toolcraft 0.0.17 → 0.0.19

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.
Files changed (109) hide show
  1. package/dist/cli.d.ts +2 -0
  2. package/dist/cli.js +833 -124
  3. package/dist/error-report.d.ts +39 -0
  4. package/dist/error-report.js +330 -0
  5. package/dist/human-in-loop/approval-tasks.js +11 -8
  6. package/dist/human-in-loop/approvals-commands.js +21 -20
  7. package/dist/human-in-loop/default-provider.js +5 -3
  8. package/dist/human-in-loop/runner.js +45 -4
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +55 -35
  11. package/dist/json-schema-converter.d.ts +1 -0
  12. package/dist/json-schema-converter.js +102 -52
  13. package/dist/mcp-proxy.d.ts +1 -0
  14. package/dist/mcp-proxy.js +13 -6
  15. package/dist/mcp.d.ts +2 -0
  16. package/dist/mcp.js +131 -55
  17. package/dist/sdk.d.ts +4 -2
  18. package/dist/sdk.js +132 -48
  19. package/dist/source-snippet.d.ts +8 -0
  20. package/dist/source-snippet.js +42 -0
  21. package/dist/stack-trim.d.ts +4 -0
  22. package/dist/stack-trim.js +70 -0
  23. package/dist/suggest.d.ts +4 -0
  24. package/dist/suggest.js +46 -0
  25. package/dist/user-error.d.ts +3 -0
  26. package/dist/user-error.js +7 -1
  27. package/dist/validation-errors.d.ts +5 -0
  28. package/dist/validation-errors.js +18 -0
  29. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +3 -3
  30. package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +3 -3
  31. package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +0 -1
  32. package/node_modules/@poe-code/config-mutations/dist/template/render.js +2 -22
  33. package/node_modules/@poe-code/config-mutations/package.json +1 -4
  34. package/node_modules/@poe-code/design-system/dist/acp/components.js +15 -13
  35. package/node_modules/@poe-code/design-system/dist/components/color.d.ts +31 -0
  36. package/node_modules/@poe-code/design-system/dist/components/color.js +101 -0
  37. package/node_modules/@poe-code/design-system/dist/components/help-formatter-plain.d.ts +1 -0
  38. package/node_modules/@poe-code/design-system/dist/components/help-formatter-plain.js +1 -1
  39. package/node_modules/@poe-code/design-system/dist/components/index.d.ts +4 -0
  40. package/node_modules/@poe-code/design-system/dist/components/index.js +2 -0
  41. package/node_modules/@poe-code/design-system/dist/components/logger.js +2 -2
  42. package/node_modules/@poe-code/design-system/dist/components/symbols.js +3 -3
  43. package/node_modules/@poe-code/design-system/dist/components/table.js +191 -40
  44. package/node_modules/@poe-code/design-system/dist/components/template.d.ts +6 -0
  45. package/node_modules/@poe-code/design-system/dist/components/template.js +271 -0
  46. package/node_modules/@poe-code/design-system/dist/components/text.d.ts +1 -0
  47. package/node_modules/@poe-code/design-system/dist/components/text.js +11 -3
  48. package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +20 -13
  49. package/node_modules/@poe-code/design-system/dist/dashboard/keymap.d.ts +5 -0
  50. package/node_modules/@poe-code/design-system/dist/dashboard/keymap.js +146 -12
  51. package/node_modules/@poe-code/design-system/dist/dashboard/terminal.js +31 -0
  52. package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
  53. package/node_modules/@poe-code/design-system/dist/explorer/actions.d.ts +16 -0
  54. package/node_modules/@poe-code/design-system/dist/explorer/actions.js +39 -0
  55. package/node_modules/@poe-code/design-system/dist/explorer/demo.d.ts +13 -0
  56. package/node_modules/@poe-code/design-system/dist/explorer/demo.js +297 -0
  57. package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +61 -0
  58. package/node_modules/@poe-code/design-system/dist/explorer/events.js +1 -0
  59. package/node_modules/@poe-code/design-system/dist/explorer/filter.d.ts +10 -0
  60. package/node_modules/@poe-code/design-system/dist/explorer/filter.js +95 -0
  61. package/node_modules/@poe-code/design-system/dist/explorer/index.d.ts +8 -0
  62. package/node_modules/@poe-code/design-system/dist/explorer/index.js +8 -0
  63. package/node_modules/@poe-code/design-system/dist/explorer/jobs.d.ts +7 -0
  64. package/node_modules/@poe-code/design-system/dist/explorer/jobs.js +59 -0
  65. package/node_modules/@poe-code/design-system/dist/explorer/keymap.d.ts +21 -0
  66. package/node_modules/@poe-code/design-system/dist/explorer/keymap.js +363 -0
  67. package/node_modules/@poe-code/design-system/dist/explorer/layout.d.ts +20 -0
  68. package/node_modules/@poe-code/design-system/dist/explorer/layout.js +73 -0
  69. package/node_modules/@poe-code/design-system/dist/explorer/reducer.d.ts +9 -0
  70. package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +704 -0
  71. package/node_modules/@poe-code/design-system/dist/explorer/render/detail.d.ts +4 -0
  72. package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +96 -0
  73. package/node_modules/@poe-code/design-system/dist/explorer/render/footer.d.ts +4 -0
  74. package/node_modules/@poe-code/design-system/dist/explorer/render/footer.js +49 -0
  75. package/node_modules/@poe-code/design-system/dist/explorer/render/header.d.ts +4 -0
  76. package/node_modules/@poe-code/design-system/dist/explorer/render/header.js +56 -0
  77. package/node_modules/@poe-code/design-system/dist/explorer/render/index.d.ts +8 -0
  78. package/node_modules/@poe-code/design-system/dist/explorer/render/index.js +61 -0
  79. package/node_modules/@poe-code/design-system/dist/explorer/render/list.d.ts +4 -0
  80. package/node_modules/@poe-code/design-system/dist/explorer/render/list.js +106 -0
  81. package/node_modules/@poe-code/design-system/dist/explorer/render/modal.d.ts +3 -0
  82. package/node_modules/@poe-code/design-system/dist/explorer/render/modal.js +91 -0
  83. package/node_modules/@poe-code/design-system/dist/explorer/render/test-fixtures.d.ts +8 -0
  84. package/node_modules/@poe-code/design-system/dist/explorer/render/test-fixtures.js +156 -0
  85. package/node_modules/@poe-code/design-system/dist/explorer/runtime.d.ts +2 -0
  86. package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +282 -0
  87. package/node_modules/@poe-code/design-system/dist/explorer/runtime.test-helpers.d.ts +50 -0
  88. package/node_modules/@poe-code/design-system/dist/explorer/runtime.test-helpers.js +101 -0
  89. package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +130 -0
  90. package/node_modules/@poe-code/design-system/dist/explorer/state.js +87 -0
  91. package/node_modules/@poe-code/design-system/dist/explorer/theme.d.ts +27 -0
  92. package/node_modules/@poe-code/design-system/dist/explorer/theme.js +97 -0
  93. package/node_modules/@poe-code/design-system/dist/index.d.ts +7 -0
  94. package/node_modules/@poe-code/design-system/dist/index.js +5 -0
  95. package/node_modules/@poe-code/design-system/dist/internal/color-support.d.ts +9 -0
  96. package/node_modules/@poe-code/design-system/dist/internal/color-support.js +12 -0
  97. package/node_modules/@poe-code/design-system/dist/prompts/index.js +2 -2
  98. package/node_modules/@poe-code/design-system/dist/prompts/primitives/cancel.js +2 -2
  99. package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +2 -2
  100. package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +4 -4
  101. package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +5 -5
  102. package/node_modules/@poe-code/design-system/dist/prompts/primitives/outro.js +2 -2
  103. package/node_modules/@poe-code/design-system/dist/prompts/primitives/spinner.js +3 -3
  104. package/node_modules/@poe-code/design-system/dist/static/menu.js +5 -5
  105. package/node_modules/@poe-code/design-system/dist/static/spinner.js +8 -8
  106. package/node_modules/@poe-code/design-system/dist/tokens/colors.js +29 -29
  107. package/node_modules/@poe-code/design-system/dist/tokens/typography.js +6 -6
  108. package/node_modules/@poe-code/design-system/package.json +6 -3
  109. package/package.json +6 -5
