@raidiant/notifai 0.2.1 → 0.4.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 +20 -4
- package/dist/atomic-file.d.ts +4 -0
- package/dist/atomic-file.js +60 -10
- package/dist/atomic-file.js.map +1 -1
- package/dist/client.d.ts +25 -2
- package/dist/client.js +45 -1
- package/dist/client.js.map +1 -1
- package/dist/commands.d.ts +85 -6
- package/dist/commands.js +1133 -322
- package/dist/commands.js.map +1 -1
- package/dist/config-schema.d.ts +62 -0
- package/dist/config-schema.js +312 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +38 -3
- package/dist/config.js +61 -14
- package/dist/config.js.map +1 -1
- package/dist/file-lock.d.ts +26 -0
- package/dist/file-lock.js +268 -0
- package/dist/file-lock.js.map +1 -0
- package/dist/harnesses.d.ts +28 -0
- package/dist/harnesses.js +40 -0
- package/dist/harnesses.js.map +1 -0
- package/dist/hook-adapter.d.ts +27 -0
- package/dist/hook-adapter.js +188 -0
- package/dist/hook-adapter.js.map +1 -0
- package/dist/hook-input.d.ts +10 -0
- package/dist/hook-input.js +64 -0
- package/dist/hook-input.js.map +1 -0
- package/dist/hooks.d.ts +66 -10
- package/dist/hooks.js +751 -276
- package/dist/hooks.js.map +1 -1
- package/dist/install-hooks.d.ts +40 -16
- package/dist/install-hooks.js +217 -73
- package/dist/install-hooks.js.map +1 -1
- package/dist/interactive.d.ts +4 -0
- package/dist/interactive.js +604 -0
- package/dist/interactive.js.map +1 -0
- package/dist/logging.d.ts +142 -0
- package/dist/logging.js +533 -0
- package/dist/logging.js.map +1 -0
- package/dist/main.js +201 -51
- package/dist/main.js.map +1 -1
- package/dist/opencode-plugin.d.ts +7 -7
- package/dist/opencode-plugin.js +12 -13
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/ui/banner.d.ts +22 -0
- package/dist/ui/banner.js +87 -0
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/config-view.d.ts +32 -0
- package/dist/ui/config-view.js +108 -0
- package/dist/ui/config-view.js.map +1 -0
- package/dist/ui/help.d.ts +46 -0
- package/dist/ui/help.js +105 -0
- package/dist/ui/help.js.map +1 -0
- package/dist/ui/theme.d.ts +108 -0
- package/dist/ui/theme.js +261 -0
- package/dist/ui/theme.js.map +1 -0
- package/package.json +11 -9
- package/src/atomic-file.ts +86 -7
- package/src/client.test.ts +12 -0
- package/src/client.ts +72 -4
- package/src/commands.test.ts +971 -44
- package/src/commands.ts +1323 -337
- package/src/config-schema.test.ts +152 -0
- package/src/config-schema.ts +363 -0
- package/src/config.test.ts +6 -5
- package/src/config.ts +85 -16
- package/src/file-lock-process-worker.test.ts +64 -0
- package/src/file-lock.test.ts +279 -0
- package/src/file-lock.ts +318 -0
- package/src/harnesses.test.ts +48 -0
- package/src/harnesses.ts +59 -0
- package/src/hook-adapter.test.ts +187 -0
- package/src/hook-adapter.ts +212 -0
- package/src/hook-input.test.ts +39 -0
- package/src/hook-input.ts +72 -0
- package/src/hooks.test.ts +1318 -240
- package/src/hooks.ts +1046 -296
- package/src/install-hooks.test.ts +90 -41
- package/src/install-hooks.ts +259 -74
- package/src/interactive.ts +692 -0
- package/src/logging-process-worker.test.ts +39 -0
- package/src/logging.test.ts +453 -0
- package/src/logging.ts +639 -0
- package/src/main.ts +220 -48
- package/src/opencode-plugin.ts +15 -16
- package/src/session-end-log-lock-worker.test.ts +35 -0
- package/src/skill.test.ts +11 -0
- package/src/ui/banner.ts +95 -0
- package/src/ui/config-view.test.ts +88 -0
- package/src/ui/config-view.ts +138 -0
- package/src/ui/help.ts +124 -0
- package/src/ui/theme.test.ts +92 -0
- package/src/ui/theme.ts +279 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type BannerSize = 'block' | 'ascii' | 'word';
|
|
2
|
+
export declare function bannerSize(columns?: number): BannerSize;
|
|
3
|
+
/** The wordmark as rendered lines, gradient included. */
|
|
4
|
+
export declare function bannerLines(columns?: number): string[];
|
|
5
|
+
/**
|
|
6
|
+
* Reveal the wordmark one row at a time.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately brief and deliberately skippable: this runs before someone can
|
|
9
|
+
* do anything, so it may not become a wait. It is skipped entirely when output
|
|
10
|
+
* is not a TTY, when `NOTIFAI_NO_ANIMATION` is set, and under `CI`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function printBanner(options?: {
|
|
13
|
+
animate?: boolean;
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
write?: (line: string) => void;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* One line of orientation under the wordmark — and it must stay one line.
|
|
19
|
+
* Wrapped onto two it stops reading as a subtitle and starts reading as the
|
|
20
|
+
* first paragraph of something, so a narrow terminal gets the version alone.
|
|
21
|
+
*/
|
|
22
|
+
export declare function tagline(version: string, columns?: number): string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wordmark shown when a human opens the interactive app.
|
|
3
|
+
*
|
|
4
|
+
* Three tiers, chosen by what the terminal can actually render rather than by
|
|
5
|
+
* what looks best in a screenshot: box-drawing blocks when the terminal is wide
|
|
6
|
+
* and Unicode-capable, a pure-ASCII form that survives anywhere, and a plain
|
|
7
|
+
* word when neither fits. A banner that wraps is worse than no banner, so the
|
|
8
|
+
* width check is not optional.
|
|
9
|
+
*
|
|
10
|
+
* The art is embedded rather than rendered at run time. It is one fixed word
|
|
11
|
+
* that will never change, and shipping a font engine to redraw a constant on
|
|
12
|
+
* every launch would cost every install — including the agents that never see
|
|
13
|
+
* it — for no benefit.
|
|
14
|
+
*/
|
|
15
|
+
import { gradientBlock, style, terminalWidth, unicode } from './theme.js';
|
|
16
|
+
/** ANSI Shadow. 50 columns, 6 rows. */
|
|
17
|
+
const BLOCK = [
|
|
18
|
+
'███╗ ██╗ ██████╗ ████████╗██╗███████╗ █████╗ ██╗',
|
|
19
|
+
'████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔══██╗██║',
|
|
20
|
+
'██╔██╗ ██║██║ ██║ ██║ ██║█████╗ ███████║██║',
|
|
21
|
+
'██║╚██╗██║██║ ██║ ██║ ██║██╔══╝ ██╔══██║██║',
|
|
22
|
+
'██║ ╚████║╚██████╔╝ ██║ ██║██║ ██║ ██║██║',
|
|
23
|
+
'╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═╝',
|
|
24
|
+
];
|
|
25
|
+
/** Pure ASCII. 34 columns, 4 rows — safe on any terminal, any code page. */
|
|
26
|
+
const ASCII = [
|
|
27
|
+
' _ _ ___ _____ ___ ___ _ ___ ',
|
|
28
|
+
' | \\| |/ _ \\_ _|_ _| __/_\\ |_ _|',
|
|
29
|
+
' | .` | (_) || | | || _/ _ \\ | | ',
|
|
30
|
+
' |_|\\_|\\___/ |_| |___|_/_/ \\_\\___|',
|
|
31
|
+
];
|
|
32
|
+
export function bannerSize(columns = terminalWidth()) {
|
|
33
|
+
if (unicode && columns >= 54)
|
|
34
|
+
return 'block';
|
|
35
|
+
if (columns >= 38)
|
|
36
|
+
return 'ascii';
|
|
37
|
+
return 'word';
|
|
38
|
+
}
|
|
39
|
+
/** The wordmark as rendered lines, gradient included. */
|
|
40
|
+
export function bannerLines(columns = terminalWidth()) {
|
|
41
|
+
switch (bannerSize(columns)) {
|
|
42
|
+
case 'block':
|
|
43
|
+
return gradientBlock(BLOCK);
|
|
44
|
+
case 'ascii':
|
|
45
|
+
return gradientBlock(ASCII);
|
|
46
|
+
case 'word':
|
|
47
|
+
return gradientBlock(['N O T I F A I']);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reveal the wordmark one row at a time.
|
|
52
|
+
*
|
|
53
|
+
* Deliberately brief and deliberately skippable: this runs before someone can
|
|
54
|
+
* do anything, so it may not become a wait. It is skipped entirely when output
|
|
55
|
+
* is not a TTY, when `NOTIFAI_NO_ANIMATION` is set, and under `CI`.
|
|
56
|
+
*/
|
|
57
|
+
export async function printBanner(options = {}) {
|
|
58
|
+
const env = options.env ?? process.env;
|
|
59
|
+
const write = options.write ?? ((line) => process.stdout.write(`${line}\n`));
|
|
60
|
+
const lines = bannerLines();
|
|
61
|
+
const animate = options.animate !== false &&
|
|
62
|
+
process.stdout.isTTY === true &&
|
|
63
|
+
(env['NOTIFAI_NO_ANIMATION'] ?? '') === '' &&
|
|
64
|
+
(env['CI'] ?? '') === '';
|
|
65
|
+
write('');
|
|
66
|
+
for (const line of lines) {
|
|
67
|
+
// Two columns, matching the tagline and the status card beneath it. Flush
|
|
68
|
+
// left, the wordmark reads as a separate thing sitting above the app.
|
|
69
|
+
write(` ${line}`);
|
|
70
|
+
if (animate)
|
|
71
|
+
await new Promise((resolve) => setTimeout(resolve, 26));
|
|
72
|
+
}
|
|
73
|
+
write('');
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One line of orientation under the wordmark — and it must stay one line.
|
|
77
|
+
* Wrapped onto two it stops reading as a subtitle and starts reading as the
|
|
78
|
+
* first paragraph of something, so a narrow terminal gets the version alone.
|
|
79
|
+
*/
|
|
80
|
+
export function tagline(version, columns = terminalWidth()) {
|
|
81
|
+
const full = 'Native notifications for agents and local programs';
|
|
82
|
+
// Two leading columns of indent, two trailing for the version.
|
|
83
|
+
return columns >= full.length + 12
|
|
84
|
+
? `${style.dim(full)} ${style.dim(`v${version}`)}`
|
|
85
|
+
: style.dim(`v${version}`);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../src/ui/banner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzE,uCAAuC;AACvC,MAAM,KAAK,GAAG;IACZ,oD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,EAAE,CAAC,KAAK,EAAE;QAC1C,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAA;IAE1B,KAAK,CAAC,EAAE,CAAC,CAAA;IACT,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,0EAA0E;QAC1E,sEAAsE;QACtE,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;QAClB,IAAI,OAAO;YAAE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;IACtE,CAAC;IACD,KAAK,CAAC,EAAE,CAAC,CAAA;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,OAAO,GAAG,aAAa,EAAE;IAChE,MAAM,IAAI,GAAG,oDAAoD,CAAA;IACjE,+DAA+D;IAC/D,OAAO,OAAO,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE;QAChC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE;QACnD,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering for the configuration surfaces a person reads.
|
|
3
|
+
*
|
|
4
|
+
* The agent-facing shapes are untouched and live elsewhere: `--json` is the
|
|
5
|
+
* contract, and the flat `key = value` form stays exactly as it was for
|
|
6
|
+
* anything that is not a terminal. What is new is only what a human sees.
|
|
7
|
+
*/
|
|
8
|
+
import { type CliConfig, type ConfigKey } from '../config.js';
|
|
9
|
+
/**
|
|
10
|
+
* The full settings listing, grouped and explained.
|
|
11
|
+
*
|
|
12
|
+
* Each key gets its name (what you type), its value (what is in force), where
|
|
13
|
+
* that value came from, and one line on what it does. The name leads rather
|
|
14
|
+
* than the friendly label because the next thing a reader does with it is type
|
|
15
|
+
* it into `config set`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderConfigList(config: CliConfig, options?: {
|
|
18
|
+
showAdvanced?: boolean;
|
|
19
|
+
}): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Everything about one key, for someone who has asked about it specifically.
|
|
22
|
+
*
|
|
23
|
+
* This is the payoff of the listing above staying terse: the reader arrives
|
|
24
|
+
* here already knowing which key they care about, so the full paragraph, the
|
|
25
|
+
* legal values, and the layer the current value came from can all be spent on
|
|
26
|
+
* that one key.
|
|
27
|
+
*/
|
|
28
|
+
export declare function renderConfigExplain(key: ConfigKey, config: CliConfig): string[];
|
|
29
|
+
/** The flat form, unchanged, for anything that is not a person at a terminal. */
|
|
30
|
+
export declare function renderConfigPlain(config: CliConfig, explain: boolean): string[];
|
|
31
|
+
/** Longest visible line, for callers that need to size a rule or a box. */
|
|
32
|
+
export declare function widestLine(lines: readonly string[]): number;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering for the configuration surfaces a person reads.
|
|
3
|
+
*
|
|
4
|
+
* The agent-facing shapes are untouched and live elsewhere: `--json` is the
|
|
5
|
+
* contract, and the flat `key = value` form stays exactly as it was for
|
|
6
|
+
* anything that is not a terminal. What is new is only what a human sees.
|
|
7
|
+
*/
|
|
8
|
+
import { CONFIG_KEYS } from '../config.js';
|
|
9
|
+
import { CONFIG_GROUPS, acceptedValues, configInfo, configKeysByGroup, describeSource, formatValue, } from '../config-schema.js';
|
|
10
|
+
import { glyph, pad, style, terminalWidth, width, wrap } from './theme.js';
|
|
11
|
+
/**
|
|
12
|
+
* The full settings listing, grouped and explained.
|
|
13
|
+
*
|
|
14
|
+
* Each key gets its name (what you type), its value (what is in force), where
|
|
15
|
+
* that value came from, and one line on what it does. The name leads rather
|
|
16
|
+
* than the friendly label because the next thing a reader does with it is type
|
|
17
|
+
* it into `config set`.
|
|
18
|
+
*/
|
|
19
|
+
export function renderConfigList(config, options = {}) {
|
|
20
|
+
const columns = terminalWidth();
|
|
21
|
+
const lines = [];
|
|
22
|
+
const nameWidth = Math.max(...CONFIG_KEYS.map((key) => key.length));
|
|
23
|
+
const SUMMARY_INDENT = ' ';
|
|
24
|
+
for (const group of CONFIG_GROUPS) {
|
|
25
|
+
const keys = configKeysByGroup(group.id).filter((info) => options.showAdvanced === true || info.advanced !== true);
|
|
26
|
+
if (keys.length === 0)
|
|
27
|
+
continue;
|
|
28
|
+
lines.push('');
|
|
29
|
+
lines.push(style.heading(group.title));
|
|
30
|
+
for (const line of wrap(group.blurb, columns - 2))
|
|
31
|
+
lines.push(style.dim(` ${line}`));
|
|
32
|
+
lines.push('');
|
|
33
|
+
for (const info of keys) {
|
|
34
|
+
const entry = config[info.key];
|
|
35
|
+
const source = describeSource(entry.source);
|
|
36
|
+
const value = formatValue(info.key, entry.value);
|
|
37
|
+
const isSet = source.label !== 'default';
|
|
38
|
+
// The provenance mark is only drawn when there is provenance to show;
|
|
39
|
+
// an empty dim segment still emits escape codes, so a `trimEnd` on the
|
|
40
|
+
// finished string cannot remove it.
|
|
41
|
+
const provenance = isSet ? ` ${style.dim(`${glyph.bullet} ${source.label}`)}` : '';
|
|
42
|
+
lines.push(` ${style.code(pad(info.key, nameWidth))} ` +
|
|
43
|
+
`${isSet ? style.value(value) : style.unset(value)}${provenance}`);
|
|
44
|
+
for (const line of wrap(info.summary, columns - SUMMARY_INDENT.length)) {
|
|
45
|
+
lines.push(style.dim(`${SUMMARY_INDENT}${line}`));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push(style.dim(`${glyph.arrow} ${style.code('notifai config explain <key>')} for what one of these means and how to change it.`));
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Everything about one key, for someone who has asked about it specifically.
|
|
55
|
+
*
|
|
56
|
+
* This is the payoff of the listing above staying terse: the reader arrives
|
|
57
|
+
* here already knowing which key they care about, so the full paragraph, the
|
|
58
|
+
* legal values, and the layer the current value came from can all be spent on
|
|
59
|
+
* that one key.
|
|
60
|
+
*/
|
|
61
|
+
export function renderConfigExplain(key, config) {
|
|
62
|
+
const info = configInfo(key);
|
|
63
|
+
const entry = config[key];
|
|
64
|
+
const source = describeSource(entry.source);
|
|
65
|
+
const columns = terminalWidth();
|
|
66
|
+
const lines = [];
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push(`${style.code(key)} ${style.dim(glyph.bullet)} ${style.heading(info.label)}`);
|
|
69
|
+
lines.push('');
|
|
70
|
+
for (const paragraph of info.detail.split('\n\n')) {
|
|
71
|
+
for (const line of wrap(paragraph, columns - 2))
|
|
72
|
+
lines.push(` ${line}`);
|
|
73
|
+
lines.push('');
|
|
74
|
+
}
|
|
75
|
+
const valueLabel = formatValue(key, entry.value);
|
|
76
|
+
lines.push(` ${style.dim(pad('Now', 10))}${style.value(valueLabel)} ${style.dim(`${glyph.bullet} ${source.label}`)}`);
|
|
77
|
+
if (source.path !== null)
|
|
78
|
+
lines.push(` ${style.dim(pad('', 10))}${style.dim(source.path)}`);
|
|
79
|
+
lines.push(` ${style.dim(pad('Accepts', 10))}${acceptedValues(key)}`);
|
|
80
|
+
if (info.choices !== undefined && info.choiceHints !== undefined) {
|
|
81
|
+
lines.push('');
|
|
82
|
+
for (const choice of info.choices) {
|
|
83
|
+
const hint = info.choiceHints[choice];
|
|
84
|
+
lines.push(` ${style.dim(pad('', 10))}${style.code(pad(choice, 14))}${style.dim(hint ?? '')}`.trimEnd());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
lines.push('');
|
|
88
|
+
const example = info.example ?? (info.choices?.[0] ?? 'value');
|
|
89
|
+
lines.push(` ${style.dim('Change it')} ${style.code(`notifai config set ${key} ${example}`)}`);
|
|
90
|
+
if (entry.source !== 'default' && entry.source !== 'flag') {
|
|
91
|
+
lines.push(` ${style.dim('Inherit it')} ${style.code(`notifai config unset ${key}`)}`);
|
|
92
|
+
}
|
|
93
|
+
lines.push('');
|
|
94
|
+
return lines;
|
|
95
|
+
}
|
|
96
|
+
/** The flat form, unchanged, for anything that is not a person at a terminal. */
|
|
97
|
+
export function renderConfigPlain(config, explain) {
|
|
98
|
+
return CONFIG_KEYS.map((key) => {
|
|
99
|
+
const entry = config[key];
|
|
100
|
+
const provenance = explain ? ` [${entry.source}]` : '';
|
|
101
|
+
return `${key} = ${JSON.stringify(entry.value)}${provenance}`;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/** Longest visible line, for callers that need to size a rule or a box. */
|
|
105
|
+
export function widestLine(lines) {
|
|
106
|
+
return Math.max(0, ...lines.map((line) => width(line)));
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=config-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-view.js","sourceRoot":"","sources":["../../src/ui/config-view.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAkC,MAAM,cAAc,CAAA;AAC1E,OAAO,EACL,aAAa,EACb,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAE1E;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAiB,EACjB,UAAsC,EAAE;IAExC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAA;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACn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,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACzB,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;QACvD,OAAO,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,UAAU,EAAE,CAAA;IAC/D,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,KAAwB;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help that answers "what can I do here", not "what strings does argv accept".
|
|
3
|
+
*
|
|
4
|
+
* The old help listed seventeen commands in one flat column, with the two a new
|
|
5
|
+
* user needs (`init`, `login`) sitting between a platform capability dump and
|
|
6
|
+
* an entry point marked "Internal:". Everything was equally prominent, which is
|
|
7
|
+
* the same as nothing being prominent.
|
|
8
|
+
*
|
|
9
|
+
* Grouping and colour are Commander's own (`commandsGroup`, `optionsGroup`, and
|
|
10
|
+
* the `styleX` hooks it calls when the output has colours); this module only
|
|
11
|
+
* supplies the palette and the group vocabulary. Commander turns its styling
|
|
12
|
+
* off by itself when the output is not a terminal, so piped help stays plain
|
|
13
|
+
* without a second code path.
|
|
14
|
+
*/
|
|
15
|
+
import { type HelpConfiguration } from 'commander';
|
|
16
|
+
/**
|
|
17
|
+
* Group headings, in the order a reader meets them.
|
|
18
|
+
*
|
|
19
|
+
* Ordering is by who needs it and when: first run, then daily use, then the
|
|
20
|
+
* commands agents drive, then the things touched once or never. Commander
|
|
21
|
+
* renders groups in first-use order, so these constants are also the layout.
|
|
22
|
+
*/
|
|
23
|
+
export declare const GROUP: {
|
|
24
|
+
readonly start: "Getting started:";
|
|
25
|
+
readonly daily: "Everyday:";
|
|
26
|
+
readonly agent: "For agents and scripts:";
|
|
27
|
+
readonly advanced: "Account and wiring:";
|
|
28
|
+
readonly help: "Help:";
|
|
29
|
+
};
|
|
30
|
+
/** Option groups for `send`, which carries thirty flags. */
|
|
31
|
+
export declare const SEND_GROUP: {
|
|
32
|
+
readonly content: "What it says:";
|
|
33
|
+
readonly routing: "Where it goes:";
|
|
34
|
+
readonly presentation: "How it arrives:";
|
|
35
|
+
readonly reply: "Asking for an answer:";
|
|
36
|
+
readonly advanced: "Advanced:";
|
|
37
|
+
};
|
|
38
|
+
export declare const helpConfiguration: HelpConfiguration;
|
|
39
|
+
/**
|
|
40
|
+
* Footer for the root help.
|
|
41
|
+
*
|
|
42
|
+
* Its whole job is to make the interactive app discoverable, because someone
|
|
43
|
+
* reading a wall of flags has already demonstrated they did not know it was
|
|
44
|
+
* there.
|
|
45
|
+
*/
|
|
46
|
+
export declare function rootHelpFooter(): string;
|
package/dist/ui/help.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help that answers "what can I do here", not "what strings does argv accept".
|
|
3
|
+
*
|
|
4
|
+
* The old help listed seventeen commands in one flat column, with the two a new
|
|
5
|
+
* user needs (`init`, `login`) sitting between a platform capability dump and
|
|
6
|
+
* an entry point marked "Internal:". Everything was equally prominent, which is
|
|
7
|
+
* the same as nothing being prominent.
|
|
8
|
+
*
|
|
9
|
+
* Grouping and colour are Commander's own (`commandsGroup`, `optionsGroup`, and
|
|
10
|
+
* the `styleX` hooks it calls when the output has colours); this module only
|
|
11
|
+
* supplies the palette and the group vocabulary. Commander turns its styling
|
|
12
|
+
* off by itself when the output is not a terminal, so piped help stays plain
|
|
13
|
+
* without a second code path.
|
|
14
|
+
*/
|
|
15
|
+
import { Help } from 'commander';
|
|
16
|
+
import { glyph, style } from './theme.js';
|
|
17
|
+
/**
|
|
18
|
+
* Group headings, in the order a reader meets them.
|
|
19
|
+
*
|
|
20
|
+
* Ordering is by who needs it and when: first run, then daily use, then the
|
|
21
|
+
* commands agents drive, then the things touched once or never. Commander
|
|
22
|
+
* renders groups in first-use order, so these constants are also the layout.
|
|
23
|
+
*/
|
|
24
|
+
export const GROUP = {
|
|
25
|
+
start: 'Getting started:',
|
|
26
|
+
daily: 'Everyday:',
|
|
27
|
+
agent: 'For agents and scripts:',
|
|
28
|
+
advanced: 'Account and wiring:',
|
|
29
|
+
help: 'Help:',
|
|
30
|
+
};
|
|
31
|
+
/** Option groups for `send`, which carries thirty flags. */
|
|
32
|
+
export const SEND_GROUP = {
|
|
33
|
+
content: 'What it says:',
|
|
34
|
+
routing: 'Where it goes:',
|
|
35
|
+
presentation: 'How it arrives:',
|
|
36
|
+
reply: 'Asking for an answer:',
|
|
37
|
+
advanced: 'Advanced:',
|
|
38
|
+
};
|
|
39
|
+
/** Group order, independent of the order commands happen to be registered in. */
|
|
40
|
+
const GROUP_ORDER = [
|
|
41
|
+
GROUP.start,
|
|
42
|
+
GROUP.daily,
|
|
43
|
+
GROUP.agent,
|
|
44
|
+
GROUP.advanced,
|
|
45
|
+
GROUP.help,
|
|
46
|
+
];
|
|
47
|
+
function groupRank(heading) {
|
|
48
|
+
const index = GROUP_ORDER.indexOf(heading);
|
|
49
|
+
// Anything not named above keeps its position relative to its peers, because
|
|
50
|
+
// the sort is stable — which is what lets the same override run over option
|
|
51
|
+
// groups without needing to know their headings.
|
|
52
|
+
return index === -1 ? GROUP_ORDER.length : index;
|
|
53
|
+
}
|
|
54
|
+
export const helpConfiguration = {
|
|
55
|
+
// Groups already carry the intended order; alphabetising would scatter the
|
|
56
|
+
// dependency between `login` and everything that needs a credential.
|
|
57
|
+
sortSubcommands: false,
|
|
58
|
+
sortOptions: false,
|
|
59
|
+
showGlobalOptions: false,
|
|
60
|
+
/**
|
|
61
|
+
* Commander seeds group order from the raw registration order, which ties
|
|
62
|
+
* how the help reads to where a `program.command(…)` block happens to sit in
|
|
63
|
+
* the file — move one and the help silently reorders. Sorting the finished
|
|
64
|
+
* grouping makes `GROUP_ORDER` the single place that decision is made.
|
|
65
|
+
*
|
|
66
|
+
* The same override runs over option groups, whose headings are not in
|
|
67
|
+
* `GROUP_ORDER` at all. They all rank equal, and `sort` is stable, so they
|
|
68
|
+
* keep the order they were declared in.
|
|
69
|
+
*/
|
|
70
|
+
groupItems(unsortedItems, visibleItems, getGroup) {
|
|
71
|
+
// `.call` cannot carry the method's own generic through, so the signature
|
|
72
|
+
// is restated once here instead of widening every caller to
|
|
73
|
+
// `Command | Option`.
|
|
74
|
+
const base = Help.prototype.groupItems;
|
|
75
|
+
const grouped = base.call(this, unsortedItems, visibleItems, getGroup);
|
|
76
|
+
return new Map([...grouped.entries()].sort((a, b) => groupRank(a[0]) - groupRank(b[0])));
|
|
77
|
+
},
|
|
78
|
+
styleTitle: (title) => style.heading(title),
|
|
79
|
+
styleCommandText: (text) => style.accent(text),
|
|
80
|
+
styleSubcommandTerm: (text) => style.code(text),
|
|
81
|
+
styleOptionTerm: (text) => style.code(text),
|
|
82
|
+
styleArgumentTerm: (text) => style.code(text),
|
|
83
|
+
styleDescriptionText: (text) => text,
|
|
84
|
+
styleUsage: (text) => text,
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Footer for the root help.
|
|
88
|
+
*
|
|
89
|
+
* Its whole job is to make the interactive app discoverable, because someone
|
|
90
|
+
* reading a wall of flags has already demonstrated they did not know it was
|
|
91
|
+
* there.
|
|
92
|
+
*/
|
|
93
|
+
export function rootHelpFooter() {
|
|
94
|
+
const lines = [
|
|
95
|
+
'',
|
|
96
|
+
style.heading('Start here'),
|
|
97
|
+
` ${style.code('notifai')} ${style.dim(`${glyph.arrow} the interactive app: status, settings, devices, test sends`)}`,
|
|
98
|
+
` ${style.code('notifai init')} ${style.dim(`${glyph.arrow} set this project up, step by step`)}`,
|
|
99
|
+
'',
|
|
100
|
+
style.dim(`Every command takes ${style.code('--help')}. Machine-readable output: ${style.code('--json')}.`),
|
|
101
|
+
style.dim(`Settings are explained by ${style.code('notifai config show')} and ${style.code('notifai config explain <key>')}.`),
|
|
102
|
+
];
|
|
103
|
+
return lines.join('\n');
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/ui/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,IAAI,EAAqD,MAAM,WAAW,CAAA;AACnF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,kBAAkB;IACzB,KAAK,EAAE,WAAW;IAClB,KAAK,EAAE,yBAAyB;IAChC,QAAQ,EAAE,qBAAqB;IAC/B,IAAI,EAAE,OAAO;CACL,CAAA;AAEV,4DAA4D;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,gBAAgB;IACzB,YAAY,EAAE,iBAAiB;IAC/B,KAAK,EAAE,uBAAuB;IAC9B,QAAQ,EAAE,WAAW;CACb,CAAA;AAEV,iFAAiF;AACjF,MAAM,WAAW,GAAsB;IACrC,KAAK,CAAC,KAAK;IACX,KAAK,CAAC,KAAK;IACX,KAAK,CAAC,KAAK;IACX,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,IAAI;CACX,CAAA;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1C,6EAA6E;IAC7E,4EAA4E;IAC5E,iDAAiD;IACjD,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,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,EAAE,CAAC,IAAI;CAC3C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG;QACZ,EAAE;QACF,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;QAC3B,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,KAAK,CAAC,GAAG,CAClD,GAAG,KAAK,CAAC,KAAK,6DAA6D,CAC5E,EAAE;QACH,KAAK,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,oCAAoC,CAAC,EAAE;QAC1G,EAAE;QACF,KAAK,CAAC,GAAG,CAAC,uBAAuB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,8BAA8B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC3G,KAAK,CAAC,GAAG,CAAC,6BAA6B,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC;KAC/H,CAAA;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** True when the terminal can render the box-drawing and status glyphs below. */
|
|
2
|
+
export declare const unicode: boolean;
|
|
3
|
+
/** True when 24-bit colour is available, which the banner gradient needs. */
|
|
4
|
+
export declare function supportsTrueColor(env?: NodeJS.ProcessEnv): boolean;
|
|
5
|
+
export declare const color: import("picocolors/types.js").Colors & {
|
|
6
|
+
createColors: (enabled?: boolean) => import("picocolors/types.js").Colors;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Brand ramp, shared with the companion app icon: pink → coral → rose →
|
|
10
|
+
* magenta. Used for the wordmark and for accenting the surfaces a human sees.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BRAND_RAMP: readonly ["#FF9EC0", "#FF816B", "#EC5A73", "#B84E93"];
|
|
13
|
+
/**
|
|
14
|
+
* Sample the brand ramp at `t` in [0, 1]. Multi-stop so the gradient keeps the
|
|
15
|
+
* icon's coral midtones instead of washing straight from pink to magenta.
|
|
16
|
+
*/
|
|
17
|
+
export declare function rampAt(t: number, ramp?: readonly string[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Paint `text` across the brand ramp, one escape per character.
|
|
20
|
+
*
|
|
21
|
+
* Falls back to a single flat brand colour without truecolor, and to the bare
|
|
22
|
+
* string with colour off — a gradient is the most decorative thing this CLI
|
|
23
|
+
* does, so it must also be the first thing to degrade quietly.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gradient(text: string, ramp?: readonly string[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Paint each line of a block so the gradient runs left-to-right across the
|
|
28
|
+
* whole block rather than restarting per line. The wordmark is one image, and
|
|
29
|
+
* per-line gradients make it read as several.
|
|
30
|
+
*/
|
|
31
|
+
export declare function gradientBlock(lines: readonly string[], ramp?: readonly string[]): string[];
|
|
32
|
+
export declare const style: {
|
|
33
|
+
/** A heading that opens a section. */
|
|
34
|
+
readonly heading: (text: string) => string;
|
|
35
|
+
/** The brand voice — command names, the product name, the selected thing. */
|
|
36
|
+
readonly accent: (text: string) => string;
|
|
37
|
+
/** Secondary text: hints, provenance, units, defaults. */
|
|
38
|
+
readonly dim: (text: string) => string;
|
|
39
|
+
/** Something the reader can type. */
|
|
40
|
+
readonly code: (text: string) => string;
|
|
41
|
+
readonly ok: (text: string) => string;
|
|
42
|
+
readonly warn: (text: string) => string;
|
|
43
|
+
readonly bad: (text: string) => string;
|
|
44
|
+
/** A value as it currently stands. */
|
|
45
|
+
readonly value: (text: string) => string;
|
|
46
|
+
/** A value that is not set, or is inherited rather than chosen. */
|
|
47
|
+
readonly unset: (text: string) => string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Status marks. The glyph and the colour say the same thing twice on purpose;
|
|
51
|
+
* either alone is enough to read the line.
|
|
52
|
+
*/
|
|
53
|
+
export declare const glyph: {
|
|
54
|
+
readonly ok: "●" | "*";
|
|
55
|
+
readonly warn: "!" | "▲";
|
|
56
|
+
readonly bad: "✕" | "x";
|
|
57
|
+
readonly pending: "○" | "o";
|
|
58
|
+
readonly bullet: "•" | "-";
|
|
59
|
+
readonly arrow: "→" | "->";
|
|
60
|
+
readonly chevron: "›" | ">";
|
|
61
|
+
readonly bar: "│" | "|";
|
|
62
|
+
};
|
|
63
|
+
export type Tone = 'ok' | 'warn' | 'bad' | 'pending';
|
|
64
|
+
/** A coloured glyph for a tone; the caller supplies the words. */
|
|
65
|
+
export declare function mark(tone: Tone): string;
|
|
66
|
+
/** Visible width, ignoring ANSI escapes, for alignment maths. */
|
|
67
|
+
export declare function width(text: string): number;
|
|
68
|
+
/** Pad to `size` using visible width, so colour never breaks a column. */
|
|
69
|
+
export declare function pad(text: string, size: number): string;
|
|
70
|
+
/**
|
|
71
|
+
* Usable terminal width: the real one, capped so paragraphs do not run to 200
|
|
72
|
+
* characters on a maximised window.
|
|
73
|
+
*
|
|
74
|
+
* No lower clamp. Raising a narrow terminal to a comfortable minimum sounds
|
|
75
|
+
* harmless and is not — every box drawn to that invented width overflows the
|
|
76
|
+
* real one and wraps, which looks far worse than a cramped box that fits.
|
|
77
|
+
*/
|
|
78
|
+
export declare function terminalWidth(fallback?: number): number;
|
|
79
|
+
/**
|
|
80
|
+
* A titled box around `rows`.
|
|
81
|
+
*
|
|
82
|
+
* Hand-drawn rather than delegated, because the obvious library call sizes
|
|
83
|
+
* itself from `process.stdout.columns` and divides by it — a pty that reports
|
|
84
|
+
* zero columns (some CI runners, some `script` invocations) makes the padding
|
|
85
|
+
* negative and throws, taking the whole screen down with it. A status card is
|
|
86
|
+
* decoration; it may degrade, but it must never be what crashes the app.
|
|
87
|
+
*
|
|
88
|
+
* Rows are measured with `width`, so colour inside them does not skew the
|
|
89
|
+
* border, and anything too wide for the terminal is clipped rather than
|
|
90
|
+
* wrapped — a status line that wraps stops being a status line.
|
|
91
|
+
*/
|
|
92
|
+
export declare function card(title: string, rows: readonly string[], columns?: number): string[];
|
|
93
|
+
/**
|
|
94
|
+
* Truncate to a visible width, carrying escape sequences through untouched.
|
|
95
|
+
*
|
|
96
|
+
* Counting only printable characters is the whole point: slicing a coloured
|
|
97
|
+
* string by `String.length` cuts through an escape sequence and spills raw
|
|
98
|
+
* `[38;2` into the terminal.
|
|
99
|
+
*/
|
|
100
|
+
export declare function clip(text: string, limit: number): string;
|
|
101
|
+
/**
|
|
102
|
+
* Wrap `text` to `columns`, returning bare lines.
|
|
103
|
+
*
|
|
104
|
+
* Indentation is the caller's, deliberately: an earlier version indented
|
|
105
|
+
* continuation lines itself, callers indented every line as well, and each
|
|
106
|
+
* wrapped paragraph stepped further right down the page.
|
|
107
|
+
*/
|
|
108
|
+
export declare function wrap(text: string, columns: number): string[];
|