opencode-swarm 7.125.0 → 7.125.1

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 (47) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -127
  2. package/.opencode/skills/swarm-pr-feedback/references/bot-claim-verification.md +71 -0
  3. package/.opencode/skills/swarm-pr-feedback/references/operational-gotchas.md +49 -0
  4. package/.opencode/skills/swarm-pr-review/SKILL.md +6 -346
  5. package/.opencode/skills/swarm-pr-review/references/parser-dry-run.md +235 -0
  6. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +103 -0
  7. package/.opencode/skills/writing-tests/SKILL.md +4 -123
  8. package/.opencode/skills/writing-tests/references/mock-and-seam-inventory.md +43 -0
  9. package/dist/cli/{config-doctor-be9sxqx8.js → config-doctor-g3m2q646.js} +2 -2
  10. package/dist/cli/{curation-policy-52kt6d7t.js → curation-policy-vgbx8530.js} +2 -2
  11. package/dist/cli/{curator-llm-factory-frde1955.js → curator-llm-factory-7pvqy94w.js} +13 -13
  12. package/dist/cli/{curator-hbst8nbc.js → curator-xk4g1nx2.js} +13 -13
  13. package/dist/cli/{evidence-summary-service-9hq7n9k9.js → evidence-summary-service-v4h2w487.js} +1 -1
  14. package/dist/cli/{guardrail-explain-112kqmbc.js → guardrail-explain-wfk16bpr.js} +14 -14
  15. package/dist/cli/{guardrail-log-c8zcab91.js → guardrail-log-5zz9xx6z.js} +3 -3
  16. package/dist/cli/{hive-promoter-448xs2tp.js → hive-promoter-njwc5rt0.js} +13 -13
  17. package/dist/cli/{index-kt0awv1n.js → index-3k8pg467.js} +1 -1
  18. package/dist/cli/{index-n6chz2g8.js → index-83rwq7pb.js} +1 -1
  19. package/dist/cli/{index-xattnmyb.js → index-8yvqkbw7.js} +3 -1
  20. package/dist/cli/{index-99ed0h32.js → index-93cq8t5b.js} +5 -5
  21. package/dist/cli/{index-9hbwa5x1.js → index-cz6fv84h.js} +15 -15
  22. package/dist/cli/{index-amspa811.js → index-dsf1yv4s.js} +119 -44
  23. package/dist/cli/{index-4rzzzjtg.js → index-fs02c7tz.js} +277 -16
  24. package/dist/cli/{index-dx2c2wjt.js → index-ghteqdy1.js} +2 -2
  25. package/dist/cli/{index-67hqr2zv.js → index-kvrk3h8p.js} +1 -1
  26. package/dist/cli/{index-09vd53pz.js → index-kws8zn6y.js} +1 -1
  27. package/dist/cli/{index-7j3sm7h8.js → index-mhhmecsw.js} +2 -2
  28. package/dist/cli/{index-yt1v62pv.js → index-mwdcvh0e.js} +4 -4
  29. package/dist/cli/{index-6vfvc36k.js → index-pbjenws7.js} +1 -1
  30. package/dist/cli/{index-958hf0yr.js → index-rpg8qqjs.js} +2 -2
  31. package/dist/cli/{index-vtwqjr4z.js → index-tn3shyqj.js} +3 -3
  32. package/dist/cli/{index-jh6s75f6.js → index-txragda9.js} +1 -1
  33. package/dist/cli/{index-0y6tmm9v.js → index-z4sc6yxc.js} +1 -1
  34. package/dist/cli/index.js +13 -13
  35. package/dist/cli/{knowledge-escalator-htafbhxg.js → knowledge-escalator-jtyykzqc.js} +3 -3
  36. package/dist/cli/{knowledge-events-havw8c4t.js → knowledge-events-qhr97sy9.js} +1 -1
  37. package/dist/cli/{knowledge-store-hqngpt2v.js → knowledge-store-332x3pjv.js} +1 -1
  38. package/dist/cli/{knowledge-validator-g7mpnazh.js → knowledge-validator-3t8tgzsz.js} +4 -4
  39. package/dist/cli/{scan-cursor-sx7cvh8v.js → scan-cursor-q21c9k9q.js} +2 -2
  40. package/dist/cli/{schema-2418eqy3.js → schema-y2d7j2jk.js} +1 -1
  41. package/dist/cli/{skill-generator-zggy797r.js → skill-generator-3gkxx98d.js} +5 -5
  42. package/dist/commands/close.d.ts +4 -2
  43. package/dist/config/schema.d.ts +4 -0
  44. package/dist/evidence/documents-retention.d.ts +116 -0
  45. package/dist/evidence/manager.d.ts +17 -0
  46. package/dist/index.js +374 -366
  47. package/package.json +1 -1
