@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
@@ -10,7 +10,7 @@ description: Researches features with seven specialists and consolidates a featu
10
10
  > **OpenCode V2 compatibility:** `--team` is unsupported. If it is supplied, abort before setup or dispatch and ask the caller to rerun without it. This target uses native standalone `subagent` calls only.
11
11
 
12
12
 
13
- **Operational context:** Dispatch api-researcher, business-analyzer, tech-designer, ux-researcher, security-researcher, practices-researcher, and recommendations-agent; write seven research-*.md files plus feature-spec.md under docs/plans/[feature-name]/, never docs/prps/. Use /ycc:prp-spec for lightweight single-pass PRP specs.
13
+ **Operational context:** Dispatch api-researcher, business-analyzer, tech-designer, ux-researcher, security-researcher, practices-researcher, and recommendations-agent; write seven research-*.md files plus feature-spec.md at paths resolved through the artifact store, never docs/prps/. Linear mode (default) uses `.ycc/artifacts/[feature-name]/`; local mode keeps `docs/plans/[feature-name]/`. Use /ycc:prp-spec for lightweight single-pass PRP specs.
14
14
 
15
15
  ## Workflow Integration
16
16
 
@@ -25,7 +25,7 @@ feature-spec.md feature-spec.md parallel-plan.md
25
25
 
26
26
  | Skill | Agents | Output Dir | Output Files | Use When |
27
27
  | ------------------------- | --------------------------------- | -------------------- | ------------------------------------- | ---------------------------------------------- |
28
- | `feature-research` (THIS) | 7 parallel agents | `docs/plans/[name]/` | 7 `research-*.md` + `feature-spec.md` | Deep multi-agent research before plan-workflow |
28
+ | `feature-research` (THIS) | 7 parallel agents | Resolved feature dir | 7 `research-*.md` + `feature-spec.md` | Deep multi-agent research before plan-workflow |
29
29
  | `prp-spec` | Single pass (optional researcher) | `docs/prps/specs/` | `{name}.spec.md` | Lightweight spec for PRP workflow |
30
30
  | `prp-prd` | Interactive + researcher | `docs/prps/prds/` | `{name}.prd.md` | Full PRD with hypothesis-driven questioning |
31
31
  | `prp-plan` | Single pass + researcher | `docs/prps/plans/` | `{name}.plan.md` | Implementation plan from PRD or description |
@@ -34,7 +34,8 @@ feature-spec.md feature-spec.md parallel-plan.md
34
34
 
35
35
  - Deploys all 7 researchers in parallel (never skips agents)
36
36
  - Creates 7 `research-*.md` files + 1 `feature-spec.md`
37
- - Outputs ONLY to `docs/plans/[feature-name]/`
37
+ - Outputs only to the artifact-store feature directory (`docs/plans/[feature-name]/` in local mode)
38
+ - Uses `research-<lens>` paths, including the linear `research/` subdirectory
38
39
 
39
40
  **This skill NEVER**:
40
41
 
@@ -50,12 +51,13 @@ feature-spec.md feature-spec.md parallel-plan.md
50
51
  Parse arguments (flags first, then the feature name):
51
52
 
52
53
  - **--description "..."**: Brief description of the feature (guides research agents)
53
- - **feature-name**: Required. Directory name in `docs/plans/`
54
+ - **feature-name**: Required. Feature slug passed to the artifact-store resolver
55
+ - **--store=local|linear**: Optional artifact-store override. Forward it to every helper call. Linear is the default; `local` opts out.
54
56
 
55
57
  If no feature name provided, abort with usage instructions:
56
58
 