@@ -0,0 +1,97 @@
1
+ export function getExplorerTheme() {
2
+ return {
3
+ accent: accent,
4
+ muted: muted,
5
+ border: muted,
6
+ borderFocused: accent,
7
+ badge: (text, tone) => tonePainter(tone)(` ${text} `),
8
+ matchHighlight: (text) => accent(`\u001b[4m${text}\u001b[24m`)
9
+ };
10
+ }
11
+ export function getExplorerStyles() {
12
+ return resolveThemeName() === "light"
13
+ ? {
14
+ accent: { fg: "#006699", bold: true },
15
+ muted: { fg: "#666666" },
16
+ border: { fg: "#666666" },
17
+ borderFocused: { fg: "#006699", bold: true },
18
+ matchHighlight: { fg: "#006699", bold: true, underline: true },
19
+ tones: {
20
+ success: { fg: "#008800" },
21
+ warning: { fg: "#cc6600" },
22
+ error: { fg: "#cc0000" },
23
+ info: { fg: "#a200ff" },
24
+ muted: { fg: "#666666" }
25
+ }
26
+ }
27
+ : {
28
+ accent: { fg: "cyan", bold: true },
29
+ muted: { dim: true },
30
+ border: { dim: true },
31
+ borderFocused: { fg: "cyan", bold: true },
32
+ matchHighlight: { fg: "cyan", bold: true, underline: true },
33
+ tones: {
34
+ success: { fg: "green" },
35
+ warning: { fg: "yellow" },
36
+ error: { fg: "red" },
37
+ info: { fg: "magenta" },
38
+ muted: { dim: true }
39
+ }
40
+ };
41
+ }
42
+ function tonePainter(tone) {
43
+ const light = resolveThemeName() === "light";
44
+ if (tone === "success") {
45
+ return light ? hex(0, 136, 0) : ansi(32);
46
+ }
47
+ if (tone === "warning") {
48
+ return light ? hex(204, 102, 0) : ansi(33);
49
+ }
50
+ if (tone === "error") {
51
+ return light ? hex(204, 0, 0) : ansi(31);
52
+ }
53
+ if (tone === "info") {
54
+ return light ? hex(162, 0, 255) : ansi(35);
55
+ }
56
+ return muted;
57
+ }
58
+ function accent(text) {
59
+ return resolveThemeName() === "light" ? ansi(38, 2, 0, 102, 153, 1)(text) : ansi(36)(text);
60
+ }
61
+ function muted(text) {
62
+ return resolveThemeName() === "light" ? hex(102, 102, 102)(text) : ansi(2)(text);
63
+ }
64
+ function hex(red, green, blue) {
65
+ return ansi(38, 2, red, green, blue);
66
+ }
67
+ function ansi(...codes) {
68
+ return (text) => `\u001b[${codes.join(";")}m${text}\u001b[0m`;
69
+ }
70
+ function resolveThemeName(env = process.env) {
71
+ const raw = (env.POE_CODE_THEME ?? env.POE_THEME)?.toLowerCase();
72
+ if (raw === "light" || raw === "dark") {
73
+ return raw;
74
+ }
75
+ const apple = env.APPLE_INTERFACE_STYLE;
76
+ if (typeof apple === "string") {
77
+ return apple.toLowerCase() === "dark" ? "dark" : "light";
78
+ }
79
+ const vscodeKind = env.VSCODE_COLOR_THEME_KIND;
80
+ if (typeof vscodeKind === "string") {
81
+ const normalized = vscodeKind.toLowerCase();
82
+ if (normalized.includes("light")) {
83
+ return "light";
84
+ }
85
+ if (normalized.includes("dark")) {
86
+ return "dark";
87
+ }
88
+ }
89
+ const colorFGBG = env.COLORFGBG;
90
+ if (typeof colorFGBG === "string") {
91
+ const background = Number.parseInt(colorFGBG.split(";").at(-1) ?? "", 10);
92
+ if (Number.isFinite(background)) {
93
+ return background >= 8 ? "light" : "dark";
94
+ }
95
+ }
96
+ return "dark";
97
+ }
@@ -5,6 +5,8 @@ export { spacing } from "./tokens/spacing.js";
5
5
  export { typography } from "./tokens/typography.js";
