ghostrail 0.16.0 → 0.17.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 (51) hide show
  1. package/dist/cli/commands.d.ts.map +1 -1
  2. package/dist/cli/commands.js +106 -16
  3. package/dist/cli/commands.js.map +1 -1
  4. package/dist/commands/help.d.ts.map +1 -1
  5. package/dist/commands/help.js +4 -3
  6. package/dist/commands/help.js.map +1 -1
  7. package/dist/factory/build.d.ts.map +1 -1
  8. package/dist/factory/build.js +1 -0
  9. package/dist/factory/build.js.map +1 -1
  10. package/dist/init/regions.d.ts +76 -0
  11. package/dist/init/regions.d.ts.map +1 -0
  12. package/dist/init/regions.js +247 -0
  13. package/dist/init/regions.js.map +1 -0
  14. package/dist/init/template.d.ts +7 -1
  15. package/dist/init/template.d.ts.map +1 -1
  16. package/dist/init/template.js +37 -2
  17. package/dist/init/template.js.map +1 -1
  18. package/dist/publish/gh.d.ts +8 -0
  19. package/dist/publish/gh.d.ts.map +1 -1
  20. package/dist/publish/gh.js +12 -0
  21. package/dist/publish/gh.js.map +1 -1
  22. package/dist/publish/githost.d.ts +8 -0
  23. package/dist/publish/githost.d.ts.map +1 -1
  24. package/dist/publish/githost.js.map +1 -1
  25. package/dist/publish/index.d.ts +1 -1
  26. package/dist/publish/index.d.ts.map +1 -1
  27. package/dist/publish/index.js +1 -1
  28. package/dist/publish/index.js.map +1 -1
  29. package/dist/respond/index.d.ts +3 -2
  30. package/dist/respond/index.d.ts.map +1 -1
  31. package/dist/respond/index.js +3 -2
  32. package/dist/respond/index.js.map +1 -1
  33. package/dist/respond/merge.d.ts +13 -0
  34. package/dist/respond/merge.d.ts.map +1 -0
  35. package/dist/respond/merge.js +181 -0
  36. package/dist/respond/merge.js.map +1 -0
  37. package/dist/respond/respond.d.ts +25 -5
  38. package/dist/respond/respond.d.ts.map +1 -1
  39. package/dist/respond/respond.js +57 -28
  40. package/dist/respond/respond.js.map +1 -1
  41. package/dist/respond/select.d.ts +15 -0
  42. package/dist/respond/select.d.ts.map +1 -1
  43. package/dist/respond/select.js +17 -0
  44. package/dist/respond/select.js.map +1 -1
  45. package/package.json +1 -1
  46. package/skill/ghostrail/SKILL.md +80 -10
  47. package/templates/code/prompts/resolve-issue.md +13 -4
  48. package/templates/code/prompts/respond.md +4 -0
  49. package/templates/code/prompts/triage.md +6 -0
  50. package/templates/content/prompts/draft.md +6 -0
  51. package/templates/content/prompts/respond.md +4 -0
@@ -5,7 +5,7 @@ user-invocable: true
5
5
  argument-hint: "[customize | init | update | doctor | status | run | respond | triage]"
6
6
  license: Apache-2.0
7
7
  metadata:
8
- version: 0.5.0
8
+ version: 0.7.0
9
9
  allowed-tools:
10
10
  - Read
11
11
  - Write
@@ -66,9 +66,24 @@ this tailors them to *this* repo. Never guess: read before proposing.
66
66
  - `[gate].commands` — mirroring CI exactly.
67
67
  - `[source]` — the team/project/label/assignee filters, if you can tell what
68
68
  they should be. Ask rather than invent tracker identifiers.