57
59
  ```
58
- Usage: /ycc:feature-research [--description "..."] [--dry-run] [feature-name]
60
+ Usage: /ycc:feature-research [--description "..."] [--dry-run] [--store=local|linear] [feature-name]
59
61
 
60
62
  Examples:
61
63
  /ycc:feature-research plex-integration --description "Advanced Plex media library integration with filters and playlists"
@@ -76,22 +78,38 @@ Extract from `$ARGUMENTS`:
76
78
  2. **--description**: Quoted string after flag (optional but recommended)
77
79
  3. **--dry-run**: Boolean flag. Set `DRY_RUN=true` if present, else `false`.
78
80
  4. **feature-name**: First non-flag argument (required)
81
+ 5. **--store=local|linear**: Parse and strip before selecting feature-name. Retain the exact override as `STORE_FLAG` (empty if absent), reject invalid/conflicting overrides, and pass it to every helper call and validator.
79
82
 
80
83
  Validate the feature name: must be kebab-case, no special characters except hyphens.
81
84
 
82
85
 
83
86
 
84
- ### Step 2: Create Directory
87
+ ### Step 2: Resolve Artifact Paths and Create Directories
85
88
 
86
- **CRITICAL**: Output goes to `docs/plans/[feature-name]/` — NEVER to `docs/prps/` or any other directory, regardless of the user's current working directory. If the user invokes this skill from inside `docs/prps/` or any subdirectory, still resolve the output path from the repository root as `docs/plans/[feature-name]/`.
89
+ **CRITICAL**: Write only to paths returned by the artifact-store resolver — NEVER to `docs/prps/` or another directory, regardless of the current working directory. Linear mode (default) resolves under `.ycc/artifacts/[feature-name]/`; local mode preserves `docs/plans/[feature-name]/`.
87
90
 
88
- ```bash
89
- test -d "docs/plans/[feature-name]" && echo "exists" || mkdir -p "docs/plans/[feature-name]"
90
- ```
91
+ 1. Print the mode and read `ARTIFACT_STORE=` from stdout; resolve paths without writes:
92
+
93
+ ```bash
94
+ bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell
95
+ feature_dir="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=feature-dir --slug="[feature-name]")"
96
+ research_dir="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=research-dir --slug="[feature-name]")"
97
+ spec_file="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --kind=feature-spec --slug="[feature-name]")"
98
+ ```
99
+
100
+ 2. For a non-dry linear run only, apply the **Linear call gate** from `{{package-root}}/shared/references/artifact-store.md` before any write or pull.
101
+ 3. Once writing is permitted, establish the safe cache and gitignore rule before Lookup/Load:
102
+
103
+ ```bash
104
+ feature_dir="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=feature-dir --slug="[feature-name]")"
105
+ mkdir -p "$feature_dir" "$research_dir"
106
+ ```
107
+
108
+ Dry runs only resolve paths, never ensure or Load. In local mode `research_dir` equals `feature_dir`. In a real linear run, populate missing inputs via Lookup/Load before checking research. For every research/spec document to be written, if `linear.document` identity is missing, follow artifact-store.md **Planning skills** Lookup steps 3–6 and Load any hit before dispatch/writing; preserve identity and use Conflict for replacement, then Save. Retain the printed mode and absolute paths across tool calls.
91
109
 
92
110
  ### Step 3: Check Existing Research
93
111
 
94
- List any existing files. If `feature-spec.md` exists, read it and ask user if they want to regenerate or enhance.
112
+ List any existing files. If `${spec_file}` exists, read it and ask user if they want to regenerate or enhance.
95
113
 
96
114
  ### Step 4: Handle Dry Run
97
115
 
@@ -117,14 +135,14 @@ Researchers: 7 (api-researcher, business-analyzer, tech-designer, ux-researcher,
117
135
 
118
136
  ## Files That Would Be Created
119
137
 
120
- - docs/plans/[feature-name]/research-external.md
121
- - docs/plans/[feature-name]/research-business.md
122
- - docs/plans/[feature-name]/research-technical.md
123
- - docs/plans/[feature-name]/research-ux.md
124
- - docs/plans/[feature-name]/research-security.md
125
- - docs/plans/[feature-name]/research-practices.md
126
- - docs/plans/[feature-name]/research-recommendations.md
127
- - docs/plans/[feature-name]/feature-spec.md
138
+ - ${research_dir}/research-external.md
139
+ - ${research_dir}/research-business.md
140
+ - ${research_dir}/research-technical.md
141
+ - ${research_dir}/research-ux.md
142
+ - ${research_dir}/research-security.md
143
+ - ${research_dir}/research-practices.md
144
+ - ${research_dir}/research-recommendations.md
145
+ - ${spec_file}
128
146
 
129
147
  ## Execution Model
130
148
 
@@ -165,7 +183,8 @@ cat {{package-root}}/skills/feature-research/templates/research-agents.md
165
183
  Use the prompts from `research-agents.md` with variables substituted:
166
184
 
167
185
  - `{{FEATURE_NAME}}` - The feature directory name
168
- - `{{FEATURE_DIR}}` - Full output directory path (`docs/plans/[feature-name]`)
186
+ - `{{FEATURE_DIR}}` - Resolved feature directory (`${feature_dir}`)
187
+ - `{{RESEARCH_<LENS>_FILE}}` - Absolute path from the executed resolver with kind `research-<lens>` and the same store override; in local mode these are `${feature_dir}/research-<lens>.md`, in linear mode `${feature_dir}/research/research-<lens>.md`
169
188
  - `{{FEATURE_DESCRIPTION}}` - The description provided (or feature name if none)
170
189
 
171
190
  #### Path A — Standalone sub-agents (`STANDALONE_MODE=true`, default)
@@ -208,14 +227,16 @@ If a child report is empty or contentless, record its `sessionID`, inspect the d
208
227
  After all 7 sub-agents complete, validate all `research-*.md` files:
209
228
 
210
229
  ```bash
