toolcraft 0.0.18 → 0.0.20
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.js +32 -34
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +3 -3
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +3 -3
- package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +0 -1
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +2 -22
- package/node_modules/@poe-code/config-mutations/package.json +1 -4
- package/node_modules/@poe-code/design-system/dist/acp/components.js +15 -13
- package/node_modules/@poe-code/design-system/dist/components/color.d.ts +31 -0
- package/node_modules/@poe-code/design-system/dist/components/color.js +101 -0
- package/node_modules/@poe-code/design-system/dist/components/index.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/components/index.js +2 -0
- package/node_modules/@poe-code/design-system/dist/components/logger.js +2 -2
- package/node_modules/@poe-code/design-system/dist/components/symbols.js +3 -3
- package/node_modules/@poe-code/design-system/dist/components/table.js +191 -40
- package/node_modules/@poe-code/design-system/dist/components/template.d.ts +6 -0
- package/node_modules/@poe-code/design-system/dist/components/template.js +271 -0
- package/node_modules/@poe-code/design-system/dist/components/text.js +3 -3
- package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +12 -12
- package/node_modules/@poe-code/design-system/dist/index.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/index.js +2 -0
- package/node_modules/@poe-code/design-system/dist/internal/color-support.d.ts +9 -0
- package/node_modules/@poe-code/design-system/dist/internal/color-support.js +12 -0
- package/node_modules/@poe-code/design-system/dist/prompts/index.d.ts +1 -1
- package/node_modules/@poe-code/design-system/dist/prompts/index.js +5 -4
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/cancel.js +2 -2
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +2 -2
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +4 -4
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +5 -5
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/outro.js +2 -2
- package/node_modules/@poe-code/design-system/dist/prompts/primitives/spinner.js +3 -3
- package/node_modules/@poe-code/design-system/dist/static/menu.js +5 -5
- package/node_modules/@poe-code/design-system/dist/static/spinner.js +8 -8
- package/node_modules/@poe-code/design-system/dist/tokens/colors.js +29 -29
- package/node_modules/@poe-code/design-system/dist/tokens/typography.js +6 -6
- package/node_modules/@poe-code/design-system/package.json +5 -3
- package/package.json +2 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../components/color.js";
|
|
2
2
|
import * as clack from "@clack/prompts";
|
|
3
3
|
import { resolveOutputFormat } from "../internal/output-format.js";
|
|
4
4
|
import { stripAnsi } from "../internal/strip-ansi.js";
|
|
@@ -19,7 +19,7 @@ export function introPlain(title) {
|
|
|
19
19
|
if (format === "json") {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
process.stdout.write(`${
|
|
22
|
+
process.stdout.write(`${color.gray("┌")} ${title}\n`);
|
|
23
23
|
}
|
|
24
24
|
export async function select(opts) {
|
|
25
25
|
return clack.select(opts);
|
|
@@ -80,6 +80,7 @@ function formatElapsed(ms) {
|
|
|
80
80
|
}
|
|
81
81
|
export async function withSpinner(options) {
|
|
82
82
|
const { message, fn, stopMessage, subtext } = options;
|
|
83
|
+
const readMessage = () => (typeof message === "function" ? message() : message);
|
|
83
84
|
if (resolveOutputFormat() === "json") {
|
|
84
85
|
const result = await fn();
|
|
85
86
|
const sub = subtext ? subtext(result) : undefined;
|
|
@@ -106,9 +107,9 @@ export async function withSpinner(options) {
|
|
|
106
107
|
}
|
|
107
108
|
const s = spinner();
|
|
108
109
|
const start = Date.now();
|
|
109
|
-
s.start(
|
|
110
|
+
s.start(readMessage());
|
|
110
111
|
const timer = setInterval(() => {
|
|
111
|
-
s.message(`${
|
|
112
|
+
s.message(`${readMessage()} [${formatElapsed(Date.now() - start)}]`);
|
|
112
113
|
}, 1000);
|
|
113
114
|
try {
|
|
114
115
|
const result = await fn();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../../components/color.js";
|
|
2
2
|
export { isCancel } from "@clack/prompts";
|
|
3
3
|
import { resolveOutputFormat } from "../../internal/output-format.js";
|
|
4
4
|
export function cancel(msg = "") {
|
|
5
5
|
if (resolveOutputFormat() !== "terminal") {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
|
-
process.stdout.write(`${
|
|
8
|
+
process.stdout.write(`${color.gray("└")} ${color.red(msg)}\n\n`);
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../../components/color.js";
|
|
2
2
|
import { text } from "../../components/text.js";
|
|
3
3
|
import { resolveOutputFormat } from "../../internal/output-format.js";
|
|
4
4
|
import { stripAnsi } from "../../internal/strip-ansi.js";
|
|
@@ -11,5 +11,5 @@ export function intro(title) {
|
|
|
11
11
|
process.stdout.write(`# ${stripAnsi(title)}\n\n`);
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
process.stdout.write(`${
|
|
14
|
+
process.stdout.write(`${color.gray("┌")} ${text.intro(title)}\n`);
|
|
15
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../../components/color.js";
|
|
2
2
|
import { symbols } from "../../components/symbols.js";
|
|
3
3
|
import { resolveOutputFormat } from "../../internal/output-format.js";
|
|
4
4
|
import { stripAnsi } from "../../internal/strip-ansi.js";
|
|
5
|
-
function writeTerminalMessage(msg, { symbol =
|
|
5
|
+
function writeTerminalMessage(msg, { symbol = color.gray("│"), secondarySymbol = color.gray("│"), spacing = 1, withGuide = true } = {}) {
|
|
6
6
|
const lines = [];
|
|
7
7
|
const showGuide = withGuide !== false;
|
|
8
8
|
const contentLines = msg.split("\n");
|
|
@@ -78,7 +78,7 @@ export function warn(msg) {
|
|
|
78
78
|
process.stdout.write(`${JSON.stringify({ level: "warn", message: stripAnsi(msg) })}\n`);
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
-
message(msg, { symbol:
|
|
81
|
+
message(msg, { symbol: color.yellow("▲") });
|
|
82
82
|
}
|
|
83
83
|
export function error(msg) {
|
|
84
84
|
const format = resolveOutputFormat();
|
|
@@ -90,7 +90,7 @@ export function error(msg) {
|
|
|
90
90
|
process.stdout.write(`${JSON.stringify({ level: "error", message: stripAnsi(msg) })}\n`);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
message(msg, { symbol:
|
|
93
|
+
message(msg, { symbol: color.red("■") });
|
|
94
94
|
}
|
|
95
95
|
export const log = {
|
|
96
96
|
info,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../../components/color.js";
|
|
2
2
|
import { resolveOutputFormat } from "../../internal/output-format.js";
|
|
3
3
|
import { stripAnsi } from "../../internal/strip-ansi.js";
|
|
4
4
|
function getVisibleWidth(value) {
|
|
@@ -8,13 +8,13 @@ function renderTerminalNote(message, title) {
|
|
|
8
8
|
const contentLines = ["", ...message.split("\n"), ""];
|
|
9
9
|
const visibleTitle = stripAnsi(title ?? "");
|
|
10
10
|
const contentWidth = Math.max(visibleTitle.length, ...contentLines.map((line) => getVisibleWidth(line))) + 2;
|
|
11
|
-
const titleLine = `${
|
|
11
|
+
const titleLine = `${color.green("◇")} ${color.reset(title ?? "")} ${color.gray(`${"─".repeat(Math.max(contentWidth - visibleTitle.length - 1, 1))}╮`)}`;
|
|
12
12
|
const content = contentLines.map((line) => {
|
|
13
13
|
const padding = " ".repeat(contentWidth - getVisibleWidth(line));
|
|
14
|
-
return `${
|
|
14
|
+
return `${color.gray("│")} ${line}${padding}${color.gray("│")}`;
|
|
15
15
|
});
|
|
16
|
-
const bottom =
|
|
17
|
-
return [
|
|
16
|
+
const bottom = color.gray(`├${"─".repeat(contentWidth + 2)}╯`);
|
|
17
|
+
return [color.gray("│"), titleLine, ...content, bottom].join("\n");
|
|
18
18
|
}
|
|
19
19
|
export function note(message, title) {
|
|
20
20
|
const format = resolveOutputFormat();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../../components/color.js";
|
|
2
2
|
import { resolveOutputFormat } from "../../internal/output-format.js";
|
|
3
3
|
import { stripAnsi } from "../../internal/strip-ansi.js";
|
|
4
4
|
export function outro(message) {
|
|
@@ -12,5 +12,5 @@ export function outro(message) {
|
|
|
12
12
|
process.stdout.write(`${JSON.stringify({ type: "outro", message: stripped })}\n`);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
process.stdout.write(`${
|
|
15
|
+
process.stdout.write(`${color.gray("│")}\n${color.gray("└")} ${message}\n\n`);
|
|
16
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../../components/color.js";
|
|
2
2
|
import { resolveOutputFormat } from "../../internal/output-format.js";
|
|
3
3
|
import { stripAnsi } from "../../internal/strip-ansi.js";
|
|
4
4
|
import { SPINNER_FRAMES } from "../../static/spinner.js";
|
|
@@ -62,8 +62,8 @@ export function spinner() {
|
|
|
62
62
|
}
|
|
63
63
|
clearTimer();
|
|
64
64
|
const symbol = code === undefined || code === 0
|
|
65
|
-
?
|
|
66
|
-
:
|
|
65
|
+
? color.green("◆")
|
|
66
|
+
: color.red("■");
|
|
67
67
|
if (fallback) {
|
|
68
68
|
process.stdout.write(`${symbol} ${currentMessage}\n`);
|
|
69
69
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../components/color.js";
|
|
2
2
|
import { symbols } from "../components/symbols.js";
|
|
3
3
|
import { resolveOutputFormat } from "../internal/output-format.js";
|
|
4
4
|
import { getTheme } from "../internal/theme-detect.js";
|
|
@@ -20,15 +20,15 @@ export function renderMenu(opts) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
const theme = getTheme();
|
|
23
|
-
const bar =
|
|
23
|
+
const bar = color.gray(symbols.bar);
|
|
24
24
|
const lines = [];
|
|
25
|
-
lines.push(`${
|
|
25
|
+
lines.push(`${color.cyan(symbols.active)} ${opts.message}`);
|
|
26
26
|
lines.push(bar);
|
|
27
27
|
opts.options.forEach((option, index) => {
|
|
28
28
|
const isSelected = index === selectedIndex;
|
|
29
|
-
const prefix = isSelected ?
|
|
29
|
+
const prefix = isSelected ? color.cyan(symbols.active) : color.gray(symbols.inactive);
|
|
30
30
|
const label = isSelected ? theme.accent(option.label) : option.label;
|
|
31
|
-
const hint = option.hint ?
|
|
31
|
+
const hint = option.hint ? color.dim(` (${option.hint})`) : "";
|
|
32
32
|
lines.push(`${bar} ${prefix} ${label}${hint}`);
|
|
33
33
|
});
|
|
34
34
|
lines.push(`${bar}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../components/color.js";
|
|
2
2
|
import { symbols } from "../components/symbols.js";
|
|
3
3
|
import { resolveOutputFormat } from "../internal/output-format.js";
|
|
4
4
|
export const SPINNER_FRAMES = ["◒", "◐", "◓", "◑"];
|
|
@@ -16,9 +16,9 @@ export function renderSpinnerFrame(options) {
|
|
|
16
16
|
})}\n`;
|
|
17
17
|
}
|
|
18
18
|
const frame = options.frame ?? 0;
|
|
19
|
-
const spinnerChar =
|
|
20
|
-
const timerSuffix = options.timer ?
|
|
21
|
-
const bar =
|
|
19
|
+
const spinnerChar = color.magenta(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
|
|
20
|
+
const timerSuffix = options.timer ? color.dim(` [${options.timer}]`) : "";
|
|
21
|
+
const bar = color.gray(symbols.bar);
|
|
22
22
|
return `${spinnerChar} ${options.message}${timerSuffix}\n${bar}`;
|
|
23
23
|
}
|
|
24
24
|
export function renderSpinnerStopped(options) {
|
|
@@ -35,12 +35,12 @@ export function renderSpinnerStopped(options) {
|
|
|
35
35
|
})}\n`;
|
|
36
36
|
}
|
|
37
37
|
const code = options.code ?? 0;
|
|
38
|
-
const symbol = code === 0 ?
|
|
39
|
-
const timerSuffix = options.timer ?
|
|
40
|
-
const bar =
|
|
38
|
+
const symbol = code === 0 ? color.green("◆") : color.red("■");
|
|
39
|
+
const timerSuffix = options.timer ? color.dim(` [${options.timer}]`) : "";
|
|
40
|
+
const bar = color.gray(symbols.bar);
|
|
41
41
|
let output = `${symbol} ${options.message}${timerSuffix}`;
|
|
42
42
|
if (options.subtext) {
|
|
43
|
-
output += `\n${bar} ${
|
|
43
|
+
output += `\n${bar} ${color.dim(options.subtext)}`;
|
|
44
44
|
}
|
|
45
45
|
return output;
|
|
46
46
|
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../components/color.js";
|
|
2
2
|
export const brand = "#a200ff";
|
|
3
3
|
export const dark = {
|
|
4
|
-
header: (text) =>
|
|
5
|
-
divider: (text) =>
|
|
6
|
-
prompt: (text) =>
|
|
7
|
-
number: (text) =>
|
|
8
|
-
intro: (text) =>
|
|
9
|
-
resolvedSymbol:
|
|
10
|
-
errorSymbol:
|
|
11
|
-
accent: (text) =>
|
|
12
|
-
muted: (text) =>
|
|
13
|
-
success: (text) =>
|
|
14
|
-
warning: (text) =>
|
|
15
|
-
error: (text) =>
|
|
16
|
-
info: (text) =>
|
|
17
|
-
badge: (text) =>
|
|
4
|
+
header: (text) => color.magentaBright.bold(text),
|
|
5
|
+
divider: (text) => color.dim(text),
|
|
6
|
+
prompt: (text) => color.cyan(text),
|
|
7
|
+
number: (text) => color.cyanBright(text),
|
|
8
|
+
intro: (text) => color.bgMagenta.white(` Poe - ${text} `),
|
|
9
|
+
resolvedSymbol: color.magenta("◇"),
|
|
10
|
+
errorSymbol: color.red("■"),
|
|
11
|
+
accent: (text) => color.cyan(text),
|
|
12
|
+
muted: (text) => color.dim(text),
|
|
13
|
+
success: (text) => color.green(text),
|
|
14
|
+
warning: (text) => color.yellow(text),
|
|
15
|
+
error: (text) => color.red(text),
|
|
16
|
+
info: (text) => color.magenta(text),
|
|
17
|
+
badge: (text) => color.bgYellow.black(` ${text} `)
|
|
18
18
|
};
|
|
19
19
|
export const light = {
|
|
20
|
-
header: (text) =>
|
|
21
|
-
divider: (text) =>
|
|
22
|
-
prompt: (text) =>
|
|
23
|
-
number: (text) =>
|
|
24
|
-
intro: (text) =>
|
|
25
|
-
resolvedSymbol:
|
|
26
|
-
errorSymbol:
|
|
27
|
-
accent: (text) =>
|
|
28
|
-
muted: (text) =>
|
|
29
|
-
success: (text) =>
|
|
30
|
-
warning: (text) =>
|
|
31
|
-
error: (text) =>
|
|
32
|
-
info: (text) =>
|
|
33
|
-
badge: (text) =>
|
|
20
|
+
header: (text) => color.hex("#a200ff").bold(text),
|
|
21
|
+
divider: (text) => color.hex("#666666")(text),
|
|
22
|
+
prompt: (text) => color.hex("#006699").bold(text),
|
|
23
|
+
number: (text) => color.hex("#0077cc").bold(text),
|
|
24
|
+
intro: (text) => color.bgHex("#a200ff").white(` Poe - ${text} `),
|
|
25
|
+
resolvedSymbol: color.hex("#a200ff")("◇"),
|
|
26
|
+
errorSymbol: color.hex("#cc0000")("■"),
|
|
27
|
+
accent: (text) => color.hex("#006699").bold(text),
|
|
28
|
+
muted: (text) => color.hex("#666666")(text),
|
|
29
|
+
success: (text) => color.hex("#008800")(text),
|
|
30
|
+
warning: (text) => color.hex("#cc6600")(text),
|
|
31
|
+
error: (text) => color.hex("#cc0000")(text),
|
|
32
|
+
info: (text) => color.hex("#a200ff")(text),
|
|
33
|
+
badge: (text) => color.bgHex("#cc6600").white(` ${text} `)
|
|
34
34
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from "../components/color.js";
|
|
2
2
|
export const typography = {
|
|
3
|
-
bold: (text) =>
|
|
4
|
-
dim: (text) =>
|
|
5
|
-
italic: (text) =>
|
|
6
|
-
underline: (text) =>
|
|
7
|
-
strikethrough: (text) =>
|
|
3
|
+
bold: (text) => color.bold(text),
|
|
4
|
+
dim: (text) => color.dim(text),
|
|
5
|
+
italic: (text) => color.italic(text),
|
|
6
|
+
underline: (text) => color.underline(text),
|
|
7
|
+
strikethrough: (text) => color.strikethrough(text)
|
|
8
8
|
};
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@clack/prompts": "^1.0.0"
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
"@clack/prompts": "^1.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/mustache": "^4.2.6",
|
|
26
|
+
"mustache": "^4.2.0"
|
|
25
27
|
}
|
|
26
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,15 +45,12 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@clack/core": "^1.0.0",
|
|
47
47
|
"@clack/prompts": "^1.0.0",
|
|
48
|
-
"chalk": "^5.6.2",
|
|
49
48
|
"commander": "^14.0.3",
|
|
50
|
-
"console-table-printer": "^2.15.0",
|
|
51
49
|
"jose": "^6.1.2",
|
|
52
50
|
"jsonc-parser": "^3.3.1",
|
|
53
|
-
"mustache": "^4.2.0",
|
|
54
51
|
"smol-toml": "^1.3.0",
|
|
55
52
|
"tiny-stdio-mcp-server": "^0.1.0",
|
|
56
|
-
"toolcraft-schema": "^0.0.
|
|
53
|
+
"toolcraft-schema": "^0.0.20",
|
|
57
54
|
"yaml": "^2.8.2"
|
|
58
55
|
},
|
|
59
56
|
"files": [
|