phasegate 0.152.7 → 0.152.9
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 +12 -0
- package/README.md +17 -1
- package/docs/ADR/ADR-002-pre-commit-validators.md +5 -2
- package/docs/ADR/ADR-004-scheduled-validators.md +4 -2
- package/docs/ADR/ADR-013-story-reflection-gate.md +2 -2
- package/docs/guide/cli-reference.md +4 -2
- package/docs/guide/configuration.md +9 -0
- package/docs/guide/getting-started.md +64 -0
- package/docs/guide/installation.md +13 -4
- package/docs/guide/recipes.md +65 -0
- package/docs/guide/setup-artifacts.md +21 -1
- package/docs/guide/troubleshooting.md +60 -0
- package/docs/templates/agent-context/AGENTS.md.template.md +45 -0
- package/docs/templates/agent-context/CLAUDE.md.template.md +4 -0
- package/package.json +1 -1
- package/scripts/harness/ci-governance/infrastructure/adapters/agents-md-file-adapter.ts +31 -5
- package/scripts/harness/installation/application/usecases/run-install.ts +78 -4
- package/scripts/harness/installation/application/usecases/run-reconcile.ts +57 -4
- package/scripts/harness/installation/application/usecases/run-uninstall.ts +13 -1
- package/scripts/harness/installation/presentation/cli/install-handler.ts +7 -0
- package/scripts/harness/main.ts +293 -1
- package/skills/phasegate-config-doctor/SKILL.md +4 -0
- package/skills/phasegate-toolkit-guide/SKILL.md +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.152.9] - 2026-05-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **WI-171 / WI-172 / WI-173 / WI-174 — user onboarding and agent-driven setup** — adds first-run recipes and troubleshooting guides, managed `AGENTS.md` / `CLAUDE.md` setup sections, dedicated AGENTS lesson pointer refresh, `setup:agent` setup planning/apply flow, and `config:plan` configuration-change intent planning.
|
|
15
|
+
|
|
16
|
+
## [0.152.8] - 2026-05-13
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **WI-155 / WI-165 / WI-166 / WI-167 / WI-168 — product reflection and catalog cleanup** — aligns product unit catalog policy, ADR validator catalog references, Work Item reflection wording, hook skip observability docs, and coverage/test design refresh for WI-117..148 follow-up semantics.
|
|
21
|
+
|
|
10
22
|
## [0.152.7] - 2026-05-13
|
|
11
23
|
|
|
12
24
|
### Changed
|
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ The point is not just to fail the edit. The error gives the AI agent enough stru
|
|
|
60
60
|
|
|
61
61
|
## Quick Start
|
|
62
62
|
|
|
63
|
+
For a guided first run, start with [Getting Started](docs/guide/getting-started.md). It maps new repo, existing repo, CI-only, agent-hook, and strict rollout paths to the next command and success state. <!-- @work-item-id WI-171 -->
|
|
64
|
+
|
|
63
65
|
### Requirements
|
|
64
66
|
|
|
65
67
|
Node.js >= 18, npm >= 9, TypeScript 5.x
|
|
@@ -98,7 +100,16 @@ npx phasegate install --apply
|
|
|
98
100
|
npx phasegate doctor
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
`install` merges PhaseGate into the current project without discarding existing Claude/Codex hooks or Husky scripts. It reports planned changes before writing, adds package scripts and the `phasegate` devDependency, creates agent skill links, 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/`.
|
|
103
|
+
`install` merges PhaseGate into the current project without discarding existing Claude/Codex hooks or Husky scripts. It reports planned changes before writing, adds package scripts and the `phasegate` devDependency, creates agent skill links, 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 -->
|
|
104
|
+
|
|
105
|
+
For agent-driven setup planning, use:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npx phasegate setup:agent --intent recommended --dry-run --json
|
|
109
|
+
npx phasegate config:plan --intent codex-hooks --dry-run --json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The first command reports detected setup state, missing questions, planned managed targets, rollback, and validation. The second maps a configuration change intent to files, commands, risks, and checks. <!-- @work-item-id WI-172, WI-173 -->
|
|
102
113
|
|
|
103
114
|
To remove PhaseGate from that project later, run:
|
|
104
115
|
|
|
@@ -507,6 +518,8 @@ README keeps only the entry points most users need. The full public/compatibilit
|
|
|
507
518
|
| `doctor` | Diagnose silent or partial installations (`--json`, `--strict`, `--report-out <path>`). `--report-out` is an explicit file path, not `reporting.outputDir`. |
|
|
508
519
|
| `uninstall --dry-run` / `--apply` | Remove PhaseGate-managed files and managed blocks using `.phasegate/manifest.json`, preserving user content. |
|
|
509
520
|
| `reconcile --dry-run` / `--apply` | Update PhaseGate-managed files to the current package templates and refresh manifest hashes. |
|
|
521
|
+
| `setup:agent --dry-run` / `--apply` | Diagnose repository setup and produce or apply an agent-readable setup plan with questions, risks, rollback, and validation. |
|
|
522
|
+
| `config:plan --intent <intent>` | Map a safe configuration-change intent to target files, commands, risks, rollback, and validation. |
|
|
510
523
|
| `lint` / `phasegate:lint` | Run L1 Biome AST checks. The `phasegate:*` form is a binary subcommand, not an npm script unless `package.json` defines it locally. |
|
|
511
524
|
| `validate --layer <L1-L4\|all>` | Run validators for the specified layer (`--layer L0` prints runtime hook guidance). `--fail-on-warning` / `--no-fail-on-warning` override config. |
|
|
512
525
|
| `ci-check` | Full CI check (L2-L4; disabled L4 is reported as skipped). Supports `--quick`, `--fail-on-reject`, `--dry-run`, and `--files`. |
|
|
@@ -547,6 +560,9 @@ See the [CLI Reference](docs/guide/cli-reference.md) for the complete catalog an
|
|
|
547
560
|
Detailed guides are available under `docs/guide/`:
|
|
548
561
|
|
|
549
562
|
- [Installation](docs/guide/installation.md) -- Detailed install and setup instructions
|
|
563
|
+
- [Getting Started](docs/guide/getting-started.md) -- First-run, daily-use, CI-use, and agent-use paths
|
|
564
|
+
- [Recipes](docs/guide/recipes.md) -- Focused onboarding and configuration recipes
|
|
565
|
+
- [Troubleshooting](docs/guide/troubleshooting.md) -- Doctor finding, repairHint, suggestedSkill, and setup recovery guide
|
|
550
566
|
- [Configuration](docs/guide/configuration.md) -- `phasegate.config.json` full reference
|
|
551
567
|
- [CLI Reference](docs/guide/cli-reference.md) -- All CLI commands and options
|
|
552
568
|
- [Skills Overview](docs/guide/skills-overview.md) -- 30 skills with AIDLC execution order
|
|
@@ -10,13 +10,16 @@ AIエージェントは設計文書を無視して直接コードを書くこと
|
|
|
10
10
|
|
|
11
11
|
## Decision
|
|
12
12
|
|
|
13
|
-
L2(Pre-commit
|
|
13
|
+
L2(Pre-commit)で以下のバリデータにより設計-実装の順序、メタデータ、テスト品質、CLI E2E、WI status、公開 contract traceability を機械的に強制または報告する。初期ADRの3バリデータ記述は履歴であり、現行 catalog は validator-system registry を正とする。<!-- @work-item-id WI-168 -->
|
|
14
14
|
|
|
15
15
|
| バリデータ | コード | 検出対象 |
|
|
16
16
|
|-----------|--------|---------|
|
|
17
17
|
| phase-gate | L2-001 | 設計文書なしの実装コード変更を拒否 |
|
|
18
18
|
| metadata | L2-002 | @unit/@layer/@US-XXX メタデータの完全性検証 |
|
|
19
19
|
| test-quality | L2-003 | AAA パターン、actual 命名、日本語テスト名の検証 |
|
|
20
|
+
| cli-e2e | L2-013 | public CLI entrypoint の基本 E2E 契約 |
|
|
21
|
+
| wi-status | L2-014 | WI status と acceptance criteria の陳腐化検出 |
|
|
22
|
+
| contract-traceability | L2-015 | public contract / boundary / observation の traceability coverage |
|
|
20
23
|
|
|
21
24
|
### Phase Gate の3層検証
|
|
22
25
|
|
|
@@ -27,7 +30,7 @@ L2(Pre-commit)で以下の3バリデータにより設計-実装の順序を
|
|
|
27
30
|
## Consequences
|
|
28
31
|
|
|
29
32
|
- 設計文書なしのコード変更が物理的に不可能になる
|
|
30
|
-
- `@
|
|
33
|
+
- `@work-item-id WI-XXX` と legacy annotation の対応によりトレーサビリティが機械的に保証される
|
|
31
34
|
- テスト品質ルール(AAA, actual 命名)が全テストに強制される
|
|
32
35
|
|
|
33
36
|
## 関連要件
|
|
@@ -10,13 +10,15 @@ Accepted
|
|
|
10
10
|
|
|
11
11
|
## Decision
|
|
12
12
|
|
|
13
|
-
L4(Scheduled
|
|
13
|
+
L4(Scheduled)で以下のバリデータを週次または明示実行で扱う。初期ADRの3バリデータ記述は履歴であり、現行 catalog は validator-system registry と `docs/guide/layer-model.md` を正とする。<!-- @work-item-id WI-168 -->
|
|
14
14
|
|
|
15
15
|
| バリデータ | コード | 検出対象 |
|
|
16
16
|
|-----------|--------|---------|
|
|
17
17
|
| drift-detect | L4-001 | 設計にあるがコードにない / コードにあるが設計にない双方向乖離 |
|
|
18
18
|
| consistency-check | L4-002 | 文書間のレイヤー整合性の破綻 |
|
|
19
19
|
| dead-code | L4-003 | 未使用エクスポート、到達不能コード |
|
|
20
|
+
| doc-freshness | L4-004 | 設計文書の freshness threshold 超過 |
|
|
21
|
+
| pointer-validation | L4-005 | 設計文書 pointer の owner/type/source/severity/nextAction 付き検証 |
|
|
20
22
|
|
|
21
23
|
### 技術的実装
|
|
22
24
|
|
|
@@ -28,7 +30,7 @@ L4(Scheduled)で以下の3バリデータを週次で実行する。
|
|
|
28
30
|
|
|
29
31
|
- 設計-実装の乖離が週次で自動検出される
|
|
30
32
|
- 未使用コードの蓄積が防止される
|
|
31
|
-
- strict
|
|
33
|
+
- L4 は default-off の scheduled/advisory 層として扱い、strict または明示 `validate --layer L4` で実行できる。fail-on-warning policy がない限り warning-only findings は gate failure へ昇格しない。
|
|
32
34
|
|
|
33
35
|
## 関連要件
|
|
34
36
|
|
|
@@ -16,7 +16,7 @@ Phase Gate(L2-001)は設計文書の**存在**を検証するが、inception
|
|
|
16
16
|
|
|
17
17
|
## Decision
|
|
18
18
|
|
|
19
|
-
`phaseDependencies.storyReflection` を導入し、**実装着手時(`src/` / `scripts/harness/` への Write/Edit)に inception → product
|
|
19
|
+
`phaseDependencies.storyReflection` を導入し、**実装着手時(`src/` / `scripts/harness/` への Write/Edit)に inception → product 反映を機械的に検証**する。現行の新規 reflection は `@work-item-id WI-XXX` を正とし、既存の `@story-id HXX-XX` / `@story-id US-XXX` は WI frontmatter の `legacy_id` 経由で履歴として解決する。<!-- @work-item-id WI-155 -->
|
|
20
20
|
|
|
21
21
|
### 設計原則
|
|
22
22
|
|
|
@@ -72,7 +72,7 @@ inception/order/US-002/logical_design.md は存在しますが、
|
|
|
72
72
|
### 関連コンポーネント
|
|
73
73
|
|
|
74
74
|
- `PhaseConfigProviderPort.getStoryReflectionConfig()` — プリセット + config から有効な mappings を解決
|
|
75
|
-
- `FileSystemStoryReflectionAdapter` — inception ディレクトリ列挙と product 文書内 `@story-id` 検索
|
|
75
|
+
- `FileSystemStoryReflectionAdapter` — inception ディレクトリ列挙と product 文書内 `@work-item-id` / legacy `@story-id` 検索
|
|
76
76
|
- `HandlePreToolUseUseCase` — src/ への Write 発火時に storyReflection チェックを呼び出し、未反映ならブロック
|
|
77
77
|
- Quick Mode (`relaxedGates: ["phase-gate"]`) 時は storyReflection も緩和される(§4.6)
|
|
78
78
|
|
|
@@ -23,10 +23,12 @@ Command names in this document are split into three surfaces:
|
|
|
23
23
|
| Command | Description |
|
|
24
24
|
|---|---|
|
|
25
25
|
| `init --name <name>` | Legacy-compatible bootstrap for new projects: deploy skills, generate config, and optionally add hooks/CI. Options: `--preset <full\|standard\|minimal\|custom>`, `--skills <core\|all>`, `--agent <claude\|codex\|both>`, `--workflow <standard\|strict>`, `--with-husky`, `--with-ci`, `--yes`. |
|
|
26
|
-
| `install --dry-run` / `--apply` | Idempotently merge PhaseGate into an existing project, preserve user content, add package scripts/devDependency, and write `.phasegate/manifest.json`. `--force` replaces managed targets after backup. |
|
|
26
|
+
| `install --dry-run` / `--apply` | Idempotently merge PhaseGate into an existing project, preserve user content, add package scripts/devDependency, create selected `AGENTS.md` / `CLAUDE.md` managed sections, and write `.phasegate/manifest.json`. `--agent <claude\|codex\|both>`, `--skills <core\|all>`, and `--workflow <standard\|strict>` affect rendered agent context; `--force` replaces managed targets after backup. |
|
|
27
27
|
| `doctor` | Diagnose silent or partial installations and report repair hints (`--json`, `--strict`, `--report-out <path>`). `--report-out` writes exactly to the supplied path, not to `reporting.outputDir`. |
|
|
28
28
|
| `uninstall --dry-run` / `--apply` | Remove PhaseGate-managed files and managed blocks using `.phasegate/manifest.json`; `--force` handles managed conflict cases. |
|
|
29
29
|
| `reconcile --dry-run` / `--apply` | Update PhaseGate-managed files to current package templates and refresh manifest hashes; `--force` allows managed-file replacement with backup. |
|
|
30
|
+
| `setup:agent` | Agent-readable setup planner and optional apply path. Options: `--intent <minimal\|recommended\|strict\|ci-only\|agent-hooks\|retrofit>`, `--agent <claude\|codex\|both>`, `--workflow <standard\|strict>`, `--with-husky`, `--with-ci`, `--dry-run`, `--apply`, `--json`. <!-- @work-item-id WI-172 --> |
|
|
31
|
+
| `config:plan` | Agent-readable configuration change planner. Options: `--intent <l4-strict\|codex-hooks\|ci-fail-on-warning\|baseline-reset\|quick-mode-strict>`, `--dry-run`, `--json`. <!-- @work-item-id WI-173 --> |
|
|
30
32
|
| `update-skills` | Compatibility alias for `reconcile`; use `reconcile` for new automation. |
|
|
31
33
|
| `scaffold-wi <unit> <type>` | Create `docs/inception/{unit}/WI-XXX/description.md` using the next free WI number. |
|
|
32
34
|
| `emit-agent-rules` | Print the AGENTS.md / CLAUDE.md WI workflow rules block. |
|
|
@@ -374,7 +376,7 @@ ISSUE-005 P3-10 で明確化された境界:
|
|
|
374
376
|
|---|---|---|
|
|
375
377
|
| `ci:generate-template` | `--preset <id>`(省略時 `standard`) `--type <type>` `--render` `--json` | Generate CI/CD template |
|
|
376
378
|
| `ci:migrate-agents-md` | `--dry-run` `--validate-only` `--json` | Migrate AGENTS.md to pointer format |
|
|
377
|
-
| `ci:auto-refresh-agent-context` | `--dry-run` `--apply` `--json` | Refresh AGENTS.md pointers and CLAUDE.md standard sections |
|
|
379
|
+
| `ci:auto-refresh-agent-context` | `--dry-run` `--apply` `--json` | Refresh AGENTS.md lesson pointers in a dedicated section and CLAUDE.md standard sections without replacing user-owned agent instructions |
|
|
378
380
|
| `refresh-claude-md` | `--dry-run` `--apply` `--json` | Refresh CLAUDE.md while preserving the user-owned section |
|
|
379
381
|
| `p2:check-agent-context` | `--threshold-days <n>` `--json` | Check AGENTS.md / CLAUDE.md freshness |
|
|
380
382
|
| `ci:check-repetition` | `--code <errorCode>` `--reset` `--json` | Detect repetitive errors |
|
|
@@ -8,6 +8,15 @@ This file is the **Single Source of Truth** for all quality configuration in a P
|
|
|
8
8
|
|
|
9
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
10
|
|
|
11
|
+
For agent-assisted changes, preview the intent before editing the config:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx phasegate config:plan --intent l4-strict --dry-run --json
|
|
15
|
+
npx phasegate config:plan --intent quick-mode-strict --dry-run --json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The plan identifies target fields, managed artifacts, commands, validation, risks, and rollback so an agent can explain the change before applying it. <!-- @work-item-id WI-173 -->
|
|
19
|
+
|
|
11
20
|
### Full Reference
|
|
12
21
|
|
|
13
22
|
```jsonc
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
<!-- @work-item-id WI-171 -->
|
|
4
|
+
|
|
5
|
+
Use this page when you want the shortest path from "PhaseGate is installed" to "the next command is obvious".
|
|
6
|
+
|
|
7
|
+
## First Run
|
|
8
|
+
|
|
9
|
+
Start with one question: what kind of repository are you setting up?
|
|
10
|
+
|
|
11
|
+
| Answer | Command | Success state |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| New project with agent hooks | `npx phasegate init --name <project> --agent both --with-husky --with-ci` | `phasegate.config.json`, skills, hooks, agent context files, Husky, and CI targets exist |
|
|
14
|
+
| Existing repository | `npx phasegate install --dry-run` then `npx phasegate install --apply` | Existing hooks/scripts are preserved and `.phasegate/manifest.json` records managed targets |
|
|
15
|
+
| CI-only rollout | `npx phasegate setup:agent --intent ci-only --with-ci --dry-run --json` | The plan explains CI changes without requiring local hooks |
|
|
16
|
+
| Codex-only project | `npx phasegate init --agent codex --with-husky` | `.codex/hooks.json`, `AGENTS.md`, `.codex/skills`, and pre-commit backstop are present |
|
|
17
|
+
| Strict validation rollout | `npx phasegate setup:agent --intent strict --dry-run --json` | The plan lists strict checks, L4 risk, rollback, and validation commands |
|
|
18
|
+
|
|
19
|
+
After any setup path:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx phasegate doctor
|
|
23
|
+
npx phasegate phasegate:check-ready
|
|
24
|
+
npx phasegate validate --layer L2 --format human
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The first successful run is:
|
|
28
|
+
|
|
29
|
+
- `doctor` has no unexpected red finding for the targets you chose.
|
|
30
|
+
- `phasegate:check-ready` exits successfully.
|
|
31
|
+
- L2 validators pass or report only issues you intentionally left for a later rollout.
|
|
32
|
+
- The active agent can read `AGENTS.md` or `CLAUDE.md` and see the PhaseGate managed instructions.
|
|
33
|
+
|
|
34
|
+
## Daily Use
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx phasegate work-items:status --dry-run
|
|
38
|
+
npx phasegate validate --layer L2 --format human
|
|
39
|
+
npx phasegate phasegate:status --json
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use `work-items:status` before commit when a WI is close to completion. Use `phasegate:status --json` when an agent needs machine-readable hook, baseline, and validator health.
|
|
43
|
+
|
|
44
|
+
## Agent Use
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx phasegate setup:agent --dry-run --json
|
|
48
|
+
npx phasegate config:plan --intent codex-hooks --dry-run --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`setup:agent` reads repository setup state and returns missing targets, questions, risk, rollback, and validation steps. `config:plan` maps natural-language change intents such as "enable Codex hooks" or "make L4 stricter" to concrete files, commands, and checks.
|
|
52
|
+
|
|
53
|
+
## CI Use
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx phasegate ci:generate-template --type aidlc-gate --render
|
|
57
|
+
npx phasegate validate --layer all --format ci
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For warning-as-failure rollout, preview the change first:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx phasegate config:plan --intent ci-fail-on-warning --dry-run --json
|
|
64
|
+
```
|
|
@@ -17,7 +17,7 @@ Or add it directly to your `package.json`:
|
|
|
17
17
|
```json
|
|
18
18
|
{
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"phasegate": "^0.152.
|
|
20
|
+
"phasegate": "^0.152.9"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
```
|
|
@@ -38,7 +38,7 @@ npx phasegate init --name <project-name>
|
|
|
38
38
|
|
|
39
39
|
This deploys 30 skills to `skills/`, creates the agent-facing skill links (for example `.claude/skills/` or `.codex/skills/`), and generates `phasegate.config.json`.
|
|
40
40
|
|
|
41
|
-
`init` is the legacy-compatible bootstrap path for new projects. Use `install` when the project may already have hooks, package scripts, or CI files that should be preserved.
|
|
41
|
+
`init` is the legacy-compatible bootstrap path for new projects. It also runs the structured install path for the selected agent target so `CLAUDE.md` and/or `AGENTS.md` receive a PhaseGate managed section. Use `install` when the project may already have hooks, package scripts, or CI files that should be preserved. <!-- @work-item-id WI-174 -->
|
|
42
42
|
|
|
43
43
|
For Codex, project initialization stops at the project boundary. After `npx phasegate init --agent codex`, enable the Codex CLI feature flag manually:
|
|
44
44
|
|
|
@@ -56,7 +56,16 @@ 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 `.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 -->
|
|
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 -->
|
|
60
|
+
|
|
61
|
+
For agent-readable planning before writing files:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx phasegate setup:agent --intent recommended --dry-run --json
|
|
65
|
+
npx phasegate setup:agent --intent strict --with-ci --with-husky --dry-run --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The setup plan includes detected state, questions, planned changes, risks, rollback, and validation commands. <!-- @work-item-id WI-172 -->
|
|
60
69
|
|
|
61
70
|
If a managed update must replace existing custom content, use:
|
|
62
71
|
|
|
@@ -73,7 +82,7 @@ npx phasegate uninstall --dry-run
|
|
|
73
82
|
npx phasegate uninstall --apply
|
|
74
83
|
```
|
|
75
84
|
|
|
76
|
-
`uninstall` reads `.phasegate/manifest.json`, deletes files that PhaseGate created, removes only PhaseGate-managed portions from merged JSON, 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>/`.
|
|
85
|
+
`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 -->
|
|
77
86
|
|
|
78
87
|
After upgrading PhaseGate, reconcile existing managed files with the bundled templates from the new version:
|
|
79
88
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Recipes
|
|
2
|
+
|
|
3
|
+
<!-- @work-item-id WI-171, WI-172, WI-173 -->
|
|
4
|
+
|
|
5
|
+
## First-Run Recipe
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev phasegate
|
|
9
|
+
npx phasegate setup:agent --intent recommended --dry-run --json
|
|
10
|
+
npx phasegate install --apply
|
|
11
|
+
npx phasegate doctor
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Use this when you want an existing repository to keep user-owned hooks, scripts, and CI files. The dry-run explains the managed targets before any file is written.
|
|
15
|
+
|
|
16
|
+
## Retrofit Recipe
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx phasegate setup:agent --intent retrofit --dry-run --json
|
|
20
|
+
npx phasegate install --dry-run
|
|
21
|
+
npx phasegate install --apply
|
|
22
|
+
npx phasegate baseline --dry-run
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use this when a repository already has meaningful history or custom automation. Treat any refused target as an agent-assisted review task instead of forcing it blindly.
|
|
26
|
+
|
|
27
|
+
## Agent Hooks Recipe
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx phasegate setup:agent --intent agent-hooks --agent both --with-husky --dry-run --json
|
|
31
|
+
npx phasegate install --agent both --apply
|
|
32
|
+
codex features enable codex_hooks
|
|
33
|
+
npx phasegate doctor --json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The repository-managed portion covers `.claude/settings.json`, `.codex/hooks.json`, `CLAUDE.md`, `AGENTS.md`, skills links, and the Husky backstop. The Codex user-level feature flag remains a local manual setting.
|
|
37
|
+
|
|
38
|
+
## CI Recipe
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx phasegate setup:agent --intent ci-only --with-ci --dry-run --json
|
|
42
|
+
npx phasegate install --apply
|
|
43
|
+
npx phasegate ci:generate-template --type aidlc-gate --render
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Use this when local hooks are not part of the rollout. The plan still includes validation and rollback steps so the agent can explain what changed.
|
|
47
|
+
|
|
48
|
+
## Strict L4 Recipe
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx phasegate config:plan --intent l4-strict --dry-run --json
|
|
52
|
+
npx phasegate validate --layer L4 --fail-on-warning --format human
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Only enable fail-on-warning after reviewing the drift, consistency, dead-code, pointer, and freshness findings. The plan output identifies the config fields and validations the agent should cite in its change summary.
|
|
56
|
+
|
|
57
|
+
## Configuration Change Recipe
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx phasegate config:plan --intent quick-mode-strict --dry-run --json
|
|
61
|
+
npx phasegate check-change-category --paths <changed-files> --format json
|
|
62
|
+
npx phasegate ci-check --quick --dry-run
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use `config:plan` before changing `phasegate.config.json`. It separates repo-managed artifacts from user-level settings and lists the checks needed after the change.
|
|
@@ -10,7 +10,7 @@ PhaseGate setup is more than `phasegate.config.json`. A healthy installation is
|
|
|
10
10
|
|
|
11
11
|
| Class | Examples | Owner | Lifecycle |
|
|
12
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` |
|
|
13
|
+
| Managed target | `.claude/settings.json`, `.codex/hooks.json`, `CLAUDE.md`, `AGENTS.md`, `.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
14
|
| Configuration | `phasegate.config.json`, `package.json` | User owned, PhaseGate assisted | Created by `init`; `install` may merge scripts/devDependency into `package.json` |
|
|
15
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
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 |
|
|
@@ -22,12 +22,15 @@ PhaseGate setup is more than `phasegate.config.json`. A healthy installation is
|
|
|
22
22
|
`install --apply` and `reconcile --apply` manage only explicit targets. The current structured lifecycle covers:
|
|
23
23
|
|
|
24
24
|
- Agent hook JSON: `.claude/settings.json`, `.codex/hooks.json`
|
|
25
|
+
- Agent context files: `CLAUDE.md` and `AGENTS.md` managed sections. `AGENT.md` singular is not a PhaseGate managed target; treat it as user-owned content or migrate it manually. <!-- @work-item-id WI-174 -->
|
|
25
26
|
- Husky scripts when requested: `.husky/pre-commit`, `.husky/commit-msg`, `.husky/pre-push`
|
|
26
27
|
- CI workflow when requested: `.github/workflows/phasegate-aidlc-gate.yml`
|
|
27
28
|
- Agent skill links: `.claude/skills`, `.codex/skills`
|
|
28
29
|
- Package metadata: PhaseGate scripts and `devDependencies.phasegate` in `package.json`
|
|
29
30
|
- Manifest: `.phasegate/manifest.json`
|
|
30
31
|
|
|
32
|
+
`AGENTS.md` has two PhaseGate sections with separate ownership. `<!-- phasegate:managed-section:start -->` contains standard setup/WI workflow instructions. `<!-- phasegate:lesson-pointers:start -->` is reserved for `ci:auto-refresh-agent-context` lesson pointers. Refreshing lesson pointers must not replace the standard managed section or user-owned content. <!-- @work-item-id WI-174 -->
|
|
33
|
+
|
|
31
34
|
`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
35
|
|
|
33
36
|
## Doctor Findings
|
|
@@ -53,6 +56,23 @@ PhaseGate setup is more than `phasegate.config.json`. A healthy installation is
|
|
|
53
56
|
- `.harness/reports` is a legacy fallback used only when a phase-dependency provider cannot resolve project config.
|
|
54
57
|
- `.phasegate/hook-skip-events.jsonl` records hook bypass/skip observations for diagnosis; it is runtime state, not a managed install target.
|
|
55
58
|
|
|
59
|
+
## Hook Skip Events
|
|
60
|
+
|
|
61
|
+
<!-- @work-item-id WI-166 -->
|
|
62
|
+
|
|
63
|
+
`.phasegate/hook-skip-events.jsonl` is a best-effort JSON Lines runtime log written by agent hooks when a hook intentionally skips or cannot complete its normal validation path. Each record is diagnostic evidence for `phasegate status --json`, not a gate result by itself.
|
|
64
|
+
|
|
65
|
+
Typical fields are:
|
|
66
|
+
|
|
67
|
+
| Field | Meaning |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `hookType` | Hook family, for example `PostToolUse` or `Stop`. |
|
|
70
|
+
| `reason` | Stable skip reason such as disabled hook, reentry detection, timeout, or unsupported native pre-edit path. |
|
|
71
|
+
| `targetPaths` | Files or paths relevant to the hook event when available. |
|
|
72
|
+
| `timestamp` | Event time in ISO format. |
|
|
73
|
+
|
|
74
|
+
Recording is best-effort. A write failure must not change the original hook exit code. Operators should use the latest skip event and counts in `phasegate status --json` to decide whether to run `phasegate doctor`, refresh hooks with `reconcile`, enable Codex hook support, or rely on the L2 pre-commit backstop for edits that native hooks cannot observe before mutation.
|
|
75
|
+
|
|
56
76
|
## Legacy Retirement
|
|
57
77
|
|
|
58
78
|
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.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
<!-- @work-item-id WI-171, WI-172, WI-173 -->
|
|
4
|
+
|
|
5
|
+
Start with:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx phasegate doctor --json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Each finding has a severity, a repair mode, and optional next-step fields.
|
|
12
|
+
|
|
13
|
+
| Field | Meaning |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `severity` | `red` blocks the expected setup state; `warn` needs review but may be acceptable for partial rollout |
|
|
16
|
+
| `repairMode` | `mechanical` can be handled by PhaseGate commands; `ai-assisted` needs an agent to preserve user intent; `manual` needs human review |
|
|
17
|
+
| `repairHint` | Copyable command for mechanical repair |
|
|
18
|
+
| `suggestedSkill` | Agent skill to invoke when a merge or setup choice needs reasoning |
|
|
19
|
+
|
|
20
|
+
## Common Findings
|
|
21
|
+
|
|
22
|
+
| Finding | First action |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `claude-hook-missing` | `npx phasegate install --agent claude --dry-run` |
|
|
25
|
+
| `codex-hook-missing` | `npx phasegate install --agent codex --dry-run` |
|
|
26
|
+
| `husky-pre-commit-missing` | `npx phasegate setup:agent --intent agent-hooks --with-husky --dry-run --json` |
|
|
27
|
+
| `ci-workflow-missing` | `npx phasegate setup:agent --intent ci-only --with-ci --dry-run --json` |
|
|
28
|
+
| agent context drift | `npx phasegate reconcile --dry-run` |
|
|
29
|
+
|
|
30
|
+
## Refused Managed Target
|
|
31
|
+
|
|
32
|
+
If `install`, `reconcile`, or `uninstall` refuses a target, do not immediately force it. Inspect the diff and ask the agent to explain:
|
|
33
|
+
|
|
34
|
+
- which file is repo-managed and which part is user-owned;
|
|
35
|
+
- why the target cannot be merged mechanically;
|
|
36
|
+
- what backup and rollback path will exist if `--force` is used;
|
|
37
|
+
- which validation commands will be run afterward.
|
|
38
|
+
|
|
39
|
+
## Codex Hooks Do Not Fire
|
|
40
|
+
|
|
41
|
+
Check both project and user-level state:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx phasegate doctor --json
|
|
45
|
+
codex features enable codex_hooks
|
|
46
|
+
npx phasegate phasegate:status --json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Native Codex `apply_patch` writes are validated by the pre-commit backstop. Bash-based writes can be blocked before execution when hooks are enabled.
|
|
50
|
+
|
|
51
|
+
## Agent Setup Is Ambiguous
|
|
52
|
+
|
|
53
|
+
Use the planner instead of guessing:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx phasegate setup:agent --intent retrofit --dry-run --json
|
|
57
|
+
npx phasegate config:plan --intent codex-hooks --dry-run --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The planner output is intentionally agent-readable: detected state, questions, planned targets, risks, rollback, and validation commands are all explicit.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
<!-- @work-item-id WI-174 -->
|
|
4
|
+
|
|
5
|
+
<!-- phasegate:managed-section:start -->
|
|
6
|
+
## PhaseGate Managed Instructions
|
|
7
|
+
|
|
8
|
+
### Required Documents
|
|
9
|
+
|
|
10
|
+
- `docs/folder_management_rules.md`
|
|
11
|
+
- `docs/principles/architecture-philosophy.md`
|
|
12
|
+
- `docs/principles/testing-rules.md`
|
|
13
|
+
|
|
14
|
+
### Workflow
|
|
15
|
+
|
|
16
|
+
- Create or update the relevant `docs/inception/**/WI-XXX/` work item before planning, design, implementation, or tests.
|
|
17
|
+
- Reflect accepted design into `docs/product/...` with `@work-item-id WI-XXX` before changing source files.
|
|
18
|
+
- Run the relevant PhaseGate checks after changing docs, source, hooks, skills, or setup artifacts.
|
|
19
|
+
- Do not bypass git hooks unless the user explicitly approves the reason, residual risk, and replacement validation.
|
|
20
|
+
|
|
21
|
+
### Setup State
|
|
22
|
+
|
|
23
|
+
- Agent target: `{{PHASEGATE_AGENT}}`
|
|
24
|
+
- Skill set: `{{PHASEGATE_SKILLS_MODE}}`
|
|
25
|
+
- Workflow mode: `{{PHASEGATE_WORKFLOW}}`
|
|
26
|
+
- Husky hooks: `{{PHASEGATE_HUSKY_STATE}}`
|
|
27
|
+
- CI workflow: `{{PHASEGATE_CI_STATE}}`
|
|
28
|
+
|
|
29
|
+
### Common Commands
|
|
30
|
+
|
|
31
|
+
{{PHASEGATE_COMMANDS}}
|
|
32
|
+
|
|
33
|
+
### Codex Notes
|
|
34
|
+
|
|
35
|
+
- Enable native hook execution with `codex features enable codex_hooks` when Codex hooks are installed.
|
|
36
|
+
- Keep local-only Codex settings outside repository-managed targets unless PhaseGate explicitly reports them as managed.
|
|
37
|
+
<!-- phasegate:managed-section:end -->
|
|
38
|
+
|
|
39
|
+
<!-- phasegate:lesson-pointers:start -->
|
|
40
|
+
<!-- lesson pointers are managed by phasegate ci:auto-refresh-agent-context -->
|
|
41
|
+
<!-- phasegate:lesson-pointers:end -->
|
|
42
|
+
|
|
43
|
+
<!-- phasegate:user-section:start -->
|
|
44
|
+
Project-specific agent instructions go here.
|
|
45
|
+
<!-- phasegate:user-section:end -->
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# CLAUDE.md
|
|
2
2
|
|
|
3
|
+
<!-- @work-item-id WI-174 -->
|
|
4
|
+
|
|
5
|
+
<!-- phasegate:managed-section:start -->
|
|
3
6
|
## 必読ドキュメント
|
|
4
7
|
|
|
5
8
|
- `docs/folder_management_rules.md`
|
|
@@ -27,3 +30,4 @@
|
|
|
27
30
|
## Agent Context Refresh
|
|
28
31
|
|
|
29
32
|
Run `phasegate ci:auto-refresh-agent-context --dry-run` to preview updates and `phasegate ci:auto-refresh-agent-context --apply` to write AGENTS.md / CLAUDE.md.
|
|
33
|
+
<!-- phasegate:managed-section:end -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @layer infrastructure
|
|
3
3
|
* @unit ci-governance
|
|
4
|
+
* @work-item-id WI-174
|
|
4
5
|
*
|
|
5
6
|
* AgentsMdPort実装(AGENTS.mdファイルI/O)
|
|
6
7
|
*/
|
|
@@ -13,6 +14,7 @@ import { PointerEntry } from '../../domain/value-objects/pointer-entry.js';
|
|
|
13
14
|
|
|
14
15
|
export class AgentsMdFileAdapter implements AgentsMdPort {
|
|
15
16
|
private readonly filePath: string;
|
|
17
|
+
private lastReadContent: string | null = null;
|
|
16
18
|
|
|
17
19
|
constructor(baseDir: string) {
|
|
18
20
|
this.filePath = path.join(baseDir, 'AGENTS.md');
|
|
@@ -21,8 +23,10 @@ export class AgentsMdFileAdapter implements AgentsMdPort {
|
|
|
21
23
|
async read(): Promise<AgentsMdPointer> {
|
|
22
24
|
try {
|
|
23
25
|
const content = await fs.readFile(this.filePath, 'utf-8');
|
|
26
|
+
this.lastReadContent = content;
|
|
24
27
|
return this.parseAgentsMd(content);
|
|
25
28
|
} catch {
|
|
29
|
+
this.lastReadContent = null;
|
|
26
30
|
return AgentsMdPointer.create();
|
|
27
31
|
}
|
|
28
32
|
}
|
|
@@ -36,7 +40,7 @@ export class AgentsMdFileAdapter implements AgentsMdPort {
|
|
|
36
40
|
before = 0;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
const content = this.serializeAgentsMd(pointer);
|
|
43
|
+
const content = this.serializeAgentsMd(pointer, this.lastReadContent ?? null);
|
|
40
44
|
await fs.writeFile(this.filePath, content, 'utf-8');
|
|
41
45
|
const after = content.split('\n').length;
|
|
42
46
|
|
|
@@ -81,11 +85,28 @@ export class AgentsMdFileAdapter implements AgentsMdPort {
|
|
|
81
85
|
return AgentsMdPointer.create(pointers, adrLinks);
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
private serializeAgentsMd(pointer: AgentsMdPointer): string {
|
|
85
|
-
const
|
|
88
|
+
private serializeAgentsMd(pointer: AgentsMdPointer, existing: string | null): string {
|
|
89
|
+
const section = this.serializeLessonPointerSection(pointer);
|
|
90
|
+
if (existing !== null && existing.trim().length > 0) {
|
|
91
|
+
const start = '<!-- phasegate:lesson-pointers:start -->';
|
|
92
|
+
const end = '<!-- phasegate:lesson-pointers:end -->';
|
|
93
|
+
const pattern = new RegExp(`${this.escapeRegExp(start)}[\\s\\S]*?${this.escapeRegExp(end)}`);
|
|
94
|
+
if (pattern.test(existing)) {
|
|
95
|
+
return existing.replace(pattern, section.trim()).replace(/\s*$/, '\n');
|
|
96
|
+
}
|
|
97
|
+
return `${existing.replace(/\s*$/, '\n\n')}${section}`;
|
|
98
|
+
}
|
|
99
|
+
return ['# AGENTS.md', '', section].join('\n');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private serializeLessonPointerSection(pointer: AgentsMdPointer): string {
|
|
103
|
+
const lines: string[] = [
|
|
104
|
+
'<!-- phasegate:lesson-pointers:start -->',
|
|
105
|
+
'## PhaseGate Lesson Pointers',
|
|
106
|
+
'',
|
|
107
|
+
];
|
|
86
108
|
|
|
87
109
|
if (pointer.pointers.length > 0) {
|
|
88
|
-
lines.push('## Pointers', '');
|
|
89
110
|
for (const entry of pointer.pointers) {
|
|
90
111
|
if (entry.isCommand()) {
|
|
91
112
|
lines.push(`- [cmd:${entry.key}](${entry.command ?? ''}) ${entry.description}`);
|
|
@@ -97,13 +118,18 @@ export class AgentsMdFileAdapter implements AgentsMdPort {
|
|
|
97
118
|
}
|
|
98
119
|
|
|
99
120
|
if (pointer.adrLinks.length > 0) {
|
|
100
|
-
lines.push('
|
|
121
|
+
lines.push('### ADR Links', '');
|
|
101
122
|
for (const adr of pointer.adrLinks) {
|
|
102
123
|
lines.push(`- ADR: ${adr}`);
|
|
103
124
|
}
|
|
104
125
|
lines.push('');
|
|
105
126
|
}
|
|
106
127
|
|
|
128
|
+
lines.push('<!-- phasegate:lesson-pointers:end -->', '');
|
|
107
129
|
return lines.join('\n');
|
|
108
130
|
}
|
|
131
|
+
|
|
132
|
+
private escapeRegExp(value: string): string {
|
|
133
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
134
|
+
}
|
|
109
135
|
}
|