@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
@@ -17,12 +17,15 @@
17
17
  set -euo pipefail
18
18
 
19
19
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
20
- RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-plans-dir.sh"
20
+ RESOLVER="${SCRIPT_DIR}/../../../shared/scripts/resolve-artifact-store.sh"
21
21
 
22
- # Source resolver to get PLANS_ROOT for path resolution
22
+ # Source resolver to get PLANS_ROOT/ARTIFACT_ROOT for path resolution and the
23
+ # artifact_body helper for frontmatter-skipping heading checks.
23
24
  if [[ -f "$RESOLVER" ]]; then
24
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
25
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
25
26
  source "$RESOLVER"
27
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
28
+ source "${SCRIPT_DIR}/../../../shared/scripts/artifact-body.sh"
26
29
  fi
27
30
 
28
31
  RED='\033[0;31m'
@@ -55,7 +58,9 @@ require_any_heading() {
55
58
  local found=false
56
59
  local heading
57
60
  for heading in "$@"; do
58
- if grep -q "^${heading}" "$file"; then
61
+ # Match against the body only: identity frontmatter is not content
62
+ # (see _shared/references/artifact-store.md, Frontmatter).
63
+ if grep -q "^${heading}" < <(artifact_body "$file"); then
59
64
  found=true
60
65
  break
61
66
  fi
@@ -69,12 +74,13 @@ require_any_heading() {
69
74
  }
70
75
 
71
76
  if [[ $# -lt 1 ]]; then
72
- echo "Usage: $0 <feature-dir> [--optimized]"
77
+ echo "Usage: $0 <feature-dir> [--optimized] [--store=linear|local]"
73
78
  exit 1
74
79
  fi
75
80
 
76
81
  feature_dir=""
77
82
  optimized="false"
83
+ store_flag=""
78
84
 
79
85
  while [[ $# -gt 0 ]]; do
80
86
  case "$1" in
@@ -82,6 +88,10 @@ while [[ $# -gt 0 ]]; do
82
88
  optimized="true"
83
89
  shift
84
90
  ;;
91
+ --store=*)
92
+ store_flag="$1"
93
+ shift
94
+ ;;
85
95
  *)
86
96
  if [[ -z "$feature_dir" ]]; then
87
97
  feature_dir="$1"
@@ -94,14 +104,23 @@ while [[ $# -gt 0 ]]; do
94
104
  esac
95
105
  done
96
106
 
107
+ if [[ -n "$store_flag" ]]; then
108
+ # shellcheck disable=SC2086
109
+ resolve_artifact_store "$PWD" "$store_flag" || {
110
+ echo -e "${RED}ERROR:${NC} invalid ${store_flag#--}" >&2
111
+ exit 1
112
+ }
113
+ fi
114
+
97
115
  if [[ -z "$feature_dir" ]]; then
98
116
  echo -e "${RED}ERROR:${NC} feature-dir required" >&2
99
117
  exit 1
100
118
  fi
101
119
 
102
- # Always resolve relative paths against PLANS_ROOT (from resolve-plans-dir.sh)
103
- if [[ "$feature_dir" != /* && -n "${PLANS_ROOT:-}" ]]; then
104
- feature_dir="${PLANS_ROOT}/${feature_dir}"
120
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
121
+ # mode, ARTIFACT_ROOT in linear mode.
122
+ if [[ "$feature_dir" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
123
+ feature_dir="${ARTIFACT_ROOT:-$PLANS_ROOT}/${feature_dir}"
105
124
  fi
106
125
 
107
126
  if [[ ! -d "$feature_dir" ]]; then
@@ -139,6 +158,12 @@ echo "=========================================="
139
158
  for file in "${files[@]}"; do
140
159
  path="${feature_dir}/${file}"
141
160
 
161
+ # Research files live directly in the feature dir (local layout) or in its
162
+ # research/ subdir (linear layout). An existing research/ directory wins.
163
+ if [[ "$file" == research-* && -d "${feature_dir}/research" ]]; then
164
+ path="${feature_dir}/research/${file}"
165
+ fi
166
+
142
167
  if [[ ! -f "$path" ]]; then
143
168
  log_error "${file}: file not found"
144
169
  continue
@@ -154,8 +179,8 @@ for file in "${files[@]}"; do
154
179
  log_warning "${file}: content is short (${size_bytes} bytes)"
155
180
  fi
156
181
 
157
- # Check for title heading
158
- if grep -q "^# " "$path"; then
182
+ # Check for title heading in the body (frontmatter skipped)
183
+ if grep -q "^# " < <(artifact_body "$path"); then
159
184
  log_success "${file}: has title heading"
160
185
  else
161
186
  log_warning "${file}: missing title heading"
@@ -11,21 +11,30 @@
11
11
 
12
12
  set -uo pipefail
13
13
 
14
- SHARED_FILE="${1:-}"
15
14
  ERRORS=0
16
15
  WARNINGS=0
17
16
 
18
- # Source the shared resolver to get PLANS_ROOT for file path validation
17
+ # Source the artifact-store resolver to get PLANS_ROOT/ARTIFACT_ROOT for path
18
+ # resolution and the store mode.
19
19
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
20
20
  SHARED_DIR="${SCRIPT_DIR}/../../../shared/scripts"
21
21
 
22
- if [[ -f "${SHARED_DIR}/resolve-plans-dir.sh" ]]; then
23
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
24
- 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"
25
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
26
+ source "${SHARED_DIR}/artifact-body.sh"
27
+ else
28
+ # ponytail: resolver ships with the plugin; failing beats guessing a wrong
29
+ # relative docs/plans. Upgrade path: restore resolver alongside this script.
30
+ echo "ERROR: resolve-artifact-store.sh not found at ${SHARED_DIR}" >&2
31
+ echo "Cannot resolve plans directory safely; refusing to guess." >&2
32
+ exit 1
25
33
  fi
26
34
 
27
- # Use PLANS_ROOT as base for validating file paths, fallback to current directory
28
- VALIDATE_ROOT="${PLANS_ROOT:-$(pwd)}"
35
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
36
+ # mode, ARTIFACT_ROOT in linear mode.
37
+ VALIDATE_ROOT="${ARTIFACT_ROOT:-${PLANS_ROOT:-$(pwd)}}"
29
38
 
30
39
  # Colors for output
31
40
  RED='\033[0;31m'
@@ -47,16 +56,44 @@ success() {
47
56
  echo -e "${GREEN}✓${NC} $1"
48
57
  }
49
58
 
59
+ SHARED_FILE=""
60
+ STORE_FLAG=""
61
+ while [[ $# -gt 0 ]]; do
62
+ case "$1" in
63
+ --store=*)
64
+ STORE_FLAG="$1"
65
+ ;;
66
+ *)
67
+ if [[ -z "$SHARED_FILE" ]]; then
68
+ SHARED_FILE="$1"
69
+ else
70
+ echo "Usage: validate-shared.sh <path-to-shared.md> [--store=linear|local]" >&2
71
+ exit 1
72
+ fi
73
+ ;;
74
+ esac
75
+ shift
76
+ done
77
+
78
+ if [[ -n "$STORE_FLAG" ]]; then
79
+ # shellcheck disable=SC2086
80
+ resolve_artifact_store "$PWD" "$STORE_FLAG" || {
81
+ echo "ERROR: invalid ${STORE_FLAG#--}" >&2
82
+ exit 1
83
+ }
84
+ fi
85
+
50
86
  if [[ -z "$SHARED_FILE" ]]; then
51
- echo "Usage: validate-shared.sh <path-to-shared.md>"
87
+ echo "Usage: validate-shared.sh <path-to-shared.md> [--store=linear|local]"
52
88
  echo ""
53
89
  echo "Validates the structure and content of a shared.md document."
54
90
  exit 1
55
91
  fi
56
92
 
57
- # Always resolve relative paths against PLANS_ROOT
58
- if [[ "$SHARED_FILE" != /* && -n "${PLANS_ROOT:-}" ]]; then
59
- SHARED_FILE="${PLANS_ROOT}/${SHARED_FILE}"
93
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
94
+ # mode, ARTIFACT_ROOT in linear mode.
95
+ if [[ "$SHARED_FILE" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
96
+ SHARED_FILE="${ARTIFACT_ROOT:-$PLANS_ROOT}/${SHARED_FILE}"
60
97
  fi
61
98
 
62
99
  if [[ ! -f "$SHARED_FILE" ]]; then
@@ -67,15 +104,19 @@ fi
67
104
  echo "Validating: $SHARED_FILE"
68
105
  echo "---"
69
106
 
70
- # Read file content
71
- CONTENT=$(cat "$SHARED_FILE")
107
+ # Read file content minus any leading frontmatter block (linear-mode identity
108
+ # metadata is not body; see _shared/references/artifact-store.md, Frontmatter).
109
+ # Match against it with here-strings, not `echo | grep -q`: under pipefail an
110
+ # early-exiting reader SIGPIPEs the echo writer and a present section reads as
111
+ # missing (YAN-1285).
112
+ CONTENT=$(artifact_body "$SHARED_FILE")
72
113
 
73
114
  # Check for required sections
74
115
  check_section() {
75
116
  local section="$1"
76
117
  local required="$2"
77
118
 
78
- if echo "$CONTENT" | grep -q "^## $section"; then
119
+ if grep -q "^## $section" <<<"$CONTENT"; then
79
120
  success "Found section: $section"
80
121
  return 0
81
122
  else
@@ -101,7 +142,7 @@ check_section "Relevant Tables" "false" || true
101
142
  # Check for title (H1)
102
143
  echo ""
103
144
  echo "Checking document structure..."
104
- if echo "$CONTENT" | head -5 | grep -q "^# "; then
145
+ if grep -q "^# " <<<"$(head -n 5 <<<"$CONTENT")"; then
105
146
  success "Found document title (H1)"
106
147
  else
107
148
  error "Missing document title (should start with '# ')"
@@ -19,21 +19,23 @@
19
19
 
20
20
  set -uo pipefail
21
21
 
22
- PLAN_FILE="${1:-}"
23
22
  ERRORS=0
24
23
  WARNINGS=0
25
24
 
26
- # Source the shared resolver to get PLANS_ROOT for file path validation
25
+ # Source the artifact-store resolver to get PLANS_ROOT/ARTIFACT_ROOT for path
26
+ # resolution and the store mode.
27
27
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
28
28
  SHARED_DIR="${SCRIPT_DIR}/../../../shared/scripts"
29
29
 
30
- if [[ -f "${SHARED_DIR}/resolve-plans-dir.sh" ]]; then
31
- # shellcheck source=../../../shared/scripts/resolve-plans-dir.sh
32
- source "${SHARED_DIR}/resolve-plans-dir.sh"
30
+ if [[ -f "${SHARED_DIR}/resolve-artifact-store.sh" ]]; then
31
+ # shellcheck source=../../../shared/scripts/resolve-artifact-store.sh
32
+ source "${SHARED_DIR}/resolve-artifact-store.sh"
33
+ # shellcheck source=../../../shared/scripts/artifact-body.sh
34
+ source "${SHARED_DIR}/artifact-body.sh"
33
35
  else
34
36
  # ponytail: resolver ships with the plugin; failing beats resolving a
35
37
  # relative plan path against the wrong cwd. Upgrade: restore the resolver.
36
- echo "ERROR: resolve-plans-dir.sh not found at ${SHARED_DIR}" >&2
38
+ echo "ERROR: resolve-artifact-store.sh not found at ${SHARED_DIR}" >&2
37
39
  echo "Cannot resolve PLANS_ROOT safely; refusing to guess." >&2
38
40
  exit 1
39
41
  fi
@@ -58,16 +60,44 @@ success() {
58
60
  echo -e "${GREEN}✓${NC} $1"
59
61
  }
60
62
 
63
+ PLAN_FILE=""
64
+ STORE_FLAG=""
65
+ while [[ $# -gt 0 ]]; do
66
+ case "$1" in
67
+ --store=*)
68
+ STORE_FLAG="$1"
69
+ ;;
70
+ *)
71
+ if [[ -z "$PLAN_FILE" ]]; then
72
+ PLAN_FILE="$1"
73
+ else
74
+ echo "Usage: validate-plan.sh <plan-file> [--store=linear|local]" >&2
75
+ exit 1
76
+ fi
77
+ ;;
78
+ esac
79
+ shift
80
+ done
81
+
82
+ if [[ -n "$STORE_FLAG" ]]; then
83
+ # shellcheck disable=SC2086
84
+ resolve_artifact_store "$PWD" "$STORE_FLAG" || {
85
+ echo "ERROR: invalid ${STORE_FLAG#--}" >&2
86
+ exit 1
87
+ }
88
+ fi
89
+
61
90
  if [[ -z "$PLAN_FILE" ]]; then
62
- echo "Usage: validate-plan.sh <plan-file>"
91
+ echo "Usage: validate-plan.sh <plan-file> [--store=linear|local]"
63
92
  echo ""
64
93
  echo "Validates the structure of a parallel implementation plan."
65
94
  exit 1
66
95
  fi
67
96
 
68
- # Always resolve relative paths against PLANS_ROOT
69
- if [[ "$PLAN_FILE" != /* && -n "${PLANS_ROOT:-}" ]]; then
70
- PLAN_FILE="${PLANS_ROOT}/${PLAN_FILE}"
97
+ # Resolve relative paths against the active artifact root: PLANS_ROOT in local
98
+ # mode, ARTIFACT_ROOT in linear mode.
99
+ if [[ "$PLAN_FILE" != /* && -n "${ARTIFACT_ROOT:-${PLANS_ROOT:-}}" ]]; then
100
+ PLAN_FILE="${ARTIFACT_ROOT:-$PLANS_ROOT}/${PLAN_FILE}"
71
101
  fi
72
102
 
73
103
  if [[ ! -f "$PLAN_FILE" ]]; then
@@ -78,12 +108,13 @@ fi
78
108
  echo "Validating plan structure: $PLAN_FILE"
79
109
  echo ""
80
110
 
81
- # Read file content
82
- CONTENT=$(cat "$PLAN_FILE")
111
+ # Read file content minus any leading frontmatter block (linear-mode identity
112
+ # metadata is not body; see _shared/references/artifact-store.md, Frontmatter).
113
+ CONTENT=$(artifact_body "$PLAN_FILE")
83
114
 
84
115
  # Title check
85
116
  echo "Checking document structure..."
86
- if echo "$CONTENT" | head -5 | grep -q "^# "; then
117
+ if grep -q "^# " <<<"$(head -n 5 <<<"$CONTENT")"; then
87
118
  success "Title present"
88
119
  else
89
120
  error "Missing title (# heading)"
@@ -108,7 +139,7 @@ fi
108
139
  # Critically Relevant Files section
109
140
  echo ""
110
141
  echo "Checking required sections..."
111
- if echo "$CONTENT" | grep -q "## Critically Relevant Files"; then
142
+ if grep -q "## Critically Relevant Files" <<<"$CONTENT"; then
112
143
  success "Critically Relevant Files section present"
113
144
 
114
145
  # Count files listed (absolute or relative paths)
@@ -123,14 +154,14 @@ else
123
154
  fi
124
155
 
125
156
  # Implementation Plan section
126
- if echo "$CONTENT" | grep -q "## Implementation Plan"; then
157
+ if grep -q "## Implementation Plan" <<<"$CONTENT"; then
127
158
  success "Implementation Plan section present"
128
159
  else
129
160
  error "Missing 'Implementation Plan' section"
130
161
  fi
131
162
 
132
163
  # Advice section
133
- if echo "$CONTENT" | grep -q "## Advice"; then
164
+ if grep -q "## Advice" <<<"$CONTENT"; then
134
165
  success "Advice section present"
135
166
 
136
167
  # Count advice items
@@ -148,7 +179,7 @@ fi
148
179
  # per-task **Worktree** lines are legacy and not required in new plans.
149
180
  echo ""
150
181
  echo "Checking optional worktree annotations..."
151
- if echo "$CONTENT" | grep -q "^## Worktree Setup"; then
182
+ if grep -q "^## Worktree Setup" <<<"$CONTENT"; then
152
183
  success "Worktree Setup section present (single feature worktree — see worktree-strategy.md)"
153
184
  WORKTREE_TASK_FIELDS=$(echo "$CONTENT" | grep -c '\*\*Worktree\*\*:' || true)
154
185
  success " $WORKTREE_TASK_FIELDS legacy per-task **Worktree** field(s) (expected 0 in new plans)"
@@ -87,12 +87,18 @@ Extract flags from `$ARGUMENTS`; the remainder is the PR selector.
87
87
  | `--ci-max-same-failure=N` | Bail after the same failure signature recurs N times (default 3). |
88
88
  | `--ci-timeout-min=N` | Wall-clock cap in minutes (default 30). |
89
89
  | `--ci-yes` | Skip the one-time CI authorization prompt (non-interactive callers). |
90
+ | `--store=local\|linear` | Artifact-store override for the local report path; kept verbatim as `STORE_FLAG` (empty when absent). |
90
91
 
91
92
  **Validation** (abort on any failure):
92
93
 
93
94
  - `--bot-only` and `--human-only` are mutually exclusive.
94
95
  - `--no-push` and `--ci` are mutually exclusive (CI cannot observe unpushed commits).
95
96
  - `--commit-style` must be `one` or `per-comment`.
97
+ - Artifact store: print the mode for the report with
98
+ `bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --shell "$(git rev-parse --show-toplevel)"`
99
+ and abort on a non-zero exit (for example `--store=liner`), before any fix,
100
+ commit or push. The report is a local-only kind, so no Linear call gate
101
+ applies (artifact-store.md > Review and report skills).
96
102
 
97
103
  ### PR resolution
98
104
 
@@ -125,6 +131,8 @@ Before the GitHub checks, detect the provider on `origin` (`forge_detect_provide
125
131
  | Working tree clean | Warn + ask the user: "Uncommitted changes detected — commit/stash before fixing? (yes/no/abort)" |
126
132
  | Local checkout = `HEAD_BRANCH` | If not, ask the user: "Switch to `<HEAD_BRANCH>` now? (yes/no)". On `no`, abort. |
127
133
 
134
+ A `.gitignore` whose only change adds the `.ycc/artifacts/` rule (left by a previous linear-mode report, Phase 8; the rule-only check in artifact-store.md > Reviews) does not count as uncommitted changes in any clean-tree or clean-index check: Phase 0 here, Phase 4 before each dispatch, and Phase 5 after each per-comment commit. Never stage it.
135
+
128
136
  If `--ci` was passed and any refusal fires, append: `--ci will not run because the autofix run cannot proceed.`
129
137
 
130
138
  ---
@@ -175,7 +183,7 @@ For each `Apply` entry, sanitize the body per `references/prompt-injection-safet
175
183
  ### Batching
176
184
 
177
185
  1. For `--commit-style one`: group same-file Apply entries in one fixer, sorted by line DESCENDING. Different-file groups parallelize with `--parallel`; order batches by severity: CRITICAL → HIGH → MEDIUM → LOW.
178
- 2. For `--commit-style per-comment`: dispatch one comment at a time, sequentially even with `--parallel`. Use the same severity-first, same-file line-DESC order; re-check each anchor against the current file. Before dispatch require a clean working tree and index. After each `Fixed`, run Phase 5's per-comment commit before dispatching the next comment.
186
+ 2. For `--commit-style per-comment`: dispatch one comment at a time, sequentially even with `--parallel`. Use the same severity-first, same-file line-DESC order; re-check each anchor against the current file. Before dispatch require a clean working tree and index (a `.gitignore` whose only change adds the `.ycc/artifacts/` rule does not count). After each `Fixed`, run Phase 5's per-comment commit before dispatching the next comment.
179
187
  3. For either mode, a Failed fixer with leftover edits stops dispatch and push for user review; never include those edits in another comment's commit or discard them automatically.
180
188
 
181
189
  ### Dispatch modes
@@ -192,7 +200,7 @@ Each fixer returns `STATUS: Fixed` or `STATUS: Failed` per comment, with `CHANGE
192
200
  If no fixer returned `Fixed`, create no commit. Otherwise:
193
201
 
194
202
  - `--commit-style one` (default): after all fixers finish, review the diff, stage only verified Fixed changes with `git add <files-touched>`, then `git commit -m "fix: apply PR review feedback (PR #${PR_NUMBER})"`. Uncommitted Failed changes require user review before staging/pushing.
195
- - `--commit-style per-comment`: commit immediately after each `Fixed` in Phase 4, before dispatching the next comment. Review only this comment's delta against its clean pre-dispatch state, validate the message, and `git add -- <this-comment-files>` (never stage all fixers). No delta (`CHANGES: none (already applied)`): record `Fixed`, create no empty commit. Any unexpected file or failed commit stops dispatch and push for user review. After each commit require a clean working tree and index. Message:
203
+ - `--commit-style per-comment`: commit immediately after each `Fixed` in Phase 4, before dispatching the next comment. Review only this comment's delta against its clean pre-dispatch state, validate the message, and `git add -- <this-comment-files>` (never stage all fixers). No delta (`CHANGES: none (already applied)`): record `Fixed`, create no empty commit. Any unexpected file or failed commit stops dispatch and push for user review. After each commit require a clean working tree and index (the rule-only `.gitignore` exemption from Phase 0 applies). Message:
196
204
 
197
205
  ```
198
206
  fix: address review comment from <author> on <path>:<line>
@@ -275,7 +283,14 @@ If everything was Deferred (no commit, no thread mutation), skip the summary ent
275
283
 
276
284
  ### Local report and final stdout
277
285
 
278
- Write the report to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-$(date -u +%FT%H%M%SZ).md`, then print the final stdout. Both templates, and the Goal Signals block, are in `references/output-templates.md`. Print every Goal Signal verbatim as the last lines of Phase 8 output, one `KEY: PASS|FAIL` per line.
286
+ Resolve the report through the artifact store, kind `pr-autofix-report-<N>-<ts>`, using the same UTC stamp as before:
287
+
288
+ ```bash
289
+ TS="$(date -u +%FT%H%M%SZ)"
290
+ REPORT_PATH="$(bash "{{package-root}}/shared/scripts/resolve-artifact-store.sh" ${STORE_FLAG} --ensure --kind=pr-autofix-report-${PR_NUMBER}-${TS} --slug=<slug> "$(git rev-parse --show-toplevel)")"
291
+ ```
292
+
293
+ Slug: `pr-autofix` in local mode (validated only); in linear mode artifact-store.md Slugs rules 3-4 (lowercased `ARTIFACT_LINEAR_HINT`, else the sanitized `HEAD_BRANCH`), with no Linear calls. Local mode: unchanged path `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-<ts>.md`. Linear mode: `.ycc/artifacts/<slug>/reports/pr-autofix-<N>-<ts>.md` (gitignored); create its parent with `mkdir -p "$(dirname "$REPORT_PATH")"` before writing. The report is local-only in both modes (artifact-store.md > Review and report skills > Local-only reports): never pushed to Linear, never committed in linear mode, and a `.gitignore` change made by `--ensure` is never staged. When the rule-only `.gitignore` check (artifact-store.md > Reviews, run against the toplevel) holds, add the `.gitignore` line from the final stdout template; later runs ignore that change in their clean-tree checks. `--dry-run` writes no report. The `~/.config/opencode/session-data/ci-watch/` audit log is unchanged. Write the report to `$REPORT_PATH`, then print the final stdout (`Report:` shows the toplevel-relative path in local mode, as before). Both templates, and the Goal Signals block, are in `references/output-templates.md`. Print every Goal Signal verbatim as the last lines of Phase 8 output, one `KEY: PASS|FAIL` per line.
279
294
 
280
295
  ---
281
296
 
@@ -296,7 +311,7 @@ Write the report to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autof
296
311
  - **NO_FORCE_PUSH**: no `git push --force` or `--force-with-lease` was issued.
297
312
  - **NO_NO_VERIFY**: no `git commit --no-verify` was issued.
298
313
  - **NO_RAW_PROMPTS_OUTBOUND**: no reviewer text appears verbatim in any reply, summary, or commit message; all outbound text passes the sanitizer.
299
- - **REPORT_CREATED**: `docs/prps/reports/pr-autofix-<N>-<ts>.md` exists.
314
+ - **REPORT_CREATED**: the resolved `$REPORT_PATH` exists (local mode: `docs/prps/reports/pr-autofix-<N>-<ts>.md`).
300
315
  - **CI_GREEN**: if `--ci` ran, the loop reached `RESULT=green` and Phase 8 stdout shows `Result: green`. `n/a` when `--ci` was not set.
301
316
  - **CI_BAIL_VISIBLE**: if `--ci` bailed, the report and stdout state the `bail-*` code and the cap/constraint that fired. `n/a` when `--ci` reached green or was not set.
302
317
 
@@ -61,7 +61,7 @@ For `Skip`, a second ask the user collects a free-form reason (max ~140 chars),
61
61
 
62
62
  ## Phase 8 local report
63
63
 
64
- Write to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-$(date -u +%FT%H%M%SZ).md`:
64
+ Write to `$REPORT_PATH`, resolved in SKILL.md Phase 8 with kind `pr-autofix-report-<N>-<ts>` (local mode: unchanged `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUMBER}-$(date -u +%FT%H%M%SZ).md`; linear mode: `.ycc/artifacts/<slug>/reports/pr-autofix-<N>-<ts>.md`, local-only and never pushed or committed):
65
65
 
66
66
  ```markdown
67
67
  # PR Autofix Report: PR #<N>
@@ -126,7 +126,8 @@ Write to `$(git rev-parse --show-toplevel)/docs/prps/reports/pr-autofix-${PR_NUM
126
126
  PR: #<PR_NUMBER>
127
127
  Branch: <HEAD_BRANCH>
128
128
  Mode: <Sequential|Parallel>
129
- Report: docs/prps/reports/pr-autofix-<N>-<ts>.md
129
+ Report: <local mode docs/prps/reports/pr-autofix-<N>-<ts>.md; linear mode absolute REPORT_PATH>
130
+ Gitignore: <linear mode only, when --ensure added it: .gitignore gained the .ycc/artifacts/ rule; leave it out of commits>
130
131
 
131
132
  ### Comments
132
133
  Fetched: T
@@ -42,7 +42,6 @@ VERSION="1.0.0"
42
42
 
43
43
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
44
44
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
45
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
46
45
  # shellcheck source=/dev/null
47
46
  source "$FORGE_LIB"
48
47
 
@@ -131,7 +130,7 @@ done
131
130
  require_arg "--pr" "$PR"
132
131
  require_arg "--out" "$OUT"
133
132
 
134
- if ! printf '%s' "$PR" | grep -qE '^[0-9]+$'; then
133
+ if ! grep -qE '^[0-9]+$' <<<"$PR"; then
135
134
  printf 'fetch-pr-comments.sh: --pr must be a positive integer, got: %s\n' "$PR" >&2
136
135
  exit 1
137
136
  fi
@@ -41,7 +41,6 @@ VERSION="1.0.0"
41
41
 
42
42
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
43
43
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
44
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
45
44
  # shellcheck source=/dev/null
46
45
  source "$FORGE_LIB"
47
46
 
@@ -129,7 +128,7 @@ for pair in "pr:$PR" "fixed:$FIXED" "failed:$FAILED" "skipped:$SKIPPED" "deferre
129
128
  "ci-iterations:$CI_ITERATIONS" "ci-pushes:$CI_PUSHES"; do
130
129
  label="${pair%%:*}"
131
130
  value="${pair#*:}"
132
- if ! printf '%s' "$value" | grep -qE '^[0-9]+$'; then
131
+ if ! grep -qE '^[0-9]+$' <<<"$value"; then
133
132
  printf 'post-summary.sh: --%s must be a non-negative integer, got: %s\n' "$label" "$value" >&2
134
133
  exit 1
135
134
  fi
@@ -42,7 +42,6 @@ VERSION="1.0.0"
42
42
 
43
43
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
44
44
  FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
45
- [[ -f "$FORGE_LIB" ]] || FORGE_LIB="${SCRIPT_DIR}/../../../shared/scripts/lib/forge.sh"
46
45
  # shellcheck source=/dev/null
47
46
  source "$FORGE_LIB"
48
47
 
@@ -114,11 +113,11 @@ cmd_reply() {
114
113
  require_arg "root_comment_id" "$root_id"
115
114
  require_arg "body" "$body"
116
115
 
117
- if ! printf '%s' "$pr" | grep -qE '^[0-9]+$'; then
116
+ if ! grep -qE '^[0-9]+$' <<<"$pr"; then
118
117
  printf 'resolve-thread.sh: pr_number must be a positive integer, got: %s\n' "$pr" >&2
119
118
  exit 1
120
119
  fi
121
- if ! printf '%s' "$root_id" | grep -qE '^[0-9]+$'; then
120
+ if ! grep -qE '^[0-9]+$' <<<"$root_id"; then
122
121
  printf 'resolve-thread.sh: root_comment_id must be a positive integer, got: %s\n' "$root_id" >&2
123
122
  exit 1
124
123
  fi
@@ -139,7 +138,7 @@ cmd_issue_reply() {
139
138
  require_arg "pr_number" "$pr"
140
139
  require_arg "body" "$body"
141
140
 
142
- if ! printf '%s' "$pr" | grep -qE '^[0-9]+$'; then
141
+ if ! grep -qE '^[0-9]+$' <<<"$pr"; then
143
142
  printf 'resolve-thread.sh: pr_number must be a positive integer, got: %s\n' "$pr" >&2
144
143
  exit 1
145
144
  fi