@yandy-r/ycc-opencode 6.1.0 → 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
@@ -16,7 +16,7 @@ These prompts are used to spawn analysis sub-agents for condensing planning cont
16
16
 
17
17
  Apply this contract to every sub-agent prompt in this file:
18
18
 
19
- - Write only your assigned output file under `{{FEATURE_DIR}}`.
19
+ - Write only your assigned `{{ANALYSIS_<NAME>_FILE}}`; the orchestrator resolves it with the artifact-store `analysis-<name>` kind. Analysis artifacts remain local-only in linear mode.
20
20
  - Do not edit any other files.
21
21
  - After writing the file, verify it exists using the Read tool or equivalent.
22
22
  - **Share key findings** with relevant sub-agents using re-dispatch the affected sub-agent with the needed guidance.
@@ -37,7 +37,7 @@ Apply this contract to every sub-agent prompt in this file:
37
37
  ````markdown
38
38
  ## PRIMARY DELIVERABLE
39
39
 
40
- **Output File**: {{FEATURE_DIR}}/analysis-context.md
40
+ **Output File**: {{ANALYSIS_CONTEXT_FILE}}
41
41
 
42
42
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary.
43
43
 
@@ -57,7 +57,7 @@ Read and analyze all planning documentation:
57
57
  1. **Core Planning Documents**
58
58
  - {{FEATURE_DIR}}/shared.md
59
59
  - {{FEATURE_DIR}}/requirements.md (if exists)
60
- - All other .md files in {{FEATURE_DIR}}/
60
+ - All other .md files in {{FEATURE_DIR}}/, plus research files in {{RESEARCH_DIR}}/ when it differs from {{FEATURE_DIR}}/
61
61
 
62
62
  2. **Extract Key Information**
63
63
  - Architecture decisions relevant to implementation
@@ -136,7 +136,7 @@ Be concise. Each bullet should be information-dense. Aim for 60-80% compression
136
136
 
137
137
  You MUST complete ALL of these steps in order:
138
138
 
139
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-context.md
139
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_CONTEXT_FILE}}
140
140
  2. **Verify file**: Use the Read tool to confirm the file exists and has content
141
141
  3. **Share findings**: Message sub-agents with key insights
142
142
  4. **Mark complete**: Update your task status to completed
@@ -157,7 +157,7 @@ You MUST complete ALL of these steps in order:
157
157
  ````markdown
158
158
  ## PRIMARY DELIVERABLE
159
159
 
160
- **Output File**: {{FEATURE_DIR}}/analysis-code.md
160
+ **Output File**: {{ANALYSIS_CODE_FILE}}
161
161
 
162
162
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary.
163
163
 
@@ -298,7 +298,7 @@ Focus on patterns that inform implementation. Extract actual code patterns, not
298
298
 
299
299
  You MUST complete ALL of these steps in order:
300
300
 
301
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-code.md
301
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_CODE_FILE}}
302
302
  2. **Verify file**: Use the Read tool to confirm the file exists and has content
303
303
  3. **Share findings**: Message sub-agents with key insights
304
304
  4. **Mark complete**: Update your task status to completed
@@ -319,7 +319,7 @@ You MUST complete ALL of these steps in order:
319
319
  ````markdown
320
320
  ## PRIMARY DELIVERABLE
321
321
 
322
- **Output File**: {{FEATURE_DIR}}/analysis-tasks.md
322
+ **Output File**: {{ANALYSIS_TASKS_FILE}}
323
323
 
324
324
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary.
325
325
 
@@ -478,7 +478,7 @@ Focus on actionable structure suggestions. The goal is to help organize the para
478
478
 
479
479
  You MUST complete ALL of these steps in order:
480
480
 
481
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-tasks.md
481
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_TASKS_FILE}}
482
482
  2. **Verify file**: Use the Read tool to confirm the file exists and has content
483
483
  3. **Share findings**: Message sub-agents with key insights
484
484
  4. **Mark complete**: Update your task status to completed
