@notchlet/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.
- package/dist/cli-format.js +46 -0
- package/dist/cli-prompt.js +73 -0
- package/dist/cli.js +895 -258
- package/dist/guidance-install.js +58 -35
- package/guidance/aliases.json +27 -27
- package/guidance/generated/claude-code/notchlet-deliver/SKILL.md +94 -0
- package/guidance/generated/claude-code/notchlet-implement/SKILL.md +94 -0
- package/guidance/generated/claude-code/notchlet-init/SKILL.md +30 -0
- package/guidance/generated/claude-code/notchlet-mcp/SKILL.md +60 -0
- package/guidance/generated/claude-code/notchlet-plan/SKILL.md +100 -0
- package/guidance/generated/claude-code/notchlet-platform/SKILL.md +85 -0
- package/guidance/generated/claude-code/notchlet-review/SKILL.md +68 -0
- package/guidance/generated/claude-code/notchlet-super/SKILL.md +47 -47
- package/guidance/generated/compatibility.json +7 -0
- package/guidance/generated/manifest.json +127 -5
- package/guidance/generated/opencode/notchlet-deliver/SKILL.md +94 -0
- package/guidance/generated/opencode/notchlet-implement/SKILL.md +94 -0
- package/guidance/generated/opencode/notchlet-init/SKILL.md +30 -0
- package/guidance/generated/opencode/notchlet-mcp/SKILL.md +60 -0
- package/guidance/generated/opencode/notchlet-plan/SKILL.md +100 -0
- package/guidance/generated/opencode/notchlet-platform/SKILL.md +85 -0
- package/guidance/generated/opencode/notchlet-review/SKILL.md +68 -0
- package/guidance/generated/opencode/notchlet-super/SKILL.md +47 -47
- package/package.json +1 -1
- package/scripts/generate-guidance.mjs +56 -20
- package/guidance/notchlet-super.md +0 -47
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const BOLD = '\x1b[1m';
|
|
2
|
+
const DIM = '\x1b[2m';
|
|
3
|
+
const GREEN = '\x1b[32m';
|
|
4
|
+
const RED = '\x1b[31m';
|
|
5
|
+
const YELLOW = '\x1b[33m';
|
|
6
|
+
const CYAN = '\x1b[36m';
|
|
7
|
+
const RESET = '\x1b[0m';
|
|
8
|
+
const supportsColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
9
|
+
const c = (code) => (supportsColor ? code : '');
|
|
10
|
+
const wrap = (str, code) => (supportsColor ? `${code}${str}${RESET}` : str);
|
|
11
|
+
export function section(title) {
|
|
12
|
+
return `${c(BOLD)}${title}${RESET}`;
|
|
13
|
+
}
|
|
14
|
+
export function kv(label, value) {
|
|
15
|
+
return ` ${c(DIM)}${label}${RESET}: ${value}`;
|
|
16
|
+
}
|
|
17
|
+
export function bullet(text, prefix = '•') {
|
|
18
|
+
return ` ${c(CYAN)}${prefix}${RESET} ${text}`;
|
|
19
|
+
}
|
|
20
|
+
export function ok(text) {
|
|
21
|
+
return wrap(text, GREEN);
|
|
22
|
+
}
|
|
23
|
+
export function err(text) {
|
|
24
|
+
return wrap(text, RED);
|
|
25
|
+
}
|
|
26
|
+
export function warn(text) {
|
|
27
|
+
return wrap(text, YELLOW);
|
|
28
|
+
}
|
|
29
|
+
export function table(headers, rows) {
|
|
30
|
+
if (rows.length === 0)
|
|
31
|
+
return `${c(DIM)}(none)${RESET}`;
|
|
32
|
+
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)));
|
|
33
|
+
const line = (cells) => cells.map((cell, i) => cell.padEnd(widths[i])).join(' ');
|
|
34
|
+
const out = [];
|
|
35
|
+
out.push(line(headers));
|
|
36
|
+
out.push(widths.map((w) => '-'.repeat(w)).join(' '));
|
|
37
|
+
for (const row of rows)
|
|
38
|
+
out.push(line(row));
|
|
39
|
+
return out.join('\n');
|
|
40
|
+
}
|
|
41
|
+
export function box(lines) {
|
|
42
|
+
return lines.join('\n');
|
|
43
|
+
}
|
|
44
|
+
export function divider() {
|
|
45
|
+
return c(DIM) + '──────────────────────────────────────────────────────────────' + RESET;
|
|
46
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline/promises';
|
|
2
|
+
export function isTty() {
|
|
3
|
+
return Boolean(process.stdin.isTTY && process.stderr.isTTY);
|
|
4
|
+
}
|
|
5
|
+
export async function prompt(text) {
|
|
6
|
+
if (!isTty())
|
|
7
|
+
throw new Error(`Interactive input required but not a TTY: ${text}`);
|
|
8
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
9
|
+
try {
|
|
10
|
+
return (await rl.question(text)).trim();
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
rl.close();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function secret(text = 'Value (input hidden): ') {
|
|
17
|
+
const input = process.stdin, output = process.stderr;
|
|
18
|
+
if (!input.isTTY || !output.isTTY || !input.setRawMode)
|
|
19
|
+
throw new Error('Hidden input requires a TTY.');
|
|
20
|
+
output.write(text);
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
let value = '';
|
|
23
|
+
const finish = (error) => { input.setRawMode(false); input.pause(); input.removeListener('data', onData); output.write('\n'); error ? reject(error) : resolve(value); };
|
|
24
|
+
const onData = (chunk) => {
|
|
25
|
+
for (const byte of chunk) {
|
|
26
|
+
if (byte === 3)
|
|
27
|
+
return finish(new Error('Cancelled.'));
|
|
28
|
+
if (byte === 13 || byte === 10)
|
|
29
|
+
return finish();
|
|
30
|
+
if (byte === 8 || byte === 127)
|
|
31
|
+
value = value.slice(0, -1);
|
|
32
|
+
else
|
|
33
|
+
value += String.fromCharCode(byte);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
input.setRawMode(true);
|
|
37
|
+
input.resume();
|
|
38
|
+
input.on('data', onData);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export async function confirm(text, defaultYes = false) {
|
|
42
|
+
if (!isTty())
|
|
43
|
+
return defaultYes;
|
|
44
|
+
const suffix = defaultYes ? ' [Y/n]' : ' [y/N]';
|
|
45
|
+
const answer = (await prompt(`${text}${suffix}: `)).toLowerCase();
|
|
46
|
+
if (answer === '')
|
|
47
|
+
return defaultYes;
|
|
48
|
+
return answer === 'y' || answer === 'yes';
|
|
49
|
+
}
|
|
50
|
+
/** If value is already set, return it. Otherwise interactively prompt. Returns undefined if not a TTY and no value. */
|
|
51
|
+
export async function requiredString(value, promptText) {
|
|
52
|
+
if (value)
|
|
53
|
+
return value;
|
|
54
|
+
if (!isTty())
|
|
55
|
+
return undefined;
|
|
56
|
+
return await prompt(promptText);
|
|
57
|
+
}
|
|
58
|
+
export async function requiredNumber(value, promptText) {
|
|
59
|
+
if (value) {
|
|
60
|
+
const n = Number(value);
|
|
61
|
+
if (Number.isSafeInteger(n))
|
|
62
|
+
return n;
|
|
63
|
+
}
|
|
64
|
+
if (!isTty())
|
|
65
|
+
return undefined;
|
|
66
|
+
while (true) {
|
|
67
|
+
const answer = await prompt(promptText);
|
|
68
|
+
const n = Number(answer);
|
|
69
|
+
if (Number.isSafeInteger(n))
|
|
70
|
+
return n;
|
|
71
|
+
process.stderr.write('Enter a valid integer.\n');
|
|
72
|
+
}
|
|
73
|
+
}
|