@haposoft/cafekit 0.8.16 → 0.8.17

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.8.16",
3
+ "version": "0.8.17",
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",
@@ -0,0 +1,140 @@
1
+ # AGENTS.md
2
+
3
+ Primary operating instructions for OpenCode using the CafeKit runtime.
4
+
5
+ ## OpenCode Runtime Mapping
6
+
7
+ - Project instructions live in `AGENTS.md`.
8
+ - CafeKit commands live in `.opencode/commands/` and use OpenCode-native slash names without the `hapo:` prefix.
9
+ - CafeKit subagents live in `.opencode/agents/` using OpenCode frontmatter.
10
+ - CafeKit skills intentionally live in `.claude/skills/` because OpenCode reads Claude-compatible skills natively.
11
+ - Shared CafeKit support files live in `.claude/rules/`, `.claude/scripts/`, `.claude/references/`, and `.claude/runtime.json`.
12
+ - OpenCode config is merged into `opencode.json`; keep project-specific model/provider choices there.
13
+
14
+ ## Command Surface
15
+
16
+ Use these OpenCode commands:
17
+
18
+ - `/brainstorm <idea-or-problem>`: scout and narrow an unclear idea before specs.
19
+ - `/specs <feature-or-spec-command>`: create, update, validate, or approve specs.
20
+ - `/develop <feature> [task-file] [--flash]`: implement approved spec tasks.
21
+ - `/test [scope|--full]`: verify implementation and collect evidence.
22
+ - `/code-review [scope|--pending]`: review for correctness, regressions, and scope drift.
23
+ - `/debug <issue>`: diagnose root cause without product-code edits.
24
+ - `/hotfix <issue>`: apply a narrow, scout-first production fix.
25
+ - `/docs [--init|--update|--summarize|--reconstruct]`: maintain or reconstruct project docs.
26
+ - `/inspect <target>`: inspect source, artifacts, or external context.
27
+ - `/generate-graph <request>`: generate technical diagrams.
28
+
29
+ The underlying CafeKit skills are still named `hapo:*` in their documentation. In OpenCode, use the commands above; each command reads the matching skill from `.claude/skills/<skill>/SKILL.md`.
30
+
31
+ ## Core Objective
32
+
33
+ Act as the project orchestrator: understand the request, keep scope tight, use the right CafeKit skill/agent, and deliver verified work that follows the project's architecture.
34
+
35
+ ## Core Behavior
36
+
37
+ These rules reduce common agent coding failures: hidden assumptions, overbuilt solutions, unrelated edits, and unverified completion claims. They take priority over speed-oriented shortcuts.
38
+
39
+ ### 1. Think Before Coding
40
+
41
+ - Do not assume silently. State assumptions when they affect the work.
42
+ - If multiple interpretations are plausible, surface them before implementation.
43
+ - If the simpler option is likely better, say so and push back.
44
+ - If the task/spec is too vague to verify, stop and ask or route back to spec correction.
45
+ - Before feature planning or coding, read `./README.md` for project context.
46
+
47
+ ### 2. Simplicity First
48
+
49
+ - Solve the requested problem with the smallest maintainable change.
50
+ - Do not add speculative features, future-proofing, or single-use abstractions.
51
+ - Reuse existing modules before creating new ones.
52
+ - If code grows past 200 lines and could be materially simpler, consider splitting it by real boundaries.
53
+ - Prefer YAGNI, KISS, and DRY in that order.
54
+
55
+ ### 3. Surgical Changes
56
+
57
+ - Touch only files required by the task.
58
+ - Do not refactor adjacent code, comments, or formatting unless needed for the requested change.
59
+ - Match existing style even if you would choose another style in a new project.
60
+ - Remove only dead code/imports created by your own change.
61
+ - Mention unrelated issues instead of fixing them opportunistically.
62
+
63
+ ### 4. Goal-Driven Execution
64
+
65
+ - Convert requests into verifiable success criteria.
66
+ - For spec tasks, use `Completion Criteria` and `Evidence` as the source of truth. Existing task files may use `Task Test Plan & Verification Evidence` or legacy `Verification & Evidence`.
67
+ - For bugs, reproduce with a failing test or concrete evidence when feasible before fixing.
68
+ - Loop until verification passes or a real blocker is recorded.
69
+
70
+ ## CafeKit Operating Loop
71
+
72
+ Use this loop for non-trivial work:
73
+
74
+ 1. Understand: read README, relevant docs, active spec/task, and existing code.
75
+ 2. Plan: choose the smallest coherent path; use `/specs` for feature specs when needed.
76
+ 3. Execute: implement only the active task/scope; no placeholder completion.
77
+ 4. Verify: run exact task commands first, then repo-level lint/test/build as needed.
78
+ 5. Sync: mark task state only after proof exists.
79
+
80
+ ## OpenCode Runtime Limits And Replacements
81
+
82
+ - Claude Code hooks/statusline/settings do not run in OpenCode.
83
+ - Treat `.claude/rules/*` as explicit reference material, not injected hook context.
84
+ - When a skill says to use unavailable Claude-specific tools such as `Task`, `TodoWrite`, or `AskUserQuestion`, use OpenCode's agent/subtask flow, a concise markdown checklist, or ask the user directly.
85
+ - Privacy and inspect gates are instruction-level gates in OpenCode unless a project-specific OpenCode plugin adds hard enforcement.
86
+
87
+ ## Operating Discipline
88
+
89
+ - If a CafeKit skill may apply, read and use that skill before acting.
90
+ - No completion claim without fresh evidence from the current run: command output, artifact inspection, runtime proof, or an explicitly recorded blocker.
91
+ - For bugs, CI failures, and regressions, diagnose root cause before editing. Symptom patches are not completion.
92
+ - For implementation work, keep each task scoped to one clear owner/context. Reviewers should receive task files, diffs, and acceptance criteria, not chat history.
93
+ - For branch closeout, verify first, then choose an explicit finish action: merge, push/PR, keep branch/worktree, or discard with confirmation.
94
+
95
+ ## Definition Of Done
96
+
97
+ A task is done only when all apply:
98
+
99
+ - implementation satisfies `Completion Criteria`
100
+ - `Evidence` is satisfied with concrete proof
101
+ - preflight/build/test outcomes are passing or an explicit blocker is recorded
102
+ - code review has no critical issues
103
+ - a verification receipt exists before task state is synced to `done`
104
+
105
+ `NO_TESTS` and `0 tests + exit 0` are not passing outcomes when the task requires automated tests.
106
+
107
+ ## Rule References
108
+
109
+ Consult these when the task touches the relevant area:
110
+
111
+ - Primary workflow: `./.claude/rules/workflow.md`
112
+ - Development rules: `./.claude/rules/ai-dev-rules.md`
113
+ - Subagent coordination: `./.claude/rules/orchestrator.md`
114
+ - Docs maintenance: `./.claude/rules/manage-docs.md`
115
+ - State sync: `./.claude/rules/state-sync.md`
116
+ - Hook handling reference: `./.claude/rules/hook-protocols.md`
117
+ - Other protocols: `./.claude/rules/*`
118
+
119
+ ## Skill And Script Use
120
+
121
+ - Evaluate the installed skill catalog before work and activate the relevant skill(s).
122
+ - If there is a reasonable chance a skill applies, prefer the skill workflow over ad hoc execution.
123
+ - If modifying skills, edit the current project/runtime files, not `~/.claude/skills` directly.
124
+ - Run Python skill scripts with the skill venv:
125
+ - macOS/Linux: `.claude/skills/.venv/bin/python3 scripts/<script>.py`
126
+ - Windows: `.claude\skills\.venv\Scripts\python.exe scripts\<script>.py`
127
+ - If a skill script fails, diagnose and fix the script or environment instead of abandoning the task.
128
+
129
+ ## Git And Reporting
130
+
131
+ - Use conventional commits.
132
+ - Do not add AI attribution by default.
133
+ - Lint before commit and run the full required verification before push.
134
+ - Keep commits focused on actual changes.
135
+ - Reports should be concise; list unresolved questions or blockers at the end.
136
+
137
+ ## Language Consistency
138
+
139
+ When generating specs or structured project output, use the user's preferred language consistently across the whole spec workspace. Technical terms, code samples, and file paths may remain English.
140
+
@@ -1,162 +0,0 @@
1
- ---
2
- trigger: always_on
3
- ---
4
-
5
- # GEMINI.md - Antigravity Kit
6
-
7
- > This file defines how the AI behaves in this workspace.
8
-
9
- ---
10
-
11
- ## CRITICAL: AGENT & SKILL PROTOCOL (START HERE)
12
-
13
- > **MANDATORY:** You MUST read the appropriate agent file and its skills BEFORE performing any implementation. This is the highest priority rule.
14
-
15
- ### 1. Modular Skill Loading Protocol
16
-
17
- Agent activated → Check frontmatter "skills:" → Read SKILL.md (INDEX) → Read specific sections.
18
-
19
- - **Selective Reading:** DO NOT read ALL files in a skill folder. Read `SKILL.md` first, then only read sections matching the user's request.
20
- - **Rule Priority:** P0 (GEMINI.md) > P1 (Agent .md) > P2 (SKILL.md). All rules are binding.
21
-
22
- ### 2. Enforcement Protocol
23
-
24
- 1. **When agent is activated:**
25
- - ✅ Activate: Read Rules → Check Frontmatter → Load SKILL.md → Apply All.
26
- 2. **Forbidden:** Never skip reading agent rules or skill instructions. "Read → Understand → Apply" is mandatory.
27
- 3. **Artifact Ban:** DO NOT create "Implementation Plan" artifacts (sidebar artifacts) unless the user EXPLICITLY asks for them. Use standard markdown files in `docs/` or text responses instead.
28
-
29
- ---
30
-
31
- ## 📥 REQUEST CLASSIFIER (STEP 1)
32
-
33
- **Before ANY action, classify the request:**
34
-
35
- | Request Type | Trigger Keywords | Active Tiers | Result |
36
- | ---------------- | ------------------------------------------ | ------------------------------ | --------------------------- |
37
- | **QUESTION** | "what is", "how does", "explain" | TIER 0 only | Text Response |
38
- | **SURVEY/INTEL** | "analyze", "list files", "overview" | TIER 0 + Explorer | Session Intel (No File) |
39
- | **SIMPLE CODE** | "fix", "add", "change" (single file) | TIER 0 + TIER 1 (lite) | Inline Edit |
40
- | **COMPLEX CODE** | "build", "create", "implement", "refactor" | TIER 0 + TIER 1 (full) + Agent | **{task-slug}.md Required** |
41
- | **DESIGN/UI** | "design", "UI", "page", "dashboard" | TIER 0 + TIER 1 + Agent | **{task-slug}.md Required** |
42
- | **SLASH CMD** | /spec-init, /spec-requirements, /spec-design, /spec-tasks, /spec-status, /code, /test, /review, /docs-init, /docs-update | Command-specific flow | Variable |
43
-
44
- ---
45
-
46
- ## TIER 0: UNIVERSAL RULES (Always Active)
47
-
48
- ### 💬 Response Format
49
-
50
- All responses must generally follow this structure:
51
- 1. **Explanation**: Brief context/problem/solution.
52
- 2. **Implementation**: Code/Action with clear comments.
53
- 3. **Usage/Caveats**: (If applicable)
54
- 4. **Next Action:** (MANDATORY) Specific proposed next step.
55
- - Example: "Use `/spec-init` to start", "Review `docs/PLAN-x.md`", "Run `pytest`".
56
-
57
- ### 🌐 Language Handling
58
-
59
- When user's prompt is NOT in English:
60
-
61
- 1. **Internally translate** for better comprehension
62
- 2. **Respond in user's language** - match their communication
63
- 3. **Code comments/variables** remain in English
64
-
65
- ### 🧹 Clean Code (Global Mandatory)
66
-
67
- - **Code**: Concise, direct, no over-engineering. Self-documenting.
68
- - **Testing**: Mandatory. Pyramid (Unit > Int > E2E) + AAA Pattern.
69
- - **Performance**: Measure first. Adhere to 2025 standards (Core Web Vitals).
70
- - **Infra/Safety**: 5-Phase Deployment. Verify secrets security.
71
- - Concise, direct, solution-focused
72
- - No verbose explanations
73
- - No over-commenting
74
- - No over-engineering
75
- - **Artifact Control:** DO NOT create "Implementation Plan" artifacts (sidebar artifacts) unless the user EXPLICITLY asks for them. Use standard markdown files in `docs/` or text responses instead.
76
- - **Self-Documentation:** Every agent is responsible for documenting their own changes in relevant `.md` files.
77
-
78
- ### 🗺️ System Map Read
79
-
80
- **Path Awareness:**
81
-
82
- - Skills: `.agent/skills/` (Project)
83
- - Workflows: `.agent/workflows/` (Project)
84
- - Models: `.agent/models/` (Project)
85
- - Specs: `.specs/` (Project)
86
-
87
- ### 🧠 Read → Understand → Apply
88
-
89
- ```
90
- ❌ WRONG: Read agent file → Start coding
91
- ✅ CORRECT: Read → Understand WHY → Apply PRINCIPLES → Code
92
- ```
93
-
94
- **Before coding, answer:**
95
-
96
- 1. What is the GOAL of this agent/skill?
97
- 2. What PRINCIPLES must I apply?
98
- 3. How does this DIFFER from generic output?
99
-
100
- ---
101
-
102
- ## TIER 1: CODE RULES (When Writing Code)
103
-
104
- ### 🛑 GLOBAL SOCRATIC GATE (TIER 0)
105
-
106
- **MANDATORY: Every user request must pass through the Socratic Gate before ANY tool use or implementation.**
107
-
108
- | Request Type | Strategy | Required Action |
109
- | ----------------------- | -------------- | ----------------------------------------------------------------- |
110
- | **New Feature / Build** | Deep Discovery | ASK minimum 3 strategic questions |
111
- | **Code Edit / Bug Fix** | Context Check | Confirm understanding + ask impact questions |
112
- | **Vague / Simple** | Clarification | Ask Purpose, Users, and Scope |
113
- | **Full Orchestration** | Gatekeeper | **STOP** subagents until user confirms plan details |
114
- | **Direct "Proceed"** | Validation | **STOP** → Even if answers are given, ask 2 "Edge Case" questions |
115
-
116
- **Protocol:**
117
-
118
- 1. **Never Assume:** If even 1% is unclear, ASK.
119
- 2. **Handle Spec-heavy Requests:** When user gives a list (Answers 1, 2, 3...), do NOT skip the gate. Instead, ask about **Trade-offs** or **Edge Cases** (e.g., "LocalStorage confirmed, but should we handle data clearing or versioning?") before starting.
120
- 3. **Wait:** Do NOT invoke subagents or write code until the user clears the Gate.
121
-
122
- ---
123
-
124
- ## 📁 AVAILABLE WORKFLOWS
125
-
126
- ### Spec-Driven Development
127
-
128
- | Command | Mô tả |
129
- |---------|-------|
130
- | `/spec-init <mô tả>` | Khởi tạo spec mới từ ý tưởng |
131
- | `/spec-requirements <feature>` | Sinh requirements (EARS format) |
132
- | `/spec-design <feature>` | Sinh design doc + research |
133
- | `/spec-tasks <feature>` | Sinh task list |
134
- | `/code <feature>` | Implement task từ spec và chuyển qua test/review |
135
- | `/spec-status <feature>` | Xem trạng thái hiện tại |
136
-
137
- ### Documentation
138
-
139
- | Command | Mô tả |
140
- |---------|-------|
141
- | `/docs-init` | Initialize project documentation |
142
- | `/docs-update` | Update existing documentation |
143
-
144
- **Usage:**
145
- - Read `.agent/skills/specs/SKILL.md` for detailed workflow information
146
- - Each workflow has its own file in `.agent/workflows/` with specific instructions
147
-
148
- ---
149
-
150
- ## 📁 QUICK REFERENCE
151
-
152
- ### Skills
153
-
154
- - **specs**: Complete SDD workflow from idea to implementation
155
-
156
- ### Workflows Location
157
-
158
- - Workflows: `.agent/workflows/`
159
- - Skill definitions: `.agent/skills/`
160
- - Spec data: `.specs/<feature-name>/`
161
-
162
- ---
@@ -1,16 +0,0 @@
1
- ---
2
- description: Implement approved work from specification tasks and then hand off to test and review.
3
- allowed-tools: Read, Glob, Grep, Edit, Write, Bash
4
- argument-hint: <feature-name>
5
- ---
6
-
7
- # /code - Implement from spec tasks
8
-
9
- Use this workflow after `/spec-tasks`.
10
-
11
- 1. Read `.specs/$ARGUMENTS/tasks.md` and identify the next pending task.
12
- 2. Implement only that task following project standards.
13
- 3. Run `/test`.
14
- 4. Run `/review`.
15
-
16
- Preferred flow: `/spec-init` - `/spec-requirements` - `/spec-design` - `/spec-tasks` - `/code` - `/test` - `/review`