issue-flow 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/{analyze-VSWAEVN3.js → analyze-7B5TORNK.js} +13 -8
  2. package/dist/analyze-7B5TORNK.js.map +1 -0
  3. package/dist/apply-WUJHDD7A.js +788 -0
  4. package/dist/apply-WUJHDD7A.js.map +1 -0
  5. package/dist/{chunk-NB6WKTBL.js → chunk-3BOHTH4V.js} +2 -2
  6. package/dist/chunk-3D4A4B46.js +2 -0
  7. package/dist/chunk-47VIN33V.js +983 -0
  8. package/dist/chunk-47VIN33V.js.map +1 -0
  9. package/dist/{chunk-DP43WJY4.js → chunk-6N7LZZ5U.js} +19 -13
  10. package/dist/chunk-6N7LZZ5U.js.map +1 -0
  11. package/dist/{chunk-KXAG24DD.js → chunk-AAY6KM7N.js} +6 -3
  12. package/dist/chunk-AAY6KM7N.js.map +1 -0
  13. package/dist/{chunk-VNKSMWDN.js → chunk-GANSDJV7.js} +4 -4
  14. package/dist/{chunk-57MH6RYJ.js → chunk-HC2MT7BX.js} +249 -181
  15. package/dist/chunk-HC2MT7BX.js.map +1 -0
  16. package/dist/chunk-HQYXVIH6.js +110 -0
  17. package/dist/chunk-HQYXVIH6.js.map +1 -0
  18. package/dist/{chunk-66ZGYXTH.js → chunk-JW7WLSZ6.js} +15 -11
  19. package/dist/chunk-JW7WLSZ6.js.map +1 -0
  20. package/dist/{chunk-M37YZYDO.js → chunk-LVKQ2AKT.js} +3 -3
  21. package/dist/{chunk-TLSIK656.js → chunk-MKD2D7WE.js} +12 -8
  22. package/dist/chunk-MKD2D7WE.js.map +1 -0
  23. package/dist/{chunk-WHEU55ZP.js → chunk-MSPUB635.js} +15 -11
  24. package/dist/chunk-MSPUB635.js.map +1 -0
  25. package/dist/chunk-OBLVLIUS.js +285 -0
  26. package/dist/chunk-OBLVLIUS.js.map +1 -0
  27. package/dist/{chunk-JGKPSWOA.js → chunk-PL6CNMVS.js} +2 -2
  28. package/dist/chunk-RKTEV6EG.js +246 -0
  29. package/dist/chunk-RKTEV6EG.js.map +1 -0
  30. package/dist/{chunk-TJMZWRS6.js → chunk-UBIQXCVE.js} +15 -11
  31. package/dist/chunk-UBIQXCVE.js.map +1 -0
  32. package/dist/{chunk-X7XBF5TS.js → chunk-VCKX262Z.js} +12 -8
  33. package/dist/chunk-VCKX262Z.js.map +1 -0
  34. package/dist/{chunk-MTJQOOMG.js → chunk-VQ5VN7DF.js} +123 -4
  35. package/dist/chunk-VQ5VN7DF.js.map +1 -0
  36. package/dist/cli.js +32 -21
  37. package/dist/cli.js.map +1 -1
  38. package/dist/{config-J5DW6HSY.js → config-4THHOXNN.js} +7 -3
  39. package/dist/execute-5OEKLM5X.js +15 -0
  40. package/dist/{generate-ERDPOTKX.js → generate-6RA2MFJB.js} +99 -12
  41. package/dist/generate-6RA2MFJB.js.map +1 -0
  42. package/dist/init-PRMOTQ7N.js +9 -0
  43. package/dist/plan-KENR6MJ3.js +17 -0
  44. package/dist/policy-XQW5NUIE.js +117 -0
  45. package/dist/policy-XQW5NUIE.js.map +1 -0
  46. package/dist/pr-KDGKG4BP.js +21 -0
  47. package/dist/pr-review-CAMAB7KO.js +17 -0
  48. package/dist/prd-V3MWDIHK.js +17 -0
  49. package/dist/review-7LN47SAN.js +15 -0
  50. package/dist/review-7LN47SAN.js.map +1 -0
  51. package/dist/{run-BRBFHVUO.js → run-H75MD5BQ.js} +26 -25
  52. package/dist/{run-BRBFHVUO.js.map → run-H75MD5BQ.js.map} +1 -1
  53. package/dist/{web-WQISLO66.js → web-ANQQTTRD.js} +5 -5
  54. package/package.json +1 -1
  55. package/prompts/analyze.md +24 -0
  56. package/prompts/execute.md +29 -1
  57. package/prompts/generate.md +61 -7
  58. package/prompts/plan.md +24 -1
  59. package/prompts/pr-review.md +65 -4
  60. package/prompts/pr.md +37 -3
  61. package/prompts/prd.md +17 -0
  62. package/prompts/review.md +40 -0
  63. package/dist/analyze-VSWAEVN3.js.map +0 -1
  64. package/dist/chunk-57MH6RYJ.js.map +0 -1
  65. package/dist/chunk-66ZGYXTH.js.map +0 -1
  66. package/dist/chunk-DP43WJY4.js.map +0 -1
  67. package/dist/chunk-DTNM3LTO.js +0 -101
  68. package/dist/chunk-DTNM3LTO.js.map +0 -1
  69. package/dist/chunk-KXAG24DD.js.map +0 -1
  70. package/dist/chunk-M72ZEPWD.js +0 -135
  71. package/dist/chunk-M72ZEPWD.js.map +0 -1
  72. package/dist/chunk-MTJQOOMG.js.map +0 -1
  73. package/dist/chunk-SLHZPB3C.js +0 -50
  74. package/dist/chunk-SLHZPB3C.js.map +0 -1
  75. package/dist/chunk-TJMZWRS6.js.map +0 -1
  76. package/dist/chunk-TLSIK656.js.map +0 -1
  77. package/dist/chunk-WHEU55ZP.js.map +0 -1
  78. package/dist/chunk-X7XBF5TS.js.map +0 -1
  79. package/dist/execute-Z2DKGVLR.js +0 -14
  80. package/dist/generate-ERDPOTKX.js.map +0 -1
  81. package/dist/init-UY6ZCIFT.js +0 -9
  82. package/dist/plan-REMAMCX4.js +0 -16
  83. package/dist/pr-KERP52TI.js +0 -20
  84. package/dist/pr-review-IU4N3TEK.js +0 -16
  85. package/dist/prd-SHVQW6RM.js +0 -16
  86. package/dist/review-L5F77QAC.js +0 -14
  87. /package/dist/{chunk-NB6WKTBL.js.map → chunk-3BOHTH4V.js.map} +0 -0
  88. /package/dist/{config-J5DW6HSY.js.map → chunk-3D4A4B46.js.map} +0 -0
  89. /package/dist/{chunk-VNKSMWDN.js.map → chunk-GANSDJV7.js.map} +0 -0
  90. /package/dist/{chunk-M37YZYDO.js.map → chunk-LVKQ2AKT.js.map} +0 -0
  91. /package/dist/{chunk-JGKPSWOA.js.map → chunk-PL6CNMVS.js.map} +0 -0
  92. /package/dist/{execute-Z2DKGVLR.js.map → config-4THHOXNN.js.map} +0 -0
  93. /package/dist/{init-UY6ZCIFT.js.map → execute-5OEKLM5X.js.map} +0 -0
  94. /package/dist/{plan-REMAMCX4.js.map → init-PRMOTQ7N.js.map} +0 -0
  95. /package/dist/{pr-KERP52TI.js.map → plan-KENR6MJ3.js.map} +0 -0
  96. /package/dist/{pr-review-IU4N3TEK.js.map → pr-KDGKG4BP.js.map} +0 -0
  97. /package/dist/{prd-SHVQW6RM.js.map → pr-review-CAMAB7KO.js.map} +0 -0
  98. /package/dist/{review-L5F77QAC.js.map → prd-V3MWDIHK.js.map} +0 -0
  99. /package/dist/{web-WQISLO66.js.map → web-ANQQTTRD.js.map} +0 -0
  100. /package/web/{CLAUDE.md → AGENTS.md} +0 -0