@@ -493,7 +493,9 @@ When spawning analysis sub-agents:
493
493
  1. **Read this file** to get the prompt templates
494
494
  2. **Substitute variables**:
495
495
  - `{{FEATURE_NAME}}` - The feature directory name
496
- - `{{FEATURE_DIR}}` - Full output directory (`${feature_dir}`, resolved in Step 1)
496
+ - `{{FEATURE_DIR}}` - Resolved feature directory (`${feature_dir}`, resolved in Step 2)
497
+ - `{{RESEARCH_DIR}}` - Resolved research directory (`${research_dir}`; equals `${feature_dir}` in local mode)
498
+ - `{{ANALYSIS_<NAME>_FILE}}` - Absolute output path resolved for kind `analysis-<name>`
497
499
  3. **Create tasks** - Use track the task to create 3 analysis tasks
498
500
  5. **Monitor progress** - Use the todo tracker to check when all tasks complete
499
501
  6. **Verify artifacts** - Check all analysis files exist on disk
@@ -9,6 +9,8 @@
9
9
  - Agent 5: Task Planner (Unified)
10
10
  - Optimized Mode Sub-agent Configuration
11
11
 
12
+ Each `{{ANALYSIS_<NAME>_FILE}}` placeholder is the absolute path resolved by the orchestrator for the `analysis-<name>` kind. These artifacts remain local-only in linear mode.
13
+
12
14
 
13
15
  ### Agent 1: Architecture Analyst (Unified)
14
16
 
@@ -21,7 +23,7 @@
21
23
  ```markdown
22
24
  ## PRIMARY DELIVERABLE
23
25
 
24
- **Output File**: {{FEATURE_DIR}}/analysis-architecture.md
26
+ **Output File**: {{ANALYSIS_ARCHITECTURE_FILE}}
25
27
 
26
28
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary. Do NOT return your findings in summary text without writing the file — the orchestrator will fail the pre-generation gate and re-dispatch you.
27
29
 
@@ -75,7 +77,7 @@ Be concise. Each bullet should be information-dense.
75
77
 
76
78
  ## Completion Checklist
77
79
 
78
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-architecture.md
80
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_ARCHITECTURE_FILE}}
79
81
  2. **Verify file**: Use the Read tool to confirm the file exists and has the expected structure
80
82
  3. **(Path B only)** Share findings via re-dispatch the affected sub-agent with the needed guidance, then mark your task complete via update the todo tracker
81
83
  ```
@@ -91,7 +93,7 @@ Be concise. Each bullet should be information-dense.
91
93
  ```markdown
92
94
  ## PRIMARY DELIVERABLE
93
95
 
94
- **Output File**: {{FEATURE_DIR}}/analysis-patterns.md
96
+ **Output File**: {{ANALYSIS_PATTERNS_FILE}}
95
97
 
96
98
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary. Do NOT return your findings in summary text without writing the file — the orchestrator will fail the pre-generation gate and re-dispatch you.
97
99
 
@@ -143,7 +145,7 @@ Extract actual code patterns with file paths, not just file listings.
143
145
 
144
146
  ## Completion Checklist
145
147
 
146
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-patterns.md
148
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_PATTERNS_FILE}}
147
149
  2. **Verify file**: Use the Read tool to confirm the file exists and has the expected structure
148
150
  3. **(Path B only)** Share findings via re-dispatch the affected sub-agent with the needed guidance, then mark your task complete via update the todo tracker
149
151
  ```
@@ -159,7 +161,7 @@ Extract actual code patterns with file paths, not just file listings.
159
161
  ```markdown
160
162
  ## PRIMARY DELIVERABLE
161
163
 
162
- **Output File**: {{FEATURE_DIR}}/analysis-integration.md
164
+ **Output File**: {{ANALYSIS_INTEGRATION_FILE}}
163
165
 
164
166
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary. Do NOT return your findings in summary text without writing the file — the orchestrator will fail the pre-generation gate and re-dispatch you.
165
167
 
@@ -209,7 +211,7 @@ Be specific with route paths, table names, and file references.
209
211
 
210
212
  ## Completion Checklist
211
213
 
212
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-integration.md
214
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_INTEGRATION_FILE}}
213
215
  2. **Verify file**: Use the Read tool to confirm the file exists and has the expected structure
214
216
  3. **(Path B only)** Share findings via re-dispatch the affected sub-agent with the needed guidance, then mark your task complete via update the todo tracker
215
217
  ```
