@vipcasso/cli 0.0.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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ License — TBD at project kickoff.
2
+
3
+ Choose one and replace the contents of this file. Common options:
4
+
5
+ - **MIT** — permissive, broad reuse allowed. Most popular for open-source SaaS.
6
+ - **Apache-2.0** — permissive + explicit patent grant + trademark restriction.
7
+ - **BSL (Business Source License)** — source-available, time-limited commercial-use restriction. Common for commercial OSS-adjacent projects.
8
+ - **Proprietary / All Rights Reserved** — closed source. State explicitly to avoid ambiguity.
9
+
10
+ Reference: https://choosealicense.com/
11
+
12
+ Once chosen, log the decision in docs/DECISIONS.md with rationale (commercial posture, contributor expectations, dependency-license compatibility).
@@ -0,0 +1,44 @@
1
+ import { Command } from "commander";
2
+ import { type ApiOperation } from "@vipcasso/mcp/operations";
3
+ /**
4
+ * `vipcasso` CLI — the third transport over the one router (blueprint §3.3).
5
+ * Every command is a plain HTTP call to the API; no business logic here.
6
+ *
7
+ * Since PLATFORM-AUDIT W7 the commands are GENERATED from the live OpenAPI
8
+ * document (like the MCP tools): one command per operation, named by its
9
+ * `operationId`, with `--<path_param>` options, repeatable `--query k=v`, and
10
+ * `--body <json | @file>` for operations that take one. `vipcasso ops` lists
11
+ * them. The three static commands (`health`, `me`, `openapi`) stay so the CLI
12
+ * is useful even when the document cannot be fetched.
13
+ */
14
+ export interface CliDeps {
15
+ fetchImpl: typeof fetch;
16
+ stdout: (line: string) => void;
17
+ env: Record<string, string | undefined>;
18
+ /** Read `@file` bodies (tests inject; default: fs). */
19
+ readFile?: ((path: string) => string) | undefined;
20
+ /** Read a file's bytes for multipart `--file` (tests inject; default: fs). */
21
+ readBytes?: ((path: string) => Uint8Array) | undefined;
22
+ /** Binary responses (audio, images) go out raw — never through the text line printer (default: process.stdout). */
23
+ stdoutBytes?: ((bytes: Uint8Array) => void) | undefined;
24
+ }
25
+ /** A response a person reads: JSON or text. Anything else is bytes (Codex on #417: `conciergeSpeak` is audio/wav). */
26
+ export declare function isTextResponse(contentType: string | null): boolean;
27
+ /** `k=v` pairs → an object (later values win); a bare `k` is `k=`. */
28
+ export declare function parseQuery(pairs: readonly string[]): Record<string, string>;
29
+ /** Fill `{page_id}` from the command's options; missing ones are an error. */
30
+ export declare function fillPath(path: string, params: Record<string, string | undefined>): string;
31
+ export declare function buildProgram(deps: CliDeps): Command;
32
+ /** Add one command per API operation (from the live OpenAPI document). */
33
+ export declare function addOperationCommands(program: Command, ops: readonly ApiOperation[], deps: CliDeps): Command;
34
+ /** `--field k=v` and `--file field=path` → the multipart body an upload route expects. */
35
+ export declare function buildFormData(fields: Record<string, string>, files: readonly string[], readBytes: (path: string) => Uint8Array): FormData;
36
+ /**
37
+ * The full program: static commands plus one per live API operation. When the
38
+ * document cannot be fetched (offline, wrong URL) the static program is
39
+ * returned and a note goes to stderr — `health`/`me`/`openapi` still work.
40
+ */
41
+ export declare function buildProgramWithApi(deps: CliDeps & {
42
+ stderr?: (line: string) => void;
43
+ }): Promise<Command>;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,OAAO,KAAK,CAAC;IACxB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IAClD,8EAA8E;I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Operations } from "@vipcasso/mcp/operations";
4
+ /** A response a person reads: JSON or text. Anything else is bytes (Codex on #417: `conciergeSpeak` is audio/wav). */
5
+ export function isTextResponse(contentType) {
6
+ if (!contentType)
7
+ return true;
8
+ const t = contentType.toLowerCase();
9
+ return t.startsWith("text/") || t.includes("json") || t.includes("xml") || t.includes("javascript") || t.includes("x-www-form-urlencoded");
10
+ }
11
+ function toKebab(name) {
12
+ return name.replace(/_/g, "-");
13
+ }
14
+ /** `k=v` pairs → an object (later values win); a bare `k` is `k=`. */
15
+ export function parseQuery(pairs) {
16
+ const out = {};
17
+ for (const p of pairs) {
18
+ const i = p.indexOf("=");
19
+ if (i === -1)
20
+ out[p] = "";
21
+ else
22
+ out[p.slice(0, i)] = p.slice(i + 1);
23
+ }
24
+ return out;
25
+ }
26
+ /** Fill `{page_id}` from the command's options; missing ones are an error. */
27
+ export function fillPath(path, params) {
28
+ return path.replace(/\{([^}]+)\}/g, (_m, name) => {
29
+ const v = params[name];
30
+ if (v === undefined || v === "")
31
+ throw new Error(`missing --${toKebab(name)}`);
32
+ return encodeURIComponent(v);
33
+ });
34
+ }
35
+ export function buildProgram(deps) {
36
+ const program = new Command("vipcasso")
37
+ .description("Vipcasso platform CLI — a client of the Vipcasso API")
38
+ .option("--api-url <url>", "API base URL (env VIPCASSO_API_URL)", deps.env["VIPCASSO_API_URL"] ?? "https://api.vipcasso.com")
39
+ .option("--key <key>", "API key vpk_… (env VIPCASSO_API_KEY)", deps.env["VIPCASSO_API_KEY"])
40
+ .option("--json", "Pretty-print JSON responses")
41
+ .exitOverride();
42
+ const print = (text, pretty) => {
43
+ if (!pretty)
44
+ return deps.stdout(text);
45
+ try {
46
+ deps.stdout(JSON.stringify(JSON.parse(text), null, 2));
47
+ }
48
+ catch {
49
+ deps.stdout(text);
50
+ }
51
+ };
52
+ const call = async (method, path, opts) => {
53
+ const { apiUrl, key, json } = program.opts();
54
+ const url = new URL(`${apiUrl}${path}`);
55
+ for (const [k, v] of Object.entries(opts.query ?? {}))
56
+ url.searchParams.set(k, v);
57
+ const headers = {};
58
+ if (opts.auth && key)
59
+ headers["authorization"] = `Bearer ${key}`;
60
+ if (opts.body !== undefined)
61
+ headers["content-type"] = "application/json";
62
+ const res = await deps.fetchImpl(url.toString(), { method, headers, ...(opts.body !== undefined ? { body: opts.body } : {}) });
63
+ const text = await res.text();
64
+ const took = res.headers.get("server-timing");
65
+ print(text, Boolean(json));
66
+ if (json && took)
67
+ deps.stdout(`# ${took}`);
68
+ if (!res.ok)
69
+ throw new Error(`${method} ${path} → ${res.status}`);
70
+ };
71
+ program
72
+ .command("health")
73
+ .description("Check API health")
74
+ .action(() => call("GET", "/v1/health", { auth: false }));
75
+ program
76
+ .command("me")
77
+ .description("Show the authenticated account context")
78
+ .action(() => call("GET", "/v1/me", { auth: true }));
79
+ program
80
+ .command("openapi")
81
+ .description("Print the live OpenAPI document")
82
+ .action(() => call("GET", "/v1/openapi.json", { auth: false }));
83
+ return program;
84
+ }
85
+ /** Add one command per API operation (from the live OpenAPI document). */
86
+ export function addOperationCommands(program, ops, deps) {
87
+ program
88
+ .command("ops")
89
+ .description("List every API operation the CLI can call")
90
+ .action(() => {
91
+ for (const op of ops)
92
+ deps.stdout(`${op.toolName.padEnd(34)} ${op.method.padEnd(6)} ${op.path} ${op.description.split("\n")[0] ?? ""}`);
93
+ });
94
+ const taken = new Set(program.commands.map((c) => c.name()));
95
+ for (const op of ops) {
96
+ if (taken.has(op.toolName))
97
+ continue;
98
+ const cmd = program.command(op.toolName).description(`${op.method} ${op.path} — ${op.description.split("\n")[0] ?? ""}`);
99
+ for (const p of op.pathParams)
100
+ cmd.requiredOption(`--${toKebab(p)} <value>`, `path parameter ${p}`);
101
+ cmd.option("--query <k=v>", `query parameter (repeatable)${op.queryParams.length ? `: ${op.queryParams.join(", ")}` : ""}`, (v, prev) => [...prev, v], []);
102
+ if (op.bodyMediaType === "json")
103
+ cmd.option("--body <json>", "JSON request body, or @path to a file");
104
+ if (op.bodyMediaType === "multipart") {
105
+ // Files travel as multipart/form-data, the way the API declares them (Codex on #417).
106
+ cmd.option("--file <field=path>", "a file field (repeatable), e.g. --file file=./logo.png", (v, prev) => [...prev, v], []);
107
+ cmd.option("--field <k=v>", "a text field (repeatable)", (v, prev) => [...prev, v], []);
108
+ }
109
+ cmd.action(async (opts) => {
110
+ const params = {};
111
+ for (const p of op.pathParams)
112
+ params[p] = opts[p.replace(/_([a-z])/g, (_m, ch) => ch.toUpperCase())];
113
+ let body;
114
+ const raw = opts["body"];
115
+ if (raw !== undefined) {
116
+ body = raw.startsWith("@") ? (deps.readFile ?? defaultReadFile)(raw.slice(1)) : raw;
117
+ JSON.parse(body); // fail here, plainly, not with a 400 from the API
118
+ }
119
+ if (op.bodyMediaType === "multipart") {
120
+ body = buildFormData(parseQuery(opts["field"] ?? []), opts["file"] ?? [], deps.readBytes ?? defaultReadBytes);
121
+ }
122
+ const query = parseQuery(opts["query"]);
123
+ // Every generated call authenticates; unauthenticated ones just ignore the header.
124
+ await callFromProgram(program, deps, op.method, fillPath(op.path, params), query, body);
125
+ });
126
+ }
127
+ return program;
128
+ }
129
+ function defaultReadFile(path) {
130
+ return readFileSync(path, "utf8");
131
+ }
132
+ function defaultReadBytes(path) {
133
+ return new Uint8Array(readFileSync(path));
134
+ }
135
+ /** `--field k=v` and `--file field=path` → the multipart body an upload route expects. */
136
+ export function buildFormData(fields, files, readBytes) {
137
+ const fd = new FormData();
138
+ for (const [k, v] of Object.entries(fields))
139
+ fd.set(k, v);
140
+ for (const spec of files) {
141
+ const i = spec.indexOf("=");
142
+ if (i === -1)
143
+ throw new Error(`--file expects field=path, got "${spec}"`);
144
+ const field = spec.slice(0, i);
145
+ const path = spec.slice(i + 1);
146
+ const name = path.split(/[\\/]/).pop() ?? "file";
147
+ const bytes = readBytes(path);
148
+ // A fresh ArrayBuffer copy: Blob wants a plain buffer, not a typed-array view over a shared one.
149
+ const buf = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
150
+ // append, not set: several files may share a field (`files`); the API reads getAll.
151
+ fd.append(field, new Blob([buf]), name);
152
+ }
153
+ return fd;
154
+ }
155
+ async function callFromProgram(program, deps, method, path, query, body) {
156
+ const { apiUrl, key, json } = program.opts();
157
+ const url = new URL(`${apiUrl}${path}`);
158
+ for (const [k, v] of Object.entries(query))
159
+ url.searchParams.set(k, v);
160
+ const headers = {};
161
+ if (key)
162
+ headers["authorization"] = `Bearer ${key}`;
163
+ // A FormData body sets its own multipart content type (with the boundary).
164
+ if (typeof body === "string")
165
+ headers["content-type"] = "application/json";
166
+ const res = await deps.fetchImpl(url.toString(), { method, headers, ...(body !== undefined ? { body } : {}) });
167
+ if (!isTextResponse(res.headers.get("content-type"))) {
168
+ // Raw bytes, so `vipcasso conciergeSpeak … > reply.wav` is a playable file.
169
+ (deps.stdoutBytes ?? ((b) => process.stdout.write(b)))(new Uint8Array(await res.arrayBuffer()));
170
+ if (!res.ok)
171
+ throw new Error(`${method} ${path} → ${res.status}`);
172
+ return;
173
+ }
174
+ const text = await res.text();
175
+ if (json) {
176
+ try {
177
+ deps.stdout(JSON.stringify(JSON.parse(text), null, 2));
178
+ }
179
+ catch {
180
+ deps.stdout(text);
181
+ }
182
+ const took = res.headers.get("server-timing");
183
+ if (took)
184
+ deps.stdout(`# ${took}`);
185
+ }
186
+ else
187
+ deps.stdout(text);
188
+ if (!res.ok)
189
+ throw new Error(`${method} ${path} → ${res.status}`);
190
+ }
191
+ /**
192
+ * The full program: static commands plus one per live API operation. When the
193
+ * document cannot be fetched (offline, wrong URL) the static program is
194
+ * returned and a note goes to stderr — `health`/`me`/`openapi` still work.
195
+ */
196
+ export async function buildProgramWithApi(deps) {
197
+ const program = buildProgram(deps);
198
+ const apiUrl = deps.env["VIPCASSO_API_URL"] ?? "https://api.vipcasso.com";
199
+ try {
200
+ // A human at a keyboard may call everything, including what models must not (createApiKey).
201
+ const ops = await loadOperations(apiUrl, deps.fetchImpl, { includeHidden: true });
202
+ addOperationCommands(program, ops, deps);
203
+ }
204
+ catch (err) {
205
+ deps.stderr?.(`(generated commands unavailable: ${err instanceof Error ? err.message : String(err)})`);
206
+ }
207
+ return program;
208
+ }
209
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAyB7E,sHAAsH;AACtH,MAAM,UAAU,cAAc,CAAC,WAA0B;IACvD,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,MAAM,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACpC,OAAO,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAC7I,CAAC;AAQD,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,KAAwB;IACjD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;;YACrB,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC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,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,IAAI,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAmD;IAC3F,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,0BAA0B,CAAC;IAC1E,IAAI,CAAC;QACH,4FAA4F;QAC5F,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAClF,oBAAoB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,EAAE,CAAC,oCAAoC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
package/dist/main.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { buildProgramWithApi } from "./index.js";
3
+ // `--api-url` on the command line must win over the environment for the
4
+ // OpenAPI fetch too, so read it before building.
5
+ const argUrl = (() => {
6
+ const i = process.argv.indexOf("--api-url");
7
+ return i >= 0 ? process.argv[i + 1] : process.argv.find((a) => a.startsWith("--api-url="))?.slice("--api-url=".length);
8
+ })();
9
+ const program = await buildProgramWithApi({
10
+ fetchImpl: fetch,
11
+ stdout: (line) => console.log(line),
12
+ stderr: (line) => console.error(line),
13
+ env: { ...process.env, ...(argUrl ? { VIPCASSO_API_URL: argUrl } : {}) },
14
+ });
15
+ try {
16
+ await program.parseAsync(process.argv);
17
+ }
18
+ catch (err) {
19
+ if (err instanceof Error && !err.message.startsWith("(outputHelp)")) {
20
+ console.error(err.message);
21
+ }
22
+ process.exitCode = 1;
23
+ }
24
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,wEAAwE;AACxE,iDAAiD;AACjD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;IACnB,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACzH,CAAC,CAAC,EAAE,CAAC;AACL,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC;IACxC,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;IACrC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;CACzE,CAAC,CAAC;AAEH,IAAI,CAAC;IACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,IAAI,GAAG,YAAY,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@vipcasso/cli",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "bin": {
7
+ "vipcasso": "./dist/main.js"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "dependencies": {
16
+ "commander": "15.0.0",
17
+ "@vipcasso/mcp": "0.0.1"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "26.1.1",
21
+ "typescript": "6.0.3",
22
+ "vitest": "4.1.11",
23
+ "@vitest/coverage-v8": "4.1.11"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "license": "UNLICENSED",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/AspynAI/vipcasso.git",
35
+ "directory": "apps/cli"
36
+ },
37
+ "scripts": {
38
+ "build": "tsc -p tsconfig.json",
39
+ "typecheck": "tsc -p tsconfig.json --noEmit false --emitDeclarationOnly",
40
+ "lint": "eslint src",
41
+ "test": "vitest run"
42
+ }
43
+ }