micode 0.2.1 → 0.3.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 CHANGED
@@ -3,7 +3,11 @@
3
3
  [![CI](https://github.com/vtemian/micode/actions/workflows/ci.yml/badge.svg)](https://github.com/vtemian/micode/actions/workflows/ci.yml)
4
4
  [![npm version](https://badge.fury.io/js/micode.svg)](https://www.npmjs.com/package/micode)
5
5
 
6
- OpenCode plugin with a structured Brainstorm → Research → Plan → Implement workflow.
6
+ OpenCode plugin with a structured Brainstorm → Plan → Implement workflow.
7
+
8
+
9
+ https://github.com/user-attachments/assets/85236ad3-e78a-4ff7-a840-620f6ea2f512
10
+
7
11
 
8
12
  ## Installation
9
13
 
@@ -17,12 +21,26 @@ Add to `~/.config/opencode/opencode.json`:
17
21
 
18
22
  **AI-assisted install:** Share [INSTALL_CLAUDE.md](./INSTALL_CLAUDE.md) with your AI assistant for guided setup.
19
23
 
24
+ ## Getting Started
25
+
26
+ **Important:** Run `/init` first to generate project documentation:
27
+
28
+ ```
29
+ /init
30
+ ```
31
+
32
+ This creates `ARCHITECTURE.md` and `CODE_STYLE.md` which agents reference during brainstorming, planning, and implementation. Without these files, agents lack context about your codebase patterns.
33
+
20
34
  ## Workflow
21
35
 
22
36
  ```
23
- Brainstorm → Research → Plan → Implement → Review
37
+ Brainstorm → Plan → Implement
38
+ ↓ ↓ ↓
39
+ research research executor
24
40
  ```
25
41
 
42
+ Research subagents (codebase-locator, codebase-analyzer, pattern-finder) are spawned within brainstorm and plan phases - not as a separate step.
43
+
26
44
  ### 1. Brainstorm
27
45
 
28
46
  Refine rough ideas into fully-formed designs through collaborative questioning.
@@ -30,11 +48,10 @@ Refine rough ideas into fully-formed designs through collaborative questioning.
30
48
  - One question at a time
31
49
  - 2-3 approaches with trade-offs
32
50
  - Section-by-section validation
51
+ - Spawns research subagents to understand codebase
33
52
  - Output: `thoughts/shared/designs/YYYY-MM-DD-{topic}-design.md`
34
53
 
35
- ### 2. Research
36
-
37
- Parallel codebase investigation using specialized subagents:
54
+ **Research subagents** (spawned in parallel):
38
55
 
39
56
  | Subagent | Purpose |
40
57
  |----------|---------|
@@ -42,19 +59,18 @@ Parallel codebase investigation using specialized subagents:
42
59
  | `codebase-analyzer` | Explain HOW code works (with file:line refs) |
43
60
  | `pattern-finder` | Find existing patterns to follow |
44
61
 
45
- Output: `thoughts/shared/research/YYYY-MM-DD-{topic}.md`
46
-
47
- ### 3. Plan
62
+ ### 2. Plan
48
63
 
49
64
  Transform validated designs into comprehensive implementation plans.
50
65
 
66
+ - Spawns research subagents for exact paths, signatures, patterns
51
67
  - Bite-sized tasks (2-5 minutes each)
52
68
  - Exact file paths, complete code examples
53
69
  - TDD workflow: failing test → verify fail → implement → verify pass → commit
54
70
  - Get human approval before implementing
55
71
  - Output: `thoughts/shared/plans/YYYY-MM-DD-{topic}.md`
56
72
 
57
- ### 4. Implement
73
+ ### 3. Implement
58
74
 
59
75
  Execute plan in git worktree for isolation:
60
76
 
@@ -62,12 +78,91 @@ Execute plan in git worktree for isolation:
62
78
  git worktree add ../{feature} -b feature/{feature}
63
79
  ```
64
80
 
65
- - **Executor** orchestrates the implement review cycle automatically
66
- - Spawns Implementer → waits → spawns Reviewer → loops if changes requested
67
- - Maximum 3 cycles before escalating to human
68
- - Commit with descriptive messages when approved
81
+ The **Executor** orchestrates task execution with intelligent parallelization:
82
+
83
+ #### How It Works
84
+
85
+ 1. **Parse** - Extract individual tasks from the plan
86
+ 2. **Analyze** - Build dependency graph between tasks
87
+ 3. **Batch** - Group independent tasks for parallel execution
88
+ 4. **Execute** - Run implementer→reviewer cycle per task
89
+ 5. **Aggregate** - Collect results and report status
90
+
91
+ #### Dependency Analysis
92
+
93
+ Tasks are grouped into batches based on their dependencies:
94
+
95
+ ```
96
+ Independent tasks (can parallelize):
97
+ - Modify different files
98
+ - Don't depend on each other's output
99
+ - Don't share state
100
+
101
+ Dependent tasks (must be sequential):
102
+ - Task B modifies a file Task A creates
103
+ - Task B imports something Task A defines
104
+ - Task B's test relies on Task A's implementation
105
+ ```
106
+
107
+ #### Parallel Execution
108
+
109
+ Within a batch, all tasks run concurrently by spawning multiple subagents in a single message:
110
+
111
+ ```
112
+ Plan with 6 tasks:
113
+ ├── Batch 1 (parallel): Tasks 1, 2, 3 → independent, different files
114
+ │ ├── implementer: task 1 ─┐
115
+ │ ├── implementer: task 2 ─┼─ spawn in ONE message
116
+ │ └── implementer: task 3 ─┘
117
+ │ [wait for all]
118
+ │ ├── reviewer: task 1 ─┐
119
+ │ ├── reviewer: task 2 ─┼─ spawn in ONE message
120
+ │ └── reviewer: task 3 ─┘
121
+ │ [wait for all]
122
+
123
+ └── Batch 2 (parallel): Tasks 4, 5, 6 → depend on batch 1
124
+ └── [same pattern]
125
+ ```
126
+
127
+ #### Per-Task Cycle
128
+
129
+ Each task gets its own implement→review loop:
130
+
131
+ 1. Spawn implementer with task details
132
+ 2. Spawn reviewer to check implementation
133
+ 3. If changes requested → re-spawn implementer (max 3 cycles)
134
+ 4. Mark as DONE or BLOCKED
135
+
136
+ #### Example Output
137
+
138
+ ```
139
+ ## Execution Complete
140
+
141
+ **Plan**: thoughts/shared/plans/2024-01-15-auth-feature.md
142
+ **Total tasks**: 6
143
+ **Batches**: 2
144
+
145
+ ### Dependency Analysis
146
+ - Batch 1 (parallel): Tasks 1, 2, 3 - independent, no shared files
147
+ - Batch 2 (parallel): Tasks 4, 5, 6 - depend on batch 1
148
+
149
+ ### Results
150
+
151
+ | Task | Status | Cycles | Notes |
152
+ |------|--------|--------|-------|
153
+ | 1 | ✅ DONE | 1 | |
154
+ | 2 | ✅ DONE | 2 | Fixed type error |
155
+ | 3 | ✅ DONE | 1 | |
156
+ | 4 | ✅ DONE | 1 | |
157
+ | 5 | ❌ BLOCKED | 3 | Test assertion failing |
158
+ | 6 | ✅ DONE | 1 | |
159
+
160
+ ### Summary
161
+ - Completed: 5/6 tasks
162
+ - Blocked: 1 task needs human intervention
163
+ ```
69
164
 
70
- ### 5. Handoff
165
+ ### 4. Handoff
71
166
 
72
167
  Save/resume session state for continuity:
73
168
 
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var brainstormerAgent = {
16
16
  mode: "primary",
17
17
  model: "anthropic/claude-opus-4-5",
18
18
  temperature: 0.7,
19
+ tools: { ask: true },
19
20
  prompt: `<purpose>
20
21
  Turn ideas into fully formed designs through natural collaborative dialogue.
21
22
  This is DESIGN ONLY. The planner agent handles detailed implementation plans.
@@ -1098,7 +1099,8 @@ var primaryAgent = {
1098
1099
  budgetTokens: 32000
1099
1100
  },
1100
1101
  maxTokens: 64000,
1101
- prompt: PROMPT
1102
+ prompt: PROMPT,
1103
+ tools: { ask: true }
1102
1104
  };
1103
1105
  var PRIMARY_AGENT_NAME = process.env.OPENCODE_AGENT_NAME || "Commander";
1104
1106
 
@@ -1324,7 +1326,7 @@ var agents = {
1324
1326
  };
1325
1327
 
1326
1328
  // src/tools/ast-grep/index.ts
1327
- var {spawn } = globalThis.Bun;
1329
+ var {spawn, which } = globalThis.Bun;
1328
1330
 
1329
1331
  // node_modules/zod/v4/classic/external.js
1330
1332
  var exports_external = {};
@@ -13648,6 +13650,20 @@ function tool(input) {
13648
13650
  tool.schema = exports_external;
13649
13651
 
13650
13652
  // src/tools/ast-grep/index.ts
13653
+ async function checkAstGrepAvailable() {
13654
+ const sgPath = which("sg");
13655
+ if (sgPath) {
13656
+ return { available: true };
13657
+ }
13658
+ return {
13659
+ available: false,
13660
+ message: `ast-grep CLI (sg) not found. AST-aware search/replace will not work.
13661
+ ` + `Install with one of:
13662
+ ` + ` npm install -g @ast-grep/cli
13663
+ ` + ` cargo install ast-grep --locked
13664
+ ` + " brew install ast-grep"
13665
+ };
13666
+ }
13651
13667
  var LANGUAGES = [
13652
13668
  "c",
13653
13669
  "cpp",
@@ -15321,6 +15337,10 @@ var MCP_SERVERS = {
15321
15337
  }
15322
15338
  };
15323
15339
  var OpenCodeConfigPlugin = async (ctx) => {
15340
+ const astGrepStatus = await checkAstGrepAvailable();
15341
+ if (!astGrepStatus.available) {
15342
+ console.warn(`[micode] ${astGrepStatus.message}`);
15343
+ }
15324
15344
  const thinkModeState = new Map;
15325
15345
  const autoCompactHook = createAutoCompactHook(ctx);
15326
15346
  const contextInjectorHook = createContextInjectorHook(ctx);
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Check if ast-grep CLI (sg) is available on the system.
3
+ * Returns installation instructions if not found.
4
+ */
5
+ export declare function checkAstGrepAvailable(): Promise<{
6
+ available: boolean;
7
+ message?: string;
8
+ }>;
1
9
  export declare const ast_grep_search: {
2
10
  description: string;
3
11
  args: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micode",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "OpenCode plugin with Brainstorm-Research-Plan-Implement workflow",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",