6
6
  export { widths } from "./tokens/widths.js";
7
7
  export { text } from "./components/text.js";
8
+ export { color } from "./components/color.js";
9
+ export type { Color } from "./components/color.js";
8
10
  export { symbols } from "./components/symbols.js";
9
11
  export { createLogger, logger } from "./components/logger.js";
10
12
  export type { LoggerOutput } from "./components/logger.js";
@@ -15,10 +17,15 @@ export { formatCommandNotFound } from "./components/command-errors.js";
15
17
  export { formatCommandNotFoundPanel } from "./components/command-errors.js";
16
18
  export { renderTable } from "./components/table.js";
17
19
  export type { TableColumn, RenderTableOptions } from "./components/table.js";
20
+ export { renderTemplate } from "./components/template.js";
21
+ export type { RenderTemplateOptions, TemplateEscape } from "./components/template.js";
18
22
  export * as acp from "./acp/index.js";
19
23
  export * as dashboard from "./dashboard/index.js";
20
24
  export { createDashboard, shouldUseInteractiveDashboard } from "./dashboard/index.js";
21
25
  export type { Dashboard, DashboardOptions } from "./dashboard/index.js";
26
+ export * as explorer from "./explorer/index.js";
27
+ export { runExplorer, singleDetail } from "./explorer/index.js";
28
+ export type { Row, DetailItem, Detail, DetailCtx, Action, ActionContext, ExplorerConfig, Tone, } from "./explorer/index.js";
22
29
  export * as prompts from "./prompts/index.js";
