@haposoft/cafekit 0.14.0 → 0.14.2

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.
Files changed (66) hide show
  1. package/README.md +27 -3
  2. package/bin/__tests__/installer-safety.test.js +145 -0
  3. package/bin/install.js +9 -1
  4. package/bin/lib/backup.js +60 -16
  5. package/bin/lib/context.js +1 -1
  6. package/bin/phases/claude-runtime.js +57 -4
  7. package/bin/phases/post-install.js +39 -26
  8. package/bin/phases/root-config.js +24 -5
  9. package/bin/phases/select-platform.js +14 -9
  10. package/package.json +1 -1
  11. package/src/claude/CLAUDE.md +1 -1
  12. package/src/claude/agents/code-auditor.md +1 -1
  13. package/src/claude/agents/debugger.md +1 -0
  14. package/src/claude/agents/god-developer.md +10 -1
  15. package/src/claude/agents/inspector.md +1 -0
  16. package/src/claude/agents/spec-maker.md +1 -1
  17. package/src/claude/agents/test-runner.md +2 -2
  18. package/src/claude/gitignore +11 -4
  19. package/src/claude/hooks/__tests__/privacy-block.test.js +50 -10
  20. package/src/claude/hooks/__tests__/spec-gate.test.js +75 -1
  21. package/src/claude/hooks/__tests__/state.test.js +65 -0
  22. package/src/claude/hooks/docs-sync.cjs +15 -21
  23. package/src/claude/hooks/inspect-block.cjs +1 -1
  24. package/src/claude/hooks/lib/config.cjs +0 -5
  25. package/src/claude/hooks/privacy-block.cjs +39 -62
  26. package/src/claude/hooks/spec-gate.cjs +18 -7
  27. package/src/claude/hooks/spec-state.cjs +4 -0
  28. package/src/claude/hooks/state.cjs +13 -3
  29. package/src/claude/hooks/usage.cjs +6 -0
  30. package/src/claude/migration-manifest.json +1 -0
  31. package/src/claude/rules/orchestrator.md +2 -2
  32. package/src/claude/rules/skill-domain-routing.md +27 -86
  33. package/src/claude/rules/skill-workflow-routing.md +11 -74
  34. package/src/claude/rules/state-sync.md +1 -1
  35. package/src/claude/runtime.json +7 -7
  36. package/src/claude/scripts/validate-spec-output.cjs +6 -0
  37. package/src/claude/skills/code-review/references/spec-compliance-review.md +1 -1
  38. package/src/claude/skills/delegate/SKILL.md +124 -0
  39. package/src/claude/skills/delegate/references/codex-delegation.md +71 -0
  40. package/src/claude/skills/delegate/references/grok-delegation.md +84 -0
  41. package/src/claude/skills/develop/SKILL.md +26 -5
  42. package/src/claude/skills/develop/references/parallel-waves.md +112 -0
  43. package/src/claude/skills/develop/references/quality-gate.md +10 -2
  44. package/src/claude/skills/hotfix/references/parallel-patterns.md +1 -1
  45. package/src/claude/skills/inspect/SKILL.md +42 -113
  46. package/src/claude/skills/inspect/references/internal-inspection.md +16 -135
  47. package/src/claude/skills/specs/SKILL.md +134 -386
  48. package/src/claude/skills/specs/rules/tasks-generation.md +1 -1
  49. package/src/claude/skills/specs/templates/task.md +3 -1
  50. package/src/claude/skills/sync/SKILL.md +2 -2
  51. package/src/claude/skills/sync/references/sync-protocols.md +4 -4
  52. package/src/claude/skills/test/SKILL.md +1 -1
  53. package/src/claude/status.cjs +9 -6
  54. package/src/opencode/plugins/docs-sync.ts +10 -16
  55. package/src/claude/archive-command/code/SKILL.md +0 -55
  56. package/src/claude/archive-command/code/references/execution-loop.md +0 -21
  57. package/src/claude/archive-command/code.md +0 -17
  58. package/src/claude/archive-command/docs.md +0 -609
  59. package/src/claude/archive-command/review/codebase/parallel.md +0 -76
  60. package/src/claude/archive-command/spec-design.md +0 -247
  61. package/src/claude/archive-command/spec-init.md +0 -120
  62. package/src/claude/archive-command/spec-requirements.md +0 -138
  63. package/src/claude/archive-command/spec-status.md +0 -98
  64. package/src/claude/archive-command/spec-tasks.md +0 -173
  65. package/src/claude/archive-command/spec-validate.md +0 -118
  66. package/src/claude/archive-command/test.md +0 -8
