phasegate 0.152.5 → 0.152.7
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 +16 -0
- package/README.md +1 -0
- package/docs/guide/cli-reference.md +12 -2
- package/docs/guide/configuration.md +10 -5
- package/docs/guide/contract-traceability.md +55 -0
- package/docs/guide/hooks-integration.md +4 -0
- package/docs/guide/installation.md +4 -2
- package/docs/guide/layer-model.md +49 -0
- package/docs/guide/quick-vs-full-mode.md +2 -2
- package/docs/guide/setup-artifacts.md +60 -0
- package/package.json +1 -1
- package/scripts/harness/quick-mode/domain/value-objects/validator-relaxation-profile.ts +3 -3
- package/scripts/harness/quick-mode/infrastructure/adapters/validator-system-validator-id-registry-adapter.ts +1 -1
- package/skills/README.md +5 -5
- package/skills/phasegate-config-doctor/SKILL.md +29 -4
- package/skills/phasegate-toolkit-guide/SKILL.md +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.152.7] - 2026-05-13
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **WI-159 / WI-160 / WI-161 / WI-162 / WI-163 / WI-164 — validator and JSON contract foundation** — aligns the public validator catalog, Quick Mode relaxation contract, contract traceability guide, status/drift JSON semantics, G5 operational validator payload docs, CI/L4 rollout docs, and pointer/freshness semantics.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **WI-159 — Quick Mode validator catalog** — includes `L2-013` and `L2-015` in the Quick Mode validator ID registry and relaxation invariant so skipped/maintained L2 sets match the validator-system catalog.
|
|
19
|
+
|
|
20
|
+
## [0.152.6] - 2026-05-13
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **WI-152 / WI-153 / WI-154 / WI-157 / WI-169 — setup lifecycle documentation refresh** — adds the setup artifact inventory, aligns installation product construction docs with the current doctor/install/reconcile contract, refreshes bundled setup guidance skills, and modernizes developer skill documentation before publish prep.
|
|
25
|
+
|
|
10
26
|
## [0.152.3] - 2026-05-12
|
|
11
27
|
|
|
12
28
|
### Fixed
|
package/README.md
CHANGED
|
@@ -551,6 +551,7 @@ Detailed guides are available under `docs/guide/`:
|
|
|
551
551
|
- [CLI Reference](docs/guide/cli-reference.md) -- All CLI commands and options
|
|
552
552
|
- [Skills Overview](docs/guide/skills-overview.md) -- 30 skills with AIDLC execution order
|
|
553
553
|
- [5-Layer Defense Model](docs/guide/layer-model.md) -- L0-L4 layer details and HarnessError format
|
|
554
|
+
- [Contract Traceability](docs/guide/contract-traceability.md) -- `L2-015` public contract, boundary, error, state, and observation annotations
|
|
554
555
|
- [Hooks Integration](docs/guide/hooks-integration.md) -- Claude Code Hooks setup and behavior
|
|
555
556
|
- [Codex Integration](docs/guide/codex-integration.md) -- Codex CLI setup, coverage matrix, and native `apply_patch` limitation
|
|
556
557
|
- [Quick Mode vs Full Mode](docs/guide/quick-vs-full-mode.md) -- When to use `/story-implementor` vs `/quick-implementor`, with decision flow and case studies
|
|
@@ -296,7 +296,7 @@ The following are binary subcommands (`npx phasegate <command>`). Do not assume
|
|
|
296
296
|
|
|
297
297
|
### Status and drift JSON semantics
|
|
298
298
|
|
|
299
|
-
<!-- @work-item-id WI-151 -->
|
|
299
|
+
<!-- @work-item-id WI-151, WI-162 -->
|
|
300
300
|
|
|
301
301
|
`phasegate:status --json` is intended for humans, CI, and agents that need to distinguish configured intent from observed results. Layer entries may include:
|
|
302
302
|
|
|
@@ -308,6 +308,16 @@ The following are binary subcommands (`npx phasegate <command>`). Do not assume
|
|
|
308
308
|
|
|
309
309
|
`phasegate:detect-drift --json` returns drift findings from live design/code comparison. A finding with a real mismatch is different from a validator `limitation`: `missing` means expected evidence or artifacts were absent, while `limitation` means the validator cannot currently prove the condition and should be treated as advisory until coverage is improved.
|
|
310
310
|
|
|
311
|
+
Status JSON may also include:
|
|
312
|
+
|
|
313
|
+
| Key | Meaning |
|
|
314
|
+
|---|---|
|
|
315
|
+
| `hookHealth` | Configured hook files, latest skipped hook event, skip counts by reason, and the Codex native `apply_patch` limitation with the pre-commit backstop. |
|
|
316
|
+
| `baselineHealth` | Baseline enabled state, baseline path, grandfathered file count, SHA mismatch count, missing file count, and removal rate. |
|
|
317
|
+
| `operationalWarnings` | Non-gating warnings with `code`, `message`, and `nextAction`. |
|
|
318
|
+
|
|
319
|
+
Drift JSON findings should preserve the most precise available `location`, `unit`, `category`, `severity`, and `nextAction`. Structural drift (`L4-001`) compares product design and code structure. Semantic drift compares `DesignIntent`, `ImplementationBehavior`, and `TestObservation` by `unitName + behaviorId`; it is an L4 report producer above structural drift and does not replace `L4-001`.
|
|
320
|
+
|
|
311
321
|
L4 warning findings fail the process only when warning strictness is enabled (`validate.failOnWarning: true`, the `strict` preset, or `--fail-on-warning`). `--no-fail-on-warning` forces advisory behavior for the current command.
|
|
312
322
|
|
|
313
323
|
---
|
|
@@ -391,7 +401,7 @@ ISSUE-005 P3-10 で明確化された境界:
|
|
|
391
401
|
|
|
392
402
|
| Command | Options | Description |
|
|
393
403
|
|---|---|---|
|
|
394
|
-
| `hooks:config validate` | |
|
|
404
|
+
| `hooks:config validate` | | Compatibility validator for legacy `.harness-hooks.yml`; new setup should use `install`, `doctor`, `reconcile`, `lint`, and `validate` |
|
|
395
405
|
| `hooks:gate-check` | `--story <id>` | Completion gate check |
|
|
396
406
|
|
|
397
407
|
---
|
|
@@ -6,6 +6,8 @@ Place at project root. Generated by `npx phasegate init`.
|
|
|
6
6
|
|
|
7
7
|
This file is the **Single Source of Truth** for all quality configuration in a Phasegate project. Every layer validator, skill, and harness behavior reads from this file.
|
|
8
8
|
|
|
9
|
+
It is not the whole setup state. Hook JSON, Husky scripts, CI workflow files, skill links, `.phasegate/manifest.json`, runtime reports, and Codex user-level feature flags are tracked separately. Use [Setup Artifacts](setup-artifacts.md) when auditing whether a project is fully installed. <!-- @work-item-id WI-152 -->
|
|
10
|
+
|
|
9
11
|
### Full Reference
|
|
10
12
|
|
|
11
13
|
```jsonc
|
|
@@ -22,8 +24,8 @@ This file is the **Single Source of Truth** for all quality configuration in a P
|
|
|
22
24
|
},
|
|
23
25
|
"quickMode": {
|
|
24
26
|
"allowedCategories": ["bugfix", "docs", "test", "config"],
|
|
25
|
-
"maintainedLayers": ["L1", "L2"],
|
|
26
|
-
"relaxedGates": ["
|
|
27
|
+
"maintainedLayers": ["L1", "L2-002", "L2-003", "L2-014", "L3-001"],
|
|
28
|
+
"relaxedGates": ["L2-001", "L3-002", "L3-003", "L3-004", "L4"],
|
|
27
29
|
"fullModeRequiredWhen": {
|
|
28
30
|
"mixedCategories": true,
|
|
29
31
|
"newDomainFile": true,
|
|
@@ -119,8 +121,8 @@ The five layers are:
|
|
|
119
121
|
| Sub-field | Type | Default | Description |
|
|
120
122
|
|------------------------|------------|-----------------------------------------|-----------------------------------------------------------------------------|
|
|
121
123
|
| `allowedCategories` | `string[]` | `["bugfix", "docs", "test", "config"]` | Change categories permitted under Quick Mode. Any category outside this list requires the full `story-implementor` workflow. |
|
|
122
|
-
| `maintainedLayers` | `string[]` | `["L1", "L2"]`
|
|
123
|
-
| `relaxedGates` | `string[]` | `["
|
|
124
|
+
| `maintainedLayers` | `string[]` | `["L1", "L2-002", "L2-003", "L2-014", "L3-001"]` | Exact validator IDs that remain enforced in Quick Mode. `L1` is the only layer shorthand; `L2` is not expanded. |
|
|
125
|
+
| `relaxedGates` | `string[]` | `["L2-001", "L3-002", "L3-003", "L3-004", "L4"]` | Validators/layers relaxed by Quick Mode. `L4` means all L4 validators are skipped. |
|
|
124
126
|
| `fullModeRequiredWhen` | `object` | all flags `true` | Conditions that force a Quick Mode change to escalate to the full `/story-implementor` flow. See below. |
|
|
125
127
|
|
|
126
128
|
##### `fullModeRequiredWhen`
|
|
@@ -137,6 +139,9 @@ Introduced in ISSUE-006 Story A (v0.63.0) and wired into the pre-tool-use hook b
|
|
|
137
139
|
|
|
138
140
|
Set a flag to `false` only when the project intentionally accepts the risk of merging that category of change without the design ceremony -- e.g. an early-stage prototype where new domain files are expected to churn.
|
|
139
141
|
|
|
142
|
+
<!-- @work-item-id WI-159 -->
|
|
143
|
+
Quick Mode uses exact validator IDs for `maintainedLayers`. To keep all L2 validators active, list `L2-001`, `L2-002`, `L2-003`, `L2-013`, `L2-014`, and `L2-015` explicitly. The default keeps metadata, test-quality, work-item status, and security checks active while skipping phase-gate, CLI E2E coverage, contract traceability coverage, performance, coverage, nyquist, and L4 scheduled validators.
|
|
144
|
+
|
|
140
145
|
#### `phaseDependencies`
|
|
141
146
|
|
|
142
147
|
| Sub-field | Type | Default | Description |
|
|
@@ -444,7 +449,7 @@ Controls how warning-severity validator failures are aggregated into the overall
|
|
|
444
449
|
|
|
445
450
|
| Sub-field | Type | Default by preset | Description |
|
|
446
451
|
|------------------|-----------|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
447
|
-
| `failOnWarning` | `boolean` | `false` (`minimal` / `standard`), `true` (`strict`) | When `true`, warning-only validator fails (
|
|
452
|
+
| `failOnWarning` | `boolean` | `false` (`minimal` / `standard`), `true` (`strict`) | When `true`, warning-only validator fails (for example L4-001 drift, L4-002 consistency, L4-003 dead-code, L4-004 doc-freshness, or L4-005 pointer-validation) count as overall FAIL / exit 1. When `false`, they count as PASS / exit 0. |
|
|
448
453
|
|
|
449
454
|
CLI override: `--fail-on-warning` / `--no-fail-on-warning` (CLI > config). Both unspecified → config value used.
|
|
450
455
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
traceability:
|
|
3
|
+
initial_creation: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Contract Traceability
|
|
7
|
+
|
|
8
|
+
<!-- @work-item-id WI-160 -->
|
|
9
|
+
|
|
10
|
+
`L2-015 contract-traceability-coverage` validates opt-in semantic records that connect public contracts to tests and product reflection.
|
|
11
|
+
|
|
12
|
+
## Annotations
|
|
13
|
+
|
|
14
|
+
Use `@phasegate-contract` on the file or section that declares a public behavior, boundary, error, state, or traceability contract. Use `@phasegate-observation` on tests or evidence that covers that contract.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// @phasegate-contract id=phasegate-status-json kind=PublicContract behaviors=hook-health,baseline-health
|
|
18
|
+
// @phasegate-observation covers=phasegate-status-json:hook-health kind=integration
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The current scanner is deliberately annotation based. It avoids treating every Markdown heading or exported symbol as a public contract while keeping the domain model ready for richer AST/Markdown extractors.
|
|
22
|
+
|
|
23
|
+
## Semantic keys
|
|
24
|
+
|
|
25
|
+
| Key | Meaning |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `behavior` | A required public behavior under a CLI, API, Port, config, domain, or error contract. |
|
|
28
|
+
| `boundary` | A boundary case such as invalid input, adapter edge, compatibility mode, or public/private API distinction. |
|
|
29
|
+
| `observation` | Test or other evidence that covers a behavior or boundary. |
|
|
30
|
+
|
|
31
|
+
## Model types
|
|
32
|
+
|
|
33
|
+
| Type | What it represents |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `PublicContract` | CLI/API/Port/config/domain/error contract and its required behavior cases. |
|
|
36
|
+
| `BoundaryCase` | Edge behavior that must be covered separately from the happy path. |
|
|
37
|
+
| `ErrorContract` | Stable error code, severity, message, suggestion, documentation reference, exit code, and machine-readable fields. |
|
|
38
|
+
| `StateMachineModel` | States, transitions, terminal states, and invalid transitions. |
|
|
39
|
+
| `TraceabilityGraphSlice` | WI, affected Unit, product reflection, implementation evidence, test evidence, and public-doc sync status. |
|
|
40
|
+
|
|
41
|
+
## Findings
|
|
42
|
+
|
|
43
|
+
`L2-015` findings use the standard validator result contract. Important fields are:
|
|
44
|
+
|
|
45
|
+
| Field | Meaning |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `kind` | Finding class such as missing behavior observation, missing boundary observation, incomplete error contract, state transition gap, or traceability graph gap. |
|
|
48
|
+
| `subject` | Contract, behavior, error, state, or WI graph node that needs attention. |
|
|
49
|
+
| `sourcePath` | File where the contract or observation was collected. |
|
|
50
|
+
| `severity` | Current policy severity for the finding. |
|
|
51
|
+
| `suggestion` | Repair action, usually adding an observation, completing an error contract, or reflecting a WI edge. |
|
|
52
|
+
|
|
53
|
+
## WI-133 severity policy
|
|
54
|
+
|
|
55
|
+
WI-133 made boundary/error/traceability coverage severity configurable at the validator policy layer. It is implemented as validator-system policy behavior, not as a new top-level `phasegate.config.json` field. Treat additional user-facing severity knobs as follow-up work unless the schema explicitly documents them.
|
|
@@ -4,6 +4,8 @@ Phasegate integrates natively with Claude Code through its hooks system. This en
|
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
|
+
For new or existing projects, prefer `npx phasegate install --dry-run` followed by `npx phasegate install --apply` so existing hook JSON is merged instead of replaced. Manual editing is still possible, but then `phasegate doctor` may report missing managed targets until the expected PhaseGate entries, skill links, Husky scripts, CI workflow, and manifest are present. See [Setup Artifacts](setup-artifacts.md). <!-- @work-item-id WI-152 --> <!-- @work-item-id WI-169 -->
|
|
8
|
+
|
|
7
9
|
Add the following to `.claude/settings.json`:
|
|
8
10
|
|
|
9
11
|
```jsonc
|
|
@@ -130,3 +132,5 @@ Additional hooks can be placed in `.claude/scripts/`:
|
|
|
130
132
|
| targetDirs | Directories where hooks apply (relative to project root) | [] (skip if empty) |
|
|
131
133
|
| formatter | "biome" or "eslint-prettier" | "biome" |
|
|
132
134
|
| formatterArgs | Arguments passed to formatter | ["check", "--write"] |
|
|
135
|
+
|
|
136
|
+
Legacy `.harness-hooks.yml` and old Fuse hook files are not part of the current install lifecycle. Keep them only for archived integrations; new setup should use `install`, `doctor`, `reconcile`, `lint`, and `validate`. <!-- @work-item-id WI-157 -->
|
|
@@ -17,7 +17,7 @@ Or add it directly to your `package.json`:
|
|
|
17
17
|
```json
|
|
18
18
|
{
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"phasegate": "^0.
|
|
20
|
+
"phasegate": "^0.152.7"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
```
|
|
@@ -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
|
|
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 `.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 -->
|
|
60
60
|
|
|
61
61
|
If a managed update must replace existing custom content, use:
|
|
62
62
|
|
|
@@ -116,6 +116,8 @@ npx phasegate reconcile --apply
|
|
|
116
116
|
|
|
117
117
|
`phasegate update-skills` remains available as a compatibility alias, but `reconcile` is the preferred upgrade path because it updates all managed files recorded in `.phasegate/manifest.json`.
|
|
118
118
|
|
|
119
|
+
`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 -->
|
|
120
|
+
|
|
119
121
|
## Recommended .gitignore additions
|
|
120
122
|
|
|
121
123
|
```
|
|
@@ -113,6 +113,7 @@ L2 validators run before every commit. They enforce process discipline and test
|
|
|
113
113
|
| **test-quality** | L2-003 | Enforces test authoring standards through a runner-independent semantic model: AAA pattern, named Act observation, single-act-per-test, assertion strength, lifecycle/E2E exceptions, and no domain/internal mocking in domain layer tests. |
|
|
114
114
|
| **cli-e2e-test-existence** | L2-013 | Checks that public CLI commands have corresponding CLI/e2e coverage or an explicit documented reason for compatibility/internal handling. |
|
|
115
115
|
| **work-item-status-staleness** | L2-014 | Compares `description.md` frontmatter status with derived artifact evidence and reports stale WI status. |
|
|
116
|
+
| **contract-traceability-coverage** | L2-015 | Checks opt-in public contract, boundary, error, state-machine, and traceability observations declared with `@phasegate-contract` / `@phasegate-observation`. |
|
|
116
117
|
|
|
117
118
|
**Command:**
|
|
118
119
|
|
|
@@ -133,6 +134,16 @@ L3 validators run in the CI/CD pipeline before a merge is permitted. They cover
|
|
|
133
134
|
| **coverage** | Enforces test coverage thresholds. Standard preset requires 90%; strict preset requires 95%. |
|
|
134
135
|
| **nyquist** | Bidirectional requirements-test traceability. Validates that every requirement in `requirement-test-matrix.json` has corresponding tests and vice versa. |
|
|
135
136
|
|
|
137
|
+
<!-- @work-item-id WI-161 -->
|
|
138
|
+
Operational L3 findings use stable payloads:
|
|
139
|
+
|
|
140
|
+
| Validator | Key payload fields |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `L3-001 security` | `ruleId`, redacted value or redaction marker, token family, file location, fixture/allowlist context, suggestion. |
|
|
143
|
+
| `L3-002 performance` | smell id, file location, observed metric, threshold, optional suppression marker, suggestion. |
|
|
144
|
+
|
|
145
|
+
Security findings must redact matched token values. Fixture allowlists are for tests and examples only. Performance suppression should be explicit in source, and suppressed findings remain visible as accepted risk rather than disappearing from the model.
|
|
146
|
+
|
|
136
147
|
**Command:**
|
|
137
148
|
|
|
138
149
|
```bash
|
|
@@ -169,6 +180,44 @@ npx phasegate validate --layer L4
|
|
|
169
180
|
|
|
170
181
|
Use a weekly cron such as `0 9 * * 1` for the generated consistency-check workflow. Standard projects normally keep L4 default-off and run the scheduled audit as advisory. Strict projects may opt into `layers.L4.enabled: true` and `failOnWarning` behavior when L4 warnings should block promotion. @work-item-id WI-128
|
|
171
182
|
|
|
183
|
+
### Validator execution contract
|
|
184
|
+
|
|
185
|
+
<!-- @work-item-id WI-159, WI-164 -->
|
|
186
|
+
|
|
187
|
+
The canonical validator catalog is:
|
|
188
|
+
|
|
189
|
+
| Layer | Validator IDs |
|
|
190
|
+
|---|---|
|
|
191
|
+
| L2 | `L2-001`, `L2-002`, `L2-003`, `L2-013`, `L2-014`, `L2-015` |
|
|
192
|
+
| L3 | `L3-001`, `L3-002`, `L3-003`, `L3-004` |
|
|
193
|
+
| L4 | `L4-001`, `L4-002`, `L4-003`, `L4-004`, `L4-005` |
|
|
194
|
+
|
|
195
|
+
`validate --layer L2` runs all enabled L2 validators. `validate --layer L4` is an explicit operator request and runs L4 even when standard preset config leaves `layers.L4.enabled: false`. `validate --layer all`, `phasegate:ci-check`, and aggregate CI-style commands preserve disabled L4 entries as skipped results; skipped results do not fail the process and are not promoted by `--fail-on-warning`.
|
|
196
|
+
|
|
197
|
+
Quick Mode does not expand `maintainedLayers: ["L2"]` into every L2 validator. It treats entries as exact validator IDs, plus `L1` for all L1 lint behavior and `L4` as an all-skipped layer marker. The default Quick Mode profile maintains `L2-002`, `L2-003`, `L2-014`, and `L3-001`; it skips `L2-001`, `L2-013`, `L2-015`, `L3-002`, `L3-003`, `L3-004`, and all L4 validators.
|
|
198
|
+
|
|
199
|
+
### L4 pointer and freshness report shape
|
|
200
|
+
|
|
201
|
+
<!-- @work-item-id WI-164 -->
|
|
202
|
+
|
|
203
|
+
`L4-004 doc-freshness` and `L4-005 pointer-validation` findings are registered L4 validator results, not separate hidden checks. Reports should be read with these fields:
|
|
204
|
+
|
|
205
|
+
| Field | Meaning |
|
|
206
|
+
|---|---|
|
|
207
|
+
| `owner` | Unit or workflow responsible for the document/pointer policy. |
|
|
208
|
+
| `pointerType` | Semantic type such as `reference`, `implementation`, `adr`, `product-doc`, or `external-url`. |
|
|
209
|
+
| `sourceDocument` / `documentPath` | Document where the freshness or pointer finding originated. |
|
|
210
|
+
| `severity` | `warning` or `error`; warning remains advisory unless fail-on-warning is active. |
|
|
211
|
+
| `nextAction` / `suggestion` | Human or agent action that repairs the stale document or broken pointer. |
|
|
212
|
+
|
|
213
|
+
External URL pointers are skipped by default unless a policy explicitly asks for URL validation.
|
|
214
|
+
|
|
215
|
+
### Dead-code graph boundaries
|
|
216
|
+
|
|
217
|
+
<!-- @work-item-id WI-161 -->
|
|
218
|
+
|
|
219
|
+
`L4-003 dead-code` uses import/export graph analysis rather than simple text search. It accounts for direct exports, named re-exports, wildcard re-exports, default exports, dynamic imports, public API boundaries, and generated/test/fixture exclusions. Because module boundaries and public entrypoints can be project-specific, dead-code findings are warnings by default and become blocking only under fail-on-warning policy.
|
|
220
|
+
|
|
172
221
|
### Status and drift states
|
|
173
222
|
|
|
174
223
|
`phasegate:status --json` separates three ideas that should not be collapsed in CI or agent logic:
|
|
@@ -41,12 +41,12 @@ flowchart TD
|
|
|
41
41
|
| Test design doc | Required before coding | Not required |
|
|
42
42
|
| Coverage target | 90% or above | Existing coverage maintained |
|
|
43
43
|
| L1 Biome rules | All 8 rules | **All 8 rules** |
|
|
44
|
-
| L2 Pre-commit | phase-gate + metadata + test-quality | **metadata + test-quality** (phase-gate relaxed) |
|
|
44
|
+
| L2 Pre-commit | phase-gate + metadata + test-quality + CLI E2E coverage + WI status + contract traceability | **metadata + test-quality + WI status** (phase-gate, CLI E2E coverage, and contract traceability relaxed) |
|
|
45
45
|
| L3 CI | security + performance + coverage + nyquist | security only |
|
|
46
46
|
| L4 Scheduled | drift + consistency + dead-code | skipped |
|
|
47
47
|
| Commit prefix | conventional (`feat:`, `fix:`, ...) | `[quick] ...` |
|
|
48
48
|
|
|
49
|
-
Both modes keep **L1 in full strength** and **L2 metadata / test-quality** — `@unit` / `@layer` comments, semantic AAA structure,
|
|
49
|
+
Both modes keep **L1 in full strength** and **L2 metadata / test-quality / WI status** — `@unit` / `@layer` comments, semantic AAA structure, assertion-strength checks, and stale WI status checks are non-negotiable regardless of flow. Quick Mode treats `maintainedLayers` entries as exact validator IDs; `L2` is not expanded into every L2 validator. <!-- @work-item-id WI-159 -->
|
|
50
50
|
|
|
51
51
|
---
|
|
52
52
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Setup Artifacts
|
|
2
|
+
|
|
3
|
+
PhaseGate setup is more than `phasegate.config.json`. A healthy installation is the combination of project configuration, managed targets, generated state, runtime reports, and a small number of user-level settings.
|
|
4
|
+
|
|
5
|
+
<!-- @work-item-id WI-152 -->
|
|
6
|
+
<!-- @work-item-id WI-157 -->
|
|
7
|
+
<!-- @work-item-id WI-169 -->
|
|
8
|
+
|
|
9
|
+
## Artifact Classes
|
|
10
|
+
|
|
11
|
+
| Class | Examples | Owner | Lifecycle |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| Managed target | `.claude/settings.json`, `.codex/hooks.json`, `.husky/pre-commit`, `.husky/commit-msg`, `.husky/pre-push`, `.github/workflows/phasegate-aidlc-gate.yml`, `.claude/skills`, `.codex/skills`, `package.json` PhaseGate scripts/devDependency | PhaseGate managed block or symlink plus user content | Created or merged by `install`, refreshed by `reconcile`, removed or reversed by `uninstall` |
|
|
14
|
+
| Configuration | `phasegate.config.json`, `package.json` | User owned, PhaseGate assisted | Created by `init`; `install` may merge scripts/devDependency into `package.json` |
|
|
15
|
+
| Generated artifact | `.phasegate/manifest.json`, `.phasegate/backups/*`, `.phasegate/uninstalled-*.json`, `.phasegate/baseline.json` | PhaseGate | Written by lifecycle commands and validators; safe to regenerate only through the owning command |
|
|
16
|
+
| Runtime state/report | `.phasegate/hook-skip-events.jsonl`, explicit `doctor --report-out <path>` output, `reports/regression/*`, resolved `reporting.outputDir` reports | PhaseGate command output | Produced while hooks, doctor, and validation commands run |
|
|
17
|
+
| Legacy artifact | `.harness-hooks.yml`, old Fuse hook files, `.harness/session-state.json`, `.harness/context-priority.json`, `.harness/reports` fallback | Compatibility only | Not required for current install lifecycle unless a project intentionally keeps an archived integration |
|
|
18
|
+
| User-level setting | Codex CLI `codex_hooks` feature flag | User machine | Must be enabled manually with `codex features enable codex_hooks`; project commands do not modify it |
|
|
19
|
+
|
|
20
|
+
## Managed Targets
|
|
21
|
+
|
|
22
|
+
`install --apply` and `reconcile --apply` manage only explicit targets. The current structured lifecycle covers:
|
|
23
|
+
|
|
24
|
+
- Agent hook JSON: `.claude/settings.json`, `.codex/hooks.json`
|
|
25
|
+
- Husky scripts when requested: `.husky/pre-commit`, `.husky/commit-msg`, `.husky/pre-push`
|
|
26
|
+
- CI workflow when requested: `.github/workflows/phasegate-aidlc-gate.yml`
|
|
27
|
+
- Agent skill links: `.claude/skills`, `.codex/skills`
|
|
28
|
+
- Package metadata: PhaseGate scripts and `devDependencies.phasegate` in `package.json`
|
|
29
|
+
- Manifest: `.phasegate/manifest.json`
|
|
30
|
+
|
|
31
|
+
`init --with-ci` still deploys the legacy-compatible template set, including `.github/workflows/aidlc-gate.yml`, `.github/workflows/consistency-check.yml`, and `.github/workflows/agent-context-refresh.yml`. Structured `install` uses `.github/workflows/phasegate-aidlc-gate.yml` so it can coexist with existing project CI without taking over a generic workflow filename.
|
|
32
|
+
|
|
33
|
+
## Doctor Findings
|
|
34
|
+
|
|
35
|
+
`phasegate doctor` evaluates setup health from the managed targets and related project state. Findings include `repairMode`, optional `repairHint`, and optional `suggestedSkill`.
|
|
36
|
+
|
|
37
|
+
| Field | Meaning |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `repairMode: "mechanical"` | A PhaseGate command can usually fix the target, for example `npx phasegate install --apply` or `--force`. |
|
|
40
|
+
| `repairMode: "ai-assisted"` | Existing user content needs judgment before merging. Doctor includes `suggestedSkill`, usually `phasegate-config-doctor`. |
|
|
41
|
+
| `repairMode: "manual"` | Human review is required, commonly for semantic CI/workflow conflicts. |
|
|
42
|
+
| `repairHint` | Copyable command for mechanical cases. |
|
|
43
|
+
| `suggestedSkill` | Skill name, rationale, and invoke command for agent-assisted repair planning. |
|
|
44
|
+
|
|
45
|
+
`doctor --report-out <path>` writes exactly to the path you pass. `.phasegate/last-doctor-report.json` is not created automatically; it is only a conventional path you may choose.
|
|
46
|
+
|
|
47
|
+
## Reports And Runtime Files
|
|
48
|
+
|
|
49
|
+
`reporting.outputDir` is the default project-visible report directory for phase dependency and phase-gate reports. Some command families have their own contracts:
|
|
50
|
+
|
|
51
|
+
- `doctor --report-out <path>` writes to the explicit path only.
|
|
52
|
+
- `regression:*` commands write under `reports/regression/`.
|
|
53
|
+
- `.harness/reports` is a legacy fallback used only when a phase-dependency provider cannot resolve project config.
|
|
54
|
+
- `.phasegate/hook-skip-events.jsonl` records hook bypass/skip observations for diagnosis; it is runtime state, not a managed install target.
|
|
55
|
+
|
|
56
|
+
## Legacy Retirement
|
|
57
|
+
|
|
58
|
+
Current setup does not require `.harness-hooks.yml`, old Fuse hook files, `.harness/session-state.json`, or `.harness/context-priority.json`. Treat them as project-local compatibility artifacts. Before deleting them, check whether an archived workflow or local script still references them; otherwise prefer documenting them as retired rather than wiring new guidance around them.
|
|
59
|
+
|
|
60
|
+
`hooks:config validate` is a compatibility command for old `.harness-hooks.yml` projects. New setup should use `install`, `doctor`, `reconcile`, `lint`, and `validate`.
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Quick Mode時のバリデータ実行構成を表す値オブジェクト
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
const L2_IDS = ['L2-001', 'L2-002', 'L2-003', 'L2-014'] as const;
|
|
9
|
+
const L2_IDS = ['L2-001', 'L2-002', 'L2-003', 'L2-013', 'L2-014', 'L2-015'] as const;
|
|
10
10
|
const L3_IDS = ['L3-001', 'L3-002', 'L3-003', 'L3-004'] as const;
|
|
11
11
|
|
|
12
12
|
type L2Id = (typeof L2_IDS)[number];
|
|
@@ -49,7 +49,7 @@ export class ValidatorRelaxationProfile {
|
|
|
49
49
|
return new ValidatorRelaxationProfile({
|
|
50
50
|
levelDependencyRelaxed: false,
|
|
51
51
|
l1: { all: true },
|
|
52
|
-
l2: { maintained: ['L2-002', 'L2-003', 'L2-014'], skipped: ['L2-001'] },
|
|
52
|
+
l2: { maintained: ['L2-002', 'L2-003', 'L2-014'], skipped: ['L2-001', 'L2-013', 'L2-015'] },
|
|
53
53
|
l3: { maintained: ['L3-001'], skipped: ['L3-002', 'L3-003', 'L3-004'] },
|
|
54
54
|
l4: { all: false },
|
|
55
55
|
phaseExecution: { twoPhaseRequired: false },
|
|
@@ -66,7 +66,7 @@ export class ValidatorRelaxationProfile {
|
|
|
66
66
|
}): ValidatorRelaxationProfile {
|
|
67
67
|
const { l2, l3 } = params;
|
|
68
68
|
|
|
69
|
-
// INV-P5: l2.maintained ∪ l2.skipped =
|
|
69
|
+
// INV-P5: l2.maintained ∪ l2.skipped = the canonical L2 validator catalog.
|
|
70
70
|
const l2Union = [...l2.maintained, ...l2.skipped].sort();
|
|
71
71
|
const l2Expected = [...L2_IDS].sort();
|
|
72
72
|
if (JSON.stringify(l2Union) !== JSON.stringify(l2Expected)) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
const STATIC_VALIDATOR_IDS: readonly string[] = Object.freeze([
|
|
10
10
|
'L1-001', 'L1-002', 'L1-003', 'L1-004', 'L1-005', 'L1-006', 'L1-007', 'L1-008',
|
|
11
|
-
'L2-001', 'L2-002', 'L2-003', 'L2-014',
|
|
11
|
+
'L2-001', 'L2-002', 'L2-003', 'L2-013', 'L2-014', 'L2-015',
|
|
12
12
|
'L3-001', 'L3-002', 'L3-003', 'L3-004',
|
|
13
13
|
'L4-001', 'L4-002', 'L4-003', 'L4-004', 'L4-005',
|
|
14
14
|
]);
|
package/skills/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Skills ディレクトリ
|
|
2
2
|
|
|
3
|
-
このディレクトリには、AI
|
|
3
|
+
このディレクトリには、AIエージェントの共有スキル定義が含まれています。現在の配布対象は 30 skills です。公開一覧は `docs/guide/skills-overview.md`、setup lifecycle の管理対象は `docs/guide/setup-artifacts.md` を正とします。<!-- @work-item-id WI-154 -->
|
|
4
4
|
|
|
5
5
|
## ディレクトリ構成と同期
|
|
6
6
|
|
|
7
7
|
このディレクトリはスキルの**唯一の信頼できる情報源 (Single Source of Truth)** です。
|
|
8
|
-
`.
|
|
8
|
+
`.claude` と `.codex` の両方の環境から同じスキルにアクセスできるように、`phasegate install` / `phasegate reconcile` は必要に応じて以下のシンボリックリンクを管理します:
|
|
9
9
|
|
|
10
|
-
- `.agent/skills` -> `./skills` (プロジェクトルートからの相対パス)
|
|
11
10
|
- `.claude/skills` -> `./skills` (プロジェクトルートからの相対パス)
|
|
12
11
|
- `.codex/skills` -> `./skills` (プロジェクトルートからの相対パス)
|
|
13
12
|
|
|
14
13
|
技術的には、リンクは以下のように設定されています:
|
|
15
|
-
- `.agent/skills` -> `../skills`
|
|
16
14
|
- `.claude/skills` -> `../skills`
|
|
17
15
|
- `.codex/skills` -> `../skills`
|
|
18
16
|
|
|
17
|
+
`.agent/skills` は旧 setup 由来の互換パスです。新規導入では管理対象にしません。<!-- @work-item-id WI-157 -->
|
|
18
|
+
|
|
19
19
|
## 新しいスキルの追加
|
|
20
20
|
|
|
21
|
-
新しいスキルを追加する場合は、この `skills`
|
|
21
|
+
新しいスキルを追加する場合は、この `skills` ディレクトリに直接追加してください。あわせて `docs/guide/skills-overview.md`、README の skill 数、必要なら `skills/phasegate-toolkit-guide/SKILL.md` の参照先を更新します。シンボリックリンクを通じて、対応エージェントから利用可能になります。<!-- @work-item-id WI-154 -->
|
|
@@ -9,7 +9,7 @@ description: 現在の phasegate.config.json を schema + プロジェクト検
|
|
|
9
9
|
|
|
10
10
|
## このスキルが解決する問題
|
|
11
11
|
|
|
12
|
-
phasegate を導入した直後の config は単純な default で、実プロジェクトの構造 (monorepo / formatter 選定 / architecture style / Quick Mode の運用方針)
|
|
12
|
+
phasegate を導入した直後の config は単純な default で、実プロジェクトの構造 (monorepo / formatter 選定 / architecture style / Quick Mode の運用方針) に最適化されていない。さらに setup lifecycle は `phasegate.config.json` だけでは完結せず、manifest、hook JSON、Husky、CI、skill link、doctor finding を合わせて読む必要がある。AI が schema や setup contract を知らずに勘で書き換えると壊れるため、**schema + 検出結果に基づいた決定的提案** が必要。<!-- @work-item-id WI-153 -->
|
|
13
13
|
|
|
14
14
|
## 設計原則
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ phasegate を導入した直後の config は単純な default で、実プロ
|
|
|
18
18
|
3. **AI 推論は判断要素のみ** — architecture preset 選定、relaxedGates 推奨値などは AI が判断するが根拠を必ず示す
|
|
19
19
|
4. **schema は enum 違反確認時のみ Read** — 日常診断は本 SKILL 内の判定基準で十分。schema 全文 Read は値域不明時に限定する
|
|
20
20
|
5. **read-only な Q&A は phasegate-toolkit-guide に委譲** — 「L2 って何?」など概念質問は本 skill スコープ外
|
|
21
|
-
6.
|
|
21
|
+
6. **変更後は対象別に検証** — config 変更は `npx phasegate validate --layer L2`、setup lifecycle 変更は `npx phasegate doctor`、hook/script/metadata 変更は `npx phasegate lint` または `npm run phasegate:check-ready` を走らせてからユーザーに完了報告
|
|
22
22
|
|
|
23
23
|
## 診断プロセス
|
|
24
24
|
|
|
@@ -33,11 +33,19 @@ phasegate を導入した直後の config は単純な default で、実プロ
|
|
|
33
33
|
| pnpm workspace | `pnpm-workspace.yaml` (存在すれば) | workspace 検出 |
|
|
34
34
|
| lerna config | `lerna.json` (存在すれば) | workspace 検出 |
|
|
35
35
|
| hook config | `.claude/scripts/hook-config.json` | 既存 hook 設定確認 |
|
|
36
|
+
| doctor report | 明示された report path、またはユーザーが指定した `.phasegate/last-doctor-report.json` | `repairMode` / `repairHint` / `suggestedSkill` の確認 |
|
|
37
|
+
| manifest | `.phasegate/manifest.json` | install / reconcile / uninstall の managed target と hash 状態確認 |
|
|
38
|
+
| Claude hooks | `.claude/settings.json` | managed hook JSON と user customization の確認 |
|
|
39
|
+
| Codex hooks | `.codex/hooks.json` | managed hook JSON と Codex hook 配線確認 |
|
|
40
|
+
| Husky scripts | `.husky/pre-commit`, `.husky/commit-msg`, `.husky/pre-push` | pre-commit backstop と bypass audit の確認 |
|
|
41
|
+
| CI workflows | `.github/workflows/*` | `phasegate-aidlc-gate.yml` や既存 workflow との競合確認 |
|
|
36
42
|
|
|
37
43
|
**schema は必要なときだけ Read** (enum 違反疑い時など): `node_modules/phasegate/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v3.schema.json` (or `harness-config-v2.schema.json` if v2)。
|
|
38
44
|
|
|
39
45
|
phasegate リポジトリ自体 (dogfood) の場合は `node_modules/phasegate/` を `scripts/harness/config-foundation/...` に置換。
|
|
40
46
|
|
|
47
|
+
`doctor --report-out <path>` は指定された path にだけ書く。`.phasegate/last-doctor-report.json` は固定生成物ではないため、存在しない場合は `npx phasegate doctor --json` を実行して現状を読み取る。<!-- @work-item-id WI-152 -->
|
|
48
|
+
|
|
41
49
|
### Step 1.5: Fresh init 判定 (重要)
|
|
42
50
|
|
|
43
51
|
以下の **全条件** を満たす場合、フル診断は早期。Step 2 に進まず AIDLC 開始を案内する:
|
|
@@ -115,6 +123,15 @@ product-architect で Unit を作り、いくつかの logical_design を書い
|
|
|
115
123
|
- `formatter: "biome"` だが `@biomejs/biome` が devDependencies に無い → WARN: prettier に切り替え推奨
|
|
116
124
|
- v0.119 未満で deploy された hook script (bash 4 `mapfile` 使用) → WARN: macOS の bash 3.2 で silent fail。`phasegate init` 再実行で更新
|
|
117
125
|
|
|
126
|
+
#### 観点 9: setup lifecycle と doctor finding
|
|
127
|
+
|
|
128
|
+
- `phasegate doctor --json` の finding に `repairMode: "ai-assisted"` と `suggestedSkill.skillName = "phasegate-config-doctor"` がある → 本 skill が merge 方針、保持する user content、実行すべき `install --apply` / `--force` / `reconcile --apply` を提案する
|
|
129
|
+
- `repairHint` がある mechanical finding → 原則として hint のコマンドを優先し、実行前に対象ファイルと manifest の差分を確認
|
|
130
|
+
- manifest parse error → `.phasegate/manifest.json` を手で修復する前に backup / uninstall / reinstall の選択肢を提示
|
|
131
|
+
- reconcile / uninstall が refuse → user modified managed target として扱い、`--force` のリスクと backup path を説明して承認を取る
|
|
132
|
+
- Codex の `codex_hooks` feature flag は user-level setting。project-local `install` では変更されないため、必要なら `codex features enable codex_hooks` を案内
|
|
133
|
+
- Codex native `apply_patch` bypass は hook で完全捕捉できない。`.husky/pre-commit` の `phasegate pre-commit` が backstop になるため、Husky 配線を診断対象に含める
|
|
134
|
+
|
|
118
135
|
### Step 3: 診断レポート
|
|
119
136
|
|
|
120
137
|
診断結果を以下の形式で提示する:
|
|
@@ -179,13 +196,21 @@ options:
|
|
|
179
196
|
|
|
180
197
|
ユーザーが適用対象を確定したら `Edit` で `phasegate.config.json` を変更。
|
|
181
198
|
|
|
182
|
-
|
|
199
|
+
**変更後の検証**:
|
|
183
200
|
|
|
184
201
|
```bash
|
|
185
202
|
npx phasegate validate --layer L2
|
|
186
203
|
```
|
|
187
204
|
|
|
188
|
-
|
|
205
|
+
setup target を触った場合は以下も使い分ける:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx phasegate doctor
|
|
209
|
+
npx phasegate lint
|
|
210
|
+
npm run phasegate:check-ready
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
検証でエラーが出た場合は変更を **rollback** し、ユーザーに報告 (silent に進めない)。
|
|
189
214
|
|
|
190
215
|
## phasegate-toolkit-guide との使い分け
|
|
191
216
|
|
|
@@ -119,10 +119,15 @@ docs/guide/ # phasegate リポジトリ自体 (dogfood)
|
|
|
119
119
|
- 「phasegate のインストール方法は?」
|
|
120
120
|
- 「monorepo で使うときは?」
|
|
121
121
|
- 「既存プロジェクトに後から導入したい」
|
|
122
|
+
- 「doctor の repairMode / suggestedSkill って何?」
|
|
123
|
+
- 「.phasegate/manifest.json や hook-skip-events は何?」
|
|
122
124
|
|
|
123
125
|
**参照先**:
|
|
124
126
|
- 新規導入: `docs/guide/installation.md`
|
|
125
127
|
- 既存プロジェクト導入: `docs/guide/retrofit-adoption.md`
|
|
128
|
+
- setup artifact / doctor finding / legacy artifact: `docs/guide/setup-artifacts.md`
|
|
129
|
+
|
|
130
|
+
`setup-artifacts.md` は managed target / generated artifact / runtime state / legacy artifact / user-level setting の分類を持つ。`doctor --report-out` は明示 path への出力で、`.phasegate/last-doctor-report.json` は固定生成物ではない点もここを参照する。<!-- @work-item-id WI-153 -->
|
|
126
131
|
|
|
127
132
|
### 8. skill 一覧と使い分け
|
|
128
133
|
|