@haposoft/cafekit 0.8.5 → 0.8.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/bin/install.js CHANGED
@@ -424,8 +424,15 @@ function copyPlatformFiles(platformKey, results, options = {}) {
424
424
 
425
425
  // Keep templates in sync for claude command runtime copies under .claude/skills/specs
426
426
  if (platformKey === 'claude') {
427
+ const legacyInitTemplate = path.join(platform.skillsDir, 'specs', 'templates', 'init.json');
428
+ if (fs.existsSync(legacyInitTemplate)) {
429
+ fs.rmSync(legacyInitTemplate, { force: true });
430
+ console.log(` ↻ Removed legacy template: ${legacyInitTemplate}`);
431
+ results.updated++;
432
+ }
433
+
427
434
  const specTemplates = [
428
- 'init.json',
435
+ 'spec-state.json',
429
436
  'requirements-init.md',
430
437
  'requirements.md',
431
438
  'design.md',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haposoft/cafekit",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "Claude Code-first spec-driven workflow for AI coding assistants. Bundles CafeKit hapo: skills, runtime hooks, agents, and installer scaffolding.",
5
5
  "author": "Haposoft <nghialt@haposoft.com>",
6
6
  "license": "MIT",
@@ -15,6 +15,23 @@ You DO NOT write implementation code. You produce Specifications that downstream
15
15
 
16
16
  **Before ANY action**, you MUST read `.claude/skills/specs/SKILL.md` and follow it step-by-step. `SKILL.md` is the authoritative workflow. This agent file provides behavioral guidance; `SKILL.md` provides the execution protocol.
17
17
 
18
+ ## Artifact Contract (MANDATORY)
19
+
20
+ Generate only the CafeKit spec artifacts defined by `hapo:specs`:
21
+
22
+ ```
23
+ specs/<feature>/
24
+ ├── spec.json
25
+ ├── requirements.md
26
+ ├── research.md
27
+ ├── design.md
28
+ └── tasks/task-R{N}-{SEQ}-<slug>.md
29
+ ```
30
+
31
+ - `spec.json` is generated from `.claude/skills/specs/templates/spec-state.json`; never write `init.json` or `spec-state.json` into the spec directory.
32
+ - Task filenames MUST include the `task-` prefix, requirement number, two-digit sequence, and descriptive slug, for example `tasks/task-R0-01-project-scaffolding.md`.
33
+ - Do NOT write `hydration.md`; task hydration is session/task-state synchronization only.
34
+
18
35
  ## Mental Models (How You Think)
19
36
 
20
37
  - **Decomposition:** Break epics into concrete, testable tasks.
@@ -41,6 +58,8 @@ Init → Requirements → Design → Tasks
41
58
  ### Auto-Approval Behavior
42
59
  - When running the full pipeline end-to-end, follow the auto-approval rules defined in `SKILL.md`.
43
60
  - When running a single phase, stop and report status after completion.
61
+ - Normal `/hapo:specs <feature-description>` requests are full pipeline requests.
62
+ - If a pause is required after user review, tell the user to continue with `/hapo:specs resume <feature>` or `/hapo:specs <feature>`.
44
63
 
45
64
  ## Scope Lock Protocol (MANDATORY)
46
65
 
@@ -195,7 +214,7 @@ specs/<feature>/
195
214
 
196
215
  - Output format follows `hapo:specs` protocol (see `skills/specs/SKILL.md`)
197
216
  - Task files follow `skills/specs/templates/task.md` template
198
- - `spec.json` follows `skills/specs/templates/init.json` schema
217
+ - `spec.json` follows the `skills/specs/templates/spec-state.json` schema; the generated file must still be named `spec.json`
199
218
  - Research output follows `skills/specs/templates/research.md` template
200
219
  - Requirements follow EARS format per `skills/specs/rules/ears-format.md`
201
220
  - Design follows principles per `skills/specs/rules/design-principles.md`
@@ -69,7 +69,7 @@ Generate a unique feature name from the project description ($ARGUMENTS) and ini
69
69
  1. **Check Uniqueness**: Verify `.specs/` for naming conflicts (append number suffix if needed)
70
70
  2. **Create Directory**: `.specs/[feature-name]/`
71
71
  3. **Initialize Files Using Templates**:
72
- - Read `{{SKILLS_DIR}}/specs/templates/init.json`
72
+ - Read `{{SKILLS_DIR}}/specs/templates/spec-state.json`
73
73
  - Read `{{SKILLS_DIR}}/specs/templates/requirements-init.md`
74
74
  - Replace placeholders:
75
75
  - `{{FEATURE_NAME}}` → generated feature name
@@ -92,7 +92,7 @@ Generate a unique feature name from the project description ($ARGUMENTS) and ini
92
92
 
93
93
  ## Tool Guidance
94
94
  - Use **Glob** to check existing spec directories for name uniqueness
95
- - Use **Read** to fetch templates: `init.json` and `requirements-init.md`
95
+ - Use **Read** to fetch templates: `spec-state.json` and `requirements-init.md`
96
96
  - Use **Write** to create spec.json and requirements.md after placeholder replacement
97
97
  - Perform validation before any file write operation
98
98
 
@@ -102,8 +102,10 @@ Provide output in the language specified in `spec.json` with the following struc
102
102
  1. **Generated Feature Name**: `feature-name` format with 1-2 sentence rationale
103
103
  2. **Project Summary**: Brief summary (1 sentence)
104
104
  3. **Created Files**: Bullet list with full paths
105
- 4. **Next Step**: Command block showing `/spec-requirements <feature-name>`
106
- 5. **Notes**: Explain why only initialization was performed (2-3 sentences on phase separation)
105
+ 4. **Next Step**: Command block showing `/hapo:specs resume <feature-name>`
106
+ 5. **Notes**: Explain this legacy init command only initialized files. Recommend using `/hapo:specs <feature-description>` for the normal end-to-end CafeKit flow.
107
+
108
+ **Command integrity:** CafeKit continuation uses `/hapo:specs resume <feature-name>`.
107
109
 
108
110
  **Format Requirements**:
109
111
  - Use Markdown headings (##, ###)
@@ -34,6 +34,7 @@ Analyze → Dependency Scan → Complexity Assessment → Init → Evidence Gate
34
34
  - Each phase (Init → Requirements → Design → Tasks) must complete before the next begins
35
35
  - No skipping — don't write design without requirements
36
36
  - Exception: simple tasks may merge requirements + design into one step
37
+ - A normal `/hapo:specs <feature-description>` run is an end-to-end spec creation workflow. Do not stop after Init unless the user explicitly asks for init-only behavior.
37
38
 
38
39
  ### Scope Rules
39
40
  - Respect `scope_lock` absolutely once user has confirmed
@@ -55,6 +56,31 @@ Analyze → Dependency Scan → Complexity Assessment → Init → Evidence Gate
55
56
  - Insert code samples/pseudocode when needed to clarify flow
56
57
  - Comply with `./docs/development-rules.md` if it exists
57
58
 
59
+ ### Hard Output Contract
60
+ For a normal `/hapo:specs <feature-description>` run, the persistent spec artifacts MUST use this shape:
61
+
62
+ ```
63
+ specs/<feature>/
64
+ ├── spec.json
65
+ ├── requirements.md
66
+ ├── research.md
67
+ ├── design.md
68
+ ├── tasks/
69
+ │ ├── task-R0-01-<slug>.md
70
+ │ ├── task-R1-01-<slug>.md
71
+ │ └── ...
72
+ └── reports/
73
+ └── <optional-review-or-research-report>.md
74
+ ```
75
+
76
+ Forbidden generated artifacts:
77
+ - Do NOT create `specs/<feature>/init.json`.
78
+ - Do NOT create `specs/<feature>/spec-state.json`.
79
+ - Do NOT create `specs/<feature>/hydration.md`.
80
+ - Do NOT create shorthand task files such as `tasks/task-R0-1.md`, `tasks/task-R1-1.md`, or `tasks/R0-1-<slug>.md`.
81
+ - The template file name is never the output file name. `templates/spec-state.json` is only the schema source for generated `spec.json`.
82
+ - Task hydration is session/task-state synchronization only; it MUST NOT be written as a markdown artifact.
83
+
58
84
  ### Writing Style
59
85
  - Concise, prefer bullet lists
60
86
  - Get straight to the point, no fluff
@@ -91,6 +117,8 @@ System auto-analyzes the description:
91
117
  - If task is simple (small bugfix, config change) → suggest "A spec may not be needed for this. Continue anyway?"
92
118
  - If task is complex (multi-module, security/migration related) → auto-activate deep research, ask user 3 scope questions
93
119
  - For non-trivial specs, execute the Step 5 Evidence Gate before writing final requirements. Do not design from memory when codebase or current external evidence can answer the question.
120
+ - After user confirms scope, continue through Init → Evidence/Requirements → Design → Tasks → Finalization in the same workflow unless the user explicitly asks for "init only" or "pause after init".
121
+ - If the workflow must pause for manual approval, the continuation command is `/hapo:specs resume <feature>` or `/hapo:specs <feature>`.
94
122
 
95
123
  ### When called WITH `--validate` argument
96
124
 
@@ -187,14 +215,14 @@ Load: `references/scope-inquiry.md`
187
215
  ### Step 4: Init
188
216
  - Check for duplicate slugs in `specs/` via Glob
189
217
  - Create directory `specs/<feature-name>/`
190
- - Create `spec.json` from template `templates/init.json`
218
+ - Create `spec.json` from template `templates/spec-state.json`. The output file name MUST be `spec.json`; never write the template filename into the spec directory.
191
219
  - Create empty `requirements.md` from template `templates/requirements-init.md`
192
220
  - Initialize `scope_lock` in `spec.json`:
193
221
  - `source`: original description
194
222
  - `in_scope`: confirmed scope items
195
223
  - `out_of_scope`: excluded items
196
224
  - `expansion_policy`: `requires-user-approval`
197
- - Do NOT generate requirements, design, or tasks at this step
225
+ - Step 4 itself only initializes files. In a normal `/hapo:specs <feature-description>` run, immediately continue to Step 5 after Init. Stop here only when the user explicitly requested init-only behavior.
198
226
 
199
227
  ### Step 5: Evidence Gate, Requirements & Research
200
228
  - Read `spec.json` — stop if init hasn't completed
@@ -499,7 +527,7 @@ Before finalizing any specification, assert all the following:
499
527
  ## Resources
500
528
 
501
529
  ### Templates (`templates/`)
502
- - `init.json` — Metadata schema for spec.json
530
+ - `spec-state.json` — Metadata/state schema used to create `spec.json`
503
531
  - `requirements-init.md` — Empty requirements template
504
532
  - `requirements.md` — Full requirements template
505
533
  - `design.md` — Design document template
@@ -43,7 +43,7 @@ These rules override any self-reasoning or optimization the system may attempt:
43
43
  5. **No false completion.** You MUST NOT set `validation.status = "completed"` or `ready_for_implementation = true` until a reconciliation audit proves the accepted findings and validation decisions are reflected in the physical spec artifacts.
44
44
  6. **Provider drift is a real defect.** If the scope changed away from Claude/Anthropic, stale strings like `Claude API`, `Haiku`, or `haiku_reachable` in `requirements.md`, `design.md`, or `tasks/*.md` are validation failures. `research.md` may mention them only as historical comparison.
45
45
  7. **Implementation-facing propagation is mandatory.** A decision that affects implementation is NOT considered applied if it only appears in `Risk Assessment`, `validate-log.md`, or `red-team-report.md`. It must update at least one of: `requirements.md`, `Canonical Contracts & Invariants`, `Objective`, `Constraints`, `Implementation Steps`, `Completion Criteria`, or `Task Test Plan & Verification Evidence`.
46
- 8. **CafeKit command dialect only.** Validation output MUST use `/hapo:develop <feature>` as the implementation handoff. Never mention `/sdd:execute-spec`, `/sdd:*`, `/work`, `/code`, or non-CafeKit aliases.
46
+ 8. **CafeKit command dialect only.** Validation output MUST use `/hapo:develop <feature>` as the implementation handoff.
47
47
  9. **CafeKit task filename convention only.** Task files MUST use `tasks/task-R{N}-{SEQ}-<slug>.md` with two-digit `SEQ` (for example `tasks/task-R0-01-project-scaffolding.md`). Files like `tasks/R0-1-project-scaffolding.md` are legacy/foreign format; rename them and update `spec.json.task_files`, `spec.json.task_registry`, and dependency references before passing validation.
48
48
 
49
49
  ---
@@ -231,7 +231,6 @@ Before declaring validation complete:
231
231
  - stale provider strings remain after a provider change
232
232
  - delete-data/privacy artifacts mix multiple canonical policies
233
233
  - any task path fails the CafeKit `tasks/task-R{N}-{SEQ}-<slug>.md` naming convention
234
- - any output or report suggests `/sdd:execute-spec`, `/sdd:*`, `/work`, `/code`, or any non-CafeKit implementation command
235
234
  - `spec.json.updated_at`, `timestamps.review_done`, or `timestamps.validation_done` do not reflect the final reviewed state
236
235
  4. Only after the audit passes may you:
237
236
  - set `spec.json.validation.status = "completed"`
@@ -6,7 +6,7 @@ The following guidelines dictate exactly how `hapo:sync` should interact with fi
6
6
 
7
7
  ## 1. Updating `spec.json`
8
8
 
9
- When requested to update a phase or change task configuration, `spec.json` must maintain its strict schema (defined in `hapo:specs/templates/init.json`).
9
+ When requested to update a phase or change task configuration, `spec.json` must maintain its strict schema (defined in `hapo:specs/templates/spec-state.json`).
10
10
 
11
11
  * **JSON Modification Rule:** Do not output whole files. Instead, load the JSON structure, apply the update to `status`, `current_phase`, `blocker` (if any), `task_files`, and the relevant `task_registry` entry, then overwrite the file cleanly.
12
12
  * **Task Registry Rule:** Resolve the incoming task reference to a single relative path in `task_registry`. Accept either: