@yandy-r/ycc-opencode 6.1.1 → 6.2.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 (126) hide show
  1. package/README.md +7 -3
  2. package/agents/code-researcher.md +3 -3
  3. package/agents/feature-researcher.md +1 -1
  4. package/agents/implementor.md +4 -4
  5. package/agents/pr-comment-fixer.md +1 -1
  6. package/agents/release-fix-applier.md +1 -1
  7. package/agents/review-fixer.md +1 -1
  8. package/index.js +146 -95
  9. package/package.json +1 -1
  10. package/registration.json +0 -4
  11. package/shared/references/artifact-store.md +613 -0
  12. package/shared/references/branch-prep.md +2 -0
  13. package/shared/references/forge-detection.md +3 -2
  14. package/shared/references/review-artifact-format.md +13 -6
  15. package/shared/references/review-checklist.md +3 -2
  16. package/shared/references/review-dispatch.md +15 -10
  17. package/shared/references/target-capability-matrix.md +140 -32
  18. package/shared/references/visual-mode.md +19 -13
  19. package/shared/references/worktree-strategy.md +12 -8
  20. package/shared/scripts/artifact-body.sh +71 -0
  21. package/shared/scripts/artifact-store-pointer.sh +245 -0
  22. package/shared/scripts/ci-monitor.sh +9 -4
  23. package/shared/scripts/collect-linear-keys.sh +77 -0
  24. package/shared/scripts/lib/ci-classify.sh +13 -10
  25. package/shared/scripts/lib/forge.sh +13 -4
  26. package/shared/scripts/prepare-feature-branch.sh +118 -10
  27. package/shared/scripts/release-ci-monitor.sh +2 -2
  28. package/shared/scripts/report-bundle-drift.sh +1 -1
  29. package/shared/scripts/resolve-artifact-store.sh +636 -0
  30. package/shared/scripts/validate-file-paths.sh +11 -4
  31. package/skills/blueprint/SKILL.md +48 -13
  32. package/skills/bundle-release/scripts/draft-notes.sh +1 -1
  33. package/skills/bundle-release/scripts/release_versions.py +9 -1
  34. package/skills/clean/SKILL.md +1 -1
  35. package/skills/clean/scripts/detect-project-type.sh +2 -2
  36. package/skills/clean/scripts/generate-report.sh +34 -5
  37. package/skills/clean/scripts/validate-safety.sh +9 -6
  38. package/skills/code-report/SKILL.md +26 -14
  39. package/skills/code-report/scripts/check-prerequisites.sh +72 -12
  40. package/skills/code-report/templates/report-structure.md +1 -1
  41. package/skills/code-review/SKILL.md +68 -17
  42. package/skills/code-review/references/pr-procedure.md +28 -15
  43. package/skills/compatibility-audit/SKILL.md +10 -5
  44. package/skills/compatibility-audit/references/reading-the-report.md +4 -1
  45. package/skills/compatibility-audit/scripts/audit-install-assumptions.sh +64 -7
  46. package/skills/compatibility-audit/scripts/audit-target-features.sh +13 -10
  47. package/skills/deep-research/SKILL.md +28 -5
  48. package/skills/deep-research/references/completion-summary-template.md +3 -2
  49. package/skills/deep-research/scripts/validate-research.sh +8 -2
  50. package/skills/feature-research/SKILL.md +48 -25
  51. package/skills/feature-research/scripts/validate-research.sh +51 -12
  52. package/skills/feature-research/scripts/validate-spec.sh +53 -22
  53. package/skills/feature-research/templates/research-agents.md +15 -14
  54. package/skills/feature-research/templates/spec-structure.md +5 -0
  55. package/skills/formatters/scripts/apply-aliases.sh +3 -1
  56. package/skills/formatters/scripts/apply-ci.sh +3 -1
  57. package/skills/git-workflow/SKILL.md +2 -1
  58. package/skills/git-workflow/references/pr-creation.md +10 -0
  59. package/skills/git-workflow/scripts/analyze-changes.sh +21 -11
  60. package/skills/git-workflow/scripts/create-pr.sh +51 -6
  61. package/skills/git-workflow/scripts/validate-commit.sh +26 -14
  62. package/skills/hooks-workflow/scripts/verify-hooks.sh +1 -1
  63. package/skills/implement-plan/SKILL.md +35 -16
  64. package/skills/implement-plan/references/agent-task-prompt.md +8 -5
  65. package/skills/implement-plan/references/linear-sync.md +20 -0
  66. package/skills/implement-plan/references/output-formats.md +17 -2
  67. package/skills/implement-plan/references/plan-inputs.md +23 -4
  68. package/skills/implement-plan/scripts/check-prerequisites.sh +95 -49
  69. package/skills/implement-plan/scripts/parse-dependencies.sh +10 -10
  70. package/skills/init/SKILL.md +77 -42
  71. package/skills/init/references/flag-reference.md +41 -17
  72. package/skills/init/references/project-profile-heuristics.md +3 -0
  73. package/skills/init/references/template-library.md +15 -5
  74. package/skills/init/scripts/profile-project.sh +26 -0
  75. package/skills/init/scripts/render-template.py +2 -2
  76. package/skills/init/templates/AGENTS.md.tmpl +6 -0
  77. package/skills/init/templates/git/gitignore.tmpl +5 -0
  78. package/skills/orchestrate/SKILL.md +17 -2
  79. package/skills/parallel-plan/SKILL.md +14 -8
  80. package/skills/plan/SKILL.md +18 -2
  81. package/skills/plan/references/planning-tracks.md +1 -1
  82. package/skills/plan-workflow/SKILL.md +67 -32
  83. package/skills/plan-workflow/references/checkpoint-messages.md +23 -14
  84. package/skills/plan-workflow/references/plan-structure.md +1 -1
  85. package/skills/plan-workflow/references/planning-agents.md +11 -9
  86. package/skills/plan-workflow/references/research-agents-optimized.md +12 -10
  87. package/skills/plan-workflow/references/research-agents.md +11 -10
  88. package/skills/plan-workflow/scripts/check-prerequisites.sh +50 -11
  89. package/skills/plan-workflow/scripts/check-state.sh +53 -9
  90. package/skills/plan-workflow/scripts/persist-or-fail.sh +21 -7
  91. package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +28 -14
  92. package/skills/plan-workflow/scripts/validate-research-artifacts.sh +35 -10
  93. package/skills/plan-workflow/scripts/validate-shared.sh +56 -15
  94. package/skills/plan-workflow/scripts/validate-workflow-plan.sh +48 -17
  95. package/skills/pr-autofix/SKILL.md +19 -4
  96. package/skills/pr-autofix/references/output-templates.md +3 -2
  97. package/skills/pr-autofix/scripts/fetch-pr-comments.sh +1 -2
  98. package/skills/pr-autofix/scripts/post-summary.sh +1 -2
  99. package/skills/pr-autofix/scripts/resolve-thread.sh +3 -4
  100. package/skills/prp-implement/SKILL.md +31 -16
  101. package/skills/prp-implement/references/agent-task-prompt.md +5 -2
  102. package/skills/prp-implement/references/detection.md +4 -1
  103. package/skills/prp-implement/references/linear-sync.md +25 -0
  104. package/skills/prp-implement/references/report-output.md +15 -2
  105. package/skills/prp-plan/SKILL.md +62 -30
  106. package/skills/prp-plan/references/enhanced-researchers.md +8 -9
  107. package/skills/prp-plan/scripts/validate-prp-plan.sh +42 -18
  108. package/skills/prp-pr/SKILL.md +14 -1
  109. package/skills/prp-prd/SKILL.md +21 -9
  110. package/skills/prp-spec/SKILL.md +30 -20
  111. package/skills/quick-fix/SKILL.md +6 -4
  112. package/skills/quick-review/SKILL.md +62 -25
  113. package/skills/release-model/scripts/collect-signals.sh +9 -3
  114. package/skills/releaser/scripts/publish-release.sh +6 -3
  115. package/skills/research-to-issues/SKILL.md +33 -14
  116. package/skills/research-to-issues/scripts/validate-prerequisites.sh +45 -23
  117. package/skills/research-to-issues/templates/task-issue.md +4 -0
  118. package/skills/research-to-issues/templates/tracking-issue.md +3 -0
  119. package/skills/review-fix/SKILL.md +96 -14
  120. package/skills/review-fix/references/fix-report.md +10 -10
  121. package/skills/review-fix/references/plan.md +5 -2
  122. package/skills/shared-context/SKILL.md +14 -11
  123. package/skills/visual-plan/SKILL.md +26 -8
  124. package/skills/visual-recap/SKILL.md +1 -1
  125. package/skills/write-docs/scripts/audit-documentation.sh +44 -10
  126. package/skills/write-docs/scripts/generate-doc-index.sh +10 -3
