opencode-plugin-flow 4.1.12 → 4.1.15

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  One short line per release. For the full rationale behind each entry, see the
4
4
  commit history and review evidence.
5
5
 
6
+ ## [4.1.15] - 2026-06-22
7
+
8
+ Refine Flow's orchestration lore into a quick path, bundled wave example, tested doc links, and trusted-publishing release guidance.
9
+
10
+ ## [4.1.14] - 2026-06-22
11
+
12
+ Publish Flow through npm trusted publishing so release CI no longer depends on expiring npm tokens.
13
+
14
+ ## [4.1.13] - 2026-06-21
15
+
16
+ Teach Flow's parallel orchestration lore to walk a full wave while pinning hidden worker permissions to tested docs.
17
+
6
18
  ## [4.1.12] - 2026-06-18
7
19
 
8
20
  Harden Flow's hidden worker lore, scriptable doctor checks, typed package smoke, and session edge contracts without widening the v4 runtime surface.
package/README.md CHANGED
@@ -21,8 +21,8 @@ The manager still owns every Flow state change. Workers gather evidence; they do
21
21
  Use OpenCode's plugin installer when your OpenCode version supports it:
22
22
 
23
23
  ```bash
24
- opencode plugin opencode-plugin-flow@4.1.12 --global --force
25
- npx -y opencode-plugin-flow@4.1.12 sync
24
+ opencode plugin opencode-plugin-flow@4.1.15 --global --force
25
+ npx -y opencode-plugin-flow@4.1.15 sync
26
26
  ```
27
27
 
28
28
  The first command adds Flow to your global OpenCode plugin config or replaces an
@@ -48,7 +48,7 @@ OpenCode config manually instead:
48
48
 
49
49
  ```json
50
50
  {
51
- "plugin": ["opencode-plugin-flow@4.1.12"]
51
+ "plugin": ["opencode-plugin-flow@4.1.15"]
52
52
  }
53
53
  ```
54
54
 
@@ -59,7 +59,7 @@ duplicate entry.
59
59
  Then run the same pre-start skill sync and start or restart OpenCode:
60
60
 
61
61
  ```bash
62
- npx -y opencode-plugin-flow@4.1.12 sync
62
+ npx -y opencode-plugin-flow@4.1.15 sync
63
63
  ```
64
64
 
65
65
  Project-local skill overrides still work through OpenCode's normal lookup:
@@ -84,15 +84,15 @@ version in your global `opencode.json`.
84
84
  To inspect the installed skill set:
85
85
 
86
86
  ```bash
87
- npx -y opencode-plugin-flow@4.1.12 doctor
87
+ npx -y opencode-plugin-flow@4.1.15 doctor
88
88
  ```
89
89
 
90
90
  For automation, keep the default human-readable `doctor` output and opt into
91
91
  machine behavior explicitly:
92
92
 
93
93
  ```bash
94
- npx -y opencode-plugin-flow@4.1.12 doctor --json
95
- npx -y opencode-plugin-flow@4.1.12 doctor --check
94
+ npx -y opencode-plugin-flow@4.1.15 doctor --json
95
+ npx -y opencode-plugin-flow@4.1.15 doctor --check
96
96
  ```
97
97
 
98
98
  `doctor --check` and `doctor --strict` exit nonzero when the health status is
@@ -111,7 +111,7 @@ above first. Missing, incomplete, or outdated managed skills can still be
111
111
  repaired with:
112
112
 
113
113
  ```bash
114
- npx -y opencode-plugin-flow@4.1.12 sync
114
+ npx -y opencode-plugin-flow@4.1.15 sync
115
115
  ```
116
116
 
117
117
  Then restart OpenCode so the refreshed registry is loaded. `sync` manages all
@@ -226,7 +226,7 @@ First remove `opencode-plugin-flow` from your OpenCode plugin config so future
226
226
  OpenCode startups stop loading Flow. Then remove Flow-owned synced skills:
227
227
 
228
228
  ```bash
229
- npx -y opencode-plugin-flow@4.1.12 uninstall
229
+ npx -y opencode-plugin-flow@4.1.15 uninstall
230
230
  ```
231
231
 
232
232
  Restart OpenCode after both steps. This removes Flow-owned synced skills when
package/dist/cli.js CHANGED
@@ -1,11 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import{createHash as De}from"node:crypto";import{mkdir as Te,readdir as oe,readFile as Pe,rm as je,writeFile as b}from"node:fs/promises";import{createRequire as Se}from"node:module";import{dirname as We,join as u,normalize as ze,sep as Be}from"node:path";var S=`# Flow worker handoff contract
2
+ import{createHash as Pe}from"node:crypto";import{mkdir as je,readdir as re,readFile as Se,rm as We,writeFile as b}from"node:fs/promises";import{createRequire as Oe}from"node:module";import{dirname as Be,join as u,normalize as ze,sep as Ee}from"node:path";var S=`# Flow worker handoff contract
3
3
 
4
4
  Flow managers merge only the worker's final response. Treat that response as the
5
5
  worker report of record: it must include the assigned scope, what was actually
6
6
  covered, the evidence for each useful claim, and the remaining gaps. End worker
7
7
  prompts with "Return only this Flow handoff."
8
8
 
