@yandy-r/ycc-opencode 6.1.1 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) 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/package.json +1 -1
  9. package/shared/references/artifact-store.md +613 -0
  10. package/shared/references/branch-prep.md +2 -0
  11. package/shared/references/forge-detection.md +3 -2
  12. package/shared/references/review-artifact-format.md +13 -6
  13. package/shared/references/review-checklist.md +3 -2
  14. package/shared/references/review-dispatch.md +15 -10
  15. package/shared/references/target-capability-matrix.md +42 -6
  16. package/shared/references/visual-mode.md +19 -13
  17. package/shared/references/worktree-strategy.md +12 -8
  18. package/shared/scripts/artifact-body.sh +71 -0
  19. package/shared/scripts/artifact-store-pointer.sh +245 -0
  20. package/shared/scripts/ci-monitor.sh +9 -4
  21. package/shared/scripts/collect-linear-keys.sh +77 -0
  22. package/shared/scripts/lib/ci-classify.sh +13 -10
  23. package/shared/scripts/lib/forge.sh +13 -4
  24. package/shared/scripts/prepare-feature-branch.sh +96 -10
  25. package/shared/scripts/release-ci-monitor.sh +2 -2
  26. package/shared/scripts/report-bundle-drift.sh +1 -1
  27. package/shared/scripts/resolve-artifact-store.sh +636 -0
  28. package/shared/scripts/validate-file-paths.sh +11 -4
  29. package/skills/blueprint/SKILL.md +48 -13
  30. package/skills/clean/SKILL.md +1 -1
  31. package/skills/clean/scripts/detect-project-type.sh +2 -2
  32. package/skills/clean/scripts/generate-report.sh +34 -5
  33. package/skills/clean/scripts/validate-safety.sh +9 -6
  34. package/skills/code-report/SKILL.md +26 -14
  35. package/skills/code-report/scripts/check-prerequisites.sh +72 -12
  36. package/skills/code-report/templates/report-structure.md +1 -1
  37. package/skills/code-review/SKILL.md +68 -17
  38. package/skills/code-review/references/pr-procedure.md +28 -15
  39. package/skills/compatibility-audit/scripts/audit-target-features.sh +1 -1
  40. package/skills/deep-research/SKILL.md +28 -5
  41. package/skills/deep-research/references/completion-summary-template.md +3 -2
  42. package/skills/deep-research/scripts/validate-research.sh +8 -2
  43. package/skills/feature-research/SKILL.md +48 -25
  44. package/skills/feature-research/scripts/validate-research.sh +51 -12
  45. package/skills/feature-research/scripts/validate-spec.sh +53 -22
  46. package/skills/feature-research/templates/research-agents.md +15 -14
  47. package/skills/feature-research/templates/spec-structure.md +5 -0
  48. package/skills/formatters/scripts/apply-aliases.sh +3 -1
  49. package/skills/formatters/scripts/apply-ci.sh +3 -1
  50. package/skills/git-workflow/SKILL.md +2 -1
  51. package/skills/git-workflow/references/pr-creation.md +10 -0
  52. package/skills/git-workflow/scripts/analyze-changes.sh +21 -11
  53. package/skills/git-workflow/scripts/create-pr.sh +51 -6
  54. package/skills/git-workflow/scripts/validate-commit.sh +26 -14
  55. package/skills/hooks-workflow/scripts/verify-hooks.sh +1 -1
  56. package/skills/implement-plan/SKILL.md +35 -16
  57. package/skills/implement-plan/references/agent-task-prompt.md +8 -5
  58. package/skills/implement-plan/references/linear-sync.md +20 -0
  59. package/skills/implement-plan/references/output-formats.md +17 -2
  60. package/skills/implement-plan/references/plan-inputs.md +23 -4
  61. package/skills/implement-plan/scripts/check-prerequisites.sh +95 -49
  62. package/skills/implement-plan/scripts/parse-dependencies.sh +10 -10
  63. package/skills/init/SKILL.md +77 -42
  64. package/skills/init/references/flag-reference.md +41 -17
  65. package/skills/init/references/project-profile-heuristics.md +3 -0
  66. package/skills/init/references/template-library.md +15 -5
  67. package/skills/init/scripts/profile-project.sh +26 -0
  68. package/skills/init/scripts/render-template.py +2 -2
  69. package/skills/init/templates/AGENTS.md.tmpl +6 -0
  70. package/skills/init/templates/git/gitignore.tmpl +5 -0
  71. package/skills/orchestrate/SKILL.md +17 -2
  72. package/skills/parallel-plan/SKILL.md +14 -8
  73. package/skills/plan/SKILL.md +18 -2
  74. package/skills/plan/references/planning-tracks.md +1 -1
  75. package/skills/plan-workflow/SKILL.md +67 -32
  76. package/skills/plan-workflow/references/checkpoint-messages.md +23 -14
  77. package/skills/plan-workflow/references/plan-structure.md +1 -1
  78. package/skills/plan-workflow/references/planning-agents.md +11 -9
  79. package/skills/plan-workflow/references/research-agents-optimized.md +12 -10
  80. package/skills/plan-workflow/references/research-agents.md +11 -10
  81. package/skills/plan-workflow/scripts/check-prerequisites.sh +50 -11
  82. package/skills/plan-workflow/scripts/check-state.sh +53 -9
  83. package/skills/plan-workflow/scripts/persist-or-fail.sh +21 -7
  84. package/skills/plan-workflow/scripts/validate-analysis-artifacts.sh +28 -14
  85. package/skills/plan-workflow/scripts/validate-research-artifacts.sh +35 -10
  86. package/skills/plan-workflow/scripts/validate-shared.sh +56 -15
  87. package/skills/plan-workflow/scripts/validate-workflow-plan.sh +48 -17
  88. package/skills/pr-autofix/SKILL.md +19 -4
  89. package/skills/pr-autofix/references/output-templates.md +3 -2
  90. package/skills/pr-autofix/scripts/fetch-pr-comments.sh +1 -2
  91. package/skills/pr-autofix/scripts/post-summary.sh +1 -2
  92. package/skills/pr-autofix/scripts/resolve-thread.sh +3 -4
  93. package/skills/prp-implement/SKILL.md +31 -16
  94. package/skills/prp-implement/references/agent-task-prompt.md +5 -2
  95. package/skills/prp-implement/references/detection.md +4 -1
  96. package/skills/prp-implement/references/linear-sync.md +25 -0
  97. package/skills/prp-implement/references/report-output.md +15 -2
  98. package/skills/prp-plan/SKILL.md +62 -30
  99. package/skills/prp-plan/references/enhanced-researchers.md +8 -9
  100. package/skills/prp-plan/scripts/validate-prp-plan.sh +42 -18
  101. package/skills/prp-pr/SKILL.md +14 -1
  102. package/skills/prp-prd/SKILL.md +21 -9
  103. package/skills/prp-spec/SKILL.md +30 -20
  104. package/skills/quick-fix/SKILL.md +6 -4
  105. package/skills/quick-review/SKILL.md +62 -25
  106. package/skills/release-model/scripts/collect-signals.sh +9 -3
  107. package/skills/releaser/scripts/publish-release.sh +6 -3
  108. package/skills/research-to-issues/SKILL.md +33 -14
  109. package/skills/research-to-issues/scripts/validate-prerequisites.sh +45 -23
  110. package/skills/research-to-issues/templates/task-issue.md +4 -0
  111. package/skills/research-to-issues/templates/tracking-issue.md +3 -0
  112. package/skills/review-fix/SKILL.md +96 -14
  113. package/skills/review-fix/references/fix-report.md +10 -10
  114. package/skills/review-fix/references/plan.md +5 -2
  115. package/skills/shared-context/SKILL.md +14 -11
  116. package/skills/visual-plan/SKILL.md +26 -8
  117. package/skills/visual-recap/SKILL.md +1 -1
  118. package/skills/write-docs/scripts/audit-documentation.sh +44 -10
  119. package/skills/write-docs/scripts/generate-doc-index.sh +10 -3