23
30
  export { intro, introPlain, outro, note, select, multiselect, text as promptText, confirm, confirmOrCancel, password, spinner, withSpinner, isCancel, cancel, log, PromptCancelledError } from "./prompts/index.js";
24
31
  export type { SelectOptions, MultiselectOptions, TextOptions, ConfirmOptions, PasswordOptions, SpinnerOptions, WithSpinnerOptions } from "./prompts/index.js";
@@ -6,6 +6,7 @@ export { typography } from "./tokens/typography.js";
6
6
  export { widths } from "./tokens/widths.js";
7
7
  // Components
8
8
  export { text } from "./components/text.js";
9
+ export { color } from "./components/color.js";
9
10
  export { symbols } from "./components/symbols.js";
10
11
  export { createLogger, logger } from "./components/logger.js";
11
12
  export { helpFormatter, formatColumns, formatCommand, formatUsage, formatOption, formatCommandList, formatOptionList } from "./components/help-formatter.js";
@@ -13,11 +14,15 @@ export * as helpFormatterPlain from "./components/help-formatter-plain.js";
13
14
  export { formatCommandNotFound } from "./components/command-errors.js";
14
15
  export { formatCommandNotFoundPanel } from "./components/command-errors.js";
15
16
  export { renderTable } from "./components/table.js";
17
+ export { renderTemplate } from "./components/template.js";
16
18
  // ACP rendering
17
19
  export * as acp from "./acp/index.js";
18
20
  // Dashboard
19
21
  export * as dashboard from "./dashboard/index.js";
20
22
  export { createDashboard, shouldUseInteractiveDashboard } from "./dashboard/index.js";
23
+ // Explorer
24
+ export * as explorer from "./explorer/index.js";
25
+ export { runExplorer, singleDetail } from "./explorer/index.js";
21
26
  // Prompts
22
27
  export * as prompts from "./prompts/index.js";
23
28
  export { intro, introPlain, outro, note, select, multiselect, text as promptText, confirm, confirmOrCancel, password, spinner, withSpinner, isCancel, cancel, log, PromptCancelledError } from "./prompts/index.js";