@@ -28,8 +28,9 @@ Extract flags from `$ARGUMENTS` before treating the remainder as the input:
28
28
  | `--dry-run` | Print the fix plan and stop. Do not dispatch fixers or modify files. |
29
29
  | `--worktree` | Legacy no-op; worktree mode is default (auto-detect from artifact) |
30
30
  | `--no-worktree` | Apply fixes directly in current working tree |
31
+ | `--store=<mode>` | Artifact store override, `local` or `linear` |
31
32
 
32
- Strip the supported flags from `$ARGUMENTS` and set `PARALLEL_MODE`, `MIN_SEVERITY`, `DRY_RUN`, and `WORKTREE_MODE=true` unless `--no-worktree` is present. The remaining text is the input selector.
33
+ Strip the supported flags from `$ARGUMENTS` and set `PARALLEL_MODE`, `MIN_SEVERITY`, `DRY_RUN`, and `WORKTREE_MODE=true` unless `--no-worktree` is present. Keep `--store=local|linear` verbatim as `STORE_FLAG` (empty when absent) and forward it to every resolver call. The remaining text is the input selector.
33
34
 
34
35
  **Questions:** class `failure-recovery` (Path B/C between-batch failure): headless (no question tool or chat turn), stop, preserve completed fixes, and print the failing batch plus the resume command; class `clarify` (blank input): headless, print the resolved artifact path and stop. See `{{package-root}}/shared/references/question-policy.md`.