@@ -4,20 +4,20 @@ import {
4
4
  getWebLockFile,
5
5
  readWebLock,
6
6
  removeWebLock
7
- } from "./chunk-VNKSMWDN.js";
8
- import "./chunk-SLHZPB3C.js";
7
+ } from "./chunk-GANSDJV7.js";
8
+ import "./chunk-HQYXVIH6.js";
9
9
  import {
10
10
  ISSUES_DIR_NAME,
11
11
  PROJECTS_DIR_NAME,
12
12
  getGlobalRoot,
13
13
  loadWebConfig
14
- } from "./chunk-MTJQOOMG.js";
14
+ } from "./chunk-VQ5VN7DF.js";
15
15
  import {
16
16
  printError,
17
17
  printInfo,
18
18
  printWarning,
19
19
  sessionSnapshotSchema
20
- } from "./chunk-57MH6RYJ.js";
20
+ } from "./chunk-HC2MT7BX.js";
21
21
 
22
22
  // src/web/session-directory.ts
23
23
  import { readdir, readFile, stat as statFile } from "fs/promises";
@@ -185,4 +185,4 @@ export {
185
185
  runWebServe,
186
186
  runWebStop
187
187
  };
188
- //# sourceMappingURL=web-WQISLO66.js.map
188
+ //# sourceMappingURL=web-ANQQTTRD.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "issue-flow",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Unified CLI for orchestrating the full issue-flow pipeline via Claude Code Headless",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,3 +39,27 @@ Save your analysis to __ANALYSIS_PATH__ with this structure:
39
39
  [Key considerations, risks, dependencies]