@@ -11,7 +11,7 @@ metadata:
11
11
  > The whole-software charter. Sits at the top of the funnel — upstream of `prp-prd`, `prp-spec`, and every other planning
12
12
  > skill. Produces ONE durable source-of-truth spec for an entire piece of software, then bootstraps the project from it.
13
13
 
14
- **Operational context:** Write the whole-project source of truth to docs/blueprint.md through Foundation, Grounding, Scope, Tech Stack, Architecture, and Generate gates; its machine-readable Bootstrap section drives /ycc:init and /formatters. This is upstream of per-feature prp-prd and prp-spec.
14
+ **Operational context:** Write the whole-project source of truth to the resolved `blueprint` artifact through Foundation, Grounding, Scope, Tech Stack, Architecture, and Generate gates; its machine-readable Bootstrap section drives /ycc:init and /formatters. This is upstream of per-feature prp-prd and prp-spec.
15
15
 
16
16
  **Input**: `$ARGUMENTS`
17
17
 
@@ -36,9 +36,10 @@ You are a principal engineer + product strategist who:
36
36
 
37
37
  Parse from `$ARGUMENTS`:
38
38
 
39
- - `--update` — re-run over an existing `docs/blueprint.md`; diff-and-merge instead of overwrite.
39
+ - `--update` — re-run over the existing resolved blueprint; diff-and-merge instead of overwrite.
40
40
  - `--dry-run` — walk the gates and show the spec preview, but do NOT write the file or
41
41
  bootstrap. If set, also pass `--dry-run` through to any orchestrated `/ycc:init` call.
42
+ - `--store=local|linear` — parse and strip before interpreting the project idea; retain the exact override as `STORE_FLAG` (empty when absent), reject invalid/conflicting overrides, and forward `${STORE_FLAG}` to every resolver call.
42
43
 
