@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.
- 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/package.json +1 -1
- 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 +42 -6
- 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 +96 -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/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/scripts/audit-target-features.sh +1 -1
- 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
|
@@ -10,6 +10,8 @@ The helper echoes the prepared branch name on success.
|
|
|
10
10
|
|
|
11
11
|
"Trunk" means `main`/`master`/`trunk`/`develop`, plus the `trunk` named in `RELEASING.md` when the repo has one (`branching-model.md` in this directory). Rows marked _(RELEASING.md)_ apply only when `release-state.sh get` reports `present=1`; without the file the helper behaves exactly as it did before the release model.
|
|
12
12
|
|
|
13
|
+
"Plan-only dirty" means every changed, staged or untracked path is a plan artifact for the slug (`docs/plans/<slug>/*`, `docs/orchestration/<slug>*`, `docs/prps/{plans,specs,prds}/<slug>*`), matched from the repository root or from the directory the helper runs in (package-local `scope: local` plans), or a `.gitignore` whose only change, in the working tree, the index or both, appends one `.ycc/artifacts/` rule line.
|
|
14
|
+
|
|
13
15
|
| Current State | Helper Behavior |
|
|
14
16
|
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
15
17
|
| On `feat/<slug>` | Idempotent no-op; echoes branch and exits 0 |
|
|
@@ -76,8 +76,9 @@ Never call the host API to check auth — use the local status commands:
|
|
|
76
76
|
# github
|
|
77
77
|
command -v gh >/dev/null && gh auth status >/dev/null 2>&1 # → authed
|
|
78
78
|
|
|
79
|
-
# forgejo / gitea (tea has no `auth status`; a configured login is the signal)
|
|
80
|
-
|
|
79
|
+
# forgejo / gitea (tea has no `auth status`; a configured login is the signal).
|
|
80
|
+
# Capture, then match: `tea login list | grep -q` SIGPIPEs tea under pipefail.
|
|
81
|
+
command -v tea >/dev/null && ( logins="$(tea login list 2>/dev/null || true)"; grep -q '://' <<<"$logins" )
|
|
81
82
|
|
|
82
83
|
# gitlab
|
|
83
84
|
command -v glab >/dev/null && glab auth status >/dev/null 2>&1
|
|
@@ -9,18 +9,25 @@
|
|
|
9
9
|
- Status field rules
|
|
10
10
|
- Required fields per finding
|
|
11
11
|
|
|
12
|
-
Canonical schema for review artifacts written to `docs/prps/reviews
|
|
12
|
+
Canonical schema for review artifacts, written to `docs/prps/reviews/` (local
|
|
13
|
+
store) or `.ycc/artifacts/<slug>/reviews/` (linear store, the default).
|
|
13
14
|
`/ycc:code-review` writes it (both modes). `/ycc:review-fix`, `/ycc:quick-fix`,
|
|
14
15
|
and `/ycc:quick-review` parse it. Do not deviate — downstream skills parse
|
|
15
16
|
these fields mechanically.
|
|
16
17
|
|
|
17
18
|
## File locations
|
|
18
19
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
| Local | `docs/prps/reviews/local-{YYYYMMDD-HHMMSS}-review.md` |
|
|
22
|
-
| PR | `docs/prps/reviews/pr-{NUMBER}-review.md` |
|
|
23
|
-
| Quick | `docs/prps/reviews/quick-{YYYYMMDD-HHMMSS}-review.md` |
|
|
20
|
+
| Artifact | Local store | Linear store (cache; one Linear Document each) |
|
|
21
|
+
| ------------ | ----------------------------------------------------- | ----------------------------------------------------------------- |
|
|
22
|
+
| Local review | `docs/prps/reviews/local-{YYYYMMDD-HHMMSS}-review.md` | `.ycc/artifacts/<slug>/reviews/local-{YYYYMMDD-HHMMSS}-review.md` |
|
|
23
|
+
| PR review | `docs/prps/reviews/pr-{NUMBER}-review.md` | `.ycc/artifacts/<slug>/reviews/pr-{NUMBER}-review.md` |
|
|
24
|
+
| Quick review | `docs/prps/reviews/quick-{YYYYMMDD-HHMMSS}-review.md` | `.ycc/artifacts/<slug>/reviews/quick-{YYYYMMDD-HHMMSS}-review.md` |
|
|
25
|
+
| Fix report | `docs/prps/reviews/fixes/{review-id}-fixes.md` | `.ycc/artifacts/<slug>/reviews/{review-id}-fixes.md` |
|
|
26
|
+
|
|
27
|
+
Resolve every path with `resolve-artifact-store.sh --kind=review-<id>` or
|
|
28
|
+
`--kind=review-fixes-<id>`; never build it by hand. Mode, slug, Linear
|
|
29
|
+
Document parent, scratch directories, and fix-input lookup: see
|
|
30
|
+
`artifact-store.md` > Review and report skills.
|
|
24
31
|
|
|
25
32
|
## Template
|
|
26
33
|
|
|
@@ -142,7 +142,8 @@ After all 3 foreground reviewer calls return candidate reports and their scratch
|
|
|
142
142
|
1. For any reviewer whose `subagent` return was empty, missing, or malformed,
|
|
143
143
|
treat that reviewer as a failure for that role (do not fabricate findings
|
|
144
144
|
for it). In Path B only, the scratch file at
|
|
145
|
-
|
|
145
|
+
`<review-dir>/.review-scratch/<run-id>/<reviewer-name>.md` (`<review-dir>`
|
|
146
|
+
is the resolved review file's directory; see review-dispatch.md) is the
|
|
146
147
|
calling skill's own copy of the inline returns it already received, not a
|
|
147
148
|
second source to recover from.
|
|
148
149
|
2. Combine by severity (CRITICAL first, then HIGH, MEDIUM, LOW).
|
|
@@ -156,6 +157,6 @@ Pass the merged findings to the REPORT phase as if they came from a single-pass
|
|
|
156
157
|
review.
|
|
157
158
|
|
|
158
159
|
**Cleanup**: after a successful merge, the calling skill should remove the
|
|
159
|
-
|
|
160
|
+
`<review-dir>/.review-scratch/<run-id>/` directory.
|
|
160
161
|
|
|
161
162
|
---
|
|
@@ -18,13 +18,18 @@ from `{{package-root}}/shared/references/review-checklist.md`.
|
|
|
18
18
|
That reference defines the roster, severity rubric, findings-format directive
|
|
19
19
|
and merge procedure. Prompt contract follows below.
|
|
20
20
|
|
|
21
|
-
Run-id and scratch paths per mode
|
|
21
|
+
Run-id and scratch paths per mode. `<review-dir>` is the directory of the
|
|
22
|
+
resolved review file, `$(dirname "$OUT")` (local mode: `docs/prps/reviews`,
|
|
23
|
+
unchanged; linear mode: `.ycc/artifacts/<slug>/reviews`). Quick mode in linear
|
|
24
|
+
mode fans out before the Linear call gate, so its scratch dir is a `mktemp -d`
|
|
25
|
+
directory outside the repository instead. Scratch is never pushed to Linear or
|
|
26
|
+
committed.
|
|
22
27
|
|
|
23
|
-
| Mode | run-id | scratch dir
|
|
24
|
-
| ----- | --------------------------------------------------------------------------------------------------------- |
|
|
25
|
-
| Local | `local-<TIMESTAMP>` (one canonical timestamp per invocation; reused for the Phase 3 review filename) |
|
|
26
|
-
| PR | `pr-<NUMBER>` (PR numbers are unique; no timestamp) |
|
|
27
|
-
| Quick | `quick-<TIMESTAMP>` (reused for the artifact filename if the user later selects an artifact-writing path) |
|
|
28
|
+
| Mode | run-id | scratch dir |
|
|
29
|
+
| ----- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
30
|
+
| Local | `local-<TIMESTAMP>` (one canonical timestamp per invocation; reused for the Phase 3 review filename) | `<review-dir>/.review-scratch/local-<TIMESTAMP>/` |
|
|
31
|
+
| PR | `pr-<NUMBER>` (PR numbers are unique; no timestamp) | `<review-dir>/.review-scratch/pr-<NUMBER>/` |
|
|
32
|
+
| Quick | `quick-<TIMESTAMP>` (reused for the artifact filename if the user later selects an artifact-writing path) | `<review-dir>/.review-scratch/quick-<TIMESTAMP>/` |
|
|
28
33
|
|
|
29
34
|
Each reviewer prompt includes the instruction "flag only gaps that affect correctness or the stated requirements", plus:
|
|
30
35
|
|
|
@@ -48,7 +53,7 @@ Wait for all 3 reviewer results before merging: if results are pending and the r
|
|
|
48
53
|
offers a wait tool, call it until every reviewer job has settled; never finish the run
|
|
49
54
|
while a reviewer is still running. After all 3 native `subagent` calls return, the calling skill
|
|
50
55
|
(not the reviewer) persists each valid inline return to its scratch copy at
|
|
51
|
-
|
|
56
|
+
`<review-dir>/.review-scratch/<run-id>/<reviewer-name>.md`, where
|
|
52
57
|
`<run-id>` is `local-<YYYYMMDD-HHMMSS>` for local mode, `pr-<NUMBER>` for PR
|
|
53
58
|
mode, `quick-<YYYYMMDD-HHMMSS>` for quick mode. An empty, missing, or malformed
|
|
54
59
|
return marks that reviewer failed (merge procedure in review-checklist.md); the
|
|
@@ -62,12 +67,12 @@ parallelization applies only to the review pass.
|
|
|
62
67
|
|
|
63
68
|
## Scratch backstop and cleanup
|
|
64
69
|
|
|
65
|
-
- code-review local mode: remove
|
|
70
|
+
- code-review local mode: remove `<review-dir>/.review-scratch/local-<TIMESTAMP>/`
|
|
66
71
|
once the review artifact has been written successfully (Phase 3).
|
|
67
|
-
- code-review PR mode: remove
|
|
72
|
+
- code-review PR mode: remove `<review-dir>/.review-scratch/pr-<NUMBER>/`
|
|
68
73
|
once the artifact has been written and (when `WORKTREE_ACTIVE=true`)
|
|
69
74
|
committed successfully (Phase 6).
|
|
70
|
-
- quick-review: remove
|
|
75
|
+
- quick-review: remove `<review-dir>/.review-scratch/quick-<TIMESTAMP>/`
|
|
71
76
|
at the end of Phase 5 (HAND-OFF) unconditionally — including on "Discard"
|
|
72
77
|
and "Apply fixes", which never write a permanent artifact. The scratch file
|
|
73
78
|
is the one ephemeral exception to quick-review's artifact-free guarantee.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
- Capability Matrix
|
|
7
7
|
- Native vs install.sh Fallback
|
|
8
8
|
- Notes
|
|
9
|
+
- Artifact store
|
|
9
10
|
- How to Update This Document
|
|
10
11
|
|
|
11
12
|
As of 2026-10-19
|
|
@@ -68,7 +69,7 @@ alone do not make them shipping user install paths. This does not revise the cap
|
|
|
68
69
|
|
|
69
70
|
| target | native, listed today | install.sh fallback today | unlisted or gated native packages |
|
|
70
71
|
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------- |
|
|
71
|
-
| Claude | `ycc@ycc`, `ycc-mcp@ycc`, `ycc-hooks@ycc` (2.1.300+), `ycc-all@ycc`; `status-bar@ycc-mods` | Rules, settings, statusline,
|
|
72
|
+
| Claude | `ycc@ycc`, `ycc-mcp@ycc`, `ycc-hooks@ycc` (2.1.300+), `ycc-all@ycc`; `status-bar@ycc-mods` | Rules, settings, statusline, MCP, standalone skills/agents; hooks via the native `ycc-hooks` plugin at project scope (global hooks link with `--global`) | `ycc-agents@ycc` in v7.0.0 |
|
|
72
73
|
| Cursor | `ycc`, `ycc-rules`, `ycc-mcp`, `ycc-hooks` via the root `.cursor-plugin/marketplace.json` (interactive `/plugins`); hooks `sessionStart` only | Skills, agents, commands, rules, settings under `~/.cursor/`; optional hooks | None |
|
|
73
74
|
| Codex | `ycc@ycc`, `ycc-mcp@ycc` via the root `.agents/plugins/marketplace.json` | Agent TOMLs, `AGENTS.md`, `config.toml` | `ycc-hooks` excluded (YAN-1149) |
|
|
74
75
|
| opencode | None | Skills, agents, commands, shared, `opencode.json`, `AGENTS.md` | `@yandy-r/ycc-opencode` npm plugin: experimental, opt-in, unpublished |
|
|
@@ -140,7 +141,24 @@ via the plugin bundle; there is no Codex analog for slash commands.
|
|
|
140
141
|
**AGENTS:cursor**
|
|
141
142
|
Agents from `ycc/agents/` are adapted into `packages/cursor/ycc/agents/` and copied by
|
|
142
143
|
the installer to `~/.cursor/agents/`. The same generated definitions are packaged in the
|
|
143
|
-
native `ycc` package.
|
|
144
|
+
native `ycc` package. Shell scope is not enforced (YAN-1276): Cursor subagent frontmatter
|
|
145
|
+
documents only `name`, `description`, `model`, `readonly` and `is_background`, so the copied
|
|
146
|
+
`Bash(<prefix>:*)` entries in `tools:` are not a documented grant, and `readonly` cannot
|
|
147
|
+
express "these validation commands only". Cursor's `beforeShellExecution` / `preToolUse` hook
|
|
148
|
+
input carries no subagent name, so a hook cannot apply one agent's prefixes either. The
|
|
149
|
+
restricted fixers (`pr-comment-fixer`, `review-fixer`, `release-fix-applier`) keep their
|
|
150
|
+
allowlist as prompt instructions only. Sources: cursor.com/docs/subagents, cursor.com/docs/hooks.
|
|
151
|
+
|
|
152
|
+
**AGENTS:codex**
|
|
153
|
+
Agents are emitted as custom-agent TOMLs (`name`, `description`, `developer_instructions`)
|
|
154
|
+
and installed under `~/.codex/agents/`. Shell scope is not enforced (YAN-1276): a custom agent
|
|
155
|
+
can only switch off whole capabilities (`features.shell_tool`, `apps`, `plugins`, `memories`,
|
|
156
|
+
`request_permissions_tool`); `sandbox_mode`, `approval_policy` and command rules come from the
|
|
157
|
+
parent session (codex-rs `core/src/agent/role.rs`, rust-v0.164.0). Prefix rules
|
|
158
|
+
(`rules/*.rules`) apply per config layer, never per agent. The restricted fixers need their
|
|
159
|
+
validation commands, so the shell stays on and the allowlist is a prompt instruction only. A
|
|
160
|
+
`PreToolUse` hook input does carry `agent_type`, but ycc ships no Codex hooks (YAN-1149).
|
|
161
|
+
Sources: learn.chatgpt.com/docs/agent-configuration/subagents, `.../rules`, `.../hooks`.
|
|
144
162
|
|
|
145
163
|
**HOOKS.PreToolUse:cursor**
|
|
146
164
|
Cursor does not expose a native PreToolUse hook execution surface equivalent to Claude Code's
|
|
@@ -189,10 +207,18 @@ file so the committed `ycc/settings/settings.json` is not modified, and the `set
|
|
|
189
207
|
later merges repo-managed keys while preserving the CLI-written marketplace entry. It also
|
|
190
208
|
removes legacy `local-ycc-plugins` marketplace and `ycc@local-ycc-plugins` entries from
|
|
191
209
|
`~/.claude.json` and `~/.claude/settings.local.json`, deleting `settings.local.json` if that
|
|
192
|
-
leaves it empty. Other steps: `rules` links `~/.claude/CLAUDE.md
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
210
|
+
leaves it empty. Other steps: `rules` links `~/.claude/CLAUDE.md`; `hooks` (the
|
|
211
|
+
default) enables the native `ycc-hooks@ycc` plugin at project scope, declaring
|
|
212
|
+
the `ycc` marketplace at project scope (repo mode, committed) or local scope
|
|
213
|
+
(local mode) only when no visible declaration supplies it — never repointing an
|
|
214
|
+
existing declaration — while `--global` links `~/.claude/hooks`; `mods`
|
|
215
|
+
registers the `ycc-mods` directory marketplace; and `skills`/`agents`
|
|
216
|
+
install standalone copies into `~/.claude/` (warning about duplicate names if
|
|
217
|
+
`ycc@ycc` is also installed). The `base` step of `remove --target claude`
|
|
218
|
+
uninstalls `ycc@ycc` and the `ycc` marketplace. The `hooks` intent removes
|
|
219
|
+
`ycc-hooks@ycc` at project scope, then removes only installer-written
|
|
220
|
+
marketplace declarations when no other `@ycc` install remains; with
|
|
221
|
+
`--global`, it removes the installer-managed global hooks link.
|
|
196
222
|
|
|
197
223
|
**INSTALL_PATH:cursor**
|
|
198
224
|
Sources under `ycc/` generate `packages/cursor/ycc/{skills,agents,commands}/`,
|
|
@@ -493,6 +519,16 @@ not ported. Source: ADR 0002.
|
|
|
493
519
|
|
|
494
520
|
---
|
|
495
521
|
|
|
522
|
+
## Artifact store
|
|
523
|
+
|
|
524
|
+
Descriptive only; this is not a parsed capability row. The artifact store (`ycc/skills/_shared/references/artifact-store.md`) is skill-level and identical on claude, cursor, codex, opencode and omp: store resolution, the `.ycc/artifacts/` cache and the `.plans-config` pointer are plain files and Bash helpers, so no target needs extra support for `store: local`.
|
|
525
|
+
|
|
526
|
+
- **Linear mode needs a Linear MCP in the running runtime.** ycc ships the `linear` / `linear-personal` servers from `ycc-mcp` where the MCP row is supported (claude, cursor, opencode). On codex and omp the MCP row is `partial`: the servers install, but a user's runtime may lack, shadow or not yet have authorized them (see the MCP:codex and MCP:omp notes), so linear mode can be unavailable there until a Linear MCP is configured by hand.
|
|
527
|
+
- Without a reachable, authorized Linear MCP, skills stop at the Linear call gate before any local write and suggest `store: local`. Local mode never calls Linear.
|
|
528
|
+
- Every generator emits `.ycc/artifacts/` and `.plans-config` paths verbatim; no target rewrites them. `scripts/validate-artifact-store.sh` checks the occurrence counts of each generated skills tree against `ycc/skills` and that a committed `store: linear` pointer is tracked and not ignored.
|
|
529
|
+
|
|
530
|
+
---
|
|
531
|
+
|
|
496
532
|
## How to Update This Document
|
|
497
533
|
|
|
498
534
|
Before changing any cell value, consult the three primary research artifacts that produced the
|
|
@@ -32,7 +32,7 @@ skill behaves exactly as it does today and writes no visual output.
|
|
|
32
32
|
|
|
33
33
|
| Skill | Writes a plan artifact by default? | `--visual` target |
|
|
34
34
|
| ------------------- | ------------------------------------ | ----------------------------------------- |
|
|
35
|
-
| `prp-plan` | yes — `
|
|
35
|
+
| `prp-plan` | yes — resolved `prp-plan` artifact | the written plan file |
|
|
36
36
|
| `parallel-plan` | yes — feature-dir `parallel-plan.md` | the written plan file |
|
|
37
37
|
| `plan-workflow` | yes — feature-dir `parallel-plan.md` | the written plan file |
|
|
38
38
|
| `plan` | **no** — plan kept in-chat | a plan file `--visual` is forced to write |
|
|
@@ -94,20 +94,24 @@ links are produced in a dry run.
|
|
|
94
94
|
When `--visual` runs for real (not `--dry-run`), the planning skill invokes:
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
visual-plan <absolute-plan-path>
|
|
97
|
+
visual-plan ${STORE_FLAG} <absolute-plan-path>
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
passing the **absolute path** of the plan file it wrote and validated.
|
|
100
|
+
passing the **absolute path** of the plan file it wrote and validated, plus the exact `--store=local|linear` override as `STORE_FLAG` when the user supplied one (otherwise empty). Parse and strip the override before deriving descriptions or slugs; never let visual-plan re-resolve a conflicting config because the caller dropped the flag.
|
|
101
101
|
|
|
102
102
|
Contract for `visual-plan`:
|
|
103
103
|
|
|
104
104
|
- **Accept ANY plan path.** It must not assume `docs/prps/plans` or any other
|
|
105
105
|
fixed location. The plan path is supplied by the caller and may live anywhere
|
|
106
|
-
(e.g. `docs/prps/plans/<name>.plan.md`, a feature-dir
|
|
107
|
-
forced-write file from `plan`).
|
|
108
|
-
- **
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
(e.g. a local-mode `docs/prps/plans/<name>.plan.md`, a feature-dir
|
|
107
|
+
`parallel-plan.md`, or a forced-write file from `plan`).
|
|
108
|
+
- **Resolve `visual/` by store.** Local mode keeps the sibling
|
|
109
|
+
`<dirname of plan>/visual/`. Linear mode (default) resolves kind `feature-dir`
|
|
110
|
+
for the source feature slug and writes its `visual/` child, even if the input plan
|
|
111
|
+
lives elsewhere. Follow artifact-store.md **Size and diagrams**: visual
|
|
112
|
+
surfaces are local-only, never uploaded, and never linked by editing the
|
|
113
|
+
source plan.
|
|
114
|
+
- **Forward the store override to every resolver call.** Print `--shell` and read `ARTIFACT_STORE` first; in linear mode apply the Linear call gate before `--ensure` or any cache write.
|
|
111
115
|
- **Print the resulting link to stdout.** Exactly one of:
|
|
112
116
|
- a hosted shareable URL, or
|
|
113
117
|
- a localhost preview `http://127.0.0.1:PORT/...`, or
|
|
@@ -127,11 +131,13 @@ re-derive the path itself.
|
|
|
127
131
|
therefore nothing on disk to visualize. When `--visual` is passed to
|
|
128
132
|
`plan`:
|
|
129
133
|
|
|
130
|
-
1. `plan` **MUST force a plan-file write first
|
|
131
|
-
|
|
134
|
+
1. `plan` **MUST force a plan-file write first** using kind `prp-plan`
|
|
135
|
+
through the artifact-store helper, producing an absolute path on disk.
|
|
136
|
+
Local mode keeps `docs/prps/plans/<slug>.plan.md`; linear mode follows
|
|
137
|
+
artifact-store.md **Planning skills** to Save the plan and task sub-issues.
|
|
132
138
|
2. That forced write is then validated like any other plan.
|
|
133
139
|
3. Only after a valid file exists does `plan` hand the absolute path to
|
|
134
|
-
`visual-plan <absolute-plan-path>`.
|
|
140
|
+
`visual-plan ${STORE_FLAG} <absolute-plan-path>`.
|
|
135
141
|
|
|
136
142
|
Without the forced write there is no input for `visual-plan`, so the
|
|
137
143
|
force-write rule is mandatory — not optional — for `plan --visual`. Under
|
|
@@ -151,5 +157,5 @@ In-body references to skill assets use the plugin-root variable, e.g.:
|
|
|
151
157
|
- `{{package-root}}/skills/plan-workflow/SKILL.md`
|
|
152
158
|
|
|
153
159
|
The hand-off is always expressed as the skill invocation
|
|
154
|
-
`visual-plan <absolute-plan-path>`, with `<absolute-plan-path>` resolved by
|
|
155
|
-
the calling skill to a real, absolute path on disk.
|
|
160
|
+
`visual-plan ${STORE_FLAG} <absolute-plan-path>`, with `<absolute-plan-path>` resolved by
|
|
161
|
+
the calling skill to a real, absolute path on disk and `STORE_FLAG` retaining any user override.
|
|
@@ -61,16 +61,20 @@ honor its annotations when present. When the plan has no annotations, the
|
|
|
61
61
|
fallback is now **on** (was off). `--no-worktree` overrides both the plan
|
|
62
62
|
annotations and the default.
|
|
63
63
|
|
|
64
|
-
**Artifact location for `code-review`** — In PR mode
|
|
65
|
-
|
|
66
|
-
`<worktree>/docs/prps/reviews/pr-<N>-review.md`, then
|
|
67
|
-
the PR's head branch.
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
**Artifact location for `code-review`** — In PR mode, local store mode writes
|
|
65
|
+
the review artifact _into the active worktree_ at
|
|
66
|
+
`<worktree>/docs/prps/reviews/pr-<N>-review.md`, then commits and pushes it to
|
|
67
|
+
the PR's head branch. Linear store mode writes the gitignored cache
|
|
68
|
+
`<worktree>/.ycc/artifacts/<slug>/reviews/pr-<N>-review.md`, saves it as a
|
|
69
|
+
Linear Document, and never commits it. See the `code-review` skill
|
|
70
|
+
(`SKILL.md`) for the full lifecycle (draft→ready promotion, artifact
|
|
71
|
+
commit+push, post-review worktree removal, opt-outs `--keep-draft` and
|
|
72
|
+
`--keep-worktree`).
|
|
70
73
|
|
|
71
74
|
`review-fix` follows: it discovers the artifact in the active worktree's
|
|
72
|
-
`docs/prps/reviews/` first,
|
|
73
|
-
artifacts written under the
|
|
75
|
+
review location (`docs/prps/reviews/` or `.ycc/artifacts/*/reviews/`) first,
|
|
76
|
+
then falls back to the main repo for in-flight artifacts written under the
|
|
77
|
+
previous contract.
|
|
74
78
|
|
|
75
79
|
---
|
|
76
80
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Print an artifact without its complete leading frontmatter block.
|
|
3
|
+
# Frontmatter starts and ends with exact --- lines (ignoring CR). Its first
|
|
4
|
+
# non-blank line must be a top-level YAML key (^[A-Za-z_][A-Za-z0-9_.-]*: then
|
|
5
|
+
# whitespace or end of line); blank-only blocks qualify. Leading # comment lines
|
|
6
|
+
# may precede that key only when the block also has a top-level identity key
|
|
7
|
+
# (linear, syncedAt, contentHash, pending, tasks). Otherwise preserve the whole
|
|
8
|
+
# file, including a leading Markdown thematic break.
|
|
9
|
+
# Source for artifact_body, or execute with one file argument.
|
|
10
|
+
# shellcheck disable=SC2094 # fallbacks re-read the whole file by name
|
|
11
|
+
_artifact_body() {
|
|
12
|
+
local file="$1"
|
|
13
|
+
# Read through a redirect on a brace group instead of exec so the caller's
|
|
14
|
+
# file descriptors stay untouched. After read, a regular file's offset sits
|
|
15
|
+
# just past the consumed line, so cat prints the rest of the body.
|
|
16
|
+
{
|
|
17
|
+
local line first stripped
|
|
18
|
+
# first_content: 0 none yet, 1 key first, 2 key after leading comments.
|
|
19
|
+
local first_content=0 comments=0 identity=0
|
|
20
|
+
local key_pattern='^[A-Za-z_][A-Za-z0-9_.-]*:([[:space:]]|$)' blank_pattern='^[[:space:]]*$'
|
|
21
|
+
local identity_pattern='^(linear|syncedAt|contentHash|pending|tasks):([[:space:]]|$)'
|
|
22
|
+
IFS= read -r first || { command cat -- "$file"; return; }
|
|
23
|
+
first=${first%$'\r'}
|
|
24
|
+
if [[ "$first" != '---' ]]; then
|
|
25
|
+
command cat -- "$file"
|
|
26
|
+
return
|
|
27
|
+
fi
|
|
28
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
29
|
+
stripped=${line%$'\r'}
|
|
30
|
+
if [[ "$stripped" == '---' ]]; then
|
|
31
|
+
if [[ "$first_content" == 2 && "$identity" == 0 ]] ||
|
|
32
|
+
[[ "$first_content" == 0 && "$comments" == 1 ]]; then
|
|
33
|
+
command cat -- "$file"
|
|
34
|
+
return
|
|
35
|
+
fi
|
|
36
|
+
command cat
|
|
37
|
+
return 0
|
|
38
|
+
fi
|
|
39
|
+
[[ "$stripped" =~ $blank_pattern ]] && continue
|
|
40
|
+
if [[ "$first_content" == 0 ]]; then
|
|
41
|
+
if [[ "$stripped" == '#'* ]]; then
|
|
42
|
+
comments=1
|
|
43
|
+
continue
|
|
44
|
+
fi
|
|
45
|
+
if [[ ! "$stripped" =~ $key_pattern ]]; then
|
|
46
|
+
command cat -- "$file"
|
|
47
|
+
return
|
|
48
|
+
fi
|
|
49
|
+
first_content=$((comments + 1))
|
|
50
|
+
fi
|
|
51
|
+
if [[ "$first_content" == 2 && "$stripped" =~ $identity_pattern ]]; then identity=1; fi
|
|
52
|
+
done
|
|
53
|
+
command cat -- "$file"
|
|
54
|
+
} <"$file"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
artifact_body() {
|
|
58
|
+
if [[ $# -ne 1 || -z "$1" || ! -f "$1" ]]; then
|
|
59
|
+
printf 'ERROR: artifact_body expects one readable file\n' >&2
|
|
60
|
+
return 1
|
|
61
|
+
fi
|
|
62
|
+
if [[ ! -r "$1" ]]; then
|
|
63
|
+
printf 'ERROR: Artifact body is not readable: %s\n' "$1" >&2
|
|
64
|
+
return 1
|
|
65
|
+
fi
|
|
66
|
+
_artifact_body "$1"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
|
70
|
+
artifact_body "$@"
|
|
71
|
+
fi
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Write and optionally commit the portable repository artifact-store pointer.
|
|
3
|
+
# workspace/label/project are read indirectly via ${!name} in the validation and merge loops.
|
|
4
|
+
# shellcheck disable=SC2034
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd -P)"
|
|
7
|
+
usage() {
|
|
8
|
+
printf '%s\n' 'Usage: artifact-store-pointer.sh --store=linear|local [--linear-workspace=<slug>] [--linear-team=<KEY>] [--linear-label=<label> | --linear-project=<id-or-slug>] [--dry-run] [--no-commit] [--force] [<dir>]'
|
|
9
|
+
}
|
|
10
|
+
die() { printf 'ERROR: %s\n' "$2" >&2; exit "$1"; }
|
|
11
|
+
store='' workspace='' team='' label='' project='' dir=''
|
|
12
|
+
workspace_set=0 team_set=0 label_set=0 project_set=0 dry_run=0 no_commit=0 force=0
|
|
13
|
+
while [[ $# -gt 0 ]]; do
|
|
14
|
+
case "$1" in
|
|
15
|
+
--help|-h) usage; exit 0 ;;
|
|
16
|
+
--store=*) store=${1#*=} ;;
|
|
17
|
+
--linear-workspace=*) workspace=${1#*=}; workspace_set=1 ;;
|
|
18
|
+
--linear-team=*) team=${1#*=}; team_set=1 ;;
|
|
19
|
+
--linear-label=*) label=${1#*=}; label_set=1 ;;
|
|
20
|
+
--linear-project=*) project=${1#*=}; project_set=1 ;;
|
|
21
|
+
--dry-run) dry_run=1 ;;
|
|
22
|
+
--no-commit) no_commit=1 ;;
|
|
23
|
+
--force) force=1 ;;
|
|
24
|
+
-*) die 2 "Unknown option: $1" ;;
|
|
25
|
+
*) [[ -z "$dir" && -n "$1" ]] || die 2 'Expected one directory'; dir=$1 ;;
|
|
26
|
+
esac
|
|
27
|
+
shift
|
|
28
|
+
done
|
|
29
|
+
[[ "$store" == linear || "$store" == local ]] || die 2 '--store must be linear or local'
|
|
30
|
+
value_pattern='^[A-Za-z0-9][A-Za-z0-9._:/@+-]*$'
|
|
31
|
+
for name in workspace label project; do
|
|
32
|
+
set_name="${name}_set"
|
|
33
|
+
if [[ "${!set_name}" == 1 ]]; then
|
|
34
|
+
[[ "${!name}" =~ $value_pattern ]] || die 2 "Invalid --linear-${name} value"
|
|
35
|
+
fi
|
|
36
|
+
done
|
|
37
|
+
if [[ "$team_set" == 1 ]]; then
|
|
38
|
+
[[ "$team" =~ ^[A-Z][A-Z0-9]{0,9}$ ]] || die 2 'Invalid --linear-team value'
|
|
39
|
+
fi
|
|
40
|
+
[[ "$label_set$project_set" != 11 ]] || die 2 '--linear-label and --linear-project are mutually exclusive'
|
|
41
|
+
if [[ "$store" == linear ]]; then
|
|
42
|
+
[[ "$workspace_set$team_set" == 11 && "$label_set$project_set" != 00 ]] || die 2 'Linear store requires --linear-workspace, --linear-team, and --linear-label or --linear-project'
|
|
43
|
+
fi
|
|
44
|
+
dir=${dir:-.}
|
|
45
|
+
[[ "$(git -C "$dir" rev-parse --is-inside-work-tree 2>/dev/null || :)" == true ]] || die 2 'Artifact-store pointer requires a Git work tree'
|
|
46
|
+
root=$(git -C "$dir" rev-parse --show-toplevel)
|
|
47
|
+
root=$(CDPATH='' cd -- "$root" >/dev/null && pwd -P)
|
|
48
|
+
pointer="${root}/.plans-config"
|
|
49
|
+
for path in .plans-config .gitignore .ycc; do
|
|
50
|
+
[[ ! -L "${root}/${path}" ]] || die 2 "Refusing symlinked ${path}"
|
|
51
|
+
done
|
|
52
|
+
[[ ! -e "$pointer" || -f "$pointer" ]] || die 2 '.plans-config must be a regular file'
|
|
53
|
+
[[ ! -e "${root}/.gitignore" || -f "${root}/.gitignore" ]] || die 2 '.gitignore must be a regular file'
|
|
54
|
+
if [[ -f "$pointer" ]] && grep -q $'\r' "$pointer"; then
|
|
55
|
+
die 2 'CRLF .plans-config; convert .plans-config to LF line endings and retry'
|
|
56
|
+
fi
|
|
57
|
+
# Source in the target repository so auto-resolution never consults the caller.
|
|
58
|
+
start_pwd=$PWD
|
|
59
|
+
CDPATH='' cd -- "$root"
|
|
60
|
+
# shellcheck source=resolve-artifact-store.sh
|
|
61
|
+
source "${SCRIPT_DIR}/resolve-artifact-store.sh"
|
|
62
|
+
CDPATH='' cd -- "$start_pwd"
|
|
63
|
+
set -euo pipefail
|
|
64
|
+
keys=(store) values=("$store") seen=(0) old_values=()
|
|
65
|
+
for name in workspace team label project; do
|
|
66
|
+
set_name="${name}_set"
|
|
67
|
+
if [[ "${!set_name}" == 1 ]]; then
|
|
68
|
+
keys+=("linear_${name}"); values+=("${!name}"); seen+=(0)
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
for ((i=0; i<${#keys[@]}; i++)); do
|
|
72
|
+
if old=$(_artifact_config_value "${keys[i]}" "$pointer"); then
|
|
73
|
+
[[ "$old" == "${values[i]}" || "$force" == 1 ]] || die 3 "Conflicting ${keys[i]}: ${old} -> ${values[i]} (use --force)"
|
|
74
|
+
old_values+=("$old")
|
|
75
|
+
else
|
|
76
|
+
old_values+=('')
|
|
77
|
+
fi
|
|
78
|
+
done
|
|
79
|
+
# A label <-> project mapping switch must be explicit: the other key's existing
|
|
80
|
+
# line conflicts, and --force removes it instead of leaving both mappings.
|
|
81
|
+
remove_keys=()
|
|
82
|
+
other_key=''
|
|
83
|
+
if [[ "$label_set$project_set" == 10 ]]; then
|
|
84
|
+
other_key=linear_project
|
|
85
|
+
elif [[ "$label_set$project_set" == 01 ]]; then
|
|
86
|
+
other_key=linear_label
|
|
87
|
+
fi
|
|
88
|
+
if [[ -n "$other_key" && -f "$pointer" ]]; then
|
|
89
|
+
if old=$(_artifact_config_value "$other_key" "$pointer"); then
|
|
90
|
+
if [[ "$force" == 1 ]]; then
|
|
91
|
+
remove_keys=("$other_key")
|
|
92
|
+
elif [[ "$other_key" == linear_project ]]; then
|
|
93
|
+
die 3 'Conflicting linear_project mapping; use --force to switch to --linear-label'
|
|
94
|
+
else
|
|
95
|
+
die 3 'Conflicting linear_label mapping; use --force to switch to --linear-project'
|
|
96
|
+
fi
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
# Creating a root pointer would make nested, non-local configs inherit its
|
|
100
|
+
# plans_dir. Refuse before changing that resolution unless explicitly forced.
|
|
101
|
+
if [[ ! -e "$pointer" && "$force" == 0 ]]; then
|
|
102
|
+
nested_configs=()
|
|
103
|
+
while IFS= read -r -d '' nested_config; do
|
|
104
|
+
scope=$(_artifact_config_value scope "${root}/${nested_config}") || scope=''
|
|
105
|
+
[[ "$scope" == local ]] || nested_configs+=("$nested_config")
|
|
106
|
+
done < <({
|
|
107
|
+
git -C "$root" ls-files -z --cached -- '*/.plans-config'
|
|
108
|
+
git -C "$root" ls-files -z --others --exclude-standard -- '*/.plans-config'
|
|
109
|
+
} | sort -zu)
|
|
110
|
+
if [[ ${#nested_configs[@]} -gt 0 ]]; then
|
|
111
|
+
printf 'ERROR: Creating a root .plans-config would change plan resolution for nested configs without scope: local:\n' >&2
|
|
112
|
+
printf ' %s\n' "${nested_configs[@]}" >&2
|
|
113
|
+
die 3 'Add scope: local to those configs or rerun with --force.'
|
|
114
|
+
fi
|
|
115
|
+
fi
|
|
116
|
+
# Every refusal runs before any write, for both stores.
|
|
117
|
+
if git -C "$root" check-ignore -q --no-index -- .plans-config; then
|
|
118
|
+
die 4 '.plans-config is ignored; a committed artifact-store pointer cannot be ignored. Remove the ignore rule and retry.'
|
|
119
|
+
fi
|
|
120
|
+
ignore=skipped
|
|
121
|
+
# Dry-run checks coverage without invoking the resolver's write entry point.
|
|
122
|
+
# The actual write always uses the canonical helper, including wider repo rules.
|
|
123
|
+
if [[ "$store" == linear ]]; then
|
|
124
|
+
export ARTIFACT_STORE=linear ARTIFACT_ROOT="$root" ARTIFACT_DIR="${root}/.ycc/artifacts"
|
|
125
|
+
_artifact_require_git_root || die 2 'Cannot ensure repository artifact-cache ignore rule'
|
|
126
|
+
if [[ -e "${root}/.gitignore" ]]; then
|
|
127
|
+
[[ -w "${root}/.gitignore" ]] || die 2 '.gitignore is not writable'
|
|
128
|
+
else
|
|
129
|
+
[[ -w "$root" ]] || die 2 'Repository root is not writable; cannot create .gitignore'
|
|
130
|
+
fi
|
|
131
|
+
coverage=0
|
|
132
|
+
_artifact_gitignore_present || coverage=$?
|
|
133
|
+
case "$coverage" in
|
|
134
|
+
0) ignore=present ;;
|
|
135
|
+
1) ignore=added ;;
|
|
136
|
+
2) die 2 'A negated (!) ignore rule re-includes .ycc/artifacts/ paths; refusing to override it' ;;
|
|
137
|
+
3) die 2 'Cannot check .ycc/artifacts/ ignore coverage (git check-ignore, .gitignore scan, or TMPDIR scratch failed)' ;;
|
|
138
|
+
*) die 2 'Cannot ensure repository artifact-cache ignore rule' ;;
|
|
139
|
+
esac
|
|
140
|
+
fi
|
|
141
|
+
# Pre-existing uncommitted .plans-config edits (unstaged or staged-only) keep
|
|
142
|
+
# the user's commit boundary: the pointer is written but never committed.
|
|
143
|
+
pointer_dirty=0
|
|
144
|
+
if [[ -f "$pointer" ]]; then
|
|
145
|
+
if git -C "$root" rev-parse -q --verify HEAD >/dev/null 2>&1; then
|
|
146
|
+
if ! git -C "$root" diff --quiet HEAD -- .plans-config || ! git -C "$root" diff --cached --quiet -- .plans-config; then
|
|
147
|
+
pointer_dirty=1
|
|
148
|
+
fi
|
|
149
|
+
fi
|
|
150
|
+
if [[ "$pointer_dirty" == 0 ]] && ! git --literal-pathspecs -C "$root" ls-files --error-unmatch -- .plans-config >/dev/null 2>&1; then
|
|
151
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
152
|
+
[[ "$line" =~ ^[[:space:]]*(#|$) ]] && continue
|
|
153
|
+
[[ "$line" =~ ^(store|linear_[A-Za-z0-9_]*)[[:space:]]*[:=] ]] || pointer_dirty=1
|
|
154
|
+
done <"$pointer"
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
planned=''
|
|
158
|
+
if [[ -f "$pointer" ]]; then
|
|
159
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
160
|
+
drop=0
|
|
161
|
+
if [[ ${#remove_keys[@]} -gt 0 ]]; then
|
|
162
|
+
for remove_key in "${remove_keys[@]}"; do
|
|
163
|
+
if [[ "$line" =~ ^${remove_key}[[:space:]]*[:=] ]]; then drop=1; fi
|
|
164
|
+
done
|
|
165
|
+
fi
|
|
166
|
+
if [[ "$drop" == 0 ]]; then
|
|
167
|
+
for ((i=0; i<${#keys[@]}; i++)); do
|
|
168
|
+
if [[ "$line" =~ ^${keys[i]}[[:space:]]*[:=] ]]; then
|
|
169
|
+
seen[i]=1
|
|
170
|
+
old=${old_values[i]}
|
|
171
|
+
if [[ "$old" != "${values[i]}" ]]; then
|
|
172
|
+
comment=''
|
|
173
|
+
comment_pattern='([[:space:]]*#.*)$'
|
|
174
|
+
if [[ "$line" =~ $comment_pattern ]]; then comment=${BASH_REMATCH[1]}; fi
|
|
175
|
+
line="${keys[i]}: ${values[i]}${comment}"
|
|
176
|
+
fi
|
|
177
|
+
break
|
|
178
|
+
fi
|
|
179
|
+
done
|
|
180
|
+
planned+="${line}"$'\n'
|
|
181
|
+
fi
|
|
182
|
+
done <"$pointer"
|
|
183
|
+
fi
|
|
184
|
+
for ((i=0; i<${#keys[@]}; i++)); do
|
|
185
|
+
if [[ "${seen[i]}" == 0 ]]; then planned+="${keys[i]}: ${values[i]}"$'\n'; fi
|
|
186
|
+
done
|
|
187
|
+
change=created
|
|
188
|
+
if [[ -f "$pointer" ]]; then
|
|
189
|
+
change=updated
|
|
190
|
+
same=1
|
|
191
|
+
for ((i=0; i<${#keys[@]}; i++)); do
|
|
192
|
+
[[ "${seen[i]}" == 1 && "${old_values[i]}" == "${values[i]}" ]] || same=0
|
|
193
|
+
done
|
|
194
|
+
if [[ "$same" == 1 && ${#remove_keys[@]} -eq 0 ]]; then change=unchanged; fi
|
|
195
|
+
fi
|
|
196
|
+
commit=none
|
|
197
|
+
if [[ "$dry_run" == 1 ]]; then
|
|
198
|
+
printf '%s\n' '--- .plans-config (planned) ---'
|
|
199
|
+
printf '%s' "$planned"
|
|
200
|
+
printf '%s\n' '--- end ---' "Plan: ${change} .plans-config; gitignore=${ignore}; commit only eligible pointer paths."
|
|
201
|
+
commit=skipped
|
|
202
|
+
else
|
|
203
|
+
if [[ "$store" == linear ]]; then
|
|
204
|
+
before_ignore=$(if [[ -f "${root}/.gitignore" ]]; then cat "${root}/.gitignore"; fi; printf '\001')
|
|
205
|
+
ensure_artifact_gitignore || die 2 'Cannot ensure repository artifact-cache ignore rule'
|
|
206
|
+
after_ignore=$(cat "${root}/.gitignore" 2>/dev/null || :; printf '\001')
|
|
207
|
+
if [[ "$before_ignore" != "$after_ignore" ]]; then ignore=added; else ignore=present; fi
|
|
208
|
+
fi
|
|
209
|
+
if [[ "$change" != unchanged ]]; then printf '%s' "$planned" >"$pointer"; fi
|
|
210
|
+
paths=()
|
|
211
|
+
if ! git -C "$root" ls-files --error-unmatch -- .plans-config >/dev/null 2>&1 || ! git -C "$root" diff --quiet HEAD -- .plans-config; then paths+=(.plans-config); fi
|
|
212
|
+
if [[ "$store" == linear && -f "${root}/.gitignore" ]]; then
|
|
213
|
+
base=$(git -C "$root" show HEAD:.gitignore 2>/dev/null && printf '\001') || base=$'\001'
|
|
214
|
+
base=${base%$'\001'}
|
|
215
|
+
expected=$base
|
|
216
|
+
if [[ -n "$expected" && "$expected" != *$'\n' ]]; then expected+=$'\n'; fi
|
|
217
|
+
expected+=$'.ycc/artifacts/\n'
|
|
218
|
+
if ! git -C "$root" ls-files --error-unmatch -- .gitignore >/dev/null 2>&1 || ! git -C "$root" diff --quiet HEAD -- .gitignore; then
|
|
219
|
+
if cmp -s "${root}/.gitignore" <(printf '%s' "$expected"); then
|
|
220
|
+
paths+=(.gitignore)
|
|
221
|
+
else
|
|
222
|
+
printf 'WARNING: .gitignore has unrelated changes; committing only .plans-config.\n' >&2
|
|
223
|
+
fi
|
|
224
|
+
fi
|
|
225
|
+
fi
|
|
226
|
+
if [[ "$no_commit" == 1 ]]; then
|
|
227
|
+
commit=skipped
|
|
228
|
+
elif [[ "$pointer_dirty" == 1 ]]; then
|
|
229
|
+
printf 'WARNING: .plans-config has pre-existing uncommitted changes; leaving the pointer commit to you (commit=skipped).\n' >&2
|
|
230
|
+
commit=skipped
|
|
231
|
+
elif [[ ${#paths[@]} -gt 0 ]]; then
|
|
232
|
+
if ! git -C "$root" add -- "${paths[@]}" || ! git -C "$root" commit -m "chore(ycc): configure ${store/linear/Linear} artifact store" -- "${paths[@]}"; then
|
|
233
|
+
if git -C "$root" rev-parse -q --verify HEAD >/dev/null 2>&1; then
|
|
234
|
+
git -C "$root" reset -q -- "${paths[@]}" || :
|
|
235
|
+
else
|
|
236
|
+
git -C "$root" rm --cached -q --ignore-unmatch -- "${paths[@]}" || :
|
|
237
|
+
fi
|
|
238
|
+
die 5 'Artifact-store pointer commit failed; files remain written and staged pointer paths were unstaged (Git error above).'
|
|
239
|
+
fi
|
|
240
|
+
commit=$(git -C "$root" rev-parse --short HEAD)
|
|
241
|
+
elif [[ "$store" == local ]]; then
|
|
242
|
+
commit=skipped
|
|
243
|
+
fi
|
|
244
|
+
fi
|
|
245
|
+
printf 'pointer=%s\npointer_change=%s\ngitignore=%s\ncommit=%s\n' "$pointer" "$change" "$ignore" "$commit"
|