@haposoft/cafekit 0.16.0-rc.2 → 0.16.0-rc.3
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 +355 -12
- package/bin/__tests__/codex-native.test.js +1 -1
- package/bin/__tests__/develop-contract.test.js +1374 -78
- package/bin/__tests__/installer-safety.test.js +43 -29
- package/bin/__tests__/opencode-spec-gate.test.js +791 -0
- package/bin/__tests__/package-inventory.test.js +157 -0
- package/bin/__tests__/validator-grounding.test.js +707 -2
- package/package.json +1 -1
- package/src/claude/agents/spec-maker.md +107 -200
- package/src/claude/hooks/__tests__/completion-authority.test.js +720 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +511 -38
- package/src/claude/hooks/completion-authority-check.cjs +307 -0
- package/src/claude/hooks/completion-authority-state.cjs +525 -0
- package/src/claude/hooks/completion-authority.cjs +148 -0
- package/src/claude/hooks/session.cjs +33 -19
- package/src/claude/hooks/spec-gate.cjs +173 -61
- package/src/claude/hooks/spec-state.cjs +104 -45
- package/src/claude/migration-manifest.json +6 -1
- package/src/claude/scripts/provenance.cjs +315 -0
- package/src/claude/scripts/spec-resolver.cjs +450 -0
- package/src/claude/scripts/spec-scaffold.cjs +716 -41
- package/src/claude/scripts/validate-spec-output.cjs +355 -53
- package/src/claude/scripts/workflow-policy.cjs +1529 -162
- package/src/claude/settings/settings.json +8 -0
- package/src/claude/skills/code-review/SKILL.md +85 -66
- package/src/claude/skills/develop/SKILL.md +153 -285
- package/src/claude/skills/develop/references/quality-gate.md +116 -148
- package/src/claude/skills/develop/references/subagent-patterns.md +42 -37
- package/src/claude/skills/specs/SKILL.md +170 -381
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +45 -46
- package/src/claude/skills/specs/rules/tasks-generation.md +49 -20
- package/src/claude/skills/specs/templates/spec-state.json +23 -2
- package/src/claude/skills/specs/templates/task.md +20 -0
- package/src/claude/skills/sync/SKILL.md +15 -8
- package/src/claude/skills/sync/references/sync-protocols.md +4 -4
- package/src/claude/skills/test/SKILL.md +141 -167
- package/src/codex/hooks/completion-authority-check.cjs +260 -0
- package/src/codex/hooks/completion-authority-state.cjs +525 -0
- package/src/codex/hooks/completion-authority.cjs +100 -0
- package/src/codex/hooks/lib/hook-context.cjs +42 -2
- package/src/codex/hooks/lib/spec-receipt.cjs +76 -43
- package/src/codex/hooks/lib/spec-utils.cjs +53 -27
- package/src/codex/hooks/session.cjs +2 -0
- package/src/codex/hooks/spec-gate.cjs +132 -20
- package/src/codex/hooks/spec-state.cjs +56 -10
- package/src/codex/hooks.json +10 -0
- 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
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"type": "command",
|
|
43
43
|
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/rules.cjs\""
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
"type": "command",
|
|
47
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/completion-authority.cjs\""
|
|
48
|
+
},
|
|
45
49
|
{
|
|
46
50
|
"type": "command",
|
|
47
51
|
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/spec-state.cjs\""
|
|
@@ -106,6 +110,10 @@
|
|
|
106
110
|
"type": "command",
|
|
107
111
|
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/spec-gate.cjs\""
|
|
108
112
|
},
|
|
113
|
+
{
|
|
114
|
+
"type": "command",
|
|
115
|
+
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/completion-authority.cjs\""
|
|
116
|
+
},
|
|
109
117
|
{
|
|
110
118
|
"type": "command",
|
|
111
119
|
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/state.cjs\""
|
|
@@ -1,100 +1,119 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hapo:code-review
|
|
3
|
-
description: "
|
|
3
|
+
description: "Review a change for correctness, security, and specification compliance without owning execution proof."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
when_to_use: "
|
|
5
|
+
when_to_use: "Use for a pending diff, commit, PR, or explicitly scoped review."
|
|
6
6
|
category: dev-tools
|
|
7
|
-
keywords: [review, diff,
|
|
7
|
+
keywords: [review, diff, correctness, security]
|
|
8
8
|
argument-hint: "[#PR | COMMIT | --pending | scope]"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
|
-
version: "
|
|
11
|
+
version: "2.0.0"
|
|
12
12
|
---
|
|
13
|
-
# Code Review
|
|
13
|
+
# Code Review — correctness and compliance owner
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Review evaluates correctness, security, scope, architecture, and specification
|
|
16
|
+
compliance. It does not execute the test suite, create a canonical execution
|
|
17
|
+
receipt, or turn a missing test result into a review-owned proof. `hapo:test`
|
|
18
|
+
owns execution proof; the single closeout owner combines both results.
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
## Input and depth
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- `references/verification-gate.md` (Execution Proofs)
|
|
23
|
-
- `references/pre-landing-checklists.md` (Stage 2 rules)
|
|
24
|
-
- `references/adversarial-review.md` (Stage 3 rules)
|
|
22
|
+
With no argument, review the pending diff. Supported targets are a PR, commit,
|
|
23
|
+
pending changes, or an explicit path. Load only the spec and references needed
|
|
24
|
+
for the target.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Select review depth from the persisted lane, risk, and blast radius:
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
- Direct: targeted correctness/security/spec check;
|
|
29
|
+
- Standard: bounded feature review at closeout;
|
|
30
|
+
- Critical: independent, adversarial review covering every required obligation.
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
Do not use file count as the depth selector. `execution_tier` is a read-only
|
|
33
|
+
legacy adapter and cannot choose a review sequence. The review contract has no
|
|
34
|
+
fixed Light/Standard/Deep sequence.
|
|
33
35
|
|
|
34
|
-
##
|
|
36
|
+
## Review stages
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
### 1. Specification compliance
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| `scope` | **Path** | Specific files or directories |
|
|
40
|
+
Compare the diff with `scope_lock`, requirements, design contracts, active task
|
|
41
|
+
criteria, and declared runtime reachability. Identify missing behavior,
|
|
42
|
+
unjustified extras, contract substitution, orphaned outputs, and incorrect
|
|
43
|
+
completion claims. If a design image or document carries requirements, load its
|
|
44
|
+
multimodal reference only when needed; do not guess from a filename.
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
### 2. Correctness and security
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
Trace changed entrypoints and callers. Check boundary validation, error paths,
|
|
49
|
+
resource handling, race assumptions, secrets, authorization, persistence, and
|
|
50
|
+
failure recovery in proportion to risk. Apply YAGNI/KISS/DRY as maintainability
|
|
51
|
+
signals, not as a numeric score.
|
|
48
52
|
|
|
49
|
-
###
|
|
50
|
-
Does the code match what was requested?
|
|
51
|
-
- Read contextual spec records (markdown files).
|
|
52
|
-
- **Multimodal Delegation:** If the spec references or provides PDF requirements, architecture diagrams, or UI mockups (images), **STOP**. Delegate to `hapo:ai-multimodal` scripts (e.g. `gemini_batch_process.py`) to parse the JSON constraints from the document, then compare the implementation against the true layout/logic constraints.
|
|
53
|
-
- Any missing requirements? Any unjustified extras?
|
|
53
|
+
### 3. Adversarial checks
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
Try empty, malformed, unauthorized, duplicate, stale, boundary, and concurrent
|
|
56
|
+
inputs where the changed contract makes them relevant. For Critical obligations,
|
|
57
|
+
review the required independent evidence and provenance. A marker such as
|
|
58
|
+
`Audit: PASS` is not independent evidence.
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
The independent-audit proof must be a durable object with exactly
|
|
61
|
+
`schema_version: "1"`, distinct concrete `reviewer_session_id` and
|
|
62
|
+
`implementation_session_id`, `expected_provenance: { base, head }` matching the
|
|
63
|
+
runtime binding, concrete `evidence`, and literal `verdict: "PASS"`.
|
|
64
|
+
`independent: true`, `PASS_WITH_WARNINGS`, missing binding, or reused session
|
|
65
|
+
provenance is insufficient.
|
|
66
66
|
|
|
67
|
-
##
|
|
67
|
+
## Execution-proof boundary
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
Consume the current canonical receipt when available and report its identity,
|
|
70
|
+
scope, and caveats. Never rerun commands to manufacture proof. If execution
|
|
71
|
+
proof is missing, say `execution proof unavailable` and leave the overall
|
|
72
|
+
closeout to the test owner; do not claim PASS on the feature from review alone.
|
|
73
|
+
A review can still return a correctness verdict when its review inputs are
|
|
74
|
+
complete.
|
|
75
|
+
|
|
76
|
+
## Verdict
|
|
77
|
+
|
|
78
|
+
Use the shared adapter surface exactly:
|
|
79
|
+
|
|
80
|
+
`PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`
|
|
81
|
+
|
|
82
|
+
Legacy adapter inputs may include `PASS | FAIL | BLOCKED`, but they are
|
|
83
|
+
normalized to the shared surface and no second enum is allowed. `PASS` means no
|
|
84
|
+
Critical/High correctness, security, or compliance finding. `PASS_WITH_WARNINGS`
|
|
85
|
+
means only documented non-blocking findings remain. `FAIL` requires remediation;
|
|
86
|
+
`PASS` also requires no blocking Medium finding. `PASS_WITH_WARNINGS` may carry
|
|
87
|
+
documented non-blocking findings. Finding count never selects depth or overrides
|
|
88
|
+
missing execution proof. A review `PASS_WITH_WARNINGS` remains an unfinished
|
|
89
|
+
closeout result; only literal `PASS` can finish a task. `BLOCKED` means the review input or a user-owned
|
|
90
|
+
decision is unavailable.
|
|
73
91
|
|
|
74
|
-
Format:
|
|
75
92
|
```markdown
|
|
76
93
|
# Code Review Results [hapo:code-review]
|
|
77
94
|
|
|
78
|
-
**Verdict:** PASS | FAIL | BLOCKED
|
|
95
|
+
**Verdict:** PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED
|
|
79
96
|
**Target:** [PR | Commit | Path]
|
|
97
|
+
**Lane / risk:** [snapshot and relevant signals]
|
|
98
|
+
**Execution proof:** consumed | unavailable (owned by hapo:test)
|
|
80
99
|
|
|
81
|
-
##
|
|
82
|
-
- [
|
|
100
|
+
## Findings
|
|
101
|
+
- [Critical|High|Medium|Low] path:line — issue, failure scenario, evidence,
|
|
102
|
+
and fix boundary.
|
|
83
103
|
|
|
84
|
-
##
|
|
85
|
-
-
|
|
104
|
+
## Decision
|
|
105
|
+
- Scope/spec compliance: PASS | WARN | FAIL
|
|
106
|
+
- Correctness/security: PASS | WARN | FAIL
|
|
107
|
+
- Reachability/provenance review: PASS | WARN | FAIL
|
|
108
|
+
```
|
|
86
109
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- [🟠 High] ...
|
|
90
|
-
- [🟡 Medium] ...
|
|
91
|
-
- [🔵 Suggestion] ...
|
|
110
|
+
Do not add a test command, a fabricated receipt, or an `Audit: PASS` marker to
|
|
111
|
+
make the review look complete. Return unresolved questions at the end.
|
|
92
112
|
|
|
93
|
-
##
|
|
94
|
-
[List exact bash commands or SED replacements to fix the issues quickly if possible]
|
|
95
|
-
```
|
|
113
|
+
## References
|
|
96
114
|
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
115
|
+
- `references/spec-compliance-review.md` — load for detailed scope checks.
|
|
116
|
+
- `references/pre-landing-checklists.md` — load for the selected risk surface.
|
|
117
|
+
- `references/adversarial-review.md` — load for Critical/adversarial depth.
|
|
118
|
+
- `references/verification-gate.md` — receipt consumption only; execution stays
|
|
119
|
+
with `hapo:test`.
|