9
+ Status meanings:
10
+
11
+ - \`success\`: the assigned scope was covered, or any skipped items are explicitly
12
+ immaterial to the assigned question.
13
+ - \`partial\`: useful evidence was gathered, but material assigned scope remains
14
+ unchecked or unresolved.
15
+ - \`blocked\`: the worker cannot answer the assigned question without missing
16
+ access, input, dependencies, or manager clarification.
17
+
9
18
  ## Evidence, review, validation, or audit worker report
10
19
 
11
20
  Use this for \`flow-evidence-worker\`, \`flow-reviewer\`,
@@ -47,7 +56,17 @@ success | partial | blocked
47
56
  Validation workers must include exact command names and raw outcome summaries
48
57
  for commands they actually ran. Audit workers must include guards checked for
49
58
  any blocking-severity candidate. Review workers must separate blocking findings
50
- from advisory notes.
59
+ from advisory notes. In the shared \`Findings or facts\` section, review workers
60
+ should prefix review items with \`blocking:\` or \`advisory:\` before the claim.
61
+
62
+ Example evidence quality:
63
+
64
+ - Good fact: \`[high] public Flow command prompts include bundled instructions;
65
+ evidence: src/config-shared.ts:135; corroboration: single source\`.
66
+ - Weak fact: \`[high] prompts look self-contained; evidence: read the config\`.
67
+ - Good validation: \`bun test tests/distribution-and-surface.test.ts\`, status
68
+ passed, summary \`surface tests passed and covered bundled command prompts\`.
69
+ - Weak validation: \`tests pass\`, with no command, status, or raw outcome.
51
70
 
52
71
  ## Verifier worker report
53
72
 
@@ -118,7 +137,74 @@ live-verified | test-verified | type-check-only | not-verified
118
137
 
119
138
  The manager must inspect and validate any candidate patch before recording Flow
120
139
  completion.
121
- `;var W=`# Parallel orchestration
140
+ `;var W=`# Parallel full-wave example
141
+
142
+ Use this example after \`parallel-orchestration.md\` when a broad Flow task needs a
143
+ concrete worker wave shape.
144
+
145
+ Goal: review whether bundled Flow command guidance is self-contained and aligned
146
+ with hidden worker permissions.
147
+
148
+ Serial orientation: the manager reads \`src/config-shared.ts\` enough to identify
149
+ five public command templates and six hidden worker configs. The manager keeps
150
+ \`flow-status\` local because it is one line and does not need a worker.
151
+
152
+ Coverage gate: ten countable items remain after the local check.
153
+
154
+ - Slice A: \`flow-auto\`, \`flow-plan\`, and \`flow-run\` templates, expected 3/10.
155
+ - Slice B: \`flow-review\` template plus \`flow-reviewer\` config, expected 2/10.
156
+ - Slice C: remaining hidden worker permission blocks, expected 5/10 after
157
+ excluding the reviewer already covered by Slice B.
158
+
159
+ Worker prompts:
160
+
161
+ \`\`\`text
162
+ Overall goal, context only: confirm Flow public commands are self-contained.
163
+ Mode: evidence
164
+ Your exact slice: flow-auto, flow-plan, and flow-run templates in src/config-shared.ts.
165
+ Expected coverage: 3/3 templates.
166
+ Do: report bundled sections, setup preflight coverage, and any gaps with file:line evidence.
167
+ Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
168
+ Return exactly the matching handoff shape from handoff-format.md.
169
+ \`\`\`
170
+
171
+ \`\`\`text
172
+ Overall goal, context only: confirm Flow review command and hidden reviewer behavior.
173
+ Mode: review
174
+ Your exact slice: flow-review command template and flow-reviewer config in src/config-shared.ts.
175
+ Expected coverage: 2/2 surfaces.
176
+ Do: separate blocking findings from advisory notes and cite file:line evidence.
177
+ Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
178
+ Return exactly the matching handoff shape from handoff-format.md.
179
+ \`\`\`
180
+
181
+ \`\`\`text
182
+ Overall goal, context only: confirm hidden worker permissions match the orchestration model.
183
+ Mode: audit
184
+ Your exact slice: flow-evidence-worker, flow-validation-worker, flow-audit-worker, flow-candidate-worker, and flow-verifier-worker permissions in src/config-shared.ts.
185
+ Expected coverage: 5/5 worker permission blocks.
186
+ Do: report edit, bash, task, skill, flow_*, and flow_status permissions with evidence.
187
+ Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
188
+ Return exactly the matching handoff shape from handoff-format.md.
189
+ \`\`\`
190
+
191
+ Handoff checks: the manager accepts only reports with terminal status, matching
192
+ coverage counts, concrete file:line evidence, confidence tags, and claims inside
193
+ the assigned slice. A claim such as \`[high] validation workers may run commands;
194
+ evidence: src/config-shared.ts:281-288; corroboration: single source\` is usable.
195
+ A claim such as \`[high] permissions look safe; evidence: config reviewed\` is
196
+ dropped or retasked.
197
+
198
+ Verifier pass: the manager sends any single-source claim that will enter the
199
+ Flow payload to \`flow-verifier-worker\`, for example: \`C1: validation, audit,
200
+ candidate, and verifier workers have bash ask while evidence and review workers
201
+ have bash deny; sources: src/config-shared.ts worker permission blocks\`.
202
+
203
+ Final synthesis: the manager re-reads the relevant config lines, keeps only
204
+ verified or clearly labeled claims, and records one artifact such as a plan
205
+ decision, review payload, or docs patch. Raw handoffs and unverified suggestions
206
+ do not move into the next wave or user-facing answer.
207
+ `;var O=`# Parallel orchestration
122
208
 
123
209
  Use fan-out when Flow work is broad enough that independent workers can gather
124
210
  evidence faster than one linear pass. The manager still owns the Flow session:
@@ -130,6 +216,42 @@ Read these companion references before a broad wave:
130
216
  - \`handoff-format.md\` for the exact worker response shapes.
131
217
  - \`verification-gates.md\` for coverage checks, handoff acceptance, verifier
132
218
  triggers, and synthesis rules.
219
+ - \`parallel-full-wave-example.md\` for a concrete end-to-end wave after the rules
220
+ below are clear.
221
+
222
+ ## Quick path
223
+
224
+ 1. Orient serially and keep the immediate blocker local.
225
+ 2. Fan out only when two to five non-overlapping slices reduce known
226
+ uncertainty.
227
+ 3. Write a coverage gate before spawning workers: total scope, exact slices,
228
+ expected counts, and overlap/gap check.
229
+ 4. Give each worker a named mode, exact slice, expected coverage, and the
230
+ required handoff shape.
231
+ 5. Accept only scoped, evidenced, confidence-labeled claims; verify important
232
+ weak, contested, or single-source claims.
233
+ 6. Synthesize one manager-owned artifact. Raw handoffs do not become the answer,
234
+ Flow payload, or patch decision.
235
+
236
+ ## Operational defaults
237
+
238
+ - Prefer serial work when the scope is small, tightly coupled, or blocked by one
239
+ decision that must be made before slices are meaningful.
240
+ - A normal first wave is two to five workers with independent slices. Use more
241
+ only when the coverage gate is countable and the slices remain non-overlapping.
242
+ - Run at most one routine follow-up wave. Extra waves need an explicit manager
243
+ reason, such as a high-stakes verifier check or a newly discovered bounded
244
+ slice.
245
+ - Do not fan out just to keep agents busy. Every worker should reduce a known
246
+ planning, validation, review, audit, or implementation uncertainty.
247
+
248
+ Skip fan-out when:
249
+
250
+ - one file, command, or design question determines the next step.
251
+ - slices would share the same contracts, fixtures, or edit targets.
252
+ - the manager can inspect the full scope faster than writing and checking
253
+ worker prompts.
254
+ - the result would still need the same manual synthesis with no time saved.
133
255
 
134
256
  ## Manager sequence
135
257
 
@@ -154,9 +276,10 @@ Read these companion references before a broad wave:
154
276
  claims to \`flow-verifier-worker\`.
155
277
  9. Run second waves only for material gaps, conflicts, narrowed scope, or
156
278
  verification needs.
157
- 10. Synthesize one Flow artifact: plan fields, completion evidence, review
158
- payload, audit report, or candidate patch decision. Do not paste worker
159
- handoffs as the user-facing result.
279
+ 10. Apply the manager synthesis barrier: keep only distilled, evidence-backed
280
+ claims and synthesize one Flow artifact, such as plan fields, completion
281
+ evidence, review payload, audit report, or candidate patch decision. Do not
282
+ paste worker handoffs as the user-facing result.
160
283
 
161
284
  ## Modes
162
285
 
@@ -174,6 +297,36 @@ carry the permission boundaries for each mode.
174
297
  | \`verifier\` | \`flow-verifier-worker\` | Per-claim verdicts against cited evidence or commands | No | \`flow_status\` only if needed |
175
298
  | \`candidate-implementation\` | \`flow-candidate-worker\` | Candidate patch summary from an isolated worktree or exact path-owned slice | Only with explicit user authorization plus isolation or exact non-overlapping path ownership | No state-changing Flow tools |
176
299
 
300
+ Mode examples:
301
+
302
+ - Use \`flow-evidence-worker\` when the repo shape is unclear and the output will
303
+ become plan requirements, decisions, targets, or validation entries.
304
+ - Use \`flow-reviewer\` when changed files or risk lenses can be reviewed
305
+ independently before the manager returns one review payload.
306
+ - Use \`flow-validation-worker\` when the manager needs command options or raw
307
+ output from an explicitly authorized command.
308
+ - Use \`flow-audit-worker\` when candidate findings must be refuted before they
309
+ can become a report or follow-up feature.
310
+ - Use \`flow-verifier-worker\` for atomic claims that are contested,
311
+ single-sourced, high-stakes, or destined for a Flow payload.
312
+ - Use \`flow-candidate-worker\` only after explicit user authorization and only
313
+ with an isolated worktree or exact non-overlapping path ownership.
314
+
315
+ ## Permission contract
316
+
317
+ The plugin injects these hidden workers with the following permission values.
318
+ \`Flow state tools\` means the \`flow_*\` rule, while \`Flow status\` documents the
319
+ explicit \`flow_status\` exception.
320
+
321
+ | Worker | Edit | Bash | Task | Skill | Flow state tools | Flow status |
322
+ | --- | --- | --- | --- | --- | --- | --- |
323
+ | \`flow-reviewer\` | deny | deny | deny | deny | deny | allow |
324
+ | \`flow-evidence-worker\` | deny | deny | deny | deny | deny | allow |
325
+ | \`flow-validation-worker\` | deny | ask | deny | deny | deny | allow |
326
+ | \`flow-audit-worker\` | deny | ask | deny | deny | deny | allow |
327
+ | \`flow-candidate-worker\` | ask | ask | deny | deny | deny | allow |
328
+ | \`flow-verifier-worker\` | deny | ask | deny | deny | deny | allow |
329
+
177
330
  Do not fan out parallel \`flow_plan_save\`, \`flow_plan_approve\`,
178
331
  \`flow_run_start\`, \`flow_feature_complete\`, \`flow_feature_reset\`, or
179
332
  \`flow_session_close\` calls. Runtime locking protects files, but Flow accepts only
@@ -209,7 +362,7 @@ Mode: evidence | review | validation | audit | verifier | candidate-implementati
209
362
  Your exact slice: <paths, modules, command, claim ids, risk lens, or worktree>
210
363
  Expected coverage: <count, paths, range, or complete question set>
211
364
  Do: <bounded actions>
212
- Do not: call Flow state tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
365
+ Do not: call state-changing Flow tools, edit .flow/**, own sibling slices, or make the final Flow verdict.
213
366
  Return exactly the matching handoff shape from handoff-format.md.
214
367
  \`\`\`
215
368
 
@@ -235,6 +388,10 @@ work may be active and that they must not revert unrelated changes.
235
388
  When worker results conflict, inspect the underlying artifact directly and rerun
236
389
  the smallest check that can settle the disagreement.
237
390
 
391
+ The manager synthesis barrier means raw handoffs do not move forward by default.
392
+ Only claims that survived coverage, evidence, confidence, and verifier checks may
393
+ enter the next wave, Flow payload, patch decision, or user-facing answer.
394
+
238
395
  ## Second waves
239
396
 
240
397
  Start a follow-up wave when first-wave handoffs reveal:
@@ -247,7 +404,7 @@ Start a follow-up wave when first-wave handoffs reveal:
247
404
 
248
405
  Do not recurse by default. If a worker says it needs another worker, the manager
249
406
  decides whether that is a second wave and writes the next bounded prompt.
250
- `;var z='# Recovery playbook\n\nUse this when a Flow tool returns `status: "error"`, a blocker, or a `nextAction` that conflicts with memory.\n\n## First response\n\n1. Re-anchor with `flow_status`.\n2. Read the returned `summary`, `recovery`, `lastError`, and active feature.\n3. Fix the cause, then retry the smallest valid Flow action.\n\n## Common cases\n\n- `missing_session`: start with `flow_plan_save` using the user\'s goal.\n- `missing_goal`: ask for a concrete goal before planning.\n- `Approved plans cannot be changed`: use `flow_feature_reset` when only affected features need another pass; otherwise close and start a new goal.\n- `No feature is currently running`: call `flow_run_start` before completing.\n- `already in progress`: finish, reset, or block the active feature before starting another.\n- `Completion requires recorded validation evidence`: run real validation and include at least one passing `validationRun`.\n- `Completion requires all recorded validation to pass`: fix failures and rerun. Do not relabel failed checks as passed.\n- `Non-final feature completion requires targeted validation`: use `validationScope: "targeted"` for ordinary features.\n- `Final feature completion requires broad validation`: run the project-level gate and use `validationScope: "broad"`.\n- `Completion requires a passing featureReview`: run or request a real review and include a passing `featureReview` only when there are no blocking findings.\n- `Final feature completion requires a finalReview`: perform final review and include `finalReview`.\n- `Final review depth must match the plan policy`: use `reviewDepth` equal to the approved plan\'s `finalReviewPolicy`; valid final-review values are `broad` and `detailed`.\n- `Cannot close ... unfinished features`: complete, reset, defer, or abandon honestly. Do not mark completed while work remains.\n\n## Reset guidance\n\nUse `flow_feature_reset` when the active or completed work was built on the wrong assumption, validation revealed a design issue, dependencies need to be rerun, or dependent features must be invalidated. Resetting a feature also resets its dependents.\n\n## Closure guidance\n\nUse `flow_session_close`:\n\n- `completed`: only after all planned features are complete.\n- `deferred`: the user intentionally postpones unfinished work.\n- `abandoned`: the session should be archived without claiming delivery.\n\nAfter closure, the active `.flow/session.json` is removed and the archived JSON is stored under `.flow/history/`.\n';var B=`# Verification gates
407
+ `;var B='# Recovery playbook\n\nUse this when a Flow tool returns `status: "error"`, a blocker, or a `nextAction` that conflicts with memory.\n\n## First response\n\n1. Re-anchor with `flow_status`.\n2. Read the returned `summary`, `recovery`, `lastError`, and active feature.\n3. Fix the cause, then retry the smallest valid Flow action.\n\n## Common cases\n\n- `missing_session`: start with `flow_plan_save` using the user\'s goal.\n- `missing_goal`: ask for a concrete goal before planning.\n- `Approved plans cannot be changed`: use `flow_feature_reset` when only affected features need another pass; otherwise close and start a new goal.\n- `No feature is currently running`: call `flow_run_start` before completing.\n- `already in progress`: finish, reset, or block the active feature before starting another.\n- `Completion requires recorded validation evidence`: run real validation and include at least one passing `validationRun`.\n- `Completion requires all recorded validation to pass`: fix failures and rerun. Do not relabel failed checks as passed.\n- `Non-final feature completion requires targeted validation`: use `validationScope: "targeted"` for ordinary features.\n- `Final feature completion requires broad validation`: run the project-level gate and use `validationScope: "broad"`.\n- `Completion requires a passing featureReview`: run or request a real review and include a passing `featureReview` only when there are no blocking findings.\n- `Final feature completion requires a finalReview`: perform final review and include `finalReview`.\n- `Final review depth must match the plan policy`: use `reviewDepth` equal to the approved plan\'s `finalReviewPolicy`; valid final-review values are `broad` and `detailed`.\n- `Cannot close ... unfinished features`: complete, reset, defer, or abandon honestly. Do not mark completed while work remains.\n\n## Reset guidance\n\nUse `flow_feature_reset` when the active or completed work was built on the wrong assumption, validation revealed a design issue, dependencies need to be rerun, or dependent features must be invalidated. Resetting a feature also resets its dependents.\n\n## Closure guidance\n\nUse `flow_session_close`:\n\n- `completed`: only after all planned features are complete.\n- `deferred`: the user intentionally postpones unfinished work.\n- `abandoned`: the session should be archived without claiming delivery.\n\nAfter closure, the active `.flow/session.json` is removed and the archived JSON is stored under `.flow/history/`.\n';var z=`# Verification gates
251
408
 
252
409
  Verification is how Flow keeps parallel work from turning into parallel
253
410
  guesswork. Worker handoffs are candidate evidence; the manager decides what can
@@ -322,7 +479,7 @@ Candidate implementation patches are not Flow evidence until the manager
322
479
  inspects, merges or rejects them, and runs suitable validation in the main
323
480
  Flow-managed workspace.
324
481
 
325
- ## Final synthesis
482
+ ## Manager synthesis barrier
326
483
 
327
484
  Before presenting or recording the result:
328
485
 
@@ -332,12 +489,14 @@ Before presenting or recording the result:
332
489
  instead of arbitrating from summaries.
333
490
  - Run the strongest practical local check for the deliverable.
334
491
  - Re-read critical files or docs that will be cited in the final decision.
492
+ - Move only distilled, evidence-backed claims forward; raw handoffs remain
493
+ candidate evidence, not a plan, review, completion payload, or final answer.
335
494
  - Record gaps honestly instead of converting missing evidence into success
336
495
  language.
337
496
 
338
497
  \`Status: success\` only says the worker believes its slice is done. The manager
339
498
  still checks coverage and evidence before trusting the result.
340
- `;var O=`---
499
+ `;var E=`---
341
500
  name: flow
342
501
  description: Run the end-to-end Flow loop for skills-first OpenCode work. Use when a user asks for Flow-guided planning through implementation, resumable autonomous delivery, session status, or completion with validation and review gates.
343
502
  ---
@@ -528,7 +687,7 @@ Before running \`git commit\`, report:
528
687
 
529
688
  After a successful commit, report the commit hash and leave push or release
530
689
  actions for a separate explicit request.
531
- `;var E=`# Safe refactor workflow
690
+ `;var G=`# Safe refactor workflow
532
691
 
533
692
  Refactoring is a behavior-preserving sequence of small changes. This workflow keeps cleanup from becoming an unreviewable rewrite.
534
693
 
@@ -604,7 +763,7 @@ class; severity; location; evidence read; refutation checked; why it matters; sa
604
763
  \`\`\`
605
764
 
606
765
  Rate as blocking only when the smell materially raises defect risk, blocks planned work, hides behavior, or makes the success claim unverifiable. Style-only cleanup is advisory.
607
- `;var G=`---
766
+ `;var M=`---
608
767
  name: flow-deslop
609
768
  description: Clean up and refactor code with evidence-backed code-smell analysis. Use for AI-slop removal, overengineering reduction, maintainability refactors, behavior-preserving cleanup, duplicated or bloated code, speculative abstractions, dead code, or broad cleanup/refactor review.
610
769
  ---
@@ -679,6 +838,10 @@ For this repository, good first-wave slices are:
679
838
  \`bun.lock\`, \`README.md\`, and \`CHANGELOG.md\`.
680
839
  - Docs and operator contract: \`docs/**\`, \`README.md\`, and skill references.
681
840
 
841
+ Treat these as starting points, not a simultaneous coverage map. Before fan-out,
842
+ choose the relevant entries and de-overlap shared docs, skills, or release
843
+ surfaces in the coverage gate.
844
+
682
845
  ## Coverage gate
683
846
 
684
847
  Before spawning workers, state the total discovery scope and one line per slice.
@@ -689,17 +852,19 @@ state the completeness rule, such as "all changed files plus callers."
689
852
  ## Worker prompt
690
853
 
691
854
  \`\`\`text
692
- Inspect <slice> for <goal>. Read-only. Do not edit files or call Flow tools.
693
- Return the evidence/review/validation/audit handoff shape from ../../flow/references/handoff-format.md.
855
+ Inspect <slice> for <goal>. Read-only. Do not edit files or call
856
+ state-changing Flow tools. Return the evidence/review/validation/audit handoff
857
+ shape from ../../flow/references/handoff-format.md.
694
858
  \`\`\`
695
859
 
696
860
  For validation-oriented discovery:
697
861
 
698
862
  \`\`\`text
699
- Inspect <slice> for validation risk. Read-only. Do not edit files or call Flow
700
- tools. You may report commands that should be run, and include raw output only
701
- for commands you actually ran. Return the evidence/review/validation/audit
702
- handoff shape from ../../flow/references/handoff-format.md.
863
+ Inspect <slice> for validation risk. Read-only. Do not edit files or call
864
+ state-changing Flow tools. You may report commands that should be run, and
865
+ include raw output only for commands you actually ran. Return the
866
+ evidence/review/validation/audit handoff shape from
867
+ ../../flow/references/handoff-format.md.
703
868
  \`\`\`
704
869
 
705
870
  ## Synthesis
@@ -712,6 +877,10 @@ Convert only evidence-backed work into plan fields:
712
877
  - feature \`validation\`: checks expected to prove the feature.
713
878
 
714
879
  If workers disagree, inspect the source artifact yourself. If a candidate finding lacks a concrete citation or refutation pass, make it a review-first deliverable rather than a fix feature.
880
+
881
+ Apply the manager synthesis barrier from
882
+ \`../../flow/references/verification-gates.md\`: only distilled, evidence-backed
883
+ claims become plan fields.
715
884
  `;var $=`# Planning examples
716
885
 
717
886
  ## Rate limiting feature set
@@ -797,7 +966,7 @@ Better plan:
797
966
  - Validation that only says "manual testing".
798
967
  - Targets that name the entire repo.
799
968
  - Features with hidden dependencies instead of \`dependsOn\`.
800
- `;var M=`---
969
+ `;var Q=`---
801
970
  name: flow-plan
802
971
  description: Plan Flow work for the v4 skills-first runtime: inspect the repo, decompose a user goal into right-sized features, save a draft with flow_plan_save, and approve it with flow_plan_approve.
803
972
  ---
@@ -867,7 +1036,7 @@ Use only \`finalReviewPolicy: "broad"\` or \`"detailed"\`. These are the canonic
867
1036
  After saving, summarize the plan to the user. Call \`flow_plan_approve\` only after explicit user approval, unless the user already authorized autonomous implementation. Approved plans are immutable; changing them later requires reset/closure rather than silent edits.
868
1037
 
869
1038
  See \`references/planning-examples.md\` for payload examples and decomposition anti-patterns.
870
- `;var Q=`# Review rubric
1039
+ `;var K=`# Review rubric
871
1040
 
872
1041
  Use this to decide whether a \`featureReview\` or \`finalReview\` payload may pass.
873
1042
 
@@ -955,7 +1124,7 @@ When reviewing a findings report, verify findings adversarially:
955
1124
  - Downgrade or reject findings that do not survive refutation.
956
1125
 
957
1126
  Approve only on evidence actually inspected. A review is a claim of coverage, not a courtesy stamp.
958
- `;var K=`---
1127
+ `;var Y=`---
959
1128
  name: flow-review
960
1129
  description: Review Flow work in the v4 runtime: inspect feature or final-session changes, classify findings, and return featureReview or finalReview payloads for flow_feature_complete.
961
1130
  ---
@@ -1135,7 +1304,7 @@ Broad validation usually means the repo's full check command, full relevant test
1135
1304
  - If validation needs external access, missing credentials, or ambiguous user input, record \`status: "needs_input"\` with an honest \`outcome\`.
1136
1305
 
1137
1306
  Never trim failing output, relabel a failed command as passed, or use "not run" as completion evidence.
1138
- `;var Y=`---
1307
+ `;var Z=`---
1139
1308
  name: flow-run
1140
1309
  description: Execute one approved Flow feature in the v4 runtime: start a feature with flow_run_start, make scoped changes, gather real validation evidence, obtain review payloads, and complete with flow_feature_complete.
1141
1310
  ---
@@ -1222,7 +1391,7 @@ Complete with:
1222
1391
  \`\`\`
1223
1392
 
1224
1393
  If genuinely blocked, call \`flow_feature_complete\` with \`status: "needs_input"\` and an \`outcome\` that explains the blocker and next step. Never fabricate validation or review evidence to force progress.
1225
- `;var Z=`---
1394
+ `;var H=`---
1226
1395
  name: flow-test
1227
1396
  description: Test, validate, make test plans, triage failures, and gather Flow validation evidence. Use when selecting checks, running tests, running browser QA for UI changes, classifying failures, or preparing validationRun evidence for flow_feature_complete.
1228
1397
  ---
@@ -1346,7 +1515,7 @@ covered. Static inspection alone is a gap for behavioral changes.
1346
1515
 
1347
1516
  Never relabel a failed command as passed, invent output, or use "not run" as
1348
1517
  completion evidence.
1349
- `;var H=`# UI quality rubric
1518
+ `;var ee=`# UI quality rubric
1350
1519
 
1351
1520
  Use this rubric for frontend planning, implementation, and review.
1352
1521
 
@@ -1390,7 +1559,7 @@ class; severity; location or screenshot area; evidence inspected; user impact; f
1390
1559
  \`\`\`
1391
1560
 
1392
1561
  Blocking UI findings are issues that prevent task completion, hide required information, break accessibility basics, create incoherent layout at supported sizes, or make the visual success claim unverifiable.
1393
- `;var ee=`# Visual verification workflow
1562
+ `;var ae=`# Visual verification workflow
1394
1563
 
1395
1564
  Use this workflow when UI changes can be run locally. Flow execution may create visual evidence; Flow review usually assesses recorded evidence because the reviewer is read-only.
1396
1565
 
@@ -1430,7 +1599,7 @@ Record the reason and use the strongest available substitute:
1430
1599
  - code inspection against existing component patterns.
1431
1600
 
1432
1601
  Do not claim visual polish was verified if no visual artifact was inspected.
1433
- `;var ae=`---
1602
+ `;var te=`---
1434
1603
  name: flow-ui-quality
1435
1604
  description: Review and improve frontend UI quality for Flow work. Use for UX/UI design, frontend polish, visual quality review, responsive and accessible interfaces, interaction states, screenshots, browser-verified UI work, and avoiding generic AI-generated UI.
1436
1605
  ---
@@ -1478,23 +1647,23 @@ Approve only when the interface is both useful and inspectable:
1478
1647
  - Screenshot/browser evidence supports the claim whenever feasible.
1479
1648
 
1480
1649
  Never approve a UI change based only on code shape. If users will judge it visually, Flow evidence should include visual inspection.
1481
- `;var y=[{name:"flow",files:[{relativePath:"SKILL.md",content:O},{relativePath:"references/recovery-playbook.md",content:z},{relativePath:"references/parallel-orchestration.md",content:W},{relativePath:"references/handoff-format.md",content:S},{relativePath:"references/verification-gates.md",content:B}]},{name:"flow-plan",files:[{relativePath:"SKILL.md",content:M},{relativePath:"references/planning-examples.md",content:$},{relativePath:"references/parallel-discovery.md",content:L}]},{name:"flow-run",files:[{relativePath:"SKILL.md",content:Y},{relativePath:"references/validation-rubric.md",content:J},{relativePath:"references/audit-rubric.md",content:X}]},{name:"flow-test",files:[{relativePath:"SKILL.md",content:Z}]},{name:"flow-review",files:[{relativePath:"SKILL.md",content:K},{relativePath:"references/review-rubric.md",content:Q}]},{name:"flow-deslop",files:[{relativePath:"SKILL.md",content:G},{relativePath:"references/smell-rubric.md",content:V},{relativePath:"references/refactor-workflow.md",content:E}]},{name:"flow-ui-quality",files:[{relativePath:"SKILL.md",content:ae},{relativePath:"references/ui-rubric.md",content:H},{relativePath:"references/visual-verification.md",content:ee}]},{name:"flow-commit",files:[{relativePath:"SKILL.md",content:N}]}];var q=".flow-skill-version";function _(){return process.env.HOME??process.env.USERPROFILE??""}function D(e=_()){return u(e,".config","opencode","skills")}function w(e){return De("sha256").update(e).digest("hex")}function k(e,a){return[`version=${a}`,...e.files.map((t)=>`file=${t.relativePath} sha256=${w(t.content)}`),""].join(`
1482
- `)}async function m(e){try{return await Pe(e,"utf8")}catch(a){if(a.code==="ENOENT")return null;throw a}}function T(e){let a=new Map;if(!e)return a;for(let t of e.split(/\r?\n/)){let r=/^file=(.+) sha256=([a-f0-9]{64})$/.exec(t)??/^file=(.+)=sha256:([a-f0-9]{64})$/.exec(t);if(r?.[1]&&r[2])a.set(r[1],r[2]);let n=/^hash=sha256:([a-f0-9]{64})$/.exec(t);if(n?.[1]&&!a.has("SKILL.md"))a.set("SKILL.md",n[1])}return a}function Oe(e){if(!e)return null;for(let a of e.split(/\r?\n/)){let t=/^version=(.+)$/.exec(a);if(t?.[1])return t[1]}return null}function x(e,a){let t=ze(u(e,...a.split("/")));if(t!==e&&t.startsWith(`${e}${Be}`))return t;throw Error(`Unsafe skill file path '${a}'.`)}async function Ne(e,a){let t=`${e}.backup.${w(a).slice(0,12)}`;for(let r=0;;r+=1){let n=r===0?t:`${t}.${r}`;try{return await b(n,a,{encoding:"utf8",flag:"wx"}),n}catch(s){if(s.code==="EEXIST")continue;throw s}}}async function Ee(e,a,t){let r=u(t,e.name),n=u(r,q),s=await m(n),d=T(s);if(await m(u(r,"SKILL.md"))!==null&&s===null)return{name:e.name,action:"skipped_foreign"};let i=!1,l=[];for(let o of e.files){let c=x(r,o.relativePath),p=await m(c);if(p===o.content)continue;i=!0;let v=d.get(o.relativePath);if(p!==null&&(v?w(p)!==v:s!==null))l.push(await Ne(c,p))}if(!i&&s===k(e,a))return{name:e.name,action:"unchanged"};if(!i)return await b(n,k(e,a),"utf8"),{name:e.name,action:"marker_updated"};let g=s!==null;for(let o of e.files){let c=x(r,o.relativePath);await Te(We(c),{recursive:!0}),await b(c,o.content,"utf8")}return await b(n,k(e,a),"utf8"),{name:e.name,action:l.length>0?"updated_with_backup":g?"updated":"installed",...l.length>0?{backupPaths:l}:{}}}function Ve(){return y.map((e)=>e.name)}function Ge(e){return`npx -y opencode-plugin-flow@${e} doctor`}function I(){if(process.env.npm_package_version)return process.env.npm_package_version;try{let e=Se(import.meta.url);for(let a of["../package.json","../../package.json"])try{let t=e(a);if(t.version)return t.version}catch{}}catch{}return"0.0.0"}async function re(e,a=_()){let t=D(a);return Promise.all(y.map((r)=>Ee(r,e,t)))}async function se(e=I(),a=_()){let t=D(a),r=new Set(Ve()),n=await Promise.all(y.map(async(o)=>{let c=u(t,o.name),p=await m(u(c,q)),v=Oe(p),P=T(p);if(await m(u(c,"SKILL.md"))===null)return{name:o.name,path:c,status:"missing",markerVersion:v,missingFiles:o.files.map((f)=>f.relativePath),editedFiles:[],outdatedFiles:[]};if(p===null)return{name:o.name,path:c,status:"foreign",markerVersion:v,missingFiles:[],editedFiles:[],outdatedFiles:[]};let R=[],C=[],U=[];for(let f of o.files){let A=await m(x(c,f.relativePath));if(A===null){R.push(f.relativePath);continue}if(A===f.content)continue;let j=P.get(f.relativePath);if(j&&w(A)!==j){C.push(f.relativePath);continue}U.push(f.relativePath)}let ce=p!==k(o,e),de=R.length>0?"incomplete":C.length>0?"edited":ce||U.length>0?"outdated":"ok";return{name:o.name,path:c,status:de,markerVersion:v,missingFiles:R,editedFiles:C,outdatedFiles:U}})),s=[];try{s=await oe(t)}catch(o){if(o.code!=="ENOENT")throw o}let d=s.filter((o)=>(o==="flow"||o.startsWith("flow-"))&&!r.has(o)).map((o)=>u(t,o)),h=n.filter((o)=>["missing","incomplete","outdated"].includes(o.status)).map((o)=>o.name),i=n.filter((o)=>["foreign","edited"].includes(o.status)).map((o)=>o.name),l=i.length>0,g=h.length>0;return{status:l?"action_required":g?"sync_required":"ok",version:e,root:t,expectedSkills:[...r],skills:n,syncRequiredSkills:h,actionRequiredSkills:i,unmanagedFlowSkills:d}}function te(e,a,t){if(t.length===0)return;e.push(`- ${a}: ${t.join(", ")}`)}function ne(e){let a=["Flow doctor",`- status: ${e.status}`,`- plugin version: ${e.version}`,`- skills root: ${e.root}`,`- expected skills: ${e.expectedSkills.join(", ")}`];te(a,"startup sync can install/update",e.syncRequiredSkills),te(a,"needs user decision",e.actionRequiredSkills),a.push("","Skills:");for(let t of e.skills){if(a.push(`- ${t.name}: ${t.status} (${t.path})${t.markerVersion?` marker=${t.markerVersion}`:""}`),t.missingFiles.length>0)a.push(` missing: ${t.missingFiles.join(", ")}`);if(t.editedFiles.length>0)a.push(` edited: ${t.editedFiles.join(", ")}`);if(t.outdatedFiles.length>0)a.push(` outdated: ${t.outdatedFiles.join(", ")}`)}if(e.unmanagedFlowSkills.length>0){a.push("","Unmanaged Flow-like skill folders:");for(let t of e.unmanagedFlowSkills)a.push(`- ${t}`)}if(a.push("","Recommendation:"),e.status==="ok")a.push("- Flow skills are present and current.");else if(e.status==="sync_required")a.push("- Start or restart OpenCode with opencode-plugin-flow enabled so startup sync can install or update the listed skills. If Flow then reports restart_required, restart OpenCode once more so the refreshed skill registry is used.");else a.push("- Resolve user-owned or edited managed skill folders, then restart OpenCode. Move a folder aside to let Flow recreate it, or keep it intentionally as a local override.");return a.push(`- Details command: ${Ge(e.version)}`),`${a.join(`
1650
+ `;var y=[{name:"flow",files:[{relativePath:"SKILL.md",content:E},{relativePath:"references/recovery-playbook.md",content:B},{relativePath:"references/parallel-orchestration.md",content:O},{relativePath:"references/parallel-full-wave-example.md",content:W},{relativePath:"references/handoff-format.md",content:S},{relativePath:"references/verification-gates.md",content:z}]},{name:"flow-plan",files:[{relativePath:"SKILL.md",content:Q},{relativePath:"references/planning-examples.md",content:$},{relativePath:"references/parallel-discovery.md",content:L}]},{name:"flow-run",files:[{relativePath:"SKILL.md",content:Z},{relativePath:"references/validation-rubric.md",content:J},{relativePath:"references/audit-rubric.md",content:X}]},{name:"flow-test",files:[{relativePath:"SKILL.md",content:H}]},{name:"flow-review",files:[{relativePath:"SKILL.md",content:Y},{relativePath:"references/review-rubric.md",content:K}]},{name:"flow-deslop",files:[{relativePath:"SKILL.md",content:M},{relativePath:"references/smell-rubric.md",content:V},{relativePath:"references/refactor-workflow.md",content:G}]},{name:"flow-ui-quality",files:[{relativePath:"SKILL.md",content:te},{relativePath:"references/ui-rubric.md",content:ee},{relativePath:"references/visual-verification.md",content:ae}]},{name:"flow-commit",files:[{relativePath:"SKILL.md",content:N}]}];var q=".flow-skill-version";function _(){return process.env.HOME??process.env.USERPROFILE??""}function D(e=_()){return u(e,".config","opencode","skills")}function g(e){return Pe("sha256").update(e).digest("hex")}function k(e,a){return[`version=${a}`,...e.files.map((t)=>`file=${t.relativePath} sha256=${g(t.content)}`),""].join(`
1651
+ `)}async function m(e){try{return await Se(e,"utf8")}catch(a){if(a.code==="ENOENT")return null;throw a}}function T(e){let a=new Map;if(!e)return a;for(let t of e.split(/\r?\n/)){let r=/^file=(.+) sha256=([a-f0-9]{64})$/.exec(t)??/^file=(.+)=sha256:([a-f0-9]{64})$/.exec(t);if(r?.[1]&&r[2])a.set(r[1],r[2]);let s=/^hash=sha256:([a-f0-9]{64})$/.exec(t);if(s?.[1]&&!a.has("SKILL.md"))a.set("SKILL.md",s[1])}return a}function Ne(e){if(!e)return null;for(let a of e.split(/\r?\n/)){let t=/^version=(.+)$/.exec(a);if(t?.[1])return t[1]}return null}function x(e,a){let t=ze(u(e,...a.split("/")));if(t!==e&&t.startsWith(`${e}${Ee}`))return t;throw Error(`Unsafe skill file path '${a}'.`)}async function Ge(e,a){let t=`${e}.backup.${g(a).slice(0,12)}`;for(let r=0;;r+=1){let s=r===0?t:`${t}.${r}`;try{return await b(s,a,{encoding:"utf8",flag:"wx"}),s}catch(n){if(n.code==="EEXIST")continue;throw n}}}async function Ve(e,a,t){let r=u(t,e.name),s=u(r,q),n=await m(s),d=T(n);if(await m(u(r,"SKILL.md"))!==null&&n===null)return{name:e.name,action:"skipped_foreign"};let i=!1,l=[];for(let o of e.files){let c=x(r,o.relativePath),h=await m(c);if(h===o.content)continue;i=!0;let w=d.get(o.relativePath);if(h!==null&&(w?g(h)!==w:n!==null))l.push(await Ge(c,h))}if(!i&&n===k(e,a))return{name:e.name,action:"unchanged"};if(!i)return await b(s,k(e,a),"utf8"),{name:e.name,action:"marker_updated"};let v=n!==null;for(let o of e.files){let c=x(r,o.relativePath);await je(Be(c),{recursive:!0}),await b(c,o.content,"utf8")}return await b(s,k(e,a),"utf8"),{name:e.name,action:l.length>0?"updated_with_backup":v?"updated":"installed",...l.length>0?{backupPaths:l}:{}}}function Me(){return y.map((e)=>e.name)}function Le(e){return`npx -y opencode-plugin-flow@${e} doctor`}function F(){if(process.env.npm_package_version)return process.env.npm_package_version;try{let e=Oe(import.meta.url);for(let a of["../package.json","../../package.json"])try{let t=e(a);if(t.version)return t.version}catch{}}catch{}return"0.0.0"}async function ne(e,a=_()){let t=D(a);return Promise.all(y.map((r)=>Ve(r,e,t)))}async function se(e=F(),a=_()){let t=D(a),r=new Set(Me()),s=await Promise.all(y.map(async(o)=>{let c=u(t,o.name),h=await m(u(c,q)),w=Ne(h),P=T(h);if(await m(u(c,"SKILL.md"))===null)return{name:o.name,path:c,status:"missing",markerVersion:w,missingFiles:o.files.map((f)=>f.relativePath),editedFiles:[],outdatedFiles:[]};if(h===null)return{name:o.name,path:c,status:"foreign",markerVersion:w,missingFiles:[],editedFiles:[],outdatedFiles:[]};let R=[],U=[],C=[];for(let f of o.files){let A=await m(x(c,f.relativePath));if(A===null){R.push(f.relativePath);continue}if(A===f.content)continue;let j=P.get(f.relativePath);if(j&&g(A)!==j){U.push(f.relativePath);continue}C.push(f.relativePath)}let de=h!==k(o,e),le=R.length>0?"incomplete":U.length>0?"edited":de||C.length>0?"outdated":"ok";return{name:o.name,path:c,status:le,markerVersion:w,missingFiles:R,editedFiles:U,outdatedFiles:C}})),n=[];try{n=await re(t)}catch(o){if(o.code!=="ENOENT")throw o}let d=n.filter((o)=>(o==="flow"||o.startsWith("flow-"))&&!r.has(o)).map((o)=>u(t,o)),p=s.filter((o)=>["missing","incomplete","outdated"].includes(o.status)).map((o)=>o.name),i=s.filter((o)=>["foreign","edited"].includes(o.status)).map((o)=>o.name),l=i.length>0,v=p.length>0;return{status:l?"action_required":v?"sync_required":"ok",version:e,root:t,expectedSkills:[...r],skills:s,syncRequiredSkills:p,actionRequiredSkills:i,unmanagedFlowSkills:d}}function oe(e,a,t){if(t.length===0)return;e.push(`- ${a}: ${t.join(", ")}`)}function ie(e){let a=["Flow doctor",`- status: ${e.status}`,`- plugin version: ${e.version}`,`- skills root: ${e.root}`,`- expected skills: ${e.expectedSkills.join(", ")}`];oe(a,"startup sync can install/update",e.syncRequiredSkills),oe(a,"needs user decision",e.actionRequiredSkills),a.push("","Skills:");for(let t of e.skills){if(a.push(`- ${t.name}: ${t.status} (${t.path})${t.markerVersion?` marker=${t.markerVersion}`:""}`),t.missingFiles.length>0)a.push(` missing: ${t.missingFiles.join(", ")}`);if(t.editedFiles.length>0)a.push(` edited: ${t.editedFiles.join(", ")}`);if(t.outdatedFiles.length>0)a.push(` outdated: ${t.outdatedFiles.join(", ")}`)}if(e.unmanagedFlowSkills.length>0){a.push("","Unmanaged Flow-like skill folders:");for(let t of e.unmanagedFlowSkills)a.push(`- ${t}`)}if(a.push("","Recommendation:"),e.status==="ok")a.push("- Flow skills are present and current.");else if(e.status==="sync_required")a.push("- Start or restart OpenCode with opencode-plugin-flow enabled so startup sync can install or update the listed skills. If Flow then reports restart_required, restart OpenCode once more so the refreshed skill registry is used.");else a.push("- Resolve user-owned or edited managed skill folders, then restart OpenCode. Move a folder aside to let Flow recreate it, or keep it intentionally as a local override.");return a.push(`- Details command: ${Le(e.version)}`),`${a.join(`
1483
1652
  `)}
1484
- `}async function ie(e=_()){let a=D(e),t=[],r=[],n;try{n=await oe(a)}catch(s){if(s.code==="ENOENT")return{removed:t,kept:r};throw s}for(let s of n){if(s!=="flow"&&!s.startsWith("flow-"))continue;let d=u(a,s),h=await m(u(d,q));if(h===null){r.push(d);continue}let i=T(h),l=!1;for(let[g,o]of i){let c=await m(x(d,g));if(c!==null&&w(c)!==o){l=!0;break}}if(l){r.push(d);continue}await je(d,{recursive:!0,force:!0}),t.push(d)}return{removed:t,kept:r}}function F(){return["usage: opencode-plugin-flow <doctor|sync|uninstall> [options]","","commands:"," doctor Inspect managed Flow skills"," sync Install or refresh managed Flow skills"," uninstall Remove pristine Flow-owned managed skills","","doctor options:"," --json Write the doctor report as JSON"," --check, --strict Exit nonzero when doctor status is not ok","","global options:"," --help Show this help"," --version Print the plugin version"].join(`
1485
- `)}function Le(e,a){return e.every((t)=>a.has(t))}function $e(e,a){if(a.json){process.stdout.write(`${JSON.stringify(e,null,2)}
1486
- `);return}process.stdout.write(ne(e))}async function Me(e){let a=e[2],t=e.slice(3);if(a==="--help"||a==="-h"){process.stdout.write(`${F()}
1487
- `);return}if(a==="--version"||a==="-v"){process.stdout.write(`${I()}
1488
- `);return}if(a!=="uninstall"&&a!=="doctor"&&a!=="sync"){process.stderr.write(`${F()}
1489
- `),process.exitCode=2;return}if(a==="doctor"){if(!Le(t,new Set(["--json","--check","--strict"]))){process.stderr.write(`${F()}
1490
- `),process.exitCode=2;return}let s=await se();if($e(s,{json:t.includes("--json")}),(s.status==="sync_required"||s.status==="action_required")&&(t.includes("--check")||t.includes("--strict")))process.exitCode=1;return}if(t.length>0){process.stderr.write(`${F()}
1491
- `),process.exitCode=2;return}if(a==="sync"){let n=I(),s=await re(n),d=s.filter((i)=>["installed","updated","updated_with_backup"].includes(i.action)),h=s.filter((i)=>i.action==="skipped_foreign");process.stdout.write(`Flow skill sync (${n})
1492
- `);for(let i of s){process.stdout.write(`- ${i.name}: ${i.action}
1653
+ `}async function ce(e=_()){let a=D(e),t=[],r=[],s;try{s=await re(a)}catch(n){if(n.code==="ENOENT")return{removed:t,kept:r};throw n}for(let n of s){if(n!=="flow"&&!n.startsWith("flow-"))continue;let d=u(a,n),p=await m(u(d,q));if(p===null){r.push(d);continue}let i=T(p),l=!1;for(let[v,o]of i){let c=await m(x(d,v));if(c!==null&&g(c)!==o){l=!0;break}}if(l){r.push(d);continue}await We(d,{recursive:!0,force:!0}),t.push(d)}return{removed:t,kept:r}}function I(){return["usage: opencode-plugin-flow <doctor|sync|uninstall> [options]","","commands:"," doctor Inspect managed Flow skills"," sync Install or refresh managed Flow skills"," uninstall Remove pristine Flow-owned managed skills","","doctor options:"," --json Write the doctor report as JSON"," --check, --strict Exit nonzero when doctor status is not ok","","global options:"," --help Show this help"," --version Print the plugin version"].join(`
1654
+ `)}function $e(e,a){return e.every((t)=>a.has(t))}function Qe(e,a){if(a.json){process.stdout.write(`${JSON.stringify(e,null,2)}
1655
+ `);return}process.stdout.write(ie(e))}async function Ke(e){let a=e[2],t=e.slice(3);if(a==="--help"||a==="-h"){process.stdout.write(`${I()}
1656
+ `);return}if(a==="--version"||a==="-v"){process.stdout.write(`${F()}
1657
+ `);return}if(a!=="uninstall"&&a!=="doctor"&&a!=="sync"){process.stderr.write(`${I()}
1658
+ `),process.exitCode=2;return}if(a==="doctor"){if(!$e(t,new Set(["--json","--check","--strict"]))){process.stderr.write(`${I()}
1659
+ `),process.exitCode=2;return}let n=await se();if(Qe(n,{json:t.includes("--json")}),(n.status==="sync_required"||n.status==="action_required")&&(t.includes("--check")||t.includes("--strict")))process.exitCode=1;return}if(t.length>0){process.stderr.write(`${I()}
1660
+ `),process.exitCode=2;return}if(a==="sync"){let s=F(),n=await ne(s),d=n.filter((i)=>["installed","updated","updated_with_backup"].includes(i.action)),p=n.filter((i)=>i.action==="skipped_foreign");process.stdout.write(`Flow skill sync (${s})
1661
+ `);for(let i of n){process.stdout.write(`- ${i.name}: ${i.action}
1493
1662
  `);for(let l of i.backupPaths??[])process.stdout.write(` backup: ${l}
1494
1663
  `)}if(d.length>0)process.stdout.write(`Restart OpenCode so the refreshed skill registry is used.
1495
- `);if(h.length>0)process.stdout.write(`Some managed skill folders are user-owned or edited; run doctor for repair guidance.
1496
- `);return}let r=await ie();for(let n of r.removed)process.stdout.write(`Removed Flow skill: ${n}
1497
- `);for(let n of r.kept)process.stdout.write(`Kept non-Flow or user-edited skill: ${n}
1664
+ `);if(p.length>0)process.stdout.write(`Some managed skill folders are user-owned or edited; run doctor for repair guidance.
1665
+ `);return}let r=await ce();for(let s of r.removed)process.stdout.write(`Removed Flow skill: ${s}
1666
+ `);for(let s of r.kept)process.stdout.write(`Kept non-Flow or user-edited skill: ${s}
1498
1667
  `);process.stdout.write(`Remove opencode-plugin-flow from your OpenCode plugin config and restart OpenCode.
1499
- `)}Me(process.argv).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
1668
+ `)}Ke(process.argv).catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
1500
1669
  `),process.exitCode=1});