Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion kompass.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
},

"components": {
"align-pr-branch": { "enabled": true },
"change-summary": { "enabled": true },
"changes-summary": { "enabled": true },
"commit": { "enabled": true },
Expand Down
7 changes: 2 additions & 5 deletions kompass.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"align-pr-branch": {
"$ref": "#/$defs/componentConfig"
},
"change-summary": {
"$ref": "#/$defs/componentConfig"
},
Expand Down Expand Up @@ -246,15 +243,15 @@
"type": "array",
"items": {
"type": "string",
"enum": ["align-pr-branch", "change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "skill-authoring", "summarize-changes"]
"enum": ["change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "skill-authoring", "summarize-changes"]
},
"uniqueItems": true,
"deprecated": true
},
"paths": {
"type": "object",
"propertyNames": {
"enum": ["align-pr-branch", "change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "skill-authoring", "summarize-changes"]
"enum": ["change-summary", "changes-summary", "commit", "dev-flow", "load-pr", "load-ticket", "skill-authoring", "summarize-changes"]
},
"additionalProperties": {
"type": "string"
Expand Down
6 changes: 5 additions & 1 deletion packages/core/commands/pr/fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ $ARGUMENTS

### Align Local Branch

<%~ include("@align-pr-branch", { action: "analyzing repository files or making code changes for this PR", scope: "inspect or modify local code for this PR", requiresBranch: true }) -%>
- If `<pr-branch>` is unavailable, STOP and report that the PR head branch could not be determined
- Run `gh pr checkout <pr-context.pr.number>` before analyzing repository files or making code changes for this PR
- After checkout, store the active branch as `<active-branch>`
- If checkout fails or times out, STOP and report that the PR branch could not be checked out locally; do not retry checkout unless the user explicitly asks
- Do not inspect or modify local code for this PR until `<active-branch>` equals `<pr-branch>`

### Load Changes

Expand Down
8 changes: 2 additions & 6 deletions packages/core/commands/pr/review.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ $ARGUMENTS

<%~ include("@load-pr", { config: it.config, ref: "<pr-ref>", result: "<pr-context>" }) %>

### Align Local Branch

<%~ include("@align-pr-branch", { action: "inspecting local repository files for this PR review", scope: "inspect local repository code for this PR", requiresBranch: false }) -%>

### Load Ticket Context

If `<pr-context.pr.body>` links to exactly one clear ticket:
Expand All @@ -37,13 +33,13 @@ If `<pr-context.pr.body>` links to exactly one clear ticket:

### Load Changes

Call `<%= it.config.tools.changes_load.name %>` with `base: <pr-context.pr.baseRefName>`, `head: <active-branch>`, and `depthHint: <pr-context.pr.commitCount>` only when it is a positive integer. Store as `<changes>`.
Call `<%= it.config.tools.changes_load.name %>` with `base: <pr-context.pr.baseRefName>`, `head: <pr-context.pr.headRefName>`, and `depthHint: <pr-context.pr.commitCount>` only when it is a positive integer. Store as `<changes>`.

### Review Changes

Following the reviewer agent guidance:
1. Check `<pr-context.reviews>`, `<pr-context.issueComments>`, and `<pr-context.threads>`
2. Use `<active-branch>` whenever local repository files need to be inspected alongside the diff
2. Use `<changes>` as the source of truth for changed files and diff hunks
3. Derive `<author-decisions>` from `<pr-context.issueComments>` and `<pr-context.threads>`:
- Include direct author replies that explicitly decline, defer, or intentionally narrow a suggestion and explain why they do not plan to implement it
- Treat each matching author reply as higher priority than `<ticket-context>` for that same concern, unless the current diff introduces a materially different defect with a concrete failure mode
Expand Down
18 changes: 0 additions & 18 deletions packages/core/components/align-pr-branch.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/kompass.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
},

"components": {
"align-pr-branch": { "enabled": true },
"change-summary": { "enabled": true },
"changes-summary": { "enabled": true },
"commit": { "enabled": true },
Expand Down
3 changes: 0 additions & 3 deletions packages/core/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const DEFAULT_COMMAND_NAMES = [
export const DEFAULT_AGENT_NAMES = ["worker", "navigator", "planner", "reviewer"] as const;

export const DEFAULT_COMPONENT_NAMES = [
"align-pr-branch",
"change-summary",
"changes-summary",
"commit",
Expand Down Expand Up @@ -132,7 +131,6 @@ export interface KompassConfig {
ticket_load?: ToolConfig;
};
components?: {
"align-pr-branch"?: ComponentConfig;
"change-summary"?: ComponentConfig;
"changes-summary"?: ComponentConfig;
commit?: ComponentConfig;
Expand Down Expand Up @@ -447,7 +445,6 @@ const defaultAgentPlanner: AgentDefinition = {
};

const defaultComponentPaths: Record<string, string> = {
"align-pr-branch": "components/align-pr-branch.md",
"change-summary": "components/change-summary.md",
"changes-summary": "components/changes-summary.md",
"commit": "components/commit.md",
Expand Down
18 changes: 9 additions & 9 deletions packages/core/test/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ describe("resolveCommands", () => {
assert.deepEqual(commands["pr/review"]?.config, { enabled: true });
});

test("skips PR checkout when pr/review is already at PR head", async () => {
test("loads pr/review changes without checking out the PR branch", async () => {
const commands = await resolveCommands(process.cwd());
const template = commands["pr/review"]?.template ?? "";

assert.match(template, /git rev-parse HEAD/);
assert.match(template, /`<current-head>` equals `<pr-context\.pr\.headRefOid>`/);
assert.match(template, /Run `gh pr checkout <pr-context\.pr\.number>`/);
assert.match(template, /do not retry checkout unless the user explicitly asks/);
assert.match(template, /head: <pr-context\.pr\.headRefName>/);
assert.match(template, /Use `<changes>` as the source of truth/);
assert.doesNotMatch(template, /Run `gh pr checkout <pr-context\.pr\.number>`/);
assert.doesNotMatch(template, /<active-branch>/);
});

test("requires PR branch for pr/fix checkout alignment", async () => {
test("requires PR branch checkout for pr/fix", async () => {
const commands = await resolveCommands(process.cwd());
const template = commands["pr/fix"]?.template ?? "";

assert.match(template, /`<current-branch>` equals `<pr-branch>` and `<current-head>` equals `<pr-context\.pr\.headRefOid>`/);
assert.match(template, /`<current-branch>` differs from `<pr-branch>` or `<current-head>` differs from `<pr-context\.pr\.headRefOid>`/);
assert.match(template, /Do not inspect or modify local code for this PR until `<active-branch>` equals `<pr-branch>` and `<current-head>` equals `<pr-context\.pr\.headRefOid>`/);
assert.match(template, /Run `gh pr checkout <pr-context\.pr\.number>` before analyzing repository files or making code changes for this PR/);
assert.match(template, /Do not inspect or modify local code for this PR until `<active-branch>` equals `<pr-branch>`/);
assert.doesNotMatch(template, /`<current-branch>` differs from `<pr-branch>` or `<current-head>` differs from `<pr-context\.pr\.headRefOid>`/);
});
});
11 changes: 4 additions & 7 deletions packages/opencode/.opencode/commands/pr/fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,10 @@ $ARGUMENTS
### Align Local Branch

- If `<pr-branch>` is unavailable, STOP and report that the PR head branch could not be determined
- If `<current-branch>` equals `<pr-branch>` and `<current-head>` equals `<pr-context.pr.headRefOid>`, store `<current-branch>` as `<active-branch>` and do not checkout again
- If `<current-branch>` differs from `<pr-branch>` or `<current-head>` differs from `<pr-context.pr.headRefOid>`:
- Run `gh pr checkout <pr-context.pr.number>` before analyzing repository files or making code changes for this PR
- After checkout, store the active branch as `<active-branch>`
- Run `git rev-parse HEAD` again and store the trimmed result as `<current-head>`
- If checkout fails or times out, STOP and report that the PR branch could not be checked out locally; do not retry checkout unless the user explicitly asks
- Do not inspect or modify local code for this PR until `<active-branch>` equals `<pr-branch>` and `<current-head>` equals `<pr-context.pr.headRefOid>`
- Run `gh pr checkout <pr-context.pr.number>` before analyzing repository files or making code changes for this PR
- After checkout, store the active branch as `<active-branch>`
- If checkout fails or times out, STOP and report that the PR branch could not be checked out locally; do not retry checkout unless the user explicitly asks
- Do not inspect or modify local code for this PR until `<active-branch>` equals `<pr-branch>`

### Load Changes

Expand Down
15 changes: 2 additions & 13 deletions packages/opencode/.opencode/commands/pr/review.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ $ARGUMENTS
- Review attached images, screenshots, videos, PDFs, and other linked files whenever they can affect the requested fix, review outcome, reproduction steps, or acceptance criteria
- If any relevant attachment cannot be accessed, note that gap and continue only when the remaining PR context is still sufficient to proceed reliably

### Align Local Branch

- If `<pr-branch>` is unavailable, STOP and report that the PR head branch could not be determined
- If `<current-head>` equals `<pr-context.pr.headRefOid>`, store `<current-branch>` as `<active-branch>` when `<current-branch>` is available; otherwise store `<current-head>` as `<active-branch>`. Do not checkout because the worktree is already at the PR head commit.
- If `<current-head>` differs from `<pr-context.pr.headRefOid>`:
- Run `gh pr checkout <pr-context.pr.number>` before inspecting local repository files for this PR review
- After checkout, store the active branch as `<active-branch>`
- Run `git rev-parse HEAD` again and store the trimmed result as `<current-head>`
- If checkout fails or times out, STOP and report that the PR branch could not be checked out locally; do not retry checkout unless the user explicitly asks
- Do not inspect local repository code for this PR until `<current-head>` equals `<pr-context.pr.headRefOid>`

### Load Ticket Context

If `<pr-context.pr.body>` links to exactly one clear ticket:
Expand All @@ -63,13 +52,13 @@ If `<pr-context.pr.body>` links to exactly one clear ticket:

### Load Changes

Call `kompass_changes_load` with `base: <pr-context.pr.baseRefName>`, `head: <active-branch>`, and `depthHint: <pr-context.pr.commitCount>` only when it is a positive integer. Store as `<changes>`.
Call `kompass_changes_load` with `base: <pr-context.pr.baseRefName>`, `head: <pr-context.pr.headRefName>`, and `depthHint: <pr-context.pr.commitCount>` only when it is a positive integer. Store as `<changes>`.

### Review Changes

Following the reviewer agent guidance:
1. Check `<pr-context.reviews>`, `<pr-context.issueComments>`, and `<pr-context.threads>`
2. Use `<active-branch>` whenever local repository files need to be inspected alongside the diff
2. Use `<changes>` as the source of truth for changed files and diff hunks
3. Derive `<author-decisions>` from `<pr-context.issueComments>` and `<pr-context.threads>`:
- Include direct author replies that explicitly decline, defer, or intentionally narrow a suggestion and explain why they do not plan to implement it
- Treat each matching author reply as higher priority than `<ticket-context>` for that same concern, unless the current diff introduces a materially different defect with a concrete failure mode
Expand Down
1 change: 0 additions & 1 deletion packages/opencode/kompass.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
},

"components": {
"align-pr-branch": { "enabled": true },
"change-summary": { "enabled": true },
"changes-summary": { "enabled": true },
"commit": { "enabled": true },
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Kompass command templates can include reusable Eta partials from `packages/core/

Bundled components:

- `align-pr-branch`
- `change-summary`
- `changes-summary`
- `commit`
Expand All @@ -19,10 +18,6 @@ Bundled components:

## Bundled components

### `align-pr-branch`

Guides PR-scoped commands to switch onto the PR head branch with `gh pr checkout`, capture the active branch, and stop if local work is not aligned to the PR branch.

### `change-summary`

Loads changes with `changes_load`, analyzes file-level diffs, and groups the work into concise what/why themes.
Expand Down
Loading