211
- {{package-root}}/skills/feature-research/scripts/validate-research.sh docs/plans/[feature-name]
230
+ {{package-root}}/skills/feature-research/scripts/validate-research.sh "${feature_dir}" ${STORE_FLAG}
212
231
  ```
213
232
 
214
233
  If validation fails: message the relevant sub-agent to fix their output, wait for correction, rerun validation until pass.
215
234
 
235
+ In linear mode, after validation and fixes, follow artifact-store.md section **Planning skills** to Save each of the seven `research-<lens>` documents.
236
+
216
237
  ### Step 12: Read Research Results
217
238
 
218
- Read all 7 research files from `docs/plans/[feature-name]/`.
239
+ Read all 7 research files from `${research_dir}/`.
219
240
 
220
241
  ### Step 13: Read Spec Template
221
242
 
@@ -225,7 +246,7 @@ cat {{package-root}}/skills/feature-research/templates/spec-structure.md
225
246
 
226
247
  ### Step 14: Generate feature-spec.md
227
248
 
228
- Create `docs/plans/[feature-name]/feature-spec.md` following the template.
249
+ Create `${spec_file}` following the template. In linear mode use `./research/research-<lens>.md` research links; in local mode use `./research-<lens>.md`. When replacing an existing spec, preserve its identity frontmatter in linear mode and replace only the body; local mode writes the body without frontmatter.
229
250
 
230
251
  **Key Consolidation Principles**:
231
252
 
@@ -245,11 +266,13 @@ Create `docs/plans/[feature-name]/feature-spec.md` following the template.
245
266
  Run after Step 14 creates `feature-spec.md`:
246
267
 
247
268
  ```bash
