@cryer/star-cli 0.1.1 → 0.1.2

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 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 · 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 | ask | readonly
40
+ permissionMode = "ask" # ask | auto | readonly | yolo
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 | ask | readonly
87
+ star --permission-mode auto ask | auto | readonly | yolo
81
88
  star -r <sessionId> resume a previous session
82
89
  ```
83
90
 
@@ -89,16 +96,47 @@ 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
- | `/cost` | show API token usage for this session |
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 |
94
103
  | `/compact` | compact conversation history to free up context |
95
104
  | `/export [path]` | export the current session to a Markdown file |
96
- | `/undo` | revert the last file write/edit made by a tool |
105
+ | `/undo` | undo the last conversation turn: revert its file changes (write_file/edit_file) and retract its messages — earlier turns are never touched |
106
+ | `/init [force]` | scan the project and generate an AGENTS.md (LLM-polished when a model is available) |
107
+ | `/doctor` | environment self-check (Node, shell, config, API key status, sessions dir writability) |
97
108
  | `/clear` | clear the screen |
98
109
  | `/exit` | quit |
99
110
  | `/q` | quit (alias of `/exit`) |
100
111
 
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.
112
+ 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. 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
+
114
+ 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.
115
+
116
+ ## !shell passthrough
117
+
118
+ Prefix input with `!` to run a command locally without involving the model:
119
+
120
+ ```
121
+ !git status
122
+ ```
123
+
124
+ 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.
125
+
126
+ ## Background tasks
127
+
128
+ 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.
129
+
130
+ ## Custom slash commands
131
+
132
+ 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.
133
+
134
+ ```markdown
135
+ <!-- description: review code for issues -->
136
+ Review the following code and list concrete issues: $ARGUMENTS
137
+ ```
138
+
139
+ The REPL also checks npm for a newer release on startup (async, non-blocking; disable with `STAR_NO_UPDATE_CHECK=1`).
102
140
 
103
141
  ## @file mentions
104
142
 
@@ -112,7 +150,9 @@ Missing, binary, oversized (>100KB), or sensitive files (`.env`, private keys) a
112
150
 
113
151
  ## Built-in tools
114
152
 
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 every mode and cannot be overridden by allow-rules.
153
+ `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.
154
+
155
+ 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). Switch at runtime with `/permission` (persisted to the config file) or at startup with `--permission-mode`.
116
156
 
117
157
  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
158