40
40
 
41
41
  IMPORTANT: You MUST write the analysis to the file path above. Do not just output it.
42
+
43
+ <!-- if:__REPO_POLICY__ -->
44
+ ## Repository policy
45
+
46
+ The repository this runs in declares the conventions below. They were discovered
47
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
48
+ `CODEOWNERS`) and from its configuration.
49
+
50
+ __REPO_POLICY__
51
+
52
+ **This section takes precedence over any convention stated earlier in this
53
+ prompt.** Where the two disagree, follow the repository. Where the repository is
54
+ silent, the defaults above still apply.
55
+
56
+ Paths listed under "Policy documents" are pointers, not content: read them when
57
+ a decision depends on what they say.
58
+
59
+ ### Judging completeness against this repository
60
+
61
+ When the section above lists Issue Templates, the applicable one defines what a
62
+ well-formed issue of this kind is expected to carry. Judge the issue's
63
+ completeness against **its** required fields, not against a generic checklist,
64
+ and name the field that is missing rather than asking for more detail in general.
65
+ <!-- /if -->
@@ -6,7 +6,7 @@ You are an autonomous coding agent working on a software project.
6
6
 
7
7
  1. Read the PRD at `__PRD_FILE__`
8
8
  2. Read the progress log at `__PROGRESS_FILE__` (check Codebase Patterns section first)
9
- 3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create from main.
9
+ 3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create it from `__BASE_BRANCH__`.
10
10
  4. Treat the issue as unresolved if **any** `userStories[].passes` is `false`, **or** if the PRD's top-level `lastReviewFindings` is non-null — that second condition holds even when every story already passes (see "Correction Findings from a Failed Review" below).
11
11
  5. If `lastReviewFindings` is non-null, address it first (see below); otherwise pick the **highest priority** user story where `passes: false`
12
12
  6. Implement that single user story
@@ -134,3 +134,31 @@ If you need to stop for user guidance or another non-transient blocker, record i
134
134
  - Commit frequently
135
135
  - Keep CI green
136
136
  - Read the Codebase Patterns section in `__PROGRESS_FILE__` before starting
137
+
138
+ <!-- if:__REPO_POLICY__ -->
139
+ ## Repository policy
140
+
141
+ The repository this runs in declares the conventions below. They were discovered
142
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
143
+ `CODEOWNERS`) and from its configuration.
144
+
145
+ __REPO_POLICY__
146
+
147
+ **This section takes precedence over any convention stated earlier in this
148
+ prompt.** Where the two disagree, follow the repository. Where the repository is
149
+ silent, the defaults above still apply.
150
+
151
+ Paths listed under "Policy documents" are pointers, not content: read them when
152
+ a decision depends on what they say.
153
+ <!-- /if -->
154
+
155
+ <!-- if:__COMMIT_CONVENTION__ -->
156
+ ## Commit convention
157
+
158
+ This repository declares: __COMMIT_CONVENTION__
159
+
160
+ `<type>` in the commit message above is for you to choose, and it must match the
161
+ **nature of the change** — `fix` for a bug fix, `docs` for documentation, `test`,
162
+ `refactor`, `chore`, `feat` for a new capability. Committing a bug fix as `feat`
163
+ corrupts the changelog and any version bump computed from the history.
164
+ <!-- /if -->
@@ -5,13 +5,27 @@ __USER_PROMPT__
5
5
 
6
6
  Steps:
7
7
  1. Analyze the project's tech stack, architecture, and codebase
8
- 2. Check for duplicates before drafting:
8
+ 2. Decide the **human language** to write in, in this order of priority:
9
+ 1. the language the user's request is written in;
10
+ 2. the predominant language of the repository's existing issue titles
11
+ (`gh issue list --limit 10 --state all --json title --jq '.[].title'`);
12
+ 3. the language of the README;
13
+ 4. the language the user wrote in.
14
+
15
+ Use it for the title and the whole body. A backlog written in two languages
16
+ is harder to search than one written in the "wrong" one.
17
+ 3. Check for duplicates before drafting. This is a **multi-strategy search** —
18
+ one query finds only issues worded the way you happened to word yours:
9
19
  - Local issues: read `__LOCAL_ISSUES_DIR__/*/metadata.json` (the directory may not exist)
