@cryer/star-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) 2025 cryer
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,106 @@
1
+ # Star CLI
2
+
3
+ An AI agent command-line interface written in TypeScript — multi-model LLM access, streaming terminal UI, tool calling, permission control, and session persistence.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js >= 20
8
+ - pnpm
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install -g @cryer/star-cli
14
+ star # interactive REPL
15
+ star -p "hi" # non-interactive print mode
16
+ ```
17
+
18
+ ## Quick start (from source)
19
+
20
+ ```bash
21
+ pnpm install
22
+ pnpm build
23
+ node dist/main.js # interactive REPL
24
+ node dist/main.js -p "hi" # non-interactive print mode
25
+ ```
26
+
27
+ ## Configuration
28
+
29
+ Config file: `~/.star-cli/config.toml` (project-level override: `.star/config.toml` in cwd; CLI flags win over both).
30
+
31
+ ```toml
32
+ defaultModel = "gpt"
33
+ permissionMode = "ask" # auto | ask | readonly
34
+ contextMaxTokens = 100000
35
+ contextCompaction = "summary" # summary | truncate — how over-budget history is compacted
36
+
37
+ [[providers]]
38
+ name = "openai"
39
+ protocol = "openai-compatible"
40
+ baseURL = "https://api.openai.com/v1"
41
+ apiKeyEnv = "OPENAI_API_KEY"
42
+ # protocol = "openai-responses" # for relays exposing only /v1/responses
43
+
44
+ [[models]]
45
+ name = "gpt"
46
+ provider = "openai"
47
+ model = "gpt-4o"
48
+
49
+ [[providers]]
50
+ name = "claude"
51
+ protocol = "anthropic"
52
+ baseURL = "https://api.anthropic.com"
53
+ apiKeyEnv = "ANTHROPIC_API_KEY"
54
+
55
+ [[models]]
56
+ name = "sonnet"
57
+ provider = "claude"
58
+ model = "claude-sonnet-4-20250514"
59
+ ```
60
+
61
+ API keys resolve from the environment variable first (`apiKeyEnv`), then the `apiKey` field in the config file.
62
+
63
+ ## CLI flags
64
+
65
+ ```
66
+ star start the interactive REPL
67
+ star -p "prompt" non-interactive print mode (pipe-friendly)
68
+ star -m gpt pick a model
69
+ star --permission-mode auto auto | ask | readonly
70
+ star -r <sessionId> resume a previous session
71
+ ```
72
+
73
+ ## Slash commands (REPL)
74
+
75
+ | Command | Description |
76
+ |---|---|
77
+ | `/help` | list commands |
78
+ | `/model [name]` | list / switch models |
79
+ | `/resume [id]` | list / resume sessions |
80
+ | `/todo` | show TODO list |
81
+ | `/cost` | show API token usage for this session |
82
+ | `/config` | show resolved config |
83
+ | `/clear` | clear the screen |
84
+ | `/exit` | quit |
85
+ | `/q` | quit (alias of `/exit`) |
86
+
87
+ Keys: `ESC` / `Ctrl+C` interrupts the current stream; on a permission prompt: `y` allow, `n` deny, `a` always allow this tool for the session. Input editing: arrow keys move the cursor, `Ctrl+A`/`Ctrl+E` jump to start/end, `Ctrl+U`/`Ctrl+K` delete before/after the cursor, `Ctrl+W` deletes the previous word, up/down recall history.
88
+
89
+ ## Built-in tools
90
+
91
+ `read_file`, `write_file`, `edit_file`, `glob`, `grep`, `bash`, `web_fetch`, `todo_read`, `todo_write` — each declares a permission level (`read` / `write` / `exec`) enforced by the permission gate. Hard safety rules (dangerous shell commands, paths outside the working directory, secret files like `.env` / private keys) are denied in every mode.
92
+
93
+ ## Sessions
94
+
95
+ Sessions persist under `~/.star-cli/sessions/<id>/` (messages as JSONL + `meta.json`). List with `/resume` (only sessions started in the current directory are listed), resume with `/resume <id>` or `star -r <id>`. Sessions are created lazily — opening the REPL and exiting without chatting leaves nothing on disk, and print mode (`-p`) doesn't create a session unless resuming with `-r`. Token usage is accumulated in `meta.json`, so `/cost` reflects resumed history too.
96
+
97
+ ## Development
98
+
99
+ ```bash
100
+ pnpm build # tsup bundle to dist/
101
+ pnpm test # vitest
102
+ pnpm typecheck # tsc --noEmit
103
+ pnpm lint # biome
104
+ ```
105
+
106
+ Architecture: `src/cli` (Ink UI), `src/agent` (main loop), `src/llm` (Vercel AI SDK provider layer), `src/tools`, `src/context` (token budget + compaction), `src/permissions`, `src/session`, `src/config`.