43
44
  ```
44
45
  DETECT → INITIATE → FOUNDATION → GROUNDING → SCOPE → TECH STACK → ARCHITECTURE → GENERATE → HANDOFF
@@ -54,6 +55,37 @@ dual-mode (market + codebase) discovery. Every `[GATE]` means: present the quest
54
55
 
55
56
  ## Phase 0: DETECT — Project Context
56
57
 
58
+ Resolve the store and blueprint path before detection. Derive the shared repository name from the main checkout, not the worktree directory:
59
+
60
+ ```bash
61
+ COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)"
62
+ if [ "$(basename "$COMMON_DIR" 2>/dev/null)" = ".git" ]; then
63
+ REPO_NAME="$(basename "$(dirname "$COMMON_DIR")")" # normal checkout or worktree
64
+ elif [ -n "$COMMON_DIR" ]; then
65
+ REPO_NAME="$(basename "$COMMON_DIR" .git)" # bare repo or submodule
66
+ else
67
+ REPO_NAME="$(basename "$PWD")" # not a git repository
68
+ fi
69
+ ```
70
+
71
+ Set `<slug>` from `REPO_NAME`: lowercase, replace characters outside `[a-z0-9._-]` with `-`, collapse hyphens and trim leading/trailing separators; never use the feature name. If no valid slug remains, ask for one.
72
+
73
+ 1. Print the mode and read `ARTIFACT_STORE=` from stdout:
74
+
75
+ ```bash
76
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell
77
+ OUT="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=blueprint --slug=<slug>)"
78
+ ```
79
+
80
+ 2. For a real linear run only, apply the **Linear call gate** from `{{package-root}}/shared/references/artifact-store.md` before any write or pull. Dry runs only resolve paths, never ensure, Load or create files.
81
+ 3. Before Lookup/Load in a real linear run, establish the safe cache and gitignore rule:
82
+
83
+ ```bash
84
+ OUT="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=blueprint --slug=<slug>)"
85
+ ```
86
+
87
+ Then follow artifact-store.md **Planning skills**: when document identity is missing, Lookup steps 3–6 and Load any hit before checking whether a blueprint exists; preserve identity and use Conflict for replacement before Save. Local mode keeps `docs/blueprint.md` under the current checkout's git toplevel. Retain the printed mode, main-checkout slug and absolute path across tool calls.
88
+
57
89
  Determine whether this is greenfield, an existing repo, or a re-run.
58
90
 
59
91
  1. Run the shared profiler (read its `key=value` output; do NOT reimplement profiling):
@@ -63,15 +95,15 @@ Determine whether this is greenfield, an existing repo, or a re-run.
63
95
  ```
64
96
 
65
97
  If the script is unavailable (non-Claude target / missing path), fall back gracefully:
66
- `test -f docs/blueprint.md` and a quick `ls` to judge emptiness. Do not fail the run.
98
+ Check the resolved `$OUT` and inspect the repository directory to judge emptiness. Do not fail the run.
67
99
 
68
100
  2. Classify:
69
101
  - **Greenfield** (`is_empty=true`): tech-stack phase is forward-looking; skip codebase grounding.
70
102
  - **Existing repo**: grounding includes codebase mode; reconcile the _detected_ profile
71
103
  against the _desired_ profile and flag any mismatch as a risk/decision.
72
- - **Re-run** (`docs/blueprint.md` exists): if `--update`, do a structured refresh
104
+ - **Re-run** (resolved blueprint exists locally or in Linear): if `--update`, do a structured refresh
73
105
  (diff each section, merge, preserve user edits). Without `--update`, tell the user the
74
- file exists and ask whether to refresh (`--update`) or abort. Never silently overwrite.
106
+ artifact exists and ask whether to refresh (`--update`) or abort. Never silently overwrite.
75
107
 
76
108
  ---
77
109
 
@@ -207,17 +239,20 @@ Ask:
207
239
 
208
240
  ## Phase 7: GENERATE — Write the Blueprint
209
241
 
210
- **Output path**: `docs/blueprint.md` (fixed — there is exactly one per repo).
242
+ **Output path**: resolved `$OUT` (one blueprint per repo, keyed by the sanitized main-checkout name).
211
243
 
212
- If `--dry-run`, render the spec preview to the user and skip writing. Otherwise:
244
+ If `--dry-run`, render the spec preview to the user and skip writing. Otherwise, in linear mode apply the Linear call gate before `--ensure`:
213
245
 
214
246
  ```bash
215
- mkdir -p docs
247
+ OUT="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=blueprint --slug=<slug>)"
248
+ mkdir -p "$(dirname "$OUT")"
216
249
  ```
217
250
 
218
251
  If re-running with `--update`, merge into the existing file section-by-section, preserving
219
252
  user edits; otherwise write fresh.
220
253
 
254
+ Write `$OUT`; local mode adds no identity frontmatter. Linear mode follows artifact-store.md **Planning skills** to prepare any missing document identity via Lookup/Load before writing, then Save the blueprint, preserving loaded identity and user edits.
255
+
221
256
  ### Blueprint Template
222
257
 
223
258
  ````markdown