10
20
  - Remote issues, only if `gh` is installed and authenticated:
11
- `gh issue list --state open --search "<keywords>"`
12
- If an existing issue already covers the request, still emit the draft, but
13
- say so in the body under a "Possible duplicates" section.
14
- 3. Emit the issue draft in the exact format below
21
+ - 2-3 different keyword combinations drawn from the title and the core problem:
22
+ `gh issue list --search "<keyword1> <keyword2>" --state all --limit 30 --json number,title,state,url`
23
+ - the affected area, when the request names one (auth, database, API…)
24
+ - a label the request maps to, when the repository has a matching one
25
+ Judge a candidate on whether it describes the **same problem**, not on textual
26
+ overlap. If an existing issue already covers the request, still emit the draft,
27
+ but say so in the body under a "Possible duplicates" section, citing the issue.
28
+ 4. Emit the issue draft in the exact format below
15
29
 
16
30
  The issue should:
17
31
  - Have a clear, descriptive title
@@ -27,6 +41,8 @@ with no surrounding commentary:
27
41
  <issue-draft>
28
42
  <title>Concise, descriptive title</title>
29
43
  <labels>label-one, label-two</labels>
44
+ <type>Issue Type, when the repository has them</type>
45
+ <template>path of the Issue Template followed, when there is one</template>
30
46
  <body>
31
47
  Full issue body in markdown, including context and acceptance criteria.
32
48
  </body>
@@ -35,6 +51,44 @@ Full issue body in markdown, including context and acceptance criteria.
35
51
  Rules for the block:
36
52
  - `<title>` and `<body>` are required; an empty one aborts the command
37
53
  - `<labels>` is a comma-separated list; leave it empty when no label applies
38
- - Only suggest labels that already exist in the repository, or that are
39
- conventional (`bug`, `enhancement`, `documentation`)
54
+ - **Only suggest labels that already exist in this repository.** Never invent
55
+ one, and never create one. A label that does not exist is dropped before the
56
+ issue is created, so inventing one silently loses the classification. When the
57
+ section below lists the repository's labels, that list is exhaustive.
58
+ - `<type>` and `<template>` are optional: omit them entirely unless the section
59
+ below shows that this repository has Issue Types or Issue Templates
40
60
  - Write the body as plain markdown — do not wrap it in a code fence
61
+
62
+ <!-- if:__REPO_POLICY__ -->
63
+ ## Repository policy
64
+
65
+ The repository this runs in declares the conventions below. They were discovered
66
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
67
+ `CODEOWNERS`) and from its configuration.
68
+
69
+ __REPO_POLICY__
70
+
71
+ **This section takes precedence over any convention stated earlier in this
72
+ prompt.** Where the two disagree, follow the repository. Where the repository is
73
+ silent, the defaults above still apply.
74
+
75
+ Paths listed under "Policy documents" are pointers, not content: read them when
76
+ a decision depends on what they say.
77
+
78
+ ### Drafting against this repository's conventions
79
+
80
+ - **Issue Templates.** When the section above lists them, pick the one that fits
81
+ the request — by its name and description — and write the body to *its*
82
+ structure, filling every field it marks as required. Report the one you chose
83
+ in `<template>`. The default structure described earlier in this prompt is the
84
+ fallback for a repository with no template, not a floor to add on top of one.
85
+ If two templates fit equally well, say so in the body and pick the more
86
+ specific: choosing a type is the author's call, and a wrong guess is easier to
87
+ correct when it is stated.
88
+ - **Issue Types.** When the section above lists them, choose one and put it in
89
+ `<type>`. A repository with Issue Types has usually *removed* the equivalent
90
+ textual prefix from titles (`[Bug]`, `[Enhancement]`) precisely because the
91
+ information moved into a structured field — do not reintroduce it.
92
+ - **Labels.** Use only the ones listed. Anything else is dropped.
93
+ - **Title.** Follow the convention shown above when there is one.
94
+ <!-- /if -->
package/prompts/plan.md CHANGED
@@ -30,7 +30,7 @@ Create a tasks.json file at __TASKS_PATH__ with this exact structure:
30
30
  "project": "<repo-name>",
31
31
  "issueNumber": __ISSUE_NUMBER__,
32
32
  "issueUrl": "__ISSUE_URL__",