@@ -225,7 +227,7 @@ Be specific with route paths, table names, and file references.
225
227
  ```markdown
226
228
  ## PRIMARY DELIVERABLE
227
229
 
228
- **Output File**: {{FEATURE_DIR}}/analysis-docs.md
230
+ **Output File**: {{ANALYSIS_DOCS_FILE}}
229
231
 
230
232
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary. Do NOT return your findings in summary text without writing the file — the orchestrator will fail the pre-generation gate and re-dispatch you.
231
233
 
@@ -275,7 +277,7 @@ Identify which documents are REQUIRED reading vs nice-to-have.
275
277
 
276
278
  ## Completion Checklist
277
279
 
278
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-docs.md
280
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_DOCS_FILE}}
279
281
  2. **Verify file**: Use the Read tool to confirm the file exists and has the expected structure
280
282
  3. **(Path B only)** Share findings via re-dispatch the affected sub-agent with the needed guidance, then mark your task complete via update the todo tracker
281
283
  ```
@@ -291,7 +293,7 @@ Identify which documents are REQUIRED reading vs nice-to-have.
291
293
  ```markdown
292
294
  ## PRIMARY DELIVERABLE
293
295
 
294
- **Output File**: {{FEATURE_DIR}}/analysis-tasks.md
296
+ **Output File**: {{ANALYSIS_TASKS_FILE}}
295
297
 
296
298
  You MUST write this file using the Write tool. This is your #1 job. Everything else is secondary. Do NOT return your findings in summary text without writing the file — the orchestrator will fail the pre-generation gate and re-dispatch you.
297
299
 
@@ -340,7 +342,7 @@ Focus on actionable structure. The goal is to help organize the parallel plan, n
340
342
 
341
343
  ## Completion Checklist
342
344
 
343
- 1. **Write file**: Use the Write tool to create {{FEATURE_DIR}}/analysis-tasks.md
345
+ 1. **Write file**: Use the Write tool to create {{ANALYSIS_TASKS_FILE}}
344
346
  2. **Verify file**: Use the Read tool to confirm the file exists and has the expected structure
345
347
  3. **(Path B only)** Share findings via re-dispatch the affected sub-agent with the needed guidance, then mark your task complete via update the todo tracker
346
348
  ```
@@ -17,7 +17,8 @@ These prompts are used to spawn research sub-agents for gathering shared context
17
17
 
18
18
  Apply this contract to every sub-agent prompt in this file:
19
19
 
20
- - Write only your assigned output file under `{{FEATURE_DIR}}`.
20
+ - Write only your assigned `{{RESEARCH_<LENS>_FILE}}`; the orchestrator resolves it with the artifact-store `research-<lens>` kind.
21
+ - When replacing an existing file in linear mode, preserve its frontmatter and replace only the body. The orchestrator performs the Linear Save; do not call Linear yourself.
21
22
  - Do not edit any other files.
22
23
  - After writing the file, verify it exists using the Read tool or equivalent.
23
24
  - **Share key findings** with relevant sub-agents using re-dispatch the affected sub-agent with the needed guidance.
@@ -75,7 +76,7 @@ Analyze the codebase to understand:
75
76
 
76
77
  **CRITICAL**: You MUST write your findings to the specified file. This is not optional.
77
78
 
78
- **Output File**: {{FEATURE_DIR}}/research-architecture.md
79
+ **Output File**: {{RESEARCH_ARCHITECTURE_FILE}}
79
80
 
80
81
  Before completing this task:
81
82
 