@@ -101,75 +101,9 @@ rounds of review for N pushes, and budget for it.
101
101
  each round's work is bounded by new findings + carried-forward items only.
102
102
  This matches how the bot actually behaves and avoids wasted cycles.
103
103
 
104
- ### Bot Review Verification Traps
105
-
106
- When a bot or pasted review cites a code fact, verify the fact against the
107
- current branch before editing:
108
-
109
- - **Import/export claims:** Check the exact import path used by the changed file.
110
- A symbol may be missing from an internal submodule but correctly exported by the
111
- public barrel the tests or runtime actually import.
112
- - **Line numbers:** Treat bot line references as approximate after any follow-up
113
- push or local edit. Re-locate the symbol or block with `rg` before patching.
114
- - **Ordering claims:** If the concern is about rule precedence, add or run a
115
- direct precedence test that would fail under the wrong ordering; comments alone
116
- are not enough.
117
- - **Disproved findings:** Do not change unrelated code to satisfy a false claim.
118
- Keep the finding in the closure ledger with the source or test evidence that
119
- disproves it.
120
- - **Cache/state claims:** Test both relevant state orders when the behavior
121
- depends on cache priming, singleton state, or prior calls.
122
-
123
- ### Automated Security Finding Verification
124
-
125
- This is a repository-agnostic verification checklist. Technology names and
126
- paths in the examples below are illustrative only: apply an example only when
127
- the reviewed repository actually uses that API, validator, runtime, or file
128
- layout, and otherwise translate the same origin-to-sink question to the
129
- repository's language and framework. No example creates a dependency on the
130
- opencode-swarm tree.
131
-
132
- Automated security bots can produce CRITICAL or HIGH false positives. Before
133
- acting on any bot security finding, perform these source-level checks:
134
-
135
- 1. **`child_process.exec` vs `RegExp.exec`**: SAST rules pattern-match on
136
- `.exec(` and cannot distinguish `child_process.exec(userInput)` (real
137
- injection risk) from `/^pattern$/.exec(str)` (safe regex test). Read the
138
- actual line to determine which `.exec` is called.
139
-
140
- 2. **Schema validation already present**: Bots may flag "missing type
141
- validation" without checking the Zod schema. Search for the field name in
142
- `src/config/schema.ts` — `z.number().int()`, `z.string().min()`, etc. are
143
- runtime validators that run before the code path the bot reviewed.
144
-
145
- 3. **`Object.assign` mutation claims**: Bots may claim `Object.assign` mutates
146
- the source object. Check whether the call is `Object.assign(target, source)`
147
- (mutates target) vs `Object.assign({}, source)` or a manual copy loop into a
148
- new `{}` (creates a new object, source is safe). Read the actual assignment.
149
-
150
- 4. **Path containment for system-generated paths**: Bots may flag "path
151
- traversal" on file paths. Check whether the path is user-controlled (real
152
- risk) or system-generated from `provisionWorktree`, `mkdtempSync`, or
153
- similar (no user input reaches the path). Trace the variable's origin.
154
-
155
- 5. **Value validation vs key validation**: Bots may suggest validating env var
156
- *values* for shell injection characters. Check whether the value is passed
157
- through a sandbox executor that escapes arguments (e.g., `wrapCommand`
158
- which returns a shell-quoted / `psStringEscape`-escaped string for the
159
- `bunSpawn` array-form argv to consume). Value validation would break
160
- legitimate env vars (PATH with `;`, URLs with `$`); escaping is the
161
- sandbox's job — see `engineering-conventions` § "Sandbox env overrides"
162
- for the full escape contract.
163
-
164
- 6. **Deduplication for independent resources**: Bots may suggest deduplicating
165
- cache redirects or env var entries. Check whether the entries map to
166
- independent keys (different env var names) — independent keys cannot
167
- "collide" and deduplication is nonsensical.
168
-
169
- **Rule:** For any bot finding rated CRITICAL or HIGH, read the actual source
170
- line AND its surrounding context (parent function, schema definition, type
171
- annotations) before accepting the finding. If the finding is disproved, record
172
- it in the closure ledger with the specific source evidence that disproves it.
104
+ ### Bot and Security Claim Verification
105
+
106
+ Before trusting automated review findings (SAST bots, security scanners, AI reviewers), apply the verification protocol in `references/bot-claim-verification.md`. Key principle: every bot claim is unverified until you reproduce the exact finding against the current HEAD with the exact tool and rule it names.
173
107
 
