@fro.bot/systematic 3.25.1 → 3.26.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.
@@ -63,12 +63,14 @@ Use the current branch and existing PR check from context. If the current branch
63
63
 
64
64
  ### DU-3: Write and apply the updated description
65
65
 
66
- Read the current PR description to drive the compare-and-confirm step later:
66
+ Read the current PR description. It drives the compare-and-confirm step later, and it is saved to an old body file for the carry:
67
67
 
68
68
  ```bash
69
- gh pr view --json body --jq '.body'
69
+ OLD_BODY_FILE=$(mktemp) && gh pr view "<PR URL>" --json body --jq '.body' > "$OLD_BODY_FILE" && cat "$OLD_BODY_FILE" && echo saved
70
70
  ```
71
71
 
72
+ When the command does not print `saved`, the temp file could not be created or the `gh` read failed. Stop and apply nothing, because the current description was never saved. Tell the user why, remove the old file, and ask how to proceed.
73
+
72
74
  **Generate the updated title and body** — using the PR URL from DU-2 and the commit range it covers, write an updated PR title and body. The URL preserves repo/PR identity even when invoked from a worktree or subdirectory. If the user provided a focus (e.g., "include the benchmarking results"), incorporate it into the generated content. Write the body to an OS temp file:
73
75
 
74
76
  ```bash
@@ -80,7 +82,13 @@ EOF
80
82
 
81
83
  If the PR is not open or the commit range cannot be resolved, report the issue and stop.
82
84
 
83
- **Evidence decision:** Preserve any existing `## Demo` or `## Screenshots` block from the current body by default. If the user's focus asks to refresh or remove evidence, honor that intent.
85
+ **Evidence decision:** Preserve any existing `## Demo` or `## Screenshots` block from the current body by default. Carry the `## Demo` section with `mode:carry`, by following Carrying the Demo section: `old=` is the old body file saved above, and `new=` is the body file written above. The carry always runs, and it runs before the compare-and-confirm step. If the user's focus asks to refresh or remove evidence, honor that intent and skip the carry. When the carry ends, remove the old file:
86
+
87
+ ```bash
88
+ rm -f "$OLD_BODY_FILE"
89
+ ```
90
+
91
+ Do not offer to publish images here. If the user asks to attach local images, route that request to `systematic:pr-attachments` in PR mode, with the image paths as its only tokens. PR mode writes the Demo section itself, and a later rewrite carries it through.
84
92
 
85
93
  **Compare and confirm** — briefly explain what the new description covers differently from the old one. This helps the user decide whether to apply; the description itself does not narrate these differences. Summarize from the body already in context (from the bash call that wrote `body_file`); do not `cat` the temp file, which would re-emit the body.
86
94
 
@@ -147,7 +155,8 @@ If the PR check returned `state: OPEN`, note the URL -- this is the existing-PR
147
155
 
148
156
  1. If on the default branch, create a feature branch first with `git checkout -b <branch-name>`.
149
157
  2. Scan changed files for naturally distinct concerns. If files clearly group into separate logical changes, create separate commits (2-3 max). Group at the file level only (no `git add -p`). When ambiguous, one commit is fine.
150
- 3. Stage and commit each group in a single call. Avoid `git add -A` or `git add .`. Follow conventions from Step 2:
158
+ 3. Never stage an untracked image file without asking. Image files are PNG, JPEG, GIF and WebP, such as `.png` or `.jpg`. A screenshot meant for the PR description is evidence, not part of the change, so it stays out of the feature commit. When untracked images exist, ask the evidence-source question from Step 6 first, and do not ask again in Step 6. Stage an image only when the user says it is part of the change.
159
+ 4. Stage and commit each group in a single call. Avoid `git add -A` or `git add .`. Follow conventions from Step 2:
151
160
  ```bash
152
161
  git add file1 file2 file3 && git commit -m "$(cat <<'EOF'
153
162
  commit message here
@@ -199,8 +208,24 @@ Use this branch diff (not the working-tree diff) for the evidence decision. If t
199
208
  **Evidence decision (before delegation).** If the branch diff changes observable behavior (UI, CLI output, API behavior with runnable code, generated artifacts, workflow output) and evidence is not otherwise blocked (unavailable credentials, paid services, deploy-only infrastructure, hardware), ask: "This PR has observable behavior. Capture evidence for the PR description?"
200
209
 
201
210
  - **Use existing evidence** -- ask for the URL or markdown embed, then splice it into the PR body as a `## Demo` section before applying.