@@ -167,7 +168,7 @@ Identify and document:
167
168
 
168
169
  **CRITICAL**: You MUST write your findings to the specified file. This is not optional.
169
170
 
170
- **Output File**: {{FEATURE_DIR}}/research-patterns.md
171
+ **Output File**: {{RESEARCH_PATTERNS_FILE}}
171
172
 
172
173
  Before completing this task:
173
174
 
@@ -263,7 +264,7 @@ Investigate:
263
264
 
264
265
  **CRITICAL**: You MUST write your findings to the specified file. This is not optional.
265
266
 
266
- **Output File**: {{FEATURE_DIR}}/research-integration.md
267
+ **Output File**: {{RESEARCH_INTEGRATION_FILE}}
267
268
 
268
269
  Before completing this task:
269
270
 
@@ -369,7 +370,7 @@ Search for documentation in:
369
370
 
370
371
  **CRITICAL**: You MUST write your findings to the specified file. This is not optional.
371
372
 
372
- **Output File**: {{FEATURE_DIR}}/research-docs.md
373
+ **Output File**: {{RESEARCH_DOCS_FILE}}
373
374
 
374
375
  Before completing this task:
375
376
 
@@ -421,7 +422,7 @@ When spawning research sub-agents:
421
422
  1. **Read this file** to get the prompt templates
422
423
  2. **Substitute variables**:
423
424
  - `{{FEATURE_NAME}}` - The feature directory name (e.g., `user-authentication`)
424
- - `{{FEATURE_DIR}}` - Full output directory (e.g., `docs/plans/user-authentication`)
425
+ - `{{RESEARCH_<LENS>_FILE}}` - The absolute path resolved for kind `research-<lens>` (local example: `docs/plans/user-authentication/research-<lens>.md`)
425
426
  3. **Create tasks** - Use track the task to create research tasks
426
427
  5. **Monitor progress** - Use the todo tracker to check when all tasks complete
427
428
  6. **Verify artifacts** - Check all research files exist on disk
@@ -430,7 +431,7 @@ When spawning research sub-agents:
430
431
 
431
432
  ## Variable Reference
432
433
 
433
- | Variable | Description | Example |
434
- | ------------------ | ------------------------------ | -------------------------------- |
435
- | `{{FEATURE_NAME}}` | Feature directory name | `user-authentication` |
436
- | `{{FEATURE_DIR}}` | Full research output directory | `docs/plans/user-authentication` |
434
+ | Variable | Description | Example |
435
+ | -------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
436
+ | `{{FEATURE_NAME}}` | Feature directory name | `user-authentication` |
437
+ | `{{RESEARCH_<LENS>_FILE}}` | Absolute research output path | Local: `docs/plans/user-authentication/research-<lens>.md`; linear: `.ycc/artifacts/user-authentication/research/research-<lens>.md` |
@@ -7,31 +7,60 @@
7
7
 
8
8
  set -euo pipefail
9
9
 
10
- FEATURE_NAME="${1:-}"
11
-
12
- # Source the shared resolver to get PLANS_DIR
10
+ # Source the artifact-store resolver: the feature dir is PLANS_DIR/<feature>
11
+ # in local mode and .ycc/artifacts/<feature> in linear mode.
13
12
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
14
13
  SHARED_DIR="${SCRIPT_DIR}/../../../shared/scripts"
15
14
 
16
- if [[ -f "${SHARED_DIR}/resolve-plans-dir.sh" ]]; then
17
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
18
- source "${SHARED_DIR}/resolve-plans-dir.sh"
15
+ if [[ -f "${SHARED_DIR}/resolve-artifact-store.sh" ]]; then
16
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
17
+ source "${SHARED_DIR}/resolve-artifact-store.sh"
19
18
  else
20
19
  # ponytail: resolver ships with the plugin; failing beats guessing a wrong
21
20
  # relative docs/plans. Upgrade path: restore resolver alongside this script.
