@haposoft/cafekit 0.16.0-rc.6 → 0.16.0-rc.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.
Files changed (87) hide show
  1. package/README.md +21 -58
  2. package/bin/__tests__/change-firewall.semantic-firewall.test.js +4 -5
  3. package/bin/__tests__/codex-hooks.test.js +382 -0
  4. package/bin/__tests__/codex-native.test.js +579 -80
  5. package/bin/__tests__/develop-contract.test.js +155 -76
  6. package/bin/__tests__/installer-safety.test.js +19 -154
  7. package/bin/__tests__/package-inventory.test.js +494 -26
  8. package/bin/__tests__/release-preflight.semantic-firewall.test.js +2 -2
  9. package/bin/__tests__/validator-grounding.test.js +11 -11
  10. package/bin/install.js +2 -7
  11. package/bin/lib/context.js +0 -45
  12. package/bin/lib/copy-utils.js +1 -1
  13. package/bin/lib/i18n.js +0 -3
  14. package/bin/lib/manifest.js +1 -1
  15. package/bin/phases/claude-runtime.js +1 -3
  16. package/bin/phases/codex-runtime.js +4 -2
  17. package/bin/phases/copy-payload.js +3 -15
  18. package/bin/phases/post-install.js +5 -17
  19. package/bin/phases/root-config.js +2 -3
  20. package/bin/phases/select-platform.js +2 -5
  21. package/bin/phases/summary.js +0 -1
  22. package/package.json +2 -5
  23. package/src/claude/CLAUDE.md +19 -6
  24. package/src/claude/agents/project-manager.md +41 -9
  25. package/src/claude/agents/spec-maker.md +82 -155
  26. package/src/claude/gitignore +1 -1
  27. package/src/claude/hooks/__tests__/spec-gate.test.js +238 -0
  28. package/src/claude/hooks/__tests__/state.test.js +249 -3
  29. package/src/claude/hooks/lib/context.cjs +1 -1
  30. package/src/claude/hooks/lib/detect.cjs +1 -1
  31. package/src/claude/hooks/spec-gate.cjs +44 -9
  32. package/src/claude/hooks/spec-state.cjs +51 -13
  33. package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
  34. package/src/claude/migration-manifest.json +17 -3
  35. package/src/claude/rules/manage-docs.md +43 -24
  36. package/src/claude/rules/state-sync.md +57 -62
  37. package/src/claude/rules/workflow.md +30 -13
  38. package/src/claude/scripts/change-firewall.cjs +2 -2
  39. package/src/claude/scripts/generate-skill-catalog.cjs +0 -1
  40. package/src/claude/scripts/spec-receipt.cjs +196 -1
  41. package/src/claude/scripts/spec-resolver.cjs +428 -0
  42. package/src/claude/skills/develop/SKILL.md +89 -125
  43. package/src/claude/skills/develop/references/parallel-waves.md +75 -162
  44. package/src/claude/skills/develop/references/quality-gate.md +61 -121
  45. package/src/claude/skills/develop/references/subagent-patterns.md +31 -38
  46. package/src/claude/skills/question/SKILL.md +1 -1
  47. package/src/claude/skills/specs/SKILL.md +152 -204
  48. package/src/claude/skills/specs/references/review.md +124 -243
  49. package/src/claude/skills/specs/references/templates.md +202 -0
  50. package/src/claude/skills/sync/SKILL.md +66 -90
  51. package/src/claude/skills/sync/references/sync-protocols.md +62 -83
  52. package/src/codex/AGENTS.md +20 -7
  53. package/src/codex/hooks/lib/spec-receipt.cjs +18 -0
  54. package/src/codex/hooks/lib/spec-utils.cjs +25 -0
  55. package/src/codex/hooks/spec-gate.cjs +46 -16
  56. package/src/codex/hooks/spec-state.cjs +54 -16
  57. package/src/codex/rules/state-sync.md +57 -61
  58. package/src/common/AGENTS.md +8 -1
  59. package/bin/__tests__/opencode-spec-gate.test.js +0 -799
  60. package/bin/lib/opencode-install.js +0 -899
  61. package/bin/phases/opencode-runtime.js +0 -38
  62. package/src/claude/skills/specs/references/archive-workflow.md +0 -74
  63. package/src/claude/skills/specs/references/ask-user-question-gates.md +0 -70
  64. package/src/claude/skills/specs/references/codebase-analysis.md +0 -102
  65. package/src/claude/skills/specs/references/cross-spec-dependency.md +0 -76
  66. package/src/claude/skills/specs/references/research-strategy.md +0 -107
  67. package/src/claude/skills/specs/references/scope-inquiry.md +0 -107
  68. package/src/claude/skills/specs/references/translation-mirror.md +0 -83
  69. package/src/claude/skills/specs/rules/design-discovery-full.md +0 -45
  70. package/src/claude/skills/specs/rules/design-discovery-light.md +0 -28
  71. package/src/claude/skills/specs/rules/design-principles.md +0 -138
  72. package/src/claude/skills/specs/rules/design-review.md +0 -55
  73. package/src/claude/skills/specs/rules/ears-format.md +0 -42
  74. package/src/claude/skills/specs/rules/phase-decision-matrix.md +0 -56
  75. package/src/claude/skills/specs/rules/task-scoring-rubric.md +0 -52
  76. package/src/claude/skills/specs/rules/tasks-generation.md +0 -189
  77. package/src/opencode/AGENTS.md +0 -41
  78. package/src/opencode/plugins/docs-sync.ts +0 -175
  79. package/src/opencode/plugins/inspect-block.ts +0 -164
  80. package/src/opencode/plugins/privacy-block.ts +0 -182
  81. package/src/opencode/plugins/rules.ts +0 -155
  82. package/src/opencode/plugins/session.ts +0 -179
  83. package/src/opencode/plugins/spec-gate.ts +0 -457
  84. package/src/opencode/plugins/spec-state.ts +0 -311
  85. package/src/opencode/plugins/state.ts +0 -253
  86. package/src/opencode/plugins/task-scaffold-guard.ts +0 -161
  87. package/src/opencode/plugins/usage.ts +0 -178
