@haposoft/cafekit 0.16.0-rc.2 → 0.16.0-rc.4
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/bin/__tests__/codex-hooks.test.js +794 -21
- package/bin/__tests__/codex-native.test.js +228 -7
- package/bin/__tests__/develop-contract.test.js +1838 -112
- package/bin/__tests__/installer-safety.test.js +82 -29
- package/bin/__tests__/opencode-spec-gate.test.js +799 -0
- package/bin/__tests__/package-inventory.test.js +841 -10
- package/bin/__tests__/specs-v2-execution-closeout.test.js +421 -0
- package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +601 -0
- package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +952 -0
- package/bin/__tests__/test-runtime-dependency-closure.cjs +182 -0
- package/bin/__tests__/validator-grounding.test.js +2469 -71
- package/bin/lib/managed-writer.js +12 -3
- package/bin/phases/codex-runtime.js +17 -1
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +6 -0
- package/src/claude/agents/code-auditor.md +20 -0
- package/src/claude/agents/spec-maker.md +153 -202
- package/src/claude/hooks/__tests__/completion-authority.test.js +953 -0
- package/src/claude/hooks/__tests__/privacy-block.test.js +172 -0
- package/src/claude/hooks/__tests__/semantic-review-authority.test.js +257 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +604 -56
- package/src/claude/hooks/completion-authority-check.cjs +56 -0
- package/src/claude/hooks/completion-authority-state.cjs +527 -0
- package/src/claude/hooks/completion-authority.cjs +154 -0
- package/src/claude/hooks/docs-sync.cjs +5 -2
- package/src/claude/hooks/lib/privacy-command-analysis.cjs +393 -0
- package/src/claude/hooks/lib/runtime-path-safety.cjs +119 -0
- package/src/claude/hooks/privacy-block.cjs +77 -30
- package/src/claude/hooks/semantic-review-authority.cjs +152 -0
- package/src/claude/hooks/session.cjs +33 -19
- package/src/claude/hooks/spec-gate.cjs +181 -139
- package/src/claude/hooks/spec-state.cjs +112 -47
- package/src/claude/migration-manifest.json +15 -2
- package/src/claude/rules/state-sync.md +52 -21
- package/src/claude/rules/workflow.md +17 -9
- package/src/claude/scripts/provenance.cjs +315 -0
- package/src/claude/scripts/spec-final-state.cjs +244 -0
- package/src/claude/scripts/spec-ground.cjs +535 -173
- package/src/claude/scripts/spec-readiness.cjs +118 -0
- package/src/claude/scripts/spec-receipt.cjs +162 -0
- package/src/claude/scripts/spec-resolver.cjs +501 -0
- package/src/claude/scripts/spec-scaffold.cjs +1945 -55
- package/src/claude/scripts/spec-semantic-model.cjs +396 -0
- package/src/claude/scripts/validate-spec-output.cjs +3204 -262
- package/src/claude/scripts/workflow-policy.cjs +1888 -203
- package/src/claude/settings/settings.json +12 -0
- package/src/claude/skills/code-review/SKILL.md +94 -66
- package/src/claude/skills/code-review/references/spec-compliance-review.md +10 -2
- package/src/claude/skills/code-review/references/verification-gate.md +13 -0
- package/src/claude/skills/develop/SKILL.md +138 -283
- package/src/claude/skills/develop/references/parallel-waves.md +9 -6
- package/src/claude/skills/develop/references/quality-gate.md +123 -148
- package/src/claude/skills/develop/references/subagent-patterns.md +42 -37
- package/src/claude/skills/specs/SKILL.md +192 -397
- package/src/claude/skills/specs/references/ask-user-question-gates.md +27 -18
- package/src/claude/skills/specs/references/cross-spec-dependency.md +8 -4
- package/src/claude/skills/specs/references/research-strategy.md +4 -1
- package/src/claude/skills/specs/references/review.md +200 -260
- package/src/claude/skills/specs/references/scope-inquiry.md +18 -5
- package/src/claude/skills/specs/rules/design-discovery-full.md +33 -81
- package/src/claude/skills/specs/rules/design-discovery-light.md +21 -42
- package/src/claude/skills/specs/rules/design-principles.md +136 -180
- package/src/claude/skills/specs/rules/design-review.md +42 -97
- package/src/claude/skills/specs/rules/ears-format.md +42 -50
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +42 -41
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +46 -46
- package/src/claude/skills/specs/rules/tasks-generation.md +189 -271
- package/src/claude/skills/specs/templates/design.md +49 -263
- package/src/claude/skills/specs/templates/requirements.md +26 -36
- package/src/claude/skills/specs/templates/research.md +9 -98
- package/src/claude/skills/specs/templates/spec-state.json +26 -67
- package/src/claude/skills/specs/templates/task.md +30 -82
- package/src/claude/skills/sync/SKILL.md +45 -15
- package/src/claude/skills/sync/references/sync-protocols.md +34 -16
- package/src/claude/skills/test/SKILL.md +151 -167
- package/src/codex/AGENTS.md +6 -0
- package/src/codex/hooks/completion-authority-check.cjs +63 -0
- package/src/codex/hooks/completion-authority-state.cjs +527 -0
- package/src/codex/hooks/completion-authority.cjs +106 -0
- package/src/codex/hooks/lib/hook-context.cjs +58 -4
- package/src/codex/hooks/lib/privacy-command-analysis.cjs +3 -0
- package/src/codex/hooks/lib/privacy-state.cjs +38 -16
- package/src/codex/hooks/lib/runtime-path-safety.cjs +3 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +86 -115
- package/src/codex/hooks/lib/spec-utils.cjs +104 -27
- package/src/codex/hooks/privacy-approval.cjs +1 -1
- package/src/codex/hooks/privacy-block.cjs +67 -11
- package/src/codex/hooks/semantic-review-authority.cjs +130 -0
- package/src/codex/hooks/session.cjs +2 -0
- package/src/codex/hooks/spec-gate.cjs +151 -24
- package/src/codex/hooks/spec-state.cjs +65 -12
- package/src/codex/hooks/state.cjs +2 -0
- package/src/codex/hooks.json +16 -1
- package/src/codex/rules/state-sync.md +47 -27
- package/src/common/AGENTS.md +1 -1
- package/src/opencode/AGENTS.md +4 -2
- package/src/opencode/plugins/spec-gate.ts +296 -122
- package/src/opencode/plugins/spec-state.ts +183 -116
package/src/codex/hooks.json
CHANGED
|
@@ -43,6 +43,11 @@
|
|
|
43
43
|
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/privacy-approval.cjs\"",
|
|
44
44
|
"commandWindows": "node \".codex/hooks/privacy-approval.cjs\""
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
"type": "command",
|
|
48
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/completion-authority.cjs\"",
|
|
49
|
+
"commandWindows": "node \".codex/hooks/completion-authority.cjs\""
|
|
50
|
+
},
|
|
46
51
|
{
|
|
47
52
|
"type": "command",
|
|
48
53
|
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/rules.cjs\"",
|
|
@@ -58,7 +63,7 @@
|
|
|
58
63
|
],
|
|
59
64
|
"PreToolUse": [
|
|
60
65
|
{
|
|
61
|
-
"matcher": "Bash|apply_patch|Edit|Write|Read|Glob|Grep|mcp__
|
|
66
|
+
"matcher": "Bash|exec_command|apply_patch|Edit|Write|Read|Glob|Grep|mcp__.*|shell",
|
|
62
67
|
"hooks": [
|
|
63
68
|
{
|
|
64
69
|
"type": "command",
|
|
@@ -98,6 +103,11 @@
|
|
|
98
103
|
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/spec-gate.cjs\"",
|
|
99
104
|
"commandWindows": "node \".codex/hooks/spec-gate.cjs\""
|
|
100
105
|
},
|
|
106
|
+
{
|
|
107
|
+
"type": "command",
|
|
108
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/completion-authority.cjs\"",
|
|
109
|
+
"commandWindows": "node \".codex/hooks/completion-authority.cjs\""
|
|
110
|
+
},
|
|
101
111
|
{
|
|
102
112
|
"type": "command",
|
|
103
113
|
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\"",
|
|
@@ -110,6 +120,11 @@
|
|
|
110
120
|
{
|
|
111
121
|
"matcher": "*",
|
|
112
122
|
"hooks": [
|
|
123
|
+
{
|
|
124
|
+
"type": "command",
|
|
125
|
+
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/semantic-review-authority.cjs\"",
|
|
126
|
+
"commandWindows": "node \".codex/hooks/semantic-review-authority.cjs\""
|
|
127
|
+
},
|
|
113
128
|
{
|
|
114
129
|
"type": "command",
|
|
115
130
|
"command": "node \"$(git rev-parse --show-toplevel)/.codex/hooks/state.cjs\"",
|
|
@@ -1,41 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Specs v2.1 state synchronization
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Authority layers
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`spec.json` is machine semantic authority. Requirements, design, conditional
|
|
6
|
+
research, and conditional task Markdown are human projections. Host state may
|
|
7
|
+
record authority or integrity, but it never supplies product semantics.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
Planning depth and assurance level remain independent. Route artifacts before
|
|
10
|
+
discovery: None persists no spec; Compact and Full persist the bounded core;
|
|
11
|
+
research and tasks remain absent unless their semantic triggers exist.
|
|
9
12
|
|
|
10
|
-
##
|
|
13
|
+
## Canonical lifecycle
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
The feature lifecycle is exactly `in_progress`, `paused`, `blocked`, or `done`.
|
|
16
|
+
Authoring state is independently `draft`, `validated`, or `absent`. New 2.1
|
|
17
|
+
artifacts never emit legacy lifecycle aliases.
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
Technical readiness is not lifecycle completion. `ready_for_implementation`
|
|
20
|
+
may change only through the installed machine finalization path after every
|
|
21
|
+
routed artifact, projection, semantic review, grounding check, and deterministic
|
|
22
|
+
gate passes. The author cannot directly declare readiness, authority, approval,
|
|
23
|
+
review capability, execution proof, or closeout.
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
`task_files`, status, timestamps, and the matching `task_registry` entry accurate.
|
|
18
|
-
2. Update the matching task Markdown status, checkboxes, completion criteria,
|
|
19
|
-
and `## Evidence` receipt from the current verification run.
|
|
20
|
-
3. Update native plan or task state when the active Codex session provides it,
|
|
21
|
-
but never use chat-only state as a substitute for the files above.
|
|
25
|
+
## Projection sync
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
After a semantic Markdown edit:
|
|
24
28
|
|
|
25
|
-
1.
|
|
26
|
-
2.
|
|
27
|
-
3.
|
|
29
|
+
1. invoke the explicit installed machine semantic-sync step to promote `semantic_model`;
|
|
30
|
+
2. regenerate or reconcile every affected Markdown projection;
|
|
31
|
+
3. verify requirements, decisions, anchors, task registry, typed boundaries,
|
|
32
|
+
and verification refs round-trip without loss; and
|
|
33
|
+
4. rerun applicable deterministic validation and grounding checks.
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
For Codex, the isolated promotion is
|
|
36
|
+
`node .codex/scripts/spec-scaffold.cjs <feature> --sync-semantic-model`.
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
Task Markdown exists only for typed ownership, dependency, transition, proof,
|
|
39
|
+
or parallel topology. Its status and dependencies project the matching
|
|
40
|
+
`task_registry` entry. Its Verification Plan is prospective, never execution
|
|
41
|
+
proof. Typed `coordination.boundaries` alone define topology; legacy trigger
|
|
42
|
+
fields, priority markers, related-file lists, and prose do not.
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
## Lifecycle updates
|
|
35
45
|
|
|
36
|
-
- `
|
|
37
|
-
-
|
|
38
|
-
- a
|
|
46
|
+
- Active work uses `in_progress`.
|
|
47
|
+
- A deliberate resumable stop uses `paused` with the exact remaining decision.
|
|
48
|
+
- An external or semantic blocker uses `blocked` with a concrete cause.
|
|
49
|
+
- Task state changes update the registry and matching projection together only
|
|
50
|
+
from observed work and verification.
|
|
51
|
+
- Feature `done` is reserved for final-state authority after implementation
|
|
52
|
+
closeout; authoring or readiness cannot produce it.
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
State synchronization never fabricates commands, PASS results, timestamps,
|
|
55
|
+
receipts, completed work, reviewer identity, or user approval. When execution
|
|
56
|
+
evidence is absent, preserve unfinished state and report the missing proof.
|
|
57
|
+
Never hand-author the `semantic_model` shape or treat an unsynchronized Markdown
|
|
58
|
+
edit as machine authority.
|
|
59
|
+
|
|
60
|
+
Codex-native plan or task state may mirror physical state when available, but
|
|
61
|
+
it is never a substitute for `spec.json` or authority to advance lifecycle.
|
package/src/common/AGENTS.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Shared CafeKit instructions
|
|
4
4
|
|
|
5
5
|
- Deliver exactly what was asked. Do not expand, polish, or add optional work beyond the request. Match existing code style and structure.
|
|
6
|
-
- For
|
|
6
|
+
- For Specs v2.1, treat `spec.json` as machine authority and Markdown as human projections. Keep task status and plan synchronized with `task_registry`; derive ownership, dependencies, transitions, proof, and parallelism only from typed `coordination.boundaries`. Never invent proof, readiness, approval, or audit state.
|
|
7
7
|
- `NO_TESTS` and `0 tests + exit 0` do not pass when the task requires automated tests.
|
|
8
8
|
- When a hook blocks an action, that is an instruction boundary — do not work around it.
|
|
9
9
|
- Use conventional commits. Do not add AI attribution unless requested.
|
package/src/opencode/AGENTS.md
CHANGED
|
@@ -28,9 +28,11 @@ The underlying CafeKit skills are still named `hapo:*` in their documentation.
|
|
|
28
28
|
|
|
29
29
|
## OpenCode limits
|
|
30
30
|
|
|
31
|
-
Claude Code hooks, statusline, and settings do not run in OpenCode. Map Claude-only tools to OpenCode built-ins: `TodoWrite` → `todowrite`, `AskUserQuestion` → `question`, `Task` → the agent/subtask flow. The installed plugins under `.opencode/plugins/` provide the privacy, inspect-scope, spec-state, scaffold-guard, session-state, and docs-sync gates; other Claude runtime behavior has no OpenCode equivalent.
|
|
31
|
+
Claude Code hooks, statusline, and settings do not run in OpenCode. Map Claude-only tools to OpenCode built-ins: `TodoWrite` → `todowrite`, `AskUserQuestion` → `question`, `Task` → the agent/subtask flow. The installed plugins under `.opencode/plugins/` provide the privacy, inspect-scope, spec-state, scaffold-guard, session-state, and docs-sync gates; other Claude runtime behavior has no OpenCode equivalent.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
The installed `spec-gate` plugin uses the cancellable `tool.execute.before` hook to hard-block supported completion/state tools (`task`, `taskupdate`, and `todowrite`) with a controlled `CAFEKIT_SPEC_GATE_BLOCKED` result when shared policy/resolver or receipt evidence is invalid or unavailable. Receipt-repair tools remain available where the host boundary permits correction.
|
|
34
|
+
|
|
35
|
+
OpenCode does not expose a cancellable `session.idle`/Stop hook or final assistant-turn cancellation boundary. Those event and prompt-injection paths are observational only; do not claim full-turn parity with Claude/Codex.
|
|
34
36
|
|
|
35
37
|
## Combined-install boundary
|
|
36
38
|
|