22
- echo "ERROR: resolve-plans-dir.sh not found at ${SHARED_DIR}" >&2
21
+ echo "ERROR: resolve-artifact-store.sh not found at ${SHARED_DIR}" >&2
23
22
  echo "Cannot resolve plans directory safely; refusing to guess." >&2
24
23
  exit 1
25
24
  fi
26
25
 
27
- PLAN_DIR="${PLANS_DIR}/${FEATURE_NAME}"
26
+ FEATURE_NAME=""
27
+ STORE_FLAG=""
28
+ while [[ $# -gt 0 ]]; do
29
+ case "$1" in
30
+ --store=*)
31
+ STORE_FLAG="$1"
32
+ ;;
33
+ *)
34
+ if [[ -z "$FEATURE_NAME" ]]; then
35
+ FEATURE_NAME="$1"
36
+ else
37
+ echo "Usage: check-prerequisites.sh <feature-name> [--store=linear|local]" >&2
38
+ exit 1
39
+ fi
40
+ ;;
41
+ esac
42
+ shift
43
+ done
44
+
45
+ if [[ -n "$STORE_FLAG" ]]; then
46
+ # shellcheck disable=SC2086
47
+ resolve_artifact_store "$PWD" "$STORE_FLAG" || {
48
+ echo "ERROR: invalid ${STORE_FLAG#--}" >&2
49
+ exit 1
50
+ }
51
+ fi
28
52
 
29
53
  if [[ -z "$FEATURE_NAME" ]]; then
30
54
  echo "ERROR: Feature name required"
31
- echo "Usage: check-prerequisites.sh <feature-name>"
55
+ echo "Usage: check-prerequisites.sh <feature-name> [--store=linear|local]"
32
56
  exit 1
33
57
  fi
34
58
 
59
+ # The resolver prints its own reason (invalid store config or feature name).
60
+ # Default store: an existing local plan keeps local mode (artifact-store.md Inputs).
61
+ if [[ -z "$STORE_FLAG" ]]; then select_local_plan_store "$FEATURE_NAME" || exit 1; fi
62
+ PLAN_DIR="$(get_plans_feature_dir "$FEATURE_NAME")" || exit 1
63
+
35
64
  if [[ ! -d "$PLAN_DIR" ]]; then
36
65
  echo "ERROR: Plan directory not found: $PLAN_DIR"
37
66
  echo "Create the directory first or run /shared-context to initialize planning"
@@ -56,8 +85,18 @@ if [[ -f "${PLAN_DIR}/requirements.md" ]]; then
56
85
  echo " Found: ${PLAN_DIR}/requirements.md"
57
86
  fi
58
87
 
59
- # Count other markdown files for context
60
- OTHER_FILES=$(find "$PLAN_DIR" -maxdepth 1 -name "*.md" ! -name "shared.md" ! -name "requirements.md" ! -name "parallel-plan.md" | wc -l)
88
+ # Count other markdown files for context. Research lives either directly in
89
+ # the feature dir (local layout) or in its research/ subdir (linear layout).
90
+ RESEARCH_DIR="${PLAN_DIR}/research"
91
+ if [[ -d "$RESEARCH_DIR" ]]; then
92
+ OTHER_FILES=$(find "$RESEARCH_DIR" -maxdepth 1 -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
93
+ if [[ $OTHER_FILES -gt 0 ]]; then
94
+ echo " Found: $OTHER_FILES research file(s)"
95
+ fi
96
+ OTHER_FILES=$(find "$PLAN_DIR" -maxdepth 1 -name "*.md" ! -name "shared.md" ! -name "requirements.md" ! -name "parallel-plan.md" 2>/dev/null | wc -l | tr -d ' ')
97
+ else
98
+ OTHER_FILES=$(find "$PLAN_DIR" -maxdepth 1 -name "*.md" ! -name "shared.md" ! -name "requirements.md" ! -name "parallel-plan.md" 2>/dev/null | wc -l | tr -d ' ')
99
+ fi
61
100
  if [[ $OTHER_FILES -gt 0 ]]; then
62
101
  echo " Found: $OTHER_FILES additional context file(s)"
63
102
  fi
@@ -14,18 +14,17 @@
14
14
 
15
15
  set -uo pipefail
16
16
 
17
- FEATURE_NAME="${1:-}"
18
-
19
- # Source the shared resolver to get PLANS_DIR
17
+ # Source the artifact-store resolver: the feature dir is PLANS_DIR/<feature>
18
+ # in local mode and .ycc/artifacts/<feature> in linear mode.
20
19
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
21
20
  SHARED_DIR="${SCRIPT_DIR}/../../../shared/scripts"
22
21
 
23
- if [[ -f "${SHARED_DIR}/resolve-plans-dir.sh" ]]; then
24
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
25
- source "${SHARED_DIR}/resolve-plans-dir.sh"
22
+ if [[ -f "${SHARED_DIR}/resolve-artifact-store.sh" ]]; then
23
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
24
+ source "${SHARED_DIR}/resolve-artifact-store.sh"
26
25
  else
27
26
  # Fallback if shared resolver not found - compute absolute repo root
28
- echo "WARNING: resolve-plans-dir.sh not found, using default path" >&2
27
+ echo "WARNING: resolve-artifact-store.sh not found, using default path" >&2
29
28
 
30
29
  # Try to find repo root using git
31
30
  if REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null); then
