micode 0.3.2 → 0.3.4
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/INSTALL_CLAUDE.md +10 -10
- package/README.md +2 -2
- package/dist/config-loader.d.ts +20 -0
- package/dist/index.js +59 -3
- package/package.json +1 -1
package/INSTALL_CLAUDE.md
CHANGED
|
@@ -4,7 +4,7 @@ This document guides AI assistants through the micode plugin installation proces
|
|
|
4
4
|
|
|
5
5
|
## Step 0: Ask User About Setup
|
|
6
6
|
|
|
7
|
-
micode uses Claude Opus 4.5 for its primary agents (
|
|
7
|
+
micode uses Claude Opus 4.5 for its primary agents (commander, brainstormer, project-initializer). Ask the user:
|
|
8
8
|
|
|
9
9
|
### Question 1: Claude Subscription
|
|
10
10
|
|
|
@@ -22,8 +22,8 @@ micode uses Claude Opus 4.5 for its primary agents (Commander, Brainstormer, pro
|
|
|
22
22
|
```json
|
|
23
23
|
{
|
|
24
24
|
"agents": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"commander": { "model": "opencode/big-pickle" },
|
|
26
|
+
"brainstormer": { "model": "opencode/big-pickle" },
|
|
27
27
|
"project-initializer": { "model": "opencode/big-pickle" }
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -98,7 +98,7 @@ opencode auth login
|
|
|
98
98
|
## Step 5: Verify Everything Works
|
|
99
99
|
|
|
100
100
|
1. Run `opencode` in terminal
|
|
101
|
-
2. Check that
|
|
101
|
+
2. Check that commander agent is available
|
|
102
102
|
3. Try `/init` command to test project-initializer
|
|
103
103
|
|
|
104
104
|
## Step 6: Congratulate User
|
|
@@ -108,8 +108,8 @@ Say to user:
|
|
|
108
108
|
> Congratulations! 🎉 You have successfully set up micode!
|
|
109
109
|
>
|
|
110
110
|
> **What you can do now:**
|
|
111
|
-
> - Use **
|
|
112
|
-
> - Use **
|
|
111
|
+
> - Use **commander** as your main orchestrator
|
|
112
|
+
> - Use **brainstormer** for design exploration
|
|
113
113
|
> - Run `/init` to generate ARCHITECTURE.md and CODE_STYLE.md
|
|
114
114
|
>
|
|
115
115
|
> **Workflow:** Brainstorm → Research → Plan → Implement → Review
|
|
@@ -137,8 +137,8 @@ Never run this automatically without consent.
|
|
|
137
137
|
|
|
138
138
|
| Agent | Model | Purpose |
|
|
139
139
|
|-------|-------|---------|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
140
|
+
| commander | claude-opus-4-5 | Main orchestrator |
|
|
141
|
+
| brainstormer | claude-opus-4-5 | Design exploration |
|
|
142
142
|
| project-initializer | claude-opus-4-5 | Generate docs |
|
|
143
143
|
| codebase-locator | - | Find files |
|
|
144
144
|
| codebase-analyzer | - | Analyze code |
|
|
@@ -168,8 +168,8 @@ To use different models, create `~/.config/opencode/micode.json`:
|
|
|
168
168
|
```json
|
|
169
169
|
{
|
|
170
170
|
"agents": {
|
|
171
|
-
"
|
|
172
|
-
"
|
|
171
|
+
"commander": { "model": "your-preferred-model" },
|
|
172
|
+
"brainstormer": { "model": "your-preferred-model" }
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
```
|
package/README.md
CHANGED
|
@@ -195,8 +195,8 @@ Save/resume session state for continuity:
|
|
|
195
195
|
|
|
196
196
|
| Agent | Mode | Model | Purpose |
|
|
197
197
|
|-------|------|-------|---------|
|
|
198
|
-
|
|
|
199
|
-
|
|
|
198
|
+
| commander | primary | claude-opus-4-5 | Orchestrator, delegates to specialists |
|
|
199
|
+
| brainstormer | primary | claude-opus-4-5 | Design exploration through questioning |
|
|
200
200
|
| project-initializer | subagent | claude-opus-4-5 | Generate ARCHITECTURE.md and CODE_STYLE.md |
|
|
201
201
|
| codebase-locator | subagent | claude-sonnet | Find file locations |
|
|
202
202
|
| codebase-analyzer | subagent | claude-sonnet | Deep code analysis |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AgentConfig } from "@opencode-ai/sdk";
|
|
2
|
+
export interface AgentOverride {
|
|
3
|
+
model?: string;
|
|
4
|
+
temperature?: number;
|
|
5
|
+
maxTokens?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface MicodeConfig {
|
|
8
|
+
agents?: Record<string, AgentOverride>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Load micode.json from ~/.config/opencode/micode.json
|
|
12
|
+
* Returns null if file doesn't exist or is invalid JSON
|
|
13
|
+
* @param configDir - Optional override for config directory (for testing)
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadMicodeConfig(configDir?: string): Promise<MicodeConfig | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Merge user config overrides into plugin agent configs
|
|
18
|
+
* User overrides take precedence for safe properties only
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeAgentConfigs(pluginAgents: Record<string, AgentConfig>, userConfig: MicodeConfig | null): Record<string, AgentConfig>;
|
package/dist/index.js
CHANGED
|
@@ -1117,7 +1117,7 @@ var primaryAgent = {
|
|
|
1117
1117
|
prompt: PROMPT,
|
|
1118
1118
|
tools: { ask: true }
|
|
1119
1119
|
};
|
|
1120
|
-
var PRIMARY_AGENT_NAME = process.env.OPENCODE_AGENT_NAME || "
|
|
1120
|
+
var PRIMARY_AGENT_NAME = process.env.OPENCODE_AGENT_NAME || "commander";
|
|
1121
1121
|
|
|
1122
1122
|
// src/agents/project-initializer.ts
|
|
1123
1123
|
var PROMPT2 = `
|
|
@@ -15964,6 +15964,57 @@ ${result}
|
|
|
15964
15964
|
background_list
|
|
15965
15965
|
};
|
|
15966
15966
|
}
|
|
15967
|
+
// src/config-loader.ts
|
|
15968
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
15969
|
+
import { join as join4 } from "path";
|
|
15970
|
+
import { homedir as homedir2 } from "os";
|
|
15971
|
+
var SAFE_AGENT_PROPERTIES = ["model", "temperature", "maxTokens"];
|
|
15972
|
+
async function loadMicodeConfig(configDir) {
|
|
15973
|
+
const baseDir = configDir ?? join4(homedir2(), ".config", "opencode");
|
|
15974
|
+
const configPath = join4(baseDir, "micode.json");
|
|
15975
|
+
try {
|
|
15976
|
+
const content = await readFile3(configPath, "utf-8");
|
|
15977
|
+
const parsed = JSON.parse(content);
|
|
15978
|
+
if (parsed.agents && typeof parsed.agents === "object") {
|
|
15979
|
+
const sanitizedAgents = {};
|
|
15980
|
+
for (const [agentName, agentConfig] of Object.entries(parsed.agents)) {
|
|
15981
|
+
if (agentConfig && typeof agentConfig === "object") {
|
|
15982
|
+
const sanitized = {};
|
|
15983
|
+
const config2 = agentConfig;
|
|
15984
|
+
for (const prop of SAFE_AGENT_PROPERTIES) {
|
|
15985
|
+
if (prop in config2) {
|
|
15986
|
+
sanitized[prop] = config2[prop];
|
|
15987
|
+
}
|
|
15988
|
+
}
|
|
15989
|
+
sanitizedAgents[agentName] = sanitized;
|
|
15990
|
+
}
|
|
15991
|
+
}
|
|
15992
|
+
return { agents: sanitizedAgents };
|
|
15993
|
+
}
|
|
15994
|
+
return parsed;
|
|
15995
|
+
} catch {
|
|
15996
|
+
return null;
|
|
15997
|
+
}
|
|
15998
|
+
}
|
|
15999
|
+
function mergeAgentConfigs(pluginAgents, userConfig) {
|
|
16000
|
+
if (!userConfig?.agents) {
|
|
16001
|
+
return pluginAgents;
|
|
16002
|
+
}
|
|
16003
|
+
const merged = {};
|
|
16004
|
+
for (const [name, agentConfig] of Object.entries(pluginAgents)) {
|
|
16005
|
+
const userOverride = userConfig.agents[name];
|
|
16006
|
+
if (userOverride) {
|
|
16007
|
+
merged[name] = {
|
|
16008
|
+
...agentConfig,
|
|
16009
|
+
...userOverride
|
|
16010
|
+
};
|
|
16011
|
+
} else {
|
|
16012
|
+
merged[name] = agentConfig;
|
|
16013
|
+
}
|
|
16014
|
+
}
|
|
16015
|
+
return merged;
|
|
16016
|
+
}
|
|
16017
|
+
|
|
15967
16018
|
// src/index.ts
|
|
15968
16019
|
var THINK_KEYWORDS = [
|
|
15969
16020
|
/\bthink\s*(hard|deeply|carefully|through)\b/i,
|
|
@@ -15997,6 +16048,10 @@ var OpenCodeConfigPlugin = async (ctx) => {
|
|
|
15997
16048
|
if (!astGrepStatus.available) {
|
|
15998
16049
|
console.warn(`[micode] ${astGrepStatus.message}`);
|
|
15999
16050
|
}
|
|
16051
|
+
const userConfig = await loadMicodeConfig();
|
|
16052
|
+
if (userConfig?.agents) {
|
|
16053
|
+
console.log(`[micode] Loaded model overrides for: ${Object.keys(userConfig.agents).join(", ")}`);
|
|
16054
|
+
}
|
|
16000
16055
|
const thinkModeState = new Map;
|
|
16001
16056
|
const autoCompactHook = createAutoCompactHook(ctx);
|
|
16002
16057
|
const contextInjectorHook = createContextInjectorHook(ctx);
|
|
@@ -16026,9 +16081,10 @@ var OpenCodeConfigPlugin = async (ctx) => {
|
|
|
16026
16081
|
doom_loop: "allow",
|
|
16027
16082
|
external_directory: "allow"
|
|
16028
16083
|
};
|
|
16084
|
+
const mergedAgents = mergeAgentConfigs(agents, userConfig);
|
|
16029
16085
|
config2.agent = {
|
|
16030
|
-
|
|
16031
|
-
...Object.fromEntries(Object.entries(
|
|
16086
|
+
[PRIMARY_AGENT_NAME]: mergedAgents[PRIMARY_AGENT_NAME],
|
|
16087
|
+
...Object.fromEntries(Object.entries(mergedAgents).filter(([k]) => k !== PRIMARY_AGENT_NAME)),
|
|
16032
16088
|
...config2.agent,
|
|
16033
16089
|
build: { ...config2.agent?.build, mode: "subagent" },
|
|
16034
16090
|
plan: { ...config2.agent?.plan, mode: "subagent" }
|