69
- 4. **Do not touch** `[output].auto_merge` (it must stay `false`) or invent
69
+ 4. **Managed regions are structural. Never edit inside one.** A scaffolded
70
+ prompt marks the parts ghostrail owns:
71
+
72
+ ```markdown
73
+ <!-- ghostrail:managed id="result-contract" -->
74
+ ...ghostrail's text...
75
+ <!-- /ghostrail:managed -->
76
+ ```
77
+
78
+ Rewrite anything *outside* those markers freely: that is the whole point of
79
+ customize. Inside one, change nothing, and never move, rename, reorder, or
80
+ delete a marker. Those regions are how `<GR> init --update` carries a later
81
+ template fix into this repo without touching your wording; editing one turns
82
+ a silent merge into a conflict you have to port by hand forever after. If a
83
+ managed region genuinely blocks this repo, say so rather than editing it.
84
+ 5. **Do not touch** `[output].auto_merge` (it must stay `false`) or invent
70
85
  credentials.
71
- 5. **Never run `<GR> run`, `<GR> triage`, or `<GR> respond` to check your edits.**
86
+ 6. **Never run `<GR> run`, `<GR> triage`, or `<GR> respond` to check your edits.**
72
87
  Those act on real tracker items, per the confirm-first rule under **run ·
73
88
  respond · triage** below, and that rule has no "just checking" exception:
74
89
  zero eligible items still means the command executed for real. If you want
@@ -112,18 +127,69 @@ Carry a template improvement into a repo that has customized its prompts. Run:
112
127
  <GR> init <template> --update
113
128
  ```
114
129
 
115
- It writes only files this repo never edited (proved by the baseline in
116
- `ghostrail.template.json`), and it never touches a customized file. For those it
117
- prints **signals**: what the template gained that the repo's copy lacks.
130
+ It does as much as it can prove, in three steps.
131
+
132
+ **Files this repo never edited** (proved by the baseline in
133
+ `ghostrail.template.json`) are taken whole.
134
+
135
+ **Managed regions inside a customized file are merged in place.** A region the
136
+ repo never edited is rewritten from the template, and a region the template
137
+ added is inserted. The file's editable text is never touched, and the file's own
138
+ baseline is deliberately not re-recorded, so the customization stays protected.
139
+
140
+ **Everything left over is reported**, as before: the placeholders and result
141
+ fields the template gained that the repo's copy still lacks.
118
142
 
119
143
  ```
120
144
  ghostrail/prompts/resolve-issue.md
121
- customized, and the template gained:
122
- placeholder {{description}}
123
- result field "testPlan"
145
+ customized:
146
+ updated result-contract
147
+ inserted prior-discussion
148
+ edited locally item (left alone; port it by hand)
149
+ placeholder {{description}}
124
150
  ```
125
151
 
126
- Placing those is your job, and it is not a text merge. A customized prompt can
152
+ The first two lines already happened; you do not need to do anything about them
153
+ beyond telling the user. The rest is your job, and it is not a text merge.
154
+
155
+ `edited locally` means someone edited inside a region ghostrail owns, so it was
156
+ left alone rather than overwritten. Port the template's version of that region
157
+ into the repo's copy by hand, keeping any local change that was deliberate. It
158
+ keeps being reported until the region matches the template exactly.
159
+
160
+ `unplaceable` means the template added a region and this file shares no managed
161
+ region to anchor it against.
162
+
163
+ `adopting regions: N/M` means the file has markers but no recorded baselines
164
+ yet, so nothing could be merged. See **adopting regions** below.
165
+
166
+ ### Adopting regions in a repo that predates them
167
+
168
+ A prompt scaffolded before regions existed has no markers, so `--update` says
169
+ nothing about them and behaves exactly as it always did. Getting such a repo
170
+ onto regions is a one-time guided pass, and it is incremental: you do not have
171
+ to finish it in one go.
172
+
173
+ 1. **Add the markers**, around the text in the repo's copy that already
174
+ corresponds to each region. Read the template's copy to see the region ids
175
+ and what each one covers, then wrap the repo's own equivalent text. Do not
176
+ reword anything while doing this; you are only marking boundaries.
177
+ 2. **Bring each managed region to the template's current text.** This is the
178
+ same hand port the signal report has always asked for, done once. Keep the
179
+ repo's wording *outside* the markers; inside them, the template's text wins,
180
+ because that is what ghostrail is taking ownership of.
181
+ 3. **Re-run `<GR> init <template> --update`.** Every region that now matches the
182
+ template is recorded, and the report says how many. Regions you have not
183
+ ported yet are simply reported again.
184
+
185
+ The useful part is that step 3 does not need step 2 to be complete. As soon as
186
+ *one* region matches, that file has baselines, so a region the template added
187
+ gets inserted automatically on the next run and only the regions you actually
188
+ still differ on keep asking for attention. Repeat until the file reports
189
+ `customized, nothing to take`.
190
+
191
+ Never do this by taking the template's whole file. That throws away the
192
+ customization, which is the thing the whole design exists to protect. A customized prompt can
127
193
  be a near-total rewrite that still needs the same one-line addition, so port the
128
194
  **intent**, not the template's wording:
129
195
 
@@ -139,6 +205,10 @@ be a near-total rewrite that still needs the same one-line addition, so port the
139
205
  5. Re-run `<GR> init <template> --update` and confirm it now reports
140
206
  `customized, nothing to take`.
141
207
 
208
+ Never place a signal by editing inside a managed region, and never delete a
209
+ marker to make a report go away. The markers are what make the next update a
210
+ merge instead of another hand port.
211
+
142
212
  Verify a placeholder actually renders before anyone spends a run on it:
143
213
 
144
214
  ```