@@ -47,7 +46,33 @@ else
47
46
  export PLANS_ROOT="$REPO_ROOT"
48
47
  fi
49
48
 
50
- PLAN_DIR="${PLANS_DIR}/${FEATURE_NAME}"
49
+ # Optional explicit store override from the invoking skill.
50
+ STORE_FLAG=""
51
+ FEATURE_NAME=""
52
+ while [[ $# -gt 0 ]]; do
53
+ case "$1" in
54
+ --store=*)
55
+ STORE_FLAG="$1"
56
+ ;;
57
+ *)
58
+ if [[ -z "$FEATURE_NAME" ]]; then
59
+ FEATURE_NAME="$1"
60
+ else
61
+ echo "Usage: check-state.sh <feature-name> [--store=linear|local]" >&2
62
+ exit 1
63
+ fi
64
+ ;;
65
+ esac
66
+ shift
67
+ done
68
+
69
+ if [[ -n "$STORE_FLAG" ]]; then
70
+ # shellcheck disable=SC2086
71
+ resolve_artifact_store "$PWD" "$STORE_FLAG" || {
72
+ echo "ERROR: invalid ${STORE_FLAG#--}" >&2
73
+ exit 1
74
+ }
75
+ fi
51
76
 
52
77
  # Colors for output
53
78
  YELLOW='\033[0;33m'
@@ -79,6 +104,15 @@ if [[ -z "$FEATURE_NAME" ]]; then
79
104
  exit 1
80
105
  fi
81
106
 
107
+ # The resolver prints its own reason (invalid store config or feature name).
108
+ if [[ -f "${SHARED_DIR}/resolve-artifact-store.sh" ]]; then
109
+ # Default store: an existing local plan keeps local mode (artifact-store.md Inputs).
110
+ if [[ -z "$STORE_FLAG" ]]; then select_local_plan_store "$FEATURE_NAME" || exit 1; fi
111
+ PLAN_DIR="$(get_plans_feature_dir "$FEATURE_NAME")" || exit 1
112
+ else
113
+ PLAN_DIR="${PLANS_DIR}/${FEATURE_NAME}"
114
+ fi
115
+
82
116
  echo "Checking state for: ${FEATURE_NAME}"
83
117
  echo "Directory: ${PLAN_DIR}"
84
118
  echo "---"
@@ -119,13 +153,23 @@ if [[ "$DIR_EXISTS" == "true" ]]; then
119
153
  missing "parallel-plan.md"
120
154
  fi
121
155
 