174
108
  ## Operating Stance
175
109
 
@@ -256,22 +190,12 @@ proceeding. The bundled `ci-failure-batching` skill is one conditional
256
190
  implementation; otherwise apply the host-neutral complete-ledger protocol
257
191
  below.
258
192
 
259
- The anti-pattern: iterating check-by-check, proposing a fix for one failure,
260
- pushing, waiting for CI, then discovering the next failure. Each cycle costs
261
- one push + one CI run.
262
-
263
- **The fix:** Collect all failures and their logs in one batch operation before
264
- proposing any fix.
193
+ For the detailed 6-step batch collection protocol, read `file:.swarm/bundled-skills/ci-failure-batching/SKILL.md`. The steps below are a summary:
265
194
 
266
- 1. `gh pr checks <n> --json name,bucket,state,link` get every check,
267
- its bucket/state, and the URL to its run details.
268
- 2. Filter to failing checks (`bucket == "fail"` | `bucket == "cancel"`).
269
- 3. For each failing check, extract the run ID from `link` and run
270
- `gh run view <run-id> --log-failed` to fetch the full log output.
271
- 4. Build a complete failure ledger: all checks + all failure logs collected.
272
- 5. Triage the full ledger to identify root causes.
273
- 6. Propose fixes for all failures in **one batch** — do not iterate
274
- check-by-check through push cycles.
195
+ 1. `gh pr checks <number> --json name,bucket,state,link` to collect all check results
196
+ 2. Filter to `bucket == "fail"` or `bucket == "cancel"`
197
+ 3. `gh run view <id> --log-failed` for each failing run
198
+ 4. Group failures by root cause before fixing
275
199
 
276
200
  **Rule:** The complete failure ledger must be collected before any
277
201
  modification is proposed. Verifying the ledger is complete is a prerequisite
@@ -506,29 +430,9 @@ Verification checklist:
506
430
  - Check related tests and whether a failing/proposed test would prove the item.
507
431
  - Check whether multiple feedback items share one root cause.
508
432
 
509
- ### DI seam migration validation (when the repository uses this pattern)
510
-
511
- `_internals` and `mock.module()` below are JavaScript/TypeScript examples only.
512
- For another stack, apply the same live-binding question using that language and
513
- test runner's dependency-injection/mocking semantics.
514
-
515
- When a test file mutates a DI seam object (e.g., `_internals.foo = mock`),
516
- verify that the production source reads from the seam at call time. A common
517
- anti-pattern: the test mutates the seam object, but the production code
518
- imports the named function (`import { foo } from './module'`) which is bound
519
- at module load. The seam mutation has no effect on the named reference,
520
- so the test fails even though the seam object's `foo === mock`.
521
-
522
- Verification: open the source file and grep for call sites. If you see
523
- `import { foo } from '...'` followed by `foo(...)` in the production code,
524
- and the test does `_internals.foo = mock`, the test will fail. The fix is
525
- to change the production code to call `_internals.foo(...)` (or equivalent
526
- active-seam pattern) so the seam mutation is read at call time.
433
+ ### DI seam migration validation
527
434
 
528
- If only a few call sites exist, fix them in the source. If many call sites
529
- exist, consider whether the migration should use `mock.module()` instead,
530
- which replaces the entire module object (including the named export
531
- reference).
435
+ When the repository uses `_internals` seam / `mock.module()` patterns, apply the validation protocol in `references/operational-gotchas.md`.
532
436
 
533
437
  ## Fix Planning
534
438
 
@@ -571,27 +475,7 @@ or compatibility policy, mark the item `NEEDS_USER_DECISION` and ask.
571
475
 
572
476
  ### Conditional runtime/host gotchas
