phasegate 0.160.19 → 0.160.21
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/CHANGELOG.md +4 -0
- package/README.md +4 -4
- package/docs/guide/installation.md +5 -5
- package/docs/guide/setup-artifacts.md +3 -2
- package/docs/templates/personal/hooks/pre-commit +16 -0
- package/package.json +1 -1
- package/scripts/harness/config-foundation/application/mappers/validator-system-config-mapper.ts +19 -2
- package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v3.schema.json +1 -3
- package/scripts/harness/installation/application/bundled-skill-selection.ts +46 -0
- package/scripts/harness/installation/application/checks/check-utils.ts +11 -0
- package/scripts/harness/installation/application/checks/claude-skills-symlink-check.ts +5 -3
- package/scripts/harness/installation/application/checks/codex-skills-symlink-check.ts +5 -3
- package/scripts/harness/installation/application/usecases/run-install.ts +65 -26
- package/scripts/harness/installation/application/usecases/run-reconcile.ts +97 -10
- package/scripts/harness/installation/application/usecases/run-uninstall.ts +36 -5
- package/scripts/harness/main.ts +40 -18
- package/scripts/harness/validator-system/application/dto/validation-result-contract.ts +1 -0
- package/scripts/harness/validator-system/application/mappers/validation-result-contract-mapper.ts +1 -0
- package/scripts/harness/validator-system/application/use-cases/run-l4-validators-usecase.ts +32 -3
- package/scripts/harness/validator-system/composition-root.ts +15 -1
- package/scripts/harness/validator-system/domain/services/l4/consistency-check-service.ts +78 -1
- package/scripts/harness/validator-system/domain/value-objects/validation-result.ts +7 -0
- package/scripts/harness/validator-system/infrastructure/adapters/file-system-work-item-reflection-adapter.ts +102 -0
- package/scripts/harness/validator-system/presentation/formatters/agent-validation-result-formatter.ts +3 -0
- package/scripts/harness/validator-system/presentation/formatters/human-validation-result-formatter.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **WI-217 — personal inception/product consistency** — makes L4-002 validate configured personal documentation roots, scopes L4-004 freshness to `paths.designDocs`, adds personal hook L4 backstop behavior for `.phasegate-local` docs, and lets `scaffold-wi` use custom IDs and personal inception roots.
|
|
13
|
+
|
|
10
14
|
## [0.160.16] - 2026-05-22
|
|
11
15
|
|
|
12
16
|
### Fixed
|
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ npx phasegate install --apply
|
|
|
100
100
|
npx phasegate doctor
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
`install` merges PhaseGate into the current project without discarding existing Claude/Codex hooks or
|
|
103
|
+
`install` merges PhaseGate into the current project without discarding existing Claude/Codex hooks, Husky scripts, or user-owned skills. It reports planned changes before writing, adds package scripts and the `phasegate` devDependency, deploys selected bundled skills to root `skills/`, creates agent skill links to that shared directory, writes `AGENTS.md` / `CLAUDE.md` PhaseGate managed sections for the selected agent targets, writes the CI workflow when missing, and records managed files in `.phasegate/manifest.json`. If an existing file needs a forced managed update, run `npx phasegate install --apply --force`; PhaseGate backs up replaced files under `.phasegate/backups/`. <!-- @work-item-id WI-174 --> <!-- @work-item-id WI-210 --> <!-- @work-item-id WI-216 -->
|
|
104
104
|
|
|
105
105
|
For personal evaluation inside a team-owned repository, use local-only install:
|
|
106
106
|
|
|
@@ -109,7 +109,7 @@ npx phasegate install --personal --agent claude --dry-run
|
|
|
109
109
|
npx phasegate install --personal --agent claude --apply
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
`--personal` does not plan or write `package.json`, `CLAUDE.md`, `.husky/*`, `.github/workflows/*`, `.gitignore`, GitHub CLI config, repo secrets, or CI settings. It creates `.phasegate-local/phasegate.config.json`, runtime-visible local agent context (`.claude/CLAUDE.md` for Claude, and `AGENTS.md` for Codex only when that root file is absent or already PhaseGate-managed), real local-only agent runtime artifacts for the selected agent (`.claude/settings.json` + `.claude/skills/` and/or `.codex/hooks.json` + `.codex/skills/`), local git hooks under `.git/hooks/`, local reference docs under `.phasegate-local/docs/`, a managed local-only block in `.git/info/exclude`, and `.phasegate/manifest.json`. If a team `AGENTS.md` already exists, personal Codex install leaves it unchanged and `doctor --personal --agent codex` reports the remaining context step instead of hiding it behind `AGENTS.override.md`. Codex user-level hook feature enablement remains a manual action. <!-- @work-item-id WI-207 --> <!-- @work-item-id WI-208 --> <!-- @work-item-id WI-209 --> <!-- @work-item-id WI-213 --> <!-- @work-item-id WI-215 -->
|
|
112
|
+
`--personal` does not plan or write `package.json`, `CLAUDE.md`, `.husky/*`, `.github/workflows/*`, `.gitignore`, GitHub CLI config, repo secrets, or CI settings. It creates `.phasegate-local/phasegate.config.json`, runtime-visible local agent context (`.claude/CLAUDE.md` for Claude, and `AGENTS.md` for Codex only when that root file is absent or already PhaseGate-managed), real local-only agent runtime artifacts for the selected agent (`.claude/settings.json` + `.claude/skills/` and/or `.codex/hooks.json` + `.codex/skills/`), local git hooks under `.git/hooks/`, local reference docs under `.phasegate-local/docs/`, a managed local-only block in `.git/info/exclude`, and `.phasegate/manifest.json`. Existing personal skills directories are merged: PhaseGate refreshes bundled skills and preserves user-owned skills. If a team `AGENTS.md` already exists, personal Codex install leaves it unchanged and `doctor --personal --agent codex` reports the remaining context step instead of hiding it behind `AGENTS.override.md`. Codex user-level hook feature enablement remains a manual action. <!-- @work-item-id WI-207 --> <!-- @work-item-id WI-208 --> <!-- @work-item-id WI-209 --> <!-- @work-item-id WI-213 --> <!-- @work-item-id WI-215 --> <!-- @work-item-id WI-216 -->
|
|
113
113
|
|
|
114
114
|
For agent-driven setup planning, use:
|
|
115
115
|
|
|
@@ -129,7 +129,7 @@ npx phasegate uninstall --dry-run
|
|
|
129
129
|
npx phasegate uninstall --apply
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
`uninstall` uses the manifest to delete created files
|
|
132
|
+
`uninstall` uses the manifest to delete created files, remove only PhaseGate-managed portions from merged Claude/Codex, Husky, and `package.json` files, and remove only PhaseGate-managed bundled skills. User content and user-owned skills are preserved, and the manifest is archived under `.phasegate/`. <!-- @work-item-id WI-216 -->
|
|
133
133
|
|
|
134
134
|
When you upgrade PhaseGate, reconcile existing managed files with the current bundled templates:
|
|
135
135
|
|
|
@@ -138,7 +138,7 @@ npx phasegate reconcile --dry-run
|
|
|
138
138
|
npx phasegate reconcile --apply
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
`reconcile` updates only PhaseGate-managed portions, keeps user content, adds newly introduced managed targets, repairs missing shared
|
|
141
|
+
`reconcile` updates only PhaseGate-managed portions, keeps user content, adds newly introduced managed targets, repairs missing shared or personal bundled skill bodies, and refreshes `.phasegate/manifest.json` with the current version and hashes. If a managed file was edited after install, `reconcile --apply` refuses that entry until you rerun with `--force`; PhaseGate writes a backup under `.phasegate/backups/reconcile-<timestamp>/`. <!-- @work-item-id WI-210 --> <!-- @work-item-id WI-216 -->
|
|
142
142
|
|
|
143
143
|
### Codex CLI
|
|
144
144
|
|
|
@@ -56,7 +56,7 @@ npx phasegate install --apply
|
|
|
56
56
|
npx phasegate doctor
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
`install --dry-run` reports whether each target will be created, merged, skipped, or refused. `install --apply` performs the merge, adds package scripts and the `phasegate` devDependency, creates `.claude/skills` and `.codex/skills` links, writes `CLAUDE.md` / `AGENTS.md` managed sections for selected agent targets, writes `.github/workflows/phasegate-aidlc-gate.yml` when CI is enabled, and records managed entries in `.phasegate/manifest.json`. See [Setup Artifacts](setup-artifacts.md) for the full managed target, generated artifact, runtime state, legacy artifact, and user-level setting inventory. <!-- @work-item-id WI-152 --> <!-- @work-item-id WI-169 --> <!-- @work-item-id WI-174 -->
|
|
59
|
+
`install --dry-run` reports whether each target will be created, merged, skipped, or refused. `install --apply` performs the merge, adds package scripts and the `phasegate` devDependency, deploys selected bundled skills to root `skills/`, creates `.claude/skills` and `.codex/skills` links, writes `CLAUDE.md` / `AGENTS.md` managed sections for selected agent targets, writes `.github/workflows/phasegate-aidlc-gate.yml` when CI is enabled, and records managed entries in `.phasegate/manifest.json`. Existing skills catalogs are merged: PhaseGate refreshes only bundled skill directories selected by `--skills core|all` and preserves user-owned skills. See [Setup Artifacts](setup-artifacts.md) for the full managed target, generated artifact, runtime state, legacy artifact, and user-level setting inventory. <!-- @work-item-id WI-152 --> <!-- @work-item-id WI-169 --> <!-- @work-item-id WI-174 --> <!-- @work-item-id WI-216 -->
|
|
60
60
|
|
|
61
61
|
For personal evaluation inside a team-owned repository:
|
|
62
62
|
|
|
@@ -65,7 +65,7 @@ npx phasegate install --personal --agent claude --dry-run
|
|
|
65
65
|
npx phasegate install --personal --agent claude --apply
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Personal install keeps team-owned files out of the apply path: `package.json`, `CLAUDE.md`, `.husky/*`, `.github/workflows/*`, `.gitignore`, GitHub CLI config, repo secrets, and CI settings are not touched. PhaseGate writes `.phasegate-local/phasegate.config.json`, creates runtime-visible local agent context (`.claude/CLAUDE.md` for Claude, and `AGENTS.md` for Codex only when that root file is absent or already PhaseGate-managed), creates real local-only agent runtime artifacts for the selected agent (`.claude/settings.json` + `.claude/skills/` and/or `.codex/hooks.json` + `.codex/skills/`), deploys local git hooks under `.git/hooks/`, copies reference docs under `.phasegate-local/docs/`, records `.phasegate/manifest.json`, and manages a local exclude block in `.git/info/exclude`. If a team `AGENTS.md` already exists, personal Codex install leaves it unchanged and `doctor --personal --agent codex` reports the remaining context step instead of hiding it behind `AGENTS.override.md`. Codex user-level hook feature enablement is still reported as a manual action. <!-- @work-item-id WI-207 --> <!-- @work-item-id WI-208 --> <!-- @work-item-id WI-209 --> <!-- @work-item-id WI-213 --> <!-- @work-item-id WI-215 -->
|
|
68
|
+
Personal install keeps team-owned files out of the apply path: `package.json`, `CLAUDE.md`, `.husky/*`, `.github/workflows/*`, `.gitignore`, GitHub CLI config, repo secrets, and CI settings are not touched. PhaseGate writes `.phasegate-local/phasegate.config.json`, creates runtime-visible local agent context (`.claude/CLAUDE.md` for Claude, and `AGENTS.md` for Codex only when that root file is absent or already PhaseGate-managed), creates real local-only agent runtime artifacts for the selected agent (`.claude/settings.json` + `.claude/skills/` and/or `.codex/hooks.json` + `.codex/skills/`), deploys local git hooks under `.git/hooks/`, copies reference docs under `.phasegate-local/docs/`, records `.phasegate/manifest.json`, and manages a local exclude block in `.git/info/exclude`. Existing personal skills directories are merged the same way as project `skills/`: bundled PhaseGate skills are added or refreshed, user-owned skills are preserved, and legacy `.harness-version` catalogs can be adopted into the manifest. If a team `AGENTS.md` already exists, personal Codex install leaves it unchanged and `doctor --personal --agent codex` reports the remaining context step instead of hiding it behind `AGENTS.override.md`. Codex user-level hook feature enablement is still reported as a manual action. <!-- @work-item-id WI-207 --> <!-- @work-item-id WI-208 --> <!-- @work-item-id WI-209 --> <!-- @work-item-id WI-213 --> <!-- @work-item-id WI-215 --> <!-- @work-item-id WI-216 -->
|
|
69
69
|
|
|
70
70
|
If an existing repository keeps design or governance docs outside `docs/`, set `paths.designDocs`, `paths.inceptionDocs`, `paths.principlesDocs`, and `paths.folderRulesDoc` in `phasegate.config.json` before setup/reconcile. PhaseGate deploy and hook protection use those mappings instead of forcing the default `docs/` layout. <!-- @work-item-id WI-214 -->
|
|
71
71
|
|
|
@@ -93,7 +93,7 @@ npx phasegate uninstall --dry-run
|
|
|
93
93
|
npx phasegate uninstall --apply
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
`uninstall` reads `.phasegate/manifest.json`, deletes files that PhaseGate created, removes only PhaseGate-managed portions from merged JSON, markdown agent context files, Husky, and `package.json` files, and archives the manifest as `.phasegate/uninstalled-<timestamp>.json`. If a managed file was modified after install, `uninstall --apply` refuses that entry until you rerun with `--force`, which creates a backup under `.phasegate/backups/uninstall-<timestamp>/`. <!-- @work-item-id WI-174 -->
|
|
96
|
+
`uninstall` reads `.phasegate/manifest.json`, deletes files that PhaseGate created, removes only PhaseGate-managed portions from merged JSON, markdown agent context files, Husky, and `package.json` files, removes manifest-managed bundled skills, and archives the manifest as `.phasegate/uninstalled-<timestamp>.json`. User-owned skill directories remain in place, and skills parent directories are kept when they still contain user-owned skills. If a managed file was modified after install, `uninstall --apply` refuses that entry until you rerun with `--force`, which creates a backup under `.phasegate/backups/uninstall-<timestamp>/`. <!-- @work-item-id WI-174 --> <!-- @work-item-id WI-216 -->
|
|
97
97
|
|
|
98
98
|
After upgrading PhaseGate, reconcile existing managed files with the bundled templates from the new version:
|
|
99
99
|
|
|
@@ -102,7 +102,7 @@ npx phasegate reconcile --dry-run
|
|
|
102
102
|
npx phasegate reconcile --apply
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
`reconcile` updates PhaseGate-managed portions, preserves user content, adds newly introduced managed targets, and refreshes `.phasegate/manifest.json` with current version/hash metadata. If a managed file was edited after install, `reconcile --apply` refuses that entry until you rerun with `--force`, which creates a backup under `.phasegate/backups/reconcile-<timestamp>/`.
|
|
105
|
+
`reconcile` updates PhaseGate-managed portions, preserves user content, adds newly introduced managed targets, repairs missing or stale bundled skills in project and personal catalogs, and refreshes `.phasegate/manifest.json` with current version/hash metadata. If a managed file was edited after install, `reconcile --apply` refuses that entry until you rerun with `--force`, which creates a backup under `.phasegate/backups/reconcile-<timestamp>/`. <!-- @work-item-id WI-216 -->
|
|
106
106
|
|
|
107
107
|
### Manual Setup Pieces
|
|
108
108
|
|
|
@@ -134,7 +134,7 @@ npx phasegate reconcile --dry-run
|
|
|
134
134
|
npx phasegate reconcile --apply
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
`phasegate update-skills` remains available as a compatibility alias
|
|
137
|
+
`phasegate update-skills` remains available as a compatibility alias. It now follows the same manifest-aware reconcile path, including project and personal bundled skill repair, so `reconcile` remains the preferred explicit upgrade command. <!-- @work-item-id WI-216 -->
|
|
138
138
|
|
|
139
139
|
`doctor --report-out <path>` writes exactly to the provided path. `.phasegate/last-doctor-report.json` is not a fixed output file unless you choose that path explicitly. <!-- @work-item-id WI-152 -->
|
|
140
140
|
|
|
@@ -8,6 +8,7 @@ PhaseGate setup is more than `phasegate.config.json`. A healthy installation is
|
|
|
8
8
|
<!-- @work-item-id WI-208 -->
|
|
9
9
|
<!-- @work-item-id WI-209 -->
|
|
10
10
|
<!-- @work-item-id WI-215 -->
|
|
11
|
+
<!-- @work-item-id WI-216 -->
|
|
11
12
|
|
|
12
13
|
## Artifact Classes
|
|
13
14
|
|
|
@@ -43,11 +44,11 @@ PhaseGate setup is more than `phasegate.config.json`. A healthy installation is
|
|
|
43
44
|
|
|
44
45
|
`phasegate install --personal --agent claude --apply` is a local-only bootstrap for evaluating PhaseGate in a team-owned repository. PhaseGate config is stored under `.phasegate-local/`, while selected agent runtime paths are real project-local files/directories: `.claude/settings.json` and `.claude/skills/` for Claude Code, `.codex/hooks.json` and `.codex/skills/` for Codex. These paths are hidden by `.git/info/exclude`; PhaseGate does not edit team `.gitignore`.
|
|
45
46
|
|
|
46
|
-
If `.claude/*` or `.codex/*` already exists and is not a PhaseGate-managed personal artifact, personal install reports manual review and preserves the existing path. <!-- @work-item-id WI-209 -->
|
|
47
|
+
If `.claude/*` or `.codex/*` already exists and is not a PhaseGate-managed personal artifact, personal install reports manual review and preserves the existing path. Existing `.claude/skills/` and `.codex/skills/` directories are mergeable skill catalogs: PhaseGate refreshes bundled skill directories and preserves user-owned skill directories. <!-- @work-item-id WI-209 --> <!-- @work-item-id WI-216 -->
|
|
47
48
|
|
|
48
49
|
Personal agent context is also placed only where the runtime will read it. Claude Code uses `.claude/CLAUDE.md`. Codex uses root `AGENTS.md` when PhaseGate can create or manage it locally; if a team `AGENTS.md` already exists, PhaseGate leaves it unchanged and doctor reports `codex-context-missing` instead of creating `AGENTS.override.md`. <!-- @work-item-id WI-215 -->
|
|
49
50
|
|
|
50
|
-
Project install uses a different topology: selected bundled skills are deployed once to root `skills/`, and `.claude/skills` / `.codex/skills` point to that shared target. If an older project install has the links but an empty `skills/` target, `phasegate doctor` reports the selected agent skill check and `phasegate reconcile --apply` repairs the shared skill bodies. <!-- @work-item-id WI-210 -->
|
|
51
|
+
Project install uses a different topology: selected bundled skills are deployed once to root `skills/`, and `.claude/skills` / `.codex/skills` point to that shared target. Existing root `skills/` is also a mergeable catalog: selected bundled skill directories are refreshed, selection-excluded or user-owned skills are not removed, and uninstall deletes only manifest-managed bundled skills plus metadata. If an older project install has the links but an empty `skills/` target, `phasegate doctor` reports the selected agent skill check and `phasegate reconcile --apply` repairs the shared skill bodies. <!-- @work-item-id WI-210 --> <!-- @work-item-id WI-216 -->
|
|
51
52
|
|
|
52
53
|
## Doctor Findings
|
|
53
54
|
|
|
@@ -18,4 +18,20 @@ if [ "${HARNESS_QUICK_MODE:-0}" = "1" ]; then
|
|
|
18
18
|
else
|
|
19
19
|
$PHASEGATE_CMD validate --layer L2 --format human
|
|
20
20
|
fi
|
|
21
|
+
L2_EXIT=$?
|
|
22
|
+
if [ $L2_EXIT -ne 0 ]; then
|
|
23
|
+
echo "PhaseGate L2 validation failed."
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
STAGED_FILES="$(git diff --cached --name-only --diff-filter=ACM 2>/dev/null || true)"
|
|
28
|
+
if printf '%s\n' "$STAGED_FILES" | grep -E '^\.phasegate-local/(inception|product)/' >/dev/null 2>&1; then
|
|
29
|
+
$PHASEGATE_CMD validate --layer L4 --format human --fail-on-warning
|
|
30
|
+
L4_EXIT=$?
|
|
31
|
+
if [ $L4_EXIT -ne 0 ]; then
|
|
32
|
+
echo "PhaseGate local inception/product consistency failed."
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
21
36
|
|
|
37
|
+
exit 0
|
package/package.json
CHANGED
package/scripts/harness/config-foundation/application/mappers/validator-system-config-mapper.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @layer application
|
|
3
3
|
* @unit config-foundation
|
|
4
4
|
* @work-item-id WI-133 / WI-156
|
|
5
|
+
* @work-item-id WI-217
|
|
5
6
|
*/
|
|
6
7
|
import type { HarnessConfigV2 } from '../../domain/harness-config.js';
|
|
7
8
|
|
|
@@ -27,19 +28,26 @@ export function toValidatorSystemConfig(resolvedConfig: HarnessConfigV2 | undefi
|
|
|
27
28
|
'pointer-validator': 'L4-005',
|
|
28
29
|
'skill-catalog-drift': 'L4-006',
|
|
29
30
|
}, /^L4-\d{3}$/);
|
|
31
|
+
const effectiveL4Validators = usesCustomDocumentRoots(resolvedConfig)
|
|
32
|
+
? includeValidator(l4Validators, 'L4-002')
|
|
33
|
+
: l4Validators;
|
|
30
34
|
|
|
31
35
|
return {
|
|
32
36
|
project: { preset: resolvedConfig.project.preset },
|
|
37
|
+
paths: {
|
|
38
|
+
designDocs: resolvedConfig.paths.designDocs,
|
|
39
|
+
inceptionDocs: resolvedConfig.paths.inceptionDocs,
|
|
40
|
+
},
|
|
33
41
|
layers: {
|
|
34
42
|
L2: { enabled: resolvedConfig.layers.L2.enabled, validators: ['L2-001', 'L2-002', 'L2-003', 'L2-013', 'L2-014', 'L2-015'] },
|
|
35
43
|
L3: {
|
|
36
44
|
enabled: resolvedConfig.layers.L3.enabled,
|
|
37
|
-
|
|
45
|
+
validators: l3Validators.length > 0 ? l3Validators : ['L3-001', 'L3-002', 'L3-003', 'L3-004'],
|
|
38
46
|
coverageThreshold: resolvedConfig.layers.L3.coverageThreshold,
|
|
39
47
|
},
|
|
40
48
|
L4: {
|
|
41
49
|
enabled: resolvedConfig.layers.L4.enabled,
|
|
42
|
-
|
|
50
|
+
validators: effectiveL4Validators.length > 0 ? effectiveL4Validators : ['L4-001', 'L4-002', 'L4-003', 'L4-004', 'L4-005', 'L4-006'],
|
|
43
51
|
},
|
|
44
52
|
},
|
|
45
53
|
harnesses: {
|
|
@@ -53,6 +61,15 @@ export function toValidatorSystemConfig(resolvedConfig: HarnessConfigV2 | undefi
|
|
|
53
61
|
};
|
|
54
62
|
}
|
|
55
63
|
|
|
64
|
+
function usesCustomDocumentRoots(resolvedConfig: HarnessConfigV2): boolean {
|
|
65
|
+
return resolvedConfig.paths.designDocs !== 'docs/product/construction'
|
|
66
|
+
|| resolvedConfig.paths.inceptionDocs !== 'docs/inception';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function includeValidator(validators: readonly string[], validatorId: string): readonly string[] {
|
|
70
|
+
return validators.includes(validatorId) ? validators : [...validators, validatorId];
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
function normalizeValidators(
|
|
57
74
|
validators: readonly string[],
|
|
58
75
|
aliases: Readonly<Record<string, string>>,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @unit installation
|
|
2
|
+
// @layer application
|
|
3
|
+
// @work-item-id WI-216
|
|
4
|
+
|
|
5
|
+
export type SkillSet = "core" | "all";
|
|
6
|
+
|
|
7
|
+
const CORE_SKILLS = [
|
|
8
|
+
"cascade-updater",
|
|
9
|
+
"codebase-mapper",
|
|
10
|
+
"consistency-checker",
|
|
11
|
+
"doc-freshness-checker",
|
|
12
|
+
"engineering-perspective",
|
|
13
|
+
"implementation-readiness-checker",
|
|
14
|
+
"pointer-validator",
|
|
15
|
+
"test-coverage-checker",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
const AIDLC_SKILLS = [
|
|
19
|
+
"domain-designer",
|
|
20
|
+
"environment-designer",
|
|
21
|
+
"implementation-planner",
|
|
22
|
+
"it-test-designer",
|
|
23
|
+
"it-test-logic-designer",
|
|
24
|
+
"logical-designer",
|
|
25
|
+
"mock-designer",
|
|
26
|
+
"product-architect",
|
|
27
|
+
"quick-implementor",
|
|
28
|
+
"scenario-test-designer",
|
|
29
|
+
"scenario-test-logic-designer",
|
|
30
|
+
"story-implementor",
|
|
31
|
+
"story-mapper",
|
|
32
|
+
"story-writer",
|
|
33
|
+
"uiux-designer",
|
|
34
|
+
"unit-designer",
|
|
35
|
+
"unit-test-designer",
|
|
36
|
+
"unit-test-logic-designer",
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
const UTILITY_SKILLS = ["codex-delegator", "skill-creator"] as const;
|
|
40
|
+
const GUIDANCE_SKILLS = ["phasegate-toolkit-guide", "phasegate-config-doctor"] as const;
|
|
41
|
+
|
|
42
|
+
export function getBundledSkillsForSet(skillSet: SkillSet): string[] {
|
|
43
|
+
if (skillSet === "core") return [...CORE_SKILLS];
|
|
44
|
+
return [...CORE_SKILLS, ...AIDLC_SKILLS, ...UTILITY_SKILLS, ...GUIDANCE_SKILLS];
|
|
45
|
+
}
|
|
46
|
+
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
// @work-item-id WI-145
|
|
4
4
|
// @work-item-id WI-209
|
|
5
5
|
// @work-item-id WI-210
|
|
6
|
+
// @work-item-id WI-216
|
|
6
7
|
|
|
7
8
|
import { join } from "node:path";
|
|
9
|
+
import { getBundledSkillsForSet, type SkillSet } from "../bundled-skill-selection.js";
|
|
8
10
|
import type { CheckId } from "../../domain/check-id.js";
|
|
9
11
|
import { DiagnosticFinding, type DiagnosticSeverity } from "../../domain/diagnostic-finding.js";
|
|
10
12
|
import type { RepairMode } from "../../domain/repair-mode.js";
|
|
@@ -69,3 +71,12 @@ export function skillTargetLooksValid(target: string | null): boolean {
|
|
|
69
71
|
export function skillDirectoryLooksValid(files: readonly string[]): boolean {
|
|
70
72
|
return files.some((file) => file.endsWith("/SKILL.md") || file.endsWith("\\SKILL.md") || file.endsWith(".harness-version"));
|
|
71
73
|
}
|
|
74
|
+
|
|
75
|
+
export function phasegateSkillDirectoryLooksComplete(files: readonly string[], metadata: string | null): boolean {
|
|
76
|
+
const skillSet: SkillSet = metadata?.includes('"skillSet": "core"') ? "core" : "all";
|
|
77
|
+
const expectedSkills = getBundledSkillsForSet(skillSet);
|
|
78
|
+
return expectedSkills.every((skill) => files.some((file) => {
|
|
79
|
+
const normalized = file.replaceAll("\\", "/");
|
|
80
|
+
return normalized.endsWith(`/${skill}/SKILL.md`);
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
// @work-item-id WI-145
|
|
4
4
|
// @work-item-id WI-209
|
|
5
5
|
// @work-item-id WI-210
|
|
6
|
+
// @work-item-id WI-216
|
|
6
7
|
|
|
7
8
|
import type { FileInspectorPort } from "../ports/file-inspector-port.js";
|
|
8
9
|
import type { HeuristicCheck } from "../../domain/ports/heuristic-check.js";
|
|
9
10
|
import type { DiagnosticFinding } from "../../domain/diagnostic-finding.js";
|
|
10
|
-
import { createFinding,
|
|
11
|
+
import { createFinding, phasegateSkillDirectoryLooksComplete, projectPath, skillTargetLooksValid } from "./check-utils.js";
|
|
11
12
|
|
|
12
13
|
export class ClaudeSkillsSymlinkCheck implements HeuristicCheck {
|
|
13
14
|
readonly checkId = "claude-skills-symlink" as const;
|
|
@@ -16,8 +17,9 @@ export class ClaudeSkillsSymlinkCheck implements HeuristicCheck {
|
|
|
16
17
|
async run(projectRoot: string, inspector: FileInspectorPort): Promise<DiagnosticFinding | null> {
|
|
17
18
|
const link = await inspector.readSymlink(projectPath(projectRoot, this.target));
|
|
18
19
|
const files = await inspector.listFiles(projectPath(projectRoot, this.target));
|
|
19
|
-
|
|
20
|
-
if (link
|
|
20
|
+
const metadata = await inspector.readText(projectPath(projectRoot, `${this.target}/.harness-version`));
|
|
21
|
+
if (skillTargetLooksValid(link) && phasegateSkillDirectoryLooksComplete(files, metadata)) return null;
|
|
22
|
+
if (link === null && phasegateSkillDirectoryLooksComplete(files, metadata)) return null;
|
|
21
23
|
return createFinding({
|
|
22
24
|
checkId: this.checkId,
|
|
23
25
|
severity: "red",
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
// @work-item-id WI-145
|
|
4
4
|
// @work-item-id WI-209
|
|
5
5
|
// @work-item-id WI-210
|
|
6
|
+
// @work-item-id WI-216
|
|
6
7
|
|
|
7
8
|
import type { FileInspectorPort } from "../ports/file-inspector-port.js";
|
|
8
9
|
import type { HeuristicCheck } from "../../domain/ports/heuristic-check.js";
|
|
9
10
|
import type { DiagnosticFinding } from "../../domain/diagnostic-finding.js";
|
|
10
|
-
import { createFinding,
|
|
11
|
+
import { createFinding, phasegateSkillDirectoryLooksComplete, projectPath, skillTargetLooksValid } from "./check-utils.js";
|
|
11
12
|
|
|
12
13
|
export class CodexSkillsSymlinkCheck implements HeuristicCheck {
|
|
13
14
|
readonly checkId = "codex-skills-symlink" as const;
|
|
@@ -16,8 +17,9 @@ export class CodexSkillsSymlinkCheck implements HeuristicCheck {
|
|
|
16
17
|
async run(projectRoot: string, inspector: FileInspectorPort): Promise<DiagnosticFinding | null> {
|
|
17
18
|
const link = await inspector.readSymlink(projectPath(projectRoot, this.target));
|
|
18
19
|
const files = await inspector.listFiles(projectPath(projectRoot, this.target));
|
|
19
|
-
|
|
20
|
-
if (link
|
|
20
|
+
const metadata = await inspector.readText(projectPath(projectRoot, `${this.target}/.harness-version`));
|
|
21
|
+
if (skillTargetLooksValid(link) && phasegateSkillDirectoryLooksComplete(files, metadata)) return null;
|
|
22
|
+
if (link === null && phasegateSkillDirectoryLooksComplete(files, metadata)) return null;
|
|
21
23
|
return createFinding({
|
|
22
24
|
checkId: this.checkId,
|
|
23
25
|
severity: "red",
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
// @work-item-id WI-213
|
|
15
15
|
// @work-item-id WI-214
|
|
16
16
|
// @work-item-id WI-215
|
|
17
|
+
// @work-item-id WI-216
|
|
17
18
|
|
|
18
19
|
import { mkdir, readFile, writeFile, copyFile, chmod, access, lstat, readlink, symlink, readdir, rm } from "node:fs/promises";
|
|
19
20
|
import { dirname, join } from "node:path";
|
|
20
|
-
import { getSkillsForSet, type SkillSet } from "../../../setup/skill-deployer.js";
|
|
21
21
|
import { DeploymentEntry } from "../../domain/deployment-entry.js";
|
|
22
22
|
import { DeploymentManifest } from "../../domain/deployment-manifest.js";
|
|
23
23
|
import type { ManagedBlockInput } from "../../domain/managed-block.js";
|
|
24
24
|
import type { RepairMode } from "../../domain/repair-mode.js";
|
|
25
|
+
import { getBundledSkillsForSet, type SkillSet } from "../bundled-skill-selection.js";
|
|
25
26
|
import type { ManifestRepositoryPort } from "../ports/manifest-repository-port.js";
|
|
26
27
|
import type { HashCalculatorPort } from "../ports/hash-calculator-port.js";
|
|
27
28
|
|
|
@@ -131,9 +132,19 @@ async function copyDirectory(src: string, dest: string): Promise<void> {
|
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
|
|
135
|
+
async function copySelectedSkillDirectories(harnessRoot: string, targetRoot: string, skills: readonly string[]): Promise<void> {
|
|
136
|
+
await mkdir(targetRoot, { recursive: true });
|
|
137
|
+
for (const skill of skills) {
|
|
138
|
+
const source = join(harnessRoot, "skills", skill);
|
|
139
|
+
const target = join(targetRoot, skill);
|
|
140
|
+
await rm(target, { recursive: true, force: true });
|
|
141
|
+
await copyDirectory(source, target);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
134
145
|
async function listSelectedBundledSkills(harnessRoot: string, skillSet: SkillSet): Promise<string[]> {
|
|
135
146
|
const skillsSource = join(harnessRoot, "skills");
|
|
136
|
-
const allowed = new Set(
|
|
147
|
+
const allowed = new Set(getBundledSkillsForSet(skillSet));
|
|
137
148
|
const entries = await readdir(skillsSource, { withFileTypes: true });
|
|
138
149
|
return entries
|
|
139
150
|
.filter((entry) => entry.isDirectory() && allowed.has(entry.name))
|
|
@@ -428,12 +439,13 @@ export class RunInstallUseCase {
|
|
|
428
439
|
...(includeCodex ? [".codex/skills"] : []),
|
|
429
440
|
]
|
|
430
441
|
: [];
|
|
442
|
+
const selectedPersonalSkills = input.personal ? await listSelectedBundledSkills(input.harnessRoot, skillSet) : [];
|
|
431
443
|
for (const skillPath of personalSkillTargets) {
|
|
432
|
-
const item = await this.planPersonalSkillDirectory(input, skillPath, baseManifest);
|
|
444
|
+
const item = await this.planPersonalSkillDirectory(input, skillPath, selectedPersonalSkills, baseManifest);
|
|
433
445
|
plan.push(item);
|
|
434
446
|
if (input.apply && item.changed && item.repairMode === "mechanical") {
|
|
435
447
|
try {
|
|
436
|
-
await
|
|
448
|
+
await copySelectedSkillDirectories(input.harnessRoot, join(input.projectRoot, skillPath), selectedPersonalSkills);
|
|
437
449
|
await writeFile(
|
|
438
450
|
join(input.projectRoot, skillPath, ".harness-version"),
|
|
439
451
|
`${JSON.stringify({ version: input.phasegateVersion, deployedAt: new Date().toISOString(), skillSet }, null, 2)}\n`,
|
|
@@ -444,10 +456,17 @@ export class RunInstallUseCase {
|
|
|
444
456
|
}
|
|
445
457
|
changed.push(item);
|
|
446
458
|
manifest = this.addManifestEntry(baseManifest, manifest, {
|
|
447
|
-
path: item.path
|
|
459
|
+
path: `${item.path}/.harness-version`,
|
|
448
460
|
mode: "created",
|
|
449
|
-
contentForHash: this.
|
|
461
|
+
contentForHash: this.personalSkillsVersionHashInput(item.path, input.phasegateVersion, skillSet, selectedPersonalSkills),
|
|
450
462
|
});
|
|
463
|
+
for (const skill of selectedPersonalSkills) {
|
|
464
|
+
manifest = this.addManifestEntry(baseManifest, manifest, {
|
|
465
|
+
path: `${item.path}/${skill}`,
|
|
466
|
+
mode: "created",
|
|
467
|
+
contentForHash: this.personalSkillHashInput(item.path, skill, input.phasegateVersion, skillSet),
|
|
468
|
+
});
|
|
469
|
+
}
|
|
451
470
|
}
|
|
452
471
|
}
|
|
453
472
|
|
|
@@ -755,32 +774,58 @@ export class RunInstallUseCase {
|
|
|
755
774
|
private async planPersonalSkillDirectory(
|
|
756
775
|
input: RunInstallInput,
|
|
757
776
|
relativePath: string,
|
|
777
|
+
skills: readonly string[],
|
|
758
778
|
baseManifest: DeploymentManifest,
|
|
759
779
|
): Promise<InstallPlanItem> {
|
|
760
780
|
const absolutePath = join(input.projectRoot, relativePath);
|
|
781
|
+
try {
|
|
782
|
+
const stat = await lstat(absolutePath);
|
|
783
|
+
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
784
|
+
return {
|
|
785
|
+
path: relativePath,
|
|
786
|
+
action: "will-merge",
|
|
787
|
+
repairMode: "manual",
|
|
788
|
+
strategy: "copy-dir",
|
|
789
|
+
changed: false,
|
|
790
|
+
summary: `${relativePath}: existing non-directory skills path requires manual review`,
|
|
791
|
+
diff: "manual review required",
|
|
792
|
+
skillHint: null,
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
} catch {}
|
|
761
796
|
const versionPath = join(absolutePath, ".harness-version");
|
|
762
797
|
const current = await readTextOrNull(versionPath);
|
|
763
|
-
const
|
|
764
|
-
const
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
|
|
798
|
+
const skillSet = input.skillSet ?? "all";
|
|
799
|
+
const expectedVersion = `"version": "${input.phasegateVersion}"`;
|
|
800
|
+
const expectedSkillSet = `"skillSet": "${skillSet}"`;
|
|
801
|
+
let missingSkill = false;
|
|
802
|
+
for (const skill of skills) {
|
|
803
|
+
if (!(await exists(join(absolutePath, skill, "SKILL.md")))) {
|
|
804
|
+
missingSkill = true;
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
const missingManifest = baseManifest.findEntry(`${relativePath}/.harness-version`) === null
|
|
809
|
+
|| skills.some((skill) => baseManifest.findEntry(`${relativePath}/${skill}`) === null);
|
|
810
|
+
const changed = current === null || !current.includes(expectedVersion) || !current.includes(expectedSkillSet) || missingSkill || missingManifest;
|
|
768
811
|
return {
|
|
769
812
|
path: relativePath,
|
|
770
|
-
action: changed ? "missing" :
|
|
771
|
-
repairMode:
|
|
813
|
+
action: changed ? "missing" : "will-skip",
|
|
814
|
+
repairMode: "mechanical",
|
|
772
815
|
strategy: "copy-dir",
|
|
773
816
|
changed,
|
|
774
|
-
summary:
|
|
775
|
-
|
|
776
|
-
: changed ? `${relativePath}: deploy bundled skills` : `${relativePath}: already up to date`,
|
|
777
|
-
diff: unmanagedExisting ? "manual review required" : changed ? "+ bundled skills" : "no changes",
|
|
817
|
+
summary: changed ? `${relativePath}: deploy bundled skills` : `${relativePath}: already up to date`,
|
|
818
|
+
diff: changed ? `+ ${skills.length} bundled skills (${skillSet})` : "no changes",
|
|
778
819
|
skillHint: null,
|
|
779
820
|
};
|
|
780
821
|
}
|
|
781
822
|
|
|
782
|
-
private
|
|
783
|
-
return `personal-skills:${path}:${version}:${skillSet}`;
|
|
823
|
+
private personalSkillsVersionHashInput(path: string, version: string, skillSet: "core" | "all", skills: readonly string[]): string {
|
|
824
|
+
return `personal-skills-version:${path}:${version}:${skillSet}:${skills.join(",")}`;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
private personalSkillHashInput(path: string, skill: string, version: string, skillSet: "core" | "all"): string {
|
|
828
|
+
return `personal-skill:${path}:${skill}:${version}:${skillSet}`;
|
|
784
829
|
}
|
|
785
830
|
|
|
786
831
|
private async planSharedSkillDirectory(
|
|
@@ -817,13 +862,7 @@ export class RunInstallUseCase {
|
|
|
817
862
|
|
|
818
863
|
private async deploySharedSkills(input: RunInstallInput, skills: readonly string[], skillSet: SkillSet): Promise<void> {
|
|
819
864
|
const targetRoot = join(input.projectRoot, "skills");
|
|
820
|
-
await
|
|
821
|
-
for (const skill of skills) {
|
|
822
|
-
const source = join(input.harnessRoot, "skills", skill);
|
|
823
|
-
const target = join(targetRoot, skill);
|
|
824
|
-
await rm(target, { recursive: true, force: true });
|
|
825
|
-
await copyDirectory(source, target);
|
|
826
|
-
}
|
|
865
|
+
await copySelectedSkillDirectories(input.harnessRoot, targetRoot, skills);
|
|
827
866
|
await writeFile(
|
|
828
867
|
join(targetRoot, ".harness-version"),
|
|
829
868
|
`${JSON.stringify({ version: input.phasegateVersion, deployedAt: new Date().toISOString(), skillSet }, null, 2)}\n`,
|