35
36
 
@@ -37,10 +38,66 @@ Strip the supported flags from `$ARGUMENTS` and set `PARALLEL_MODE`, `MIN_SEVERI
37
38
 
38
39
  - Both `--parallel`:
39
40
 
40
- Input resolution — artifact lives on the PR branch in the worktree's
41
- `docs/prps/reviews/`; fall back to main repo's. Path ending `.md` → as-is;
42
- digits → `docs/prps/reviews/pr-<N>-review.md`; blank → latest by mtime in
43
- current worktree, then main repo; prompt user to confirm.
41
+ Input resolution — print the mode first:
42
+ `"{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell`.
43
+ Apply the local-review rule below before anything else. Then, in linear mode,
44
+ apply the **Linear call gate** from
45
+ `{{package-root}}/shared/references/artifact-store.md` before any
46
+ Linear call, write or `--ensure`; rules are in its Review and report skills > Review fixes.
47
+
48
+ - Path ending `.md` → resolve a relative path against the current directory
49
+ first, then against `git rev-parse --show-toplevel` (printed review paths
50
+ are toplevel-relative). A path under `.ycc/artifacts/` or with a leading
51
+ `linear:` frontmatter block is a linear review: set `STORE_FLAG=--store=linear`
52
+ when empty (with `--store=local`, abort:
53
+ `A Linear review requires linear mode; drop --store=local.`).
54
+ - Digits `N` → resolve kind `review-pr-N` (no `--ensure`) with slug `review`
55
+ in local mode (unchanged `docs/prps/reviews/pr-<N>-review.md`, worktree then
56
+ main repo). Linear mode: the cache `.ycc/artifacts/*/reviews/pr-N-review.md`
57
+ in the current checkout, then the main checkout; if missing, run Lookup
58
+ scoped to this repository, stopping at the first hit:
59
+ 1. The PR itself: `gh pr view N --json headRefName,body`; take the issue key
60
+ from `headRefName` (Branch hint rules), else a `Closes|Fixes|Resolves <KEY>`
61
+ line in the body; verify the issue in Linear and look among its Documents
62
+ for a title ending `· pr-N-review`.
63
+ 2. Documents titled `<slug> · pr-N-review` in the Projects of Lookup step 5
64
+ (`ARTIFACT_LINEAR_PROJECT`, else Projects carrying `ARTIFACT_LINEAR_LABEL`).
65
+ 3. Ask for the Document (Lookup step 7); never search the whole workspace.
66
+
67
+ Load the hit into `--ensure --kind=review-pr-N --slug=<slug>` (slug from the
68
+ Document title prefix before `·`). `--dry-run` never writes: read a fetched
69
+ body from a temporary file outside the repository instead. Before using a
70
+ linear `pr-N` review, compare the head of its `**Branch**: <head> → <base>`
71
+ header with `gh pr view N --json headRefName --jq .headRefName`; on a
72
+ mismatch abort: `Error: review <path> is for branch <head>, not PR #N's <headRefName>.`
73
+
74
+ - Blank → latest `*-review.md` by mtime in the mode's review location (local:
75
+ `docs/prps/reviews/`; linear: `.ycc/artifacts/*/reviews/`), current checkout
76
+ then main checkout (parent of `git rev-parse --path-format=absolute --git-common-dir`);
77
+ prompt user to confirm.
78
+
79
+ Existing local reviews keep local mode (artifact-store.md > Review fixes).
80
+ When `STORE_FLAG` is empty and the printed `ARTIFACT_STORE_SOURCE=default`, set
81
+ `STORE_FLAG=--store=local` (and forward it) when the input is a `.md` path that
82
+ is not a linear review, digits `N` whose `docs/prps/reviews/pr-<N>-review.md`
83
+ exists (current checkout, then main checkout) and is newer by mtime than every
84
+ linear cache `.ycc/artifacts/*/reviews/pr-<N>-review.md` in those checkouts (no
85
+ cache counts as older), or blank input whose newest `*-review.md` across both
86
+ review locations lies under `docs/prps/reviews/`. Print one line:
87
+ `Using local review at <path>; pin with store: local in .plans-config`.
88
+ When linear mode comes from `--store=linear` or a config, a `.md` path that is
89
+ not a linear review aborts:
90
+ `A local review requires local mode; use --store=local.`
91
+
92
+ Record `REVIEW_FILE`; `REVIEW_SELECTOR`, the input to re-run with (`N` for
93
+ digits, else the resolved `.md` path; never a temporary copy); `REVIEW_ID`
94
+ (basename minus `-review.md`, else minus `.md`; `pr-<N>` for a `--dry-run`
95
+ temporary copy); and in linear mode `REVIEW_SLUG` (the `.ycc/artifacts/<slug>/`
96
+ component; the Document title prefix for a temporary copy).
97
+ Fix reports need a store review id (`pr-<N>`, `local-<YYYYMMDD-HHMMSS>`,
98
+ `quick-<YYYYMMDD-HHMMSS>`). Any other `REVIEW_ID` keeps the pre-store report
99
+ path in local mode (Phase 6); in linear mode abort here, before any write:
100
+ `Error: review id <REVIEW_ID> is not pr-<N>, local-<stamp> or quick-<stamp>; rename the review or use --store=local.`
44
101
 