573
477
 
574
- Apply each item below only when the named plugin tool, plan model, shell, or
575
- code-host client is actually present. They are portability examples, not
576
- requirements imposed on unrelated repositories.
577
-
578
- - **Plan identity change:** When switching from a review plan to a feedback-closure
579
- plan, `save_plan` rejects with `PLAN_IDENTITY_MISMATCH`. Pass
580
- `confirm_identity_change: true` to acknowledge the intentional overwrite.
581
- - **Stale gate evidence:** After a plan identity change, `check_gate_status` returns
582
- timestamps from the *prior* plan. Reset task statuses and re-run Stage A gates
583
- before trusting gate results. Do not accept cached gate verdicts from before the
584
- identity change.
585
- - **PowerShell PR comment posting:** Complex markdown bodies containing backticks,
586
- dollar signs, or nested quotes fail in PowerShell here-strings. Write the body
587
- to a temp file and use `gh pr comment <number> --body-file <tempfile>` instead
588
- of inline `--body "..."`.
589
- - **Same-file batching:** Multiple findings targeting the same file for the same
590
- review cycle CAN be fixed in one coder task when the fixes are trivially
591
- independent (e.g., a one-line guard and a typo fix). When findings require
592
- different fixes on different code paths, use separate coder tasks even if
593
- targeting the same file. The "ONE task per coder" rule is about distinct
594
- objectives, not about N edits to one file.
478
+ For portability gotchas (plan identity, stale gate evidence, PowerShell comment posting, same-file batching), read `references/operational-gotchas.md`.
595
479
 
596
480
  ## Mandatory Gates
597
481
 