@@ -1,99 +1,71 @@
1
- # Quality Gate — one closeout, separate proof and review
1
+ # Quality gate — one closeout, separate proof and review
2
2
 
3
- This reference is loaded at develop closeout. It is an executable contract, not
4
- a fixed actor checklist. Canonical v2.1 policy input is authoritative; lane and
5
- `execution_tier` are derived/read-only compatibility views.
3
+ Load this reference when closing a task or direct change. It defines ownership
4
+ and evidence, not a fixed agent sequence.
6
5
 
7
- ## Inputs and ownership
6
+ ## Ownership
8
7
 
9
- The single closeout owner receives the current scope, assurance, risk signals, blast
10
- radius, exact evidence commands, and the current diff. It calls the test owner
11
- once, then the review owner once when required. No parallel path, review path,
12
- or sync hook runs a duplicate hidden gate.
8
+ - **Test owner:** executes the named commands and is the sole producer of
9
+ execution proof.
10
+ - **Review owner:** evaluates correctness, security, scope, and reachability;
11
+ consumes proof but never creates it.
12
+ - **Closeout owner:** normalizes both results, writes the task Receipt and
13
+ Status, and reports docs impact.
13
14
 
14
- - **Test owner:** executes commands and creates the canonical execution receipt.
15
- - **Review owner:** evaluates correctness, security, scope, and spec compliance;
16
- consumes the receipt but never creates or claims execution proof.
17
- - **Closeout owner:** combines both results and performs one state/docs sync.
15
+ Use `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`. Only literal PASS plus all
16
+ required proof can close. Review depth follows risk, blast radius, and repository
17
+ policy, not file count.
18
18
 
19
- Review depth follows assurance, risk, and blast radius, not the number of files or
20
- tasks. There is no fixed Light/Standard/Deep agent sequence. The shared verdict
21
- surface is `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`; all adapters must use
22
- the same normalizer.
23
-
24
- ## Working directory (parallel mode)
25
-
26
- When an opt-in wave is active, each command runs in its task worktree. A
27
- collapse of one task does not cancel other in-flight tasks; merge and state
28
- synchronization remain single-writer operations.
29
-
30
- ## Required evidence
19
+ ## Required proof
31
20
 
32
21
  Before completion, verify:
33
22
 