248
- {{package-root}}/skills/feature-research/scripts/validate-spec.sh docs/plans/[feature-name]/feature-spec.md
269
+ {{package-root}}/skills/feature-research/scripts/validate-spec.sh "${spec_file}" ${STORE_FLAG}
249
270
  ```
250
271
 
251
272
  Fix any issues reported (missing sections, empty content, formatting).
252
273
 
274
+ In linear mode, follow artifact-store.md section **Planning skills** to Save the validated `feature-spec` document. Local mode writes no identity frontmatter and makes no Linear calls.
275
+
253
276
  ### Step 17: Display Summary
254
277
 
255
278
  Provide completion summary with: feature name, description, dispatch mode (standalone sub-agents), files created, research summary counts, key findings, decisions needed, and next steps (review spec, proceed to `/ycc:plan-workflow`, or add requirements).
@@ -276,7 +299,7 @@ Each research file should: focus on its specific domain, include concrete exampl
276
299
 
277
300
  1. **Do NOT skip the multi-agent pipeline**: Never generate `feature-spec.md` directly without first deploying all 7 researchers (standalone sub-agents) and collecting their `research-*.md` files. The spec is a synthesis of research, not a standalone generation. If about to write `feature-spec.md` without the 7 research files already on disk, STOP — the pipeline is off-rails.
278
301
 
279
- 2. **Do NOT output to `docs/prps/`**: This skill's output directory is `docs/plans/[feature-name]/`. The `docs/prps/` tree belongs to the PRP workflow (`prp-prd`, `prp-spec`, `prp-plan`, `prp-implement`). Even if the user's working directory is `docs/prps/` or any subdirectory, always create output under `docs/plans/`.
302
+ 2. **Do NOT output to `docs/prps/`**: Write only to the resolved feature directory (`docs/plans/[feature-name]/` in local mode, `.ycc/artifacts/[feature-name]/` in linear mode). The `docs/prps/` tree belongs to the PRP workflow (`prp-prd`, `prp-spec`, `prp-plan`, `prp-implement`). Even if the user's working directory is `docs/prps/` or any subdirectory, always use the resolver-selected output path.
280
303
 
281
304
  3. **Do NOT generate a single file**: The minimum correct output is 8 files (7 research + 1 spec). If about to write only one file, STOP — the user likely wants the lightweight PRP spec skill. Redirect them to `/ycc:prp-spec`.
282
305
 
@@ -5,12 +5,15 @@
5
5
  set -euo pipefail
6
6
 
7
7
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
8
- RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-plans-dir.sh"
8
+ RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-artifact-store.sh"
9
9
 
10
- # Source resolver to get PLANS_ROOT for path resolution
10
+ # Source resolver to get PLANS_ROOT/ARTIFACT_ROOT for path resolution and the
11
+ # artifact_body helper for frontmatter-skipping heading checks.
11
12
  if [[ -f "$RESOLVER" ]]; then
12
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
13
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
13
14
  source "$RESOLVER"
15
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
16
+ source "${SCRIPT_DIR}/../../../shared/scripts/artifact-body.sh"
14
17
  fi
15
18
 
16
19
  RED='\033[0;31m'
@@ -38,7 +41,9 @@ log_success() {
38
41
  require_heading() {
39
42
  local file="$1"
40
43
  local heading="$2"
41
- if grep -q "^${heading}" "$file"; then
44
+ # Match against the body only: identity frontmatter is not content
45
+ # (see _shared/references/artifact-store.md, Frontmatter).
46
+ if grep -q "^${heading}" < <(artifact_body "$file"); then
42
47
  log_success "$(basename "$file"): found ${heading}"
43
48
  else
44
49
  log_error "$(basename "$file"): missing required heading ${heading}"
@@ -53,7 +58,8 @@ require_any_heading() {
53
58
  local found=false
54
59
  local heading
55
60
  for heading in "$@"; do
56
- if grep -q "^${heading}" "$file"; then
61
+ # Body-only match: identity frontmatter is not content.
62
+ if grep -q "^${heading}" < <(artifact_body "$file"); then
57
63
  found=true
58
64
  break
59
65
  fi
@@ -66,16 +72,43 @@ require_any_heading() {
66
72
  fi
67
73
  }
68
74
 
69
- if [[ $# -lt 1 ]]; then
70
- echo "Usage: $0 <feature-dir>"
71
- exit 1
75
+ feature_dir=""
76
+ store_flag=""
77
+
78
+ while [[ $# -gt 0 ]]; do
79
+ case "$1" in
80
+ --store=*)
81
+ store_flag="$1"
82
+ ;;
83
+ *)
84
+ if [[ -z "$feature_dir" ]]; then
85
+ feature_dir="$1"
86
+ else
87
+ echo "Usage: $0 <feature-dir> [--store=linear|local]" >&2
88
+ exit 1
89
+ fi
90
+ ;;
91
+ esac
92
+ shift
93
+ done
94
+
95
+ if [[ -n "$store_flag" ]]; then
96
+ # shellcheck disable=SC2086
97
+ resolve_artifact_store "$PWD" "$store_flag" || {
98
+ echo -e "${RED}ERROR:${NC} invalid ${store_flag#--}" >&2
99
+ exit 1
100
+ }
72
101
  fi
73
102
 
74
- feature_dir="$1"
103
+ if [[ -z "$feature_dir" ]]; then
104
+ echo "Usage: $0 <feature-dir> [--store=linear|local]"
105
+ exit 1
106
+ fi
75
107
 
76
- # Always resolve relative paths against PLANS_ROOT
77
- if [[ "$feature_dir" != /* && -n "${PLANS_ROOT:-}" ]]; then
78
- feature_dir="${PLANS_ROOT}/${feature_dir}"
108
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
109
+ # mode, ARTIFACT_ROOT in linear mode.
110
+ if [[ "$feature_dir" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
111
+ feature_dir="${ARTIFACT_ROOT:-$PLANS_ROOT}/${feature_dir}"
79
112
  fi
80
113
 
81
114
  if [[ ! -d "$feature_dir" ]]; then
@@ -99,6 +132,12 @@ echo "=========================================="
99
132
  for file in "${files[@]}"; do
100
133
  path="${feature_dir}/${file}"
101
134
 
135
+ # Research files live directly in the feature dir (local layout) or in its
136
+ # research/ subdir (linear layout). An existing research/ directory wins.
137
+ if [[ "$file" == research-* && -d "${feature_dir}/research" ]]; then
138
+ path="${feature_dir}/research/${file}"
139
+ fi
140
+
102
141
  if [[ ! -f "$path" ]]; then
103
142
  log_error "${file}: file not found"
104
143
  continue
@@ -5,12 +5,15 @@
5
5
  set -euo pipefail
6
6
 
7
7
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
8
- RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-plans-dir.sh"
8
+ RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-artifact-store.sh"
9
9
 
10
- # Source resolver to get PLANS_ROOT for path resolution
10
+ # Source resolver to get PLANS_ROOT/ARTIFACT_ROOT for path resolution and the
11
+ # artifact_body helper for frontmatter-skipping content checks.
11
12
  if [[ -f "$RESOLVER" ]]; then
12
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
13
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
13
14
  source "$RESOLVER"
15
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
16
+ source "${SCRIPT_DIR}/../../../shared/scripts/artifact-body.sh"
14
17
  fi
15
18
 
16
19
  # Colors for output
@@ -69,16 +72,43 @@ log_info() {
69
72
  }
70
73
 
71
74
  # Check if file exists
72
- if [[ $# -lt 1 ]]; then
73
- echo "Usage: $0 <path-to-feature-spec.md>"
74
- exit 1
75
+ SPEC_FILE=""
76
+ store_flag=""
77
+
78
+ while [[ $# -gt 0 ]]; do
79
+ case "$1" in
80
+ --store=*)
81
+ store_flag="$1"
82
+ ;;
83
+ *)
84
+ if [[ -z "$SPEC_FILE" ]]; then
85
+ SPEC_FILE="$1"
86
+ else
87
+ echo "Usage: $0 <path-to-feature-spec.md> [--store=linear|local]" >&2
88
+ exit 1
89
+ fi
90
+ ;;
91
+ esac
92
+ shift
93
+ done
94
+
95
+ if [[ -n "$store_flag" ]]; then
96
+ # shellcheck disable=SC2086
97
+ resolve_artifact_store "$PWD" "$store_flag" || {
98
+ echo -e "${RED}ERROR:${NC} invalid ${store_flag#--}" >&2
99
+ exit 1
100
+ }
75
101
  fi
76
102
 
77
- SPEC_FILE="$1"
103
+ if [[ -z "$SPEC_FILE" ]]; then
104
+ echo "Usage: $0 <path-to-feature-spec.md> [--store=linear|local]"
105
+ exit 1
106
+ fi
78
107
 
79
- # Always resolve relative paths against PLANS_ROOT
80
- if [[ "$SPEC_FILE" != /* && -n "${PLANS_ROOT:-}" ]]; then
81
- SPEC_FILE="${PLANS_ROOT}/${SPEC_FILE}"
108
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
109
+ # mode, ARTIFACT_ROOT in linear mode.
110
+ if [[ "$SPEC_FILE" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
111
+ SPEC_FILE="${ARTIFACT_ROOT:-$PLANS_ROOT}/${SPEC_FILE}"
82
112
  fi
83
113
 
84
114
  if [[ ! -f "$SPEC_FILE" ]]; then
@@ -86,14 +116,15 @@ if [[ ! -f "$SPEC_FILE" ]]; then
86
116
  exit 1
87
117
  fi
88
118
 
89
- echo "Validating: $SPEC_FILE"
90
- echo "=========================================="
91
-
92
- # Read file content
93
- CONTENT=$(cat "$SPEC_FILE")
119
+ # Read file content minus any leading frontmatter block (linear-mode identity
120
+ # metadata is not body; see _shared/references/artifact-store.md, Frontmatter).
121
+ # Match against it with here-strings, not `echo | grep -q`: under pipefail an
122
+ # early-exiting reader SIGPIPEs the echo writer and a present section reads as
123
+ # missing (YAN-1587).
124
+ CONTENT=$(artifact_body "$SPEC_FILE")
94
125
 
95
126
  # Check for title
96
- if echo "$CONTENT" | grep -q "^# Feature Spec:"; then
127
+ if grep -q "^# Feature Spec:" <<<"$CONTENT"; then
97
128
  log_success "Title present"
98
129
  else
99
130
  log_error "Missing title (should start with '# Feature Spec: [Name]')"
@@ -103,7 +134,7 @@ fi
103
134
  echo ""
104
135
  echo "Checking required sections..."
105
136
  for section in "${REQUIRED_SECTIONS[@]}"; do
106
- if echo "$CONTENT" | grep -q "^${section}"; then
137
+ if grep -q "^${section}" <<<"$CONTENT"; then
107
138
  log_success "Found: $section"
108
139
  else
109
140
  log_error "Missing required section: $section"
@@ -114,7 +145,7 @@ done
114
145
  echo ""
115
146
  echo "Checking recommended sections..."
116
147
  for section in "${RECOMMENDED_SECTIONS[@]}"; do
117
- if echo "$CONTENT" | grep -q "^${section}"; then
148
+ if grep -q "^${section}" <<<"$CONTENT"; then
118
149
  log_success "Found: $section"
119
150
  else
120
151
  log_warning "Missing recommended section: $section"
@@ -132,7 +163,7 @@ for check in "${SUBSECTION_CHECKS[@]}"; do
132
163
  found=false
133
164
  IFS='|' read -ra SUBS <<< "$subsections"
134
165
  for sub in "${SUBS[@]}"; do
135
- if echo "$CONTENT" | grep -q "^${sub}"; then
166
+ if grep -q "^${sub}" <<<"$CONTENT"; then
136
167
  found=true
137
168
  break
138
169
  fi
@@ -197,7 +228,7 @@ placeholders=(
197
228
  )
198
229
 
199
230
  for placeholder in "${placeholders[@]}"; do
200
- if echo "$CONTENT" | grep -qi "$placeholder"; then
231
+ if grep -qi "$placeholder" <<<"$CONTENT"; then
201
232
  log_warning "Found potential placeholder text: $placeholder"
202
233
  fi
203
234
  done
@@ -231,12 +262,12 @@ fi
231
262
  # Check for links
232
263
  echo ""
233
264
  echo "Checking links..."
234
- links=$(echo "$CONTENT" | grep -oE '\[([^\]]+)\]\(([^\)]+)\)' | wc -l | tr -d ' ')
265
+ links=$(grep -oE '\[[^]]+\]\([^)]+\)' <<<"$CONTENT" | wc -l | tr -d ' ' || true)
235
266
  if [[ $links -gt 0 ]]; then
236
267
  log_success "Found $links links"
237
268
 
238
269
  # Check for broken internal links to research files
239
- research_links=$(echo "$CONTENT" | grep -oE '\./research-[a-z]+\.md' || true)
270
+ research_links=$(echo "$CONTENT" | grep -oE '\./(research/)?research-[a-z-]+\.md' || true)
240
271
  if [[ -n "$research_links" ]]; then
241
272
  dir=$(dirname "$SPEC_FILE")
242
273
  while IFS= read -r link; do
@@ -6,7 +6,8 @@ These prompts deploy research sub-agents for comprehensive feature research incl
6
6
 
7
7
  Apply this contract to every sub-agent prompt in this file:
8
8
 
9
- - Write only your assigned output file under `{{FEATURE_DIR}}`.
9
+ - Write only your assigned `{{RESEARCH_<LENS>_FILE}}`; the orchestrator resolves it with the artifact-store `research-<lens>` kind.
10
+ - 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.
10
11
  - Do not edit any other files.
11
12
  - **Do NOT invoke any skills or slash commands** (e.g., `/ycc:deep-research`, `/ycc:feature-research`, or any other skill). Perform all research directly using your own tools: WebSearch, WebFetch, Read, Grep, Glob. You are a focused research agent — do your work yourself, do not delegate to other workflows.
12
13
  - **Share key findings** with relevant sub-agents using re-dispatch the affected sub-agent with the needed guidance.
@@ -52,7 +53,7 @@ Use web search and documentation to research:
52
53
 
53
54
  ## Output Format
54
55
 
55
- Write your findings to: {{FEATURE_DIR}}/research-external.md
56
+ Write your findings to: {{RESEARCH_EXTERNAL_FILE}}
56
57
 
57
58
  Structure with: Executive Summary, Primary APIs (with docs URLs, auth, endpoints, rate limits, pricing), Libraries and SDKs, Integration Patterns, Constraints and Gotchas, Code Examples, Open Questions.
58
59
 
@@ -98,7 +99,7 @@ Research and document:
98
99
 
99
100
  ## Output Format
100
101
 
101
- Write your findings to: {{FEATURE_DIR}}/research-business.md
102
+ Write your findings to: {{RESEARCH_BUSINESS_FILE}}
102
103
 
103
104
  Structure with: Executive Summary, User Stories, Business Rules (core rules + edge cases), Workflows (primary + error recovery), Domain Model (entities + state transitions), Existing Codebase Integration, Success Criteria, Open Questions.
104
105
 
@@ -144,7 +145,7 @@ Research and design:
144
145
 
145
146
  ## Output Format
146
147
 
147
- Write your findings to: {{FEATURE_DIR}}/research-technical.md
148
+ Write your findings to: {{RESEARCH_TECHNICAL_FILE}}
148
149
 
149
150
  Structure with: Executive Summary, Architecture Design (component diagram, new components, integration points), Data Models (tables with columns/types/constraints, indexes, migrations), API Design (endpoints with request/response/errors), System Constraints (performance, security, scalability), Codebase Changes (files to create/modify, dependencies), Technical Decisions (options + recommendation + rationale), Open Questions.
150
151
 
@@ -192,7 +193,7 @@ Research and document:
192
193
 
193
194
  ## Output Format
194
195
 
195
- Write your findings to: {{FEATURE_DIR}}/research-ux.md
196
+ Write your findings to: {{RESEARCH_UX_FILE}}
196
197
 
197
198
  Structure with: Executive Summary, User Workflows (primary + alternative flows), UI/UX Best Practices (industry standards, accessibility, responsive), Error Handling (error states table, validation patterns), Performance UX (loading states, optimistic updates, offline), Competitive Analysis, Recommendations (must have, should have, nice to have), Open Questions.
198
199
 
@@ -280,7 +281,7 @@ When a sub-agent proposes something with security implications, respond with the
280
281
 
281
282
  ## Output Format
282
283
 
283
- Write your findings to: {{FEATURE_DIR}}/research-security.md
284
+ Write your findings to: {{RESEARCH_SECURITY_FILE}}
284
285
 
285
286
  Structure with:
286
287
 
@@ -406,7 +407,7 @@ When recommending modularity changes, always explain the concrete benefit. "This
406
407
 
407
408
  ## Output Format
408
409
 
409
- Write your findings to: {{FEATURE_DIR}}/research-practices.md
410
+ Write your findings to: {{RESEARCH_PRACTICES_FILE}}
410
411
 
411
412
  Structure with:
412
413
 
@@ -526,7 +527,7 @@ Explore the codebase and generate:
526
527
 
527
528
  **CRITICAL**: You MUST write your findings to the specified file. This is not optional.
528
529
 
529
- **Output File**: {{FEATURE_DIR}}/research-recommendations.md
530
+ **Output File**: {{RESEARCH_RECOMMENDATIONS_FILE}}
530
531
 
531
532
  Structure with: Executive Summary, Implementation Recommendations (approach, technology choices, phasing, quick wins), Improvement Ideas (related features, enhancements, integrations), Risk Assessment (technical risks table, integration challenges, performance, security), Alternative Approaches (options with pros/cons/effort, recommendation), Task Breakdown Preview (phases with task groups, estimated complexity), Key Decisions Needed, Open Questions.
532
533
 
@@ -542,7 +543,7 @@ When spawning research sub-agents:
542
543
  1. **Read this file** to get the prompt templates
543
544
  2. **Substitute variables**:
544
545
  - `{{FEATURE_NAME}}` - The feature directory name (e.g., `plex-integration`)
545
- - `{{FEATURE_DIR}}` - Full output directory (e.g., `docs/plans/plex-integration`)
546
+ - `{{RESEARCH_<LENS>_FILE}}` - Absolute output path resolved for kind `research-<lens>` (local example: `docs/plans/plex-integration/research-<lens>.md`)
546
547
  - `{{FEATURE_DESCRIPTION}}` - Description provided by user (or feature name if none)
547
548
  3. **Register tasks** - Use track the task for all 7 research tasks
548
549
  4. **Create tasks** - Use track the task to create 7 research tasks
@@ -553,11 +554,11 @@ When spawning research sub-agents:
553
554
 
554
555
  ## Variable Reference
555
556
 
556
- | Variable | Description | Example |
557
- | ------------------------- | ------------------------------ | -------------------------------------------------------------------- |
558
- | `{{FEATURE_NAME}}` | Feature directory name | `plex-integration` |
559
- | `{{FEATURE_DIR}}` | Full research output directory | `docs/plans/plex-integration` |
560
- | `{{FEATURE_DESCRIPTION}}` | User-provided description | `Advanced Plex media library integration with filters and playlists` |
557
+ | Variable | Description | Example |
558
+ | -------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
559
+ | `{{FEATURE_NAME}}` | Feature directory name | `plex-integration` |
560
+ | `{{RESEARCH_<LENS>_FILE}}` | Absolute research output path | Local: `docs/plans/plex-integration/research-<lens>.md`; linear: `.ycc/artifacts/plex-integration/research/research-<lens>.md` |
561
+ | `{{FEATURE_DESCRIPTION}}` | User-provided description | `Advanced Plex media library integration with filters and playlists` |
561
562
 
562
563
  ## Expected Output
563
564
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  This template defines the structure for `feature-spec.md` - the consolidated research document that serves as input for plan-workflow.
4
4
 
5
+ Resolve research links for the active store: in linear mode (default) use `./research/research-<lens>.md`; in local mode use `./research-<lens>.md`.
6
+
5
7
  ---
6
8
 
7
9
  ## Complete Example Format
@@ -307,6 +309,9 @@ For detailed findings, see:
307
309
  - [research-practices.md](./research-practices.md): Engineering practices (modularity, reuse, KISS)
308
310
  - [research-recommendations.md](./research-recommendations.md): Full recommendations
309
311
 
312
+ In linear mode use the nested research path for every reference, for example:
313
+ - [research-ux.md](./research/research-ux.md): UX research
314
+
310
315
  ````
311
316
 
312
317
  ---
@@ -113,8 +113,10 @@ apply_package_json() {
113
113
  format format:modified format:staged format:unstaged
114
114
  )
115
115
  local conflicts=()
116
+ # Here-string, not `printf | grep -q`: under pipefail the early-exiting
117
+ # grep can SIGPIPE the writer and a present key reads as absent (YAN-1607).
116
118
  for key in "${template_keys[@]}"; do
117
- if printf '%s\n' "$existing" | grep -Fxq "$key"; then
119
+ if grep -Fxq -- "$key" <<<"$existing"; then
118
120
  conflicts+=("$key")
119
121
  fi
120
122
  done
@@ -118,7 +118,9 @@ PYEOF
118
118
 
119
119
  if $dry_run; then
120
120
  info "[dry-run] would write $dest"
121
- printf '%s' "$rendered" | head -20
121
+ # Print the preview from a here-string, not `printf | head`: under
122
+ # pipefail the early-exiting head SIGPIPEs the writer (YAN-1587).
123
+ head -n 20 <<<"$rendered"
122
124
  return 0
123
125
  fi
124
126
 
@@ -105,6 +105,7 @@ Only when `pr ∈ actions`. Read `references/pr-creation.md` before Step 22. Dec
105
105
  - Step 22b: resolve `$BASE`, run the sync-check guard (exit 3: no PR, stop), offer backport, per `{{package-root}}/shared/references/pr-base-and-backport.md`. Exit 2 (malformed `RELEASING.md`) stops with the parse error and `/ycc:release-model --audit`.
106
106
  - Step 23: read `templates/pr-template.md`.
107
107
  - Step 25: PR title must be Conventional Commit format and pass `validate-commit.sh`.
108
+ - Step 26a: link Linear and GitHub issues in `## Related Issues` per `references/pr-creation.md` (contract: artifact-store.md PR linking).
108
109
  - Step 28: MCP `mcp__github__create_pull_request` first, `gh pr create` fallback; forge routing via `{{package-root}}/shared/references/forge-detection.md` (`tea` for forgejo/gitea).
