ikie-cli 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ikie
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 ADDED
@@ -0,0 +1,35 @@
1
+ # ikie
2
+
3
+ **Agentic coding CLI** — your terminal AI pair programmer.
4
+
5
+ ```bash
6
+ npm install -g ikie-cli
7
+ ikie "write a rust web server"
8
+ ```
9
+
10
+ ## Features
11
+
12
+ - Streaming AI chat completions via Fireworks AI (default: Kimi K2)
13
+ - 10 built-in tools: read/write/edit files, bash, search, grep, memory, agent spawn
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)
18
+
19
+ ## Quick start
20
+
21
+ ```bash
22
+ # Install
23
+ npm install -g ikie
24
+
25
+ # Set your API key
26
+ export FIREWORKS_API_KEY=fw_...
27
+
28
+ # Start coding
29
+ ikie "refactor this file and add tests"
30
+ ```
31
+
32
+ ## Requirements
33
+
34
+ - Node.js 20+
35
+ - A Fireworks AI API key (or any OpenAI-compatible endpoint via `--base-url`)
@@ -0,0 +1,62 @@
1
+ import OpenAI from 'openai';
2
+ import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions.js';
3
+ import type { IkieConfig } from './config.js';
4
+ import type { UserContentPart } from './attachments.js';
5
+ export interface AgentOptions {
6
+ autoApprove?: boolean;
7
+ signal?: AbortSignal;
8
+ startedAt?: number;
9
+ }
10
+ export interface AgentTurnStats {
11
+ modelCalls: number;
12
+ toolCalls: number;
13
+ filesChanged: number;
14
+ }
15
+ export declare function estimateTokens(chars: number): number;
16
+ /**
17
+ * Safely restore previously-saved stdin listeners after a raw-mode interaction
18
+ * (permission prompt, ask_user, theme picker, agent turn).
19
+ *
20
+ * Re-adding 'keypress' listeners makes Node's readline re-attach its OWN 'data'
21
+ * decoder via emitKeypressEvents' `newListener` hook. The REPL already forwards
22
+ * raw bytes to that decoder manually, so a freshly auto-attached decoder is a
23
+ * duplicate — and two decoders for the same bytes double-echo every keystroke.
24
+ * To avoid that, we add keypress listeners first, then reset the 'data' listener
25
+ * set to EXACTLY the saved set, dropping any stray decoder.
26
+ */
27
+ export declare function restoreStdinListeners(savedDataListeners: Function[], savedKeypressListeners: Function[]): void;
28
+ export declare class Agent {
29
+ private client;
30
+ private config;
31
+ private conversation;
32
+ private systemPrompt;
33
+ private sessionAllowList;
34
+ private sessionDenyList;
35
+ private depth;
36
+ private indent;
37
+ private activeTurnStats;
38
+ private activeChangedFiles;
39
+ private lastTurnStats;
40
+ constructor(client: OpenAI, config: IkieConfig, systemPrompt: string, depth?: number);
41
+ clearConversation(): void;
42
+ getConversation(): ChatCompletionMessageParam[];
43
+ setConversation(messages: ChatCompletionMessageParam[]): void;
44
+ getLastTurnStats(): AgentTurnStats;
45
+ send(userMessage: string | UserContentPart[], opts?: AgentOptions): Promise<void>;
46
+ private recordChangedFile;
47
+ private groupToolCalls;
48
+ private formatGroupSummary;
49
+ private runLoop;
50
+ private callModel;
51
+ private buildParams;
52
+ private throttleModelRequest;
53
+ private callModelStreaming;
54
+ private callModelNonStreaming;
55
+ private handleToolCall;
56
+ private askUser;
57
+ private runSubagent;
58
+ getLastAssistantText(): string;
59
+ private checkPermission;
60
+ }
61
+ export declare const SUBAGENT_FRAMING = "You are a focused sub-agent spawned by Ikie to autonomously complete ONE specific task.\nWork independently \u2014 do not ask the user questions. Use your tools to gather what you\nneed, do the work, and verify it. When finished, your FINAL message must be a concise\nsummary of what you did and any key results (paths changed, findings, answers). That\nsummary is the only thing returned to the main agent, so make it self-contained.";
62
+ export declare function buildSystemPrompt(projectContext: string, memoryContext: string): string;