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