109
110
  - Step 27: draft when work is incomplete or feedback is wanted; honor `--draft`.
110
111
 
@@ -129,4 +130,4 @@ Read `references/examples-and-troubleshooting.md` for the commit/docs/agent/PR/o
129
130
  - `references/examples-and-troubleshooting.md` — read for checklists, examples, or when a step fails.
130
131
  - `templates/commit-types.md`, `templates/documentation-decision.md`, `templates/agent-prompts.md`, `templates/pr-template.md` — read at Steps 8, 6, 14, 23.
131
132
  - `scripts/analyze-changes.sh` (Step 2), `scripts/validate-commit.sh` (Steps 10, 18, 25, 36), `scripts/create-pr.sh` (Step 24; `--analyze --base "$BASE"`; defensive existing-PR check).
132
- - Shared: `{{package-root}}/shared/references/{forge-detection,pr-base-and-backport,ci-monitoring,goal-pairing}.md`, `{{package-root}}/shared/scripts/{pr-guard,ci-monitor}.sh`. `branch-prep.md` does not apply: this skill never creates branches.
133
+ - Shared: `{{package-root}}/shared/references/{forge-detection,pr-base-and-backport,ci-monitoring,goal-pairing,artifact-store}.md`, `{{package-root}}/shared/scripts/{pr-guard,ci-monitor,collect-linear-keys}.sh`. `branch-prep.md` does not apply: this skill never creates branches.
@@ -7,6 +7,7 @@
7
7
  - Step 22b: base, sync guard, backport
