@dzhechkov/p-replicator 1.5.6 → 1.5.8
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/LICENSE +21 -0
- package/README/eng/01_quickstart.md +244 -0
- package/README/eng/02_user_guide.md +634 -0
- package/README/eng/03_admin_guide.md +333 -0
- package/README/eng/04_api_reference.md +302 -0
- package/README/eng/05_architecture.md +370 -0
- package/README/eng/06_troubleshooting.md +353 -0
- package/README/eng/07_changelog.md +134 -0
- package/README/eng/README.md +60 -0
- package/README/ru/01_quickstart.md +244 -0
- package/README/ru/02_user_guide.md +633 -0
- package/README/ru/03_admin_guide.md +337 -0
- package/README/ru/04_api_reference.md +333 -0
- package/README/ru/05_architecture.md +372 -0
- package/README/ru/06_troubleshooting.md +355 -0
- package/README/ru/07_changelog.md +146 -0
- package/README/ru/README.md +60 -0
- package/README/ru/html/build.js +553 -0
- package/README/ru/html/index.html +1312 -0
- package/README/ru/html/script.js +496 -0
- package/README/ru/html/style.css +804 -0
- package/bin/cli.js +0 -0
- package/package.json +10 -10
- package/src/cli.js +7 -1
- package/src/commands/init.js +4 -1
- package/templates/.claude/agents/replicate-coordinator.md +23 -21
- package/templates/.claude/commands/replicate.md +4 -2
- package/templates/.claude/rules/replicate-pipeline.md +16 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/03-generate-p0.md +15 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/04-generate-p1.md +20 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/README.md +11 -0
- package/templates/.claude/skills/goap-research-ed25519/SKILL.md +3 -0
- package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +3 -0
- package/templates/.claude/skills/reverse-engineering-unicorn/SKILL.md +3 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# 03. Admin Guide
|
|
2
|
+
|
|
3
|
+
For users who want to understand and customize the `p-replicator`
|
|
4
|
+
infrastructure: hooks, statusline, settings.json, insights, roadmap.
|
|
5
|
+
|
|
6
|
+
## settings.json — main configuration
|
|
7
|
+
|
|
8
|
+
**Location:** `.claude/settings.json` in the project root.
|
|
9
|
+
|
|
10
|
+
**Default structure (after init):**
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
15
|
+
"_comment": "Default hooks + statusline shipped by @dzhechkov/p-replicator init.",
|
|
16
|
+
"statusLine": {
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "node .claude/hooks/statusline.cjs"
|
|
19
|
+
},
|
|
20
|
+
"hooks": {
|
|
21
|
+
"SessionStart": [
|
|
22
|
+
{
|
|
23
|
+
"matcher": "*",
|
|
24
|
+
"hooks": [
|
|
25
|
+
{ "type": "command", "command": "node .claude/hooks/session-insights.cjs", "timeout": 5 }
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"Stop": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "*",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{ "type": "command", "command": "node .claude/hooks/autocommit-roadmap.cjs", "timeout": 10 },
|
|
34
|
+
{ "type": "command", "command": "node .claude/hooks/autocommit-insights.cjs", "timeout": 10 },
|
|
35
|
+
{ "type": "command", "command": "node .claude/hooks/autocommit-plans.cjs", "timeout": 10 }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Customization:** add new hooks or event types — they will be **preserved**
|
|
44
|
+
on `init --force` or `update` thanks to merge logic (`mergeSettingsJson` +
|
|
45
|
+
`removeOrphanHooks`).
|
|
46
|
+
|
|
47
|
+
**Full reset to defaults:**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx @dzhechkov/p-replicator init --force --reset-settings
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Hooks — lifecycle
|
|
56
|
+
|
|
57
|
+
`p-replicator` ships **6 cross-platform Node scripts** in `.claude/hooks/`:
|
|
58
|
+
|
|
59
|
+
| Hook | Event | Purpose |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `session-insights.cjs` | SessionStart | Inject 3 recent insights from `.claude/insights/index.md` to stdout (Claude Code captures) |
|
|
62
|
+
| `autocommit-roadmap.cjs` | Stop | Auto-commit `.claude/feature-roadmap.json` if changed |
|
|
63
|
+
| `autocommit-insights.cjs` | Stop | Auto-commit `.claude/insights/` if changed |
|
|
64
|
+
| `autocommit-plans.cjs` | Stop | Auto-commit `docs/plans/` if changed |
|
|
65
|
+
| `statusline.cjs` | (statusLine) | Multi-line dashboard above the prompt |
|
|
66
|
+
| `state-update.cjs` | (utility) | Argv-driven helper for writing `.claude/.p-replicator-state.json` |
|
|
67
|
+
|
|
68
|
+
**Cross-platform discipline:** all 4 autocommit scripts use
|
|
69
|
+
`execFileSync('git', [...])` (no shell pipes, no `2>/dev/null`/`|| true`).
|
|
70
|
+
Works identically on Windows-cmd, bash, PowerShell.
|
|
71
|
+
|
|
72
|
+
**Each script is defensive:** wrapped in try/catch, always exits 0
|
|
73
|
+
(best-effort, never blocks the session).
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Statusline — dashboard
|
|
78
|
+
|
|
79
|
+
**What it shows (6 lines):**
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
P-Replicator V1.5.0 ● user │ Sonnet 4.7
|
|
83
|
+
🚀 Pipeline /<cmd> ▓▓▓░░░░ 50% │ Phase: VALIDATE (2/4) │ Last: /replicate
|
|
84
|
+
🎯 Roadmap [●●●○○○○○] mvp 3/8 │ Done 5/12 │ ▶ auth-jwt │ Domain: banking
|
|
85
|
+
📊 SPARC ●11/11 │ 🟢 78/100 │ Plans ●3 │ ADRs ●2 │ Harvest 2026-05-05
|
|
86
|
+
🛠️ Toolkit Skills ●10/10 │ Cmds ●11/11 │ Agents ●4+3 │ Rules ●5+2 │ Hooks ●6/6
|
|
87
|
+
💡 Insights ●12 (2026-05-06) │ Tests 85/85 ✓ │ MCP ●1/1 │ Settings ✓ │ 🧬 Keysarium ✓
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Sources (heuristic + state-file):**
|
|
91
|
+
|
|
92
|
+
| Metric | Source |
|
|
93
|
+
|---|---|
|
|
94
|
+
| Pipeline command + phase + progress | `.claude/.p-replicator-state.json` |
|
|
95
|
+
| Roadmap progress | `.claude/feature-roadmap.json` |
|
|
96
|
+
| SPARC count | `docs/{PRD,Architecture,...}.md` |
|
|
97
|
+
| Validation score | regex extract from `docs/validation-report.md` |
|
|
98
|
+
| Plans count | `docs/plans/*.md` |
|
|
99
|
+
| ADRs count | `docs/ADR.md` H2/H3 headings, or `docs/adr/*.md`, or `docs/ddd/adr/*.md` |
|
|
100
|
+
| Insights count + last date | `## YYYY-MM-DD` in `.claude/insights/index.md` |
|
|
101
|
+
| Toolkit counts | filesystem walks of `.claude/{skills,commands,agents,rules,hooks}/` |
|
|
102
|
+
| Settings status | deep-equals current vs `manifest.shippedDefaults` |
|
|
103
|
+
| MCP servers | `.mcp.json` |
|
|
104
|
+
| Domain | keyword grep in `CLAUDE.md` |
|
|
105
|
+
| Last harvest | `TOOLKIT_HARVEST.md` mtime |
|
|
106
|
+
| Last test | optional `.claude/.last-test.json` cache |
|
|
107
|
+
|
|
108
|
+
**Stale state:** state file older than 30 minutes is ignored (Pipeline
|
|
109
|
+
section shows `idle`).
|
|
110
|
+
|
|
111
|
+
**Defensive design:** every section wrapped in `safeRun()` with fallback —
|
|
112
|
+
one parse error doesn't break the whole status bar.
|
|
113
|
+
|
|
114
|
+
**Disable statusline:**
|
|
115
|
+
|
|
116
|
+
Remove the `statusLine` field from `.claude/settings.json`. On next
|
|
117
|
+
`update` with merge logic, the deletion is preserved.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## State file for live progress
|
|
122
|
+
|
|
123
|
+
`.claude/.p-replicator-state.json` — ephemeral state, updated by commands
|
|
124
|
+
during pipeline execution:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"currentCommand": "/feature",
|
|
129
|
+
"currentPhase": {
|
|
130
|
+
"name": "VALIDATE",
|
|
131
|
+
"index": 2,
|
|
132
|
+
"total": 4,
|
|
133
|
+
"progress": 0.5
|
|
134
|
+
},
|
|
135
|
+
"lastCommand": "/replicate",
|
|
136
|
+
"lastFeature": "auth-jwt",
|
|
137
|
+
"updatedAt": "2026-05-07T..."
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Updated via `state-update.cjs`:**
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
node .claude/hooks/state-update.cjs \
|
|
145
|
+
--command /feature \
|
|
146
|
+
--phase VALIDATE \
|
|
147
|
+
--index 2 \
|
|
148
|
+
--total 4 \
|
|
149
|
+
--progress 0.5
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Pipeline commands optionally call this script (via Bash tool) so statusline
|
|
153
|
+
shows real progress.
|
|
154
|
+
|
|
155
|
+
**⚠️ Known limitation:** this file is not auto-gitignored. Recommended:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
echo ".claude/.p-replicator-state.json" >> .gitignore
|
|
159
|
+
echo ".claude/.last-test.json" >> .gitignore
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
See `KNOWN_LIMITATIONS.md` item L5.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Insights system
|
|
167
|
+
|
|
168
|
+
**Storage:** `.claude/insights/index.md` (markdown log).
|
|
169
|
+
|
|
170
|
+
**Entry format:**
|
|
171
|
+
|
|
172
|
+
```markdown
|
|
173
|
+
## YYYY-MM-DD — short title
|
|
174
|
+
|
|
175
|
+
**Tags:** tag1, tag2, tag3
|
|
176
|
+
|
|
177
|
+
**Problem:**
|
|
178
|
+
What happened (1-3 sentences).
|
|
179
|
+
|
|
180
|
+
**Solution:**
|
|
181
|
+
What fixed it (1-5 sentences with code if relevant).
|
|
182
|
+
|
|
183
|
+
**References:** file:line or commit hash or external link
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Lifecycle:**
|
|
189
|
+
|
|
190
|
+
- ≤ 50 entries → single `index.md`
|
|
191
|
+
- > 50 → split into archive `<YYYY-MM>.md` with `index.md` as TOC
|
|
192
|
+
- Never delete — only supersede via `**Status:** superseded by <link>`
|
|
193
|
+
|
|
194
|
+
**Tag conventions:**
|
|
195
|
+
- ✅ `prisma-migration`, `postgres-timezone`, `docker-compose-network`
|
|
196
|
+
- ❌ `bug`, `fix`, `important` (too generic — recall fails)
|
|
197
|
+
|
|
198
|
+
**Auto-injection via SessionStart hook** — described above.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Roadmap management
|
|
203
|
+
|
|
204
|
+
**File:** `.claude/feature-roadmap.json` (generated in `/replicate` Phase 3
|
|
205
|
+
from PRD MVP scope, or by hand).
|
|
206
|
+
|
|
207
|
+
**Schema (post v1.5.0):**
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"version": "1.0",
|
|
212
|
+
"features": [
|
|
213
|
+
{
|
|
214
|
+
"id": "auth-jwt",
|
|
215
|
+
"number": 1,
|
|
216
|
+
"branch": "feature/001-auth-jwt",
|
|
217
|
+
"name": "JWT-based authentication",
|
|
218
|
+
"priority": "mvp",
|
|
219
|
+
"status": "next",
|
|
220
|
+
"complexity": "medium",
|
|
221
|
+
"estimated_hours": "2-4",
|
|
222
|
+
"blockers": [],
|
|
223
|
+
"expected_files": ["packages/backend/src/auth/jwt.ts"],
|
|
224
|
+
"depends_on": []
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Lifecycle states:**
|
|
231
|
+
- `planned` → not yet prioritized
|
|
232
|
+
- `next` → next in queue (picked by `/next`)
|
|
233
|
+
- `in_progress` → actively being worked
|
|
234
|
+
- `done` → implemented
|
|
235
|
+
- `blocked` → waiting on `depends_on` or manual fix
|
|
236
|
+
|
|
237
|
+
**`number` and `branch`** are populated by `--feature-branches` flag in
|
|
238
|
+
`/run` or `/go`.
|
|
239
|
+
|
|
240
|
+
**Auto-commit** via `autocommit-roadmap.cjs` (Stop hook) on changes.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Doctor + Verify — two distinct tools
|
|
245
|
+
|
|
246
|
+
| Tool | Checks | When |
|
|
247
|
+
|---|---|---|
|
|
248
|
+
| `npx @dzhechkov/p-replicator doctor` | Pre-shipped contract: 10 skills + 11 commands + 4 agents + 5 rules + settings.json + 6 hooks + git on PATH | After init / when something seems broken |
|
|
249
|
+
| `npx @dzhechkov/p-replicator verify` | Pre-shipped + post-/replicate hints (CLAUDE.md, planner.md, security.md, feature-roadmap.json, etc.) | After every `/replicate` to confirm |
|
|
250
|
+
|
|
251
|
+
**`doctor` exit codes:**
|
|
252
|
+
- `0` — all good
|
|
253
|
+
- `1` — something must-have is missing (run `init --force` to repair)
|
|
254
|
+
|
|
255
|
+
**`verify` exit codes:**
|
|
256
|
+
- `0` — pre-shipped contract OK (may have warnings about project-specific)
|
|
257
|
+
- `1` — pre-shipped contract violated
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Update workflow
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Safe upgrade with preserved customizations:
|
|
265
|
+
npx @dzhechkov/p-replicator@latest update
|
|
266
|
+
|
|
267
|
+
# Or via init --force (also preserves customizations):
|
|
268
|
+
npx @dzhechkov/p-replicator@latest init --force
|
|
269
|
+
|
|
270
|
+
# Full reset of settings.json to defaults:
|
|
271
|
+
npx @dzhechkov/p-replicator@latest init --force --reset-settings
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**What the merge logic does:**
|
|
275
|
+
1. Reads `manifest.shippedDefaults['settings.json']` (what we shipped previously)
|
|
276
|
+
2. Reads current `templates/.claude/settings.json` (new template)
|
|
277
|
+
3. Reads `.claude/settings.json` (user's current)
|
|
278
|
+
4. **Orphan detection:** removes hooks present in old template but missing in new
|
|
279
|
+
5. **Merge:** adds hooks from new template that aren't already in user's current
|
|
280
|
+
6. User-added hooks (never in old template) are **preserved**
|
|
281
|
+
|
|
282
|
+
**Identity model:** hooks are compared by `command` string. User-modified
|
|
283
|
+
default (changed command) → treated as user-added, preserved.
|
|
284
|
+
|
|
285
|
+
See algorithm details in [05_architecture.md](./05_architecture.md).
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## MCP servers
|
|
290
|
+
|
|
291
|
+
**File:** `.mcp.json` (project-local).
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"mcpServers": {
|
|
296
|
+
"filesystem": {
|
|
297
|
+
"command": "npx",
|
|
298
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
|
|
299
|
+
},
|
|
300
|
+
"github": {
|
|
301
|
+
"command": "npx",
|
|
302
|
+
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
303
|
+
"env": { "GITHUB_TOKEN": "..." }
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Statusline shows MCP server count in the Status line.
|
|
310
|
+
|
|
311
|
+
`/replicate` Phase 3 auto-generates `.mcp.json` when external integrations
|
|
312
|
+
are detected.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Keysarium integration
|
|
317
|
+
|
|
318
|
+
If `.keysarium.json` (from sibling `@dzhechkov/keysarium` package) is
|
|
319
|
+
detected:
|
|
320
|
+
|
|
321
|
+
- `init` shows an integration banner
|
|
322
|
+
- Statusline shows `🧬 Keysarium ✓`
|
|
323
|
+
- `/replicate` Phase 3 doesn't duplicate skills already provided by Keysarium
|
|
324
|
+
|
|
325
|
+
Keysarium docs are in its own package.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Next
|
|
330
|
+
|
|
331
|
+
- [04_api_reference.md](./04_api_reference.md) — formal schemas
|
|
332
|
+
- [05_architecture.md](./05_architecture.md) — internal design
|
|
333
|
+
- [06_troubleshooting.md](./06_troubleshooting.md) — common issues
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# 04. API Reference
|
|
2
|
+
|
|
3
|
+
Formal reference: CLI commands, flags, JSON schemas.
|
|
4
|
+
|
|
5
|
+
## CLI: `npx @dzhechkov/p-replicator`
|
|
6
|
+
|
|
7
|
+
### Subcommands
|
|
8
|
+
|
|
9
|
+
| Subcommand | Purpose | Exit code |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `init` (default) | Install package in project | `0` ok, `1` if already installed without `--force` |
|
|
12
|
+
| `update` | Upgrade files to new version | `0` ok, `1` if not installed |
|
|
13
|
+
| `remove` | Delete package-tracked files | `0` ok, `1` if not installed |
|
|
14
|
+
| `list` | List installed components | `0` |
|
|
15
|
+
| `doctor` | Health check of pre-shipped contract | `0` ok, `1` if anything broken |
|
|
16
|
+
| `verify` | Pre-shipped + post-/replicate verification | `0` ok, `1` if pre-shipped contract violated |
|
|
17
|
+
|
|
18
|
+
### Global flags
|
|
19
|
+
|
|
20
|
+
| Flag | Where it works | Description |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `--force` | `init` | Overwrite existing files (with merge logic for settings.json) |
|
|
23
|
+
| `--dry-run` | `init`, `update`, `remove` | Preview without writing to disk |
|
|
24
|
+
| `--reset-settings` | `init --force`, `update` | Full overwrite of settings.json (disables merge) |
|
|
25
|
+
| `--help`, `-h` | any | Show help |
|
|
26
|
+
| `--version`, `-v` | any | Show package version |
|
|
27
|
+
|
|
28
|
+
### Slash command flags (inside Claude Code)
|
|
29
|
+
|
|
30
|
+
| Flag | Where | Description |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `--feature-branches` | `/run`, `/go` | Each feature on its own branch `feature/{NNN}-{id}` |
|
|
33
|
+
| `--auto-merge` | `/run`, `/go` (with `--feature-branches`) | Auto-merge feature branch into main on success |
|
|
34
|
+
| `--skip-tests` | `/start` | Skip test generation |
|
|
35
|
+
| `--skip-seed` | `/start` | Skip DB seeding |
|
|
36
|
+
| `--dry-run` | `/start`, `/replicate` | Preview without writing |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Manifest schema (`.p-replicator.json`)
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"version": "1.5.0",
|
|
45
|
+
"installedAt": "2026-05-07T12:00:00.000Z",
|
|
46
|
+
"components": ["agents", "commands", "hooks", "rules", "settings", "skills"],
|
|
47
|
+
"files": [
|
|
48
|
+
".claude/agents/doc-validator.md",
|
|
49
|
+
".claude/commands/replicate.md",
|
|
50
|
+
"...sorted list of all installed files..."
|
|
51
|
+
],
|
|
52
|
+
"shippedDefaults": {
|
|
53
|
+
"settings.json": {
|
|
54
|
+
"hooks": { "SessionStart": [...], "Stop": [...] },
|
|
55
|
+
"statusLine": { "type": "command", "command": "..." }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Field | Type | Purpose |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `version` | semver | Package version at last install/update |
|
|
64
|
+
| `installedAt` | ISO-8601 | Timestamp of last install |
|
|
65
|
+
| `components` | array of group keys | Pre-shipped groups |
|
|
66
|
+
| `files` | sorted array | All package-tracked files (for `remove`) |
|
|
67
|
+
| `shippedDefaults` | optional map | Template snapshots for orphan detection on upgrade |
|
|
68
|
+
|
|
69
|
+
**Backward compat:** manifest without `shippedDefaults` (pre-1.4.3) loads
|
|
70
|
+
without error — orphan detection is skipped on first upgrade.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Roadmap schema (`.claude/feature-roadmap.json`)
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"version": "1.0",
|
|
79
|
+
"features": [
|
|
80
|
+
{
|
|
81
|
+
"id": "auth-jwt",
|
|
82
|
+
"number": 1,
|
|
83
|
+
"branch": "feature/001-auth-jwt",
|
|
84
|
+
"name": "JWT-based authentication",
|
|
85
|
+
"priority": "mvp",
|
|
86
|
+
"status": "next",
|
|
87
|
+
"complexity": "medium",
|
|
88
|
+
"estimated_hours": "2-4",
|
|
89
|
+
"blockers": [],
|
|
90
|
+
"expected_files": ["packages/backend/src/auth/jwt.ts"],
|
|
91
|
+
"depends_on": []
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Feature fields
|
|
98
|
+
|
|
99
|
+
| Field | Required | Type | Populated by | Purpose |
|
|
100
|
+
|-------|----------|------|--------------|---------|
|
|
101
|
+
| `id` | yes | kebab-case slug | initial generation | Stable identifier |
|
|
102
|
+
| `number` | optional | int | `--feature-branches` flag | Sequential 1..N for branch naming |
|
|
103
|
+
| `branch` | optional | string | `--feature-branches` after success | `feature/{NNN}-{id}` actual ref |
|
|
104
|
+
| `name` | recommended | string | initial generation | Human-readable title |
|
|
105
|
+
| `priority` | yes | enum | initial generation | `mvp` \| `high` \| `medium` \| `low` |
|
|
106
|
+
| `status` | yes | enum | lifecycle | `planned` \| `next` \| `in_progress` \| `done` \| `blocked` |
|
|
107
|
+
| `complexity` | optional | enum | initial generation | `simple` \| `medium` \| `complex` |
|
|
108
|
+
| `estimated_hours` | optional | string | initial generation | Time hint |
|
|
109
|
+
| `blockers` | optional | string[] | manual | Issue IDs |
|
|
110
|
+
| `expected_files` | optional | string[] | initial generation | Used by `/next update` for completion detection |
|
|
111
|
+
| `depends_on` | optional | string[] | initial generation | Feature IDs that must complete first |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## State file schema (`.claude/.p-replicator-state.json`)
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"currentCommand": "/feature",
|
|
120
|
+
"currentPhase": {
|
|
121
|
+
"name": "VALIDATE",
|
|
122
|
+
"index": 2,
|
|
123
|
+
"total": 4,
|
|
124
|
+
"progress": 0.5
|
|
125
|
+
},
|
|
126
|
+
"lastCommand": "/replicate",
|
|
127
|
+
"lastFeature": "auth-jwt",
|
|
128
|
+
"updatedAt": "2026-05-07T..."
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
| Field | Type | Purpose |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `currentCommand` | `/<name>` | Active command (`null` if idle) |
|
|
135
|
+
| `currentPhase` | object | Live progress in current command |
|
|
136
|
+
| `currentPhase.name` | string | Phase name (e.g., `VALIDATE`) |
|
|
137
|
+
| `currentPhase.index` | int | Current phase 1..total |
|
|
138
|
+
| `currentPhase.total` | int | Total phases |
|
|
139
|
+
| `currentPhase.progress` | float 0..1 | Progress within current phase |
|
|
140
|
+
| `lastCommand` | `/<name>` | Previous command (for status) |
|
|
141
|
+
| `lastFeature` | string | ID of last implemented feature |
|
|
142
|
+
| `updatedAt` | ISO-8601 | Timestamp |
|
|
143
|
+
|
|
144
|
+
**Stale check:** statusline ignores state older than 30 minutes.
|
|
145
|
+
|
|
146
|
+
**Update API:**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
node .claude/hooks/state-update.cjs \
|
|
150
|
+
--command /feature \
|
|
151
|
+
--phase VALIDATE \
|
|
152
|
+
--index 2 \
|
|
153
|
+
--total 4 \
|
|
154
|
+
--progress 0.5 \
|
|
155
|
+
--last-command /replicate \
|
|
156
|
+
--last-feature auth-jwt
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Or with full JSON:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
node .claude/hooks/state-update.cjs --json '{"currentCommand":"/run", ...}'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## settings.json structure
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
172
|
+
"_comment": "Description",
|
|
173
|
+
"statusLine": {
|
|
174
|
+
"type": "command",
|
|
175
|
+
"command": "node .claude/hooks/statusline.cjs"
|
|
176
|
+
},
|
|
177
|
+
"hooks": {
|
|
178
|
+
"SessionStart": [ /* matchers + hooks */ ],
|
|
179
|
+
"Stop": [ /* matchers + hooks */ ],
|
|
180
|
+
"PreToolUse": [ /* user-added */ ],
|
|
181
|
+
"PostToolUse": [ /* user-added */ ]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `statusLine` field
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"statusLine": {
|
|
191
|
+
"type": "command", // only "command" supported
|
|
192
|
+
"command": "node .claude/hooks/statusline.cjs"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Script writes multi-line ANSI output to stdout. Remove the field to disable
|
|
198
|
+
statusline (merge preserves the deletion on upgrade).
|
|
199
|
+
|
|
200
|
+
### `hooks.<EventType>` array
|
|
201
|
+
|
|
202
|
+
Each entry:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"matcher": "*", // or regex for tool-name
|
|
207
|
+
"hooks": [
|
|
208
|
+
{
|
|
209
|
+
"type": "command",
|
|
210
|
+
"command": "node .claude/hooks/X.cjs",
|
|
211
|
+
"timeout": 10 // seconds
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Event types in Claude Code:**
|
|
218
|
+
- `SessionStart` — at session start (stdout injected into context)
|
|
219
|
+
- `Stop` — at turn end (side-effects: commit, log)
|
|
220
|
+
- `PreToolUse`, `PostToolUse` — around tool calls
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## COMPONENTS schema (in `src/utils.js`)
|
|
225
|
+
|
|
226
|
+
The contract for what's shipped vs generated:
|
|
227
|
+
|
|
228
|
+
```javascript
|
|
229
|
+
const COMPONENTS = {
|
|
230
|
+
skills: {
|
|
231
|
+
src: '.claude/skills',
|
|
232
|
+
kind: 'pre-shipped',
|
|
233
|
+
label: 'Skills (10 skill packs)',
|
|
234
|
+
group: 'core',
|
|
235
|
+
items: { 'explore': '...', /* ... 10 entries */ },
|
|
236
|
+
},
|
|
237
|
+
commands: { kind: 'pre-shipped', items: { /* 11 */ } },
|
|
238
|
+
agents: { kind: 'pre-shipped', items: { /* 4 */ } },
|
|
239
|
+
rules: { kind: 'pre-shipped', items: { /* 5 */ } },
|
|
240
|
+
settings: { isFile: true, kind: 'pre-shipped', items: { 'settings.json': '...' } },
|
|
241
|
+
hooks: { kind: 'pre-shipped', items: { /* 6 */ } },
|
|
242
|
+
|
|
243
|
+
// Project-generated (created by /replicate Phase 3)
|
|
244
|
+
projectAgents: { kind: 'project-generated', items: { /* full paths */ } },
|
|
245
|
+
projectRules: { kind: 'project-generated', items: { /* full paths */ } },
|
|
246
|
+
projectFiles: { kind: 'project-generated', items: { /* full paths */ } },
|
|
247
|
+
};
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Identity:**
|
|
251
|
+
- `kind: 'pre-shipped'` — installed by `init`, file paths derived from `src` + item key
|
|
252
|
+
- `kind: 'project-generated'` — created by `/replicate` Phase 3, item keys ARE full paths
|
|
253
|
+
- `isFile: true` — single-file component (settings.json), not a directory
|
|
254
|
+
|
|
255
|
+
**Helper:** `utils.getItemRelativePath(comp, itemKey)` centralizes path
|
|
256
|
+
derivation:
|
|
257
|
+
- pre-shipped skills: `<src>/<itemKey>/SKILL.md`
|
|
258
|
+
- pre-shipped hooks: `<src>/<itemKey>.cjs`
|
|
259
|
+
- pre-shipped commands/rules/agents: `<src>/<itemKey>.md`
|
|
260
|
+
- pre-shipped settings.json: `comp.src` (full path)
|
|
261
|
+
- project-generated: `itemKey` (already full path)
|
|
262
|
+
|
|
263
|
+
Used by `verify`, `doctor`, `list` for uniform path resolution.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Hook scripts API
|
|
268
|
+
|
|
269
|
+
### `session-insights.cjs`
|
|
270
|
+
|
|
271
|
+
**Trigger:** `SessionStart` hook.
|
|
272
|
+
**Reads:** `.claude/insights/index.md` (`## YYYY-MM-DD` headings)
|
|
273
|
+
**Writes:** stdout (Claude Code injects into session context)
|
|
274
|
+
**Output:** up to 3 recent insights as `## Recent project insights\n\n## ... ## ... ## ...`
|
|
275
|
+
|
|
276
|
+
### `autocommit-roadmap.cjs` / `autocommit-insights.cjs` / `autocommit-plans.cjs`
|
|
277
|
+
|
|
278
|
+
**Trigger:** `Stop` hook.
|
|
279
|
+
**Reads:** target paths
|
|
280
|
+
**Side-effect:** `git add` + `git diff --cached --quiet` check + `git commit --only` if changed
|
|
281
|
+
**stdout/stderr:** suppressed
|
|
282
|
+
**Always exits 0** (best-effort)
|
|
283
|
+
|
|
284
|
+
### `statusline.cjs`
|
|
285
|
+
|
|
286
|
+
**Trigger:** Claude Code `statusLine` config (every prompt render).
|
|
287
|
+
**Reads:** filesystem heuristics + state-file
|
|
288
|
+
**Writes:** stdout 6-line ANSI output (header + 5 content)
|
|
289
|
+
**Defensive:** every section wrapped in `safeRun()` with fallback
|
|
290
|
+
|
|
291
|
+
### `state-update.cjs`
|
|
292
|
+
|
|
293
|
+
**Invoked:** by pipeline commands via Bash tool
|
|
294
|
+
**Args:** `--command`, `--phase`, `--index`, `--total`, `--progress`, `--last-command`, `--last-feature`, `--json`
|
|
295
|
+
**Writes:** `.claude/.p-replicator-state.json`
|
|
296
|
+
**Always exits 0** (best-effort)
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Next
|
|
301
|
+
|
|
302
|
+
- [05_architecture.md](./05_architecture.md) — internal design details
|