toolcraft-openapi 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.
- package/dist/bin/generate.js +7 -0
- package/dist/define-client.js +2 -2
- package/dist/generate.js +2 -2
- package/dist/http.d.ts +21 -2
- package/dist/http.js +147 -22
- package/dist/index.d.ts +1 -1
- package/dist/lock.d.ts +1 -1
- package/dist/lock.js +109 -5
- package/dist/mock/fetch.js +1 -1
- package/dist/network-error.d.ts +2 -0
- package/dist/network-error.js +83 -0
- package/dist/spec-source.js +103 -3
- 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/help-formatter-plain.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/components/help-formatter-plain.js +1 -1
- 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.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/components/text.js +11 -3
- package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +20 -13
- package/node_modules/@poe-code/design-system/dist/dashboard/keymap.d.ts +5 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/keymap.js +146 -12
- package/node_modules/@poe-code/design-system/dist/dashboard/terminal.js +31 -0
- package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
- package/node_modules/@poe-code/design-system/dist/explorer/actions.d.ts +16 -0
- package/node_modules/@poe-code/design-system/dist/explorer/actions.js +39 -0
- package/node_modules/@poe-code/design-system/dist/explorer/demo.d.ts +13 -0
- package/node_modules/@poe-code/design-system/dist/explorer/demo.js +297 -0
- package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +61 -0
- package/node_modules/@poe-code/design-system/dist/explorer/events.js +1 -0
- package/node_modules/@poe-code/design-system/dist/explorer/filter.d.ts +10 -0
- package/node_modules/@poe-code/design-system/dist/explorer/filter.js +95 -0
- package/node_modules/@poe-code/design-system/dist/explorer/index.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/index.js +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/jobs.d.ts +7 -0
- package/node_modules/@poe-code/design-system/dist/explorer/jobs.js +59 -0
- package/node_modules/@poe-code/design-system/dist/explorer/keymap.d.ts +21 -0
- package/node_modules/@poe-code/design-system/dist/explorer/keymap.js +363 -0
- package/node_modules/@poe-code/design-system/dist/explorer/layout.d.ts +20 -0
- package/node_modules/@poe-code/design-system/dist/explorer/layout.js +73 -0
- package/node_modules/@poe-code/design-system/dist/explorer/reducer.d.ts +9 -0
- package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +704 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/detail.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +96 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/footer.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/footer.js +49 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/header.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/header.js +56 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/index.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/index.js +61 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/list.d.ts +4 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/list.js +106 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/modal.d.ts +3 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/modal.js +91 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/test-fixtures.d.ts +8 -0
- package/node_modules/@poe-code/design-system/dist/explorer/render/test-fixtures.js +156 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.d.ts +2 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +282 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.test-helpers.d.ts +50 -0
- package/node_modules/@poe-code/design-system/dist/explorer/runtime.test-helpers.js +101 -0
- package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +130 -0
- package/node_modules/@poe-code/design-system/dist/explorer/state.js +87 -0
- package/node_modules/@poe-code/design-system/dist/explorer/theme.d.ts +27 -0
- package/node_modules/@poe-code/design-system/dist/explorer/theme.js +97 -0
- package/node_modules/@poe-code/design-system/dist/index.d.ts +7 -0
- package/node_modules/@poe-code/design-system/dist/index.js +5 -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.js +2 -2
- 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 +6 -3
- package/package.json +2 -4
|
@@ -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
|
|
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);
|
|
@@ -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
|
};
|
|
@@ -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
|
-
|
|
23
|
-
|
|
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-openapi",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
"@clack/prompts": "^1.0.0",
|
|
33
33
|
"@poe-code/design-system": "^0.0.2",
|
|
34
34
|
"auth-store": "^0.0.1",
|
|
35
|
-
"
|
|
36
|
-
"console-table-printer": "^2.15.0",
|
|
37
|
-
"toolcraft": "^0.0.17",
|
|
35
|
+
"toolcraft": "^0.0.19",
|
|
38
36
|
"yaml": "^2.8.2"
|
|
39
37
|
},
|
|
40
38
|
"engines": {
|