@@ -0,0 +1,71 @@
1
+ # Bot Claim Verification
2
+
3
+ ## Bot Review Verification Traps
4
+
5
+ When a bot or pasted review cites a code fact, verify the fact against the
6
+ current branch before editing:
7
+
8
+ - **Import/export claims:** Check the exact import path used by the changed file.
9
+ A symbol may be missing from an internal submodule but correctly exported by the
10
+ public barrel the tests or runtime actually import.
11
+ - **Line numbers:** Treat bot line references as approximate after any follow-up
12
+ push or local edit. Re-locate the symbol or block with `rg` before patching.
13
+ - **Ordering claims:** If the concern is about rule precedence, add or run a
14
+ direct precedence test that would fail under the wrong ordering; comments alone
15
+ are not enough.
16
+ - **Disproved findings:** Do not change unrelated code to satisfy a false claim.
17
+ Keep the finding in the closure ledger with the source or test evidence that
18
+ disproves it.
19
+ - **Cache/state claims:** Test both relevant state orders when the behavior
20
+ depends on cache priming, singleton state, or prior calls.
21
+
22
+ ## Automated Security Finding Verification
23
+
24
+ This is a repository-agnostic verification checklist. Technology names and
25
+ paths in the examples below are illustrative only: apply an example only when
26
+ the reviewed repository actually uses that API, validator, runtime, or file
27
+ layout, and otherwise translate the same origin-to-sink question to the
28
+ repository's language and framework. No example creates a dependency on the
29
+ opencode-swarm tree.
30
+
31
+ Automated security bots can produce CRITICAL or HIGH false positives. Before
32
+ acting on any bot security finding, perform these source-level checks:
33
+
34
+ 1. **`child_process.exec` vs `RegExp.exec`**: SAST rules pattern-match on
35
+ `.exec(` and cannot distinguish `child_process.exec(userInput)` (real
36
+ injection risk) from `/^pattern$/.exec(str)` (safe regex test). Read the
37
+ actual line to determine which `.exec` is called.
38
+
39
+ 2. **Schema validation already present**: Bots may flag "missing type
40
+ validation" without checking the Zod schema. Search for the field name in
41
+ `src/config/schema.ts` — `z.number().int()`, `z.string().min()`, etc. are
42
+ runtime validators that run before the code path the bot reviewed.
43
+
44
+ 3. **`Object.assign` mutation claims**: Bots may claim `Object.assign` mutates
45
+ the source object. Check whether the call is `Object.assign(target, source)`
46
+ (mutates target) vs `Object.assign({}, source)` or a manual copy loop into a
47
+ new `{}` (creates a new object, source is safe). Read the actual assignment.
48
+
49
+ 4. **Path containment for system-generated paths**: Bots may flag "path
50
+ traversal" on file paths. Check whether the path is user-controlled (real
51
+ risk) or system-generated from `provisionWorktree`, `mkdtempSync`, or
52
+ similar (no user input reaches the path). Trace the variable's origin.
53
+
54
+ 5. **Value validation vs key validation**: Bots may suggest validating env var
55
+ *values* for shell injection characters. Check whether the value is passed
56
+ through a sandbox executor that escapes arguments (e.g., `wrapCommand`
57
+ which returns a shell-quoted / `psStringEscape`-escaped string for the
58
+ `bunSpawn` array-form argv to consume). Value validation would break
59
+ legitimate env vars (PATH with `;`, URLs with `$`); escaping is the
60
+ sandbox's job — see `engineering-conventions` § "Sandbox env overrides"
61
+ for the full escape contract.
62
+
63
+ 6. **Deduplication for independent resources**: Bots may suggest deduplicating
64
+ cache redirects or env var entries. Check whether the entries map to
65
+ independent keys (different env var names) — independent keys cannot
66
+ "collide" and deduplication is nonsensical.
67
+
68
+ **Rule:** For any bot finding rated CRITICAL or HIGH, read the actual source
69
+ line AND its surrounding context (parent function, schema definition, type
70
+ annotations) before accepting the finding. If the finding is disproved, record
71
+ it in the closure ledger with the specific source evidence that disproves it.
@@ -0,0 +1,49 @@
1
+ # Operational Reference
2
+
3
+ ## DI seam migration validation (when the repository uses this pattern)
4
+
5
+ `_internals` and `mock.module()` below are JavaScript/TypeScript examples only.
6
+ For another stack, apply the same live-binding question using that language and
7
+ test runner's dependency-injection/mocking semantics.
8
+
9
+ When a test file mutates a DI seam object (e.g., `_internals.foo = mock`),
10
+ verify that the production source reads from the seam at call time. A common
11
+ anti-pattern: the test mutates the seam object, but the production code
12
+ imports the named function (`import { foo } from './module'`) which is bound
13
+ at module load. The seam mutation has no effect on the named reference,
14
+ so the test fails even though the seam object's `foo === mock`.
15
+
16
+ Verification: open the source file and grep for call sites. If you see
17
+ `import { foo } from '...'` followed by `foo(...)` in the production code,
18
+ and the test does `_internals.foo = mock`, the test will fail. The fix is
19
+ to change the production code to call `_internals.foo(...)` (or equivalent
20
+ active-seam pattern) so the seam mutation is read at call time.
21
+
22
+ If only a few call sites exist, fix them in the source. If many call sites
23
+ exist, consider whether the migration should use `mock.module()` instead,
24
+ which replaces the entire module object (including the named export
25
+ reference).
26
+
27
+ ## Conditional runtime/host gotchas
28
+
29
+ Apply each item below only when the named plugin tool, plan model, shell, or
30
+ code-host client is actually present. They are portability examples, not
31
+ requirements imposed on unrelated repositories.
32
+
33
+ - **Plan identity change:** When switching from a review plan to a feedback-closure
34
+ plan, `save_plan` rejects with `PLAN_IDENTITY_MISMATCH`. Pass
35
+ `confirm_identity_change: true` to acknowledge the intentional overwrite.
36
+ - **Stale gate evidence:** After a plan identity change, `check_gate_status` returns
37
+ timestamps from the *prior* plan. Reset task statuses and re-run Stage A gates
38
+ before trusting gate results. Do not accept cached gate verdicts from before the
39
+ identity change.
40
+ - **PowerShell PR comment posting:** Complex markdown bodies containing backticks,
41
+ dollar signs, or nested quotes fail in PowerShell here-strings. Write the body
42
+ to a temp file and use `gh pr comment <number> --body-file <tempfile>` instead
43
+ of inline `--body "..."`.
44
+ - **Same-file batching:** Multiple findings targeting the same file for the same
45
+ review cycle CAN be fixed in one coder task when the fixes are trivially
46
+ independent (e.g., a one-line guard and a typo fix). When findings require
47
+ different fixes on different code paths, use separate coder tasks even if
48
+ targeting the same file. The "ONE task per coder" rule is about distinct
49
+ objectives, not about N edits to one file.