34
- 1. compile/typecheck precheck and every exact command named by the active
35
- `Verification Plan`;
36
- 2. real runtime reachability and declared artifact inspection;
37
- 3. canonical `receipts/<task-basename>.md` with task identity/path, non-empty
38
- exact command, successful exit/result, expected versus observed behavior,
39
- applicable negative/reachability proof, both provenance anchors bound to the
40
- runtime's expected Base/Head pair, and required SHA-256 declarations;
41
- 4. correctness/security/spec review at the selected depth;
42
- 5. a real independent audit when `needsIndependentAudit` is persisted. The
43
- audit must use schema version `1`, distinct reviewer and implementation
44
- session IDs, matching expected Base/Head binding, concrete evidence, and
45
- literal `verdict: "PASS"`.
46
-
47
- `PRECHECK_FAIL` outranks no-tests. Missing, pending, marker-only, contradictory,
48
- or placeholder proof is unfinished. `Audit: PASS` is not an independent audit.
49
- `NO_TESTS` may be retained as a legacy diagnostic input, but it can never become
50
- the shared completion verdict `PASS`.
23
+ 1. applicable compile/typecheck and every exact task command;
24
+ 2. at least one real test when automated tests are required;
25
+ 3. runtime reachability through the declared entrypoint or consumer;
26
+ 4. negative/failure behavior named by Acceptance;
27
+ 5. artifact bytes and SHA-256 when the task declares an artifact;
28
+ 6. an inline `## Receipt` with `Verification: PASS`, exact `Command`, `Exit: 0`,
29
+ runtime-bound Base/Head, and non-empty fenced command output;
30
+ 7. correctness/security/scope review at the required depth.
51
31
 
52
- ## Spec compliance review
32
+ `PRECHECK_FAIL` outranks no-tests. Missing, pending, placeholder, contradictory,
33
+ zero-test, stale, copied, or marker-only proof is unfinished. A review PASS
34
+ cannot replace execution evidence.
53
35
 
54
- Check scope lock, requirements, design contracts, task Acceptance, Verification
55
- Plan, runtime reachability, and artifact/provenance boundaries. A missing or orphaned
56
- runtime deliverable is a failure even when compilation succeeds.
36
+ ## Review focus
57
37
 
58
- **Specific-task mode:** review exactly the requested task and its diff, then
59
- stop. Do not select a next task.
38
+ Check task Outcome, Scope, Acceptance, Dependencies, Verification Plan, changed
39
+ diff, and actual consumers. Treat an unmounted UI, unregistered route, uncalled
40
+ service, disconnected worker, missing export, or unconsumed artifact as a
41
+ reachability failure even when compilation passes.
60
42
 
61
- **Full-feature mode:** use the cumulative feature scope only at its closeout;
62
- intermediate synchronization does not claim feature completion. Run the Final
63
- Integration Scout when runtime-facing surfaces exist.
43
+ Apply security checks relevant to the touched boundary: auth and tenant scope,
44
+ input validation, secret redaction, path containment and symlinks, atomic writes,
45
+ concurrency, cleanup, and safe error behavior. Do not add unrelated ceremony.
64
46
 
65
- ## Correctness and security review
47
+ Specific-task mode reviews only that task and stops. Full-feature mode uses
48
+ cumulative scope only for the final integration check.
66
49
 
67
- Apply only the checks relevant to the touched boundary. For logging/redaction,
68
- check safe identifiers, quoted schemes, idempotence, and receipt secrecy. For
69
- filesystem writes, check lexical and canonical containment, symlink rejection,
70
- atomic same-directory replacement, cleanup, and canonical return paths. Add
71
- auth, persistence, provider, or concurrency checks only when scope/risk requires.
72
-
73
- ## Quality cycle
50
+ ## Repair cycle
74
51
 
75
52
  ```text
76
- retry_count = 0
77
- while closeout is not PASS:
78
- test owner executes required proof once
79
- if proof is BLOCKED: stop without blind retry
80
- review owner evaluates correctness/security/spec once
81
- if FAIL: fix only the affected scope and rerun affected proof/review
82
- if retry_count reaches 3: stop and request user intervention
53
+ test owner runs required proof once
54
+ if BLOCKED: record prerequisite and stop
55
+ if FAIL: repair the observed cause and rerun affected proof
56
+ review owner evaluates the proven diff once
57
+ if review FAIL: repair affected scope and rerun affected proof/review
58
+ after three failed repair rounds: stop and request user direction
83
59
  ```
84
60
 
