@punks/cli 1.0.6 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -5
- package/README.md +1 -1
- package/dist/data/catalog/hooks.ts +1 -2
- package/dist/data/catalog/lint.ts +7 -21
- package/dist/data/catalog/packs.ts +262 -20
- package/dist/data/catalog/skills.ts +352 -38
- package/dist/data/scripts/sync-subagents.mjs +11 -4
- package/dist/data/subagents/manifest.mjs +15 -49
- package/dist/index.js +14295 -3440
- package/dist/skills/agnostic/debug/debugging-phase/SKILL.md +87 -0
- package/dist/skills/agnostic/docs/docs-ingest-phase/SKILL.md +87 -0
- package/dist/skills/agnostic/docs/docs-ingest-phase/agents/openai.yaml +4 -0
- package/dist/skills/agnostic/docs/{docs-maintenance → docs-ingest-phase}/references/concept-pages.md +1 -1
- package/dist/skills/agnostic/docs/{docs-maintenance → docs-ingest-phase}/references/flow-pages.md +1 -1
- package/dist/skills/agnostic/docs/docs-ingest-phase/references/fumadocs-routing.md +88 -0
- package/dist/skills/agnostic/docs/docs-ingest-phase/references/repo-docs.md +38 -0
- package/dist/skills/agnostic/docs/docs-ingest-phase/references/wiki-ingest.md +131 -0
- package/dist/skills/agnostic/planning/create-plan/SKILL.md +11 -9
- package/dist/skills/agnostic/planning/create-spec/SKILL.md +20 -18
- package/dist/skills/agnostic/planning/delivery-phase/SKILL.md +82 -0
- package/dist/skills/agnostic/planning/goalify/EXAMPLES.md +72 -0
- package/dist/skills/agnostic/planning/goalify/SKILL.md +97 -0
- package/dist/skills/agnostic/planning/implement-spec/SKILL.md +7 -9
- package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +6 -0
- package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +23 -2
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +0 -1
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +0 -3
- package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +5 -7
- package/dist/skills/agnostic/planning/resolve-debt-phase/SKILL.md +87 -0
- package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +4 -3
- package/dist/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +56 -2
- package/dist/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +16 -4
- package/dist/skills/agnostic/requirements/requirements-grill/references/wiki-output.md +6 -2
- package/dist/skills/agnostic/requirements/requirements-phase/SKILL.md +67 -0
- package/dist/skills/agnostic/research/review-phase/SKILL.md +99 -0
- package/package.json +16 -7
- package/dist/data/hooks/format-edited-file.py +0 -157
- package/dist/skills/agnostic/docs/docs-maintenance/SKILL.md +0 -193
- package/dist/skills/agnostic/docs/docs-maintenance/agents/openai.yaml +0 -4
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-reasoning.md +0 -19
- package/docs/README.md +0 -29
- package/docs/reference/dp-requirements.md +0 -225
- package/docs/runbooks/dp-cli-scaffolding.md +0 -261
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requirements-phase
|
|
3
|
+
description: Orchestrates the human-centric requirements phase from ambiguity through requirements-grill artifacts into backlog shape. Use when the user asks to run a requirements phase, move from discovery to backlog, close requirement branches, decide whether backlog writing is ready, or coordinate requirements-grill with write-backlog.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requirements Phase
|
|
7
|
+
|
|
8
|
+
Human-centric discovery wrapper for `requirements-grill -> write-backlog`.
|
|
9
|
+
|
|
10
|
+
Normally do not create or update a formal agent goal. This phase is an interview and decision-closure loop, not execution delivery.
|
|
11
|
+
|
|
12
|
+
## Use when
|
|
13
|
+
|
|
14
|
+
- The user asks for a requirements phase, requirements discovery, or backlog readiness.
|
|
15
|
+
- Ambiguity needs to become grill branches, glossary, axioms, parked scope, and closure decisions.
|
|
16
|
+
- Existing `*-grill-status.md` / `*-grill-log.md` artifacts need to drive backlog/module/epic/story shape.
|
|
17
|
+
- The user wants to know whether to keep grilling, park scope, or write/sync backlog.
|
|
18
|
+
|
|
19
|
+
## Do not use when
|
|
20
|
+
|
|
21
|
+
- The user asks to write `SPEC.md`, `PLAN.md`, implementation notes, code, tests, PRs, or delivery execution.
|
|
22
|
+
- The next step is already an approved spec/plan/implementation task. Use delivery-phase or the specific delivery skill instead.
|
|
23
|
+
- The user wants only a tactical backlog formatting pass from already-closed requirements. Use `write-backlog` directly.
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
1. Establish phase state.
|
|
28
|
+
- Identify the topic, source artifacts, current backlog target/provider, and any explicit scope boundary.
|
|
29
|
+
- If grill artifacts exist, read status first, then log.
|
|
30
|
+
- State assumptions and known unresolved branches tersely.
|
|
31
|
+
|
|
32
|
+
2. Route to `requirements-grill` while decisions are open.
|
|
33
|
+
- Let `requirements-grill` own HITL interviewing.
|
|
34
|
+
- Ask one question at a time with a recommended answer and why.
|
|
35
|
+
- Turn ambiguity into named branches, branch percentages, accepted decisions, rejected/superseded decisions, glossary entries, axioms, and parked scope.
|
|
36
|
+
- Do not write backlog while major branches remain open unless the user explicitly parks them.
|
|
37
|
+
|
|
38
|
+
3. Decide backlog readiness.
|
|
39
|
+
- Backlog-ready means active branches are closed enough for module/epic/story shaping, and unresolved branches are either non-blocking, explicitly parked, or recorded as follow-up scope.
|
|
40
|
+
- If not ready, continue grilling or report the exact blocker branches.
|
|
41
|
+
- If ready, hand off to `write-backlog`.
|
|
42
|
+
|
|
43
|
+
4. Run `write-backlog` only after readiness.
|
|
44
|
+
- Derive modules first, then epics/capabilities, then stories.
|
|
45
|
+
- Use accepted decisions and locked direction only.
|
|
46
|
+
- Preserve parked scope and unresolved items as deferred notes, not silent backlog content.
|
|
47
|
+
- Sync or draft provider payloads only when the user requested backlog write/sync.
|
|
48
|
+
|
|
49
|
+
5. Stop at the requirements boundary.
|
|
50
|
+
- Do not create specs, plans, implementation tasks, or code changes from this phase.
|
|
51
|
+
- Recommend delivery-phase only after backlog state is clear.
|
|
52
|
+
|
|
53
|
+
## Output contract
|
|
54
|
+
|
|
55
|
+
End with one of these states:
|
|
56
|
+
|
|
57
|
+
- `backlog-ready`: branches closed or parked enough; backlog can be written next.
|
|
58
|
+
- `backlog-written`: backlog hierarchy/payloads were produced or synced.
|
|
59
|
+
- `parked`: requirements are intentionally unresolved; parked scope and resume trigger are explicit.
|
|
60
|
+
- `blocked`: named branches still need human decisions before backlog writing.
|
|
61
|
+
|
|
62
|
+
Include:
|
|
63
|
+
|
|
64
|
+
- active, closed, parked, and unresolved branches
|
|
65
|
+
- glossary and axiom changes, if any
|
|
66
|
+
- backlog module/epic/story implications, if known
|
|
67
|
+
- next recommended action: continue grill, write/sync backlog, park, or move to delivery-phase
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-phase
|
|
3
|
+
description: Run a findings-first readonly review phase with explicit entry gates, delegated lenses, artifacts, and validation. Use for review-only goals, manual reviews, PRs, merged branches, external edits, suspicious code, or as the mandatory review wrapper inside delivery-phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review Phase
|
|
7
|
+
|
|
8
|
+
A phase is a wrapper skill: it defines when to enter, when to stop, which inner
|
|
9
|
+
skills to delegate to, what artifacts to produce, and which gates must pass.
|
|
10
|
+
`review-phase` is standalone and readonly by default. Inside `delivery-phase`, it
|
|
11
|
+
is mandatory and may hand findings back to delivery for fixes, debugging, docs,
|
|
12
|
+
or validation because delivery owns completion.
|
|
13
|
+
|
|
14
|
+
## Use When
|
|
15
|
+
|
|
16
|
+
- The user asks for a review, audit, second pass, PR review, suspicious-code check, or review-only goal.
|
|
17
|
+
- Code changed outside this session and needs independent inspection.
|
|
18
|
+
- A branch was merged, rebased, generated, or edited externally and needs confirmation.
|
|
19
|
+
- `delivery-phase` reaches its mandatory review gate.
|
|
20
|
+
- The desired output is findings, risks, missing tests, or recommended next actions.
|
|
21
|
+
|
|
22
|
+
## Do Not Use When
|
|
23
|
+
|
|
24
|
+
- The user asks directly for implementation with no review gate.
|
|
25
|
+
- The task is pure planning, requirements grilling, or docs writing with no artifact to review.
|
|
26
|
+
- You need to edit code immediately; ask for or enter an owning delivery/debug/fix phase instead.
|
|
27
|
+
- The review target is undefined and cannot be inferred from branch, diff, issue, PR, or user prompt.
|
|
28
|
+
|
|
29
|
+
## Entry Contract
|
|
30
|
+
|
|
31
|
+
1. Identify the review target: diff, PR, branch range, files, spec, plan, docs, or runtime evidence.
|
|
32
|
+
2. State scope and readonly posture. If scope is ambiguous, ask one clarifying question.
|
|
33
|
+
3. Read local guidance in checked directories, especially relevant `AGENTS.md` files under apps, packages, docs, or nested ownership boundaries.
|
|
34
|
+
4. Choose review lenses and say which are active.
|
|
35
|
+
|
|
36
|
+
## Review Lenses
|
|
37
|
+
|
|
38
|
+
- `parallel-research`: fan out independent readonly checks when scope can split by subsystem, risk, or hypothesis.
|
|
39
|
+
- `simplify`: inspect clarity, overcomplexity, unnecessary abstraction, derivable state, naming, and scope creep.
|
|
40
|
+
- `improve-codebase-architecture`: surface architectural friction, shallow modules, poor boundaries, and module-depth opportunities.
|
|
41
|
+
- Scoped local guidance: apply applicable directory instructions, stack skills, runbooks, and ownership rules discovered in checked paths.
|
|
42
|
+
|
|
43
|
+
Use only the lenses that fit the target. Do not perform ceremonial delegation when a local pass is faster and equally reliable.
|
|
44
|
+
|
|
45
|
+
## Workflow
|
|
46
|
+
|
|
47
|
+
1. Gather evidence:
|
|
48
|
+
- inspect status, diff/range/PR metadata, tests, docs, and relevant local instructions
|
|
49
|
+
- prefer primary artifacts over tracker summaries
|
|
50
|
+
- record exact files and commands consulted
|
|
51
|
+
2. Split if useful:
|
|
52
|
+
- use `parallel-research` for independent readonly checks
|
|
53
|
+
- synthesize before reporting; disagreements need evidence, not vote counting
|
|
54
|
+
3. Review findings-first:
|
|
55
|
+
- prioritize bugs, regressions, broken contracts, missing validation, unsafe assumptions, and user-facing risks
|
|
56
|
+
- include file and line references when available
|
|
57
|
+
- separate blocking findings from improvements and optional cleanup
|
|
58
|
+
4. Apply clarity and architecture lenses:
|
|
59
|
+
- use `simplify` to flag unnecessary concepts or complexity
|
|
60
|
+
- use `improve-codebase-architecture` to flag deeper boundary opportunities, usually as follow-up RFC candidates
|
|
61
|
+
5. Validate:
|
|
62
|
+
- run readonly checks that match the target when safe: tests, typecheck, lint, build, docs link checks, or focused smoke commands
|
|
63
|
+
- if a check cannot run, state why and the residual risk
|
|
64
|
+
6. Stop:
|
|
65
|
+
- standalone mode stops after findings and recommended next actions
|
|
66
|
+
- delivery mode returns findings to `delivery-phase`; delivery decides and performs fixes/debug/docs/validation
|
|
67
|
+
|
|
68
|
+
## Output Contract
|
|
69
|
+
|
|
70
|
+
Lead with findings, ordered by severity. For each finding include:
|
|
71
|
+
|
|
72
|
+
- severity
|
|
73
|
+
- file/line or artifact reference
|
|
74
|
+
- issue and impact
|
|
75
|
+
- evidence
|
|
76
|
+
- recommended action
|
|
77
|
+
|
|
78
|
+
Then include:
|
|
79
|
+
|
|
80
|
+
- open questions or assumptions
|
|
81
|
+
- validation run and result
|
|
82
|
+
- short summary only after findings
|
|
83
|
+
- whether this was standalone readonly review or delivery-owned review
|
|
84
|
+
|
|
85
|
+
If there are no findings, say so clearly and still report validation coverage and residual risk.
|
|
86
|
+
|
|
87
|
+
## Expected Outputs
|
|
88
|
+
|
|
89
|
+
- Review report in conversation, issue, PR comment, or handoff artifact as requested.
|
|
90
|
+
- Optional follow-up issue/RFC candidates for architectural opportunities.
|
|
91
|
+
- In delivery mode only: fix/debug/docs tasks handed back to the owning phase.
|
|
92
|
+
|
|
93
|
+
## Gotchas
|
|
94
|
+
|
|
95
|
+
- Findings-first means do not bury issues under summary prose.
|
|
96
|
+
- Do not edit code in standalone mode unless the user explicitly asks after seeing the review scope.
|
|
97
|
+
- Do not use `simplify` as permission to refactor; report simplification opportunities unless delivery owns fixes.
|
|
98
|
+
- Do not flatten scoped `AGENTS.md` guidance into generic advice; quote the concrete constraint that matters.
|
|
99
|
+
- Do not let `delivery-phase` skip this phase just because tests passed.
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punks/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "Devpunks AI scaffolding CLI",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"bin": {
|
|
7
6
|
"devpunks": "dist/index.js",
|
|
8
7
|
"dp": "dist/index.js",
|
|
@@ -10,9 +9,10 @@
|
|
|
10
9
|
},
|
|
11
10
|
"files": [
|
|
12
11
|
"dist",
|
|
13
|
-
"
|
|
12
|
+
"README.md",
|
|
14
13
|
"AGENTS.md"
|
|
15
14
|
],
|
|
15
|
+
"type": "module",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "node ./scripts/build-dist.mjs",
|
|
18
18
|
"baseline:build": "bun ./scripts/build-baseline.mjs",
|
|
@@ -25,13 +25,22 @@
|
|
|
25
25
|
"test": "vitest run --config vitest.config.ts"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@effect/cli": "catalog:",
|
|
29
|
+
"@effect/platform": "catalog:",
|
|
30
|
+
"@effect/platform-bun": "catalog:",
|
|
31
|
+
"@effect/printer": "catalog:",
|
|
32
|
+
"@effect/printer-ansi": "catalog:",
|
|
33
|
+
"@punks/contract": "workspace:*",
|
|
34
|
+
"@punks/scaffold": "workspace:*",
|
|
35
|
+
"diff": "catalog:",
|
|
36
|
+
"effect": "catalog:",
|
|
28
37
|
"react-devtools-core": "^6.1.5"
|
|
29
38
|
},
|
|
30
39
|
"devDependencies": {
|
|
31
|
-
"@effect/vitest": "
|
|
32
|
-
"@types/node": "
|
|
33
|
-
"typescript": "
|
|
34
|
-
"vitest": "
|
|
40
|
+
"@effect/vitest": "catalog:",
|
|
41
|
+
"@types/node": "catalog:",
|
|
42
|
+
"typescript": "catalog:",
|
|
43
|
+
"vitest": "catalog:"
|
|
35
44
|
},
|
|
36
45
|
"packageManager": "bun@1.3.5"
|
|
37
46
|
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import hashlib
|
|
6
|
-
import json
|
|
7
|
-
import os
|
|
8
|
-
import subprocess
|
|
9
|
-
import sys
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
|
|
12
|
-
SUPPORTED_SUFFIXES = (".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json")
|
|
13
|
-
IGNORED_PARTS = {".git", "node_modules", ".next", "dist"}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def read_input() -> dict[str, object]:
|
|
17
|
-
try:
|
|
18
|
-
return json.load(sys.stdin)
|
|
19
|
-
except json.JSONDecodeError:
|
|
20
|
-
return {}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def run_git(args: list[str], cwd: str) -> str:
|
|
24
|
-
result = subprocess.run(
|
|
25
|
-
["git", "-C", cwd, *args],
|
|
26
|
-
check=True,
|
|
27
|
-
capture_output=True,
|
|
28
|
-
text=True,
|
|
29
|
-
)
|
|
30
|
-
return result.stdout
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def repo_root(cwd: str) -> str:
|
|
34
|
-
try:
|
|
35
|
-
return run_git(["rev-parse", "--show-toplevel"], cwd).strip()
|
|
36
|
-
except subprocess.CalledProcessError:
|
|
37
|
-
return ""
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def dirty_files(root: str) -> list[str]:
|
|
41
|
-
try:
|
|
42
|
-
output = run_git(["ls-files", "-m", "-o", "--exclude-standard"], root)
|
|
43
|
-
except subprocess.CalledProcessError:
|
|
44
|
-
return []
|
|
45
|
-
|
|
46
|
-
files: list[str] = []
|
|
47
|
-
for raw_path in output.splitlines():
|
|
48
|
-
path = raw_path.strip()
|
|
49
|
-
if not path:
|
|
50
|
-
continue
|
|
51
|
-
if not path.endswith(SUPPORTED_SUFFIXES):
|
|
52
|
-
continue
|
|
53
|
-
if any(part in IGNORED_PARTS for part in Path(path).parts):
|
|
54
|
-
continue
|
|
55
|
-
files.append(path)
|
|
56
|
-
|
|
57
|
-
return sorted(set(files))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def file_hash(path: Path) -> str:
|
|
61
|
-
digest = hashlib.sha256()
|
|
62
|
-
with path.open("rb") as handle:
|
|
63
|
-
for chunk in iter(lambda: handle.read(65536), b""):
|
|
64
|
-
digest.update(chunk)
|
|
65
|
-
return digest.hexdigest()
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def snapshot_path(root: str, session_id: str, tool_use_id: str) -> Path:
|
|
69
|
-
repo_name = Path(root).name or "repo"
|
|
70
|
-
safe_session_id = session_id.replace("/", "_")
|
|
71
|
-
safe_tool_use_id = tool_use_id.replace("/", "_")
|
|
72
|
-
state_dir = Path(os.environ.get("TMPDIR", "/tmp")) / "codex-hooks" / repo_name / safe_session_id
|
|
73
|
-
state_dir.mkdir(parents=True, exist_ok=True)
|
|
74
|
-
return state_dir / f"{safe_tool_use_id}.json"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def load_snapshot(path: Path) -> dict[str, str]:
|
|
78
|
-
if not path.exists():
|
|
79
|
-
return {}
|
|
80
|
-
try:
|
|
81
|
-
return json.loads(path.read_text(encoding="utf-8"))
|
|
82
|
-
except (OSError, json.JSONDecodeError):
|
|
83
|
-
return {}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def fingerprints(root: str) -> dict[str, str]:
|
|
87
|
-
snapshot: dict[str, str] = {}
|
|
88
|
-
for relative_path in dirty_files(root):
|
|
89
|
-
absolute_path = Path(root) / relative_path
|
|
90
|
-
if absolute_path.exists():
|
|
91
|
-
snapshot[relative_path] = file_hash(absolute_path)
|
|
92
|
-
return snapshot
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def format_files(root: str, files: list[str]) -> list[str]:
|
|
96
|
-
failed: list[str] = []
|
|
97
|
-
for relative_path in files:
|
|
98
|
-
absolute_path = Path(root) / relative_path
|
|
99
|
-
result = subprocess.run(
|
|
100
|
-
["npx", "oxfmt", "--write", str(absolute_path)],
|
|
101
|
-
cwd=root,
|
|
102
|
-
stdout=subprocess.DEVNULL,
|
|
103
|
-
stderr=subprocess.DEVNULL,
|
|
104
|
-
check=False,
|
|
105
|
-
)
|
|
106
|
-
if result.returncode != 0:
|
|
107
|
-
failed.append(relative_path)
|
|
108
|
-
return failed
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def emit_failure(files: list[str]) -> None:
|
|
112
|
-
message = "Auto-format failed for " + ", ".join(files) + ". Review the file and format it manually if needed."
|
|
113
|
-
print(json.dumps({"systemMessage": message}))
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def main() -> int:
|
|
117
|
-
mode = sys.argv[1] if len(sys.argv) > 1 else ""
|
|
118
|
-
payload = read_input()
|
|
119
|
-
|
|
120
|
-
cwd = str(payload.get("cwd") or os.getcwd())
|
|
121
|
-
session_id = str(payload.get("session_id") or "")
|
|
122
|
-
tool_use_id = str(payload.get("tool_use_id") or "")
|
|
123
|
-
root = repo_root(cwd)
|
|
124
|
-
|
|
125
|
-
if not root or not session_id or not tool_use_id:
|
|
126
|
-
return 0
|
|
127
|
-
|
|
128
|
-
state_file = snapshot_path(root, session_id, tool_use_id)
|
|
129
|
-
|
|
130
|
-
if mode == "pre":
|
|
131
|
-
state_file.write_text(json.dumps(fingerprints(root), sort_keys=True), encoding="utf-8")
|
|
132
|
-
return 0
|
|
133
|
-
|
|
134
|
-
if mode != "post":
|
|
135
|
-
return 0
|
|
136
|
-
|
|
137
|
-
previous = load_snapshot(state_file)
|
|
138
|
-
current = fingerprints(root)
|
|
139
|
-
|
|
140
|
-
try:
|
|
141
|
-
state_file.unlink()
|
|
142
|
-
except OSError:
|
|
143
|
-
pass
|
|
144
|
-
|
|
145
|
-
touched = [path for path, digest in current.items() if previous.get(path) != digest]
|
|
146
|
-
if not touched:
|
|
147
|
-
return 0
|
|
148
|
-
|
|
149
|
-
failed = format_files(root, touched)
|
|
150
|
-
if failed:
|
|
151
|
-
emit_failure(failed)
|
|
152
|
-
|
|
153
|
-
return 0
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if __name__ == "__main__":
|
|
157
|
-
raise SystemExit(main())
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: docs-maintenance
|
|
3
|
-
description: "Ingest a spec folder into the wiki domain layer by extracting and writing flow pages first, then concept pages, then syncing ingest metadata. Secondary: update docs/ when code changes alter architecture, setup, contracts, or operator workflow. Use when a spec is ready to be captured as domain knowledge after review or implementation, or when a code task changes non-obvious behavior that docs/ should reflect."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Docs Maintenance
|
|
7
|
-
|
|
8
|
-
## Contract
|
|
9
|
-
|
|
10
|
-
- **Role:** higher-order ingest and repo-docs orchestrator
|
|
11
|
-
- **Entrypoint type:** public entrypoint
|
|
12
|
-
- **Upstream:** reviewed or implemented spec folder, or code changes that may require `docs/` updates
|
|
13
|
-
- **Delegates to:** internal flow-writing phase, then internal concept-writing phase
|
|
14
|
-
- **Downstream:** synced wiki indexes, ingest metadata, wiki log, and any required `docs/` updates
|
|
15
|
-
- **Entry conditions:** resolved spec folder for ingest work, or a concrete docs-affecting code change
|
|
16
|
-
- **Stop conditions:** ingest bookkeeping complete, required docs updates complete, failures reported honestly
|
|
17
|
-
|
|
18
|
-
## Overview
|
|
19
|
-
|
|
20
|
-
**Primary purpose:** synthesize `<wiki-root>/specs/<domain>/<spec>/SPEC.md` (and optionally `IMPLEMENTATION-NOTES.md`) into the wiki domain knowledge layer. Write flow pages first, then concept pages, then sync ingest bookkeeping.
|
|
21
|
-
|
|
22
|
-
**Secondary purpose:** keep `docs/` accurate when code changes alter architecture, setup, contracts, decisions, or operator-facing behavior.
|
|
23
|
-
|
|
24
|
-
Read `<wiki-root>/AGENTS.md` before touching any wiki content.
|
|
25
|
-
|
|
26
|
-
`<wiki-root>` is repo-shape dependent:
|
|
27
|
-
- monorepo: `apps/wiki`
|
|
28
|
-
- single-repo: `wiki`
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Primary: Wiki Ingest Orchestration
|
|
33
|
-
|
|
34
|
-
### Pipeline
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
docs-maintenance (orchestrator)
|
|
38
|
-
└─ 1. flow-writing phase — writes flows/, updates domain index
|
|
39
|
-
└─ 2. concept-writing phase — reads flows/ for cross-linking, writes concepts/, updates domain index
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Why this order is required:** concept writing reads existing flow pages to cross-link concepts. Flow pages must exist before concept pages are written.
|
|
43
|
-
|
|
44
|
-
### Inputs
|
|
45
|
-
|
|
46
|
-
Accept any of:
|
|
47
|
-
- A spec folder path: `<wiki-root>/specs/<domain>/<spec>/`
|
|
48
|
-
- A domain name + spec name
|
|
49
|
-
- An explicit `SPEC.md` path
|
|
50
|
-
|
|
51
|
-
Resolve all inputs to a full spec folder path before continuing. If the target is still ambiguous, ask only for the missing folder.
|
|
52
|
-
|
|
53
|
-
### Step 1: Guard
|
|
54
|
-
|
|
55
|
-
Check `SPEC.md` frontmatter for `ingested: true`. If set, exit with a clear no-op message.
|
|
56
|
-
|
|
57
|
-
Verify the spec has `domain:` in frontmatter. Error if absent.
|
|
58
|
-
|
|
59
|
-
### Step 2: Read the source
|
|
60
|
-
|
|
61
|
-
Read in order:
|
|
62
|
-
1. `SPEC.md` — mandatory. If missing, stop and report.
|
|
63
|
-
2. `IMPLEMENTATION-NOTES.md` — optional. If present, flows and concepts become `status: implemented`. If absent, status is `proposed`.
|
|
64
|
-
- Check its frontmatter. If it lacks frontmatter (no YAML block), add it now before continuing:
|
|
65
|
-
```yaml
|
|
66
|
-
---
|
|
67
|
-
domain: <domain from SPEC.md>
|
|
68
|
-
type: implementation-notes
|
|
69
|
-
spec: <spec id from SPEC.md>
|
|
70
|
-
links:
|
|
71
|
-
- "[[specs/<domain>/<spec>/SPEC]]"
|
|
72
|
-
ingested: false
|
|
73
|
-
last_ingested: null
|
|
74
|
-
created: <today>
|
|
75
|
-
updated: <today>
|
|
76
|
-
---
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Verify `<wiki-root>/domains/<domain>/` exists with a `<domain>.md` index file. If the domain is missing, stop and scaffold the wiki/domain structure first.
|
|
80
|
-
|
|
81
|
-
### Step 3: Extract flows
|
|
82
|
-
|
|
83
|
-
A flow exists when the spec describes a **sequence of user or system actions with a defined start, steps, and end outcome**.
|
|
84
|
-
|
|
85
|
-
Look for flows in:
|
|
86
|
-
- Multi-step acceptance criteria (e.g. "On save, the system runs duplicate detection → blocks if exact match → redirects operator on success")
|
|
87
|
-
- Explicit user journeys or process descriptions in the Context section
|
|
88
|
-
- "When X, then Y" conditional chains across multiple acceptance criteria
|
|
89
|
-
- Any section titled Flow, Process, Journey, or similar
|
|
90
|
-
|
|
91
|
-
For each flow found:
|
|
92
|
-
- Assign a descriptive `flow_name` (e.g., "Create Patient", "Document Upload", "Duplicate Check")
|
|
93
|
-
- Extract `flow_content`: triggering event, actors involved, ordered steps with decision points, terminal outcome
|
|
94
|
-
- When `IMPLEMENTATION-NOTES.md` is present: note deviations, surprises, or blocked steps inline
|
|
95
|
-
|
|
96
|
-
If no multi-step sequence is discernible (e.g., a purely data-model spec), record the absence and skip flow delegation.
|
|
97
|
-
|
|
98
|
-
### Step 4: Write flow pages
|
|
99
|
-
|
|
100
|
-
Read [references/flow-pages.md](references/flow-pages.md) and apply that contract to every extracted flow.
|
|
101
|
-
|
|
102
|
-
Wait for all flow pages to complete before proceeding.
|
|
103
|
-
|
|
104
|
-
If any flow write fails, stop immediately. Do not proceed to concept writing. Report the failure so the run can be resumed cleanly.
|
|
105
|
-
|
|
106
|
-
### Step 5: Extract concepts
|
|
107
|
-
|
|
108
|
-
A concept exists when the spec **names a domain entity or term with defined attributes, invariants, or bounded scope**.
|
|
109
|
-
|
|
110
|
-
Look for concepts in:
|
|
111
|
-
- Fields listed in acceptance criteria (e.g., `first_name`, `email`, `acquisition_channel`, `nin`)
|
|
112
|
-
- Explicit data model or entity sections
|
|
113
|
-
- Nouns that recur across multiple acceptance criteria with their own distinct attributes or rules
|
|
114
|
-
- Enum sets representing a bounded domain state (e.g., `acquisition_channel` values)
|
|
115
|
-
- Entities referenced via `[[wikilinks]]` to other specs or domain pages
|
|
116
|
-
|
|
117
|
-
**Grouping rule:** collect related fields under one owning entity rather than creating a concept per field. All patient registry fields → one "Patient" concept. All acquisition channel variants → one "Acquisition Channel" concept.
|
|
118
|
-
|
|
119
|
-
If no distinct domain entity is identifiable, record the absence and skip concept delegation.
|
|
120
|
-
|
|
121
|
-
### Step 6: Write concept pages
|
|
122
|
-
|
|
123
|
-
Read [references/concept-pages.md](references/concept-pages.md) and apply that contract to every extracted concept.
|
|
124
|
-
|
|
125
|
-
Wait for all concept pages to complete.
|
|
126
|
-
|
|
127
|
-
### Step 7: Mark sources as ingested
|
|
128
|
-
|
|
129
|
-
Update `SPEC.md` frontmatter:
|
|
130
|
-
```yaml
|
|
131
|
-
ingested: true
|
|
132
|
-
last_ingested: YYYY-MM-DD
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
If `IMPLEMENTATION-NOTES.md` is present, update its frontmatter:
|
|
136
|
-
```yaml
|
|
137
|
-
ingested: true
|
|
138
|
-
last_ingested: YYYY-MM-DD
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Also populate its `links` array with every flow and concept page written in Steps 4 and 6 (in addition to the SPEC link that was set in Step 2). This is the only moment where IMPLEMENTATION-NOTES links are updated — do not leave them pointing only at the SPEC.
|
|
142
|
-
|
|
143
|
-
### Step 8: Log entry
|
|
144
|
-
|
|
145
|
-
Append to `<wiki-root>/log.md` (cap at 50 entries; drop oldest when over):
|
|
146
|
-
```md
|
|
147
|
-
## [YYYY-MM-DD] ingest | <spec title>
|
|
148
|
-
- Source: [[specs/<domain>/<spec>/SPEC]]
|
|
149
|
-
- Flows written: <count>
|
|
150
|
-
- Concepts written: <count>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Step 9: Update wiki index
|
|
154
|
-
|
|
155
|
-
If new pages were created, update the Concepts and Flows counts in the relevant Domains table row in `<wiki-root>/index.md`.
|
|
156
|
-
|
|
157
|
-
### Resumability
|
|
158
|
-
|
|
159
|
-
Output pages are the checkpoints. On re-invocation of the same source:
|
|
160
|
-
|
|
161
|
-
- Flow pages with `ingested: true` → skip Step 4 for those flows
|
|
162
|
-
- Any expected flow page missing → re-run Step 4 for it before Step 6
|
|
163
|
-
- Concept pages with `ingested: true` → skip Step 6 for those concepts
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## Secondary: docs/ Maintenance
|
|
168
|
-
|
|
169
|
-
Update `docs/` when a code task changes **architecture, setup, contracts, decisions, or non-obvious operator-facing behavior**. Do not let docs/ work displace or delay wiki ingest.
|
|
170
|
-
|
|
171
|
-
1. Read `docs/README.md` and the nearest affected section README before editing.
|
|
172
|
-
2. Prefer editing an existing leaf doc over creating a new one.
|
|
173
|
-
3. When a doc is added, removed, or renamed: update `docs/README.md` and the nearest section README in the same task.
|
|
174
|
-
4. Record repo-wide behavior changes in `docs/architecture/decisions/`.
|
|
175
|
-
|
|
176
|
-
**Route by owned behavior:**
|
|
177
|
-
- Backend/runtime surface → `docs/reference/domains/backend-effect-sql.md` or `docs/runbooks/`
|
|
178
|
-
- Auth/user-management → `docs/reference/domains/user-management.md`
|
|
179
|
-
- Frontend/app structure → `docs/reference/domains/frontend-application-structure.md`
|
|
180
|
-
- AI workflow/agent infrastructure → `docs/runbooks/subagent-templates.md` or `docs/runbooks/claude-code-hooks.md`
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Never Do
|
|
185
|
-
|
|
186
|
-
- Ingest a spec with `ingested: true` — exit early instead
|
|
187
|
-
- Ingest an `IMPLEMENTATION-NOTES.md` with `ingested: true` — treat it as already reflected in domain pages
|
|
188
|
-
- Proceed to concept writing when a flow write has failed
|
|
189
|
-
- Create `docs/prd`, `docs/dev`, roadmap, sprint, or backlog-mirror folders
|
|
190
|
-
- Document speculative or future-state features as current truth
|
|
191
|
-
- Put agent task instructions inside human-facing docs pages
|
|
192
|
-
- Leave docs orphaned from `docs/README.md` after adding or renaming them
|
|
193
|
-
- Duplicate content between `<wiki-root>/domains/` (the "what") and `docs/reference/domains/` (the "how")
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
interface:
|
|
2
|
-
display_name: "Docs Maintenance"
|
|
3
|
-
short_description: "Wiki ingest plus repo docs maintenance"
|
|
4
|
-
default_prompt: "Use $docs-maintenance to own the wiki ingest pipeline, then keep docs/ human-facing and implementation-grounded when code changes affect durable knowledge."
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Codex Parallel Reasoning
|
|
2
|
-
|
|
3
|
-
Use this reference only when `implement-spec` runs in Codex parallel mode and calls Codex `spawn_agent`.
|
|
4
|
-
|
|
5
|
-
Set worker `reasoning_effort` lower than the parent orchestrator:
|
|
6
|
-
|
|
7
|
-
| Orchestrator reasoning | Worker reasoning |
|
|
8
|
-
|------------------------|------------------|
|
|
9
|
-
| `xhigh` | `high` |
|
|
10
|
-
| `high` | `medium` |
|
|
11
|
-
| `medium` | `low` |
|
|
12
|
-
| `low` | `low` |
|
|
13
|
-
|
|
14
|
-
Rules:
|
|
15
|
-
|
|
16
|
-
- This policy is Codex-only. Do not apply it to other models or hosts.
|
|
17
|
-
- Pass the mapped value as `reasoning_effort` in each Codex `spawn_agent` call.
|
|
18
|
-
- Keep orchestration, retries, dependency decisions, and acceptance audit in the parent.
|
|
19
|
-
- If a worker task needs equal or higher reasoning, keep that task in the parent instead of spawning it.
|
package/docs/README.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# CLI Docs
|
|
2
|
-
|
|
3
|
-
- [Requirements](./reference/dp-requirements.md)
|
|
4
|
-
- [Scaffolding runbook](./runbooks/dp-cli-scaffolding.md)
|
|
5
|
-
|
|
6
|
-
Implementation notes:
|
|
7
|
-
|
|
8
|
-
- canonical bundled scaffold metadata and shared assets live in `src/data/`
|
|
9
|
-
- runtime scaffold content resolves from a `Baseline`: latest remote stable by default, bundled fallback when offline or forced with `--baseline bundled`
|
|
10
|
-
- pack-owned lint asset metadata lives in `src/data/catalog/lint.ts`
|
|
11
|
-
- distributed skill assets live in `skills/`
|
|
12
|
-
- runtime projection/writing logic lives in `src/scaffold/`
|
|
13
|
-
- `punks update` refreshes scaffold-managed assets from `.devpunks/scaffold-manifest.json`
|
|
14
|
-
- CLI startup checks run in a detached advisory worker at most once per 12 hours by default. They check npm's `latest` dist-tag and whether the named `dp-cli` skill is present, but startup never installs or updates packages/skills while another CLI command is starting. Set `DP_NO_UPDATE_CHECK=1` or `DP_NO_SKILL_UPDATE_CHECK=1` to skip those checks, `DP_UPDATE_TAG=next` to compare against another dist-tag, and `DP_STARTUP_CHECK_INTERVAL_MS=0` to force the worker during local testing.
|
|
15
|
-
- baseline releases use `baseline/stable/*` GitHub release tags, separate from npm executable tags such as `v1.0.1`
|
|
16
|
-
- shared neutral hook and sync assets live in `src/data/hooks/` and `src/data/scripts/`; hook commands infer the target repo package manager from `packageManager` and lockfiles
|
|
17
|
-
- scaffolded required tools always include `portless` and `skills` so generated guidance can standardize local dev origins and keep skill entrypoints up to date
|
|
18
|
-
- `punks scaffold setup` checks the base required tools (`portless`, `skills`) before repo detection and checks selected-pack tools after pack confirmation.
|
|
19
|
-
- Oxlint specs/starter config are scaffolded only when scanned manifests already declare `oxlint`; the auto format/lint hook is scaffolded only when manifests declare `oxfmt`. Other lint/format stacks are intentionally left untouched for now.
|
|
20
|
-
- the default debug pack scaffolds the local `debug-agent` skill and installs/verifies the `debug-agent` CLI without running its agent-install wizard
|
|
21
|
-
- scaffolded repos keep project-local skills in `.agents/skills/`; only `.claude/skills` is a compatibility symlink mirror
|
|
22
|
-
- React scaffold surfaces include `async-react-patterns` alongside the existing React composition, structure, and Vercel guidance so agents avoid outdated manual async state patterns.
|
|
23
|
-
- Next.js detection implies the React pack even when `react` / `react-dom` are not directly listed in scanned manifests.
|
|
24
|
-
- Frontend surface detection scaffolds `frontend-domain-structure` with the frontend pack when React or Next.js is detected.
|
|
25
|
-
- Backend surface detection scaffolds `backend-domain-structure`, `backend-recoverable-actions`, and `logging-best-practices` when backend framework/data/auth packages are detected, or when workspace names/paths clearly identify API, backend, server, or service packages. Workspace prompt specs apply backend packs only to backend-looking workspaces, not frontend workspaces that happen to share repo-level backend/data detections.
|
|
26
|
-
- Drizzle detection selects the `drizzle` pack for data-layer prompt/lint metadata, but does not imply Effect skills or Effect opensrc references unless `effect` / `@effect/*` is also detected.
|
|
27
|
-
- Scaffold no longer preselects concrete opensrc repositories. Post-scaffold agents must choose and clone the core detected libraries whose source behavior matters before authoring final prompts or plans.
|
|
28
|
-
- The default subagent manifest includes a read-only `code-review` template that uses `simplify` and `improve-codebase-architecture`; root prompt guidance routes review requests to findings-first review before broad refactor planning.
|
|
29
|
-
- Non-surface agnostic skill groups are mandatory scaffold packs (`debug`, `docs`, `planning`, `quality`, `research`, `requirements`, `subagents`); `frontend` and `backend` remain detection-driven.
|