@haposoft/cafekit 0.7.18 → 0.7.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haposoft/cafekit",
3
- "version": "0.7.18",
3
+ "version": "0.7.21",
4
4
  "description": "Spec-Driven Development workflow for AI coding assistants. Supports Claude Code and Antigravity with spec-first workflows plus Claude Code hapo: skills.",
5
5
  "author": "Haposoft <nghialt@haposoft.com>",
6
6
  "license": "MIT",
@@ -15,6 +15,7 @@ Reads the full project specification (`hapo:specs`) and relentlessly implements
15
15
  ```bash
16
16
  /hapo:develop <feature name>
17
17
  /hapo:develop specs/<feature-name>
18
+ /hapo:develop <feature name> <specific-task-file.md>
18
19
  ```
19
20
 
20
21
  <HARD-GATE>
@@ -43,17 +44,21 @@ flowchart TD
43
44
  ```
44
45
 
45
46
  ### Step 1: Initialize & Load Spec
46
- - Identify input. Open `specs/<feature-name>/spec.json`.
47
+ - Identify input: Open `specs/<feature-name>/spec.json`.
47
48
  - Check `ready_for_implementation` status. If not ready, notify user.
48
- - List all Markdown files in `specs/<feature-name>/tasks/*.md`. Load them into working memory as the execution guide.
49
+ - **Task Scoping (CRITICAL):**
50
+ - If the user specifies a particular task file (e.g., `task-R0-02...md`), load **ONLY** that specific file into working memory.
51
+ - If no specific task is mentioned, list and load all Markdown files in `specs/<feature-name>/tasks/*.md`.
49
52
 
50
53
  ### Step 2: Scout (Codebase Inspection)
51
54
  - **Mandatory:** Call agent `Task(subagent_type="inspect", ...)` to scan the overall codebase structure (e.g., where components live, where utils are). Avoid wandering into forbidden zones.
52
55
 
53
56
  ### Step 3: Implement Code
54
- - Act as `god-developer` OR directly write code, executing tasks specified in the Markdown files sequentially.
57
+ - Act as `god-developer` OR directly write code, executing tasks specified in the loaded Markdown file(s) sequentially.
55
58
  - **Important:** You may create and modify files directly, but must faithfully follow the design from the Spec.
56
59
  - Progress tracking: Temporarily change `[ ]` to `[/]` in Spec files while coding is in progress.
60
+ - **Hard Stop Protocol:** If you were asked to implement a specific task file, you MUST STOP completely after that task is verified. DO NOT auto-chain or jump to "Next Task" simply because you see it in the spec. Wait for the user's next command.
61
+ - **Test Integrity Protocol:** You MUST NOT delete, replace, or reduce the scope of existing test cases to make tests pass. If a test fails, you must fix the **implementation code** or fix the **test setup/mock**, NOT remove the assertion. Reducing test count or weakening assertions (e.g., removing `toHaveBeenCalledWith` and replacing with `toEqual(expect.any(...))`) is a Critical violation.
57
62
 
58
63
  ### Step 4: Self-Healing (Quality Gate Auto-Fix)
59
64
  The moment you finish coding, DO NOT proceed further. Switch to `references/quality-gate.md` and run the automatic review loop.
@@ -2,7 +2,7 @@
2
2
  name: hapo:specs
3
3
  description: "Structured specification workflow — from vague idea to actionable task list. Includes init, requirements, design, task breakdown, review, and archiving."
4
4
  version: 2.0.0
5
- argument-hint: "<feature-description> | status | resume | review | archive"
5
+ argument-hint: "<feature-description> | status | resume | --validate | archive"
6
6
  ---
7
7
 
8
8
  # Specs (SDD — Specification-Driven Development)
@@ -67,7 +67,7 @@ Display selection menu via `AskUserQuestion`:
67
67
  { "label": "Create new spec", "description": "Initialize spec from a feature description" },
68
68
  { "label": "status", "description": "View status of all specs in specs/" },
69
69
  { "label": "resume", "description": "Continue an in-progress spec" },
70
- { "label": "review", "description": "Review spec (auto-decides: red team or validation)" },
70
+ { "label": "--validate", "description": "Review spec (auto-decides: red team or validation)" },
71
71
  { "label": "archive", "description": "Archive completed specs + write journal" }
72
72
  ],
73
73
  "multiSelect": false
@@ -82,12 +82,27 @@ System auto-analyzes the description:
82
82
  - If task is simple (small bugfix, config change) → suggest "A spec may not be needed for this. Continue anyway?"
83
83
  - If task is complex (multi-module, security/migration related) → auto-activate deep research, ask user 3 scope questions
84
84
 
85
+ ### When called WITH `--validate` argument
86
+
87
+ System IMMEDIATELY jumps to **Step 9: Validation Review**.
88
+ The system MUST NOT execute Steps 1-8. Instead, load `references/review.md` and follow it **step-by-step**.
89
+
90
+ #### `--validate` Guardrails (NON-NEGOTIABLE)
91
+
92
+ 1. **Red Team cannot be skipped by the system.** If auto-decision says "Red Team + Validate", you MUST run Red Team. A previous `code-auditor` review does NOT count — code-auditor reviews source code, NOT specifications. Only the USER can downgrade to "Validate only" by explicitly saying so.
93
+ 2. **MUST use the 4 Personas** defined in `review.md` Part A Step 3 (Security Adversary, Failure Mode Analyst, Assumption Destroyer, Scope & Complexity Critic). Generic observations without persona attribution are REJECTED.
94
+ 3. **MUST use the Finding Format** defined in `review.md` Part A (Severity, Location, Flaw, Failure scenario, Evidence, Suggested fix, Disposition, Rationale). Shortened or custom formats are REJECTED.
95
+ 4. **MUST create `reports/red-team-report.md`** when Red Team runs (review.md Part A Step 8).
96
+ 5. **MUST NOT create implementation code files** (`.ts`, `.js`, `.py`, etc.). The validate workflow produces ONLY markdown spec documents and reports. If a fix requires a new shared module, describe it in the relevant task file instead of creating the actual code file.
97
+ 6. **MUST NOT over-engineer fixes.** Apply YAGNI — if user says "configure later", add an abstraction note to the task, do NOT generate 4 concrete provider implementations.
98
+ 7. **MUST follow auto-decision table exactly.** Count task files + scan for keywords → pick mode. No self-justification to override the table result.
99
+
85
100
  ## Workflow Diagram
86
101
 
87
102
  ```mermaid
88
103
  flowchart TD
89
104
  A["Call /hapo:specs"] --> B{Has description?}
90
- B -->|No| C["Menu: init / status / resume / review / archive"]
105
+ B -->|No| C["Menu: init / status / resume / --validate / archive"]
91
106
  B -->|Yes| D["Step 1: Analyze description"]
92
107
  D --> E{Clear enough?}
93
108
  E -->|No| F["Ask user 1-2 clarifying questions"]
@@ -257,13 +272,15 @@ Load: `references/task-hydration.md`
257
272
  - If TaskCreate tool unavailable → fallback to `TodoWrite`
258
273
  - Task files are the single source of truth — hydration is just a convenience
259
274
 
260
- ### Step 9: Review (Optional)
275
+ ### Step 9: Validation Review (Optional)
261
276
  Load: `references/review.md` + `rules/design-review.md`
262
277
  - System auto-evaluates spec complexity and decides review depth:
263
278
  - **< 3 task files, no security concerns** → Validate only (lightweight interview)
264
279
  - **>= 5 task files OR security/migration keywords** → Red Team first, then Validate
265
280
  - **User explicit request** → respect user's intent
266
281
  - When both run: Red Team ALWAYS before Validate (red team may change the spec)
282
+ - **PROHIBITION:** The system MUST NOT skip Red Team because of a prior code-auditor review. Code review ≠ Spec review.
283
+ - **PROHIBITION:** The system MUST NOT create `.ts`, `.js`, `.py` or any implementation files during validation. Spec-only outputs.
267
284
 
268
285
  ### Step 10: Completion — Context Reminder (MANDATORY)
269
286
  After completing the spec, output a short summary of what was generated, then you MUST output the following block EXACTLY as written. DO NOT use awkward translations like "Điểm đã phản ánh đúng quyết định của bạn", keep it professional or just output the block directly:
@@ -342,7 +359,7 @@ specs/
342
359
  |---|---|---|
343
360
  | `/hapo:specs status` | View status of all specs | — |
344
361
  | `/hapo:specs resume <feature>` | Continue an in-progress spec | — |
345
- | `/hapo:specs review <feature>` | Review spec (auto: red team + validate based on complexity) | `references/review.md` |
362
+ | `/hapo:specs --validate <feature>` | Validate spec (auto: red team + validate based on complexity) | `references/review.md` |
346
363
  | `/hapo:specs archive` | Archive completed specs + write journal | `references/archive-workflow.md` |
347
364
 
348
365
  ## Quality Standards
@@ -28,6 +28,19 @@ The system evaluates the spec and picks the appropriate review mode:
28
28
  1. Red Team may change the spec (added risks, removed sections)
29
29
  2. Validate should confirm the FINAL spec, not a pre-review draft
30
30
 
31
+ ## Guardrails (NON-NEGOTIABLE)
32
+
33
+ These rules override any self-reasoning or optimization the system may attempt:
34
+
35
+ 1. **No self-override of auto-decision.** If the table above says "Red Team → then Validate", you MUST run Red Team. You CANNOT skip it because:
36
+ - A `code-auditor` previously reviewed the spec (code review ≠ spec review)
37
+ - The spec "looks good" to you
38
+ - You want to "save time"
39
+ - Only the USER can downgrade the mode by explicitly saying "just validate" or "skip red team"
40
+ 2. **No implementation code files.** This workflow produces ONLY `.md` files. If a finding requires a new shared module or config file, describe it inside the relevant `task-*.md` file. Do NOT create `.ts`, `.js`, `.py`, or any source code file.
41
+ 3. **Findings must use the exact format** defined in Part A Step 5 below. No shortened or custom formats.
42
+ 4. **Apply YAGNI to fixes.** When user says "configure later" or "decide later", add a single note to the task file. Do NOT generate multiple concrete implementations (e.g., 4 provider files when user only asked for abstraction).
43
+
31
44
  ---
32
45
 
33
46
  ## Part A: Red Team Review (Adversarial)
@@ -109,9 +109,13 @@ Return a **structured verdict** (required format — not free-form prose):
109
109
  - Accessibility issues: N found | none
110
110
  - Screenshots: [paths]
111
111
 
112
+ ### Test Regression Check
113
+ - **Comparison:** Compare current test count and assertion depth against previous runs.
114
+ - **Result:** OK | REGRESSION (tests deleted/weakened)
115
+
112
116
  ### Action
113
117
  - PASS → Proceed. Hand off to hapo:code-review.
114
- - FAIL → [list specific fixes needed] → Return to god-developer.
118
+ - FAIL → [list specific fixes needed] → Return to god-developer. (If REGRESSION: label "Test Regression — tests were deleted or weakened to produce green result")
115
119
  - PARTIAL → [list uncovered areas] → Consider adding tests.
116
120
  - NO_TESTS → No test runner detected. User must configure tests first.
117
121