xonecas.io
64875
Mc

mini-coder / commit 6e5527b

feat: support .claude configs

Sean2026-02-25 6e5527ba80012ac0f7d7fa6936c3e96679bd62ec parent 5b4e43d

5 files changed

TODO.md+1−1
@@ -15,7 +15,7 @@ Why not just keep using them via their MCP? Simple answer: their tools descripti
1515
1616 https://exa.ai/docs/reference/search-quickstart
1717 https://exa.ai/docs/reference/contents-quickstart
18-**Ask the user for text versions if you can find these pages**
18+**Ask the user for text versions if you can't find these pages**
1919
2020 ## Subagents don't have access to MCP tools?
2121
docs/configs.md+77−0
@@ -0,0 +1,77 @@
1+# Config conventions
2+
3+mini-coder supports both its native `.agents` convention and Claude Code's `.claude` convention for commands and skills.
4+
5+## Supported config roots
6+
7+| Root | Purpose |
8+|---|---|
9+| `.agents/` | mini-coder native config |
10+| `.claude/` | Claude Code-compatible commands/skills |
11+
12+Each root can exist in:
13+
14+- **Local (repo):** `./.agents`, `./.claude`
15+- **Global (home):** `~/.agents`, `~/.claude`
16+
17+## Commands
18+
19+Supported locations:
20+
21+- `./.agents/commands/*.md`
22+- `~/.agents/commands/*.md`
23+- `./.claude/commands/*.md`
24+- `~/.claude/commands/*.md`
25+
26+Format:
27+
28+```md
29+---
30+description: Optional help text
31+model: optional/model-override
32+---
33+
34+Prompt template body with $ARGUMENTS and $1..$9 support.
35+```
36+
37+Filename becomes the command name (`review.md` => `/review`).
38+
39+## Skills
40+
41+Supported locations:
42+
43+- `./.agents/skills/<skill-name>/SKILL.md`
44+- `~/.agents/skills/<skill-name>/SKILL.md`
45+- `./.claude/skills/<skill-name>/SKILL.md`
46+- `~/.claude/skills/<skill-name>/SKILL.md`
47+
48+Format:
49+
50+```md
51+---
52+name: optional-skill-name
53+description: Optional help text
54+---
55+
56+Skill instructions/content.
57+```
58+
59+If `name` is omitted, folder name is used.
60+
61+## Agents (mini-coder specific)
62+
63+Custom subagents are configured in `.agents`:
64+
65+- `./.agents/agents/*.md`
66+- `~/.agents/agents/*.md`
67+
68+(There is no `.claude` compatibility path for agents.)
69+
70+## Precedence and conflicts
71+
72+Precedence rules:
73+
74+1. **Local overrides global**
75+2. At the **same scope** (both local or both global), if `.agents` and `.claude` define the same command/skill name, **`.agents` wins**
76+
77+When same-scope conflicts are detected for commands/skills, mini-coder prints a warning and uses the `.agents` version.
src/cli/config-conflicts.ts+25−0
@@ -0,0 +1,25 @@
1+import * as c from "yoctocolors";
2+import { G, writeln } from "./output.ts";
3+
4+export function warnConventionConflicts(
5+ kind: "commands" | "skills",
6+ scope: "global" | "local",
7+ agentsNames: Iterable<string>,
8+ claudeNames: Iterable<string>,
9+): void {
10+ const agents = new Set(agentsNames);
11+ const claude = new Set(claudeNames);
12+ const conflicts: string[] = [];
13+
14+ for (const name of agents) {
15+ if (claude.has(name)) conflicts.push(name);
16+ }
17+
18+ if (conflicts.length === 0) return;
19+
20+ conflicts.sort((a, b) => a.localeCompare(b));
21+ const list = conflicts.map((n) => c.cyan(n)).join(c.dim(", "));
22+ writeln(
23+ `${G.warn} conflicting ${kind} in ${scope} .agents and .claude: ${list} ${c.dim("— using .agents version")}`,
24+ );
25+}
src/cli/custom-commands.ts+31−8
@@ -1,6 +1,7 @@
11 import { existsSync, readFileSync, readdirSync } from "node:fs";
22 import { homedir } from "node:os";
33 import { basename, join } from "node:path";
4+import { warnConventionConflicts } from "./config-conflicts.ts";
45 import { parseFrontmatter } from "./frontmatter.ts";
56
67 // ─── Types ────────────────────────────────────────────────────────────────────
@@ -57,14 +58,36 @@ function loadFromDir(
5758 // ─── Load all custom commands (global + local, local wins) ───────────────────
5859
5960 export function loadCustomCommands(cwd: string): Map<string, CustomCommand> {
60- const globalDir = join(homedir(), ".agents", "commands");
61- const localDir = join(cwd, ".agents", "commands");
62-
63- const global = loadFromDir(globalDir, "global");
64- const local = loadFromDir(localDir, "local");
65-
66- // Merge: local overrides global
67- return new Map([...global, ...local]);
61+ const globalAgentsDir = join(homedir(), ".agents", "commands");
62+ const globalClaudeDir = join(homedir(), ".claude", "commands");
63+ const localAgentsDir = join(cwd, ".agents", "commands");
64+ const localClaudeDir = join(cwd, ".claude", "commands");
65+
66+ const globalAgents = loadFromDir(globalAgentsDir, "global");
67+ const globalClaude = loadFromDir(globalClaudeDir, "global");
68+ const localAgents = loadFromDir(localAgentsDir, "local");
69+ const localClaude = loadFromDir(localClaudeDir, "local");
70+
71+ warnConventionConflicts(
72+ "commands",
73+ "global",
74+ globalAgents.keys(),
75+ globalClaude.keys(),
76+ );
77+ warnConventionConflicts(
78+ "commands",
79+ "local",
80+ localAgents.keys(),
81+ localClaude.keys(),
82+ );
83+
84+ // Merge precedence: local overrides global; at the same scope, .agents overrides .claude.
85+ return new Map([
86+ ...globalClaude,
87+ ...globalAgents,
88+ ...localClaude,
89+ ...localAgents,
90+ ]);
6891 }
6992
7093 // ─── Template expansion ───────────────────────────────────────────────────────
src/cli/skills.ts+29−6
@@ -1,6 +1,7 @@
11 import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
22 import { homedir } from "node:os";
33 import { join } from "node:path";
4+import { warnConventionConflicts } from "./config-conflicts.ts";
45 import { parseFrontmatter } from "./frontmatter.ts";
56
67 // ─── Types ────────────────────────────────────────────────────────────────────
@@ -55,12 +56,34 @@ function loadFromDir(
5556 // ─── Load all skills (global + local, local wins) ────────────────────────────
5657
5758 export function loadSkills(cwd: string): Map<string, Skill> {
58- const globalDir = join(homedir(), ".agents", "skills");
59- const localDir = join(cwd, ".agents", "skills");
59+ const globalAgentsDir = join(homedir(), ".agents", "skills");
60+ const globalClaudeDir = join(homedir(), ".claude", "skills");
61+ const localAgentsDir = join(cwd, ".agents", "skills");
62+ const localClaudeDir = join(cwd, ".claude", "skills");
6063
61- const global = loadFromDir(globalDir, "global");
62- const local = loadFromDir(localDir, "local");
64+ const globalAgents = loadFromDir(globalAgentsDir, "global");
65+ const globalClaude = loadFromDir(globalClaudeDir, "global");
66+ const localAgents = loadFromDir(localAgentsDir, "local");
67+ const localClaude = loadFromDir(localClaudeDir, "local");
6368
64- // Merge: local overrides global
65- return new Map([...global, ...local]);
69+ warnConventionConflicts(
70+ "skills",
71+ "global",
72+ globalAgents.keys(),
73+ globalClaude.keys(),
74+ );
75+ warnConventionConflicts(
76+ "skills",
77+ "local",
78+ localAgents.keys(),
79+ localClaude.keys(),
80+ );
81+
82+ // Merge precedence: local overrides global; at the same scope, .agents overrides .claude.
83+ return new Map([
84+ ...globalClaude,
85+ ...globalAgents,
86+ ...localClaude,
87+ ...localAgents,
88+ ]);
6689 }