33
- "branchName": "issue/__ISSUE_NUMBER__-<slug>",
33
+ "branchName": "<branch, following __BRANCH_CONVENTION__ with N=__ISSUE_NUMBER__>",
34
34
  "description": "<brief description>",
35
35
  "issueStatus": "pending",
36
36
  "completedAt": null,
@@ -74,3 +74,26 @@ Rules:
74
74
  - The branchName should use a short kebab-case slug derived from the issue title
75
75
 
76
76
  IMPORTANT: You MUST write the tasks.json to the file path above. Do not just output it.
77
+
78
+ <!-- if:__REPO_POLICY__ -->
79
+ ## Repository policy
80
+
81
+ The repository this runs in declares the conventions below. They were discovered
82
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
83
+ `CODEOWNERS`) and from its configuration.
84
+
85
+ __REPO_POLICY__
86
+
87
+ **This section takes precedence over any convention stated earlier in this
88
+ prompt.** Where the two disagree, follow the repository. Where the repository is
89
+ silent, the defaults above still apply.
90
+
91
+ Paths listed under "Policy documents" are pointers, not content: read them when
92
+ a decision depends on what they say.
93
+ <!-- /if -->
94
+
95
+ ## Branch naming
96
+
97
+ `branchName` must follow `__BRANCH_CONVENTION__`, where `{N}` is the issue number
98
+ and `{slug}` a short kebab-case summary of the issue title. A repository that
99
+ declares its own convention above overrides this one.
@@ -25,9 +25,16 @@ Run these, in this order:
25
25
  3. `gh pr diff __PR_NUMBER__ --stat` — size and shape of the change
26
26
  4. `git log --oneline <base>..<head>` — commit history of the branch
27
27
  5. Read __TASKS_PATH__ and __PRD_PATH__ when they exist, to learn what was intended
28
- 6. Read `CLAUDE.md` (root and any nested ones near the changed files) and `README.md`
29
- to learn the project's conventions a review that contradicts the documented
30
- conventions of the repository is a wrong review
28
+ 6. Learn the repository's conventions from **its own** sources, not from prior knowledge
29
+ a review that contradicts the documented conventions of the repository is a
30
+ wrong review. When this prompt ends with a section naming the repository's
31
+ policy documents, read the ones a finding would depend on. Otherwise read
32
+ `AGENTS.md`, `CLAUDE.md` (root and any nested ones near the changed files) and
33
+ `README.md`.
34
+
35
+ Follow a pointer file rather than stopping at it: a `CLAUDE.md` whose entire
36
+ content is "Read and follow the instructions in AGENTS.md" is not a repository
37
+ without conventions, and treating it as one discards everything it forwards to.
31
38
 
32
39
  ## Step 2 — Budget the diff
33
40
 
@@ -79,6 +86,42 @@ of "no problem here", not an axis skipped.
79
86
  - **Commit messages**: do they describe the change accurately, at a useful granularity?
80
87
  - **Simplification**: concrete opportunities to achieve the same result with less code
81
88
 
89
+ <!-- if:__REPO_POLICY__ -->
90
+ - **Repository policy conformance**: does the change respect what this repository
91
+ declares about itself? Check what applies, from the section at the end of this
92
+ prompt: the issue body against its Issue Template, labels against the ones that
93
+ exist, an Issue Type where the repository uses them, the title convention, the
94
+ Pull Request body against the PR template, the **base branch**, and the branch
95
+ and commit conventions. Read the policy documents listed there for rules they
96
+ state as mandatory.
97
+
98
+ **Cite where each rule is written** — the document and its section:
99
+
100
+ > `docs/engineering/ENGINEERING-STANDARDS.md#git-workflow` requires a branch and
101
+ > a Pull Request for ordinary changes; this commit went straight to the default
102
+ > branch.
103
+
104
+ A violation without a citation is an opinion, and the author has no way to check
105
+ whether the reviewer is right.
106
+
107
+ **Calibrate the severity.** Turning every formatting divergence into a blocker
108
+ makes the review noisy, and a noisy review gets ignored:
109
+
110
+ | Situation | Severity |
111
+ |---|---|
112
+ | A rule the documentation states as mandatory | blocker |
113
+ | A required template field left out | blocker |
114
+ | Wrong base branch or wrong target | blocker |
115
+ | Formatting or naming-convention divergence | observation |
116
+ | A document the change made stale | observation, unless the rule is mandatory |
117
+
118
+ When the change touches paths with a `CODEOWNERS` entry, record who owns them.
119
+ Do **not** block on it: GitHub enforces the approval, not this review.
120
+
121
+ Never restate a repository rule as if it were your own standard, and never
122
+ invent one it does not declare.
123
+ <!-- /if -->
124
+
82
125
  Ground every finding in the diff: cite `file:line`. A finding you cannot point at is
