@carrieros/cli 0.1.0 → 0.2.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.
@@ -3,10 +3,10 @@ import { ApiError } from "../services/api.js";
3
3
  import { AuthRequiredError } from "../services/context.js";
4
4
  import { errorLine, info } from "../services/output.js";
5
5
  import { COMMANDS } from "../ui/command-item.js";
6
- import { pickColor } from "../ui/color-picker.js";
6
+ import { confirmColor, pickColor } from "../ui/color-picker.js";
7
7
  import { pickFromList } from "../ui/select.js";
8
8
  import { isThemeColor, setAccent, THEME_ORDER } from "../ui/theme.js";
9
- import { chatTurn, pickMode, pickModel, setMode, setModel } from "./shell-chat.js";
9
+ import { chatTurn, pickChatType, pickMode, pickModel, setChatType, setMode, setModel } from "./shell-chat.js";
10
10
  import { buildFooter } from "./shell-prompt.js";
11
11
  import { printShellHelp } from "./shell-renderer.js";
12
12
  const STAY = { exit: false };
@@ -64,7 +64,7 @@ export async function handleSlash(ctx, program, client, input) {
64
64
  if (isThemeColor(arg)) {
65
65
  setAccent(arg);
66
66
  ctx.config.set("theme", { accent: arg });
67
- info(`Accent color set to ${arg}.`);
67
+ confirmColor(arg);
68
68
  }
69
69
  else {
70
70
  errorLine(`Unknown color "${arg}". Try: ${THEME_ORDER.join(", ")}.`);
@@ -74,17 +74,29 @@ export async function handleSlash(ctx, program, client, input) {
74
74
  const chosen = await pickColor();
75
75
  if (chosen) {
76
76
  ctx.config.set("theme", { accent: chosen });
77
- info(`Accent color set to ${chosen}.`);
77
+ confirmColor(chosen);
78
78
  }
79
79
  return STAY;
80
80
  }
81
- // In the shell you're already chatting — /chat <text> sends a message, and
82
- // bare /chat just reminds you that typing directly is enough.
83
- case "chat":
84
- if (argStr)
81
+ // `/chat` selects the chat experience: bare shows current, `/chat carrier`
82
+ // and `/chat standard` switch. `/chat <other text>` still sends a message
83
+ // (you're already in the shell, so typing directly also works).
84
+ case "chat": {
85
+ const t = argStr.trim().toLowerCase();
86
+ const isTypeArg = ["", "carrier", "carrieros", "standard", "plain", "normal"].includes(t);
87
+ if (isTypeArg)
88
+ setChatType(ctx, argStr);
89
+ else
85
90
  await chatTurn(ctx, client, argStr, { footer: buildFooter(ctx) });
91
+ return STAY;
92
+ }
93
+ // `/switch` — arrow-key picker for the chat experience (Carrier ⇄ Standard).
94
+ // An explicit arg (`/switch standard`) sets it directly.
95
+ case "switch":
96
+ if (argStr.trim())
97
+ setChatType(ctx, argStr);
86
98
  else
87
- info("You're in the shell — just type your message to chat.");
99
+ await pickChatType(ctx);
88
100
  return STAY;
89
101
  // ── Chat behavior — handled here so the prompt reflects it immediately ────
90
102
  case "modes":
@@ -1,48 +1,27 @@
1
- import { capitalize } from "../services/output.js";
1
+ import chalk from "chalk";
2
2
  import { c } from "../ui/colors.js";
3
- import { modelLabelShort } from "./shell-chat.js";
3
+ import { modeLabelShort, modelLabelShort } from "./shell-chat.js";
4
4
  /** The green caret the shell prompt uses (non-TTY fallback). */
5
5
  export const CARET = c.brand("❯") + " ";
6
+ /** Light purple used for the "Standard chat" footer label (distinct from the
7
+ * accent-green Carrier Chat label). */
8
+ const STANDARD_LABEL = chalk.hex("#c4a7ff");
6
9
  /**
7
10
  * The dim status footer shown directly beneath the input box, Claude-style:
8
- * ‖ Test CLI · Project A · Code mode · Auto / for commands
9
- * Workspace/project fade to dim; the active mode (cyan) and model (yellow) keep
10
- * a subtle accent so they read at a glance. Hidden while the palette is open.
11
+ * ‖ Carrier OS chat · Grok 4.1 Fast
12
+ * The active chat/mode leads (accent), and the model (yellow) trails. Hidden
13
+ * while the palette is open.
11
14
  */
12
15
  export function buildFooter(ctx) {
13
- const scope = ctx.config.get("scope");
14
- let ws = scope?.workspace.name ?? "—";
15
- let proj = scope?.project.name ?? "—";
16
- const mode = capitalize(ctx.mode);
16
+ const mode = modeLabelShort(ctx);
17
17
  const model = modelLabelShort(ctx);
18
- const w = process.stdout.columns && process.stdout.columns > 0 ? process.stdout.columns : 80;
19
- const trunc = (str, max) => (str.length > max ? str.slice(0, max - 1) + "…" : str);
20
- const rawPrefix = " ‖ ";
21
- const rawModeModel = ` · ${mode} mode · ${model}`;
22
- const rawHint = ` / for commands`;
23
- const fullMax = w - rawPrefix.length - rawModeModel.length - rawHint.length - 3;
24
- let hintStr = c.dim(" / ") + c.dim("for commands");
25
- if (fullMax < ws.length + proj.length) {
26
- hintStr = "";
27
- const noHintMax = w - rawPrefix.length - rawModeModel.length - 3;
28
- if (noHintMax < ws.length + proj.length) {
29
- if (noHintMax > 8) {
30
- const half = Math.floor(noHintMax / 2);
31
- ws = trunc(ws, half);
32
- proj = trunc(proj, noHintMax - ws.length);
33
- }
34
- else {
35
- ws = "";
36
- proj = "";
37
- }
38
- }
39
- }
18
+ // The leading token reflects the CHAT TYPE, so carrier vs standard is obvious:
19
+ // • carrier → "<mode> chat" (e.g. "Carrier OS chat" / "Code chat"), accent
20
+ // • standard → "Standard chat", light purple — a clearly different colour
21
+ const isStandard = ctx.chatType === "standard";
22
+ const label = isStandard ? "Standard" : mode;
23
+ const paintLabel = isStandard ? STANDARD_LABEL : c.accent;
40
24
  const dot = c.dim(" · ");
41
- let context = "";
42
- if (ws || proj) {
43
- context += c.dim(ws) + dot + c.dim(proj) + dot;
44
- }
45
- context += c.accent(mode) + c.dim(" mode") + dot + c.file(model);
46
- const finalStr = " " + c.dim("‖ ") + context + hintStr;
47
- return finalStr;
25
+ const context = paintLabel(label) + c.dim(" chat") + dot + c.file(model);
26
+ return " " + c.dim("‖ ") + context;
48
27
  }
@@ -3,33 +3,26 @@ import { kv, line } from "../services/output.js";
3
3
  import { renderBrandmark } from "../ui/banner.js";
4
4
  import { c } from "../ui/colors.js";
5
5
  import { twoCol } from "../ui/ui.js";
6
- /** First-run welcome shown when no API key is configured — branded. */
6
+ /** First-run welcome shown when there's no session — just the brandmark; the
7
+ * device-login flow prints the "Welcome to Carrier OS" line + guidance. */
7
8
  export function printWelcome() {
8
9
  line();
9
10
  for (const l of renderBrandmark())
10
11
  line(l);
11
12
  line();
12
- line(" " + c.brand("Welcome to Carrier OS"));
13
- line();
14
- line(" No API key configured.");
15
- line();
16
- line(" Paste your Carrier API Secret Key");
17
- line(chalk.dim(" (or type /exit)"));
18
- line();
19
13
  }
20
- /** Confirmation after a successful first-run login. */
21
- export function printAuthSuccess(scope) {
22
- line();
23
- line(`${chalk.green("✓")} ${chalk.bold("Authentication Successful")}`);
24
- line();
25
- if (scope.user)
26
- kv("Developer", scope.user.email);
27
- kv("Workspace", scope.workspace.name);
28
- kv("Project", scope.project.name);
29
- line();
30
- line(chalk.dim(" Configuration saved."));
31
- line();
32
- line(chalk.bold(" Ready."));
14
+ /** The post-login welcome screen (Claude-style boxed header + account summary),
15
+ * shown right before the shell opens. */
16
+ export function renderWelcomeBack(_scope, developerName) {
17
+ const title = "Welcome to Carrier OS";
18
+ const inner = ` ${title} `;
19
+ const rule = "─".repeat(inner.length);
20
+ line();
21
+ line(" " + c.brand("┌" + rule + "┐"));
22
+ line(" " + c.brand("│") + chalk.bold(inner) + c.brand("│"));
23
+ line(" " + c.brand("└" + rule + "┘"));
24
+ line();
25
+ kv("Developer", developerName);
33
26
  line();
34
27
  }
35
28
  export function printShellHelp() {
@@ -1,17 +1,17 @@
1
- import { password } from "@inquirer/prompts";
2
- import { ApiError } from "../services/api.js";
1
+ import readline from "node:readline";
2
+ import { confirm } from "@inquirer/prompts";
3
3
  import { DEFAULT_API_URL } from "../services/config.js";
4
- import { verifyAndSaveKey } from "../services/login-flow.js";
5
- import { errorLine, info, line, warn } from "../services/output.js";
6
- import { withSpinner } from "../services/spinner.js";
4
+ import { deviceLogin, renderLoginFailure } from "../services/login-flow.js";
5
+ import { line } from "../services/output.js";
7
6
  import { renderWelcomeBanner } from "../ui/banner.js";
8
7
  import { renderExit } from "../ui/chat-renderer.js";
9
8
  import { c } from "../ui/colors.js";
10
9
  import { readCommand } from "../ui/command-palette.js";
11
- import { loadModels } from "./shell-chat.js";
10
+ import { startScreen, stopScreen, screenScrollToBottom } from "../ui/screen.js";
11
+ import { loadModels, loadModes } from "./shell-chat.js";
12
12
  import { CARET, buildFooter } from "./shell-prompt.js";
13
13
  import { dispatchLine } from "./shell-router.js";
14
- import { printAuthSuccess, printWelcome } from "./shell-renderer.js";
14
+ import { printWelcome, renderWelcomeBack } from "./shell-renderer.js";
15
15
  /**
16
16
  * The interactive Carrier OS shell — the default experience when you run
17
17
  * `cos` with no command. It sits on top of the existing commands: chat is
@@ -29,8 +29,17 @@ export async function runShell(ctx, program) {
29
29
  return; // user chose /exit or Ctrl+C
30
30
  }
31
31
  const client = ctx.requireAuth();
32
- // Preload the model list so the prompt/banner can show friendly labels.
33
- await loadModels(client).catch(() => []);
32
+ // The interactive shell always OPENS in the Carrier OS mode (the core persona)
33
+ // — Carrier Chat by default, not the last standalone mode. Switch any time with
34
+ // /mode; that applies for the session. The persisted default is left untouched.
35
+ ctx.setSessionMode("general");
36
+ // Preload the mode + model lists so the prompt/banner can show friendly labels
37
+ // (e.g. the "Carrier OS" mode name rather than the raw id).
38
+ await Promise.all([loadModels(client).catch(() => []), loadModes(client).catch(() => [])]);
39
+ // Enter TUI mode: pin the composer to the bottom of the terminal and give the
40
+ // transcript its own scrolling region above it (Claude-style). From here, all
41
+ // output flows into the transcript via the screen engine.
42
+ startScreen();
34
43
  if (returning) {
35
44
  // Branded startup banner (rendered once). Notices can be passed here later —
36
45
  // e.g. renderWelcomeBanner(ctx, { notices: ["Update available: v0.2.0"] }).
@@ -53,6 +62,7 @@ export async function runShell(ctx, program) {
53
62
  // Leaving the shell: restore cooked mode + a visible cursor (the reader keeps
54
63
  // raw mode on for the session), then print the farewell.
55
64
  const leave = () => {
65
+ stopScreen(); // drop the pinned composer + scroll region before the farewell
56
66
  if (process.stdin.isTTY)
57
67
  process.stdin.setRawMode(false);
58
68
  process.stdout.write("\x1b[?25h");
@@ -81,6 +91,8 @@ export async function runShell(ctx, program) {
81
91
  if (!message)
82
92
  continue;
83
93
  history.push(message);
94
+ // Submitting always re-follows the newest output (in case they'd scrolled up).
95
+ screenScrollToBottom();
84
96
  // /new is a friendly alias for /clear. A cleared/new session drops back to
85
97
  // the welcome placeholder; sending a real message starts the conversation
86
98
  // and switches to the compact placeholder.
@@ -101,39 +113,47 @@ export async function runShell(ctx, program) {
101
113
  const WELCOME_PLACEHOLDER = "What can I help you build today?";
102
114
  /** Once the conversation is underway — a compact, unobtrusive prompt. */
103
115
  const COMPACT_PLACEHOLDER = "Ask Carrier OS…";
104
- /** Prompt for and verify a secret key until it succeeds or the user exits. */
116
+ /** Browser-based first-run sign-in (device authorization). Loops so a denied or
117
+ * expired attempt can be retried; returns false if the user declines or Ctrl+C. */
105
118
  async function firstRunLogin(ctx) {
106
119
  printWelcome();
107
120
  const apiUrl = ctx.config.get("apiUrl") ?? DEFAULT_API_URL;
108
121
  for (;;) {
109
- let key;
110
122
  try {
111
- key = (await password({ message: "carrier_sk_…", mask: "•" })).trim();
112
- }
113
- catch {
114
- return false; // Ctrl+C at the prompt
115
- }
116
- if (key === "/exit" || key === "/quit")
117
- return false;
118
- if (!key)
119
- continue;
120
- try {
121
- const scope = await withSpinner("Verifying key…", () => verifyAndSaveKey(ctx, apiUrl, key));
122
- printAuthSuccess(scope);
123
+ const scope = await deviceLogin(ctx, apiUrl);
124
+ const developer = ctx.config.get("auth")?.account?.name || scope.user?.email || "Developer";
125
+ // Claude-style two-step landing: confirm success, then a welcome screen,
126
+ // then into the shell — each gated by Enter.
127
+ line();
128
+ await pressEnter("Login successful. Press Enter to continue…");
129
+ renderWelcomeBack(scope, developer);
130
+ await pressEnter("Press Enter to start Carrier Chat…");
123
131
  return true;
124
132
  }
125
133
  catch (err) {
126
- if (err instanceof ApiError) {
127
- errorLine(`${err.message} (${err.code})`);
128
- if (err.code === "NETWORK_ERROR" || err.code.startsWith("HTTP_")) {
129
- warn(`Endpoint: ${apiUrl}`);
130
- info("Set a different endpoint with: cos login --url http://localhost:5000/v1");
131
- }
134
+ renderLoginFailure(err, apiUrl);
135
+ line();
136
+ let again;
137
+ try {
138
+ again = await confirm({ message: "Try again?", default: true });
132
139
  }
133
- else {
134
- errorLine(err.message);
140
+ catch {
141
+ return false; // Ctrl+C at the prompt
135
142
  }
136
- // Stay in the loop and let the user try again.
143
+ if (!again)
144
+ return false;
137
145
  }
138
146
  }
139
147
  }
148
+ /** Print a dim prompt and resolve when the user presses Enter. Used for the
149
+ * Claude-style "Press Enter to continue…" gates before the shell starts (raw
150
+ * TUI mode is not active yet, so a line-mode readline is correct here). */
151
+ function pressEnter(prompt) {
152
+ return new Promise((resolve) => {
153
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
154
+ rl.question(" " + c.dim(prompt) + " ", () => {
155
+ rl.close();
156
+ resolve();
157
+ });
158
+ });
159
+ }
package/dist/ui/banner.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import chalk from "chalk";
2
- import { capitalize } from "../services/output.js";
3
- import { modelLabelShort } from "../shell/shell-chat.js";
2
+ import { line } from "../services/output.js";
3
+ import { modeLabelShort, modelLabelShort } from "../shell/shell-chat.js";
4
4
  import { c } from "./colors.js";
5
5
  import { WORDMARK } from "./logo.js";
6
- import { accentHex } from "./theme.js";
6
+ import { BRAND_HEX } from "./theme.js";
7
7
  const MARGIN = " ";
8
8
  const LABEL_WIDTH = 13;
9
9
  /** Visible width of a block of lines. */
@@ -25,10 +25,11 @@ function lerpHex(a, b, t) {
25
25
  const mix = (x, y) => Math.round(x + (y - x) * t);
26
26
  return "#" + [mix(ar, br), mix(ag, bg), mix(ab, bb)].map((v) => v.toString(16).padStart(2, "0")).join("");
27
27
  }
28
- /** Color the wordmark with a gentle left→right gradient from the accent to a
29
- * lighter tint of it (spaces left untouched). Re-reads the live accent. */
28
+ /** Color the wordmark with a gentle left→right gradient from the fixed brand
29
+ * green to a lighter tint of it (spaces left untouched). The wordmark is
30
+ * branding, so it stays green and does NOT follow the runtime /color accent. */
30
31
  function gradientWordmark(lines) {
31
- const from = accentHex();
32
+ const from = BRAND_HEX;
32
33
  const to = lerpHex(from, "#ffffff", 0.5); // lighten toward white on the right
33
34
  const maxW = Math.max(1, ...lines.map((l) => [...l].length));
34
35
  return lines.map((line) => [...line].map((ch, i) => (ch === " " ? ch : chalk.hex(lerpHex(from, to, i / maxW))(ch))).join(""));
@@ -40,7 +41,7 @@ function gradientWordmark(lines) {
40
41
  */
41
42
  export function renderBrandmark() {
42
43
  if (isNarrow()) {
43
- return [MARGIN + c.brand("Carrier OS") + " " + c.subtitle("CLI")];
44
+ return [MARGIN + c.brandFixed("Carrier OS") + " " + c.subtitle("CLI")];
44
45
  }
45
46
  return gradientWordmark(WORDMARK.split("\n")).map((l) => MARGIN + l);
46
47
  }
@@ -49,11 +50,8 @@ function kvLine(label, value) {
49
50
  }
50
51
  export function renderWelcomeBanner(ctx, opts = {}) {
51
52
  try {
52
- const scope = ctx.config.get("scope");
53
53
  const out = ["", ...renderBrandmark(), ""];
54
- out.push(kvLine("Workspace", scope?.workspace.name ?? "—"));
55
- out.push(kvLine("Project", scope?.project.name ?? "—"));
56
- out.push(kvLine("Mode", capitalize(ctx.mode)));
54
+ out.push(kvLine("Mode", modeLabelShort(ctx)));
57
55
  out.push(kvLine("Model", modelLabelShort(ctx)));
58
56
  out.push("");
59
57
  for (const n of opts.notices ?? [])
@@ -61,10 +59,15 @@ export function renderWelcomeBanner(ctx, opts = {}) {
61
59
  if (opts.notices?.length)
62
60
  out.push("");
63
61
  out.push(MARGIN + c.hint("Type ") + c.key("/help") + c.hint(" for available commands."));
64
- process.stdout.write(out.join("\n") + "\n");
62
+ // Emit through `line()` so, in the interactive shell, the banner lands in the
63
+ // transcript region above the pinned composer (not written over it).
64
+ for (const l of out)
65
+ line(l);
65
66
  }
66
67
  catch {
67
68
  // The banner must never break startup — degrade to a bare header.
68
- process.stdout.write(`\n ${c.wordmark("Carrier OS")} ${c.subtitle("CLI")}\n\n`);
69
+ line();
70
+ line(` ${c.wordmark("Carrier OS")} ${c.subtitle("CLI")}`);
71
+ line();
69
72
  }
70
73
  }
@@ -143,20 +143,22 @@ function wordStops(styled) {
143
143
  return stops;
144
144
  }
145
145
  const CURSOR = "▋"; // streaming caret shown at the end of the in-progress line
146
+ /** Claude-style lead-in for an assistant reply: a soft theme-light dot before the
147
+ * first line, with continuation lines indented to align under the text. */
148
+ const LEAD = (i) => (i === 0 ? c.accentLight("●") + " " : " ");
146
149
  /** Stream the answer above a PINNED input bar via a scroll region (flicker-free):
147
- * a "Carrier" header once, then each line revealed word-by-word on the bottom
148
- * content row (with the streaming cursor) before scrolling up to the next. */
150
+ * led by a neutral dot, each line revealed word-by-word on the bottom content
151
+ * row (with the streaming cursor) before scrolling up to the next. */
149
152
  export async function streamAssistantSticky(sticky, text) {
150
153
  const md = renderMarkdown(text);
151
154
  while (md.length && md[0].trim() === "")
152
155
  md.shift();
153
156
  while (md.length && md[md.length - 1].trim() === "")
154
157
  md.pop();
155
- sticky.scroll();
156
- sticky.setLine(MARGIN + c.brand.bold("Carrier")); // response header, once
157
- for (const raw of md) {
158
+ for (let i = 0; i < md.length; i++) {
158
159
  sticky.scroll();
159
- const full = MARGIN + raw;
160
+ const raw = md[i];
161
+ const full = MARGIN + LEAD(i) + raw;
160
162
  if (raw.trim()) {
161
163
  for (const n of wordStops(full)) {
162
164
  sticky.setLine(ansiSlice(full, n) + c.dim(CURSOR));
@@ -173,19 +175,19 @@ export function renderCompleteSticky(sticky, seconds) {
173
175
  sticky.setLine(MARGIN + c.dim(`● ${completionLabel(seconds)}`));
174
176
  sticky.scroll();
175
177
  }
176
- /** Stream the assistant's answer above the pinned bar, led once by a "Carrier"
177
- * header, word by word with a streaming cursor. Each in-progress line lives in
178
- * the transient status region (so the cursor can trail it) and is promoted to
179
- * permanent once fully revealed. */
178
+ /** Stream the assistant's answer above the pinned bar, led by a neutral dot
179
+ * (Claude-style), word by word with a streaming cursor. Each in-progress line
180
+ * lives in the transient status region (so the cursor can trail it) and is
181
+ * promoted to permanent once fully revealed. */
180
182
  export async function streamAssistantLive(live, text) {
181
183
  const md = renderMarkdown(text);
182
184
  while (md.length && md[0].trim() === "")
183
185
  md.shift();
184
186
  while (md.length && md[md.length - 1].trim() === "")
185
187
  md.pop();
186
- live.commit([MARGIN + c.brand.bold("Carrier")]); // response header, once
187
188
  for (let i = 0; i < md.length; i++) {
188
- const full = MARGIN + md[i];
189
+ // No name header — the reply is led by a neutral dot (Claude-style).
190
+ const full = MARGIN + LEAD(i) + md[i];
189
191
  if (md[i].trim()) {
190
192
  for (const n of wordStops(full)) {
191
193
  live.setStatus([ansiSlice(full, n) + c.dim(CURSOR)]);
@@ -209,8 +211,8 @@ export function renderErrorLive(live, title, detail, hintCmd) {
209
211
  out.push("");
210
212
  live.commit(out);
211
213
  }
212
- /** Stream the assistant's answer led once by a "Carrier" header, word by word
213
- * with a streaming cursor in a TTY (in-place line rewrite); plain when piped. */
214
+ /** Stream the assistant's answer led by a neutral dot (Claude-style), word by
215
+ * word with a streaming cursor in a TTY (in-place line rewrite); plain when piped. */
214
216
  export async function streamAssistant(text) {
215
217
  const md = renderMarkdown(text);
216
218
  while (md.length && md[0].trim() === "")
@@ -220,9 +222,8 @@ export async function streamAssistant(text) {
220
222
  const tty = process.stdout.isTTY;
221
223
  if (tty)
222
224
  process.stdout.write("\x1b[?25l"); // hide the caret; ▋ is the cursor
223
- line(MARGIN + c.brand.bold("Carrier"));
224
225
  for (let i = 0; i < md.length; i++) {
225
- const full = MARGIN + md[i];
226
+ const full = MARGIN + LEAD(i) + md[i];
226
227
  if (tty && md[i].trim()) {
227
228
  for (const n of wordStops(full)) {
228
229
  process.stdout.write("\r\x1b[K" + ansiSlice(full, n) + c.dim(CURSOR));
@@ -1,6 +1,7 @@
1
1
  import * as readline from "node:readline";
2
2
  import chalk from "chalk";
3
3
  import { c } from "./colors.js";
4
+ import { resumeScreen, screenActive, suspendScreen } from "./screen.js";
4
5
  import { THEME_ORDER, accentHex, accentName, setAccent } from "./theme.js";
5
6
  /**
6
7
  * Claude-style inline /color selector. Renders on a single line:
@@ -13,6 +14,19 @@ import { THEME_ORDER, accentHex, accentName, setAccent } from "./theme.js";
13
14
  *
14
15
  * Resolves the chosen color, or null on cancel.
15
16
  */
17
+ /**
18
+ * Claude-style confirmation printed after the accent changes: a filled swatch
19
+ * in the new color, dim body text, and the color name shown in that very color
20
+ * so the change is visible, not just described.
21
+ *
22
+ * ● Accent color set to green
23
+ */
24
+ export function confirmColor(name) {
25
+ const hex = accentHex(name);
26
+ const swatch = chalk.hex(hex)("●");
27
+ const label = chalk.hex(hex).bold(name);
28
+ process.stdout.write(`\n ${swatch} ${chalk.dim("Accent color set to")} ${label}\n\n`);
29
+ }
16
30
  export function pickColor() {
17
31
  const stdin = process.stdin;
18
32
  const stdout = process.stdout;
@@ -22,6 +36,11 @@ export function pickColor() {
22
36
  const original = accentName();
23
37
  let sel = Math.max(0, options.indexOf(original));
24
38
  return new Promise((resolve) => {
39
+ // Suspend the persistent-composer engine so the inline selector owns its
40
+ // line, then repaint the transcript + composer once a color is chosen.
41
+ const suspended = screenActive();
42
+ if (suspended)
43
+ suspendScreen();
25
44
  stdin.removeAllListeners("keypress");
26
45
  readline.emitKeypressEvents(stdin);
27
46
  if (!stdin.isRaw)
@@ -46,6 +65,8 @@ export function pickColor() {
46
65
  readline.clearLine(stdout, 0);
47
66
  stdout.write("\x1b[?25h");
48
67
  stdin.removeListener("keypress", onKey);
68
+ if (suspended)
69
+ resumeScreen(); // repaint the pinned composer + transcript
49
70
  resolve(result);
50
71
  };
51
72
  const onKey = (_s, key) => {
package/dist/ui/colors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import chalk from "chalk";
2
- import { accentHex } from "./theme.js";
2
+ import { accentHex, accentLightHex, BRAND_HEX } from "./theme.js";
3
3
  /**
4
4
  * Carrier OS design system — the single source of truth for color. Every piece
5
5
  * of CLI output pulls from here, so the whole tool stays consistent. All color
@@ -18,6 +18,10 @@ export const c = {
18
18
  get neural() {
19
19
  return chalk.hex(accentHex());
20
20
  },
21
+ get accentLight() {
22
+ return chalk.hex(accentLightHex());
23
+ }, // soft, light tint of the accent (assistant lead dot)
24
+ brandFixed: chalk.hex(BRAND_HEX), // fixed brand green — wordmark + prompt marker, never follows /color
21
25
  wordmark: chalk.whiteBright.bold, // CARRIER block logo (never recolored)
22
26
  // Text
23
27
  title: chalk.whiteBright.bold, // section titles / headings
@@ -40,10 +40,13 @@ export function filterCommands(query) {
40
40
  * clean prefix of any command (fuzzy-only matches don't ghost).
41
41
  */
42
42
  export function ghostCompletion(query) {
43
- // Complete a color value after `/color `.
43
+ // Complete a color value after `/color <partial>`. With nothing typed yet the
44
+ // bracketed argHint() is shown instead, so don't ghost a single value there.
44
45
  const color = query.match(/^\/(?:color|theme)\s+(\w*)$/i);
45
46
  if (color) {
46
47
  const p = color[1].toLowerCase();
48
+ if (!p)
49
+ return "";
47
50
  const match = THEME_ORDER.find((n) => n.startsWith(p) && n.length > p.length);
48
51
  return match ? match.slice(p.length) : "";
49
52
  }
@@ -55,3 +58,14 @@ export function ghostCompletion(query) {
55
58
  return "";
56
59
  return matches[0].name.slice(query.length);
57
60
  }
61
+ /**
62
+ * Claude-style inline argument hint: when a command expects a value but none is
63
+ * typed yet, show the options in-line as a dim `[a|b|c]` placeholder — e.g.
64
+ * `/color ` → `[red|blue|green|…]`. Purely a hint (never accepted by Tab). Empty
65
+ * once a value is being typed, or when the command takes no listed options.
66
+ */
67
+ export function argHint(query) {
68
+ if (/^\/(?:color|theme)\s+$/i.test(query))
69
+ return `[${THEME_ORDER.join("|")}]`;
70
+ return "";
71
+ }