@@ -366,7 +401,7 @@ Otherwise ask via `ask the user`:
366
401
  ```markdown
367
402
  ## Blueprint Created
368
403
 
369
- **File**: `docs/blueprint.md`
404
+ **File**: `{resolved absolute OUT path}`
370
405
 
371
406
  **Vision**: {one line}
372
407
  **Stack**: {profile + key frameworks}
@@ -378,7 +413,7 @@ Otherwise ask via `ask the user`:
378
413
 
379
414
  ### Next Steps
380
415
 
381
- - Reference `docs/blueprint.md` as the canonical project description in `AGENTS.md`.
416
+ - In local mode, reference the repo-relative `docs/blueprint.md` as the canonical project description in `AGENTS.md`, never the absolute machine path above. In linear mode, reference the Linear Document `<slug> · blueprint` (with its URL), never the gitignored cache path.
382
417
  - Per module in the breakdown, run `/ycc:prp-spec` (or `/ycc:prp-prd` for fuzzy ones)
383
418
  to produce a feature spec, then `/ycc:prp-plan` → `/ycc:prp-implement`.
384
419
  ```
@@ -390,7 +425,7 @@ Otherwise ask via `ask the user`:
390
425
  `blueprint` is the **charter altitude** — upstream of all feature work:
391
426
 
392
427
  ```
393
- IDEA → /ycc:blueprint → docs/blueprint.md
428
+ IDEA → /ycc:blueprint → resolved blueprint artifact
394
429
  └─Bootstrap→ /ycc:init [--profile --templates --git --formatters --release-model]
395
430
  ├─Phase 5.5→ /ycc:release-model [--model <m> --yes] → RELEASING.md
396
431
  └─Phase 6.5→ /ycc:formatters [--ci --hooks --<stack>]
@@ -398,8 +433,8 @@ IDEA → /ycc:blueprint → docs/blueprint.md
398
433
  ```
399
434
 
400
435
  - `blueprint` answers "what is this whole software and how do we stand it up?" ONCE per project.
401
- - `prp-prd` / `prp-spec` answer "what is this one feature/increment?" — they live under
402
- `docs/prps/` and are run repeatedly, seeded by the blueprint's module breakdown.
436
+ - `prp-prd` / `prp-spec` answer "what is this one feature/increment?" — they use
437
+ their resolved artifact paths and run repeatedly, seeded by the blueprint's module breakdown.
403
438
  - Each row of the Module / Component Breakdown is the natural seed for one downstream feature spec.
404
439
 
405
440
  ## Success Criteria
@@ -74,7 +74,7 @@ After all agents complete:
74
74
 
75
75
  ## Phase 3: Report Generation and User Review
76
76
 
77
- 1. Run: `{{package-root}}/skills/clean/scripts/generate-report.sh "$TARGET_DIR"`
77
+ 1. Run: `{{package-root}}/skills/clean/scripts/generate-report.sh "$TARGET_DIR"`. If it exits non-zero, **STOP**: report the error to the user and do not run `validate-safety.sh` on a partial report
78
78
  2. Run safety validation: `{{package-root}}/skills/clean/scripts/validate-safety.sh "$TARGET_DIR/.cleanup-analysis/cleanup-report.md"`
79
79
  3. Fix any violations before proceeding
80
80
  4. **If --report-only**: Display report summary and **STOP**