45
102
  Error paths:
46
103
 
@@ -134,7 +191,7 @@ If `DRY_RUN=true`, stop here. Print a reminder:
134
191
 
135
192
  ```
136
193
  Dry run complete. To apply fixes, re-run without --dry-run:
137
- /ycc:review-fix $REVIEW_FILE [--parallel] [--severity <level>]
194
+ /ycc:review-fix ${STORE_FLAG} $REVIEW_SELECTOR [--parallel] [--severity <level>]
138
195
  ```
139
196
 
140
197
 
@@ -165,7 +222,11 @@ One-time parent setup only when forced and not yet ensured.
165
222
  Status updates in place via `Edit` after each agent returns: Fixed on
166
223
  `STATUS: Fixed`, Failed on `STATUS: Failed`. Track per-batch todos. In Path B/C,
167
224
  between-batch validation failure stops and asks for the path-specific choices
168
- in fixer-dispatch.md. Path A continues; no stop-and-ask gate.
225
+ in fixer-dispatch.md. Path A continues; no stop-and-ask gate. Linear mode: when
226
+ the review carries `linear.document` or `pending: true`, re-run Save for
227
+ Document `<REVIEW_SLUG> · <REVIEW_ID>-review` per artifact-store.md after the
228
+ last status edit (and before any stop); Conflict rules apply and offline sets
229
+ `pending: true`. A review kept local only (neither key) is not re-saved.
169
230
 
170
231
  ## Phase 5 — VERIFY
171
232
 
@@ -178,9 +239,24 @@ Read report template and worktree summary:
178
239
 
179
240
  `{{package-root}}/skills/review-fix/references/fix-report.md`
180
241
 