211
+ - **Publish local images** -- publish image files from this machine as commit-pinned embeds. Ask for the image paths, or offer the untracked images found in Step 4. Then load the `systematic:pr-attachments` skill in embed mode. State the tokens in the instruction text only, because some hosts pass no skill arguments and the same tokens in two places would be read twice. For example: `mode:embed shots/a.png "shots/b c.png"`. Wrap a path that has spaces in double quotes.
202
212
  - **Skip** -- proceed with no evidence section.
203
213
 
214
+ The skill ends with one status line:
215
+
216
+ ```text
217
+ pr-attachments: status=ok evidence_sha=<40-hex> demo_file=<path> images=<count>
218
+ pr-attachments: status=failed evidence=<pushed|local|none> reason=<reason>
219
+ ```
220
+
221
+ - `status=ok`: take `demo_file` from the line. The file holds the Demo section. Keep it for the splice below. The narrative range below does not use `evidence_sha`.
222
+ - `status=failed` with `evidence=pushed`: the evidence files are pushed but unreferenced. Tell the user the reason, and keep the image paths for the retry command in Step 8. Then continue without evidence.
223
+ - `status=failed` with `evidence=local`: the evidence commit is local and unpushed. It exists only on this machine, and the remote does not hold it. Tell the user the reason and that the branch needs a push (after a fetch and a rebase or merge, when the push was rejected) before the images can be published. Then continue without evidence.
224
+ - `status=failed` with `reason=blob-mismatch`: the exception to the push advice above. The local evidence commit holds an image that git changed on its way in, for example through a `.gitattributes` setting or a hook. Tell the user it must not be pushed as it is, and continue without evidence.
225
+ - `status=failed` with `evidence=none`: nothing was published. Tell the user the reason, then continue without evidence.
226
+
227
+ **Fallback.** If loading `systematic:pr-attachments` fails, or it loads but sees no `mode:` token and stops without a status line, offer only the two existing options: **Use existing evidence** and **Skip**.
228
+
204
229
  When evidence is not possible (docs-only, markdown-only, changelog-only, release metadata, CI/config-only, test-only, or pure internal refactors), skip without asking.
205
230
 
206
231
  **Generate title and body.** Using the branch diff and commit log, write a PR title and body directly:
