@bolt-cli/cli 0.13.0 → 0.14.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/README.md +1 -1
- package/lib/agent.js +1 -1
- package/lib/cli.js +32 -46
- package/lib/permissions.js +1 -1
- package/lib/present.js +12 -11
- package/lib/tools.js +1 -1
- package/lib/ui.js +14 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ Press **Esc** during any run to stop it — the session is saved, no need to kil
|
|
|
100
100
|
|
|
101
101
|
Colors and glyphs follow your terminal: full color on a TTY, plain text on pipes and CI so logs and `--format json > file` stay parseable. Git Bash, Windows Terminal, and VS Code are detected even without a TTY. Override either way with `FORCE_COLOR=1|2|3` (force on) or `NO_COLOR=1` (force off).
|
|
102
102
|
|
|
103
|
-
## Interactive mode (
|
|
103
|
+
## Interactive mode (modern terminal)
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
bolt
|
package/lib/agent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// The agent loop: multi-turn tool use in the style of
|
|
2
|
+
// The agent loop: multi-turn tool use in the style of modern agent CLIs.
|
|
3
3
|
//
|
|
4
4
|
// The Bolt backend is a text-in/text-out agent, so the loop is client-driven:
|
|
5
5
|
// the CLI describes the tool protocol in the prompt, parses ```tool blocks
|
package/lib/cli.js
CHANGED
|
@@ -49,7 +49,7 @@ Install: npm install -g @bolt-cli/cli Update: npm update -g @bolt-cli
|
|
|
49
49
|
Web: https://bolt.beerasafe.com Bugs: security@beerasafe.com
|
|
50
50
|
|
|
51
51
|
Usage:
|
|
52
|
-
bolt interactive agent (
|
|
52
|
+
bolt interactive agent (Bolt backend only)
|
|
53
53
|
bolt login | signin sign in through your browser
|
|
54
54
|
bolt auth status | logout session info, sign out this machine
|
|
55
55
|
bolt run "<prompt>" [options] single autonomous run
|
|
@@ -214,7 +214,7 @@ function finishSignin(url, data) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
*
|
|
217
|
+
* Task-first entry: a missing token signs you in instead of stopping
|
|
218
218
|
* you. On an interactive terminal the browser flow starts automatically and
|
|
219
219
|
* the command continues once it completes; without a TTY (pipes, CI) there
|
|
220
220
|
* is nothing to open, so it stays an error telling you exactly what to run.
|
|
@@ -681,7 +681,7 @@ function positionalPrompt(rest) {
|
|
|
681
681
|
.trim();
|
|
682
682
|
}
|
|
683
683
|
|
|
684
|
-
// Agents:
|
|
684
|
+
// Agents: modern terminal presets, explicit opt-in. Arming one wraps the next
|
|
685
685
|
// objective with its template client-side; unarmed runs stay verbatim.
|
|
686
686
|
const AGENTS = {
|
|
687
687
|
sweep: {
|
|
@@ -787,7 +787,7 @@ function readEvidence(rest) {
|
|
|
787
787
|
return parts.join("\n\n");
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
-
// Approval asker for tool calls,
|
|
790
|
+
// Approval asker for tool calls, modern agent CLI style: an arrow-key
|
|
791
791
|
// dropdown with Allow once / Always allow / Deny. Elevated commands (sudo,
|
|
792
792
|
// system installs, service control) render a shield card explaining why they
|
|
793
793
|
// need admin. A throwaway readline is used for the text fallback only (never
|
|
@@ -921,7 +921,10 @@ function handleToolEvent(event) {
|
|
|
921
921
|
} else {
|
|
922
922
|
toolStarted.set(toolTimingKey(event.call), Date.now());
|
|
923
923
|
const elevated = event.call && event.call.tool === "bash" ? permissions.isElevatedCommand(event.call.command) : false;
|
|
924
|
-
|
|
924
|
+
// reference terminals render tool traffic as dim text under the answer, not a
|
|
925
|
+
// branded announcement; the elevated warning keeps its colour so the
|
|
926
|
+
// one thing that must be seen, is.
|
|
927
|
+
ui.status(`${ui.c.muted(`${ui.GLYPH.caret} ${tools.describeCall(event.call)}`)}${elevated ? ` ${ui.c.warning("[elevated]")}` : ""}`);
|
|
925
928
|
}
|
|
926
929
|
return;
|
|
927
930
|
}
|
|
@@ -931,13 +934,15 @@ function handleToolEvent(event) {
|
|
|
931
934
|
if (event.call.tool === "(parse error)") {
|
|
932
935
|
ui.warn(`tool request ignored: ${r.summary || "bad block"}`);
|
|
933
936
|
} else {
|
|
934
|
-
|
|
937
|
+
// Result rows stay dim like the call row; failure keeps a warning tone
|
|
938
|
+
// so a scan down the transcript still catches it.
|
|
939
|
+
ui.status(` ${r.ok ? ui.c.muted("ok") : ui.c.warning("FAILED")} ${ui.c.muted(r.summary || "")}${took}`);
|
|
935
940
|
}
|
|
936
941
|
}
|
|
937
942
|
}
|
|
938
943
|
|
|
939
944
|
// Start timestamps for approved tool calls, so the result row can carry an
|
|
940
|
-
//
|
|
945
|
+
// modern terminal elapsed time. Keyed by the rendered call description; a
|
|
941
946
|
// repeated call re-arms the timer, which is the honest behaviour for a map
|
|
942
947
|
// (the newest start wins). Unmatched results simply show no duration.
|
|
943
948
|
const toolStarted = new Map();
|
|
@@ -1554,7 +1559,7 @@ function resolvePalettePick(raw, items) {
|
|
|
1554
1559
|
return { action: "filter", text: text.replace(/^\//, "") };
|
|
1555
1560
|
}
|
|
1556
1561
|
|
|
1557
|
-
// Grouped help box,
|
|
1562
|
+
// Grouped help box, `?`-overlay style: four small menus with stable
|
|
1558
1563
|
// numbers so the picker flow keeps working - the operator answers with a
|
|
1559
1564
|
// number exactly like the flat list. Returns the flat row list for
|
|
1560
1565
|
// pendingPalette. Pure rows in, console lines out.
|
|
@@ -1614,35 +1619,20 @@ function pickTip(n) {
|
|
|
1614
1619
|
return TIPS[((Number(n) || 0) % TIPS.length + TIPS.length) % TIPS.length];
|
|
1615
1620
|
}
|
|
1616
1621
|
|
|
1617
|
-
// Welcome lines for the REPL
|
|
1618
|
-
//
|
|
1619
|
-
//
|
|
1620
|
-
|
|
1622
|
+
// Welcome lines for the REPL: quiet, polished. One identity line
|
|
1623
|
+
// (name, version, backend, working directory), one state line (session, the
|
|
1624
|
+
// single verb that matters), one muted mechanics line. No logo wall, no box,
|
|
1625
|
+
// no rotating tip. Pure (ui.c degrades to identity), tested.
|
|
1626
|
+
function replWelcomeLines({ sid, version, host, cwd, update }) {
|
|
1627
|
+
const identity = [version ? `v${version}` : "", host, cwd].filter(Boolean);
|
|
1621
1628
|
const lines = [
|
|
1622
|
-
`${ui.c.primary(ui.c.bold("bolt"))}
|
|
1623
|
-
|
|
1629
|
+
`${ui.c.primary(ui.c.bold("bolt"))}${identity.length ? ` ${ui.c.muted(identity.join(` ${ui.GLYPH.dot} `))}` : ""}`,
|
|
1630
|
+
ui.c.muted(`session ${sid.slice(0, 8)} ${ui.GLYPH.dot} type a task and press enter`),
|
|
1631
|
+
` ${ui.c.muted(`/ opens the command dropdown ${ui.GLYPH.dot} type to filter, up/down to pick, Tab fills and keeps your place ${ui.GLYPH.dot} @path attaches a file`)}`,
|
|
1624
1632
|
];
|
|
1625
|
-
if (host || cwd) {
|
|
1626
|
-
const where = [];
|
|
1627
|
-
if (host) where.push(`${ui.c.muted("backend")} ${host}`);
|
|
1628
|
-
if (cwd) where.push(`${ui.c.muted("cwd")} ${cwd}`);
|
|
1629
|
-
lines.push(where.join(` ${ui.c.muted(ui.GLYPH.dot)} `));
|
|
1630
|
-
}
|
|
1631
1633
|
if (update) {
|
|
1632
1634
|
lines.push("", `${ui.c.warning("update")} ${update}`);
|
|
1633
1635
|
}
|
|
1634
|
-
lines.push(
|
|
1635
|
-
"",
|
|
1636
|
-
ui.bullets([
|
|
1637
|
-
"type a task and press enter to run it",
|
|
1638
|
-
`${ui.c.bold("/")} opens the command dropdown ${ui.c.muted(ui.GLYPH.dot)} type to filter, up/down to pick, ${ui.c.bold("Tab")} fills and keeps your place`,
|
|
1639
|
-
`${ui.c.bold("Tab")} completes commands and their arguments ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("@path")} attaches a file ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/help <cmd>")} detail`,
|
|
1640
|
-
`${ui.c.bold("/status")} dashboard ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/sessions")} resume ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("?")} help ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/keys")} shortcuts ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/help <cmd>")} detail`,
|
|
1641
|
-
`${ui.c.bold("/agents")} presets ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/target")} scope ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/init")} map repo ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/mode")} offensive or defensive`,
|
|
1642
|
-
`${ui.c.bold("/doctor")} health ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/export")} file ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/undo")} restore ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/exit")} save and quit`,
|
|
1643
|
-
]),
|
|
1644
|
-
);
|
|
1645
|
-
if (tip) lines.push("", `${ui.c.muted("tip")} ${tip}`);
|
|
1646
1636
|
return lines;
|
|
1647
1637
|
}
|
|
1648
1638
|
|
|
@@ -1682,7 +1672,7 @@ function completeFileFrag(frag) {
|
|
|
1682
1672
|
|
|
1683
1673
|
function completer(line) {
|
|
1684
1674
|
// Tab-completes slash commands, their arguments, and agent names,
|
|
1685
|
-
//
|
|
1675
|
+
// modern terminal. @-mentions and /file complete filesystem paths,
|
|
1686
1676
|
// Claude Code style. /resume and /session complete saved session ids.
|
|
1687
1677
|
const atMatch = line.match(/@([^\s@]*)$/);
|
|
1688
1678
|
if (atMatch && !line.startsWith("/")) {
|
|
@@ -1827,7 +1817,7 @@ async function cmdRepl() {
|
|
|
1827
1817
|
let allowAll = false;
|
|
1828
1818
|
const sessionAllowed = new Set();
|
|
1829
1819
|
// Persistent always-allow store: "Always allow" survives restarts via
|
|
1830
|
-
// ~/.bolt/permissions.json (
|
|
1820
|
+
// ~/.bolt/permissions.json (modern agent CLI style).
|
|
1831
1821
|
const alwaysStore = permissions.load();
|
|
1832
1822
|
const persistAlways = (call) => {
|
|
1833
1823
|
const next = permissions.allowAlways(permissions.load(), call);
|
|
@@ -1855,23 +1845,19 @@ async function cmdRepl() {
|
|
|
1855
1845
|
const setPrompt = () => rl.setPrompt(present.promptLine(state()));
|
|
1856
1846
|
|
|
1857
1847
|
console.log("");
|
|
1858
|
-
|
|
1848
|
+
// Quiet polished welcome: two header lines, not a logo wall in a box.
|
|
1859
1849
|
// Update notice comes from the cache first (instant, no network); a stale
|
|
1860
1850
|
// cache is refreshed in the background for the next session, and a newly
|
|
1861
1851
|
// discovered update prints one line mid-session.
|
|
1862
1852
|
const cachedUpdate = updatecheck.cachedNotice(VERSION);
|
|
1863
1853
|
console.log(
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
tip: pickTip(Math.floor(Date.now() / 86400000)),
|
|
1872
|
-
update: cachedUpdate || undefined,
|
|
1873
|
-
}),
|
|
1874
|
-
}),
|
|
1854
|
+
replWelcomeLines({
|
|
1855
|
+
sid: sess.id,
|
|
1856
|
+
version: VERSION,
|
|
1857
|
+
host: backendHost(cfg.url),
|
|
1858
|
+
cwd: process.cwd(),
|
|
1859
|
+
update: cachedUpdate || undefined,
|
|
1860
|
+
}).join("\n"),
|
|
1875
1861
|
);
|
|
1876
1862
|
console.log("");
|
|
1877
1863
|
void updatecheck
|
package/lib/permissions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Persistent permission store for the bolt agent loop.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// Modern agent CLIs remember "allow always" decisions across sessions.
|
|
5
5
|
// Session-only approvals live in memory (a Set passed around the loop); this
|
|
6
6
|
// module persists the "always" tier to ~/.bolt/permissions.json so a tool the
|
|
7
7
|
// operator trusts never asks again. File mode 600, same as the auth token.
|
package/lib/present.js
CHANGED
|
@@ -67,18 +67,19 @@ function turnFooter({ done, elapsed, turns }) {
|
|
|
67
67
|
return ui.isTTY() ? `${ui.c.border(ui.GLYPH.rule.repeat(6))} ${joined}` : joined;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// The prompt doubles as the status line, the way
|
|
70
|
+
// The prompt doubles as the status line, the way quiet terminals keep state visible:
|
|
71
71
|
// mode, target, armed agent and attachment count all live here so you never
|
|
72
|
-
// have to remember what you set.
|
|
73
|
-
|
|
72
|
+
// have to remember what you set. One quiet caret leads, mode carries the only
|
|
73
|
+
// emphasis, everything else is muted; the session id lives in /status and the
|
|
74
|
+
// welcome line, not on every keystroke.
|
|
75
|
+
function promptLine({ mode, target, agent, files, balance, tools }) {
|
|
74
76
|
const bits = [ui.c.primary(ui.c.bold(mode))];
|
|
75
|
-
if (target) bits.push(ui.c.
|
|
76
|
-
if (agent) bits.push(
|
|
77
|
+
if (target) bits.push(ui.c.muted(target));
|
|
78
|
+
if (agent) bits.push(ui.c.muted(`agent ${agent}`));
|
|
77
79
|
if (files) bits.push(ui.c.muted(`${files} file${files === 1 ? "" : "s"}`));
|
|
78
|
-
if (tools !== undefined) bits.push(
|
|
80
|
+
if (tools !== undefined) bits.push(ui.c.muted(tools ? "tools" : "no-tools"));
|
|
79
81
|
if (balance !== undefined && balance !== null) bits.push(ui.c.muted(`${balance} tok`));
|
|
80
|
-
bits.
|
|
81
|
-
return `${ui.c.primary(ui.GLYPH.bar)} ${bits.join(ui.c.muted(` ${ui.GLYPH.dot} `))} ${ui.c.primary(ui.GLYPH.caret)} `;
|
|
82
|
+
return `${ui.c.primary(ui.GLYPH.caret)} ${bits.join(ui.c.muted(` ${ui.GLYPH.dot} `))} ${ui.c.primary(ui.GLYPH.caret)} `;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
// Palette rows for `select()`; label is what gets typed back into the prompt.
|
|
@@ -109,7 +110,7 @@ function filterPalette(query, commands, agents) {
|
|
|
109
110
|
return all.filter((it) => `${it.label} ${it.hint || ""}`.toLowerCase().includes(q));
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
// Grouped help,
|
|
113
|
+
// Grouped help, `?`-overlay style: commands read as four small
|
|
113
114
|
// menus (run, session, safety, system) instead of one flat list. Pure:
|
|
114
115
|
// group membership is by command base, rows keep their COMMANDS text.
|
|
115
116
|
const HELP_GROUPS = [
|
|
@@ -142,7 +143,7 @@ function helpDetail(query, commands) {
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
// Status dashboard rows for the `/status` box: everything about the live
|
|
145
|
-
// session in one glance,
|
|
146
|
+
// session in one glance, status-dialog style. All fields optional;
|
|
146
147
|
// missing values read as "(none)" or are skipped. Pure.
|
|
147
148
|
function statusLines({ sid, mode, target, agent, files, tools, balance, turns, memChars, cwd, backend } = {}) {
|
|
148
149
|
const rows = [];
|
|
@@ -164,7 +165,7 @@ function statusLines({ sid, mode, target, agent, files, tools, balance, turns, m
|
|
|
164
165
|
return rows;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
// Session picker rows for `/sessions`,
|
|
168
|
+
// Session picker rows for `/sessions`, session-list style: newest
|
|
168
169
|
// first, title plus turn count plus relative age in the hint, and the live
|
|
169
170
|
// session flagged so resuming it is never a surprise. Pure.
|
|
170
171
|
function sessionRows(sessions, currentId) {
|
package/lib/tools.js
CHANGED
package/lib/ui.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Terminal presentation layer. Zero deps: hand-rolled ANSI only.
|
|
3
3
|
//
|
|
4
|
-
// Scope note: this is deliberately *not* a full-screen TUI.
|
|
5
|
-
//
|
|
6
|
-
// free so `npm i -g @bolt-cli/cli` is
|
|
7
|
-
// vocabulary and feel -- semantic colour
|
|
8
|
-
//
|
|
9
|
-
// command palette, and quiet
|
|
4
|
+
// Scope note: this is deliberately *not* a full-screen TUI. Full-screen
|
|
5
|
+
// terminal interfaces ship native binaries and tens of megabytes of
|
|
6
|
+
// dependencies; bolt stays dependency free so `npm i -g @bolt-cli/cli` is
|
|
7
|
+
// instant. What we reproduce is the vocabulary and feel -- semantic colour
|
|
8
|
+
// tokens with the names polished terminal UIs use, a status-carrying prompt,
|
|
9
|
+
// a thinking indicator, an arrow-key command palette, and quiet prose.
|
|
10
10
|
//
|
|
11
11
|
// Every helper degrades to plain text when stdout is not a TTY, when NO_COLOR
|
|
12
12
|
// is set, or when the terminal only supports 16 colours, so piped output and CI
|
|
@@ -168,7 +168,7 @@ function width() {
|
|
|
168
168
|
return typeof columns === "number" && columns > 20 ? Math.min(columns, 100) : 78;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
//
|
|
171
|
+
// Heavy block-letter wordmark: solid blocks where
|
|
172
172
|
// the terminal proves modern, the plain word everywhere else so raster fonts
|
|
173
173
|
// never show tofu. Rows pad to one width in code (no trailing whitespace in
|
|
174
174
|
// the literals for linters to flag); every glyph is one cell, so length math
|
|
@@ -248,7 +248,7 @@ function rule(w = width()) {
|
|
|
248
248
|
return c.border(GLYPH.rule.repeat(Math.max(8, w)));
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
function box({ title = "", lines = [], w = width(), tone = "
|
|
251
|
+
function box({ title = "", lines = [], w = width(), tone = "border" }) {
|
|
252
252
|
const paint = c[tone] || c.primary;
|
|
253
253
|
const inner = w - 4;
|
|
254
254
|
const head = title ? ` ${c.bold(title)} ` : "";
|
|
@@ -272,8 +272,11 @@ function bullets(rows, { marker = GLYPH.dot } = {}) {
|
|
|
272
272
|
|
|
273
273
|
// ---------------------------------------------------------------- status
|
|
274
274
|
|
|
275
|
+
// Quiet progress line for tool activity: reference terminals render tool traffic as
|
|
276
|
+
// plain dim text, not branded announcements, so no wordmark here either.
|
|
277
|
+
// Callers pass pre-styled text.
|
|
275
278
|
function status(text) {
|
|
276
|
-
errWrite(`${
|
|
279
|
+
errWrite(`${text}\n`);
|
|
277
280
|
}
|
|
278
281
|
|
|
279
282
|
function ok(text) {
|
|
@@ -454,7 +457,7 @@ function selectable(items) {
|
|
|
454
457
|
}
|
|
455
458
|
|
|
456
459
|
// Scroll window for a picker whose rows outnumber `max`: the selected row
|
|
457
|
-
// stays visible by sliding the viewport,
|
|
460
|
+
// stays visible by sliding the viewport, selection-menu style. Pure, tested:
|
|
458
461
|
// returns the [start, end) slice bounds to display. When everything fits the
|
|
459
462
|
// whole list shows; a non-positive max degrades to the whole list too.
|
|
460
463
|
function pickWindow(index, total, max) {
|
|
@@ -697,7 +700,7 @@ function selectLive({ title = "", items = [], max = 12, initialFilter = "", filt
|
|
|
697
700
|
|
|
698
701
|
// ---------------------------------------------------------------- approvals
|
|
699
702
|
|
|
700
|
-
// Permission options for a tool approval,
|
|
703
|
+
// Permission options for a tool approval, modern agent CLI style.
|
|
701
704
|
// Elevated commands (sudo, system installs) get the shield treatment and no
|
|
702
705
|
// silent path; installers only offer once/deny (never always).
|
|
703
706
|
function permissionItems({ elevated = false, install = false } = {}) {
|
package/package.json
CHANGED