mini-coder 0.0.4 → 0.0.6

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.
@@ -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.
@@ -0,0 +1,70 @@
1
+ # Custom Agents
2
+
3
+ An agent is a subagent with a custom system prompt and optional model override.
4
+ Use `@agent-name` anywhere in your prompt to route the message through it.
5
+
6
+ ## Where to put them
7
+
8
+ | Location | Scope |
9
+ |---|---|
10
+ | `.agents/agents/*.md` | Current repo only |
11
+ | `~/.agents/agents/*.md` | All projects (global) |
12
+
13
+ Local agents override global ones with the same name.
14
+
15
+ ## Create an agent
16
+
17
+ The filename becomes the agent name.
18
+
19
+ `~/.agents/agents/reviewer.md`:
20
+
21
+ ```md
22
+ ---
23
+ description: Strict code reviewer focused on bugs and structure
24
+ model: zen/claude-sonnet-4-6
25
+ ---
26
+
27
+ You are a senior engineer doing a code review. Be direct and specific.
28
+ Cite file and line number for every finding. Flag bugs first, then
29
+ structure issues, then style — only if they violate project conventions.
30
+ No flattery. End with a one-line verdict.
31
+ ```
32
+
33
+ Then in the REPL:
34
+
35
+ ```
36
+ @reviewer review the auth module for race conditions
37
+ ```
38
+
39
+ The rest of the message (everything except the `@reviewer` token) becomes
40
+ the prompt. The agent runs in its own context window and returns its output
41
+ into the conversation.
42
+
43
+ ## Frontmatter fields
44
+
45
+ | Field | Required | Description |
46
+ |---|---|---|
47
+ | `description` | No | Shown in `/help`. Defaults to filename. |
48
+ | `model` | No | Override the active model for this agent. |
49
+
50
+ The markdown body (after frontmatter) is the agent's system prompt.
51
+
52
+ ## Combining with files
53
+
54
+ `@file` references are resolved before the agent fires:
55
+
56
+ ```
57
+ @reviewer @src/auth/session.ts check this file for issues
58
+ ```
59
+
60
+ ## Tab completion
61
+
62
+ Type `@` and press `Tab` to autocomplete agent names alongside files.
63
+
64
+ ## Listing agents
65
+
66
+ ```
67
+ /help
68
+ ```
69
+
70
+ Agents are listed in magenta, tagged `(local)` or `(global)`.
@@ -0,0 +1,133 @@
1
+ # Custom Commands
2
+
3
+ Custom commands let you define reusable prompts that run as `/command` in the mini-coder REPL.
4
+
5
+ ## Where to put them
6
+
7
+ | Location | Scope |
8
+ |---|---|
9
+ | `.agents/commands/*.md` | Current repo only |
10
+ | `~/.agents/commands/*.md` | All projects (global) |
11
+
12
+ Local commands override global ones with the same name.
13
+
14
+ ## Create a command
15
+
16
+ Create a markdown file. The filename becomes the command name.
17
+
18
+ `.agents/commands/standup.md`:
19
+
20
+ ```md
21
+ ---
22
+ description: Summarise what changed since yesterday
23
+ model: zen/claude-3-5-haiku
24
+ ---
25
+
26
+ Run `!`git log --oneline --since=yesterday`` and summarise the changes
27
+ as a short standup update. Group by theme, skip merge commits.
28
+ ```
29
+
30
+ Then in the REPL:
31
+
32
+ ```
33
+ /standup
34
+ ```
35
+
36
+ ## Frontmatter fields
37
+
38
+ | Field | Required | Description |
39
+ |---|---|---|
40
+ | `description` | No | Shown in `/help`. Defaults to the command name. |
41
+ | `model` | No | Override the active model for this command. |
42
+
43
+ ## Arguments
44
+
45
+ Use `$ARGUMENTS` for the full argument string, or `$1`, `$2`, … `$9` for individual tokens.
46
+
47
+ `.agents/commands/search.md`:
48
+
49
+ ```md
50
+ ---
51
+ description: Search the codebase for a topic
52
+ model: zen/claude-3-5-haiku
53
+ ---
54
+
55
+ Search the codebase for: $ARGUMENTS
56
+
57
+ Use glob, grep, and read tools to explore thoroughly. Report all
58
+ relevant files, key code snippets with line numbers, and a short summary.
59
+ Be exhaustive but concise. No edits — read only.
60
+ ```
61
+
62
+ ```
63
+ /search session management
64
+ /search error handling in providers
65
+ ```
66
+
67
+ Positional tokens:
68
+
69
+ ```md
70
+ ---
71
+ description: Create a new component
72
+ ---
73
+
74
+ Create a React component named $1 in the $2 directory.
75
+ Use TypeScript, include prop types and a default export.
76
+ ```
77
+
78
+ ```
79
+ /component Button src/ui
80
+ ```
81
+
82
+ ## Shell interpolation
83
+
84
+ Use `` !`cmd` `` to inject shell output into the prompt at expansion time.
85
+ Commands time out after 10 seconds.
86
+
87
+ ```md
88
+ ---
89
+ description: Review failing tests
90
+ ---
91
+
92
+ The following tests are currently failing:
93
+
94
+ !`bun test 2>&1 | grep "fail\|✗" | head -20`
95
+
96
+ Investigate the failures and suggest fixes. Read the relevant source
97
+ files before drawing conclusions.
98
+ ```
99
+
100
+ ```
101
+ /fix-tests
102
+ ```
103
+
104
+ ## Model override
105
+
106
+ Specify a model in frontmatter to use a faster or cheaper model for
107
+ lightweight tasks regardless of what the session is currently set to.
108
+
109
+ ```md
110
+ ---
111
+ description: Quick grep for a symbol
112
+ model: zen/claude-3-5-haiku
113
+ ---
114
+
115
+ Find all usages of $ARGUMENTS across the codebase using grep and glob.
116
+ List each occurrence with file path and line number. No explanations needed.
117
+ ```
118
+
119
+ Large models for deep analysis, small models for search and lookup.
120
+
121
+ ## Precedence
122
+
123
+ Custom commands shadow built-ins. If you create `.agents/commands/review.md`
124
+ it will replace the built-in `/review` for that project.
125
+
126
+ ## Listing commands
127
+
128
+ ```
129
+ /help
130
+ ```
131
+
132
+ Custom commands are listed at the bottom under **custom commands**, tagged
133
+ with `(local)` or `(global)`.
package/docs/skills.md ADDED
@@ -0,0 +1,71 @@
1
+ # Skills
2
+
3
+ A skill is a reusable instruction file injected inline into your prompt.
4
+ Use `@skill-name` to load it — the content is inserted into the message
5
+ before it's sent to the LLM.
6
+
7
+ > **Skills are never auto-loaded.** They must be explicitly referenced
8
+ > with `@skill-name` in your prompt. Nothing is injected automatically.
9
+
10
+ ## Where to put them
11
+
12
+ Each skill is a folder containing a `SKILL.md`:
13
+
14
+ | Location | Scope |
15
+ |---|---|
16
+ | `.agents/skills/<name>/SKILL.md` | Current repo only |
17
+ | `~/.agents/skills/<name>/SKILL.md` | All projects (global) |
18
+
19
+ Local skills override global ones with the same name.
20
+
21
+ ## Create a skill
22
+
23
+ The folder name becomes the skill name (unless overridden by `name:` in frontmatter).
24
+
25
+ `.agents/skills/conventional-commits/SKILL.md`:
26
+
27
+ ```md
28
+ ---
29
+ name: conventional-commits
30
+ description: Conventional commit message format rules
31
+ ---
32
+
33
+ # Conventional Commits
34
+
35
+ All commit messages must follow this format:
36
+
37
+ <type>(<scope>): <short summary>
38
+
39
+ Types: feat, fix, docs, refactor, test, chore
40
+ - Summary is lowercase, no period at the end
41
+ - Breaking changes: add `!` after type, e.g. `feat!:`
42
+ - Body is optional, wrapped at 72 chars
43
+ ```
44
+
45
+ Then in the REPL:
46
+
47
+ ```
48
+ @conventional-commits write a commit message for my staged changes
49
+ ```
50
+
51
+ The skill content is wrapped in `<skill name="…">…</skill>` tags and
52
+ included in the message sent to the LLM.
53
+
54
+ ## Frontmatter fields
55
+
56
+ | Field | Required | Description |
57
+ |---|---|---|
58
+ | `name` | No | Skill name for `@` reference. Defaults to folder name. |
59
+ | `description` | No | Shown in `/help`. Defaults to name. |
60
+
61
+ ## Tab completion
62
+
63
+ Type `@` and press `Tab` to autocomplete skill names alongside files.
64
+
65
+ ## Listing skills
66
+
67
+ ```
68
+ /help
69
+ ```
70
+
71
+ Skills are listed in yellow, tagged `(local)` or `(global)`.
@@ -0,0 +1,142 @@
1
+ # Tool Hooks
2
+
3
+ A tool hook is an executable script that runs automatically after a specific tool call succeeds. Use hooks to trigger side effects — linting, formatting, logging, notifications — without modifying the agent's behaviour.
4
+
5
+ > Hooks fire **after** the tool succeeds. Failures are silently swallowed and never crash the agent.
6
+
7
+ ## Where to put them
8
+
9
+ Hooks live in a `hooks/` folder inside an `.agents` config root:
10
+
11
+ | Location | Scope |
12
+ |---|---|
13
+ | `.agents/hooks/post-<tool>` | Current repo only |
14
+ | `~/.agents/hooks/post-<tool>` | All projects (global) |
15
+
16
+ Local hooks take precedence over global ones. The filename must match `post-<tool>` exactly — no extension.
17
+
18
+ ## Supported tools
19
+
20
+ | Tool | Hook filename |
21
+ |---|---|
22
+ | `glob` | `post-glob` |
23
+ | `grep` | `post-grep` |
24
+ | `read` | `post-read` |
25
+ | `create` | `post-create` |
26
+ | `replace` | `post-replace` |
27
+ | `insert` | `post-insert` |
28
+ | `shell` | `post-shell` |
29
+
30
+ MCP tools are not hookable.
31
+
32
+ ## Script requirements
33
+
34
+ The script must be executable (`chmod +x`). It can be written in any language — bash, Python, Node, etc. It receives context via environment variables and its exit code is reported in the UI (zero = success, non-zero = failure).
35
+
36
+ ## Environment variables
37
+
38
+ All hooks receive:
39
+
40
+ | Variable | Description |
41
+ |---|---|
42
+ | `TOOL` | Name of the tool that fired |
43
+ | `CWD` | Working directory of the session |
44
+
45
+ Plus tool-specific variables:
46
+
47
+ ### `post-create`
48
+
49
+ | Variable | Description |
50
+ |---|---|
51
+ | `FILEPATH` | Absolute path of the file written |
52
+ | `DIFF` | Unified diff of the change |
53
+ | `CREATED` | `true` if the file was newly created, `false` if overwritten |
54
+
55
+ ### `post-replace`
56
+
57
+ | Variable | Description |
58
+ |---|---|
59
+ | `FILEPATH` | Absolute path of the file modified |
60
+ | `DIFF` | Unified diff of the change |
61
+ | `DELETED` | `true` if lines were deleted (no replacement content), `false` otherwise |
62
+
63
+ ### `post-insert`
64
+
65
+ | Variable | Description |
66
+ |---|---|
67
+ | `FILEPATH` | Absolute path of the file modified |
68
+ | `DIFF` | Unified diff of the change |
69
+
70
+ ### `post-shell`
71
+
72
+ | Variable | Description |
73
+ |---|---|
74
+ | `COMMAND` | The shell command that was run |
75
+ | `EXIT_CODE` | Exit code of the command |
76
+ | `TIMED_OUT` | `true` if the command timed out |
77
+ | `STDOUT` | Captured standard output |
78
+ | `STDERR` | Captured standard error |
79
+
80
+ ### `post-glob`
81
+
82
+ | Variable | Description |
83
+ |---|---|
84
+ | `PATTERN` | The glob pattern that was searched |
85
+
86
+ ### `post-grep`
87
+
88
+ | Variable | Description |
89
+ |---|---|
90
+ | `PATTERN` | The regex pattern that was searched |
91
+
92
+ ### `post-read`
93
+
94
+ | Variable | Description |
95
+ |---|---|
96
+ | `FILEPATH` | Absolute path of the file read |
97
+
98
+ ## Examples
99
+
100
+ ### Auto-format on write
101
+
102
+ `.agents/hooks/post-create`:
103
+
104
+ ```bash
105
+ #!/usr/bin/env bash
106
+ # Run the project formatter whenever the agent creates or overwrites a file.
107
+ bun run format -- "$FILEPATH"
108
+ ```
109
+
110
+ ```bash
111
+ chmod +x .agents/hooks/post-create
112
+ ```
113
+
114
+ Pair with a matching `post-replace` and `post-insert` to cover all write tools.
115
+
116
+ ### Log every shell command
117
+
118
+ `~/.agents/hooks/post-shell`:
119
+
120
+ ```bash
121
+ #!/usr/bin/env bash
122
+ # Append a record of every shell command to a global audit log.
123
+ echo "$(date -u +%FT%TZ) exit=$EXIT_CODE $COMMAND" >> ~/.config/mini-coder/shell-audit.log
124
+ ```
125
+
126
+ ```bash
127
+ chmod +x ~/.agents/hooks/post-shell
128
+ ```
129
+
130
+ ### Notify on file write
131
+
132
+ `.agents/hooks/post-replace`:
133
+
134
+ ```bash
135
+ #!/usr/bin/env bash
136
+ # macOS notification when the agent edits a file.
137
+ osascript -e "display notification \"$FILEPATH\" with title \"mini-coder wrote a file\""
138
+ ```
139
+
140
+ ## Hook lookup
141
+
142
+ Hooks are resolved once at session start and cached in memory — there is no filesystem access per tool call. Changing a hook script takes effect on the next session.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mini-coder",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A small, fast CLI coding agent",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",