83
126
  speculation — leave it out or mark it clearly as a question.
84
127
 
@@ -93,7 +136,8 @@ Pick exactly one recommendation, by these criteria:
93
136
  - `REQUEST_CHANGES` — at least one blocker: a bug or regression in the changed
94
137
  behaviour, a security or data-loss risk, a broken/absent test for a critical path,
95
138
  an unimplemented part of the issue/PRD, or a change that contradicts the project's
96
- documented conventions in a way that must be fixed before merge.
139
+ documented conventions in a way that must be fixed before merge — see the
140
+ severity table on the policy-conformance axis for where that line falls.
97
141
 
98
142
  A missing preference or a matter of style is never a blocker. When you hesitate
99
143
  between two verdicts, pick the more conservative one and explain why in the summary.
@@ -142,3 +186,20 @@ IMPORTANT: You MUST include the `<pr-review-result>` block, with the recommendat
142
186
  written exactly as one of `APPROVE`, `APPROVE_WITH_SUGGESTIONS` or `REQUEST_CHANGES`.
143
187
  An output without it, or with any other value, is a failed review — it is never read
144
188
  as an approval.
189
+
190
+ <!-- if:__REPO_POLICY__ -->
191
+ ## Repository policy
192
+
193
+ The repository this runs in declares the conventions below. They were discovered
194
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
195
+ `CODEOWNERS`) and from its configuration.
196
+
197
+ __REPO_POLICY__
198
+
199
+ **This section takes precedence over any convention stated earlier in this
200
+ prompt.** Where the two disagree, follow the repository. Where the repository is
201
+ silent, the defaults above still apply.
202
+
203
+ Paths listed under "Policy documents" are pointers, not content: read them when
204
+ a decision depends on what they say.
205
+ <!-- /if -->
package/prompts/pr.md CHANGED
@@ -15,8 +15,8 @@ __ISSUE_BODY__
15
15
 
16
16
  Steps:
17
17
  1. Read the task plan from __TASKS_PATH__ if it exists
18
- 2. Review the git log for this branch: git log main..HEAD --oneline
19
- 3. Review the diff: git diff main...HEAD --stat
18
+ 2. Review the git log for this branch: git log __BASE_BRANCH__..HEAD --oneline
19
+ 3. Review the diff: git diff __BASE_BRANCH__...HEAD --stat
20
20
  4. Create a well-structured PR using gh pr create
21
21
 
22
22
  The PR should:
@@ -36,6 +36,40 @@ __ISSUE_CLOSES__
36
36
  __MULTI_ISSUE_CONTEXT__
37
37
 
38
38
  Use this command format:
39
- gh pr create --title "..." --body "..." --base main
39
+ gh pr create --title "..." --body "..." --base __BASE_BRANCH__
40
40
 
41
41
  IMPORTANT: Output the PR URL after creation so it can be parsed.
42
+
43
+ <!-- if:__REPO_POLICY__ -->
44
+ ## Repository policy
45
+
46
+ The repository this runs in declares the conventions below. They were discovered
47
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
48
+ `CODEOWNERS`) and from its configuration.
49
+
50
+ __REPO_POLICY__
51
+
52
+ **This section takes precedence over any convention stated earlier in this
53
+ prompt.** Where the two disagree, follow the repository. Where the repository is
54
+ silent, the defaults above still apply.
55
+
56
+ Paths listed under "Policy documents" are pointers, not content: read them when
57
+ a decision depends on what they say.
58
+ <!-- /if -->
59
+
60
+ <!-- if:__REPO_PR_TEMPLATE__ -->
61
+ ## This repository's Pull Request template
62
+
63
+ Write the body to this template. Keep **every** heading it defines, in its order.
64
+ A section that does not apply gets one line saying why — never delete it:
65
+ automated review and the repository's own checklists key off those headings, so a
66
+ removed section reads as an unanswered one.
67
+
68
+ ```
69
+ __REPO_PR_TEMPLATE__
70
+ ```
71
+
72
+ When the repository has several templates under `.github/PULL_REQUEST_TEMPLATE/`,
73
+ pick the one matching the nature of this issue and say in the body which one you
74
+ picked. If none clearly fits, ask rather than guess.
75
+ <!-- /if -->
package/prompts/prd.md CHANGED
@@ -42,3 +42,20 @@ Save the PRD to __PRD_PATH__ with this structure:
42
42
  [External dependencies or prerequisites]