@@ -8,6 +8,7 @@ and PRs.
8
8
 
9
9
  Match the surrounding code: its style, patterns, and test conventions.
10
10
 
11
+ <!-- ghostrail:managed id="item" -->
11
12
  ## The issue
12
13
  - ID: {{id}}
13
14
  - Title: {{title}}
@@ -16,13 +17,16 @@ Match the surrounding code: its style, patterns, and test conventions.
16
17
  ### Description
17
18
 
18
19
  {{description}}
20
+ <!-- /ghostrail:managed -->
19
21
 
22
+ <!-- ghostrail:managed id="prior-discussion" -->
20
23
  ## Prior discussion
21
24
 
22
25
  If `.ghostrail/comments.md` exists, read it. It holds the comment thread on
23
26
  this issue, oldest first, and it can include a question a previous run of the
24
27
  factory asked and a human's reply. Treat an already-answered question as
25
28
  settled and act on the answer; do not ask it again.
29
+ <!-- /ghostrail:managed -->
26
30
 
27
31
  ## What to do
28
32
  1. Locate the relevant code and understand how it is structured.
@@ -30,6 +34,7 @@ settled and act on the answer; do not ask it again.
30
34
  3. Add or update tests (author them from the intent, not the implementation).
31
35
  4. Run the project's lint, typecheck, and unit-test commands and fix what you touched.
32
36
 
37
+ <!-- ghostrail:managed id="result-contract" -->
33
38
  ## Reporting your result (required, do this last)
34
39
  Write a JSON file at `.ghostrail/result.json` with exactly one of:
35
40
 
@@ -38,15 +43,19 @@ Write a JSON file at `.ghostrail/result.json` with exactly one of:
38
43
  - `{"status":"failed","error":"<why>"}`
39
44
  - `{"status":"noop","reason":"<why nothing needed changing>"}`
40
45
 
41
- `type` is the conventional-commit type for the change; it sets the commit and PR
42
- title. If you omit it, the factory's configured default is used.
46
+ `type` is the conventional-commit type for the change (pick the one that fits:
47
+ `feat` for a feature, `fix` for a bug, `docs`, `refactor`, ...); it sets the
48
+ commit and PR title. If you omit it, the factory's configured default is used.
49
+
50
+ `summary` and `testPlan` are rendered into the pull request body under headings
51
+ the factory supplies, so do not add headings of your own.
52
+ <!-- /ghostrail:managed -->
43
53
 