8
8
  - Steps 23–24: template and context
9
9
  - Step 25: PR title
10
+ - Step 26a: link Linear and GitHub issues
10
11
  - Step 26: PR description
11
12
  - Step 27: draft vs ready
12
13
  - Step 28: create the PR (MCP, then CLI)
@@ -92,6 +93,15 @@ docs: update API documentation and examples
92
93
  refactor(database): migrate to new query builder pattern
93
94
  ```
94
95
 
96
+ ## Step 26a: Link Linear and GitHub issues
97
+
98
+ Contract (collection, verification, keywords, skip message): `{{package-root}}/shared/references/artifact-store.md` § PR linking. Applies in both store modes.
99
+
100
+ 2. Add the `linear.issue` from the leading frontmatter of the cached plan implemented on this branch as a `closes` candidate: use the cache path known in the session, else `.ycc/artifacts/<slug>/{parallel-plan,prp-plan}.md` where `<slug>` is the branch name without a leading `feat/`. Check the current checkout, then the main checkout (parent of `git rev-parse --path-format=absolute --git-common-dir`), per the contract's step 1.
101
+ 3. Verify, then emit `Closes` for `closes` keys and `Refs` for `refs`-only keys, plus `Closes #<n>` for linked GitHub issues, under `## Related Issues`; never duplicate a line already present in the body or repository template (Step 31). Use the contract's skip message when no team or MCP can verify.
102
+
103
+ `create-pr.sh --create` applies the same team filter without MCP verification and keeps the bare `Closes #` placeholder when nothing qualifies.
104
+
95
105
  ## Step 26: PR description
96
106
 
97
107
  ```markdown