@@ -1,10 +1,6 @@
1
1
  # Internal Discovery with Explore Subagents
2
2
 
3
- Use Explore subagents when SCALE >= 6 or external tools unavailable.
4
-
5
- ## How It Works
6
-
7
- Spawn multiple `Explore` subagents via `Agent` tool to search codebase in parallel.
3
+ Dispatch native Explore agents with breadth medium/very-thorough + the Scope Gate in `SKILL.md`. Use when SCALE ≥ 6 or external tools are unavailable.
8
4
 
9
5
  ## Agent Tool Configuration
10
6
 
@@ -18,156 +14,41 @@ subagent_type: "Explore"
18
14
  Quickly search {DIRECTORY} for files related to: {USER_PROMPT}
19
15
 
20
16
  Instructions:
21
- - Search for relevant files matching the task
22
- - Use Glob/Grep for file discovery
23
- - List files with brief descriptions
24
- - Timeout: 3 minutes max
25
- - Skip if timeout reached
17
+ - Search for relevant files matching the task (Glob/Grep)
18
+ - List files with brief descriptions; timeout 3 minutes; skip if timed out
26
19
 
27
20
  Report format:
28
21
  ## Found Files
29
22
  - `path/file.ext` - description
30
-
31
23
  ## Patterns
32
24
  - Key patterns observed
