@haposoft/cafekit 0.7.20 → 0.7.22

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.20",
3
+ "version": "0.7.22",
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>
@@ -29,7 +30,7 @@ DO NOT write implementation code until an approved spec exists.
29
30
  | "No need to scout first" | Coding without knowing the architecture is blind. ALWAYS call `inspect` to scan files. |
30
31
  | "Review process is too tedious, let me just finish it myself" | The system needs an audit trail through agents. ALWAYS delegate via `Task` tool. |
31
32
 
32
- ## Absolute 4-Step Workflow
33
+ ## Absolute Workflow
33
34
 
34
35
  ```mermaid
35
36
  flowchart TD
@@ -39,21 +40,26 @@ flowchart TD
39
40
  C --> D[Step 3: Implement Code (god-developer)]
40
41
  D --> E[Step 4: Auto-Fix Code Review / Max 3 rounds]
41
42
  E -->|Fail (code-auditor)| D
42
- E -->|Pass| F[Report Completion]
43
+ E -->|Pass| F[Step 5: Incremental Docs Sync]
44
+ F --> G[Report Completion]
43
45
  ```
44
46
 
45
47
  ### Step 1: Initialize & Load Spec
46
- - Identify input. Open `specs/<feature-name>/spec.json`.
48
+ - Identify input: Open `specs/<feature-name>/spec.json`.
47
49
  - 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.
50
+ - **Task Scoping (CRITICAL):**
51
+ - If the user specifies a particular task file (e.g., `task-R0-02...md`), load **ONLY** that specific file into working memory.
52
+ - If no specific task is mentioned, list and load all Markdown files in `specs/<feature-name>/tasks/*.md`.
49
53
 
50
54
  ### Step 2: Scout (Codebase Inspection)
51
55
  - **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
56
 
53
57
  ### Step 3: Implement Code
54
- - Act as `god-developer` OR directly write code, executing tasks specified in the Markdown files sequentially.
58
+ - Act as `god-developer` OR directly write code, executing tasks specified in the loaded Markdown file(s) sequentially.
55
59
  - **Important:** You may create and modify files directly, but must faithfully follow the design from the Spec.
56
60
  - Progress tracking: Temporarily change `[ ]` to `[/]` in Spec files while coding is in progress.
61
+ - **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.
62
+ - **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
63
 
58
64
  ### Step 4: Self-Healing (Quality Gate Auto-Fix)
59
65
  The moment you finish coding, DO NOT proceed further. Switch to `references/quality-gate.md` and run the automatic review loop.
@@ -61,6 +67,11 @@ The moment you finish coding, DO NOT proceed further. Switch to `references/qual
61
67
 
62
68
  - Only escalate to the user after 3 consecutive failed review rounds.
63
69
 
70
+ ### Step 5: Incremental Docs Sync
71
+ - After passing the Quality Gate, evaluate if any actual codebase modifications occurred (e.g., check pending files via git status).
72
+ - If files were created or modified: Trigger `docs-keeper` automatically to execute `repomix` and update the global `/docs/` and project logs.
73
+ - Do NOT skip this step! The user explicitly requires documentation to be synced immediately after every `/hapo:develop` action, overriding the default Phase 3-only rule.
74
+
64
75
  ---
65
76
  ## Attached References
66
77
  - `references/quality-gate.md` - Rules for the Code Review loop.
@@ -85,7 +85,17 @@ System auto-analyzes the description:
85
85
  ### When called WITH `--validate` argument
86
86
 
87
87
  System IMMEDIATELY jumps to **Step 9: Validation Review**.
88
- The system MUST NOT execute Steps 1-8. Instead, load `references/review.md`, adopt Red Team personas, and read the entire `specs/` directory to hunt for flaws before interviewing the user.
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.
89
99
 
90
100
  ## Workflow Diagram
91
101
 
@@ -269,6 +279,8 @@ Load: `references/review.md` + `rules/design-review.md`
269
279
  - **>= 5 task files OR security/migration keywords** → Red Team first, then Validate
270
280
  - **User explicit request** → respect user's intent
271
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.
272
284
 
273
285
  ### Step 10: Completion — Context Reminder (MANDATORY)
274
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:
@@ -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