43
43
 
44
44
  IMPORTANT: You MUST write the PRD to the file path above. Do not just output it.
45
+
46
+ <!-- if:__REPO_POLICY__ -->
47
+ ## Repository policy
48
+
49
+ The repository this runs in declares the conventions below. They were discovered
50
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
51
+ `CODEOWNERS`) and from its configuration.
52
+
53
+ __REPO_POLICY__
54
+
55
+ **This section takes precedence over any convention stated earlier in this
56
+ prompt.** Where the two disagree, follow the repository. Where the repository is
57
+ silent, the defaults above still apply.
58
+
59
+ Paths listed under "Policy documents" are pointers, not content: read them when
60
+ a decision depends on what they say.
61
+ <!-- /if -->
package/prompts/review.md CHANGED
@@ -39,3 +39,43 @@ FINDINGS:
39
39
  IMPORTANT: You MUST include the <review-result> block in your output.
40
40
 
41
41
  IMPORTANT: On FAIL, these FINDINGS are saved verbatim and handed to a correction iteration that has no other context about this review session — it only sees this text. Write each finding as a self-contained, actionable defect report: name the exact file and line, describe what is wrong and why, and state (or strongly imply) what a correct fix looks like. Avoid vague findings like "tests could be improved" — either the codebase fails an acceptance criterion or a regression, or it doesn't.
