@cryer/star-cli 0.1.1 → 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/README.md +52 -7
- package/dist/main.js +2080 -441
- package/dist/main.js.map +1 -1
- package/dist/stream-Y55NRF2S.js +82 -0
- package/dist/stream-Y55NRF2S.js.map +1 -0
- package/package.json +1 -1
- package/dist/stream-FJQZGETE.js +0 -51
- package/dist/stream-FJQZGETE.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
An AI agent command-line interface written in TypeScript — multi-model LLM access, streaming terminal UI, tool calling, permission control, and session persistence.
|
|
6
6
|
|
|
7
|
-
Features: streaming REPL with slash commands · OpenAI / Anthropic / OpenAI-compatible providers · built-in fs / bash / web tools with a permission gate · `@file` mentions · conversation compaction (`/compact`) · session persistence and resume (`/resume`, `star -r`) · file-write snapshots with `/undo` · persistent permission allow-rules · TODO task tracking · Markdown session export (`/export`).
|
|
7
|
+
Features: streaming REPL with slash commands (+ autocomplete) · OpenAI / Anthropic / OpenAI-compatible providers · built-in fs / bash / web tools with a permission gate · plan mode with read-only research and plan approval · thinking spinner with dim reasoning preview · diff preview on write/edit approval · `@file` mentions · `!cmd` shell passthrough · custom slash commands from Markdown files · conversation compaction (`/compact`) · session persistence and resume (`/resume`, `star -r`) · file-write snapshots with `/undo` · persistent permission allow-rules · TODO task tracking · background shell tasks with status-bar visibility (`/tasks`) · Markdown session export (`/export`) · `/init` + `/doctor` project scaffolding and environment checks · cost estimation · update notifier · `--json` NDJSON output for scripting.
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
@@ -37,9 +37,12 @@ Config file: `~/.star-cli/config.toml` (project-level override: `.star/config.to
|
|
|
37
37
|
|
|
38
38
|
```toml
|
|
39
39
|
defaultModel = "gpt"
|
|
40
|
-
permissionMode = "ask" # auto |
|
|
40
|
+
permissionMode = "ask" # ask | auto | readonly | yolo | plan
|
|
41
41
|
contextMaxTokens = 100000
|
|
42
42
|
contextCompaction = "summary" # summary | truncate — how over-budget history is compacted
|
|
43
|
+
# Seconds with no stream output before a stalled response is ended gracefully
|
|
44
|
+
# (some relays never close the stream). The first token gets a fixed 120s allowance.
|
|
45
|
+
streamIdleTimeoutSec = 20
|
|
43
46
|
|
|
44
47
|
[permissions]
|
|
45
48
|
# persistent allow-rules, written automatically when you pick "a" (always) on a permission prompt
|
|
@@ -56,6 +59,9 @@ apiKeyEnv = "OPENAI_API_KEY"
|
|
|
56
59
|
name = "gpt"
|
|
57
60
|
provider = "openai"
|
|
58
61
|
model = "gpt-4o"
|
|
62
|
+
# optional per-model pricing (USD per 1M tokens) — enables the $ estimate in /cost
|
|
63
|
+
promptPrice = 2.5
|
|
64
|
+
completionPrice = 10
|
|
59
65
|
|
|
60
66
|
[[providers]]
|
|
61
67
|
name = "claude"
|
|
@@ -76,8 +82,9 @@ API keys resolve from the environment variable first (`apiKeyEnv`), then the `ap
|
|
|
76
82
|
```
|
|
77
83
|
star start the interactive REPL
|
|
78
84
|
star -p "prompt" non-interactive print mode (pipe-friendly)
|
|
85
|
+
star -p "prompt" --json NDJSON event stream on stdout (text/tool/usage/error lines)
|
|
79
86
|
star -m gpt pick a model
|
|
80
|
-
star --permission-mode auto auto |
|
|
87
|
+
star --permission-mode auto ask | auto | readonly | yolo | plan
|
|
81
88
|
star -r <sessionId> resume a previous session
|
|
82
89
|
```
|
|
83
90
|
|
|
@@ -89,16 +96,52 @@ star -r <sessionId> resume a previous session
|
|
|
89
96
|
| `/model [name]` | list / switch models |
|
|
90
97
|
| `/resume [id]` | list / resume sessions |
|
|
91
98
|
| `/todo` | show TODO list |
|
|
92
|
-
| `/
|
|
99
|
+
| `/tasks` | list background tasks (id, status, runtime, exit code) |
|
|
100
|
+
| `/cost` | show API token usage and estimated $ cost (needs per-model pricing in config) |
|
|
93
101
|
| `/config` | show resolved config |
|
|
102
|
+
| `/permission [mode]` | show / set the global permission mode (`ask`, `auto`, `readonly`, `yolo`) — saved to config |
|
|
103
|
+
| `/plan` | toggle plan mode: read-only research, then approve the generated plan before it executes (session-only) |
|
|
94
104
|
| `/compact` | compact conversation history to free up context |
|
|
95
105
|
| `/export [path]` | export the current session to a Markdown file |
|
|
96
|
-
| `/undo` |
|
|
106
|
+
| `/undo` | undo the last conversation turn: revert its file changes (write_file/edit_file) and retract its messages — earlier turns are never touched |
|
|
107
|
+
| `/init [force]` | scan the project and generate an AGENTS.md (LLM-polished when a model is available) |
|
|
108
|
+
| `/doctor` | environment self-check (Node, shell, config, API key status, sessions dir writability) |
|
|
97
109
|
| `/clear` | clear the screen |
|
|
98
110
|
| `/exit` | quit |
|
|
99
111
|
| `/q` | quit (alias of `/exit`) |
|
|
100
112
|
|
|
101
|
-
Keys: `ESC` / `Ctrl+C` interrupts the current stream; on a permission prompt: `y` allow, `n` deny, `a` always allow — the generated allow-rule (e.g. `bash(npm test)`) is saved to `permissions.allow` in the config file and survives restarts. 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. Typing `/` shows slash-command suggestions — `↑`/`↓` to highlight, `Tab` (or `→` at end of input) to complete, `ESC` to dismiss.
|
|
113
|
+
Keys: `ESC` / `Ctrl+C` interrupts the current stream; on a permission prompt: `y` allow, `n` deny, `a` always allow — the generated allow-rule (e.g. `bash(npm test)`) is saved to `permissions.allow` in the config file and survives restarts. Write/edit prompts include a colored diff preview of the pending change. `Shift+Tab` cycles the permission mode for the session (`ask` → `auto` → `readonly` → `plan`; not saved to config). 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. Typing `/` shows slash-command suggestions — `↑`/`↓` to highlight, `Tab` (or `→` at end of input) to complete, `ESC` to dismiss.
|
|
114
|
+
|
|
115
|
+
While the model is working, a spinner (`- \ | /`) shows `star is thinking…`; reasoning models also stream a dimmed tail of their thinking (last ~200 chars), which collapses to a one-line summary once the answer starts.
|
|
116
|
+
|
|
117
|
+
## !shell passthrough
|
|
118
|
+
|
|
119
|
+
Prefix input with `!` to run a command locally without involving the model:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
!git status
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Output renders as a tool card and is injected into the conversation so the model can see it afterwards. Dangerous commands are still blocked, and `ESC` / `Ctrl+C` aborts execution.
|
|
126
|
+
|
|
127
|
+
## Background tasks
|
|
128
|
+
|
|
129
|
+
The model can run long shell commands in the background via `bash` with `run_in_background: true` (same permission gate as foreground commands). While anything runs in the background, the status bar shows `bg: N`; when a task finishes, fails, times out, or is stopped, a system message reports the outcome. `/tasks` lists every task with status, runtime, and exit code, and the model can inspect or stop tasks with the `task_list` / `task_output` / `task_kill` tools. Remaining tasks are killed when the REPL exits.
|
|
130
|
+
|
|
131
|
+
## Plan mode
|
|
132
|
+
|
|
133
|
+
Plan mode (`/plan`, `Shift+Tab` cycling, or `--permission-mode plan`) makes the agent research read-only before touching anything: the model only sees read-level tools (`read_file` / `glob` / `grep` / `web_*` / `todo` …), write/exec tools are hidden entirely, and the system prompt instructs it to end with a concrete step-by-step plan. When the plan is ready, an approval prompt appears — `y` restores the previous permission mode and tells the agent to execute the plan, `n` / `ESC` stays in plan mode so you can keep refining. Plan mode is session-scoped and never written to the config file; `/plan` again toggles back.
|
|
134
|
+
|
|
135
|
+
## Custom slash commands
|
|
136
|
+
|
|
137
|
+
Drop Markdown files into `.star/commands/<name>.md` (project) or `~/.star-cli/commands/<name>.md` (global) to define your own commands — `/review src/` then sends the file's contents (with `$ARGUMENTS` replaced by your arguments) to the model as a prompt. An optional first line `<!-- description: does a thing -->` sets the description shown in `/help` and autocomplete. Names must match `[a-z0-9-]+`; built-in commands win on conflicts.
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
<!-- description: review code for issues -->
|
|
141
|
+
Review the following code and list concrete issues: $ARGUMENTS
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The REPL also checks npm for a newer release on startup (async, non-blocking; disable with `STAR_NO_UPDATE_CHECK=1`).
|
|
102
145
|
|
|
103
146
|
## @file mentions
|
|
104
147
|
|
|
@@ -112,7 +155,9 @@ Missing, binary, oversized (>100KB), or sensitive files (`.env`, private keys) a
|
|
|
112
155
|
|
|
113
156
|
## Built-in tools
|
|
114
157
|
|
|
115
|
-
`read_file`, `write_file`, `edit_file`, `glob`, `grep`, `bash`, `web_fetch`, `web_search` (DuckDuckGo, no API key needed), `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
|
|
158
|
+
`read_file`, `write_file`, `edit_file`, `glob`, `grep`, `bash`, `web_fetch`, `web_search` (DuckDuckGo, no API key needed), `todo_read`, `todo_write`, `task_list`, `task_output`, `task_kill` — 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 `ask` / `auto` / `readonly` and cannot be overridden by allow-rules.
|
|
159
|
+
|
|
160
|
+
Permission modes: `ask` (reads allowed, writes/exec ask) · `auto` (everything allowed except the hard-denied rules above) · `readonly` (read-only) · `yolo` (allow everything, never ask — **all safety checks disabled**, use at your own risk) · `plan` (read-only research with a plan-approval flow, see above — session-only). Switch at runtime with `/permission` (persisted to the config file), per session with `/plan` or `Shift+Tab`, or at startup with `--permission-mode`.
|
|
116
161
|
|
|
117
162
|
Every successful `write_file` / `edit_file` first snapshots the file's previous content (in-memory, last 50 writes per session); `/undo` restores the most recent snapshot, deleting the file if it didn't exist before.
|
|
118
163
|
|