122
- # Count research files
156
+ # Count research files: directly in the feature dir (local layout) and in
157
+ # its research/ subdir when present (linear layout).
123
158
  RESEARCH_COUNT=$(find "$PLAN_DIR" -maxdepth 1 -name "research-*.md" 2>/dev/null | wc -l | tr -d ' ')
159
+ if [[ -d "${PLAN_DIR}/research" ]]; then
160
+ SUB_COUNT=$(find "${PLAN_DIR}/research" -maxdepth 1 -name "research-*.md" 2>/dev/null | wc -l | tr -d ' ')
161
+ RESEARCH_COUNT=$((RESEARCH_COUNT + SUB_COUNT))
162
+ fi
124
163
  if [[ $RESEARCH_COUNT -gt 0 ]]; then
125
164
  found "$RESEARCH_COUNT research file(s)"
126
165
  find "$PLAN_DIR" -maxdepth 1 -name "research-*.md" -exec basename {} \; | while read -r f; do
127
166
  echo " - $f"
128
167
  done
168
+ if [[ -d "${PLAN_DIR}/research" ]]; then
169
+ find "${PLAN_DIR}/research" -maxdepth 1 -name "research-*.md" -exec basename {} \; | while read -r f; do
170
+ echo " - $f"
171
+ done
172
+ fi
129
173
  fi
130
174
 
131
175
  # Count analysis files
@@ -20,11 +20,11 @@
20
20
  set -euo pipefail
21
21
 
22
22
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
23
- RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-plans-dir.sh"
23
+ RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-artifact-store.sh"
24
24
 
25
- # Source resolver to get PLANS_ROOT for path resolution
25
+ # Source resolver to get PLANS_ROOT/ARTIFACT_ROOT for path resolution
26
26
  if [[ -f "$RESOLVER" ]]; then
27
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
27
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
28
28
  source "$RESOLVER"
29
29
  fi
30
30
 
@@ -34,7 +34,7 @@ YELLOW='\033[1;33m'
34
34
  NC='\033[0m'
35
35
 