85
- Only `FAIL` enters remediation. `BLOCKED` is terminal until its prerequisite
86
- changes. `PASS_WITH_WARNINGS` is a review result only and remains unfinished;
87
- only literal `PASS` may close when all execution and policy obligations are
88
- complete.
89
-
90
- ## Flash Gate (`--flash`)
61
+ `PASS_WITH_WARNINGS` may report non-blocking observations but remains
62
+ unfinished for state synchronization. Never retry an unchanged environment to
63
+ manufacture a green result.
91
64
 
92
- Use only when the flag is explicit. Skip dedicated tests, full evidence
93
- execution, extended UI/manual checks, and review retry loops. Still perform a
94
- cheap preflight and scope/reachability sanity check.
65
+ ## Flash gate
95
66
 
96
- The flash record must contain exactly the unfinished semantics:
67
+ With explicit `--flash`, run only a cheap available preflight and a basic
68
+ scope/reachability check. Record:
97
69
 
98
70
  ```text
99
71
  Mode: --flash
@@ -101,54 +73,22 @@ Tests: skipped by user request
101
73
  Evidence: FLASH_UNVERIFIED
102
74
  Status: in_progress
103
75
  Blocker: awaiting /hapo:test <feature>
104
- Next verification: /hapo:test <feature>
105
- ```
106
-
107
- The persisted flash input must also contain `dependencyBlocked: true`,
108
- `unblocks: false`, and a non-placeholder blocker, and must omit
109
- `readyForSync`, `flashTransition`, and `promotionReceipt`. Sync-finalize
110
- rejects minimal or caller-pre-promoted states.
111
-
112
- Terminal log:
113
-
114
- ```text
115
- ⚡ Step 4 Flash Gate: tests skipped by --flash; preflight=<pass|skipped>; evidence=FLASH_UNVERIFIED
116
76
  ```
117
77
 
118
- Do not report `Test PASS`, `Evidence PASS`, `Auto-Approved`, or
119
- `production-ready`. Flash never sets `done`, unblocks dependents, or promotes
120
- from a marker. Trusted sync-finalize alone may consume a fresh canonical PASS
121
- receipt and derive promotion.
122
-
123
- ## Closeout and docs impact
124
-
125
- After the test receipt and review verdict are both available, the closeout owner
126
- uses the policy adapter and synchronizes state. A review-only pass cannot close
127
- missing execution proof. Evaluate docs impact from the actual behavior change:
128
-
129
- - `none`: record no docs edit and stop;
130
- - `minor` or `major`: update only affected existing docs through the normal docs
131
- workflow.
132
-
133
- Do not run a docs checkpoint merely because a task completed. Do not refresh the
134
- whole repository for a local change.
135
-
136
- After every task receipt is valid, final integration execution creates
137
- `feature-receipt.md` once. A task-bearing feature cannot close without all task
138
- receipts and the feature receipt. A taskless Compact/Full feature closes from a
139
- valid feature receipt; absence before final closeout is not a failure. Receipts
140
- never supply or imply approval, readiness, audit status, or product semantics.
78
+ Flash does not write a PASS receipt, mark done, unblock dependents, or report
79
+ production readiness. Trusted sync-finalize may promote only after fresh proof
80
+ passes the same receipt contract above.
141
81
 
142
- ## Review threshold
82
+ ## Docs impact and C3
143
83
 
144
- `PASS` requires no Critical or High correctness/security/spec finding and no
145
- blocking Medium finding. `PASS_WITH_WARNINGS` may carry documented non-blocking
146
- findings. Finding count never selects review depth or overrides missing proof.
147
- Any missing proof, unresolved obligation, scope drift, contract substitution, or
148
- reachability failure remains unfinished regardless of review severity.
84
+ After proof and review, classify docs impact as `none`, `minor`, or `major`.
85
+ Update only affected existing docs when impact is not none. Show the user the
86
+ current command evidence and limitations at C3; do not infer approval from a
87
+ receipt.
149
88
 
150
- ### Reachability Failure
89
+ ## Legacy workflow compatibility
151
90
 
152
- An unmounted UI, unregistered route, uncalled service/loader, disconnected
153
- worker/command/provider/reducer, missing artifact consumer, or other orphaned
154
- runtime-facing output is a review failure.
91
+ Existing kernel packets keep their separate `receipts/<task-basename>.md`, task
92
+ identity/path metadata, final `feature-receipt.md`, persisted independent-audit
93
+ obligations, and completion-authority checks. The same proof/review ownership
94
+ applies. Do not copy that storage shape into a flat process-first task.
@@ -1,51 +1,44 @@
1
1
  # Capability dispatch patterns
