@haposoft/cafekit 0.14.1 → 0.15.0
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/README.md +86 -11
- package/bin/__tests__/codex-hooks.test.js +331 -0
- package/bin/__tests__/codex-native.test.js +458 -0
- package/bin/__tests__/installer-safety.test.js +259 -0
- package/bin/install.js +30 -8
- package/bin/lib/backup.js +82 -18
- package/bin/lib/codex-frontmatter.js +56 -0
- package/bin/lib/codex-install.js +195 -0
- package/bin/lib/context.js +65 -8
- package/bin/lib/copy-utils.js +1 -1
- package/bin/lib/i18n.js +12 -3
- package/bin/lib/managed-writer.js +17 -2
- package/bin/lib/manifest.js +21 -4
- package/bin/lib/opencode-install.js +21 -19
- package/bin/lib/path-safety.js +40 -0
- package/bin/lib/version-check.js +25 -12
- package/bin/phases/claude-runtime.js +60 -9
- package/bin/phases/codex-runtime.js +110 -0
- package/bin/phases/copy-payload.js +36 -16
- package/bin/phases/post-install.js +98 -48
- package/bin/phases/root-config.js +4 -2
- package/bin/phases/select-platform.js +105 -66
- package/bin/phases/summary.js +6 -1
- package/package.json +3 -2
- package/src/claude/CLAUDE.md +1 -1
- package/src/claude/agents/code-auditor.md +1 -1
- package/src/claude/agents/debugger.md +1 -0
- package/src/claude/agents/god-developer.md +10 -1
- package/src/claude/agents/inspector.md +1 -0
- package/src/claude/agents/spec-maker.md +1 -1
- package/src/claude/agents/test-runner.md +2 -2
- package/src/claude/hooks/__tests__/privacy-block.test.js +50 -10
- package/src/claude/hooks/__tests__/spec-gate.test.js +75 -1
- package/src/claude/hooks/__tests__/state.test.js +65 -0
- package/src/claude/hooks/docs-sync.cjs +15 -21
- package/src/claude/hooks/inspect-block.cjs +1 -1
- package/src/claude/hooks/lib/config.cjs +0 -5
- package/src/claude/hooks/privacy-block.cjs +39 -62
- package/src/claude/hooks/spec-gate.cjs +18 -7
- package/src/claude/hooks/spec-state.cjs +4 -0
- package/src/claude/hooks/state.cjs +13 -3
- package/src/claude/hooks/usage.cjs +6 -0
- package/src/claude/rules/orchestrator.md +2 -2
- package/src/claude/rules/skill-domain-routing.md +27 -86
- package/src/claude/rules/skill-workflow-routing.md +11 -82
- package/src/claude/rules/state-sync.md +1 -1
- package/src/claude/runtime.json +7 -7
- package/src/claude/scripts/generate-skill-catalog.cjs +8 -3
- package/src/claude/scripts/validate-spec-output.cjs +6 -0
- package/src/claude/skills/code-review/references/spec-compliance-review.md +1 -1
- package/src/claude/skills/develop/SKILL.md +26 -5
- package/src/claude/skills/develop/references/parallel-waves.md +112 -0
- package/src/claude/skills/develop/references/quality-gate.md +10 -2
- package/src/claude/skills/hotfix/references/parallel-patterns.md +1 -1
- package/src/claude/skills/inspect/SKILL.md +42 -113
- package/src/claude/skills/inspect/references/internal-inspection.md +16 -135
- package/src/claude/skills/specs/SKILL.md +134 -386
- package/src/claude/skills/specs/rules/tasks-generation.md +1 -1
- package/src/claude/skills/specs/templates/task.md +3 -1
- package/src/claude/skills/sync/SKILL.md +2 -2
- package/src/claude/skills/sync/references/sync-protocols.md +4 -4
- package/src/claude/skills/test/SKILL.md +1 -1
- package/src/claude/status.cjs +9 -6
- package/src/codex/AGENTS.md +30 -0
- package/src/codex/agents-gitignore +11 -0
- package/src/codex/gitignore +12 -0
- package/src/codex/hooks/agent.cjs +66 -0
- package/src/codex/hooks/docs-sync.cjs +66 -0
- package/src/codex/hooks/inspect-block.cjs +40 -0
- package/src/codex/hooks/lib/hook-context.cjs +93 -0
- package/src/codex/hooks/lib/inspect-paths.cjs +199 -0
- package/src/codex/hooks/lib/privacy-state.cjs +199 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +78 -0
- package/src/codex/hooks/lib/spec-utils.cjs +50 -0
- package/src/codex/hooks/lib/state-store.cjs +166 -0
- package/src/codex/hooks/privacy-approval.cjs +59 -0
- package/src/codex/hooks/privacy-block.cjs +182 -0
- package/src/codex/hooks/rules.cjs +79 -0
- package/src/codex/hooks/session.cjs +114 -0
- package/src/codex/hooks/spec-gate.cjs +80 -0
- package/src/codex/hooks/spec-state.cjs +73 -0
- package/src/codex/hooks/state.cjs +157 -0
- package/src/codex/hooks/task-scaffold-guard.cjs +63 -0
- package/src/codex/hooks.json +122 -0
- package/src/codex/rules/hook-protocols.md +32 -0
- package/src/codex/rules/state-sync.md +41 -0
- package/src/codex/runtime.json +28 -0
- package/src/opencode/plugins/docs-sync.ts +10 -16
- package/src/claude/archive-command/code/SKILL.md +0 -55
- package/src/claude/archive-command/code/references/execution-loop.md +0 -21
- package/src/claude/archive-command/code.md +0 -17
- package/src/claude/archive-command/docs.md +0 -609
- package/src/claude/archive-command/review/codebase/parallel.md +0 -76
- package/src/claude/archive-command/spec-design.md +0 -247
- package/src/claude/archive-command/spec-init.md +0 -120
- package/src/claude/archive-command/spec-requirements.md +0 -138
- package/src/claude/archive-command/spec-status.md +0 -98
- package/src/claude/archive-command/spec-tasks.md +0 -173
- package/src/claude/archive-command/spec-validate.md +0 -118
- package/src/claude/archive-command/test.md +0 -8
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# Internal Discovery with Explore Subagents
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
|
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
|
-
|
|
138
|
-
- Read entire file with Read tool
|
|
42
|
+
## Timeout, Aggregation, Reading
|
|
139
43
|
|
|
140
|
-
|
|
141
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
|