@@ -193,7 +193,7 @@ detect_go() {
193
193
  fi
194
194
 
195
195
  # Check for .go files
196
- if find "$TARGET_DIR" -maxdepth 2 -name "*.go" -type f | grep -q .; then
196
+ if find "$TARGET_DIR" -maxdepth 2 -name "*.go" -type f -print -quit | grep -q .; then
197
197
  score=$((score + 3))
198
198
  echo " ✓ .go files found"
199
199
  fi
@@ -221,7 +221,7 @@ detect_rust() {
221
221
  echo " ✓ Cargo.lock found"
222
222
  fi
223
223
 
224
- if dir_exists "src" && find "$TARGET_DIR/src" -name "*.rs" -type f | grep -q .; then
224
+ if dir_exists "src" && find "$TARGET_DIR/src" -name "*.rs" -type f -print -quit | grep -q .; then
225
225
  score=$((score + 3))
226
226
  echo " ✓ Rust source files found"
227
227
  fi
@@ -13,6 +13,12 @@
13
13
 
14
14
  set -euo pipefail
15
15
 
16
+ # Any unexpected failure (including a failed findings read) maps to exit 2 so
17
+ # the script never claims success after a partial run, and the partial report
18
+ # is removed. Usage errors below exit 1 explicitly and do not pass through this
19
+ # trap. Functions do not inherit ERR (no set -E), so they must `|| return`.
20
+ trap 'echo "Error: Failed to generate report (line ${LINENO}: ${BASH_COMMAND})" >&2; if [[ -n "${REPORT_PATH:-}" ]]; then rm -f "$REPORT_PATH" "$REPORT_PATH.tmp" || true; fi; exit 2' ERR
21
+
16
22
  # Colors for output
17
23
  RED='\033[0;31m'
18
24
  GREEN='\033[0;32m'
@@ -27,7 +33,10 @@ if [[ ! -d "$TARGET_DIR" ]]; then
27
33
  fi
28
34
 
29
35
  # Convert to absolute path
30
- TARGET_DIR=$(cd "$TARGET_DIR" && pwd)
36
+ TARGET_DIR=$(cd "$TARGET_DIR" && pwd) || {
37
+ echo -e "${RED}Error: Cannot access directory: $TARGET_DIR${NC}" >&2
38
+ exit 1
39
+ }
31
40
 
32
41
  # Findings directory
33
42
  FINDINGS_DIR="$TARGET_DIR/.cleanup-analysis/findings"
@@ -51,7 +60,15 @@ echo ""
51
60
  count_files() {
52
61
  local findings_file="$1"
53
62
  if [[ -f "$findings_file" ]]; then
54
- grep -c '^###' "$findings_file" || echo "0"
63
+ # grep -c prints the count itself; exit 1 only means zero matches. Any
64
+ # other non-zero status (e.g. unreadable file) is a real failure.
65
+ local count status=0
66
+ count=$(grep -c '^###' "$findings_file") || status=$?
67
+ if [[ "$status" -gt 1 ]]; then
68
+ echo "Error: Failed to read findings file: $findings_file" >&2
69
+ return "$status"
70
+ fi
71
+ echo "$count"
55
72
  else
56
73
  echo "0"
57
74
  fi
@@ -61,7 +78,19 @@ count_files() {
61
78
  extract_total_size() {
62
79
  local findings_file="$1"
63
80
  if [[ -f "$findings_file" ]]; then
64
- grep -i "^- \*\*Total.*Size\*\*:" "$findings_file" | head -1 | sed 's/.*: //' || echo "0 B"
81
+ # grep exit 1 means no Total Size line; anything above 1 is a read error.
82
+ local line status=0
83
+ line=$(grep -i "^- \*\*Total.*Size\*\*:" "$findings_file") || status=$?
84
+ if [[ "$status" -gt 1 ]]; then
85
+ echo "Error: Failed to read findings file: $findings_file" >&2
86
+ return "$status"
87
+ fi
88
+ if [[ "$status" -eq 1 ]]; then
89
+ echo "0 B"
90
+ else
91
+ line="${line%%$'\n'*}"
92
+ echo "${line##*: }"
93
+ fi
65
94
  else
66
95
  echo "0 B"
67
96
  fi
@@ -143,8 +172,8 @@ replace_in_file() {
143
172
  local tmp_file
144
173
 
145
174
  tmp_file="${file}.tmp"
146
- sed "s|${pattern}|${replacement}|g" "$file" > "$tmp_file"
147
- mv "$tmp_file" "$file"
175
+ sed "s|${pattern}|${replacement}|g" "$file" > "$tmp_file" || return
176
+ mv "$tmp_file" "$file" || return
148
177
  }
149
178
 
150
179
  replace_in_file "$REPORT_PATH" "REPORT_DATE_PLACEHOLDER" "$REPORT_DATE"
@@ -138,10 +138,13 @@ echo "=========================================="
138
138
 
139
139
  # Extract file paths from report (simplified - looks for markdown file path patterns)
140
140
  FLAGGED_FILES=$(grep -E '^\|.*\|.*\|.*\|' "$REPORT_PATH" | grep -v '^|---' | grep -v '^| File Path' | cut -d'|' -f2 | tr -d ' ' | grep -v '^$' || true)
141
+ # FLAGGED_FILES is matched with here-strings, not `echo | grep -q`: under
142
+ # pipefail an early-exiting reader SIGPIPEs the echo writer and a present
143
+ # entry reads as missing (YAN-1587).
141
144
 
142
145
  protected_dir_violations=0
143
146
  for dir in "${PROTECTED_DIRS[@]}"; do
144
- if echo "$FLAGGED_FILES" | grep -q "/$dir/\|^$dir/"; then
147
+ if grep -q "/$dir/\|^$dir/" <<<"$FLAGGED_FILES"; then
145
148
  log_violation "Protected directory found in removal list: $dir"
146
149
  ((protected_dir_violations+=1))
147
150
  fi
@@ -158,7 +161,7 @@ echo "=========================================="
158
161
 
159
162
  protected_file_violations=0
160
163
  for file in "${PROTECTED_FILES[@]}"; do
161
- if echo "$FLAGGED_FILES" | grep -qE "(^|/)$file$"; then
164
+ if grep -qE "(^|/)$file$" <<<"$FLAGGED_FILES"; then
162
165
  log_violation "Protected file found in removal list: $file"
163
166
  ((protected_file_violations+=1))
164
167
  fi
@@ -277,7 +280,7 @@ for pattern in "${SECURITY_PATTERNS[@]}"; do
277
280
  # Convert glob pattern to grep pattern
278
281
  grep_pattern=$(echo "$pattern" | sed 's/\*/.*/')
279
282
 
280
- if echo "$FLAGGED_FILES" | grep -qE "$grep_pattern"; then
283
+ if grep -qE "$grep_pattern" <<<"$FLAGGED_FILES"; then
281
284
  log_warning "Security-sensitive file pattern detected: $pattern"
282
285
  ((security_issues+=1))
283
286
  fi
@@ -311,8 +314,8 @@ fi
311
314
  if command -v du &> /dev/null; then
312
315
  total_size_line=$(grep -i "total size\|space.*recover" "$REPORT_PATH" | head -1 || true)
313
316
 
314
- if echo "$total_size_line" | grep -qi "GB"; then
315
- size_value=$(echo "$total_size_line" | grep -oP '\d+\.?\d*(?=\s*GB)' | head -1 || echo "0")
317
+ if grep -qi "GB" <<<"$total_size_line"; then
318
+ size_value=$(grep -oP '\d+\.?\d*(?=\s*GB)' <<<"$total_size_line" | head -1 || echo "0")
316
319
  if (( $(echo "$size_value > 10" | bc -l) )); then
317
320
  log_warning "Large total size detected: ${size_value}GB - verify this is correct"
318
321
  fi
@@ -337,7 +340,7 @@ if [[ -f "$TARGET_DIR/.cleanupignore" ]]; then
337
340
  continue
338
341
  fi
339
342
 
340
- if echo "$FLAGGED_FILES" | grep -q "$protected_item"; then
343
+ if grep -q "$protected_item" <<<"$FLAGGED_FILES"; then
341
344
  log_violation "Custom protected item found in removal list: $protected_item"
342
345
  fi
343
346
  done < "$TARGET_DIR/.cleanupignore"
@@ -8,7 +8,7 @@ description: Generates implementation reports from executed parallel plans. Use
8
8
 
9
9
  Generate structured implementation reports documenting changes made during plan execution. This is an **optional Step 4** in the planning workflow, providing comprehensive documentation of what was implemented.
10
10
 
11
- **Operational context:** After implement-plan, write docs/plans/[feature-name]/report.md with an overview, changed files, implemented features, and test guidance; report generation is optional.
11
+ **Operational context:** After implement-plan, write the code report with an overview, changed files, implemented features, and test guidance: `docs/plans/[feature-name]/report.md` in local mode, or artifact-store kind `code-report` (`.ycc/artifacts/[feature-name]/code-report.md`, its own Linear Document) in linear mode, never implement-plan's run `report.md`. Report generation is optional.
12
12
 
13
13
  ## Workflow Integration
14
14
 
@@ -31,13 +31,14 @@ This skill is the optional final step of the planning workflow. It requires `par
31
31
 
32
32
  Parse arguments:
33
33
 
34
- - **feature-name**: The name of the feature to report on (matches directory name in `docs/plans/`)
34
+ - **feature-name**: The name of the feature to report on (its artifact-store feature directory)
35
35
  - **--dry-run**: Show what would be created without making changes
36
+ - **--store=local|linear**: Optional artifact-store override; strip it into `STORE_FLAG` and forward it to every helper call.
36
37
 
37
38
  If no feature name provided, abort with usage instructions:
38
39
 
39
40
  ```
40
- Usage: /ycc:code-report [feature-name] [--dry-run]
41
+ Usage: /ycc:code-report [feature-name] [--dry-run] [--store=local|linear]
41
42
 
42
43
  Examples:
43
44
  /ycc:code-report user-authentication
@@ -54,10 +55,10 @@ Examples:
54
55
 
55
56
  Extract the feature name from `$ARGUMENTS` (first non-flag argument).
56
57
 
57
- Run the prerequisites check script in Step 1, before reading planning documents:
58
+ Run the prerequisites check script in Step 1, before reading planning documents. It resolves the store (an existing local `docs/plans/[feature-name]/` keeps local mode under the default store, including legacy local names such as `team/auth`) and prints `Store:` and `Target:`; retain `ARTIFACT_STORE`, the absolute report `Target:` path, and its directory as `FEATURE_DIR` for every later step:
58
59
 
59
60
  ```bash
60
- {{package-root}}/skills/code-report/scripts/check-prerequisites.sh [feature-name]
61
+ {{package-root}}/skills/code-report/scripts/check-prerequisites.sh ${STORE_FLAG} [feature-name]
61
62
  ```
62
63
 
63
64
  If the script exits with error:
@@ -68,7 +69,7 @@ If the script exits with error:
68
69
 
69
70
  ### Step 2: Verify Planning Documents
70
71
 
71
- Confirm which files exist in `docs/plans/[feature-name]/`:
72
+ Confirm which files exist in `${FEATURE_DIR}/`:
72
73
 
73
74
  - `parallel-plan.md` (strongly recommended)
74
75
  - `shared.md` (optional but helpful)
@@ -82,9 +83,9 @@ Confirm which files exist in `docs/plans/[feature-name]/`:
82
83
 
83
84
  If they exist, read in this order:
84
85
 
85
- 1. `docs/plans/[feature-name]/parallel-plan.md` - The implementation plan
86
- 2. `docs/plans/[feature-name]/shared.md` - Architecture context
87
- 3. Any other `.md` files in `docs/plans/[feature-name]/`
86
+ 1. `${FEATURE_DIR}/parallel-plan.md` - The implementation plan
87
+ 2. `${FEATURE_DIR}/shared.md` - Architecture context
88
+ 3. Any other `.md` files in `${FEATURE_DIR}/`
88
89
 
89
90
  ### Step 4: Identify Changed Files
90
91
 
@@ -132,7 +133,7 @@ Display:
132
133
 
133
134
  ## Report Location
134
135
 
135
- docs/plans/[feature-name]/report.md
136
+ [Step 1 Target: path]
136
137
 
137
138
  ## Report Structure
138
139
 
@@ -165,7 +166,18 @@ cat {{package-root}}/skills/code-report/templates/report-structure.md
165
166
 
166
167
  ### Step 8: Generate Report Content
167
168
 
168
- Create `docs/plans/[feature-name]/report.md` with the following sections:
169
+ Unless `--dry-run`, set the destination:
170
+
171
+ - **Local mode** (`Store: local`): `OUT="${FEATURE_DIR}/report.md"` (the Step 1 `Target:`); create its parent with `mkdir -p "$(dirname "$OUT")"`. Write it as before, with no identity frontmatter or Linear calls.
172
+ - **Linear mode**: apply the **Linear call gate** from `{{package-root}}/shared/references/artifact-store.md`, then resolve kind `code-report`:
173
+
174
+ ```bash
175
+ OUT="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=code-report --slug=[feature-name])"
176
+ ```
177
+
178
+ Follow artifact-store.md **Planning skills** (Lookup/Load identity, then Save) for kind `code-report`: a Document titled `<slug> · code-report` on the feature Project. Never write `report.md` or touch `linear.statusUpdate`; those belong to implement-plan's run report.
179
+
180
+ Create `$OUT` with the following sections.
169
181
 
170
182
  #### Frontmatter
171
183
 
@@ -173,7 +185,7 @@ Create `docs/plans/[feature-name]/report.md` with the following sections:
173
185
  ---
174
186
  title: [Feature Name] Implementation Report
175
187
  date: [current date in mm/dd/yyyy format]
176
- original-plan: docs/plans/[feature-name]/parallel-plan.md
188
+ original-plan: ${FEATURE_DIR}/parallel-plan.md
177
189
  ---
178
190
  ```
179
191
 
@@ -287,7 +299,7 @@ Provide completion summary:
287
299
 
288
300
  ## Location
289
301
 
290
- docs/plans/[feature-name]/report.md
302
+ ${OUT}
291
303
 
292
304
  ## Report Contents
293
305
 
@@ -312,7 +324,7 @@ docs/plans/[feature-name]/report.md
312
324
 
313
325
  ## Next Steps
314
326
 
315
- 1. Review the report: docs/plans/[feature-name]/report.md
327
+ 1. Review the report: ${OUT}
316
328
  2. Share with QA team for testing guidance
317
329
  3. Use as reference for documentation updates
318
330
  4. Commit alongside implementation changes
@@ -1,25 +1,71 @@
1
1
  #!/usr/bin/env bash
2
2
  # Check that required planning documents exist for report generation
3
- # Usage: check-prerequisites.sh <feature-name>
3
+ # Usage: check-prerequisites.sh <feature-name> [--store=linear|local]
4
4
 
5
5
  set -euo pipefail
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ SHARED_DIR="${SCRIPT_DIR}/../../../shared/scripts"
8
+ for helper in resolve-artifact-store.sh artifact-body.sh; do
9
+ if [[ ! -f "${SHARED_DIR}/${helper}" ]]; then
10
+ echo "ERROR: ${helper} not found at ${SHARED_DIR}" >&2
11
+ exit 1
12
+ fi
13
+ done
14
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
15
+ source "${SHARED_DIR}/resolve-artifact-store.sh"
16
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
17
+ source "${SHARED_DIR}/artifact-body.sh"
6
18
 
7
- FEATURE_NAME="${1:-}"
8
- PLAN_DIR="docs/plans/${FEATURE_NAME}"
19
+ FEATURE_NAME='' STORE_FLAG=''
20
+ while [[ $# -gt 0 ]]; do
21
+ case "$1" in
22
+ --store=*) STORE_FLAG=$1 ;;
23
+ --*) echo "ERROR: Unknown option: $1" >&2; exit 1 ;;
24
+ *)
25
+ if [[ -n "$FEATURE_NAME" ]]; then
26
+ echo "Usage: check-prerequisites.sh <feature-name> [--store=linear|local]" >&2
27
+ exit 1
28
+ fi
29
+ FEATURE_NAME=$1
30
+ ;;
31
+ esac
32
+ shift
33
+ done
9
34
 
10
35
  if [[ -z "$FEATURE_NAME" ]]; then
11
36
  echo "ERROR: Feature name required"
12
- echo "Usage: check-prerequisites.sh <feature-name>"
37
+ echo "Usage: check-prerequisites.sh <feature-name> [--store=linear|local]"
13
38
  exit 1
14
39
  fi
15
40
 
41
+ if [[ -n "$STORE_FLAG" ]]; then
42
+ resolve_artifact_store "$PWD" "$STORE_FLAG" || exit 1
43
+ else
44
+ # Existing local plans keep local mode (artifact-store.md Inputs).
45
+ select_local_plan_store "$FEATURE_NAME" || exit 1
46
+ fi
47
+ [[ -n "${ARTIFACT_STORE:-}" ]] || exit 1
48
+ PLAN_DIR="$(get_plans_feature_dir "$FEATURE_NAME")" || exit 1
49
+ # Local: <PLANS_DIR>/<name>/report.md, accepting legacy local names. Linear:
50
+ # kind code-report, separate from implement-plan's run report.md.
51
+ if [[ "$ARTIFACT_STORE" == linear ]]; then
52
+ REPORT_FILE="$(get_artifact_path code-report "$FEATURE_NAME")" || exit 1
53
+ else
54
+ REPORT_FILE="${PLAN_DIR}/report.md"
55
+ fi
56
+
16
57
  if [[ ! -d "$PLAN_DIR" ]]; then
17
58
  echo "ERROR: Plan directory not found: $PLAN_DIR"
18
59
  echo ""
19
60
  echo "The report requires a planning directory."
20
- echo "Either:"
21
- echo " 1. Create planning documents: /shared-context ${FEATURE_NAME}"
22
- echo " 2. Create the directory manually: mkdir -p ${PLAN_DIR}"
61
+ if [[ "$ARTIFACT_STORE" == linear ]]; then
62
+ echo "Run Lookup and hydrate the plan from Linear first (artifact-store.md, Lookup and Load),"
63
+ echo "or rerun with --store=local for a plan under docs/plans."
64
+ else
65
+ echo "Either:"
66
+ echo " 1. Create planning documents: /shared-context ${FEATURE_NAME}"
67
+ echo " 2. Create the directory manually: mkdir -p ${PLAN_DIR}"
68
+ fi
23
69
  exit 1
24
70
  fi
25
71
 
@@ -41,13 +87,27 @@ if [[ ! -f "${PLAN_DIR}/shared.md" ]]; then
41
87
  fi
42
88
 
43
89
  echo "Report can be generated for: ${FEATURE_NAME}"
44
- echo " Target: ${PLAN_DIR}/report.md"
90
+ echo " Store: ${ARTIFACT_STORE}"
91
+ echo " Target: ${REPORT_FILE}"
45
92
 
46
93
  if [[ -f "${PLAN_DIR}/parallel-plan.md" ]]; then
47
94
  echo " Found: ${PLAN_DIR}/parallel-plan.md"
48
95
 
49
- # Count tasks in the plan
50
- TASK_COUNT=$(grep -c "^#### Task" "${PLAN_DIR}/parallel-plan.md" 2>/dev/null || echo "0")
96
+ # Count tasks in the plan body (identity frontmatter is metadata, not
97
+ # content). grep -c prints the count itself; exit 1 only means zero matches.
98
+ # Any other non-zero status is a real read failure. The body is captured
99
+ # first so an artifact_body failure is seen (a process substitution would
100
+ # hide it), then matched with a here-string, never `artifact_body | grep`.
101
+ TASK_COUNT_STATUS=0
102
+ if [[ ! -r "${PLAN_DIR}/parallel-plan.md" ]] || ! PLAN_BODY=$(artifact_body "${PLAN_DIR}/parallel-plan.md"); then
103
+ echo "ERROR: Failed to read ${PLAN_DIR}/parallel-plan.md" >&2
104
+ exit 2
105
+ fi
106
+ TASK_COUNT=$(grep -c "^#### Task" <<<"$PLAN_BODY") || TASK_COUNT_STATUS=$?
107
+ if [[ "$TASK_COUNT_STATUS" -gt 1 ]]; then
108
+ echo "ERROR: Failed to read ${PLAN_DIR}/parallel-plan.md" >&2
109
+ exit "$TASK_COUNT_STATUS"
110
+ fi
51
111
  echo " Tasks in plan: ${TASK_COUNT}"
52
112
  fi
53
113
 
@@ -56,9 +116,9 @@ if [[ -f "${PLAN_DIR}/shared.md" ]]; then
56
116
  fi
57
117
 
58
118
  # Check if report already exists
59
- if [[ -f "${PLAN_DIR}/report.md" ]]; then
119
+ if [[ -f "$REPORT_FILE" ]]; then
60
120
  echo ""
61
- echo "NOTE: ${PLAN_DIR}/report.md already exists"
121
+ echo "NOTE: ${REPORT_FILE} already exists"
62
122
  echo "It will be overwritten if you proceed."
63
123
  fi
64
124
 
@@ -8,7 +8,7 @@ This template defines the structure for implementation reports generated by the
8
8
  ---
9
9
  title: [Feature Name] Implementation Report
10
10
  date: [mm/dd/yyyy]
11
- original-plan: docs/plans/[feature-name]/parallel-plan.md
11
+ original-plan: [feature dir]/parallel-plan.md
12
12
  ---
13
13
  ```
14
14