44
54
  `summary` and `testPlan` are the pull request a human reads, so write them for
45
55
  that reader rather than as a log of what you did:
46
56
 
47
57
  - **`summary`**: one or two sentences on what changed and why, then markdown
48
- bullets for the specifics. Do not write a single long paragraph, and do not
49
- add headings; the factory supplies its own.
58
+ bullets for the specifics. Do not write a single long paragraph.
50
59
  - **`testPlan`**: the steps someone runs to check this by hand. Concrete
51
60
  commands, what to look at, and what they should see. The gate has already run
52
61
  lint, typecheck, and the unit suite, so do not just repeat those: give the
@@ -5,9 +5,11 @@ of an open pull request. New human feedback has been left on the PR or its track
5
5
  issue. Address it. You may only read and write files and run shell commands in
6
6
  this workspace. Do not use git: the factory owns commits and pushes.
7
7
 
8
+ <!-- ghostrail:managed id="feedback" -->
8
9
  ## The feedback
9
10
  Read `.ghostrail/feedback.md`. It contains the new comments (author and time),
10
11
  newest work last. Treat it as the review to act on.
12
+ <!-- /ghostrail:managed -->
11
13
 
12
14
  ## What to do
13
15
  1. Read the feedback and the current state of the branch.
@@ -16,6 +18,7 @@ newest work last. Treat it as the review to act on.
16
18
  4. If a comment is a question rather than a change request, answer it in your result
17
19
  (see `blocked`) instead of guessing.
18
20
 
21
+ <!-- ghostrail:managed id="result-contract" -->
19
22
  ## Reporting your result (required, do this last)
20
23
  Write a JSON file at `.ghostrail/result.json` with exactly one of:
21
24
 
@@ -23,5 +26,6 @@ Write a JSON file at `.ghostrail/result.json` with exactly one of:
23
26
  - `{"status":"blocked","questions":"<what you need answered>"}`
24
27
  - `{"status":"failed","error":"<why>"}`
25
28
  - `{"status":"noop","reason":"<why nothing needed changing>"}`
29
+ <!-- /ghostrail:managed -->
26
30
 
27
31
  On `done` the factory commits and pushes to the PR branch and posts a summary.
@@ -5,6 +5,7 @@ NOT to fix it: it is to decide whether the issue is too large to fix in one pass
5
5
  and, if so, propose how to break it into smaller, ordered sub-issues. Do not use
6
6
  git and do not change any source files except the two output files below.
7
7
 
8
+ <!-- ghostrail:managed id="item" -->
8
9
  ## The issue
9
10
  - ID: {{id}}
10
11
  - Title: {{title}}
@@ -13,13 +14,16 @@ git and do not change any source files except the two output files below.
13
14
  ### Description
14
15
 
15
16
  {{description}}
17
+ <!-- /ghostrail:managed -->
16
18
 
19
+ <!-- ghostrail:managed id="prior-discussion" -->
17
20
  ## Prior discussion
18
21
 
19
22
  If `.ghostrail/comments.md` exists, read it. It holds the comment thread on
20
23
  this issue, oldest first, and it can include a question a previous triage pass
21
24
  asked and a human's reply. Treat an already-answered question as settled and
22
25
  act on the answer; do not ask it again.
26
+ <!-- /ghostrail:managed -->
23
27
 
24
28
  ## What to do
25
29
  1. Read the issue and enough of the codebase to judge its scope.
@@ -33,6 +37,7 @@ act on the answer; do not ask it again.
33
37
  when you produced a plan, or `{"status":"blocked","questions":"<what you need>"}`
34
38
  if you genuinely cannot decide without a human.
35
39
 
40
+ <!-- ghostrail:managed id="triage-schema" -->
36
41
  ## `.ghostrail/triage.json` schema
37
42
 
38
43
  Atomic (no split):