2
2
 
3
- This reference is optional. Load it only when the persisted lane requires
4
- independent capability work. Role names are runtime configuration, not workflow
5
- policy: resolve them from the installed catalog instead of hardcoding an actor
6
- name or a sequence in a skill.
3
+ Load this optional reference only when a task benefits from independent
4
+ inspection, implementation, verification, review, or docs capability. Runtime
5
+ role names are configuration, not workflow policy.
7
6
 
8
- ## Dispatch contract
7
+ ## Dispatch packet
9
8
 
10
- Every dispatch prompt includes:
9
+ Every dispatch includes:
11
10
 
12
- - Work context: the git root of the primary files;
13
- - Reports path: `<work-context>/plans/reports/`;
14
- - Plans path: `<work-context>/plans/`;
15
- - exact task/scope and owned files;
16
- - lane snapshot, risk/blast-radius obligations, and stop conditions;
17
- - required output, evidence, and status.
11
+ - work context and reports/plans paths;
12
+ - exact task outcome, scope, acceptance, and dependencies;
13
+ - owned read/write paths and explicit exclusions;
14
+ - risk, blast radius, stop conditions, and required evidence;
15
+ - expected status and handoff format.
18
16
 
19
- Use a capability request such as:
20
-
21
- ```text
22
- dispatch(capability="inspection|implementation|verification|review|docs",
23
- work_context="<root>",
24
- scope="<task or feature>",
25
- owned_files=["<paths>"],
26
- obligations=["<persisted obligations>"],
27
- output="<required packet and evidence>")
28
- ```
29
-
30
- The runtime may map a capability to a local role. That mapping must not change
31
- the lane, add ceremony, or become a new persisted policy field.
17
+ Use one capability per concrete responsibility. The runtime may map it to an
18
+ available local role, but that mapping cannot add scope or weaken proof.
32
19
 
33
20
  ## Independence and ownership
34
21
 
35
- - Inspection may report entrypoints and blast radius but does not edit source.
36
- - Implementation edits only the active task scope and does not sync state.
37
- - Verification is the sole producer of canonical execution proof.
38
- - Review consumes proof and reports correctness/security/spec findings only.
39
- - Documentation work is invoked only after a real docs-impact decision.
22
+ - Inspection traces entrypoints and risks without editing source.
23
+ - Implementation edits only granted paths and does not write task state.
24
+ - Verification is the sole producer of executable proof.
25
+ - Review consumes proof and reports findings without claiming execution.
26
+ - Documentation starts only after a real docs-impact decision.
27
+ - The controller alone writes Status and inline Receipt.
40
28
 
41
- Specific-task mode ends after one task. Full-feature mode may continue only
42
- after the closeout owner synchronizes the current task and finds another
43
- unblocked task. A capability result marked `PENDING`, `BLOCKED`, or lacking
44
- provenance cannot be converted into PASS by the controller.
29
+ A specific-task invocation ends after that task. Full-feature execution may
30
+ continue only after the current task is synchronized and the next dependency
31
+ set is recomputed.
45
32
 
46
33
  ## Safe fallback
47
34
 
48
- If the required capability or isolated workspace is unavailable, keep the
49
- workflow in `BLOCKED` or run the permitted main-session check. Do not substitute
50
- a model, profile, or actor silently, and do not claim an independent result
51
- without an actually independent execution.
35
+ If a required capability or isolated workspace is unavailable, record BLOCKED
36
+ or run only a permitted main-session check. Never silently substitute an actor
37
+ for an independence requirement. A PENDING, BLOCKED, or provenance-free result
38
+ cannot be normalized to PASS.
39
+
40
+ ## Legacy workflow compatibility
41
+
42
+ When the selected packet is legacy, include its persisted lane snapshot and
43
+ obligations in the dispatch, but do not let workers edit that state or infer an
44
+ independent result from a role label.
@@ -73,7 +73,7 @@ If `unclear`, ask one focused follow-up with the minimum choices needed.
73
73
 
74
74
  Repo evidence priority:
75
75
  1. `README.md`, `AGENTS.md`, `CLAUDE.md`
76
- 2. relevant `docs/`, `specs/`, `.claude/`, `.opencode/`
76
+ 2. relevant `docs/`, `specs/`, `.claude/`
77
77
  3. source files, tests, scripts, package manifests, config files
78
78
  4. git history only when the question asks about changes or provenance
79
79