181
- Write to `docs/prps/reviews/fixes/<source-name>-fixes.md` under the active
182
- checkout root. In worktree mode, stage and commit the report alongside fix
183
- commits and push. GitHub-only: detect forge first (see
242
+ Resolve the report with kind `review-fixes-<REVIEW_ID>`, starting from the
243
+ active checkout root (`$PARENT_PATH` in worktree mode):
244
+
245
+ ```bash
246
+ FIX_REPORT="$("{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=review-fixes-<REVIEW_ID> --slug=<slug> <checkout>)"
247
+ mkdir -p "$(dirname "$FIX_REPORT")"
248
+ ```
249
+
250
+ Slug: `review` in local mode (unchanged path
251
+ `docs/prps/reviews/fixes/<source-name>-fixes.md`); `REVIEW_SLUG` in linear mode
252
+ (`.ycc/artifacts/<slug>/reviews/<REVIEW_ID>-fixes.md`, saved as Document
253
+ `<slug> · <REVIEW_ID>-fixes` with the review Document's parent; none → local
254
+ only). Local mode with a `REVIEW_ID` the resolver rejects (renamed or legacy
255
+ review): skip the resolver and keep the pre-store path,
256
+ `FIX_REPORT="$(git -C <checkout> rev-parse --show-toplevel)/docs/prps/reviews/fixes/<REVIEW_ID>-fixes.md"`,
257
+ creating its parent with `mkdir -p`. Local mode in worktree mode: stage and commit the report alongside fix
258
+ commits and push. Linear mode never commits the report (gitignored); fix
259
+ commits still push, staged by explicit path only. GitHub-only: detect forge first (see
184
260
  `{{package-root}}/shared/references/forge-detection.md`); on
185
261
  non-GitHub providers skip commit/push with notice
186
262
  `PR posting is GitHub-only on provider <provider>; fixes applied locally — commit and push them yourself.` and `REPORT_COMMITTED: n/a`.
@@ -195,7 +271,11 @@ Start the output with this literal heading:
195
271
 
196
272
  Report source path, report path, mode, eligible/fixed/failed/skipped/open
197
273
  counts, updated statuses, validation results, next steps
198
- (`/ycc:code-review <target>` re-review, `/ycc:git-workflow --commit`).
274
+ (`/ycc:code-review <target>` re-review, then commit the fixed files by name:
275
+ `/ycc:prp-commit <fixed files>`, never a stage-everything commit). Linear mode:
276
+ when the rule-only `.gitignore` check (artifact-store.md > Reviews) holds for
277
+ `<checkout>`, print
278
+ `Note: <checkout>/.gitignore gained the .ycc/artifacts/ rule from the artifact store; leave it out of PR commits.`
199
279
 
200
280
  Print under `### Goal Signals (machine-readable — printed verbatim for /goal)`,
201
281
  as the last lines, one `KEY: PASS|FAIL` per line (always include the value):
@@ -209,9 +289,11 @@ REPORT_COMMITTED: <PASS|FAIL|n/a>
209
289
  ```
210
290
 
211
291
  PASS only when the criterion holds: plan respects same-file sequentialization;
212
- every attempted finding's Status updated in the source artifact; report
213
- written under `docs/prps/reviews/fixes/`; Phase 5 completed (even if checks
214
- failed); report committed and pushed (worktree mode; `n/a` in `--no-worktree`).
292
+ every attempted finding's Status updated in the source artifact (linear mode:
293
+ and saved or marked `pending`); report written at `$FIX_REPORT` (local mode
294
+ under `docs/prps/reviews/fixes/`); Phase 5 completed (even if checks
295
+ failed); report committed and pushed (local-mode worktree runs; `n/a` in
296
+ `--no-worktree` and linear mode).
215
297
  Also print an `Open remaining: <M - X - Y>` line.
216
298
 
217
299
  ## Edge cases
@@ -8,20 +8,20 @@
8
8
 
9
9
  ## Report location
10
10
 
11
- Write the fix report to `$(git rev-parse --show-toplevel)/docs/prps/reviews/fixes/`. When in a worktree this resolves to the worktree top-level; otherwise to the main repo.
11
+ Write the fix report to `$FIX_REPORT`, resolved in SKILL.md Phase 6 with kind `review-fixes-<REVIEW_ID>` from the active checkout root (its parent created there with `mkdir -p "$(dirname "$FIX_REPORT")"`).
12
12
 
13
- ```bash
14
- mkdir -p "$(git rev-parse --show-toplevel)/docs/prps/reviews/fixes"
15
- ```
13
+ - **Local mode** — unchanged: `$(git rev-parse --show-toplevel)/docs/prps/reviews/fixes/`. When in a worktree this resolves to the worktree top-level; otherwise to the main repo. A review whose id the resolver rejects (renamed or legacy name) keeps this path without the resolver: `<source-name>-fixes.md`.
14
+ - **Linear mode** — `.ycc/artifacts/<slug>/reviews/<REVIEW_ID>-fixes.md` (gitignored), saved per `{{package-root}}/shared/references/artifact-store.md` > Review and report skills > Review fixes as Document `<slug> · <REVIEW_ID>-fixes`, parented like the review Document (none → local only).
16
15
 
17
16
  Derive the report filename from the source review:
18
17
 
19
- | Source | Report |
20
- | --------------------------------------------------- | -------------------------------------------------------- |
21
- | `docs/prps/reviews/pr-42-review.md` | `docs/prps/reviews/fixes/pr-42-fixes.md` |
22
- | `docs/prps/reviews/local-20260408-143022-review.md` | `docs/prps/reviews/fixes/local-20260408-143022-fixes.md` |
18
+ | Source | Report (local mode) |
19
+ | -------------------------------------------------------- | -------------------------------------------------------- |
20
+ | `docs/prps/reviews/pr-42-review.md` | `docs/prps/reviews/fixes/pr-42-fixes.md` |
21
+ | `docs/prps/reviews/local-20260408-143022-review.md` | `docs/prps/reviews/fixes/local-20260408-143022-fixes.md` |
22
+ | `.ycc/artifacts/<slug>/reviews/pr-42-review.md` (linear) | `.ycc/artifacts/<slug>/reviews/pr-42-fixes.md` |
23
23
 
24
- After writing the fix report, stage and commit it to the PR branch alongside the fix commits:
24
+ Local mode only: after writing the fix report, stage and commit it to the PR branch alongside the fix commits. Linear mode never commits it (gitignored, `REPORT_COMMITTED: n/a`) and never stages a `.gitignore` change made by `--ensure`. Stage fix commits by explicit path (`git add -- <fixed files>`), never `git add -A`.
25
25
 
26
26
  ```bash
27
27
  FIX_REPORT_REL="docs/prps/reviews/fixes/<name>-fixes.md"
@@ -92,7 +92,7 @@ git push
92
92
 
93
93
  - Re-run `/ycc:code-review <same target>` to verify the remaining open findings and confirm fixes resolved the issues
94
94
  - Address failed fixes manually using the Blocker + Recommendation notes above
95
- - Run `/ycc:git-workflow --commit` to commit the changes when satisfied
95
+ - Commit the fixed files by name when satisfied (`/ycc:prp-commit <fixed files>`); leave any artifact-store `.gitignore` rule out of the commit
96
96
  ```
97
97
 
98
98
  ## Worktree summary (only when `WORKTREE_ACTIVE=true`)
@@ -115,5 +115,8 @@ WORKTREE_ACTIVE=true
115
115
  3. **Advance** to the next severity batch. No merge step. No child worktree removal.
116
116
 
117
117
  **Status updates**: Edit the `Status:` field in the review artifact file in place
118
- (Open → Fixed / Failed) after each agent completes its finding. The artifact lives
119
- in the active worktree at `$PARENT_PATH/docs/prps/reviews/pr-<N>-review.md`.
118
+ (Open → Fixed / Failed) after each agent completes its finding. In local mode the
119
+ artifact lives in the active worktree at `$PARENT_PATH/docs/prps/reviews/pr-<N>-review.md`.
120
+ In linear mode it is the resolved cache file (`$REVIEW_FILE`, under
121
+ `.ycc/artifacts/<slug>/reviews/`); edit it there and re-Save its Document per
122
+ SKILL.md Phase 4, never copying it into the worktree or committing it.
@@ -28,11 +28,13 @@ summary, no interactive checkpoint), regardless of `$ARGUMENTS`.
28
28
 
29
29
  **Outputs**:
30
30
 
31
- - `${PLANS_DIR}/[feature-name]/research-architecture.md`
32
- - `${PLANS_DIR}/[feature-name]/research-patterns.md`
33
- - `${PLANS_DIR}/[feature-name]/research-integration.md`
34
- - `${PLANS_DIR}/[feature-name]/research-docs.md`
35
- - `${PLANS_DIR}/[feature-name]/shared.md`
31
+ - `${research_dir}/research-architecture.md`
32
+ - `${research_dir}/research-patterns.md`
33
+ - `${research_dir}/research-integration.md`
34
+ - `${research_dir}/research-docs.md`
35
+ - `${shared_file}`
36
+
37
+ Canonical `plan-workflow` resolves these paths with the artifact-store `research-<lens>` and `shared` kinds. Local mode keeps today's `docs/plans/<feature>/` paths; linear mode resolves under `.ycc/artifacts/<feature>/`, places research under `research/`, and saves the research and shared documents to Linear.
36
38
 
37
39
  After creating the shared context files and displaying the summary, **STOP COMPLETELY**.
38
40
 
@@ -47,7 +49,8 @@ After creating the shared context files and displaying the summary, **STOP COMPL
47
49
  **Target**: `$ARGUMENTS`
48
50
 
49
51
  - **--dry-run**: Show orchestration plan without creating files. Writes nothing.
50
- - **feature-name**: Required. Directory name under `${PLANS_DIR}` (kebab-case).
52
+ - **feature-name**: Required. Feature slug passed to canonical `plan-workflow` for artifact-store resolution (kebab-case).
53
+ - **--store=local|linear**: Optional artifact-store override, forwarded to canonical `plan-workflow`. Linear is the default.
51
54
 
52
55
  If any unsupported flag is present (see Flag policy above), abort with a usage error and STOP:
53
56
 
@@ -84,14 +87,14 @@ Build the **effective `$ARGUMENTS`** for canonical `plan-workflow`:
84
87
 
85
88
  ## Location
86
89
 
87
- ${feature_dir}/shared.md
90
+ ${shared_file}
88
91
 
89
92
  ## Research Files
90
93
 
91
- - ${feature_dir}/research-architecture.md
92
- - ${feature_dir}/research-patterns.md
93
- - ${feature_dir}/research-integration.md
94
- - ${feature_dir}/research-docs.md
94
+ - ${research_dir}/research-architecture.md
95
+ - ${research_dir}/research-patterns.md
96
+ - ${research_dir}/research-integration.md
97
+ - ${research_dir}/research-docs.md
95
98
 
96
99
  ## Next Step (User Triggered)
97
100
 
@@ -30,9 +30,9 @@ The non-negotiable invariants:
30
30
 
31
31
  - **Accept ANY plan path.** Never assume `docs/prps/plans` or any fixed
32
32
  location. The plan path is supplied by the caller and may live anywhere.
33
- - **Derive `visual/` relative to the given plan path.** Output goes into a
34
- `visual/` sibling of the plan file — `<dirname of plan>/visual/` — computed
35
- from the path handed in, never hardcoded.
33
+ - **Resolve `visual/` by store.** Local mode keeps the sibling
34
+ `<dirname of plan>/visual/`. Linear mode (default) writes under the resolved
35
+ feature cache's `visual/`, never beside a legacy or external source plan.
36
36
  - **NEVER edit the plan file.** Read it; write only into the derived `visual/`
37
37
  directory. The plan artifact stays byte-for-byte intact.
38
38
  - **NEVER re-run research or dispatch.** Only consume the existing plan.
@@ -49,6 +49,7 @@ Parse `$ARGUMENTS`:
49
49
  hosted egress (destination `plan.agent-native.com`). Without it, the skill
50
50
  runs in **local-files** mode and no plan content is uploaded to hosted storage.
51
51
  See **Egress & consent** below.
52
+ - **`--store=local|linear`** — parse and strip before selecting the plan path. Retain the exact override as `STORE_FLAG` (empty when absent), reject invalid/conflicting overrides, and forward `${STORE_FLAG}` to every resolver call.
52
53
 
53
54
  ## Mode selection (auto)
54
55
 
@@ -97,15 +98,32 @@ exact tag names, required fields, and prop shapes.
97
98
 
98
99
  ## Core workflow
99
100
 
100
- 1. **Read the source plan.** Read the file at the given path (read-only). Derive
101
- the output dir with the thin helper (it computes the `visual/` sibling per the
102
- contract and never hardcodes a location). Invoke it directly, then capture its
103
- stdout as `OUT`:
101
+ 1. **Read the source plan.** Read the given path (read-only). Step 1: print the resolved store and read `ARTIFACT_STORE=` from stdout:
104
102
 
103
+ ```bash
104
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell
105
105
  ```
106
- {{package-root}}/skills/visual-plan/scripts/derive-visual-dir.sh <plan> --mkdir
106
+
107
+ In local mode, capture `OUT` from the unchanged sibling-directory helper:
108
+
109
+ ```bash
110
+ OUT="$(bash "{{package-root}}/skills/visual-plan/scripts/derive-visual-dir.sh" <plan> --mkdir)"
111
+ ```
112
+
113
+ In linear mode, identify the source feature slug from its cache directory or
114
+ its Linear Project identity; otherwise use artifact-store.md **Slugs**.
115
+ Step 2: apply the **Linear call gate** before any write or `--ensure`. Step 3: resolve the feature root after the gate:
116
+
117
+ ```bash
118
+ FEATURE_DIR="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=feature-dir --slug=<slug>)"
119
+ OUT="$FEATURE_DIR/visual"
120
+ mkdir -p "$OUT"
107
121
  ```
108
122
 
123
+ Follow artifact-store.md **Size and diagrams** for visual files and links;
124
+ do not upload the visual bundle as a planning Document. Shell state does not
125
+ persist across tool calls: retain the resolved absolute `OUT`.
126
+
109
127
  Gather the plan's exact text — do not invent source content.
110
128
 
111
129
  2. **Resolve blocks by mode.** With `--share`, call `get-plan-blocks`. In the
@@ -13,7 +13,7 @@ file, and architecture changes become the same `data-model`, `api-endpoint`, `fi
13
13
  and `diagram` blocks a forward plan would use, only now they summarize work that exists. A
14
14
  reviewer scans the shape of the change before spending attention on the literal lines.
15
15
 
16
- **Operational context:** Keep recap content local-only: write docs/prps/reviews/visual/ and preview through the localhost bridge; never upload code to hosted services. Accept a Git range, branch, or tracked working-tree diff; behavior is remote-agnostic.
16
+ **Operational context:** Keep recap content local-only: write docs/prps/reviews/visual/ and preview through the localhost bridge; never upload code to hosted services. Accept a Git range, branch, or tracked working-tree diff; behavior is remote-agnostic. This path is intentionally outside the artifact store: `--store` and linear mode never move or upload it.
17
17
 
18
18
  ## LOCAL-ONLY mandate — read this first
19
19
 
@@ -18,10 +18,22 @@ if [[ -d "docs" ]]; then
18
18
  echo "✅ \`docs/\` directory exists"
19
19
  echo ""
20
20
  echo "\`\`\`"
21
+ # Capture the full find output and trim with head on a here-string, not
22
+ # `find | head`: under pipefail an early-exiting head SIGPIPEs find once
23
+ # there are more files than the limit and errexit aborts the audit
24
+ # (YAN-1587).
21
25
  if command -v tree &> /dev/null; then
22
- tree -L 3 docs 2>/dev/null || find docs -type f -name "*.md" | head -50
26
+ tree -L 3 docs 2>/dev/null || {
27
+ doc_listing="$(find docs -type f -name "*.md" || true)"
28
+ if [[ -n "$doc_listing" ]]; then
29
+ head -n 50 <<<"$doc_listing"
30
+ fi
31
+ }
23
32
  else
24
- find docs -type f -name "*.md" 2>/dev/null | head -50
33
+ doc_listing="$(find docs -type f -name "*.md" 2>/dev/null || true)"
34
+ if [[ -n "$doc_listing" ]]; then
35
+ head -n 50 <<<"$doc_listing"
36
+ fi
25
37
  fi
26
38
  echo "\`\`\`"
27
39
  echo ""
@@ -38,7 +50,14 @@ echo ""
38
50
  echo "## README Files"
39
51
  echo ""
40
52
  readme_files=$(find . -name "README.md" -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null)
41
- readme_count=$(echo "$readme_files" | grep -c "README.md" || echo "0")
53
+ # grep -c prints the count itself; exit 1 only means zero matches. Any other
54
+ # non-zero status is a real failure.
55
+ readme_count_status=0
56
+ readme_count=$(grep -c "README.md" <<<"$readme_files") || readme_count_status=$?
57
+ if [ "$readme_count_status" -gt 1 ]; then
58
+ echo "Error: Failed to count README.md files" >&2
59
+ exit "$readme_count_status"
60
+ fi
42
61
  echo "📊 **Total README.md files**: ${readme_count}"
43
62
  echo ""
44
63
  if [[ -n "$readme_files" ]]; then
@@ -59,7 +78,14 @@ echo ""
59
78
  echo "## AGENTS.md Files"
60
79
  echo ""
61
80
  claude_files=$(find . -name "AGENTS.md" -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null)
62
- claude_count=$(echo "$claude_files" | grep -c "AGENTS.md" || echo "0")
81
+ # grep -c prints the count itself; exit 1 only means zero matches. Any other
82
+ # non-zero status is a real failure.
83
+ claude_count_status=0
84
+ claude_count=$(grep -c "AGENTS.md" <<<"$claude_files") || claude_count_status=$?
85
+ if [ "$claude_count_status" -gt 1 ]; then
86
+ echo "Error: Failed to count AGENTS.md files" >&2
87
+ exit "$claude_count_status"
88
+ fi
63
89
  echo "📊 **Total AGENTS.md files**: ${claude_count}"
64
90
  echo ""
65
91
  if [[ -n "$claude_files" && "$claude_count" -gt 0 ]]; then
@@ -107,10 +133,16 @@ echo "## Inline Documentation Density"
107
133
  echo ""
108
134
 
109
135
  # Check for JSDoc comments in JS/TS files
110
- js_ts_files=$(find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null | head -100)
136
+ # Capture all of find's output, then trim with head on a here-string: a
137
+ # `find | head -100` pipeline SIGPIPEs find past 100 files and pipefail +
138
+ # errexit aborts the audit (YAN-1587).
139
+ all_js_ts_files=$(find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null || true)
140
+ js_ts_files=$(head -n 100 <<<"$all_js_ts_files")
111
141
  if [[ -n "$js_ts_files" ]]; then
112
142
  total_js_files=$(echo "$js_ts_files" | wc -l | tr -d ' ')
113
- jsdoc_count=$(echo "$js_ts_files" | xargs grep -l "@param\|@returns\|@description" 2>/dev/null | wc -l | tr -d ' ')
143
+ # xargs exits 123 when a grep batch matches nothing; tolerate it so a
144
+ # zero-match scan reports 0 instead of aborting under errexit+pipefail.
145
+ jsdoc_count=$({ xargs grep -l "@param\|@returns\|@description" <<<"$js_ts_files" 2>/dev/null || true; } | wc -l | tr -d ' ')
114
146
  echo "### JavaScript/TypeScript"
115
147
  echo "- Files scanned: ${total_js_files}"
116
148
  echo "- Files with JSDoc: ${jsdoc_count}"
@@ -122,10 +154,11 @@ if [[ -n "$js_ts_files" ]]; then
122
154
  fi
123
155
 
124
156
  # Check for docstrings in Python files
125
- py_files=$(find . -type f -name "*.py" -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./.venv/*" 2>/dev/null | head -100)
157
+ all_py_files=$(find . -type f -name "*.py" -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./.venv/*" 2>/dev/null || true)
158
+ py_files=$(head -n 100 <<<"$all_py_files")
126
159
  if [[ -n "$py_files" ]]; then
127
160
  total_py_files=$(echo "$py_files" | wc -l | tr -d ' ')
128
- docstring_count=$(echo "$py_files" | xargs grep -l '"""' 2>/dev/null | wc -l | tr -d ' ')
161
+ docstring_count=$({ xargs grep -l '"""' <<<"$py_files" 2>/dev/null || true; } | wc -l | tr -d ' ')
129
162
  echo "### Python"
130
163
  echo "- Files scanned: ${total_py_files}"
131
164
  echo "- Files with docstrings: ${docstring_count}"
@@ -137,10 +170,11 @@ if [[ -n "$py_files" ]]; then
137
170
  fi
138
171
 
139
172
  # Check for Go doc comments
140
- go_files=$(find . -type f -name "*.go" -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null | head -100)
173
+ all_go_files=$(find . -type f -name "*.go" -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null || true)
174
+ go_files=$(head -n 100 <<<"$all_go_files")
141
175
  if [[ -n "$go_files" ]]; then
142
176
  total_go_files=$(echo "$go_files" | wc -l | tr -d ' ')
143
- godoc_count=$(echo "$go_files" | xargs grep -l "^// [A-Z]" 2>/dev/null | wc -l | tr -d ' ')
177
+ godoc_count=$({ xargs grep -l "^// [A-Z]" <<<"$go_files" 2>/dev/null || true; } | wc -l | tr -d ' ')
144
178
  echo "### Go"
145
179
  echo "- Files scanned: ${total_go_files}"
146
180
  echo "- Files with doc comments: ${godoc_count}"
@@ -63,8 +63,12 @@ generate_tree() {
63
63
 
64
64
  # Get recently updated files (portable across GNU/BSD)
65
65
  get_recent_files() {
66
- # Find all markdown files and get their timestamps using portable stat
67
- find "$DOCS_DIR" -type f -name "*.md" 2>/dev/null | while IFS= read -r file; do
66
+ # Find all markdown files and get their timestamps using portable stat.
67
+ # Sort into a variable and trim with head on a here-string, not
68
+ # `sort | head`: under pipefail an early-exiting head SIGPIPEs the writer
69
+ # (YAN-1587).
70
+ local stamped sorted
71
+ stamped="$(find "$DOCS_DIR" -type f -name "*.md" 2>/dev/null | while IFS= read -r file; do
68
72
  # Try GNU stat first, fallback to BSD stat
69
73
  if timestamp=$(stat -c '%Y' "$file" 2>/dev/null); then
70
74
  # GNU stat
@@ -73,7 +77,10 @@ get_recent_files() {
73
77
  # BSD stat
74
78
  echo "$timestamp $file"
75
79
  fi
76
- done | sort -rn | head -10 | while read -r timestamp file; do
80
+ done)"
81
+ [[ -n "$stamped" ]] || return 0
82
+ sorted="$(sort -rn <<<"$stamped")"
83
+ head -n 10 <<<"$sorted" | while read -r timestamp file; do
77
84
  # Format date (both GNU and BSD date support -r)
78
85
  local date
79
86
  date=$(date -d "@$timestamp" '+%Y-%m-%d' 2>/dev/null || date -r "$timestamp" '+%Y-%m-%d' 2>/dev/null)