@vapi-network/cli 0.2.0 → 0.2.1
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/brand.d.ts +14 -11
- package/dist/cli.js +74 -34
- package/dist/cli.js.map +1 -1
- package/dist/index.js +74 -34
- package/dist/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46669,7 +46669,7 @@ function csvCell(value) {
|
|
|
46669
46669
|
import { mkdir as mkdir6, writeFile as writeFile4 } from "node:fs/promises";
|
|
46670
46670
|
import { arch, platform, release } from "node:os";
|
|
46671
46671
|
import { join as join2 } from "node:path";
|
|
46672
|
-
var VAPI_CLIENT_VERSION = "0.2.
|
|
46672
|
+
var VAPI_CLIENT_VERSION = "0.2.1";
|
|
46673
46673
|
async function createSupportReport(options) {
|
|
46674
46674
|
const message = options.message.trim();
|
|
46675
46675
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -48801,22 +48801,32 @@ function asRecord(value) {
|
|
|
48801
48801
|
|
|
48802
48802
|
// src/brand.ts
|
|
48803
48803
|
var MARK_SOURCE_WIDTH = 743;
|
|
48804
|
-
var
|
|
48805
|
-
var
|
|
48806
|
-
var
|
|
48804
|
+
var MARK_SOURCE_HEIGHT = 659;
|
|
48805
|
+
var MARK_SOURCE_ROW_HEIGHT = 217;
|
|
48806
|
+
var MARK_COLUMNS = 28;
|
|
48807
|
+
var MARK_ROWS = 12;
|
|
48808
|
+
var PLAIN_BLOCK = "\u2588";
|
|
48807
48809
|
var MARK_STEP_MS = 70;
|
|
48808
48810
|
var WORDMARK = "vAPI Network";
|
|
48809
|
-
var
|
|
48810
|
-
var
|
|
48811
|
-
|
|
48812
|
-
|
|
48811
|
+
var WELCOME = "Welcome to the vAPI Network";
|
|
48812
|
+
var TAGLINE = [
|
|
48813
|
+
"The trusted network where agents and humans do business.",
|
|
48814
|
+
"Search APIs, pay per call, keep receipts. More coming soon."
|
|
48815
|
+
];
|
|
48816
|
+
var ESC = "\x1B";
|
|
48817
|
+
var RESET = `${ESC}[0m`;
|
|
48818
|
+
var REVERSE = `${ESC}[7m`;
|
|
48819
|
+
var BOLD = `${ESC}[1m`;
|
|
48820
|
+
var DIM = `${ESC}[2m`;
|
|
48821
|
+
var HIDE_CURSOR = `${ESC}[?25l`;
|
|
48822
|
+
var SHOW_CURSOR = `${ESC}[?25h`;
|
|
48813
48823
|
var MARK_PALETTE = {
|
|
48814
|
-
orange: "#
|
|
48815
|
-
pink: "#
|
|
48816
|
-
lime: "#
|
|
48817
|
-
cyan: "#
|
|
48818
|
-
blue: "#
|
|
48819
|
-
purple: "#
|
|
48824
|
+
orange: "#ff7300",
|
|
48825
|
+
pink: "#ff337c",
|
|
48826
|
+
lime: "#c3ff3d",
|
|
48827
|
+
cyan: "#97efff",
|
|
48828
|
+
blue: "#0041eb",
|
|
48829
|
+
purple: "#8a37fb",
|
|
48820
48830
|
ink: null
|
|
48821
48831
|
};
|
|
48822
48832
|
var MARK_BLOCKS = [
|
|
@@ -48854,36 +48864,64 @@ function renderMarkFrames(options = {}) {
|
|
|
48854
48864
|
}
|
|
48855
48865
|
function renderBanner(options) {
|
|
48856
48866
|
const frames = renderMarkFrames(options);
|
|
48857
|
-
return
|
|
48867
|
+
return renderBox(frames[frames.length - 1], options).join("\n");
|
|
48858
48868
|
}
|
|
48859
48869
|
async function animateBanner(options) {
|
|
48860
48870
|
const frames = renderMarkFrames({ color: options.color !== false });
|
|
48861
48871
|
const sleep = options.sleep ?? defaultSleep;
|
|
48862
48872
|
const stepMs = options.stepMs ?? MARK_STEP_MS;
|
|
48873
|
+
const boxes = frames.map((frame) => renderBox(frame, options));
|
|
48874
|
+
const height = boxes[0].length;
|
|
48863
48875
|
options.write(HIDE_CURSOR);
|
|
48864
48876
|
try {
|
|
48865
|
-
for (const [index2,
|
|
48866
|
-
if (index2 > 0) options.write(
|
|
48867
|
-
options.write(
|
|
48868
|
-
|
|
48869
|
-
|
|
48870
|
-
);
|
|
48871
|
-
if (index2 < frames.length - 1) await sleep(stepMs);
|
|
48877
|
+
for (const [index2, box] of boxes.entries()) {
|
|
48878
|
+
if (index2 > 0) options.write(`${ESC}[${height}A`);
|
|
48879
|
+
options.write(box.map((line) => `\r${ESC}[2K${line}
|
|
48880
|
+
`).join(""));
|
|
48881
|
+
if (index2 < boxes.length - 1) await sleep(stepMs);
|
|
48872
48882
|
}
|
|
48873
48883
|
} finally {
|
|
48874
48884
|
options.write(SHOW_CURSOR);
|
|
48875
48885
|
}
|
|
48876
|
-
|
|
48877
|
-
|
|
48878
|
-
options.
|
|
48879
|
-
|
|
48886
|
+
}
|
|
48887
|
+
function renderBox(frame, options) {
|
|
48888
|
+
const color = options.color === true;
|
|
48889
|
+
const text = [
|
|
48890
|
+
{ value: WELCOME, style: BOLD },
|
|
48891
|
+
{ value: "", style: "" },
|
|
48892
|
+
...TAGLINE.map((line) => ({ value: line, style: "" })),
|
|
48893
|
+
{ value: "", style: "" },
|
|
48894
|
+
{ value: `${WORDMARK} v${options.version}`, style: DIM }
|
|
48895
|
+
];
|
|
48896
|
+
const textWidth = Math.max(...text.map((line) => line.value.length));
|
|
48897
|
+
const gap = 3;
|
|
48898
|
+
const inner = 2 + MARK_COLUMNS + gap + textWidth + 2;
|
|
48899
|
+
const markLines = frame.split("\n");
|
|
48900
|
+
const textTop = Math.floor((MARK_ROWS - text.length) / 2);
|
|
48901
|
+
const lines = [];
|
|
48902
|
+
lines.push(`\u256D${"\u2500".repeat(inner)}\u256E`);
|
|
48903
|
+
lines.push(`\u2502${" ".repeat(inner)}\u2502`);
|
|
48904
|
+
for (let row = 0; row < MARK_ROWS; row += 1) {
|
|
48905
|
+
const mark = markLines[row] ?? "";
|
|
48906
|
+
const markPad = " ".repeat(Math.max(0, MARK_COLUMNS - visibleLength(mark)));
|
|
48907
|
+
const entry = text[row - textTop];
|
|
48908
|
+
const raw = entry?.value ?? "";
|
|
48909
|
+
const styled = color && entry && entry.style && raw ? `${entry.style}${raw}${RESET}` : raw;
|
|
48910
|
+
const textPad = " ".repeat(textWidth - raw.length);
|
|
48911
|
+
lines.push(`\u2502 ${mark}${markPad}${" ".repeat(gap)}${styled}${textPad} \u2502`);
|
|
48912
|
+
}
|
|
48913
|
+
lines.push(`\u2502${" ".repeat(inner)}\u2502`);
|
|
48914
|
+
lines.push(`\u2570${"\u2500".repeat(inner)}\u256F`);
|
|
48915
|
+
return lines;
|
|
48880
48916
|
}
|
|
48881
48917
|
function renderFrame(blocks, color) {
|
|
48882
48918
|
const rows = [];
|
|
48883
48919
|
for (let row = 0; row < MARK_ROWS; row += 1) {
|
|
48920
|
+
const sourceY = row * MARK_SOURCE_HEIGHT / MARK_ROWS;
|
|
48921
|
+
const band = Math.min(2, Math.floor(sourceY / MARK_SOURCE_ROW_HEIGHT));
|
|
48884
48922
|
rows.push(
|
|
48885
48923
|
renderRow(
|
|
48886
|
-
blocks.filter((block) => block.row ===
|
|
48924
|
+
blocks.filter((block) => block.row === band),
|
|
48887
48925
|
color
|
|
48888
48926
|
)
|
|
48889
48927
|
);
|
|
@@ -48901,11 +48939,10 @@ function renderRow(blocks, color) {
|
|
|
48901
48939
|
column = start;
|
|
48902
48940
|
}
|
|
48903
48941
|
const width = scaleWidth(block.width);
|
|
48904
|
-
|
|
48905
|
-
line += color ? `${ansiPrefix(block.color)}${glyphs}${RESET}` : glyphs;
|
|
48942
|
+
line += color ? `${cellPrefix(block.color)}${" ".repeat(width)}${RESET}` : PLAIN_BLOCK.repeat(width);
|
|
48906
48943
|
column += width;
|
|
48907
48944
|
}
|
|
48908
|
-
return line;
|
|
48945
|
+
return line + " ".repeat(Math.max(0, MARK_COLUMNS - column));
|
|
48909
48946
|
}
|
|
48910
48947
|
function scaleColumn(x) {
|
|
48911
48948
|
return Math.round(x * MARK_COLUMNS / MARK_SOURCE_WIDTH);
|
|
@@ -48913,11 +48950,14 @@ function scaleColumn(x) {
|
|
|
48913
48950
|
function scaleWidth(width) {
|
|
48914
48951
|
return Math.max(1, Math.round(width * MARK_COLUMNS / MARK_SOURCE_WIDTH));
|
|
48915
48952
|
}
|
|
48916
|
-
function
|
|
48953
|
+
function cellPrefix(color) {
|
|
48917
48954
|
const hex3 = MARK_PALETTE[color];
|
|
48918
|
-
if (hex3 === null) return
|
|
48955
|
+
if (hex3 === null) return REVERSE;
|
|
48919
48956
|
const value = Number.parseInt(hex3.slice(1), 16);
|
|
48920
|
-
return
|
|
48957
|
+
return `${ESC}[48;2;${value >> 16 & 255};${value >> 8 & 255};${value & 255}m`;
|
|
48958
|
+
}
|
|
48959
|
+
function visibleLength(line) {
|
|
48960
|
+
return line.replace(new RegExp(`${ESC}\\[[0-9;?]*[A-Za-z]`, "g"), "").length;
|
|
48921
48961
|
}
|
|
48922
48962
|
function defaultSleep(milliseconds) {
|
|
48923
48963
|
return new Promise((resolve) => {
|
|
@@ -48926,7 +48966,7 @@ function defaultSleep(milliseconds) {
|
|
|
48926
48966
|
}
|
|
48927
48967
|
|
|
48928
48968
|
// src/version.ts
|
|
48929
|
-
var CLI_VERSION = "0.2.
|
|
48969
|
+
var CLI_VERSION = "0.2.1";
|
|
48930
48970
|
|
|
48931
48971
|
// src/cli.ts
|
|
48932
48972
|
var HELP_HEADING = "vAPI Network";
|