@@ -57,6 +62,7 @@ Split into sub-issues:
57
62
  - `dependsOn` lists the indices of earlier sub-issues (0-based, all strictly
58
63
  less than the current one) that must be done first.
59
64
  - Keep titles imperative and specific. Each sub-issue should stand on its own.
65
+ <!-- /ghostrail:managed -->
60
66
 
61
67
  The factory creates the sub-issues (unassigned) and a human assigns each to the
62
68
  bot to start work; the parent leaves the triage queue.
@@ -4,6 +4,7 @@ You are a writing agent working in an isolated checkout. Write the piece
4
4
  described below as a Markdown file. You may only read and write files. Do not use
5
5
  git: the factory owns commits, branches, and PRs.
6
6
 
7
+ <!-- ghostrail:managed id="item" -->
7
8
  ## The brief
8
9
  - ID: {{id}}
9
10
  - Title: {{title}}
@@ -12,13 +13,16 @@ git: the factory owns commits, branches, and PRs.
12
13
  ### Description
13
14
 
14
15
  {{description}}
16
+ <!-- /ghostrail:managed -->
15
17
 
18
+ <!-- ghostrail:managed id="prior-discussion" -->
16
19
  ## Prior discussion
17
20
 
18
21
  If `.ghostrail/comments.md` exists, read it. It holds the comment thread on
19
22
  this item, oldest first, and it can include a question a previous run of the
20
23
  factory asked and a human's reply. Treat an already-answered question as
21
24
  settled and act on the answer; do not ask it again.
25
+ <!-- /ghostrail:managed -->
22
26
 
23
27
  ## Shared references
24
28
  Read any files under `.ghostrail/artifacts/` (voice and style, formats,
@@ -29,6 +33,7 @@ strategy). Follow them closely: they define how this work should read.
29
33
  2. Match the voice, structure, and formats in the shared references.
30
34
  3. Do not publish or post anything; produce a draft only.
31
35
 
36
+ <!-- ghostrail:managed id="result-contract" -->
32
37
  ## Reporting your result (required, do this last)
33
38
  Write `.ghostrail/result.json` with exactly one of:
34
39
 
@@ -36,5 +41,6 @@ Write `.ghostrail/result.json` with exactly one of:
36
41
  - `{"status":"blocked","questions":"<what you need decided>"}`
37
42
  - `{"status":"failed","error":"<why>"}`
38
43
  - `{"status":"noop","reason":"<why nothing needed changing>"}`
44
+ <!-- /ghostrail:managed -->
39
45
 
40
46
  The factory opens a draft pull request for a human to review.
@@ -6,9 +6,11 @@ tracker issue. Revise the draft to address it. You may only read and write files
6
6
  and run shell commands in this workspace. Do not use git: the factory owns commits
7
7
  and pushes.
8
8
 
9
+ <!-- ghostrail:managed id="feedback" -->
9
10
  ## The feedback
10
11
  Read `.ghostrail/feedback.md`. It contains the new comments (author and time),
11
12
  newest work last. Treat it as the editorial review to act on.
13
+ <!-- /ghostrail:managed -->
12
14
 
13
15
  ## What to do
14
16
  1. Read the feedback and the current draft on this branch.
@@ -16,6 +18,7 @@ newest work last. Treat it as the editorial review to act on.
16
18
  3. If a comment is a question rather than a change, answer it in your result
17
19
  (`blocked`) instead of guessing.
18
20
 
21
+ <!-- ghostrail:managed id="result-contract" -->
19
22
  ## Reporting your result (required, do this last)
20
23
  Write a JSON file at `.ghostrail/result.json` with exactly one of:
21
24
 
@@ -23,3 +26,4 @@ Write a JSON file at `.ghostrail/result.json` with exactly one of:
23
26
  - `{"status":"blocked","questions":"<what you need answered>"}`
24
27
  - `{"status":"failed","error":"<why>"}`
25
28
  - `{"status":"noop","reason":"<why nothing needed changing>"}`
29
+ <!-- /ghostrail:managed -->