@cruxy/cli 0.11.0 → 0.12.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/dist/approval/prompt.js +17 -15
- package/dist/cli/commands/checkpoint.js +6 -4
- package/dist/cli/commands/config.js +10 -7
- package/dist/cli/commands/index.js +16 -15
- package/dist/cli/commands/init.js +5 -3
- package/dist/cli/commands/login.js +5 -3
- package/dist/cli/commands/pr.js +8 -7
- package/dist/cli/commands/rollback.js +7 -6
- package/dist/cli/commands/run.js +7 -6
- package/dist/cli/commands/skills.js +12 -10
- package/dist/cli/program.js +7 -6
- package/dist/cli/repl.js +11 -9
- package/dist/components/frame.js +3 -1
- package/dist/components/fuzzy.d.ts +4 -4
- package/dist/components/fuzzy.js +14 -13
- package/dist/components/select.js +8 -7
- package/dist/errors/format.js +8 -8
- package/dist/onboarding/flow.js +6 -6
- package/dist/onboarding/steps.js +11 -11
- package/dist/plan/approve.js +6 -6
- package/dist/plan/render.js +26 -18
- package/dist/render/capabilities.js +4 -0
- package/dist/render/diff.d.ts +6 -7
- package/dist/render/diff.js +33 -22
- package/dist/render/highlight.d.ts +3 -3
- package/dist/render/highlight.js +15 -15
- package/dist/render/index.d.ts +1 -1
- package/dist/render/plain-renderer.d.ts +2 -1
- package/dist/render/plain-renderer.js +7 -6
- package/dist/render/state.d.ts +7 -2
- package/dist/render/state.js +16 -10
- package/dist/render/tty-renderer.d.ts +2 -1
- package/dist/render/tty-renderer.js +20 -17
- package/dist/render/types.d.ts +7 -0
- package/dist/subagent/orchestrator.js +21 -6
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/resolve.d.ts +32 -0
- package/dist/theme/resolve.js +73 -0
- package/dist/theme/tokens.d.ts +104 -0
- package/dist/theme/tokens.js +52 -0
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.js +7 -4
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terminal design system (U.1): one typed {@link Theme} of semantic tokens
|
|
3
|
+
* — color *roles* (never raw hues at call sites), a glyph set with ASCII
|
|
4
|
+
* fallbacks, and structure primitives. Every rendered surface resolves ONE
|
|
5
|
+
* theme (from {@link RenderCapabilities}) and references roles like
|
|
6
|
+
* `theme.danger(x)` / `theme.glyph.success`, so the CLI reads as one product
|
|
7
|
+
* and NO_COLOR / dumb-terminal degradation is handled in exactly one place.
|
|
8
|
+
*
|
|
9
|
+
* Picocolors is imported only by `resolve.ts`; this file is pure types + the
|
|
10
|
+
* two glyph tables.
|
|
11
|
+
*/
|
|
12
|
+
/** A text styler: wraps a string in ANSI, or the identity under NO_COLOR. */
|
|
13
|
+
export type Styler = (text: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Language-token colors for the streaming syntax highlighter. A distinct
|
|
16
|
+
* sub-palette (not status semantics), centralized here so every color choice
|
|
17
|
+
* lives in the theme.
|
|
18
|
+
*/
|
|
19
|
+
export interface ThemeSyntax {
|
|
20
|
+
keyword: Styler;
|
|
21
|
+
string: Styler;
|
|
22
|
+
number: Styler;
|
|
23
|
+
comment: Styler;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The glyph vocabulary. Concrete strings (resolved to the unicode or ASCII
|
|
27
|
+
* table), so a call site writes `theme.glyph.success`, never a literal "✓".
|
|
28
|
+
*/
|
|
29
|
+
export interface ThemeGlyphs {
|
|
30
|
+
/** Success / done. */
|
|
31
|
+
success: string;
|
|
32
|
+
/** Failure / error. */
|
|
33
|
+
failure: string;
|
|
34
|
+
/** Not-yet-started (plan step). */
|
|
35
|
+
pending: string;
|
|
36
|
+
/** In-progress marker (static, non-animated). */
|
|
37
|
+
running: string;
|
|
38
|
+
/** Selected-row pointer in pickers. */
|
|
39
|
+
pointer: string;
|
|
40
|
+
/** Input caret (REPL prompt, fuzzy query). */
|
|
41
|
+
caret: string;
|
|
42
|
+
/** Next-step / relation arrow. */
|
|
43
|
+
arrow: string;
|
|
44
|
+
caretUp: string;
|
|
45
|
+
caretDown: string;
|
|
46
|
+
/** Text-cursor bar in the fuzzy query line. */
|
|
47
|
+
cursorBar: string;
|
|
48
|
+
bullet: string;
|
|
49
|
+
/** Inline separator (the ` · ` joiner uses this). */
|
|
50
|
+
sep: string;
|
|
51
|
+
/** Truncation marker. */
|
|
52
|
+
ellipsis: string;
|
|
53
|
+
/** Subagent activity marker. */
|
|
54
|
+
play: string;
|
|
55
|
+
/** Animated spinner frames (used only where cursor control exists). */
|
|
56
|
+
spinnerFrames: readonly string[];
|
|
57
|
+
/** Non-animated spinner glyph (no-cursor terminals). */
|
|
58
|
+
spinnerStatic: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The resolved design system handed to a surface. Color roles are stylers
|
|
62
|
+
* (identity under NO_COLOR); `glyph`/`sep` are concrete strings; the structure
|
|
63
|
+
* helpers give consistent indentation, headings, and key/value alignment.
|
|
64
|
+
*/
|
|
65
|
+
export interface Theme {
|
|
66
|
+
/** Errors, destructive risk, failure. (red) */
|
|
67
|
+
danger: Styler;
|
|
68
|
+
/** Reversible-mutation risk, warnings. (yellow) */
|
|
69
|
+
warning: Styler;
|
|
70
|
+
/** Done / ok. (green) */
|
|
71
|
+
success: Styler;
|
|
72
|
+
/** Brand / interactive / links / pointers. (cyan) */
|
|
73
|
+
accent: Styler;
|
|
74
|
+
/** Secondary text: hints, causes, codes, rationale. (dim) */
|
|
75
|
+
muted: Styler;
|
|
76
|
+
/** Emphasis / headings — a weight, hue-independent; composes with a color. (bold) */
|
|
77
|
+
strong: Styler;
|
|
78
|
+
/** Syntax-highlighting sub-palette. */
|
|
79
|
+
syntax: ThemeSyntax;
|
|
80
|
+
/** Glyph vocabulary (unicode or ASCII per capabilities). */
|
|
81
|
+
glyph: ThemeGlyphs;
|
|
82
|
+
/** Bold heading (alias of {@link strong}, named for intent). */
|
|
83
|
+
heading: Styler;
|
|
84
|
+
/** Prefix every line with `2 * level` spaces. */
|
|
85
|
+
indent(text: string, level?: number): string;
|
|
86
|
+
/** Aligned `key value` with a bold key (optionally padded to `keyWidth`). */
|
|
87
|
+
kv(key: string, value: string, keyWidth?: number): string;
|
|
88
|
+
/** The inline joiner, e.g. ` · ` (unicode) / ` - ` (ascii). */
|
|
89
|
+
sep: string;
|
|
90
|
+
readonly color: boolean;
|
|
91
|
+
readonly unicode: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** The two axes a theme is resolved from — a structural subset of RenderCapabilities. */
|
|
94
|
+
export interface ThemeCapabilities {
|
|
95
|
+
color: boolean;
|
|
96
|
+
unicode: boolean;
|
|
97
|
+
}
|
|
98
|
+
/** The unicode glyph table (real terminals). */
|
|
99
|
+
export declare const UNICODE_GLYPHS: ThemeGlyphs;
|
|
100
|
+
/**
|
|
101
|
+
* The ASCII glyph table (TERM=dumb / CRUXY_ASCII). Readable, single-byte, no
|
|
102
|
+
* mojibake — the intentional U.1 degradation for unicode-unsafe terminals.
|
|
103
|
+
*/
|
|
104
|
+
export declare const ASCII_GLYPHS: ThemeGlyphs;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The terminal design system (U.1): one typed {@link Theme} of semantic tokens
|
|
3
|
+
* — color *roles* (never raw hues at call sites), a glyph set with ASCII
|
|
4
|
+
* fallbacks, and structure primitives. Every rendered surface resolves ONE
|
|
5
|
+
* theme (from {@link RenderCapabilities}) and references roles like
|
|
6
|
+
* `theme.danger(x)` / `theme.glyph.success`, so the CLI reads as one product
|
|
7
|
+
* and NO_COLOR / dumb-terminal degradation is handled in exactly one place.
|
|
8
|
+
*
|
|
9
|
+
* Picocolors is imported only by `resolve.ts`; this file is pure types + the
|
|
10
|
+
* two glyph tables.
|
|
11
|
+
*/
|
|
12
|
+
/** The unicode glyph table (real terminals). */
|
|
13
|
+
export const UNICODE_GLYPHS = {
|
|
14
|
+
success: "✓",
|
|
15
|
+
failure: "✗",
|
|
16
|
+
pending: "○",
|
|
17
|
+
running: "◐",
|
|
18
|
+
pointer: "❯",
|
|
19
|
+
caret: "›",
|
|
20
|
+
arrow: "→",
|
|
21
|
+
caretUp: "↑",
|
|
22
|
+
caretDown: "↓",
|
|
23
|
+
cursorBar: "▏",
|
|
24
|
+
bullet: "•",
|
|
25
|
+
sep: "·",
|
|
26
|
+
ellipsis: "…",
|
|
27
|
+
play: "⏵",
|
|
28
|
+
spinnerFrames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"],
|
|
29
|
+
spinnerStatic: "◐",
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The ASCII glyph table (TERM=dumb / CRUXY_ASCII). Readable, single-byte, no
|
|
33
|
+
* mojibake — the intentional U.1 degradation for unicode-unsafe terminals.
|
|
34
|
+
*/
|
|
35
|
+
export const ASCII_GLYPHS = {
|
|
36
|
+
success: "[ok]",
|
|
37
|
+
failure: "[x]",
|
|
38
|
+
pending: "[ ]",
|
|
39
|
+
running: "~",
|
|
40
|
+
pointer: ">",
|
|
41
|
+
caret: ">",
|
|
42
|
+
arrow: "->",
|
|
43
|
+
caretUp: "^",
|
|
44
|
+
caretDown: "v",
|
|
45
|
+
cursorBar: "|",
|
|
46
|
+
bullet: "*",
|
|
47
|
+
sep: "-",
|
|
48
|
+
ellipsis: "...",
|
|
49
|
+
play: ">",
|
|
50
|
+
spinnerFrames: ["-", "\\", "|", "/"],
|
|
51
|
+
spinnerStatic: "~",
|
|
52
|
+
};
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error", "si
|
|
|
2
2
|
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
3
3
|
declare class Logger {
|
|
4
4
|
private level;
|
|
5
|
+
/** Diagnostics go to stderr, so the theme resolves against stderr's color. */
|
|
6
|
+
private readonly theme;
|
|
5
7
|
setLevel(level: LogLevel): void;
|
|
6
8
|
getLevel(): LogLevel;
|
|
7
9
|
private enabled;
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { shouldUseColor } from "../errors/format.js";
|
|
2
|
+
import { themeForColor } from "../theme/index.js";
|
|
2
3
|
export const LOG_LEVELS = ["debug", "info", "warn", "error", "silent"];
|
|
3
4
|
const WEIGHT = {
|
|
4
5
|
debug: 10,
|
|
@@ -9,6 +10,8 @@ const WEIGHT = {
|
|
|
9
10
|
};
|
|
10
11
|
class Logger {
|
|
11
12
|
level = "info";
|
|
13
|
+
/** Diagnostics go to stderr, so the theme resolves against stderr's color. */
|
|
14
|
+
theme = themeForColor(shouldUseColor(process.stderr));
|
|
12
15
|
setLevel(level) {
|
|
13
16
|
this.level = level;
|
|
14
17
|
}
|
|
@@ -20,7 +23,7 @@ class Logger {
|
|
|
20
23
|
}
|
|
21
24
|
debug(...args) {
|
|
22
25
|
if (this.enabled("debug"))
|
|
23
|
-
console.error(
|
|
26
|
+
console.error(this.theme.muted("debug"), ...args);
|
|
24
27
|
}
|
|
25
28
|
info(...args) {
|
|
26
29
|
if (this.enabled("info"))
|
|
@@ -28,11 +31,11 @@ class Logger {
|
|
|
28
31
|
}
|
|
29
32
|
warn(...args) {
|
|
30
33
|
if (this.enabled("warn"))
|
|
31
|
-
console.error(
|
|
34
|
+
console.error(this.theme.warning("warn"), ...args);
|
|
32
35
|
}
|
|
33
36
|
error(...args) {
|
|
34
37
|
if (this.enabled("error"))
|
|
35
|
-
console.error(
|
|
38
|
+
console.error(this.theme.danger("error"), ...args);
|
|
36
39
|
}
|
|
37
40
|
/** Primary user-facing output — always written to stdout. */
|
|
38
41
|
print(...args) {
|