42
+
43
+ <!-- if:__REPO_POLICY__ -->
44
+ ## Repository policy
45
+
46
+ The repository this runs in declares the conventions below. They were discovered
47
+ from its own files (Issue Templates, labels, `AGENTS.md`, `CONTRIBUTING.md`,
48
+ `CODEOWNERS`) and from its configuration.
49
+
50
+ __REPO_POLICY__
51
+
52
+ **This section takes precedence over any convention stated earlier in this
53
+ prompt.** Where the two disagree, follow the repository. Where the repository is
54
+ silent, the defaults above still apply.
55
+
56
+ Paths listed under "Policy documents" are pointers, not content: read them when
57
+ a decision depends on what they say.
58
+
59
+ ### Repository policy conformance
60
+
61
+ Add this as an explicit axis of the review, alongside the acceptance criteria and
62
+ the regressions:
63
+
64
+ - The branch and the commits against the conventions above.
65
+ - The changes against any rule the policy documents state as **mandatory**. Read
66
+ the documents listed there; follow a pointer file rather than stopping at it —
67
+ a `CLAUDE.md` whose whole content forwards to `AGENTS.md` is not a repository
68
+ without conventions.
69
+ - Paths with a `CODEOWNERS` entry: record who owns them, and never fail on it.
70
+
71
+ **Cite the document and section that defines every rule you invoke.** A violation
72
+ without a citation is an opinion, and the author cannot check it.
73
+
74
+ Only a rule the repository states as **mandatory** — or a required template field
75
+ left out, or a wrong base branch — belongs in FINDINGS. A formatting or naming
76
+ divergence is worth mentioning in the body of your answer, never a FAIL: a review
77
+ that fails on style is a review that gets ignored.
78
+
79
+ Never restate a repository rule as if it were your own standard, and never invent
80
+ one it does not declare.
81
+ <!-- /if -->
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/analyze.ts"],"sourcesContent":["import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { runHeadless } from '../core/headless.js';\nimport { applyPlaceholders, loadPrompt } from '../core/prompt-resolver.js';\nimport { publishPhaseMetrics } from '../core/session-metrics.js';\nimport { loadTaskPlan, saveTaskPlan } from '../core/state-manager.js';\nimport { getGlobalTimeout } from '../core/verbose.js';\nimport { issuePlaceholders, resolveCommandIssue } from '../issues/context.js';\nimport type { ResolvedIssue } from '../issues/types.js';\nimport { resolveIssuePaths } from '../storage/resolve.js';\nimport { printError, printInfo, printSuccess } from '../ui/logger.js';\n\nexport async function runAnalyze(issue: string, resolvedIssue?: ResolvedIssue): Promise<number> {\n const issueNumber = issue.replace(/^#/, '');\n const paths = await resolveIssuePaths(issueNumber);\n const analysisPath = paths.analysisFile;\n\n const resolution = await resolveCommandIssue(issueNumber, resolvedIssue);\n if (!resolution.ok) {\n return resolution.code;\n }\n\n await mkdir(paths.issueDir, { recursive: true });\n\n const template = await loadPrompt('analyze');\n const prompt = applyPlaceholders(template, {\n __ISSUE_NUMBER__: issueNumber,\n __ANALYSIS_PATH__: analysisPath,\n // Last: the Issue content is substituted in but never scanned again, so a\n // body that happens to contain a placeholder is left untouched.\n ...issuePlaceholders(resolution.resolved),\n });\n\n const startedAtMs = Date.now();\n const result = await runHeadless({\n prompt,\n maxTurns: 30,\n timeout: getGlobalTimeout() ?? 300_000,\n // json (not text) so the CLI reports usage: the envelope's `result` field\n // carries the same assistant text this phase already consumed.\n outputFormat: 'json',\n allowedTools: ['Bash', 'Read', 'Glob', 'Grep', 'Write'],\n addDirs: [paths.issueDir],\n statusMessage: `Analyzing issue #${issueNumber}...`,\n });\n // Before the success check: the tokens were spent either way.\n publishPhaseMetrics('analyze', result.cost, startedAtMs);\n\n if (!result.success) {\n printError(`Analysis failed: ${result.error}`);\n return 1;\n }\n\n // Verify the file was created\n try {\n const content = await readFile(analysisPath, 'utf-8');\n if (content.length < 10) {\n printError('Analysis file was created but appears empty');\n return 1;\n }\n } catch {\n // File wasn't created by headless — save the result as analysis\n printInfo('Headless did not create analysis file; saving output directly');\n await writeFile(analysisPath, result.result, 'utf-8');\n }\n\n // Update pipeline state\n const tasksPath = paths.tasksFile;\n try {\n const plan = await loadTaskPlan(tasksPath);\n plan.pipeline.analyzeCompleted = true;\n await saveTaskPlan(tasksPath, plan);\n } catch {\n // tasks.json may not exist yet — that's OK for standalone analyze\n }\n\n printSuccess(`Analysis saved to ${analysisPath}`);\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,UAAU,iBAAiB;AAW3C,eAAsB,WAAW,OAAe,eAAgD;AAC9F,QAAM,cAAc,MAAM,QAAQ,MAAM,EAAE;AAC1C,QAAM,QAAQ,MAAM,kBAAkB,WAAW;AACjD,QAAM,eAAe,MAAM;AAE3B,QAAM,aAAa,MAAM,oBAAoB,aAAa,aAAa;AACvE,MAAI,CAAC,WAAW,IAAI;AAClB,WAAO,WAAW;AAAA,EACpB;AAEA,QAAM,MAAM,MAAM,UAAU,EAAE,WAAW,KAAK,CAAC;AAE/C,QAAM,WAAW,MAAM,WAAW,SAAS;AAC3C,QAAM,SAAS,kBAAkB,UAAU;AAAA,IACzC,kBAAkB;AAAA,IAClB,mBAAmB;AAAA;AAAA;AAAA,IAGnB,GAAG,kBAAkB,WAAW,QAAQ;AAAA,EAC1C,CAAC;AAED,QAAM,cAAc,KAAK,IAAI;AAC7B,QAAM,SAAS,MAAM,YAAY;AAAA,IAC/B;AAAA,IACA,UAAU;AAAA,IACV,SAAS,iBAAiB,KAAK;AAAA;AAAA;AAAA,IAG/B,cAAc;AAAA,IACd,cAAc,CAAC,QAAQ,QAAQ,QAAQ,QAAQ,OAAO;AAAA,IACtD,SAAS,CAAC,MAAM,QAAQ;AAAA,IACxB,eAAe,oBAAoB,WAAW;AAAA,EAChD,CAAC;AAED,sBAAoB,WAAW,OAAO,MAAM,WAAW;AAEvD,MAAI,CAAC,OAAO,SAAS;AACnB,eAAW,oBAAoB,OAAO,KAAK,EAAE;AAC7C,WAAO;AAAA,EACT;AAGA,MAAI;AACF,UAAM,UAAU,MAAM,SAAS,cAAc,OAAO;AACpD,QAAI,QAAQ,SAAS,IAAI;AACvB,iBAAW,6CAA6C;AACxD,aAAO;AAAA,IACT;AAAA,EACF,QAAQ;AAEN,cAAU,+DAA+D;AACzE,UAAM,UAAU,cAAc,OAAO,QAAQ,OAAO;AAAA,EACtD;AAGA,QAAM,YAAY,MAAM;AACxB,MAAI;AACF,UAAM,OAAO,MAAM,aAAa,SAAS;AACzC,SAAK,SAAS,mBAAmB;AACjC,UAAM,aAAa,WAAW,IAAI;AAAA,EACpC,QAAQ;AAAA,EAER;AAEA,eAAa,qBAAqB,YAAY,EAAE;AAChD,SAAO;AACT;","names":[]}