@@ -0,0 +1,9 @@
1
+ export interface ColorSupportEnv {
2
+ NO_COLOR?: string;
3
+ FORCE_COLOR?: string;
4
+ TERM?: string;
5
+ }
6
+ export interface ColorSupportStream {
7
+ isTTY?: boolean;
8
+ }
9
+ export declare function supportsColor(env?: ColorSupportEnv, stream?: ColorSupportStream): boolean;
@@ -0,0 +1,12 @@
1
+ export function supportsColor(env = process.env, stream = process.stdout) {
2
+ if (env.FORCE_COLOR !== undefined && env.FORCE_COLOR !== "0") {
3
+ return true;
4
+ }
5
+ if (env.NO_COLOR !== undefined) {
6
+ return false;
7
+ }
8
+ if (stream.isTTY !== true) {
9
+ return false;
10
+ }
11
+ return typeof env.TERM === "string" && env.TERM.length > 0 && env.TERM !== "dumb";
12
+ }
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
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(`${chalk.gray("┌")} ${title}\n`);
22
+ process.stdout.write(`${color.gray("┌")} ${title}\n`);
23
23
  }
24
24
  export async function select(opts) {
25
25
  return clack.select(opts);
@@ -1,9 +1,9 @@
1
- import chalk from "chalk";
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(`${chalk.gray("└")} ${chalk.red(msg)}\n\n`);
8
+ process.stdout.write(`${color.gray("└")} ${color.red(msg)}\n\n`);
9
9
  }
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
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(`${chalk.gray("┌")} ${text.intro(title)}\n`);
14
+ process.stdout.write(`${color.gray("┌")} ${text.intro(title)}\n`);
15
15
  }
@@ -1,8 +1,8 @@
1
- import chalk from "chalk";
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 = chalk.gray("│"), secondarySymbol = chalk.gray("│"), spacing = 1, withGuide = true } = {}) {
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: chalk.yellow("▲") });
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: chalk.red("■") });
93
+ message(msg, { symbol: color.red("■") });
94
94
  }
95
95
  export const log = {
96
96
  info,
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
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 = `${chalk.green("◇")} ${chalk.reset(title ?? "")} ${chalk.gray(`${"─".repeat(Math.max(contentWidth - visibleTitle.length - 1, 1))}╮`)}`;
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 `${chalk.gray("│")} ${line}${padding}${chalk.gray("│")}`;
14
+ return `${color.gray("│")} ${line}${padding}${color.gray("│")}`;
15
15
  });
16
- const bottom = chalk.gray(`├${"─".repeat(contentWidth + 2)}╯`);
17
- return [chalk.gray("│"), titleLine, ...content, bottom].join("\n");
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 chalk from "chalk";
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(`${chalk.gray("│")}\n${chalk.gray("└")} ${message}\n\n`);
15
+ process.stdout.write(`${color.gray("│")}\n${color.gray("└")} ${message}\n\n`);
16
16
  }
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
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
- ? chalk.green("◆")
66
- : chalk.red("■");
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 chalk from "chalk";
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 = chalk.gray(symbols.bar);
23
+ const bar = color.gray(symbols.bar);
24
24
  const lines = [];
25
- lines.push(`${chalk.cyan(symbols.active)} ${opts.message}`);
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 ? chalk.cyan(symbols.active) : chalk.gray(symbols.inactive);
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 ? chalk.dim(` (${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 chalk from "chalk";
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 = chalk.magenta(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
20
- const timerSuffix = options.timer ? chalk.dim(` [${options.timer}]`) : "";
21
- const bar = chalk.gray(symbols.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 ? chalk.green("◆") : chalk.red("■");
39
- const timerSuffix = options.timer ? chalk.dim(` [${options.timer}]`) : "";
40
- const bar = chalk.gray(symbols.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} ${chalk.dim(options.subtext)}`;
43
+ output += `\n${bar} ${color.dim(options.subtext)}`;
44
44
  }
45
45
  return output;
46
46
  }
@@ -1,34 +1,34 @@
1
- import chalk from "chalk";
1
+ import { color } from "../components/color.js";
2
2
  export const brand = "#a200ff";
