@vincemakes/kiso-tui-cells 0.5.0 → 0.7.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/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/render.d.ts +17 -6
- package/dist/render.js +1 -1
- package/dist/strings.d.ts +60 -0
- package/dist/strings.js +81 -0
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export { editFileDiff, truncateDiff, writeFileDiff, type DiffLine, type DiffResu
|
|
|
11
11
|
export { pendingQueueRows } from "./components.js";
|
|
12
12
|
export { charWidth, displayWidth, leadWidth, widthOf } from "./width.js";
|
|
13
13
|
export { panelAffordance, panelBlockRows, panelLead, panelLeadPlain, panelLeadWidth, panelStatus, type PanelArgs, type PanelFlavor, type PanelPhase, type PanelSel, type PanelState, type PanelVerdict, type PanelView, } from "./approval-panel.js";
|
|
14
|
+
export { interactivePrompt, projectTrustRows, projectTrustView, projectUntrustedNote, uncertainView, type TrustArtifact, } from "./strings.js";
|
|
14
15
|
export { bannerLines, COLOR_OFF, COLOR_ON, colorInlineCode, escapeTerminal, foldResult, foldThinking, kUnit, palette, relativeTime, renderResumeList, renderTerminalGap, renderToolSummary, TAGLINE, toolTarget, truncateRow, type Palette, type ResumeMeta, } from "./render.js";
|
package/dist/index.js
CHANGED
|
@@ -18,4 +18,9 @@ export { charWidth, displayWidth, leadWidth, widthOf } from "./width.js";
|
|
|
18
18
|
// approval is pending. Types + the row/lead/status renderers; the
|
|
19
19
|
// verdict mapping lives in the cli, never here.
|
|
20
20
|
export { panelAffordance, panelBlockRows, panelLead, panelLeadPlain, panelLeadWidth, panelStatus, } from "./approval-panel.js";
|
|
21
|
+
// KC3 slice 1 (the extraction): the human-facing strings the CLI's
|
|
22
|
+
// trust-ui.ts used to build inline — the prompt, the project-trust
|
|
23
|
+
// listing/view/note, the uncertain execution's view. The flow stays in
|
|
24
|
+
// the cli; what the human reads is presentation.
|
|
25
|
+
export { interactivePrompt, projectTrustRows, projectTrustView, projectUntrustedNote, uncertainView, } from "./strings.js";
|
|
21
26
|
export { bannerLines, COLOR_OFF, COLOR_ON, colorInlineCode, escapeTerminal, foldResult, foldThinking, kUnit, palette, relativeTime, renderResumeList, renderTerminalGap, renderToolSummary, TAGLINE, toolTarget, truncateRow, } from "./render.js";
|
package/dist/render.d.ts
CHANGED
|
@@ -11,12 +11,23 @@
|
|
|
11
11
|
* RETIRED — the identity accents (the you> prompt, the banner tagline,
|
|
12
12
|
* ✓ marks, slash-command names, the input brick) are bright-white BOLD
|
|
13
13
|
* (SGR 1); the user message is the SGR-7 chip (the 2026-08-09 ruling
|
|
14
|
-
* retired the ▍ rail);
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* retired the ▍ rail); red for errors, dim for metadata, green for the
|
|
15
|
+
* diff additions. NO_COLOR set, or a non-TTY output → every code is
|
|
16
|
+
* empty, so pipes and CI carry ZERO ANSI (the existing byte-level e2e
|
|
17
|
+
* assertions guard it). Everything not listed is plain.
|
|
18
|
+
*
|
|
19
|
+
* KC3 §2 — THE MONO DISCIPLINE (the owner's 2026-08-17 ruling, a
|
|
20
|
+
* DECLARED SUPERSESSION under ADR-0051 Amendment 3). The interface's
|
|
21
|
+
* body is carried by shades of black and white; green ✓, yellow warn
|
|
22
|
+
* and red error are the ONLY functional exceptions. v5 had already
|
|
23
|
+
* taken the identity accents to bold; `code` was the one chromatic
|
|
24
|
+
* entry left — the light BLUE 38;5;110 — and it becomes the light GRAY
|
|
25
|
+
* 38;5;252. A tint still says "this span is code", which is the job it
|
|
26
|
+
* was hired for; saying it in a hue was never the job.
|
|
27
|
+
*
|
|
28
|
+
* The functional colors are deliberately NOT moved and not
|
|
29
|
+
* approximated: red stays SGR 31, green stays SGR 32. A reader who has
|
|
30
|
+
* learned that colour means something must keep being right.
|
|
20
31
|
*/
|
|
21
32
|
export interface Palette {
|
|
22
33
|
readonly bold: string;
|
package/dist/render.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* dependencies (the tui-cells package has none).
|
|
7
7
|
*/
|
|
8
8
|
import { charWidth, displayWidth } from "./width.js";
|
|
9
|
-
export const COLOR_ON = { bold: "\x1b[1m", dim: "\x1b[2m", red: "\x1b[31m", green: "\x1b[32m", code: "\x1b[38;5;
|
|
9
|
+
export const COLOR_ON = { bold: "\x1b[1m", dim: "\x1b[2m", red: "\x1b[31m", green: "\x1b[32m", code: "\x1b[38;5;252m", rv: "\x1b[7m", rvEnd: "\x1b[27m", reset: "\x1b[0m" };
|
|
10
10
|
export const COLOR_OFF = { bold: "", dim: "", red: "", green: "", code: "", rv: "", rvEnd: "", reset: "" };
|
|
11
11
|
export function palette() {
|
|
12
12
|
return process.env.NO_COLOR === undefined && process.stdout.isTTY ? COLOR_ON : COLOR_OFF;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tui-cells — the human-facing STRINGS (KC3 slice 1, the ADR-0041
|
|
3
|
+
* escape hatch: extraction, never a raise): the readline prompt, the
|
|
4
|
+
* project-trust listing rows and its panel view, the uncertain
|
|
5
|
+
* execution's panel view, and the non-TTY not-trusted note. All five
|
|
6
|
+
* were built inline in the CLI's trust-ui.ts before the move.
|
|
7
|
+
*
|
|
8
|
+
* The split is the one the ADR names. The FLOW stays in the CLI: who is
|
|
9
|
+
* asked, when the ask happens, whether a TTY exists, and what a verdict
|
|
10
|
+
* MEANS (granted loads, refused is sticky, a cancel records nothing) is
|
|
11
|
+
* trust-ui.ts's and is untouched by this move. What the human READS is
|
|
12
|
+
* presentation, and presentation belongs to the terminal layer — the
|
|
13
|
+
* same reasoning that moved the status rows here in KC2 §5.
|
|
14
|
+
*
|
|
15
|
+
* Pure by construction: every function is (data) → bytes. No node
|
|
16
|
+
* builtins, no I/O, no clock — the package's zero-dependency promise is
|
|
17
|
+
* why the caller passes paths and counts in rather than having them
|
|
18
|
+
* looked up here.
|
|
19
|
+
*/
|
|
20
|
+
import type { PanelView } from "./approval-panel.js";
|
|
21
|
+
/** v2a: the interactive prompt — the identity accent. readline owns the
|
|
22
|
+
* echo of what the user types; we own the prompt's color. (v2c: the
|
|
23
|
+
* readline prompt keeps "you> " — the brick ▌ is the dock's row only;
|
|
24
|
+
* pipe bytes must not change.) */
|
|
25
|
+
export declare function interactivePrompt(): string;
|
|
26
|
+
/** E3 (ADR-0037) — one discovered project artifact: the relative path
|
|
27
|
+
* and its content digest. Structural on purpose — the runtime's
|
|
28
|
+
* ProjectArtifacts satisfies it without this package importing the
|
|
29
|
+
* runtime (it imports nothing). */
|
|
30
|
+
export interface TrustArtifact {
|
|
31
|
+
readonly path: string;
|
|
32
|
+
readonly digest: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* E3 — the artifact listing: `<path> (<digest6>)`, one row per file.
|
|
36
|
+
*
|
|
37
|
+
* The two callers differ by exactly the INDENT and nothing else: the
|
|
38
|
+
* scrollback record indents two (its rows sit under the root's own
|
|
39
|
+
* line), the panel's args do not (the block's frame supplies the
|
|
40
|
+
* inset). Before the move the two rows were written out separately, two
|
|
41
|
+
* template literals that had to agree by hand; the parameter keeps the
|
|
42
|
+
* one real difference visible while making the rest provably identical.
|
|
43
|
+
*/
|
|
44
|
+
export declare function projectTrustRows(files: readonly TrustArtifact[], indent?: string): string[];
|
|
45
|
+
/** E3 — the trust gate's panel: the SIMPLE flavor (1 Yes / 3 No — no
|
|
46
|
+
* "don't ask again" rule exists for a project), the root as the title,
|
|
47
|
+
* the artifact listing as the always-verbose args, and the question as
|
|
48
|
+
* the rule override. The same rows the scrollback records — the panel
|
|
49
|
+
* is a bounded block, the record is not. */
|
|
50
|
+
export declare function projectTrustView(root: string, files: readonly TrustArtifact[]): PanelView;
|
|
51
|
+
/** E3 — the non-TTY note: artifacts were found and deliberately NOT
|
|
52
|
+
* loaded, with the one path back (run once interactively). Printed to
|
|
53
|
+
* stderr by the caller; never silent. */
|
|
54
|
+
export declare function projectUntrustedNote(count: number, root: string): string;
|
|
55
|
+
/** rounds 8/10 — the uncertain execution's panel: the SIMPLE flavor
|
|
56
|
+
* again, with the options re-labelled in the rule line (1 rerun · 3
|
|
57
|
+
* abandon). The tool name is escaped for the dock-less fallback
|
|
58
|
+
* question because it reaches the terminal as raw text there; the
|
|
59
|
+
* panel's own rows are escaped by the panel renderer. */
|
|
60
|
+
export declare function uncertainView(name: string, executionId: string): PanelView;
|
package/dist/strings.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tui-cells — the human-facing STRINGS (KC3 slice 1, the ADR-0041
|
|
3
|
+
* escape hatch: extraction, never a raise): the readline prompt, the
|
|
4
|
+
* project-trust listing rows and its panel view, the uncertain
|
|
5
|
+
* execution's panel view, and the non-TTY not-trusted note. All five
|
|
6
|
+
* were built inline in the CLI's trust-ui.ts before the move.
|
|
7
|
+
*
|
|
8
|
+
* The split is the one the ADR names. The FLOW stays in the CLI: who is
|
|
9
|
+
* asked, when the ask happens, whether a TTY exists, and what a verdict
|
|
10
|
+
* MEANS (granted loads, refused is sticky, a cancel records nothing) is
|
|
11
|
+
* trust-ui.ts's and is untouched by this move. What the human READS is
|
|
12
|
+
* presentation, and presentation belongs to the terminal layer — the
|
|
13
|
+
* same reasoning that moved the status rows here in KC2 §5.
|
|
14
|
+
*
|
|
15
|
+
* Pure by construction: every function is (data) → bytes. No node
|
|
16
|
+
* builtins, no I/O, no clock — the package's zero-dependency promise is
|
|
17
|
+
* why the caller passes paths and counts in rather than having them
|
|
18
|
+
* looked up here.
|
|
19
|
+
*/
|
|
20
|
+
import { escapeTerminal, palette } from "./render.js";
|
|
21
|
+
/** v2a: the interactive prompt — the identity accent. readline owns the
|
|
22
|
+
* echo of what the user types; we own the prompt's color. (v2c: the
|
|
23
|
+
* readline prompt keeps "you> " — the brick ▌ is the dock's row only;
|
|
24
|
+
* pipe bytes must not change.) */
|
|
25
|
+
export function interactivePrompt() {
|
|
26
|
+
const p = palette();
|
|
27
|
+
return `${p.bold}you> ${p.reset}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* E3 — the artifact listing: `<path> (<digest6>)`, one row per file.
|
|
31
|
+
*
|
|
32
|
+
* The two callers differ by exactly the INDENT and nothing else: the
|
|
33
|
+
* scrollback record indents two (its rows sit under the root's own
|
|
34
|
+
* line), the panel's args do not (the block's frame supplies the
|
|
35
|
+
* inset). Before the move the two rows were written out separately, two
|
|
36
|
+
* template literals that had to agree by hand; the parameter keeps the
|
|
37
|
+
* one real difference visible while making the rest provably identical.
|
|
38
|
+
*/
|
|
39
|
+
export function projectTrustRows(files, indent = "") {
|
|
40
|
+
return files.map((f) => `${indent}${f.path} (${f.digest.slice(0, 6)})`);
|
|
41
|
+
}
|
|
42
|
+
/** E3 — the trust gate's panel: the SIMPLE flavor (1 Yes / 3 No — no
|
|
43
|
+
* "don't ask again" rule exists for a project), the root as the title,
|
|
44
|
+
* the artifact listing as the always-verbose args, and the question as
|
|
45
|
+
* the rule override. The same rows the scrollback records — the panel
|
|
46
|
+
* is a bounded block, the record is not. */
|
|
47
|
+
export function projectTrustView(root, files) {
|
|
48
|
+
return {
|
|
49
|
+
flavor: "simple",
|
|
50
|
+
name: "project trust",
|
|
51
|
+
title: root,
|
|
52
|
+
speaker: "kiso",
|
|
53
|
+
statusText: "▸ project trust",
|
|
54
|
+
args: { kind: "text", lines: projectTrustRows(files) },
|
|
55
|
+
ruleOverride: "trust this project's .kiso?",
|
|
56
|
+
fallbackQuestion: `trust this project's .kiso? (y/n) `,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** E3 — the non-TTY note: artifacts were found and deliberately NOT
|
|
60
|
+
* loaded, with the one path back (run once interactively). Printed to
|
|
61
|
+
* stderr by the caller; never silent. */
|
|
62
|
+
export function projectUntrustedNote(count, root) {
|
|
63
|
+
return `[project .kiso] found ${count} artifact(s) in ${root} — not trusted, not loaded (run kiso interactively once to decide)`;
|
|
64
|
+
}
|
|
65
|
+
/** rounds 8/10 — the uncertain execution's panel: the SIMPLE flavor
|
|
66
|
+
* again, with the options re-labelled in the rule line (1 rerun · 3
|
|
67
|
+
* abandon). The tool name is escaped for the dock-less fallback
|
|
68
|
+
* question because it reaches the terminal as raw text there; the
|
|
69
|
+
* panel's own rows are escaped by the panel renderer. */
|
|
70
|
+
export function uncertainView(name, executionId) {
|
|
71
|
+
return {
|
|
72
|
+
flavor: "simple",
|
|
73
|
+
name: "uncertain execution",
|
|
74
|
+
title: `${name} (${executionId})`,
|
|
75
|
+
speaker: "kiso",
|
|
76
|
+
statusText: "▸ uncertain execution",
|
|
77
|
+
args: { kind: "text", lines: [executionId] },
|
|
78
|
+
ruleOverride: "did the interrupted execution apply? — 1 rerun · 3 abandon",
|
|
79
|
+
fallbackQuestion: `⚠ interrupted execution: ${escapeTerminal(name)} (${executionId}) — did it apply? (y)es / (n)o `,
|
|
80
|
+
};
|
|
81
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-tui-cells",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "kiso tui-cells — the components cell renderer (components, diff, width, the render slice). Zero runtime dependencies: input is data, output is bytes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"./render": {
|
|
29
29
|
"types": "./dist/render.d.ts",
|
|
30
30
|
"default": "./dist/render.js"
|
|
31
|
+
},
|
|
32
|
+
"./strings": {
|
|
33
|
+
"types": "./dist/strings.d.ts",
|
|
34
|
+
"default": "./dist/strings.js"
|
|
31
35
|
}
|
|
32
36
|
},
|
|
33
37
|
"files": [
|