@haposoft/cafekit 0.16.0-rc.5 → 0.16.0-rc.7
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/README.md +21 -58
- package/bin/__tests__/change-firewall.semantic-firewall.test.js +4 -5
- package/bin/__tests__/codex-hooks.test.js +137 -0
- package/bin/__tests__/codex-native.test.js +130 -74
- package/bin/__tests__/develop-contract.test.js +155 -76
- package/bin/__tests__/installer-safety.test.js +19 -154
- package/bin/__tests__/package-inventory.test.js +10 -20
- package/bin/__tests__/release-preflight.semantic-firewall.test.js +13 -5
- package/bin/__tests__/validator-grounding.test.js +11 -11
- package/bin/install.js +2 -7
- package/bin/lib/context.js +0 -45
- package/bin/lib/copy-utils.js +1 -1
- package/bin/lib/i18n.js +0 -3
- package/bin/lib/manifest.js +1 -1
- package/bin/phases/claude-runtime.js +1 -3
- package/bin/phases/codex-runtime.js +4 -2
- package/bin/phases/copy-payload.js +3 -15
- package/bin/phases/post-install.js +5 -17
- package/bin/phases/root-config.js +2 -3
- package/bin/phases/select-platform.js +2 -5
- package/bin/phases/summary.js +0 -1
- package/package.json +3 -8
- package/src/claude/CLAUDE.md +19 -6
- package/src/claude/agents/project-manager.md +41 -9
- package/src/claude/agents/spec-maker.md +76 -155
- package/src/claude/gitignore +1 -1
- package/src/claude/hooks/__tests__/spec-gate.test.js +162 -0
- package/src/claude/hooks/lib/context.cjs +1 -1
- package/src/claude/hooks/lib/detect.cjs +1 -1
- package/src/claude/hooks/spec-gate.cjs +44 -9
- package/src/claude/hooks/spec-state.cjs +22 -11
- package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
- package/src/claude/migration-manifest.json +17 -3
- package/src/claude/rules/manage-docs.md +43 -24
- package/src/claude/rules/state-sync.md +57 -62
- package/src/claude/rules/workflow.md +30 -13
- package/src/claude/scripts/change-firewall.cjs +2 -2
- package/src/claude/scripts/generate-skill-catalog.cjs +0 -1
- package/src/claude/scripts/spec-receipt.cjs +141 -1
- package/src/claude/scripts/spec-resolver.cjs +288 -0
- package/src/claude/skills/develop/SKILL.md +89 -125
- package/src/claude/skills/develop/references/parallel-waves.md +75 -162
- package/src/claude/skills/develop/references/quality-gate.md +61 -121
- package/src/claude/skills/develop/references/subagent-patterns.md +31 -38
- package/src/claude/skills/question/SKILL.md +1 -1
- package/src/claude/skills/specs/SKILL.md +142 -204
- package/src/claude/skills/specs/references/review.md +109 -243
- package/src/claude/skills/specs/references/templates.md +173 -0
- package/src/claude/skills/sync/SKILL.md +66 -90
- package/src/claude/skills/sync/references/sync-protocols.md +62 -83
- package/src/codex/AGENTS.md +20 -7
- package/src/codex/hooks/lib/spec-receipt.cjs +18 -0
- package/src/codex/hooks/lib/spec-utils.cjs +25 -0
- package/src/codex/hooks/spec-gate.cjs +46 -16
- package/src/codex/hooks/spec-state.cjs +22 -12
- package/src/codex/rules/state-sync.md +57 -61
- package/src/common/AGENTS.md +8 -1
- package/bin/__tests__/opencode-spec-gate.test.js +0 -799
- package/bin/lib/opencode-install.js +0 -899
- package/bin/phases/opencode-runtime.js +0 -38
- package/src/claude/skills/specs/references/archive-workflow.md +0 -74
- package/src/claude/skills/specs/references/ask-user-question-gates.md +0 -70
- package/src/claude/skills/specs/references/codebase-analysis.md +0 -102
- package/src/claude/skills/specs/references/cross-spec-dependency.md +0 -76
- package/src/claude/skills/specs/references/research-strategy.md +0 -107
- package/src/claude/skills/specs/references/scope-inquiry.md +0 -107
- package/src/claude/skills/specs/references/translation-mirror.md +0 -83
- package/src/claude/skills/specs/rules/design-discovery-full.md +0 -45
- package/src/claude/skills/specs/rules/design-discovery-light.md +0 -28
- package/src/claude/skills/specs/rules/design-principles.md +0 -138
- package/src/claude/skills/specs/rules/design-review.md +0 -55
- package/src/claude/skills/specs/rules/ears-format.md +0 -42
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +0 -56
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +0 -52
- package/src/claude/skills/specs/rules/tasks-generation.md +0 -189
- package/src/opencode/AGENTS.md +0 -41
- package/src/opencode/plugins/docs-sync.ts +0 -175
- package/src/opencode/plugins/inspect-block.ts +0 -164
- package/src/opencode/plugins/privacy-block.ts +0 -182
- package/src/opencode/plugins/rules.ts +0 -155
- package/src/opencode/plugins/session.ts +0 -179
- package/src/opencode/plugins/spec-gate.ts +0 -457
- package/src/opencode/plugins/spec-state.ts +0 -311
- package/src/opencode/plugins/state.ts +0 -253
- package/src/opencode/plugins/task-scaffold-guard.ts +0 -161
- package/src/opencode/plugins/usage.ts +0 -178
|
@@ -39,10 +39,10 @@ try {
|
|
|
39
39
|
const RECEIPT = receiptLoaded.receipt;
|
|
40
40
|
const { projectRoot, runtime } = getHookContext(payload);
|
|
41
41
|
if (runtime.spec?.tollgate === false) process.exit(0);
|
|
42
|
-
const {
|
|
42
|
+
const { resolveWorkflowCandidate } = require('./lib/spec-utils.cjs');
|
|
43
43
|
const explicitFeature = payload.featureName || payload.feature || payload.explicitFeature || null;
|
|
44
44
|
const explicitPath = payload.specPath || payload.spec_path || payload.featurePath || null;
|
|
45
|
-
const resolved =
|
|
45
|
+
const resolved = resolveWorkflowCandidate(projectRoot, runtime, explicitFeature, explicitPath);
|
|
46
46
|
if (!resolved) process.exit(0);
|
|
47
47
|
if (resolved.error === 'multiple_active') {
|
|
48
48
|
process.stdout.write(`> ⚠️ Multiple active specs detected: ${resolved.candidates.join(', ')}. Provide explicit feature target or resolve ambiguity. Tollgate paused.\n`);
|
|
@@ -59,16 +59,17 @@ try {
|
|
|
59
59
|
}
|
|
60
60
|
if (resolved.error) process.exit(0);
|
|
61
61
|
const active = resolved;
|
|
62
|
+
const processWorkflow = active.layoutKind === 'process-v3';
|
|
62
63
|
const runtimeContext = POLICY.deriveRuntimeContext({
|
|
63
64
|
projectRoot,
|
|
64
65
|
specsRoot: active.specsDir,
|
|
65
|
-
specFile: active.specFile || path.join(active.specsDir, active.featureName, 'spec.json'),
|
|
66
|
+
specFile: active.stateFile || active.specFile || path.join(active.specsDir, active.featureName, 'spec.json'),
|
|
66
67
|
featureName: active.featureName,
|
|
67
68
|
runtimeSession: payload.session_id || payload.sessionId || payload.sessionID || payload.session?.id,
|
|
68
69
|
});
|
|
69
70
|
|
|
70
|
-
const phase = active.spec
|
|
71
|
-
const taskRegistry = active.spec
|
|
71
|
+
const phase = active.phase || active.spec?.current_phase || active.spec?.phase || 'unknown';
|
|
72
|
+
const taskRegistry = active.taskRegistry || active.spec?.task_registry || {};
|
|
72
73
|
const flashTasks = POLICY.flashState(taskRegistry);
|
|
73
74
|
const tasks = Object.entries(taskRegistry);
|
|
74
75
|
const counts = tasks.reduce((result, [, task]) => {
|
|
@@ -85,7 +86,8 @@ try {
|
|
|
85
86
|
&& (task?.dependencies || []).every((dependency) => statuses.get(dependency) === 'done')
|
|
86
87
|
));
|
|
87
88
|
const featureDir = path.join(active.specsDir, active.featureName);
|
|
88
|
-
const featureReceiptPresent =
|
|
89
|
+
const featureReceiptPresent = !processWorkflow
|
|
90
|
+
&& RECEIPT.safeRead(featureDir, 'feature-receipt.md').status === 'ok';
|
|
89
91
|
const stateKey = JSON.stringify({
|
|
90
92
|
project_root: runtimeContext.project_root,
|
|
91
93
|
specs_root: runtimeContext.specs_root,
|
|
@@ -122,12 +124,20 @@ try {
|
|
|
122
124
|
if (flashTasks.length > 0) {
|
|
123
125
|
lines.push(`- Flash verification pending: ${flashTasks.map((taskPath) => `\`${taskPath}\``).join(', ')}. A PASS proof keeps the persisted task in_progress until explicit sync-finalize.`);
|
|
124
126
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (processWorkflow) {
|
|
128
|
+
lines.push(
|
|
129
|
+
'- Sync each flat task `Status:` only after verified work; task proof belongs in that task\'s inline `## Receipt`.',
|
|
130
|
+
`- Workflow source: \`specs/${active.featureName}/plan.md\`; Stop revalidates every task currently marked done.`,
|
|
131
|
+
'- Hooks revalidate receipt bytes but never grant approval.'
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
lines.push(
|
|
135
|
+
'- Sync `spec.json` and task Markdown status only after verified work; task proof belongs in `receipts/<task-basename>.md`.',
|
|
136
|
+
`- Create \`feature-receipt.md\` once after final integration proof${featureReceiptPresent ? ' (present)' : ' (not required before closeout)'}.`,
|
|
137
|
+
`- Validate with \`node .codex/scripts/validate-spec-output.cjs specs/${active.featureName}\`.`,
|
|
138
|
+
'- Hooks revalidate receipt bytes but never grant approval.'
|
|
139
|
+
);
|
|
140
|
+
}
|
|
131
141
|
process.stdout.write(`${lines.join('\n')}\n`);
|
|
132
142
|
} catch (error) {
|
|
133
143
|
logCrash('spec-state', error);
|
|
@@ -1,61 +1,57 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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.
|
|
1
|
+
# Process-first state synchronization
|
|
2
|
+
|
|
3
|
+
## Primary file state
|
|
4
|
+
|
|
5
|
+
For new work, `specs/<feature>/plan.md` and its direct-child
|
|
6
|
+
`task-NN-*.md` files are canonical, hand-editable state. Task files stay flat
|
|
7
|
+
beside the plan; indexes and host task views are disposable projections.
|
|
8
|
+
|
|
9
|
+
Each task has exactly one `Status:` field using `pending`, `in_progress`,
|
|
10
|
+
`paused`, `blocked`, or `done`. The controller is the sole writer of task
|
|
11
|
+
status and proof. A task's final `## Receipt` is its only canonical execution
|
|
12
|
+
proof.
|
|
13
|
+
|
|
14
|
+
## Surgical synchronization
|
|
15
|
+
|
|
16
|
+
Before changing state:
|
|
17
|
+
|
|
18
|
+
1. read the plan row and the task's Outcome, Acceptance, Dependencies,
|
|
19
|
+
Verification Plan, Status, and Receipt;
|
|
20
|
+
2. confirm every dependency and owned path at the requested boundary;
|
|
21
|
+
3. edit only the observed Status, concrete blocker, implemented checkbox, or
|
|
22
|
+
Receipt; and
|
|
23
|
+
4. re-read the file and confirm exactly one Status field and one Receipt
|
|
24
|
+
section.
|
|
25
|
+
|
|
26
|
+
Starting or resuming changes only Status to `in_progress`. Blocking records a
|
|
27
|
+
specific cause without creating proof. Do not replace a whole packet to make a
|
|
28
|
+
state transition.
|
|
29
|
+
|
|
30
|
+
Set `Status: done` only after the inline Receipt passes the
|
|
31
|
+
`validateCanonicalReceipt` contract: exact command, `Exit: 0`,
|
|
32
|
+
`Verification: PASS`, runtime-derived Base and Head values, and a non-empty
|
|
33
|
+
fenced block of current command output. Missing, stale, contradictory,
|
|
34
|
+
placeholder, copied, failure, or zero-test evidence leaves the task unfinished.
|
|
35
|
+
|
|
36
|
+
Synchronization never fabricates commands, output, timestamps, completed
|
|
37
|
+
work, reviewer identity, user approval, or product readiness. A passing command
|
|
38
|
+
proves only the boundary it executed.
|
|
39
|
+
|
|
40
|
+
## Human gates and workflow ownership
|
|
41
|
+
|
|
42
|
+
- C1 records the user's scope decision before the plan is written.
|
|
43
|
+
- C2 records the user's disposition of deduplicated adversarial findings.
|
|
44
|
+
- Develop starts only after a new explicit user invocation and executes one
|
|
45
|
+
unblocked task at a time.
|
|
46
|
+
- Sync changes only observed file state and never starts implementation.
|
|
47
|
+
- C3 occurs after current receipts and limitations are shown; the user decides
|
|
48
|
+
whether the requested feature is complete.
|
|
49
|
+
|
|
50
|
+
## Legacy compatibility
|
|
51
|
+
|
|
52
|
+
Existing packets containing `spec.json`, nested `tasks/task-R*.md`, or other
|
|
53
|
+
legacy kernel artifacts stay on their installed adapters. Preserve their
|
|
54
|
+
`task_registry`, `semantic_model`, `planning_depth`, lane,
|
|
55
|
+
`execution_tier`, typed topology, separate receipts, and feature closeout
|
|
56
|
+
contract. Do not migrate that machine authority or storage shape while syncing
|
|
57
|
+
an unrelated process-first packet.
|
package/src/common/AGENTS.md
CHANGED
|
@@ -3,7 +3,14 @@
|
|
|
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 Specs
|
|
6
|
+
- For process-first Specs, `plan.md` and flat `task-NN-*.md` files are
|
|
7
|
+
canonical, hand-editable state. Each task has exactly one `Status:` field and
|
|
8
|
+
keeps canonical execution proof in its final inline `## Receipt`.
|
|
9
|
+
- Specs uses three user decisions: C1 for scope, C2 for adversarial findings,
|
|
10
|
+
and C3 for completion. Planning never starts implementation; implementation
|
|
11
|
+
requires a new explicit user invocation.
|
|
12
|
+
- Synchronize only observed task state with surgical edits. Never invent proof,
|
|
13
|
+
readiness, approval, review independence, or completed work.
|
|
7
14
|
- `NO_TESTS` and `0 tests + exit 0` do not pass when the task requires automated tests.
|
|
8
15
|
- When a hook blocks an action, that is an instruction boundary — do not work around it.
|
|
9
16
|
- Use conventional commits. Do not add AI attribution unless requested.
|