miii-cli 0.1.0 โ 0.1.3
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/.claude/settings.local.json +2 -1
- package/CONTRIBUTING.md +55 -0
- package/LICENSE +21 -0
- package/README.md +93 -81
- package/dist/files/ops.d.ts +2 -0
- package/dist/files/ops.js +8 -1
- package/dist/files/ops.js.map +1 -1
- package/dist/skills/loader.js +39 -1
- package/dist/skills/loader.js.map +1 -1
- package/dist/tools/index.js +19 -1
- package/dist/tools/index.js.map +1 -1
- package/package.json +10 -6
- package/src/files/ops.ts +10 -1
- package/src/skills/loader.ts +36 -1
- package/src/tools/index.ts +19 -1
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Contributing to miii-cli
|
|
2
|
+
|
|
3
|
+
We welcome contributions! miii-cli is a community-driven project, and your help is invaluable whether you're fixing a bug, adding a feature, or improving documentation.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
### ๐ How to Contribute
|
|
8
|
+
|
|
9
|
+
1. **Fork** the repository.
|
|
10
|
+
2. **Clone** your fork locally.
|
|
11
|
+
3. **Create a new branch** (`git checkout -b feature/my-awesome-feature`).
|
|
12
|
+
4. **Commit** your changes and **Push** to the branch.
|
|
13
|
+
5. **Open a Pull Request (PR)** against the `main` branch.
|
|
14
|
+
|
|
15
|
+
### ๐ค Guidelines
|
|
16
|
+
|
|
17
|
+
* **Code Style:** Please follow standard JavaScript/TypeScript best practices.
|
|
18
|
+
* **Testing:** All new features must include accompanying unit or integration tests.
|
|
19
|
+
* **Documentation:** If you change an API or add complex logic, please update the relevant documentation files.
|
|
20
|
+
|
|
21
|
+
### ๐ Workflow
|
|
22
|
+
|
|
23
|
+
* **Bugs:** If you find a bug, please report it on the Issues page with a clear reproduction guide and expected behavior.
|
|
24
|
+
* **Features:** Before starting a large feature, please open an Issue to discuss the scope and design with the core team.
|
|
25
|
+
|
|
26
|
+
### ๐ Bug Reporting
|
|
27
|
+
|
|
28
|
+
When reporting a bug, please include:
|
|
29
|
+
|
|
30
|
+
1. **Title:** A concise summary of the issue.
|
|
31
|
+
2. **Environment:** (e.g., Node.js version, OS, browser)
|
|
32
|
+
3. **Steps to Reproduce:** A numbered list of exact steps to trigger the bug.
|
|
33
|
+
4. **Expected Result:** What should have happened.
|
|
34
|
+
5. **Actual Result:** What actually happened.
|
|
35
|
+
|
|
36
|
+
***
|
|
37
|
+
|
|
38
|
+
### ๐ Development Setup
|
|
39
|
+
|
|
40
|
+
To work on miii-cli locally, please ensure you have the necessary dependencies installed.
|
|
41
|
+
|
|
42
|
+
1. **Install Dependencies:**
|
|
43
|
+
`npm install`
|
|
44
|
+
|
|
45
|
+
2. **Common Commands:**
|
|
46
|
+
We use a Makefile to streamline common tasks:
|
|
47
|
+
|
|
48
|
+
Development/Live Run: `make dev` (Runs the application in development mode)
|
|
49
|
+
Build Project: `make build` (Compiles the TypeScript source code)
|
|
50
|
+
Install Globally: `make install` (Links the project using `npm link`)
|
|
51
|
+
Clean Build: `make clean` (Removes compiled output)
|
|
52
|
+
|
|
53
|
+
### ๐งช Testing
|
|
54
|
+
|
|
55
|
+
When writing tests, please ensure they cover both the happy path and expected edge cases.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 maruakshay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,120 +1,127 @@
|
|
|
1
|
-
# miii
|
|
1
|
+
# miii-cli
|
|
2
|
+
|
|
3
|
+
> Local AI coding assistant for your terminal. No cloud. No API keys. No latency.
|
|
2
4
|
|
|
3
5
|
```
|
|
4
|
-
|
|
5
|
-
โ Claude Code-level
|
|
6
|
-
|
|
6
|
+
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
|
|
7
|
+
โ miii โ Claude Code-level workflows, local models only โ
|
|
8
|
+
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
[](https://www.npmjs.com/package/miii-cli)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
[](https://nodejs.org)
|
|
11
14
|
|
|
12
15
|
---
|
|
13
16
|
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install -g miii-cli
|
|
18
|
-
```
|
|
17
|
+
## What is miii?
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
`miii` is a terminal-native AI coding assistant powered by local models via [Ollama](https://ollama.com) or any OpenAI-compatible API (LM Studio, vLLM, Groq, Together, etc.).
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
npm link
|
|
28
|
-
```
|
|
21
|
+
- **Runs 100% locally** โ your code never leaves your machine
|
|
22
|
+
- **File-aware** โ type `@filename` to inject any file into context instantly
|
|
23
|
+
- **Tool-enabled** โ reads, writes, edits, and runs shell commands autonomously
|
|
24
|
+
- **Session memory** โ conversations persist across launches
|
|
25
|
+
- **Extensible** โ add custom slash commands via Markdown or TypeScript skill files
|
|
29
26
|
|
|
30
27
|
---
|
|
31
28
|
|
|
32
|
-
##
|
|
29
|
+
## Install
|
|
33
30
|
|
|
34
31
|
```bash
|
|
35
|
-
|
|
36
|
-
miii --model codellama # use a specific model
|
|
37
|
-
miii --session myproject # start in a named session
|
|
38
|
-
miii -s work -m llama3.2 # short flags
|
|
32
|
+
npm install -g miii-cli
|
|
39
33
|
```
|
|
40
34
|
|
|
41
|
-
|
|
35
|
+
**Requirements:** Node.js 18+ and [Ollama](https://ollama.com) (or any OpenAI-compatible API)
|
|
42
36
|
|
|
43
37
|
---
|
|
44
38
|
|
|
45
|
-
##
|
|
39
|
+
## Quick start
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
```bash
|
|
42
|
+
# Make sure Ollama is running
|
|
43
|
+
ollama serve
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
| `/session <name>` | Switch to (or create) a named session |
|
|
55
|
-
| `/list` | List all loaded skills |
|
|
56
|
-
| `/exit` | Exit miii |
|
|
45
|
+
# Start miii
|
|
46
|
+
miii
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
On launch, miii opens a model picker. Select a model and start coding.
|
|
57
50
|
|
|
58
|
-
|
|
51
|
+
```bash
|
|
52
|
+
miii # default session
|
|
53
|
+
miii --model codellama # specific model
|
|
54
|
+
miii --session myproject # named session
|
|
55
|
+
miii -s work -m llama3.2 # short flags
|
|
56
|
+
```
|
|
59
57
|
|
|
60
58
|
---
|
|
61
59
|
|
|
62
60
|
## File context with `@`
|
|
63
61
|
|
|
64
|
-
Type `@` anywhere in your message to fuzzy-
|
|
62
|
+
Type `@` anywhere in your message to fuzzy-search and inject project files into the model's context:
|
|
65
63
|
|
|
66
64
|
```
|
|
67
65
|
โฏ review the auth logic in @src/auth/middleware.ts
|
|
66
|
+
โฏ refactor @src/utils/parser.ts to handle edge cases
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Filtered automatically: `node_modules`, `dist`, `.git`, lock files, binaries, images.
|
|
69
|
+
Automatically excluded: `node_modules`, `dist`, `.git`, lock files, binaries, images.
|
|
73
70
|
|
|
74
71
|
---
|
|
75
72
|
|
|
76
|
-
##
|
|
77
|
-
|
|
78
|
-
Every conversation is saved. Sessions persist between launches.
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
miii # continues "default" session
|
|
82
|
-
miii --session feature-auth # continues or creates "feature-auth"
|
|
83
|
-
```
|
|
73
|
+
## Built-in commands
|
|
84
74
|
|
|
85
|
-
|
|
75
|
+
Type `/` to open the command palette.
|
|
86
76
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
| Command | Description |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `/models` | Switch or pull Ollama models |
|
|
80
|
+
| `/session <name>` | Switch to or create a named session |
|
|
81
|
+
| `/sessions` | List all sessions with message counts |
|
|
82
|
+
| `/clear` | Clear current session history |
|
|
83
|
+
| `/mkdir <path>` | Create a folder (and any missing parents) |
|
|
84
|
+
| `/touch <path>` | Create an empty file |
|
|
85
|
+
| `/mv <from> <to>` | Move or rename a file or folder |
|
|
86
|
+
| `/list` | Show loaded skills |
|
|
87
|
+
| `/exit` | Exit miii |
|
|
94
88
|
|
|
95
89
|
---
|
|
96
90
|
|
|
97
|
-
##
|
|
91
|
+
## Built-in tools
|
|
98
92
|
|
|
99
|
-
|
|
93
|
+
The model can call these tools automatically โ no setup needed.
|
|
100
94
|
|
|
101
|
-
| Tool |
|
|
95
|
+
| Tool | Description |
|
|
102
96
|
|---|---|
|
|
103
97
|
| `read_file` | Read any file |
|
|
104
98
|
| `list_files` | List directory contents |
|
|
105
|
-
| `edit_file` | Create or overwrite a file |
|
|
99
|
+
| `edit_file` | Create or overwrite a file (auto-creates parent dirs) |
|
|
100
|
+
| `create_folder` | Create a directory and any missing parents |
|
|
101
|
+
| `move_file` | Move or rename a file or directory |
|
|
106
102
|
| `delete_file` | Delete a file |
|
|
107
|
-
| `run_command` | Run a shell command in
|
|
103
|
+
| `run_command` | Run a shell command in the current directory |
|
|
108
104
|
|
|
109
|
-
|
|
105
|
+
Tool calls chain up to 6 hops deep โ the model reads, edits, runs, and verifies on its own.
|
|
110
106
|
|
|
111
107
|
---
|
|
112
108
|
|
|
113
|
-
##
|
|
109
|
+
## Sessions
|
|
110
|
+
|
|
111
|
+
Every conversation is saved and resumed automatically.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
miii # resumes "default" session
|
|
115
|
+
miii --session feature-auth # resumes or creates "feature-auth"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Sessions stored at `~/.config/miii/sessions/`.
|
|
114
119
|
|
|
115
|
-
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Skills
|
|
116
123
|
|
|
117
|
-
Create `~/.config/miii/skills
|
|
124
|
+
Skills are custom `/` commands. Create a Markdown file in `~/.config/miii/skills/`:
|
|
118
125
|
|
|
119
126
|
```markdown
|
|
120
127
|
---
|
|
@@ -126,7 +133,7 @@ Review the code I'm about to share. Look for bugs, edge cases, and improvements.
|
|
|
126
133
|
Be direct and specific. No markdown.
|
|
127
134
|
```
|
|
128
135
|
|
|
129
|
-
|
|
136
|
+
Use it:
|
|
130
137
|
|
|
131
138
|
```
|
|
132
139
|
/review
|
|
@@ -138,10 +145,11 @@ Skills can also be TypeScript files with an `execute` function for programmatic
|
|
|
138
145
|
|
|
139
146
|
## Configuration
|
|
140
147
|
|
|
141
|
-
|
|
148
|
+
Config is loaded from (in order):
|
|
142
149
|
1. `.miii.json` in the current directory
|
|
143
150
|
2. `~/.config/miii/config.json`
|
|
144
151
|
|
|
152
|
+
**Ollama (default):**
|
|
145
153
|
```json
|
|
146
154
|
{
|
|
147
155
|
"model": "llama3.2",
|
|
@@ -150,8 +158,7 @@ miii looks for config in:
|
|
|
150
158
|
}
|
|
151
159
|
```
|
|
152
160
|
|
|
153
|
-
|
|
154
|
-
|
|
161
|
+
**OpenAI-compatible API:**
|
|
155
162
|
```json
|
|
156
163
|
{
|
|
157
164
|
"model": "gpt-4o",
|
|
@@ -160,14 +167,7 @@ For OpenAI-compatible APIs:
|
|
|
160
167
|
}
|
|
161
168
|
```
|
|
162
169
|
|
|
163
|
-
Works with
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## Requirements
|
|
168
|
-
|
|
169
|
-
- Node.js 18+
|
|
170
|
-
- [Ollama](https://ollama.com) (or any OpenAI-compatible API)
|
|
170
|
+
Works with LM Studio, vLLM, Groq, Together, and any other OpenAI-compatible server.
|
|
171
171
|
|
|
172
172
|
---
|
|
173
173
|
|
|
@@ -176,7 +176,19 @@ Works with any OpenAI-compatible server: LM Studio, vLLM, Groq, Together, etc.
|
|
|
176
176
|
| Key | Action |
|
|
177
177
|
|---|---|
|
|
178
178
|
| `enter` | Send message |
|
|
179
|
-
| `ctrl+c` | Abort streaming |
|
|
180
|
-
| `ctrl+c` x2 | Exit |
|
|
181
|
-
| `esc` | Close overlay
|
|
182
|
-
| `โ โ` | Navigate command palette or file picker |
|
|
179
|
+
| `ctrl+c` | Abort streaming response |
|
|
180
|
+
| `ctrl+c` x2 | Exit miii |
|
|
181
|
+
| `esc` | Close overlay or abort |
|
|
182
|
+
| `โ / โ` | Navigate command palette or file picker |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Source
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
git clone https://github.com/maruakshay/miii-cli
|
|
190
|
+
cd miii-cli
|
|
191
|
+
npm install
|
|
192
|
+
npm run build
|
|
193
|
+
npm link
|
|
194
|
+
```
|
package/dist/files/ops.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare function readFile(p: string): string;
|
|
2
2
|
export declare function writeFile(p: string, content: string): void;
|
|
3
3
|
export declare function deleteFile(p: string): void;
|
|
4
|
+
export declare function createDir(p: string): void;
|
|
5
|
+
export declare function moveFile(from: string, to: string): void;
|
|
4
6
|
export interface FileEntry {
|
|
5
7
|
name: string;
|
|
6
8
|
path: string;
|
package/dist/files/ops.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, unlinkSync, mkdirSync, readdirSync, statSync, existsSync, } from 'fs';
|
|
1
|
+
import { readFileSync, writeFileSync, unlinkSync, mkdirSync, readdirSync, statSync, existsSync, renameSync, } from 'fs';
|
|
2
2
|
import { join, dirname, relative, extname } from 'path';
|
|
3
3
|
const SKIP_DIRS = new Set([
|
|
4
4
|
'node_modules', 'dist', 'build', '.git', '.next', '.nuxt', '.svelte-kit',
|
|
@@ -31,6 +31,13 @@ export function writeFile(p, content) {
|
|
|
31
31
|
export function deleteFile(p) {
|
|
32
32
|
unlinkSync(p);
|
|
33
33
|
}
|
|
34
|
+
export function createDir(p) {
|
|
35
|
+
mkdirSync(p, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
export function moveFile(from, to) {
|
|
38
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
39
|
+
renameSync(from, to);
|
|
40
|
+
}
|
|
34
41
|
export function listFiles(dir, recursive = false, cwd = process.cwd()) {
|
|
35
42
|
if (!existsSync(dir))
|
|
36
43
|
return [];
|
package/dist/files/ops.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/files/ops.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAAE,aAAa,EAAE,UAAU,EACvC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/files/ops.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAAE,aAAa,EAAE,UAAU,EACvC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GACzD,MAAM,IAAI,CAAA;AACX,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEvD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa;IACxE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ;IACnE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO;IAC9D,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM;CACxD,CAAC,CAAA;AAEF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IACjE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IACtC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IACpC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE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AC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/skills/loader.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, existsSync, readdirSync } from 'fs';
|
|
2
2
|
import { join, basename } from 'path';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
|
+
import { createDir, moveFile, writeFile } from '../files/ops.js';
|
|
4
5
|
const builtin = [
|
|
5
6
|
{
|
|
6
7
|
name: 'caveman',
|
|
@@ -33,7 +34,7 @@ const builtin = [
|
|
|
33
34
|
ns: 'default',
|
|
34
35
|
description: 'Show available commands',
|
|
35
36
|
execute: (_, ctx) => {
|
|
36
|
-
return 'Built-in
|
|
37
|
+
return 'Built-in: /review /mkdir /mv /touch /models /sessions /session /clear /list /help\nType /list for all loaded skills.';
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
{
|
|
@@ -48,6 +49,43 @@ const builtin = [
|
|
|
48
49
|
description: 'Choose or pull Ollama models',
|
|
49
50
|
// execute handled specially in App.tsx before skill lookup
|
|
50
51
|
},
|
|
52
|
+
{
|
|
53
|
+
name: 'mkdir',
|
|
54
|
+
ns: 'default',
|
|
55
|
+
description: 'Create a folder โ usage: /mkdir <path>',
|
|
56
|
+
execute: (args) => {
|
|
57
|
+
const p = args.trim();
|
|
58
|
+
if (!p)
|
|
59
|
+
return 'Usage: /mkdir <path>';
|
|
60
|
+
createDir(p);
|
|
61
|
+
return `created: ${p}`;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'mv',
|
|
66
|
+
ns: 'default',
|
|
67
|
+
description: 'Move or rename file/folder โ usage: /mv <from> <to>',
|
|
68
|
+
execute: (args) => {
|
|
69
|
+
const parts = args.trim().split(/\s+/);
|
|
70
|
+
if (parts.length < 2)
|
|
71
|
+
return 'Usage: /mv <from> <to>';
|
|
72
|
+
const [from, to] = parts;
|
|
73
|
+
moveFile(from, to);
|
|
74
|
+
return `moved: ${from} โ ${to}`;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'touch',
|
|
79
|
+
ns: 'default',
|
|
80
|
+
description: 'Create empty file โ usage: /touch <path>',
|
|
81
|
+
execute: (args) => {
|
|
82
|
+
const p = args.trim();
|
|
83
|
+
if (!p)
|
|
84
|
+
return 'Usage: /touch <path>';
|
|
85
|
+
writeFile(p, '');
|
|
86
|
+
return `created: ${p}`;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
51
89
|
];
|
|
52
90
|
export class SkillLoader {
|
|
53
91
|
map = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/skills/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/skills/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAiBhE,MAAM,OAAO,GAAY;IACvB;QACE,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YAClB,MAAM,GAAG,GAAG,GA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dist/tools/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFile, writeFile, deleteFile, listFiles } from '../files/ops.js';
|
|
1
|
+
import { readFile, writeFile, deleteFile, listFiles, createDir, moveFile } from '../files/ops.js';
|
|
2
2
|
import { exec } from 'child_process';
|
|
3
3
|
import { promisify } from 'util';
|
|
4
4
|
const run = promisify(exec);
|
|
@@ -54,6 +54,24 @@ export const tools = [
|
|
|
54
54
|
return [stdout, stderr ? `stderr: ${stderr}` : ''].filter(Boolean).join('\n').trim();
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
|
+
{
|
|
58
|
+
name: 'create_folder',
|
|
59
|
+
description: 'Create a directory (and any missing parents)',
|
|
60
|
+
params: '{"path": "string"}',
|
|
61
|
+
execute: async ({ path }) => {
|
|
62
|
+
createDir(path);
|
|
63
|
+
return `created: ${path}`;
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'move_file',
|
|
68
|
+
description: 'Move or rename a file or directory',
|
|
69
|
+
params: '{"from": "string", "to": "string"}',
|
|
70
|
+
execute: async ({ from, to }) => {
|
|
71
|
+
moveFile(from, to);
|
|
72
|
+
return `moved: ${from} โ ${to}`;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
57
75
|
];
|
|
58
76
|
export function getSystemPrompt(extra = '') {
|
|
59
77
|
const toolDocs = tools.map(t => `- ${t.name}(${t.params}): ${t.description}`).join('\n');
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,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AE,EAAE,EAAE,EAAE,EAAE;YAC9B,QAAQ,CAAC,IAAc,EAAE,EAAY,CAAC,CAAA;YACtC,OAAO,UAAU,IAAI,MAAM,EAAE,EAAE,CAAA;QACjC,CAAC;KACF;CACF,CAAA;AAED,MAAM,UAAU,eAAe,CAAC,KAAK,GAAG,EAAE;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxF,OAAO;;;;;;;;EAQP,QAAQ;;;;;;;;;oNAS0M,KAAK,EAAE,CAAA;AAC3N,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miii-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18"
|
|
8
|
+
},
|
|
5
9
|
"bin": {
|
|
6
10
|
"miii": "dist/index.js"
|
|
7
11
|
},
|
|
@@ -12,17 +16,17 @@
|
|
|
12
16
|
"link": "npm run build && npm link"
|
|
13
17
|
},
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"ink": "^5.2.0",
|
|
16
|
-
"react": "^18.3.1",
|
|
17
19
|
"diff": "^7.0.0",
|
|
18
20
|
"glob": "^11.0.1",
|
|
19
|
-
"
|
|
21
|
+
"ink": "^5.2.0",
|
|
22
|
+
"minimist": "^1.2.8",
|
|
23
|
+
"react": "^18.3.1"
|
|
20
24
|
},
|
|
21
25
|
"devDependencies": {
|
|
22
|
-
"@types/node": "^22.10.0",
|
|
23
|
-
"@types/react": "^18.3.1",
|
|
24
26
|
"@types/diff": "^7.0.0",
|
|
25
27
|
"@types/minimist": "^1.2.5",
|
|
28
|
+
"@types/node": "^22.10.0",
|
|
29
|
+
"@types/react": "^18.3.1",
|
|
26
30
|
"tsx": "^4.19.1",
|
|
27
31
|
"typescript": "^5.7.3"
|
|
28
32
|
}
|
package/src/files/ops.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readFileSync, writeFileSync, unlinkSync,
|
|
3
|
-
mkdirSync, readdirSync, statSync, existsSync,
|
|
3
|
+
mkdirSync, readdirSync, statSync, existsSync, renameSync,
|
|
4
4
|
} from 'fs'
|
|
5
5
|
import { join, dirname, relative, extname } from 'path'
|
|
6
6
|
|
|
@@ -40,6 +40,15 @@ export function deleteFile(p: string): void {
|
|
|
40
40
|
unlinkSync(p)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export function createDir(p: string): void {
|
|
44
|
+
mkdirSync(p, { recursive: true })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function moveFile(from: string, to: string): void {
|
|
48
|
+
mkdirSync(dirname(to), { recursive: true })
|
|
49
|
+
renameSync(from, to)
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
export interface FileEntry {
|
|
44
53
|
name: string
|
|
45
54
|
path: string
|
package/src/skills/loader.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync, existsSync, readdirSync } from 'fs'
|
|
2
2
|
import { join, basename } from 'path'
|
|
3
3
|
import { homedir } from 'os'
|
|
4
|
+
import { createDir, moveFile, writeFile } from '../files/ops.js'
|
|
4
5
|
|
|
5
6
|
export interface SkillContext {
|
|
6
7
|
messages: Array<{ role: string; content: string }>
|
|
@@ -49,7 +50,7 @@ const builtin: Skill[] = [
|
|
|
49
50
|
ns: 'default',
|
|
50
51
|
description: 'Show available commands',
|
|
51
52
|
execute: (_, ctx) => {
|
|
52
|
-
return 'Built-in
|
|
53
|
+
return 'Built-in: /review /mkdir /mv /touch /models /sessions /session /clear /list /help\nType /list for all loaded skills.'
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
{
|
|
@@ -64,6 +65,40 @@ const builtin: Skill[] = [
|
|
|
64
65
|
description: 'Choose or pull Ollama models',
|
|
65
66
|
// execute handled specially in App.tsx before skill lookup
|
|
66
67
|
},
|
|
68
|
+
{
|
|
69
|
+
name: 'mkdir',
|
|
70
|
+
ns: 'default',
|
|
71
|
+
description: 'Create a folder โ usage: /mkdir <path>',
|
|
72
|
+
execute: (args) => {
|
|
73
|
+
const p = args.trim()
|
|
74
|
+
if (!p) return 'Usage: /mkdir <path>'
|
|
75
|
+
createDir(p)
|
|
76
|
+
return `created: ${p}`
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'mv',
|
|
81
|
+
ns: 'default',
|
|
82
|
+
description: 'Move or rename file/folder โ usage: /mv <from> <to>',
|
|
83
|
+
execute: (args) => {
|
|
84
|
+
const parts = args.trim().split(/\s+/)
|
|
85
|
+
if (parts.length < 2) return 'Usage: /mv <from> <to>'
|
|
86
|
+
const [from, to] = parts
|
|
87
|
+
moveFile(from, to)
|
|
88
|
+
return `moved: ${from} โ ${to}`
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'touch',
|
|
93
|
+
ns: 'default',
|
|
94
|
+
description: 'Create empty file โ usage: /touch <path>',
|
|
95
|
+
execute: (args) => {
|
|
96
|
+
const p = args.trim()
|
|
97
|
+
if (!p) return 'Usage: /touch <path>'
|
|
98
|
+
writeFile(p, '')
|
|
99
|
+
return `created: ${p}`
|
|
100
|
+
},
|
|
101
|
+
},
|
|
67
102
|
]
|
|
68
103
|
|
|
69
104
|
export class SkillLoader {
|
package/src/tools/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFile, writeFile, deleteFile, listFiles } from '../files/ops.js'
|
|
1
|
+
import { readFile, writeFile, deleteFile, listFiles, createDir, moveFile } from '../files/ops.js'
|
|
2
2
|
import { exec } from 'child_process'
|
|
3
3
|
import { promisify } from 'util'
|
|
4
4
|
|
|
@@ -58,6 +58,24 @@ export const tools: Tool[] = [
|
|
|
58
58
|
return [stdout, stderr ? `stderr: ${stderr}` : ''].filter(Boolean).join('\n').trim()
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
name: 'create_folder',
|
|
63
|
+
description: 'Create a directory (and any missing parents)',
|
|
64
|
+
params: '{"path": "string"}',
|
|
65
|
+
execute: async ({ path }) => {
|
|
66
|
+
createDir(path as string)
|
|
67
|
+
return `created: ${path}`
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'move_file',
|
|
72
|
+
description: 'Move or rename a file or directory',
|
|
73
|
+
params: '{"from": "string", "to": "string"}',
|
|
74
|
+
execute: async ({ from, to }) => {
|
|
75
|
+
moveFile(from as string, to as string)
|
|
76
|
+
return `moved: ${from} โ ${to}`
|
|
77
|
+
},
|
|
78
|
+
},
|
|
61
79
|
]
|
|
62
80
|
|
|
63
81
|
export function getSystemPrompt(extra = ''): string {
|