33
25
  ```
34
26
 
35
27
  ## Spawning Strategy
36
28
 
37
- ### Directory Division
38
- Split codebase logically:
39
- - `src/` - Source code
40
- - `lib/` - Libraries
41
- - `tests/` - Test files
42
- - `config/` - Configuration
43
- - `api/` - API routes
44
- - `types/` - Type definitions
45
-
46
- ### Parallel Execution
47
- - Spawn all agents in single `Agent` tool call
48
- - Each agent gets distinct directory scope
49
- - No overlap between agents
50
-
51
- ## Example
29
+ Split by logical dirs (`src/`, `lib/`, `tests/`, `config/`, `api/`, `types/`). Spawn all in one call; distinct scopes; no overlap.
52
30
 
53
- User prompt: "Find authentication-related files"
54
-
55
- ```
56
- Agent 1: Inspect src/auth/, src/middleware/ for auth files
57
- Agent 2: Inspect src/api/, src/routes/ for auth endpoints
58
- Agent 3: Inspect tests/ for auth tests
59
- Agent 4: Inspect lib/, utils/ for auth utilities
60
- Agent 5: Inspect config/ for auth configuration
61
- Agent 6: Inspect types/, interfaces/ for auth types
62
- ```
31
+ **Example** (auth): A1 `src/auth/, middleware/`; A2 `api/, routes/`; A3 `tests/`; A4 `lib/, utils/`; A5 `config/`; A6 `types/`.
63
32
 
64
33
  ## Task Registration (Optional)
65
34
 
66
- ### When to Register Tasks
67
-
68
- | Agents | Create Tasks? | Rationale |
69
- |--------|--------------|-----------|
70
- | ≤ 2 | No | Overhead exceeds benefit, finishes quickly |
71
- | ≥ 3 | Yes | Meaningful coordination, progress monitoring |
72
-
73
- ### Task Registration Flow
74
-
75
- ```
76
- TaskList() // Check for existing inspect tasks
77
- → Found tasks? → Skip creation, reuse existing
78
- → Empty? → TaskCreate per agent
79
- ```
80
-
81
- ### Task Metadata Pattern
82
-
83
- ```
84
- TaskCreate(
85
- subject: "Inspect {directory} for {target}",
86
- activeForm: "Searching {directory}",
87
- description: "Search {directories} for {patterns}",
88
- metadata: {
89
- agentType: "Explore",
90
- scope: "src/auth/,src/middleware/",
91
- scale: 6,
92
- agentIndex: 1,
93
- totalAgents: 6,
94
- toolMode: "internal",
95
- priority: "P2",
96
- effort: "3m"
97
- }
98
- )
99
- ```
100
-
101
- ### Task Lifecycle
35
+ | Agents | Create Tasks? |
36
+ |--------|--------------|
37
+ | ≤ 2 | No (overhead) |
38
+ | ≥ 3 | Yes |
102
39
 
103
- ```
104
- Step 3: TaskCreate per agent → status: pending
105
- Step 4: Before spawning agent → TaskUpdate → status: in_progress
106
- Step 5: Agent returns report → TaskUpdate → status: completed
107
- Step 5: Agent times out (3m) → Keep in_progress, add error metadata
108
- ```
109
-
110
- ## Timeout Handling
111
-
112
- - Set 3-minute timeout per agent
113
- - Skip non-responding agents
114
- - Don't restart timed-out agents
115
- - Aggregate available results
116
- - Log timeouts in final report's "Unresolved Questions" section
117
-
118
- ## Reading File Content
119
-
120
- When needing to read file content, use chunking to stay within context limits (<150K tokens safe zone).
121
-
122
- ### Step 1: Get Line Counts
123
- Use Read tool with limit/offset or check file size before reading.
124
-
125
- ### Step 2: Calculate Chunks
126
- - **Target:** ~500 lines per chunk (safe for most files)
127
- - **Max files per agent:** 3-5 small files OR 1 large file chunked
128
-
129
- **Chunking formula:**
130
- ```
131
- chunks = ceil(total_lines / 500)
132
- lines_per_chunk = ceil(total_lines / chunks)
133
- ```
134
-
135
- ### Step 3: Read Strategy
40
+ `TaskList` → reuse or `TaskCreate` per agent (`agentType: Explore`, scope, scale, agentIndex, totalAgents, toolMode: internal). Lifecycle: pending → in_progress before spawn → completed on return (timeout: keep in_progress + error metadata).
136
41
 
137
- **Small files (<500 lines each):**
138
- - Read entire file with Read tool
42
+ ## Timeout, Aggregation, Reading
139
43
 
140
- **Large file (>500 lines):**
141
- - Use Read tool with offset/limit parameters
142
- - Read in 500-line chunks
143
-
144
- ### Chunking Decision Tree
145
- ```
146
- File < 500 lines → Read entire file
147
- File 500-1500 lines → Split into 2-3 chunks
148
- File > 1500 lines → Split into ceil(lines/500) chunks
149
- ```
150
-
151
- ## Result Aggregation
152
-
153
- Combine results from all agents:
154
- 1. Deduplicate file paths
155
- 2. Merge descriptions
156
- 3. Note any gaps/timeouts
157
- 4. List unresolved questions
44
+ - 3 min/agent; skip non-responders; do not restart; dedupe paths; note gaps in Unresolved Questions
45
+ - Stay under ~150K tokens; ~500 lines/chunk; max 3–5 small files or 1 large file chunked (`chunks = ceil(total_lines / 500)`); Read with offset/limit
158
46
 
159
47
  ## Scope Discipline
160
48
 
161
- - Start from concrete directories, not repo root
162
- - Prefer scope like `packages/spec/src/claude/skills/**/*.md` over `**/*.md`
163
- - Skip `NO_SCAN_PATHS` from SKILL.md
164
- - Avoid content matching `NO_SCAN_CONTENT_HINTS`
165
- - If request still broad, stop and narrow before continuing
49
+ Start from concrete directories (not repo root); prefer scoped globs; skip `NO_SCAN_PATHS` / `NO_SCAN_CONTENT_HINTS` from SKILL.md; if still broad, narrow first.
166
50
 
167
51
  ## Output Contract
168
52
 
169
- Return:
170
- - file paths
171
- - brief description per file
172
- - notable relationships or repeated patterns
173
- - unresolved questions
53
+ Return: file paths, brief description per file, notable relationships/patterns, unresolved questions.
54
+