@sns-myagent/cli 0.3.4 → 0.3.6
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/package.json +6 -4
- package/scripts/smoke-tui.ts +110 -0
- package/src/cli/agents-cli.ts +1 -1
- package/src/cli/commands/init-xdg.ts +1 -1
- package/src/cli/profile-alias.ts +6 -6
- package/src/cli/ssh-cli.ts +7 -7
- package/src/commands/read.ts +1 -1
- package/src/config/settings-schema.ts +1 -1
- package/src/config/settings.ts +1 -1
- package/src/dap/session.ts +2 -2
- package/src/hindsight/bank.ts +1 -1
- package/src/hindsight/config.ts +1 -1
- package/src/internal-urls/docs-index.ts +1 -1
- package/src/internal-urls/index.ts +1 -1
- package/src/internal-urls/local-protocol.ts +2 -2
- package/src/internal-urls/router.ts +3 -3
- package/src/internal-urls/{omp-protocol.ts → snsagent-protocol.ts} +12 -12
- package/src/internal-urls/types.ts +1 -1
- package/src/modes/acp/acp-agent.ts +1 -1
- package/src/modes/components/welcome.ts +9 -7
- package/src/modes/internal-url-autocomplete.ts +1 -1
- package/src/modes/setup-wizard/scenes/splash.ts +1 -1
- package/src/task/omp-command.ts +1 -1
- package/src/tools/image-gen.ts +1 -1
- package/src/tools/read.ts +2 -2
- package/src/tools/report-tool-issue.ts +1 -1
- package/src/tools/search.ts +4 -4
- package/src/tui/chat-blocks.ts +117 -174
- package/src/tui/code-cell.ts +9 -9
- package/src/tui/command-palette.ts +62 -175
- package/src/tui/hyperlink.ts +1 -1
- package/src/tui/index.ts +1 -1
- package/src/tui/splash.ts +67 -111
- package/src/ui/banner.ts +1 -1
- package/src/ui/error-display.ts +67 -103
- package/src/ui/gradient.ts +15 -95
- package/src/ui/index.ts +3 -9
- package/src/ui/memory-toast.ts +51 -77
- package/src/ui/status-bar.ts +26 -47
- package/src/web/scrapers/crates-io.ts +1 -1
- package/src/web/scrapers/docs-rs.ts +1 -1
- package/src/web/scrapers/github.ts +1 -1
- package/src/web/search/providers/codex.ts +2 -2
package/src/tui/index.ts
CHANGED
|
@@ -14,4 +14,4 @@ export * from "./width-aware-text";
|
|
|
14
14
|
export * from "./splash";
|
|
15
15
|
export * from "./chat-blocks";
|
|
16
16
|
export * from "./chat-ui";
|
|
17
|
-
export { renderCommandPalette,
|
|
17
|
+
export { renderCommandPalette, CHAT_COMMANDS, type PaletteCommand, type CommandPaletteOptions } from "./command-palette";
|
package/src/tui/splash.ts
CHANGED
|
@@ -1,130 +1,86 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SNS-MyAgent splash
|
|
3
|
-
*
|
|
2
|
+
* SNS-MyAgent splash — minimal banner + info block.
|
|
3
|
+
* Single accent (cyan) for brand, default terminal text everywhere else.
|
|
4
4
|
*/
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
-
import gradient from "gradient-string";
|
|
7
|
-
import boxen from "boxen";
|
|
8
6
|
import { readFileSync } from "node:fs";
|
|
9
7
|
import { dirname, resolve } from "node:path";
|
|
10
8
|
import { fileURLToPath } from "node:url";
|
|
11
9
|
|
|
12
|
-
const
|
|
13
|
-
███╗ ██╗███████╗██╗ ██╗██╗ ██╗███████╗
|
|
14
|
-
████╗ ██║██╔════╝╚██╗██╔╝██║ ██║██╔════╝
|
|
15
|
-
██╔██╗ ██║█████╗ ╚███╔╝ ██║ ██║███████╗
|
|
16
|
-
██║╚██╗██║██╔══╝ ██╔██╗ ██║ ██║╚════██║
|
|
17
|
-
██║ ╚████║███████╗██╔╝ ╚██╗╚██████╔╝███████║
|
|
18
|
-
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝`;
|
|
19
|
-
|
|
20
|
-
const SUBTITLE = "My-Agent • SnsCoder CLI";
|
|
21
|
-
|
|
22
|
-
const SNY_GRADIENT = ["#00d2ff", "#7b2ff7", "#ff6b9d"];
|
|
23
|
-
const ACCENT_GRADIENT = ["#7b2ff7", "#00d2ff"];
|
|
10
|
+
const SUBTITLE = "snsagent — coding agent CLI";
|
|
24
11
|
|
|
25
12
|
function readVersion(): string {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return "0.0.0";
|
|
57
|
-
} catch {
|
|
58
|
-
return "0.0.0";
|
|
59
|
-
}
|
|
13
|
+
try {
|
|
14
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const candidates = [
|
|
16
|
+
resolve(here, "..", "..", "package.json"),
|
|
17
|
+
resolve(here, "..", "package.json"),
|
|
18
|
+
resolve(here, "..", "..", "dist", "package.json"),
|
|
19
|
+
];
|
|
20
|
+
for (const pkgPath of candidates) {
|
|
21
|
+
try {
|
|
22
|
+
const raw = readFileSync(pkgPath, "utf8");
|
|
23
|
+
const pkg = JSON.parse(raw) as { version?: string };
|
|
24
|
+
if (pkg.version && pkg.version !== "0.0.0") return pkg.version;
|
|
25
|
+
} catch {}
|
|
26
|
+
}
|
|
27
|
+
let dir = process.cwd();
|
|
28
|
+
for (let i = 0; i < 5; i++) {
|
|
29
|
+
try {
|
|
30
|
+
const raw = readFileSync(resolve(dir, "package.json"), "utf8");
|
|
31
|
+
const pkg = JSON.parse(raw) as { name?: string; version?: string };
|
|
32
|
+
if (pkg.name === "@sns-myagent/cli" && pkg.version) return pkg.version;
|
|
33
|
+
} catch {}
|
|
34
|
+
const parent = dirname(dir);
|
|
35
|
+
if (parent === dir) break;
|
|
36
|
+
dir = parent;
|
|
37
|
+
}
|
|
38
|
+
return "0.0.0";
|
|
39
|
+
} catch {
|
|
40
|
+
return "0.0.0";
|
|
41
|
+
}
|
|
60
42
|
}
|
|
61
43
|
|
|
62
44
|
export interface SplashInfo {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function makeInfoBlocks(info: SplashInfo, width: number): string {
|
|
71
|
-
const inner = Math.min(width - 4, 56);
|
|
72
|
-
const sep = chalk.dim("─".repeat(inner));
|
|
73
|
-
|
|
74
|
-
const rows: string[] = [];
|
|
75
|
-
const kv = (k: string, v: string) =>
|
|
76
|
-
` ${chalk.dim(k.padEnd(12))}${chalk.white(v)}`;
|
|
77
|
-
|
|
78
|
-
rows.push(sep);
|
|
79
|
-
if (info.model) rows.push(kv("Model", `${info.provider ?? "unknown"}/${info.model}`));
|
|
80
|
-
if (info.cwd) rows.push(kv("Working Dir", info.cwd));
|
|
81
|
-
if (info.platform) rows.push(kv("Platform", info.platform));
|
|
82
|
-
rows.push(kv("Version", readVersion()));
|
|
83
|
-
rows.push(sep);
|
|
84
|
-
|
|
85
|
-
const hint = chalk.dim(" Type your message to start chatting.");
|
|
86
|
-
const exit = chalk.dim(" /exit or Ctrl+C to quit.");
|
|
87
|
-
rows.push(hint);
|
|
88
|
-
rows.push(exit);
|
|
89
|
-
|
|
90
|
-
return rows.join("\n");
|
|
45
|
+
model?: string;
|
|
46
|
+
provider?: string;
|
|
47
|
+
cwd?: string;
|
|
48
|
+
platform?: string;
|
|
49
|
+
nodeVersion?: string;
|
|
91
50
|
}
|
|
92
51
|
|
|
93
52
|
export function renderSplash(info: SplashInfo = {}): string {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
return box;
|
|
53
|
+
const cols = process.stdout.columns ?? 80;
|
|
54
|
+
const width = Math.min(cols - 4, 72);
|
|
55
|
+
|
|
56
|
+
// Single brand mark, no rainbow
|
|
57
|
+
const brandLine = `\n ${chalk.cyan.bold("MY")} ${chalk.bold("snsagent")} ${chalk.dim(`v${readVersion()}`)}\n`;
|
|
58
|
+
const subLine = ` ${chalk.dim(SUBTITLE)}\n`;
|
|
59
|
+
|
|
60
|
+
// Separator
|
|
61
|
+
const sep = chalk.dim("─".repeat(Math.min(width - 4, 60)));
|
|
62
|
+
|
|
63
|
+
// Info rows: key dim, value default
|
|
64
|
+
const rows: string[] = [sep];
|
|
65
|
+
const kv = (k: string, v: string) =>
|
|
66
|
+
` ${chalk.dim(k.padEnd(12))}${v}`;
|
|
67
|
+
if (info.model) rows.push(kv("Model", `${info.provider ?? "unknown"}/${info.model}`));
|
|
68
|
+
if (info.cwd) rows.push(kv("Working Dir", info.cwd));
|
|
69
|
+
if (info.platform) rows.push(kv("Platform", info.platform));
|
|
70
|
+
rows.push(kv("Version", readVersion()));
|
|
71
|
+
rows.push(sep);
|
|
72
|
+
|
|
73
|
+
// Hints
|
|
74
|
+
rows.push(` ${chalk.dim("Type your message to start chatting.")}`);
|
|
75
|
+
rows.push(` ${chalk.dim("/exit or Ctrl+C to quit.")}`);
|
|
76
|
+
|
|
77
|
+
return brandLine + subLine + "\n" + rows.join("\n") + "\n";
|
|
122
78
|
}
|
|
123
79
|
|
|
124
80
|
export function renderInlineHeader(info: SplashInfo = {}): string {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
81
|
+
const model = info.model
|
|
82
|
+
? chalk.cyan(`${info.provider ?? "?"}/${info.model}`)
|
|
83
|
+
: chalk.dim("no model");
|
|
84
|
+
const ver = chalk.dim(`v${readVersion()}`);
|
|
85
|
+
return `\n ${chalk.cyan.bold("MY")} ${chalk.bold("snsagent")} ${ver} ${chalk.dim("│")} ${model}\n`;
|
|
130
86
|
}
|
package/src/ui/banner.ts
CHANGED
|
@@ -20,7 +20,7 @@ const LOGO = `
|
|
|
20
20
|
██║ ╚████║███████╗██╔╝ ╚██╗╚██████╔╝███████║
|
|
21
21
|
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝`;
|
|
22
22
|
|
|
23
|
-
const SUBTITLE = "My-Agent •
|
|
23
|
+
const SUBTITLE = "My-Agent • SnsAgent CLI";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Show the premium banner with gradient logo + config info.
|
package/src/ui/error-display.ts
CHANGED
|
@@ -1,130 +1,94 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Supports error hierarchy: main error + optional cause chain.
|
|
2
|
+
* Error display — minimal, single accent, no gradient.
|
|
3
|
+
* Severity controls the icon color (red/yellow/cyan) but everything else
|
|
4
|
+
* stays dim + default text.
|
|
6
5
|
*/
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
import gradient from "gradient-string";
|
|
9
|
-
import boxen from "boxen";
|
|
10
|
-
import { BRAND_GRADIENT, ROLE_HEX } from "./colors.js";
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
const WARN_GRADIENT = ["#ffd700", "#ff8c00"] as const;
|
|
7
|
+
import chalk from "chalk";
|
|
14
8
|
|
|
15
9
|
export type ErrorSeverity = "error" | "warning" | "info";
|
|
16
10
|
|
|
17
11
|
export interface ErrorDisplayOptions {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
severity?: ErrorSeverity;
|
|
26
|
-
/** Stack trace (shown collapsed). */
|
|
27
|
-
stack?: string;
|
|
28
|
-
/** Suggestion for fixing the error. */
|
|
29
|
-
suggestion?: string;
|
|
30
|
-
/** Additional context lines. */
|
|
31
|
-
context?: string[];
|
|
12
|
+
title: string;
|
|
13
|
+
message: string;
|
|
14
|
+
code?: string;
|
|
15
|
+
severity?: ErrorSeverity;
|
|
16
|
+
stack?: string;
|
|
17
|
+
suggestion?: string;
|
|
18
|
+
context?: string[];
|
|
32
19
|
}
|
|
33
20
|
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
function getSeverityMeta(severity: ErrorSeverity) {
|
|
22
|
+
switch (severity) {
|
|
23
|
+
case "error":
|
|
24
|
+
return { icon: "✗", label: "ERROR", color: chalk.red.bold };
|
|
25
|
+
case "warning":
|
|
26
|
+
return { icon: "⚠", label: "WARNING", color: chalk.yellow.bold };
|
|
27
|
+
case "info":
|
|
28
|
+
return { icon: "ℹ", label: "INFO", color: chalk.cyan.bold };
|
|
29
|
+
}
|
|
43
30
|
}
|
|
44
31
|
|
|
45
|
-
/**
|
|
46
|
-
* Render an error display block.
|
|
47
|
-
*/
|
|
48
32
|
export function renderErrorDisplay(opts: ErrorDisplayOptions): string {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const width = Math.min(cols - 2, 72);
|
|
33
|
+
const severity = opts.severity ?? "error";
|
|
34
|
+
const meta = getSeverityMeta(severity);
|
|
35
|
+
const cols = process.stdout.columns ?? 80;
|
|
36
|
+
const width = Math.min(cols - 2, 72);
|
|
54
37
|
|
|
55
|
-
|
|
38
|
+
const border = "─".repeat(width - 2);
|
|
56
39
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
? chalk.red.bold(colors.icon)
|
|
60
|
-
: severity === "warning"
|
|
61
|
-
? chalk.yellow.bold(colors.icon)
|
|
62
|
-
: chalk.cyan(colors.icon);
|
|
63
|
-
const headerLabel = grad(` ${colors.label} `);
|
|
64
|
-
const codeStr = opts.code ? chalk.dim(` [${opts.code}]`) : "";
|
|
65
|
-
lines.push(`${headerIcon} ${headerLabel}${codeStr}`);
|
|
40
|
+
const lines: string[] = [];
|
|
41
|
+
lines.push(chalk.dim(border));
|
|
66
42
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
43
|
+
// Header
|
|
44
|
+
const codeStr = opts.code ? chalk.dim(` [${opts.code}]`) : "";
|
|
45
|
+
lines.push(`${meta.color(meta.icon)} ${meta.color(meta.label)}${codeStr}`);
|
|
46
|
+
lines.push("");
|
|
47
|
+
lines.push(chalk.bold(opts.title));
|
|
48
|
+
lines.push("");
|
|
70
49
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
lines.push(chalk.white(line));
|
|
76
|
-
}
|
|
50
|
+
// Message
|
|
51
|
+
for (const line of opts.message.split("\n")) {
|
|
52
|
+
lines.push(line);
|
|
53
|
+
}
|
|
77
54
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
55
|
+
// Context
|
|
56
|
+
if (opts.context && opts.context.length > 0) {
|
|
57
|
+
lines.push("");
|
|
58
|
+
lines.push(chalk.dim("Context:"));
|
|
59
|
+
for (const ctx of opts.context.slice(0, 5)) {
|
|
60
|
+
lines.push(chalk.dim(` ${ctx}`));
|
|
61
|
+
}
|
|
62
|
+
if (opts.context.length > 5) {
|
|
63
|
+
lines.push(chalk.dim(` ... +${opts.context.length - 5} more`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
89
66
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
// Suggestion
|
|
68
|
+
if (opts.suggestion) {
|
|
69
|
+
lines.push("");
|
|
70
|
+
lines.push(`${chalk.cyan("→")} ${chalk.bold("Suggestion:")}`);
|
|
71
|
+
lines.push(` ${opts.suggestion}`);
|
|
72
|
+
}
|
|
96
73
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
74
|
+
// Stack preview
|
|
75
|
+
if (opts.stack) {
|
|
76
|
+
lines.push("");
|
|
77
|
+
const stackLines = opts.stack.split("\n").slice(0, 3);
|
|
78
|
+
lines.push(chalk.dim("Stack (first 3):"));
|
|
79
|
+
for (const sl of stackLines) {
|
|
80
|
+
lines.push(chalk.dim(` ${sl.trim()}`));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
106
83
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return boxen(content, {
|
|
110
|
-
padding: { top: 1, bottom: 1, left: 2, right: 2 },
|
|
111
|
-
margin: { top: 0, bottom: 1, left: 0, right: 0 },
|
|
112
|
-
borderStyle: "round",
|
|
113
|
-
borderColor: colors.border,
|
|
114
|
-
width,
|
|
115
|
-
});
|
|
84
|
+
lines.push(chalk.dim(border));
|
|
85
|
+
return lines.join("\n");
|
|
116
86
|
}
|
|
117
87
|
|
|
118
|
-
/**
|
|
119
|
-
* Quick error render — wraps a simple error message in a styled block.
|
|
120
|
-
*/
|
|
121
88
|
export function renderQuickError(title: string, message: string): string {
|
|
122
|
-
|
|
89
|
+
return renderErrorDisplay({ title, message, severity: "error" });
|
|
123
90
|
}
|
|
124
91
|
|
|
125
|
-
/**
|
|
126
|
-
* Render a warning display.
|
|
127
|
-
*/
|
|
128
92
|
export function renderWarning(title: string, message: string, suggestion?: string): string {
|
|
129
|
-
|
|
93
|
+
return renderErrorDisplay({ title, message, severity: "warning", suggestion });
|
|
130
94
|
}
|
package/src/ui/gradient.ts
CHANGED
|
@@ -1,104 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Minimal palette for SNS-MyAgent TUI.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* One accent color (cyan) for prompts and brand. Everything else uses
|
|
5
|
+
* terminal defaults + chalk.dim for secondary text. No gradients, no
|
|
6
|
+
* 4-role color explosion — the terminal is for reading, not for show.
|
|
6
7
|
*/
|
|
7
|
-
import gradient from "gradient-string";
|
|
8
|
-
import chalk from "chalk";
|
|
9
|
-
import { BRAND_GRADIENT, ACCENT_GRADIENT, SUBTLE_GRADIENT, ROLE_HEX } from "./colors.js";
|
|
10
|
-
|
|
11
|
-
// ── Pre-built gradient instances ──
|
|
12
|
-
|
|
13
|
-
/** Full brand gradient: cyan → purple → pink. */
|
|
14
|
-
export const brandGradient: (text: string) => string = gradient(BRAND_GRADIENT);
|
|
15
|
-
|
|
16
|
-
/** Accent gradient: purple → cyan. */
|
|
17
|
-
export const accentGradient: (text: string) => string = gradient(ACCENT_GRADIENT);
|
|
18
|
-
|
|
19
|
-
/** Subtle gradient: cyan → purple. */
|
|
20
|
-
export const subtleGradient: (text: string) => string = gradient(SUBTLE_GRADIENT);
|
|
21
|
-
|
|
22
|
-
// ── Gradient functions ──
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Apply brand gradient to text.
|
|
26
|
-
*/
|
|
27
|
-
export function brand(text: string): string {
|
|
28
|
-
return brandGradient(text);
|
|
29
|
-
}
|
|
30
8
|
|
|
31
|
-
|
|
32
|
-
* Apply accent gradient to text.
|
|
33
|
-
*/
|
|
34
|
-
export function accentGrad(text: string): string {
|
|
35
|
-
return accentGradient(text);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Apply subtle gradient to text.
|
|
40
|
-
*/
|
|
41
|
-
export function subtle(text: string): string {
|
|
42
|
-
return subtleGradient(text);
|
|
43
|
-
}
|
|
9
|
+
import chalk from "chalk";
|
|
44
10
|
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
*/
|
|
48
|
-
export function gradientLine(width: number): string {
|
|
49
|
-
const line = "─".repeat(width);
|
|
50
|
-
return brandGradient(line);
|
|
51
|
-
}
|
|
11
|
+
/** Single accent for prompts, brand, and focus. */
|
|
12
|
+
export const accent = chalk.cyan;
|
|
52
13
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
*/
|
|
56
|
-
export function labeledGradientLine(label: string, width: number): string {
|
|
57
|
-
const labelLen = label.length + 4; // 2 spaces each side
|
|
58
|
-
const sideLen = Math.max(0, Math.floor((width - labelLen) / 2));
|
|
59
|
-
const left = "─".repeat(sideLen);
|
|
60
|
-
const right = "─".repeat(width - sideLen - labelLen);
|
|
61
|
-
return brandGradient(left) + chalk.dim(` ${label} `) + brandGradient(right);
|
|
62
|
-
}
|
|
14
|
+
/** Brand text — bold cyan, no rainbow. */
|
|
15
|
+
export const brand = (s: string) => chalk.cyan.bold(s);
|
|
63
16
|
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
*/
|
|
67
|
-
export function roleGradient(role: keyof typeof ROLE_HEX): (text: string) => string {
|
|
68
|
-
const hex = ROLE_HEX[role];
|
|
69
|
-
const darker = adjustBrightness(hex, -30);
|
|
70
|
-
return gradient([hex, darker]);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Create a gradient for status indicators.
|
|
75
|
-
*/
|
|
76
|
-
export function statusGradient(status: "success" | "warning" | "error" | "info"): (text: string) => string {
|
|
77
|
-
switch (status) {
|
|
78
|
-
case "success":
|
|
79
|
-
return gradient(["#00d2ff", "#00ff88"]);
|
|
80
|
-
case "warning":
|
|
81
|
-
return gradient(["#ffd700", "#ff8c00"]);
|
|
82
|
-
case "error":
|
|
83
|
-
return gradient(["#ff4444", "#cc0000"]);
|
|
84
|
-
case "info":
|
|
85
|
-
return gradient(["#00d2ff", "#7b2ff7"]);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Render text with a gradient background (using chalk bg).
|
|
91
|
-
*/
|
|
92
|
-
export function gradientBg(text: string, hex: string): string {
|
|
93
|
-
return chalk.bgHex(hex)(text);
|
|
94
|
-
}
|
|
17
|
+
/** Subtle / dimmed text. */
|
|
18
|
+
export const subtle = chalk.dim;
|
|
95
19
|
|
|
96
|
-
|
|
20
|
+
/** Stronger emphasis than subtle. */
|
|
21
|
+
export const muted = chalk.gray;
|
|
97
22
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const r = Math.min(255, Math.max(0, ((num >> 16) & 0xff) + amount));
|
|
101
|
-
const g = Math.min(255, Math.max(0, ((num >> 8) & 0xff) + amount));
|
|
102
|
-
const b = Math.min(255, Math.max(0, (num & 0xff) + amount));
|
|
103
|
-
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, "0")}`;
|
|
104
|
-
}
|
|
23
|
+
/** Accent for inline emphasis (e.g. file paths, ids). */
|
|
24
|
+
export const inline = chalk.cyan;
|
package/src/ui/index.ts
CHANGED
|
@@ -5,17 +5,11 @@ export { createSpinner } from "./spinner.js";
|
|
|
5
5
|
export { createPrompt } from "./chat-prompt.js";
|
|
6
6
|
export { renderStatusBar, clearStatusBar, type StatusBarState } from "./status-bar.js";
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
accentGradient,
|
|
10
|
-
subtleGradient,
|
|
8
|
+
accent,
|
|
11
9
|
brand,
|
|
12
|
-
accentGrad,
|
|
13
10
|
subtle,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
roleGradient,
|
|
17
|
-
statusGradient,
|
|
18
|
-
gradientBg,
|
|
11
|
+
muted,
|
|
12
|
+
inline,
|
|
19
13
|
} from "./gradient.js";
|
|
20
14
|
export { renderErrorDisplay, renderQuickError, renderWarning, type ErrorDisplayOptions, type ErrorSeverity } from "./error-display.js";
|
|
21
15
|
export { renderMemoryToast, renderMemoryRecall, renderMemorySave, clearToastLine, type MemoryToastOptions, type ToastType } from "./memory-toast.js";
|