36
36
  if [[ $# -lt 1 ]]; then
37
- echo "Usage: $0 <feature-dir> [--optimized]"
37
+ echo "Usage: $0 <feature-dir> [--optimized] [--store=linear|local]"
38
38
  echo ""
39
39
  echo "Pre-generation gate: ensures all analysis files exist before plan generation."
40
40
  echo " default Standard 3-file set (analysis-context/code/tasks)"
@@ -46,6 +46,7 @@ fi
46
46
 
47
47
  feature_dir=""
48
48
  optimized="false"
49
+ store_flag=""
49
50
 
50
51
  while [[ $# -gt 0 ]]; do
51
52
  case "$1" in
@@ -53,6 +54,10 @@ while [[ $# -gt 0 ]]; do
53
54
  optimized="true"
54
55
  shift
55
56
  ;;
57
+ --store=*)
58
+ store_flag="$1"
59
+ shift
60
+ ;;
56
61
  *)
57
62
  if [[ -z "$feature_dir" ]]; then
58
63
  feature_dir="$1"
@@ -70,9 +75,18 @@ if [[ -z "$feature_dir" ]]; then
70
75
  exit 1
71
76
  fi
72
77
 
73
- # Resolve relative paths against PLANS_ROOT (from resolve-plans-dir.sh)
74
- if [[ "$feature_dir" != /* && -n "${PLANS_ROOT:-}" ]]; then
75
- feature_dir="${PLANS_ROOT}/${feature_dir}"
78
+ if [[ -n "$store_flag" ]]; then
79
+ # shellcheck disable=SC2086
80
+ resolve_artifact_store "$PWD" "$store_flag" || {
81
+ echo -e "${RED}ERROR${NC}: invalid ${store_flag#--}" >&2
82
+ exit 1
83
+ }
84
+ fi
85
+
86
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
87
+ # mode, ARTIFACT_ROOT in linear mode.
88
+ if [[ "$feature_dir" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
89
+ feature_dir="${ARTIFACT_ROOT:-$PLANS_ROOT}/${feature_dir}"
76
90
  fi
77
91
 
78
92
  if [[ ! -d "$feature_dir" ]]; then
@@ -16,12 +16,15 @@
16
16
  set -euo pipefail
17
17
 
18
18
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
19
- RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-plans-dir.sh"
19
+ RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-artifact-store.sh"
20
20
 
21
- # Source resolver to get PLANS_ROOT for path resolution
21
+ # Source resolver to get PLANS_ROOT/ARTIFACT_ROOT for path resolution and the
22
+ # artifact_body helper for frontmatter-skipping heading checks.
22
23
  if [[ -f "$RESOLVER" ]]; then
23
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
24
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
24
25
  source "$RESOLVER"
26
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
27
+ source "${SCRIPT_DIR}/../../../shared/scripts/artifact-body.sh"
25
28
  fi
26
29
 
27
30
  RED='\033[0;31m'
@@ -54,7 +57,9 @@ require_any_heading() {
54
57
  local found=false
55
58
  local heading
56
59
  for heading in "$@"; do
57
- if grep -q "^${heading}" "$file"; then
60
+ # Match against the body only: identity frontmatter is not content
61
+ # (see _shared/references/artifact-store.md, Frontmatter).
62
+ if grep -q "^${heading}" < <(artifact_body "$file"); then
58
63
  found=true
59
64
  break
60
65
  fi
@@ -67,13 +72,9 @@ require_any_heading() {
67
72
  fi
68
73
  }
69
74
 
70
- if [[ $# -lt 1 ]]; then
71
- echo "Usage: $0 <feature-dir> [--optimized]"
72
- exit 1
73
- fi
74
-
75
75
  feature_dir=""
76
76
  optimized="false"
77
+ store_flag=""
77
78
 
78
79
  while [[ $# -gt 0 ]]; do
79
80
  case "$1" in
@@ -81,6 +82,10 @@ while [[ $# -gt 0 ]]; do
81
82
  optimized="true"
82
83
  shift
83
84
  ;;
85
+ --store=*)
86
+ store_flag="$1"
87
+ shift
88
+ ;;
84
89
  *)
85
90
  if [[ -z "$feature_dir" ]]; then
86
91
  feature_dir="$1"
@@ -93,14 +98,23 @@ while [[ $# -gt 0 ]]; do
93
98
  esac
94
99
  done
95
100
 
101
+ if [[ -n "$store_flag" ]]; then
102
+ # shellcheck disable=SC2086
103
+ resolve_artifact_store "$PWD" "$store_flag" || {
104
+ echo -e "${RED}ERROR:${NC} invalid ${store_flag#--}" >&2
105
+ exit 1
106
+ }
107
+ fi
108
+
96
109
  if [[ -z "$feature_dir" ]]; then
97
110
  echo -e "${RED}ERROR:${NC} feature-dir required" >&2
98
111
  exit 1
99
112
  fi
100
113
 
101
- # Always resolve relative paths against PLANS_ROOT (from resolve-plans-dir.sh)
102
- if [[ "$feature_dir" != /* && -n "${PLANS_ROOT:-}" ]]; then
103
- feature_dir="${PLANS_ROOT}/${feature_dir}"
114
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
115
+ # mode, ARTIFACT_ROOT in linear mode.
116
+ if [[ "$feature_dir" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
117
+ feature_dir="${ARTIFACT_ROOT:-$PLANS_ROOT}/${feature_dir}"
104
118
  fi
105
119
 
106
120
  if [[ ! -d "$feature_dir" ]]; then
@@ -151,8 +165,8 @@ for file in "${files[@]}"; do
151
165
  log_warning "${file}: content is short (${size_bytes} bytes)"
152
166
  fi
153
167
 
154
- # Check for title heading
155
- if grep -q "^# " "$path"; then
168
+ # Check for title heading in the body (frontmatter skipped)
169
+ if grep -q "^# " < <(artifact_body "$path"); then
156
170
  log_success "${file}: has title heading"
157
171
  else
158
172
  log_warning "${file}: missing title heading"