@@ -213,7 +238,19 @@ When evidence is not possible (docs-only, markdown-only, changelog-only, release
213
238
  <generated body>
214
239
  EOF
215
240
  ```
216
- - Splice any captured evidence as a `## Demo` section into the body file before applying.
241
+ - Splice any captured evidence as a `## Demo` section into the body file before applying. For the file that **Publish local images** returned, append it with the shell and delete it once it is appended, so no SHA is retyped:
242
+ ```bash
243
+ printf '\n' >> "<body_file>" && cat "<demo_file>" >> "<body_file>" && rm -f "<demo_file>"
244
+ ```
245
+
246
+ **Narrative range after publishing.** An evidence commit on the branch is housekeeping, not part of the change. Use the same two commands on every path: `status=ok`, `status=failed` with `evidence=pushed`, and no publish at all. Both leave `docs/evidence/**` out by path, so a commit that touches only evidence files drops out of the log on its own, and later feature commits stay in:
247
+
248
+ ```bash
249
+ git log --oneline <base-remote>/<base-branch>..HEAD -- . ':(exclude)docs/evidence/**'
250
+ git diff <base-remote>/<base-branch>...HEAD -- . ':(exclude)docs/evidence/**'
251
+ ```
252
+
253
+ Fill in the real values each time. No shell variable carries values from one call to the next.
217
254
 
218
255
  If the branch diff is empty or the base ref is unresolved, report the issue and stop — do not create or edit the PR.
219
256
 
@@ -233,7 +270,21 @@ Keep the title under 72 characters.
233
270
 
234
271
  The new commits are already on the PR from Step 5. Report the PR URL, then ask whether to rewrite the description.
235
272
 
236
- - If **yes**, run Step 6 now to generate the title and body file (passing the existing PR URL for context), then apply:
273
+ - If **yes**, run Step 6 now to generate the title and body file (passing the existing PR URL for context), then carry the Demo section and apply.
274
+
275
+ **Carry the Demo section.** The rewrite replaces the whole description, so a `## Demo` section in the current one has to be carried into the new one. The carry always runs; do not gate it on a heading check, because the helper decides whether a Demo section exists. Skip it only when the new body already holds a `## Demo` section from Step 6. Save the current description to a file:
276
+
277
+ ```bash
278
+ OLD_BODY_FILE=$(mktemp) && gh pr view "<PR URL>" --json body --jq '.body' > "$OLD_BODY_FILE" && echo saved
279
+ ```
280
+
281
+ When the command does not print `saved`, the temp file could not be created or the `gh` read failed. Stop the carry and do not apply the new body file, because the current description was never saved. Tell the user why, remove the old file, and ask how to proceed, with the options listed in Carrying the Demo section. Otherwise follow Carrying the Demo section, with `old=` set to the old body file and `new=` set to the new body file. Then remove the old file:
282
+
283
+ ```bash
284
+ rm -f "$OLD_BODY_FILE"
285
+ ```
286
+
287
+ **Apply.** Only after `status=ok` or `status=absent`. The carry step edits the body file in place, so the apply step is the same:
237
288
 
238
289
  ```bash
239
290
  gh pr edit --title "<title>" --body "$(cat "<body_file>")"
@@ -244,3 +295,25 @@ The new commits are already on the PR from Step 5. Report the PR URL, then ask w
244
295
  ### Step 8: Report
245
296
 
246
297
  Output the PR URL.
298
+
299
+ When this run published evidence images, print the command that fits the outcome. Take `<N>` from the PR URL:
300
+
301
+ - `status=ok`: print the zero-path command, marked as recommended before merge:
302
+
303
+ > Recommended before merge: load `systematic:pr-attachments` with no tokens (or with `pr:<N>`). It re-checks the embed pins and offers to remove the evidence images from the branch.
304
+
305
+ - `status=failed` with `evidence=pushed` and `reason=verify-failed`, or any other pushed state in which the Demo section was not written: print a retry command instead. The zero-path command re-pins and cleans up, and there is nothing to re-pin yet. The retry is to load `systematic:pr-attachments` with the same image paths and `pr:<N>`. It reuses the pushed commit, verifies the embeds and writes the description. Do not print the zero-path command until a publish succeeds.
306
+ - `status=failed` with `evidence=local`: say that the evidence commit is local and unpushed, so the branch needs a push first, and print no re-run command. For `reason=blob-mismatch` say instead that the local evidence commit holds an altered image and must not be pushed as it is.
307
+
308
+ ---
309
+
310
+ ## Carrying the Demo section
311
+
312
+ A description rewrite replaces the whole body, so a `## Demo` section in the current description has to be carried into the new one. Both rewrite paths, the Description Update workflow and the existing-PR path of Step 7, first save the current description to an old body file, and then follow this section. The carry always runs, whatever the old description holds: `status=absent` is a success and leaves the new file untouched.
313
+
314
+ Load the `systematic:pr-attachments` skill in carry mode. State the tokens in the instruction text only, because some hosts pass no skill arguments and the same tokens in two places would be read twice: `mode:carry old=<old body file> new=<new body file>`, with the real paths from this run. Wrap a path that has spaces in double quotes. Carry mode edits the new body file in place. It never touches the PR.
315
+
316
+ The skill ends with one status line, `pr-attachments: status=<ok|absent|failed> [reason=<reason>]`.
317
+
318
+ - `status=ok` or `status=absent`: apply the new body file.
319
+ - `status=failed`, a skill that fails to load, a skill that prints no status line, or the setup stops: the carry failed. Do not apply the rewritten body, and do not write a `## Demo` section by hand. The PR description stays as it is. Report the reason (the `reason` on the status line, or what stopped the setup) and ask the user how to proceed. Offer only these options: retry the carry, apply the rewritten body without a Demo section after an explicit yes, or keep the current description.