ikie-cli 0.1.32 → 0.1.34
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 +185 -22
- package/dist/agent.d.ts +44 -0
- package/dist/agent.js +386 -128
- package/dist/config.d.ts +8 -0
- package/dist/config.js +4 -0
- package/dist/index.js +36 -1
- package/dist/mcp-manager.d.ts +75 -89
- package/dist/mcp-manager.js +710 -304
- package/dist/repl.js +315 -71
- package/dist/skills.d.ts +16 -0
- package/dist/skills.js +83 -6
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +21 -4
- package/dist/tools.d.ts +1 -0
- package/dist/tools.js +177 -166
- package/dist/tree.d.ts +19 -0
- package/dist/tree.js +266 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,43 +1,206 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Ikie
|
|
2
2
|
|
|
3
|
-
**Agentic coding CLI
|
|
3
|
+
**Agentic coding CLI — your AI pair programmer in the terminal.**
|
|
4
|
+
|
|
5
|
+
Ikie reads, writes, and refactors code, runs commands, searches the web, and
|
|
6
|
+
drives multi-step engineering tasks autonomously — all from your shell, with a
|
|
7
|
+
polished interactive REPL and a one-shot mode for quick jobs.
|
|
4
8
|
|
|
5
9
|
```bash
|
|
6
10
|
npm install -g ikie-cli
|
|
7
11
|
ikie login
|
|
8
|
-
ikie "write a rust web server"
|
|
12
|
+
ikie "write a rust web server with graceful shutdown"
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Highlights
|
|
18
|
+
|
|
19
|
+
- **Autonomous agent loop** — Ikie plans, edits files, runs builds/tests, reads
|
|
20
|
+
the errors, and self-corrects until the task is done.
|
|
21
|
+
- **Plan mode & agent mode** — research read-only and propose a plan, or execute
|
|
22
|
+
with full tool access. Toggle live with **Shift+Tab**.
|
|
23
|
+
- **28 built-in tools** — files, shell, search, git, web, memory, sub-agents.
|
|
24
|
+
- **Skills** — installable instruction packs that give Ikie expert knowledge for
|
|
25
|
+
a specific kind of task (UI/UX, research, framework conventions, …).
|
|
26
|
+
- **MCP support** — extend Ikie with Model Context Protocol servers (GitHub,
|
|
27
|
+
databases, browser automation, and any custom MCP).
|
|
28
|
+
- **Polished terminal UX** — markdown rendering, slash-command menu, 7 color
|
|
29
|
+
themes, image paste (Ctrl+V), session save/load, and live token/usage tracking.
|
|
30
|
+
- **Safe by default** — mutating actions ask for permission once (press `a` to
|
|
31
|
+
always-allow for the session); reads of secret files (`.env`, keys) are guarded.
|
|
12
32
|
|
|
13
|
-
|
|
14
|
-
- Interactive REPL with slash commands, markdown rendering, and session management
|
|
15
|
-
- One-shot mode: `ikie "your prompt"`
|
|
16
|
-
- Image paste support (Ctrl+V)
|
|
17
|
-
- Theming (7 color schemes)
|
|
33
|
+
---
|
|
18
34
|
|
|
19
35
|
## Quick start
|
|
20
36
|
|
|
21
37
|
```bash
|
|
22
|
-
# Install
|
|
23
|
-
npm install -g ikie
|
|
38
|
+
# 1. Install globally
|
|
39
|
+
npm install -g ikie-cli
|
|
24
40
|
|
|
25
|
-
# Sign in to your
|
|
41
|
+
# 2. Sign in to your Ikie account
|
|
26
42
|
ikie login
|
|
27
43
|
|
|
28
|
-
#
|
|
29
|
-
ikie "
|
|
44
|
+
# 3a. One-shot — run a single task and exit
|
|
45
|
+
ikie "add input validation to src/api/users.ts and write tests"
|
|
46
|
+
|
|
47
|
+
# 3b. Interactive — start a REPL session
|
|
48
|
+
ikie
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Requirements:** Node.js 20+ and an Ikie account (`ikie login`).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Modes
|
|
56
|
+
|
|
57
|
+
Ikie runs in one of two modes, shown in the prompt header:
|
|
58
|
+
|
|
59
|
+
| Mode | What it can do |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| **agent** *(default)* | Full access — edit files, run commands, everything. |
|
|
62
|
+
| **plan** | Read-only research. Ikie explores and proposes a plan but makes no changes until you approve. |
|
|
63
|
+
|
|
64
|
+
Switch any time with **Shift+Tab** (toggles in place), or with `/plan`, `/agent`,
|
|
65
|
+
and `/mode`. When a plan is approved, Ikie automatically switches to agent mode
|
|
66
|
+
and carries it out.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Tools
|
|
71
|
+
|
|
72
|
+
Ikie has 28 built-in tools, grouped by purpose:
|
|
73
|
+
|
|
74
|
+
- **Files** — `read_file`, `write_file`, `edit_file` (surgical exact-string edits), `list_dir`
|
|
75
|
+
- **Search** — `search_files` (glob), `grep` (regex over contents)
|
|
76
|
+
- **Shell** — `bash` (builds, tests, package managers; `&` backgrounds long-running processes)
|
|
77
|
+
- **Git** — `git_status`, `git_diff`, `git_log`, `git_commit`, `git_branch`
|
|
78
|
+
- **Web** — `fetch_url` (read any page as text), `web_search` (no extra API key — your login is enough)
|
|
79
|
+
- **Memory** — `memory_write` (persist notes across sessions, project- or global-scoped)
|
|
80
|
+
- **Delegation** — `spawn_agent` (hand isolated/parallel work to a focused sub-agent), `ask_user`
|
|
81
|
+
- **Skills** — `use_skill`, `install_skill`, `remove_skill`
|
|
82
|
+
- **MCP** — `mcp_list`, `mcp_add` (configured servers expose tools as `mcp__server__tool`)
|
|
83
|
+
- **Mode** — `switch_mode`
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Skills
|
|
88
|
+
|
|
89
|
+
Skills are curated instruction packs (and optional bundled scripts) that load on
|
|
90
|
+
demand when a task matches them. Install from a git URL or local path:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
ikie skills install https://github.com/user/some-skill.git
|
|
94
|
+
ikie skills list
|
|
95
|
+
ikie skills remove some-skill
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Inside a session, Ikie loads a matching skill automatically before doing the work.
|
|
99
|
+
You can also manage them with `/skills`.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## MCP (Model Context Protocol)
|
|
104
|
+
|
|
105
|
+
Extend Ikie with external MCP servers. When a server is configured, each of its
|
|
106
|
+
tools appears as a first-class tool named `mcp__<server>__<tool>` — call them
|
|
107
|
+
directly, no meta-tool dance.
|
|
108
|
+
|
|
109
|
+
Paste a Claude/Cline-style config and Ikie will wire it up:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
claude mcp add magic --scope user --env API_KEY="…" -- npx -y @21st-dev/magic@latest
|
|
30
113
|
```
|
|
31
114
|
|
|
32
|
-
|
|
115
|
+
Or create a `.mcp.json` file in the project root (or `.mcp.local.json` for
|
|
116
|
+
machine-local overrides, or `~/.ikie/mcp.json` for global ones):
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcpServers": {
|
|
121
|
+
"magic": {
|
|
122
|
+
"type": "stdio",
|
|
123
|
+
"command": "npx",
|
|
124
|
+
"args": ["-y", "@21st-dev/magic@latest"],
|
|
125
|
+
"env": { "API_KEY": "…" },
|
|
126
|
+
"enabled": true,
|
|
127
|
+
"autoStart": true
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
In the REPL, use `/mcp` to list servers and their tools, `/mcp add <line>` to
|
|
134
|
+
add one from a `claude mcp add …` line, `/mcp remove <name>`, and `/mcp reconnect
|
|
135
|
+
<name>`.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## In-session commands
|
|
140
|
+
|
|
141
|
+
Type `/` to open the command menu. Highlights:
|
|
142
|
+
|
|
143
|
+
| Command | Description |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| `/help` | Show all commands |
|
|
146
|
+
| `/plan` · `/agent` · `/mode` | Switch or show mode *(Shift+Tab toggles)* |
|
|
147
|
+
| `/clear` | Clear conversation history |
|
|
148
|
+
| `/compact` | Summarize the conversation to free up context |
|
|
149
|
+
| `/session list\|load\|new\|delete` | Manage saved sessions |
|
|
150
|
+
| `/memory [save]` | View or save persistent notes |
|
|
151
|
+
| `/context` | Show the detected project context |
|
|
152
|
+
| `/model <name>` · `/models` | Switch or list models |
|
|
153
|
+
| `/settings [show\|model\|reset]` | View/change persisted settings |
|
|
154
|
+
| `/skills` | List, show, install, or remove skills |
|
|
155
|
+
| `/mcp` · `/mcp add` · `/mcp remove` · `/mcp reconnect` | MCP server status and management |
|
|
156
|
+
| `/theme [name]` | Change the color theme |
|
|
157
|
+
| `/usage` · `/tokens` | Account usage/credit and token estimate |
|
|
158
|
+
| `/rpm <n>` | Set the model request-per-minute limit |
|
|
159
|
+
| `/onboarding` | Re-run the first-time tutorial |
|
|
160
|
+
| `!<cmd>` | Run a shell command directly (output lands in the session) |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## CLI usage
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
ikie "<message>" One-shot command
|
|
168
|
+
ikie Start an interactive session
|
|
169
|
+
ikie login Sign in to your Ikie account
|
|
170
|
+
ikie logout Sign out
|
|
171
|
+
ikie skills <…> Manage skills (list / install / remove)
|
|
172
|
+
|
|
173
|
+
Flags:
|
|
174
|
+
-m, --model <id> Use a specific model
|
|
175
|
+
-y, --yes Auto-approve all tool executions
|
|
176
|
+
--rpm <n> Max model requests per minute (default: 10)
|
|
177
|
+
--verbose Debug output
|
|
178
|
+
--onboarding Re-run first-time onboarding
|
|
179
|
+
-h, --help Show help
|
|
180
|
+
-v, --version Show version
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Themes
|
|
186
|
+
|
|
187
|
+
Seven built-in color schemes: **nebula**, **cyberpunk**, **dracula**, **forest**,
|
|
188
|
+
**slate**, **amber**, and **aurora**. Switch with `/theme <name>`.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Permissions & safety
|
|
33
193
|
|
|
34
|
-
|
|
194
|
+
- `bash`, `write_file`, and `edit_file` ask before running. Press `y` to allow
|
|
195
|
+
once, `a` to always-allow that tool for the session, `n`/`!` to deny.
|
|
196
|
+
- Reading project files is silent; reading credential files (`.env`, `.ssh`, keys,
|
|
197
|
+
`.npmrc`, …) prompts first.
|
|
198
|
+
- Ikie warns before any command that could terminate its own session by killing
|
|
199
|
+
processes on its host port.
|
|
200
|
+
- Run with `-y` / `--yes` to auto-approve everything (use with care).
|
|
35
201
|
|
|
36
|
-
|
|
37
|
-
- **`web_search`** — search the web and get back titles, URLs, and snippets. Powered by the ikie
|
|
38
|
-
server — no separate search API key needed; your ikie login is enough.
|
|
202
|
+
---
|
|
39
203
|
|
|
40
|
-
##
|
|
204
|
+
## License
|
|
41
205
|
|
|
42
|
-
|
|
43
|
-
- An ikie account — sign in with `ikie login`
|
|
206
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/agent.d.ts
CHANGED
|
@@ -6,7 +6,13 @@ export interface AgentOptions {
|
|
|
6
6
|
autoApprove?: boolean;
|
|
7
7
|
signal?: AbortSignal;
|
|
8
8
|
startedAt?: number;
|
|
9
|
+
/** Max model→tool round-trips in a single turn before forcing a graceful stop. */
|
|
10
|
+
maxSteps?: number;
|
|
9
11
|
}
|
|
12
|
+
/** Default per-turn step budget — guards against runaway tool loops. */
|
|
13
|
+
export declare const DEFAULT_MAX_STEPS = 60;
|
|
14
|
+
/** Result synthesized for a tool call that never produced one (cancel/crash). */
|
|
15
|
+
export declare const INTERRUPTED_TOOL_RESULT = "Interrupted: this tool did not run to completion (the turn was cancelled).";
|
|
10
16
|
/** Plan = read-only research + propose; Agent = full execution. */
|
|
11
17
|
export type AgentMode = 'agent' | 'plan';
|
|
12
18
|
export interface AgentTurnStats {
|
|
@@ -20,6 +26,32 @@ export declare function estimateTokens(chars: number): number;
|
|
|
20
26
|
* The SDK wraps provider responses; we prefer the nested error.message if it exists.
|
|
21
27
|
*/
|
|
22
28
|
export declare function extractUpstreamError(err: unknown): string;
|
|
29
|
+
/**
|
|
30
|
+
* Guarantee the OpenAI invariant: every `assistant` message that carries
|
|
31
|
+
* `tool_calls` is followed by a `tool` message for each call id. A turn that is
|
|
32
|
+
* cancelled (ESC/Ctrl-C), throws mid-stream, or is restored from a session saved
|
|
33
|
+
* mid-flight can leave "dangling" tool calls with no result — and the provider
|
|
34
|
+
* then rejects the *next* request ("an assistant message with 'tool_calls' must
|
|
35
|
+
* be followed by tool messages"). This splices a synthetic result for any
|
|
36
|
+
* unanswered call so history is always replayable. Pure and idempotent.
|
|
37
|
+
*/
|
|
38
|
+
export declare function repairDanglingToolCalls(messages: ChatCompletionMessageParam[]): ChatCompletionMessageParam[];
|
|
39
|
+
/**
|
|
40
|
+
* Whether the agent loop should make another model call. We continue purely on
|
|
41
|
+
* "there were tool calls to answer" — NOT on `finishReason`, because some
|
|
42
|
+
* providers send `finish_reason: 'stop'` (or null) alongside tool calls, which
|
|
43
|
+
* would otherwise silently drop the calls. `maxSteps` caps runaway loops.
|
|
44
|
+
*/
|
|
45
|
+
export declare function shouldContinue(toolCallCount: number, _finishReason: string, step: number, maxSteps: number): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Drop malformed tool calls (no function name) accumulated from a stream. An
|
|
48
|
+
* unnamed call can't be dispatched or answered, so keeping it would create an
|
|
49
|
+
* un-satisfiable `tool_calls` entry. Applied to both the dispatch list and the
|
|
50
|
+
* assistant message so they stay in lockstep.
|
|
51
|
+
*/
|
|
52
|
+
export declare function normalizeToolCalls<T extends {
|
|
53
|
+
name: string;
|
|
54
|
+
}>(calls: T[]): T[];
|
|
23
55
|
/**
|
|
24
56
|
* Safely restore previously-saved stdin listeners after a raw-mode interaction
|
|
25
57
|
* (permission prompt, ask_user, theme picker, agent turn).
|
|
@@ -62,16 +94,28 @@ export declare class Agent {
|
|
|
62
94
|
private groupToolCalls;
|
|
63
95
|
private formatGroupSummary;
|
|
64
96
|
private runLoop;
|
|
97
|
+
/**
|
|
98
|
+
* Final wrap-up when the per-turn step budget is exhausted. One model call with
|
|
99
|
+
* tools disabled, so it produces a plain summary and can never leave a dangling
|
|
100
|
+
* tool call. Best-effort: failures here don't throw out of the turn.
|
|
101
|
+
*/
|
|
102
|
+
private summarizeAndStop;
|
|
65
103
|
private callModel;
|
|
66
104
|
private buildParams;
|
|
67
105
|
private throttleModelRequest;
|
|
68
106
|
private callModelStreaming;
|
|
69
107
|
private callModelNonStreaming;
|
|
70
108
|
private handleToolCall;
|
|
109
|
+
private handleUseSkill;
|
|
71
110
|
private handleSwitchMode;
|
|
72
111
|
private requestModeSwitch;
|
|
73
112
|
private askUser;
|
|
74
113
|
private runSubagent;
|
|
114
|
+
/**
|
|
115
|
+
* Best-effort: one tool-less model call asking for a concise, self-contained
|
|
116
|
+
* summary of the work so far. Used to guarantee a non-empty subagent result.
|
|
117
|
+
*/
|
|
118
|
+
requestFinalSummary(signal?: AbortSignal): Promise<string>;
|
|
75
119
|
getLastAssistantText(): string;
|
|
76
120
|
private checkPermission;
|
|
77
121
|
}
|