3
3
  export const dark = {
4
- header: (text) => chalk.magentaBright.bold(text),
5
- divider: (text) => chalk.dim(text),
6
- prompt: (text) => chalk.cyan(text),
7
- number: (text) => chalk.cyanBright(text),
8
- intro: (text) => chalk.bgMagenta.white(` Poe - ${text} `),
9
- resolvedSymbol: chalk.magenta("◇"),
10
- errorSymbol: chalk.red("■"),
11
- accent: (text) => chalk.cyan(text),
12
- muted: (text) => chalk.dim(text),
13
- success: (text) => chalk.green(text),
14
- warning: (text) => chalk.yellow(text),
15
- error: (text) => chalk.red(text),
16
- info: (text) => chalk.magenta(text),
17
- badge: (text) => chalk.bgYellow.black(` ${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) => chalk.hex("#a200ff").bold(text),
21
- divider: (text) => chalk.hex("#666666")(text),
22
- prompt: (text) => chalk.hex("#006699").bold(text),
23
- number: (text) => chalk.hex("#0077cc").bold(text),
24
- intro: (text) => chalk.bgHex("#a200ff").white(` Poe - ${text} `),
25
- resolvedSymbol: chalk.hex("#a200ff")("◇"),
26
- errorSymbol: chalk.hex("#cc0000")("■"),
27
- accent: (text) => chalk.hex("#006699").bold(text),
28
- muted: (text) => chalk.hex("#666666")(text),
29
- success: (text) => chalk.hex("#008800")(text),
30
- warning: (text) => chalk.hex("#cc6600")(text),
31
- error: (text) => chalk.hex("#cc0000")(text),
32
- info: (text) => chalk.hex("#a200ff")(text),
33
- badge: (text) => chalk.bgHex("#cc6600").white(` ${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 chalk from "chalk";
1
+ import { color } from "../components/color.js";
2
2
  export const typography = {
3
- bold: (text) => chalk.bold(text),
4
- dim: (text) => chalk.dim(text),
5
- italic: (text) => chalk.italic(text),
6
- underline: (text) => chalk.underline(text),
7
- strikethrough: (text) => chalk.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
  };
@@ -6,6 +6,7 @@
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
+ "postbuild": "node scripts/smoke-built-exports.cjs",
9
10
  "lint": "cd ../.. && eslint packages/design-system --ext ts && tsc -p packages/design-system/tsconfig.json --noEmit",
10
11
  "test": "cd ../.. && vitest run $(rg --files packages/design-system/src -g '*.test.ts' | sort | tr '\\n' ' ')",
11
12
  "demo": "tsx scripts/demo.ts",
@@ -18,8 +19,10 @@
18
19
  "dist"
19
20
  ],
20
21
  "peerDependencies": {
21
- "@clack/prompts": "^1.0.0",
22
- "chalk": "^5.3.0",
23
- "console-table-printer": "^2.15.0"
22
+ "@clack/prompts": "^1.0.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/mustache": "^4.2.6",
26
+ "mustache": "^4.2.0"
24
27
  }
25
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,6 +28,10 @@
28
28
  "./human-in-loop": {
29
29
  "types": "./dist/human-in-loop/index.d.ts",
30
30
  "import": "./dist/human-in-loop/index.js"
31
+ },
32
+ "./source-snippet": {
33
+ "types": "./dist/source-snippet.d.ts",
34
+ "import": "./dist/source-snippet.js"
31
35
  }
32
36
  },
33
37
  "scripts": {
@@ -41,15 +45,12 @@
41
45
  "dependencies": {
42
46
  "@clack/core": "^1.0.0",
43
47
  "@clack/prompts": "^1.0.0",
44
- "chalk": "^5.6.2",
45
48
  "commander": "^14.0.3",
46
- "console-table-printer": "^2.15.0",
47
49
  "jose": "^6.1.2",
48
50
  "jsonc-parser": "^3.3.1",
49
- "mustache": "^4.2.0",
50
51
  "smol-toml": "^1.3.0",
51
52
  "tiny-stdio-mcp-server": "^0.1.0",
52
- "toolcraft-schema": "^0.0.17",
53
+ "toolcraft-schema": "^0.0.19",
53
54
  "yaml": "^2.8.2"
54
55
  },
55
56
  "files": [