@vibiz/cli 0.3.23 → 0.3.24
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/vibiz.js
CHANGED
|
@@ -11,17 +11,18 @@ import {
|
|
|
11
11
|
formatUsd,
|
|
12
12
|
mergeEnvFile,
|
|
13
13
|
oneKeyMessage
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VV76BJPD.js";
|
|
15
15
|
|
|
16
16
|
// packages/cli/src/main.ts
|
|
17
17
|
import { spawn } from "node:child_process";
|
|
18
|
+
import { randomUUID } from "node:crypto";
|
|
18
19
|
import { chmod, mkdir as mkdir2, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
19
|
-
import { dirname as
|
|
20
|
+
import { dirname as dirname8, join as join9 } from "node:path";
|
|
20
21
|
import { format } from "node:util";
|
|
21
22
|
|
|
22
23
|
// packages/cli/src/commands.ts
|
|
23
24
|
import { homedir as homedir2 } from "node:os";
|
|
24
|
-
import { dirname as
|
|
25
|
+
import { dirname as dirname7, join as join7, resolve as resolve3 } from "node:path";
|
|
25
26
|
import { parseArgs } from "node:util";
|
|
26
27
|
|
|
27
28
|
// packages/app/src/index.ts
|
|
@@ -789,8 +790,8 @@ async function diffCommand(io, positionals, flags) {
|
|
|
789
790
|
if (!d.files.length) io.log(" No files changed.");
|
|
790
791
|
const mark = { added: "A", updated: "M", deleted: "D" };
|
|
791
792
|
for (const f of d.files) {
|
|
792
|
-
const
|
|
793
|
-
io.log(`${mark[f.change]} ${f.path}${
|
|
793
|
+
const size2 = f.binary ? ` (binary, ${bytesLabel(f.size_before ?? 0)} \u2192 ${bytesLabel(f.size_after ?? 0)})` : "";
|
|
794
|
+
io.log(`${mark[f.change]} ${f.path}${size2}`);
|
|
794
795
|
if (f.diff) io.out(f.diff);
|
|
795
796
|
if (f.note && !f.binary) io.log(` ${f.note}`);
|
|
796
797
|
}
|
|
@@ -2209,6 +2210,225 @@ async function inboxCommand(io, vibiz2, flags, positionals) {
|
|
|
2209
2210
|
throw new Error(`usage: vibiz email [${INBOX_SUBCOMMANDS.join(" | ")}]`);
|
|
2210
2211
|
}
|
|
2211
2212
|
|
|
2213
|
+
// packages/cli/src/library.ts
|
|
2214
|
+
import { lstat, readdir as readdir3 } from "node:fs/promises";
|
|
2215
|
+
import { basename as basename2, dirname as dirname4, isAbsolute, relative, resolve as resolve2, sep as sep2 } from "node:path";
|
|
2216
|
+
var PUT_LIMITS = {
|
|
2217
|
+
fileBytes: 1024 * 1024,
|
|
2218
|
+
batchFiles: 1e3,
|
|
2219
|
+
batchBytes: 20 * 1024 * 1024
|
|
2220
|
+
};
|
|
2221
|
+
var SKIP_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", ".DS_Store"]);
|
|
2222
|
+
var size = (n) => n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${(n / 1024).toFixed(1)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
2223
|
+
var day = (iso) => iso.slice(0, 16).replace("T", " ");
|
|
2224
|
+
function textOf(bytes) {
|
|
2225
|
+
if (bytes.length > PUT_LIMITS.fileBytes) return { skip: `${size(bytes.length)}, over 1 MB` };
|
|
2226
|
+
if (bytes.includes(0)) return { skip: "binary (has NUL bytes)" };
|
|
2227
|
+
try {
|
|
2228
|
+
return { text: new TextDecoder("utf-8", { fatal: true }).decode(bytes) };
|
|
2229
|
+
} catch {
|
|
2230
|
+
return { skip: "not UTF-8 text" };
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
async function walk(root) {
|
|
2234
|
+
const files = [];
|
|
2235
|
+
const folders = [];
|
|
2236
|
+
const visit = async (dir) => {
|
|
2237
|
+
const entries = await readdir3(dir, { withFileTypes: true });
|
|
2238
|
+
for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
2239
|
+
if (SKIP_DIRS.has(e.name)) continue;
|
|
2240
|
+
const full = resolve2(dir, e.name);
|
|
2241
|
+
const rel = relative(root, full).split(sep2).join("/");
|
|
2242
|
+
if (e.isSymbolicLink()) continue;
|
|
2243
|
+
if (e.isDirectory()) {
|
|
2244
|
+
folders.push(rel);
|
|
2245
|
+
await visit(full);
|
|
2246
|
+
} else if (e.isFile()) files.push(rel);
|
|
2247
|
+
}
|
|
2248
|
+
};
|
|
2249
|
+
await visit(root);
|
|
2250
|
+
return { files, folders };
|
|
2251
|
+
}
|
|
2252
|
+
function entryLine(e, indent = false) {
|
|
2253
|
+
const name = e.kind === "folder" ? `${indent ? e.path : e.name}/` : indent ? e.path : e.name;
|
|
2254
|
+
const items = e.kind === "folder" ? `${e.items ?? 0} item${e.items === 1 ? "" : "s"}` : "";
|
|
2255
|
+
return ` ${name.padEnd(40)} ${size(e.size_bytes).padStart(9)} ${items.padEnd(9)} ${day(e.updated_at)}`;
|
|
2256
|
+
}
|
|
2257
|
+
async function libraryCommand(io, positionals, f) {
|
|
2258
|
+
const vibiz2 = await io.client();
|
|
2259
|
+
const scope = f.project ? { project_id: f.project } : {};
|
|
2260
|
+
const where = f.project ? `project ${f.project}'s Library` : "the Library";
|
|
2261
|
+
const out = (value) => io.log(JSON.stringify(value, null, 2));
|
|
2262
|
+
const [sub, a, b] = positionals;
|
|
2263
|
+
switch (sub ?? "ls") {
|
|
2264
|
+
case "ls":
|
|
2265
|
+
case "list": {
|
|
2266
|
+
const list2 = await vibiz2.library.list({
|
|
2267
|
+
...scope,
|
|
2268
|
+
...a ? { path: a } : {},
|
|
2269
|
+
...f.recursive ? { recursive: true } : {}
|
|
2270
|
+
});
|
|
2271
|
+
if (f.json) return out(list2);
|
|
2272
|
+
if (!list2.data.length) {
|
|
2273
|
+
io.log(
|
|
2274
|
+
list2.path ? `${list2.path}/ is empty.` : `Nothing in ${where} yet. Keep your scripts and agent skills here: vibiz library put <file-or-folder>. Nothing here runs; it's stored so you don't lose it.`
|
|
2275
|
+
);
|
|
2276
|
+
} else {
|
|
2277
|
+
for (const e of list2.data) io.log(entryLine(e, !!f.recursive));
|
|
2278
|
+
}
|
|
2279
|
+
io.log(
|
|
2280
|
+
`
|
|
2281
|
+
${list2.usage.entries} item${list2.usage.entries === 1 ? "" : "s"} in ${where}, ${size(list2.usage.bytes)}`
|
|
2282
|
+
);
|
|
2283
|
+
io.log(` ${list2.console_url}`);
|
|
2284
|
+
return;
|
|
2285
|
+
}
|
|
2286
|
+
case "cat":
|
|
2287
|
+
case "read": {
|
|
2288
|
+
if (!a) throw new Error("usage: vibiz library cat <path>");
|
|
2289
|
+
const file = await vibiz2.library.read(a, scope);
|
|
2290
|
+
if (f.json) return out(file);
|
|
2291
|
+
io.log(file.content ?? "");
|
|
2292
|
+
return;
|
|
2293
|
+
}
|
|
2294
|
+
case "put":
|
|
2295
|
+
case "push": {
|
|
2296
|
+
if (!a) throw new Error("usage: vibiz library put <local-file-or-folder> [remote-path]");
|
|
2297
|
+
const local = io.local();
|
|
2298
|
+
const source = isAbsolute(a) ? a : resolve2(local.cwd(), a);
|
|
2299
|
+
const info = await lstat(source).catch(() => null);
|
|
2300
|
+
if (!info) throw new Error(`${a}: no such file or folder here.`);
|
|
2301
|
+
const name = basename2(source);
|
|
2302
|
+
if (info.isFile()) {
|
|
2303
|
+
const got = textOf(new Uint8Array(await local.readFile(source)));
|
|
2304
|
+
if ("skip" in got)
|
|
2305
|
+
throw new Error(
|
|
2306
|
+
`${a}: ${got.skip}. The Library keeps text files only (scripts, skills, notes); put images and other binaries in a project's Files (vibiz files upload).`
|
|
2307
|
+
);
|
|
2308
|
+
const remote2 = !b ? name : b.endsWith("/") ? `${b}${name}` : b;
|
|
2309
|
+
const saved = await vibiz2.library.write({ path: remote2, content: got.text, ...scope });
|
|
2310
|
+
if (f.json) return out(saved);
|
|
2311
|
+
io.log(`${saved.created ? "Saved" : "Updated"} ${saved.path} (${size(saved.size_bytes)}).`);
|
|
2312
|
+
io.log(` ${saved.console_url}`);
|
|
2313
|
+
return;
|
|
2314
|
+
}
|
|
2315
|
+
if (!info.isDirectory()) throw new Error(`${a}: not a file or a folder.`);
|
|
2316
|
+
const remote = (b ?? name).replace(/^\/+|\/+$/g, "");
|
|
2317
|
+
const tree = await walk(source);
|
|
2318
|
+
const batches = [[]];
|
|
2319
|
+
let bytes = 0;
|
|
2320
|
+
const skipped2 = [];
|
|
2321
|
+
for (const rel of tree.files) {
|
|
2322
|
+
const got = textOf(new Uint8Array(await local.readFile(resolve2(source, rel))));
|
|
2323
|
+
if ("skip" in got) {
|
|
2324
|
+
skipped2.push(`${rel} (${got.skip})`);
|
|
2325
|
+
continue;
|
|
2326
|
+
}
|
|
2327
|
+
const n = Buffer.byteLength(got.text);
|
|
2328
|
+
let batch = batches[batches.length - 1];
|
|
2329
|
+
if (batch.length >= PUT_LIMITS.batchFiles || bytes + n > PUT_LIMITS.batchBytes) {
|
|
2330
|
+
batch = [];
|
|
2331
|
+
batches.push(batch);
|
|
2332
|
+
bytes = 0;
|
|
2333
|
+
}
|
|
2334
|
+
batch.push({ path: rel, content: got.text });
|
|
2335
|
+
bytes += n;
|
|
2336
|
+
}
|
|
2337
|
+
let created = 0;
|
|
2338
|
+
let updated = 0;
|
|
2339
|
+
let consoleUrl = "";
|
|
2340
|
+
const results = [];
|
|
2341
|
+
for (const [i, files] of batches.entries()) {
|
|
2342
|
+
if (!files.length && i > 0) continue;
|
|
2343
|
+
const res = await vibiz2.library.import({
|
|
2344
|
+
path: remote,
|
|
2345
|
+
files,
|
|
2346
|
+
...i === 0 && tree.folders.length ? { folders: tree.folders } : {},
|
|
2347
|
+
...scope
|
|
2348
|
+
});
|
|
2349
|
+
created += res.created;
|
|
2350
|
+
updated += res.updated;
|
|
2351
|
+
consoleUrl = res.console_url;
|
|
2352
|
+
results.push(res);
|
|
2353
|
+
}
|
|
2354
|
+
if (f.json) return out({ path: remote, created, updated, skipped: skipped2, imports: results });
|
|
2355
|
+
for (const s of skipped2) io.log(` skipped ${s}`);
|
|
2356
|
+
io.log(
|
|
2357
|
+
`Saved ${remote || "the top"}/ to ${where}: ${created} new, ${updated} updated${skipped2.length ? `, ${skipped2.length} skipped` : ""}.`
|
|
2358
|
+
);
|
|
2359
|
+
if (consoleUrl) io.log(` ${consoleUrl}`);
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
case "get":
|
|
2363
|
+
case "pull": {
|
|
2364
|
+
if (a === void 0) throw new Error("usage: vibiz library get <remote-path> [local-dir]");
|
|
2365
|
+
const local = io.local();
|
|
2366
|
+
const exp = await vibiz2.library.export(a, scope);
|
|
2367
|
+
const base = resolve2(local.cwd(), b ?? ".");
|
|
2368
|
+
const root = exp.kind === "file" ? base : resolve2(base, exp.path ? basename2(exp.path) : "library");
|
|
2369
|
+
const inside = (rel) => {
|
|
2370
|
+
const target = resolve2(root, rel);
|
|
2371
|
+
if (target !== root && !target.startsWith(root + sep2)) {
|
|
2372
|
+
throw new Error(`Refusing to write ${rel}: it would land outside ${root}.`);
|
|
2373
|
+
}
|
|
2374
|
+
return target;
|
|
2375
|
+
};
|
|
2376
|
+
await local.mkdir(root, { recursive: true });
|
|
2377
|
+
for (const folder of exp.folders) await local.mkdir(inside(folder), { recursive: true });
|
|
2378
|
+
for (const file of exp.files) {
|
|
2379
|
+
const target = inside(file.path);
|
|
2380
|
+
await local.mkdir(dirname4(target), { recursive: true });
|
|
2381
|
+
await local.writeFile(target, file.content, "utf8");
|
|
2382
|
+
}
|
|
2383
|
+
if (f.json)
|
|
2384
|
+
return out({ ...exp, files: exp.files.map(({ content: _, ...r }) => r), to: root });
|
|
2385
|
+
io.log(
|
|
2386
|
+
exp.kind === "file" ? `Saved ${resolve2(root, exp.files[0]?.path ?? "")}.` : `Saved ${exp.files.length} file${exp.files.length === 1 ? "" : "s"} to ${root}.`
|
|
2387
|
+
);
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
case "mkdir": {
|
|
2391
|
+
if (!a) throw new Error("usage: vibiz library mkdir <path>");
|
|
2392
|
+
const made = await vibiz2.library.mkdir(a, scope);
|
|
2393
|
+
if (f.json) return out(made);
|
|
2394
|
+
io.log(`${made.created ? "Made" : "Already there:"} ${made.path}/`);
|
|
2395
|
+
io.log(` ${made.console_url}`);
|
|
2396
|
+
return;
|
|
2397
|
+
}
|
|
2398
|
+
case "mv":
|
|
2399
|
+
case "move": {
|
|
2400
|
+
if (!a || !b) throw new Error("usage: vibiz library mv <from> <to> [--force]");
|
|
2401
|
+
const moved = await vibiz2.library.move({
|
|
2402
|
+
from: a,
|
|
2403
|
+
to: b,
|
|
2404
|
+
...scope,
|
|
2405
|
+
...f.force ? { overwrite: true } : {}
|
|
2406
|
+
});
|
|
2407
|
+
if (f.json) return out(moved);
|
|
2408
|
+
io.log(`Moved ${a} to ${moved.path}${moved.moved > 1 ? ` (${moved.moved} items)` : ""}.`);
|
|
2409
|
+
io.log(` ${moved.console_url}`);
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2412
|
+
case "rm":
|
|
2413
|
+
case "delete": {
|
|
2414
|
+
if (!a) throw new Error("usage: vibiz library rm <path> [-r]");
|
|
2415
|
+
const gone = await vibiz2.library.delete(a, {
|
|
2416
|
+
...scope,
|
|
2417
|
+
...f.recursive ? { recursive: true } : {}
|
|
2418
|
+
});
|
|
2419
|
+
if (f.json) return out(gone);
|
|
2420
|
+
io.log(
|
|
2421
|
+
`Deleted ${gone.path}${gone.kind === "folder" ? `/ (${gone.deleted_count} item${gone.deleted_count === 1 ? "" : "s"})` : ""}.`
|
|
2422
|
+
);
|
|
2423
|
+
return;
|
|
2424
|
+
}
|
|
2425
|
+
default:
|
|
2426
|
+
throw new Error(
|
|
2427
|
+
`vibiz library ${sub}: not a command. Use ls, cat, put, get, mkdir, mv or rm (vibiz help library).`
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2212
2432
|
// packages/cli/src/login.ts
|
|
2213
2433
|
import { hostname, platform, release } from "node:os";
|
|
2214
2434
|
import { join as join4 } from "node:path";
|
|
@@ -2798,8 +3018,8 @@ function formatProfile(p) {
|
|
|
2798
3018
|
|
|
2799
3019
|
// packages/cli/src/scaffold.ts
|
|
2800
3020
|
import { existsSync } from "node:fs";
|
|
2801
|
-
import { cp, readdir as
|
|
2802
|
-
import { dirname as
|
|
3021
|
+
import { cp, readdir as readdir4, readFile, rename, writeFile } from "node:fs/promises";
|
|
3022
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
2803
3023
|
import { fileURLToPath } from "node:url";
|
|
2804
3024
|
var TEMPLATES = ["nextjs-saas"];
|
|
2805
3025
|
var SKIP = /* @__PURE__ */ new Set([
|
|
@@ -2820,7 +3040,7 @@ var packedName = (dotfile) => `_${dotfile.slice(1)}`;
|
|
|
2820
3040
|
function templatesDir() {
|
|
2821
3041
|
const fromEnv = process.env.VIBIZ_TEMPLATES_DIR?.trim();
|
|
2822
3042
|
if (fromEnv) return fromEnv;
|
|
2823
|
-
const here =
|
|
3043
|
+
const here = dirname5(fileURLToPath(import.meta.url));
|
|
2824
3044
|
const packaged = join5(here, "..", "templates");
|
|
2825
3045
|
if (existsSync(packaged)) return packaged;
|
|
2826
3046
|
return join5(here, "..", "..", "..", "templates");
|
|
@@ -2834,7 +3054,7 @@ function packageName(name) {
|
|
|
2834
3054
|
}
|
|
2835
3055
|
async function isEffectivelyEmpty(dir) {
|
|
2836
3056
|
try {
|
|
2837
|
-
return (await
|
|
3057
|
+
return (await readdir4(dir)).every((e) => HARMLESS.has(e));
|
|
2838
3058
|
} catch (err) {
|
|
2839
3059
|
if (err.code === "ENOENT") return true;
|
|
2840
3060
|
throw err;
|
|
@@ -2854,7 +3074,7 @@ async function scaffold(opts) {
|
|
|
2854
3074
|
}
|
|
2855
3075
|
}).catch((err) => {
|
|
2856
3076
|
if (err.code === "ENOENT") {
|
|
2857
|
-
throw new Error(`Template "${opts.template}" not found in ${
|
|
3077
|
+
throw new Error(`Template "${opts.template}" not found in ${dirname5(source)}`);
|
|
2858
3078
|
}
|
|
2859
3079
|
throw err;
|
|
2860
3080
|
});
|
|
@@ -2893,7 +3113,7 @@ async function setAppName(dir, name) {
|
|
|
2893
3113
|
// packages/cli/src/setup.ts
|
|
2894
3114
|
import { accessSync, constants } from "node:fs";
|
|
2895
3115
|
import { homedir, platform as platform2 } from "node:os";
|
|
2896
|
-
import { delimiter, dirname as
|
|
3116
|
+
import { delimiter, dirname as dirname6, join as join6 } from "node:path";
|
|
2897
3117
|
var CLIENT_NAMES = {
|
|
2898
3118
|
"claude code": "claude",
|
|
2899
3119
|
claude: "claude",
|
|
@@ -3016,7 +3236,7 @@ async function mergeJsonServer(io, path, key, entry) {
|
|
|
3016
3236
|
if (before && JSON.stringify(before) === JSON.stringify(entry)) return "unchanged";
|
|
3017
3237
|
doc[key] = { ...servers, vibiz: entry };
|
|
3018
3238
|
const local = io.local();
|
|
3019
|
-
await local.mkdir(
|
|
3239
|
+
await local.mkdir(dirname6(path), { recursive: true });
|
|
3020
3240
|
await local.writeFile(path, `${JSON.stringify(doc, null, 2)}
|
|
3021
3241
|
`);
|
|
3022
3242
|
return before ? "updated" : "added";
|
|
@@ -3025,9 +3245,9 @@ async function mergeCodexToml(io, path, url) {
|
|
|
3025
3245
|
const text2 = await readText2(io, path) ?? "";
|
|
3026
3246
|
if (/^\s*\[mcp_servers\.vibiz\]\s*$/m.test(text2)) return "unchanged";
|
|
3027
3247
|
const local = io.local();
|
|
3028
|
-
await local.mkdir(
|
|
3029
|
-
const
|
|
3030
|
-
await local.writeFile(path, `${text2}${
|
|
3248
|
+
await local.mkdir(dirname6(path), { recursive: true });
|
|
3249
|
+
const sep3 = text2 && !text2.endsWith("\n") ? "\n\n" : text2 ? "\n" : "";
|
|
3250
|
+
await local.writeFile(path, `${text2}${sep3}[mcp_servers.vibiz]
|
|
3031
3251
|
url = "${url}"
|
|
3032
3252
|
`);
|
|
3033
3253
|
return "added";
|
|
@@ -3177,7 +3397,7 @@ async function skillsAdd(io, api, names, opts) {
|
|
|
3177
3397
|
const res = await f(url);
|
|
3178
3398
|
if (!res.ok) throw new Error(`Could not download ${url} (${res.status})`);
|
|
3179
3399
|
const target = join6(dir, rel);
|
|
3180
|
-
await local.mkdir(
|
|
3400
|
+
await local.mkdir(dirname6(target), { recursive: true });
|
|
3181
3401
|
await local.writeFile(target, await res.text());
|
|
3182
3402
|
}
|
|
3183
3403
|
}
|
|
@@ -3731,6 +3951,9 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
|
|
|
3731
3951
|
vibiz whoami the account and key this machine uses
|
|
3732
3952
|
vibiz logout forget this machine's key (a browser login's key is
|
|
3733
3953
|
revoked too)
|
|
3954
|
+
vibiz feedback "<what happened>" [--kind bug|missing|confusing_error|docs|other]
|
|
3955
|
+
[--tool <command>] [--project <id>] tell the thelastapi team: something it can't do yet,
|
|
3956
|
+
an unclear error, wrong docs. The team reads every one
|
|
3734
3957
|
vibiz init <name> [--resources a,b|none] create a project here (default: hosting, database,
|
|
3735
3958
|
auth, analytics). Any one alone works for an app on
|
|
3736
3959
|
another host: --resources email, auth, ai, analytics\u2026
|
|
@@ -4147,6 +4370,16 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
|
|
|
4147
4370
|
vibiz files get <id> [--json] one file: its link, size, and the prompt if AI made it
|
|
4148
4371
|
vibiz files download <id> [-o path] save its bytes here (private files too)
|
|
4149
4372
|
vibiz files rm <id> delete it: its link stops working
|
|
4373
|
+
vibiz library ls [path] [-r] [--project id] [--json]
|
|
4374
|
+
the Library: folders of scripts, agent skills and notes,
|
|
4375
|
+
the account's (or a project's with --project). Stored
|
|
4376
|
+
only: nothing in it runs or is public
|
|
4377
|
+
vibiz library cat <path> print one file
|
|
4378
|
+
vibiz library put <local-file-or-folder> [remote-path]
|
|
4379
|
+
save a file, or a whole folder (a skill) recursively;
|
|
4380
|
+
files already there are replaced (text only, 1 MB each)
|
|
4381
|
+
vibiz library get <remote-path> [local-dir] download a file, or a folder recursively
|
|
4382
|
+
vibiz library mkdir <path> | mv <from> <to> [--force] | rm <path> [-r]
|
|
4150
4383
|
vibiz image "<prompt>" -o out.png [--size 1024x1024] [--model m] [--from-image <https url>] generate an image, or edit a photo
|
|
4151
4384
|
vibiz video "<prompt>" -o out.mp4 [--from-image <https url>] [--aspect 16:9|9:16] [--model m] [--params '<json>'] a short video (or animate an image)
|
|
4152
4385
|
vibiz media-models [words] [--category image-to-video] every image/video model you can run by id (Kling, face swap\u2026), with its live price
|
|
@@ -4409,13 +4642,13 @@ async function linkedProject(io) {
|
|
|
4409
4642
|
} catch {
|
|
4410
4643
|
return void 0;
|
|
4411
4644
|
}
|
|
4412
|
-
for (let dir = local.cwd(); ; dir =
|
|
4645
|
+
for (let dir = local.cwd(); ; dir = dirname7(dir)) {
|
|
4413
4646
|
try {
|
|
4414
4647
|
const linked = JSON.parse(await local.readFile(join7(dir, PROJECT_FILE), "utf8"));
|
|
4415
4648
|
if (linked.project_id) return linked.project_id;
|
|
4416
4649
|
} catch {
|
|
4417
4650
|
}
|
|
4418
|
-
if (
|
|
4651
|
+
if (dirname7(dir) === dir) return void 0;
|
|
4419
4652
|
}
|
|
4420
4653
|
}
|
|
4421
4654
|
async function buyDomainsCommand(io, vibiz2, values, sub, arg, third) {
|
|
@@ -4705,7 +4938,7 @@ async function framesCommand(io, id, values) {
|
|
|
4705
4938
|
const saved = /* @__PURE__ */ new Map();
|
|
4706
4939
|
if (values.out) {
|
|
4707
4940
|
const local = io.local();
|
|
4708
|
-
const dir =
|
|
4941
|
+
const dir = resolve3(local.cwd(), values.out);
|
|
4709
4942
|
await local.mkdir(dir, { recursive: true });
|
|
4710
4943
|
const vibiz2 = await io.client();
|
|
4711
4944
|
for (const f of out.frames) {
|
|
@@ -4743,9 +4976,9 @@ async function framesCommand(io, id, values) {
|
|
|
4743
4976
|
if (!out.frames.length) io.log(" none");
|
|
4744
4977
|
for (const f of out.frames) {
|
|
4745
4978
|
const where = `${clock(f.offset_ms).padStart(6)} ${f.kind.padEnd(14)} ${f.page}`;
|
|
4746
|
-
const
|
|
4979
|
+
const size2 = f.viewport ? ` ${f.viewport.width}x${f.viewport.height}` : "";
|
|
4747
4980
|
const label = f.label === f.page ? "" : ` ${f.label}`;
|
|
4748
|
-
io.log(` ${dot(f.status === "ready" ? "ready" : "failed")} ${where}${
|
|
4981
|
+
io.log(` ${dot(f.status === "ready" ? "ready" : "failed")} ${where}${size2}${label}`);
|
|
4749
4982
|
if (f.id && saved.has(f.id)) io.log(` saved ${saved.get(f.id)}`);
|
|
4750
4983
|
else if (f.image) io.log(` ${f.image.url}`);
|
|
4751
4984
|
if (f.error) io.log(` ${f.error.message} ${f.error.next_step}`);
|
|
@@ -5170,6 +5403,17 @@ function bytesLabel(n) {
|
|
|
5170
5403
|
if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
5171
5404
|
return `${(n / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
5172
5405
|
}
|
|
5406
|
+
var subcommands;
|
|
5407
|
+
function commandName(argv2) {
|
|
5408
|
+
const [command, sub] = argv2;
|
|
5409
|
+
if (!command || !/^[a-z][a-z-]{0,30}$/.test(command)) return null;
|
|
5410
|
+
subcommands ??= new Set(
|
|
5411
|
+
[...HELP.matchAll(/^ {2}vibiz ([a-z][a-z-]*) ([a-z][a-z-]*)(?=[\s|]|$)/gm)].map(
|
|
5412
|
+
(m) => `${m[1]} ${m[2]}`
|
|
5413
|
+
)
|
|
5414
|
+
);
|
|
5415
|
+
return sub && subcommands.has(`${command} ${sub}`) ? `${command} ${sub}` : command;
|
|
5416
|
+
}
|
|
5173
5417
|
function commandHelp(command) {
|
|
5174
5418
|
const lines = HELP.split("\n");
|
|
5175
5419
|
const out = [];
|
|
@@ -5300,6 +5544,8 @@ async function runCli(argv2, io) {
|
|
|
5300
5544
|
bucket: { type: "string" },
|
|
5301
5545
|
level: { type: "string" },
|
|
5302
5546
|
product: { type: "string" },
|
|
5547
|
+
// vibiz library ls -r, rm -r (docs: library)
|
|
5548
|
+
recursive: { type: "boolean", short: "r", default: false },
|
|
5303
5549
|
// vibiz search pages (docs: Search)
|
|
5304
5550
|
"not-indexed": { type: "boolean", default: false },
|
|
5305
5551
|
"owner-email": { type: "string" },
|
|
@@ -5527,6 +5773,29 @@ async function runCli(argv2, io) {
|
|
|
5527
5773
|
io.log(` api ${io.env.VIBIZ_API_URL || saved.apiUrl || DEFAULT_API_URL}`);
|
|
5528
5774
|
return;
|
|
5529
5775
|
}
|
|
5776
|
+
case "feedback": {
|
|
5777
|
+
const summary = positionals.join(" ").trim();
|
|
5778
|
+
const kinds = ["bug", "missing", "confusing_error", "docs", "other"];
|
|
5779
|
+
const kind = values.kind ?? "other";
|
|
5780
|
+
if (!summary) {
|
|
5781
|
+
throw new Error(
|
|
5782
|
+
'Say what happened: vibiz feedback "<what you needed or what went wrong>" [--kind bug|missing|confusing_error|docs|other]'
|
|
5783
|
+
);
|
|
5784
|
+
}
|
|
5785
|
+
if (!kinds.includes(kind)) throw new Error(`--kind is ${kinds.join(", ")}`);
|
|
5786
|
+
const out = await (await io.client()).feedback({
|
|
5787
|
+
kind,
|
|
5788
|
+
summary,
|
|
5789
|
+
...values.tool ? { tool: values.tool } : {},
|
|
5790
|
+
...values.project ? { project_id: values.project } : {}
|
|
5791
|
+
});
|
|
5792
|
+
if (values.json) {
|
|
5793
|
+
io.log(JSON.stringify(out, null, 2));
|
|
5794
|
+
return;
|
|
5795
|
+
}
|
|
5796
|
+
io.log(out.message);
|
|
5797
|
+
return;
|
|
5798
|
+
}
|
|
5530
5799
|
case "logout": {
|
|
5531
5800
|
const dir = io.configDir ?? CONFIG_DIR;
|
|
5532
5801
|
const saved = await readLogin(io, dir);
|
|
@@ -5624,7 +5893,7 @@ ${await oneKeyLines(vibiz2, project.id)}`);
|
|
|
5624
5893
|
const local = io.local();
|
|
5625
5894
|
const vibiz2 = await io.client();
|
|
5626
5895
|
const id = values.project ?? await io.project();
|
|
5627
|
-
const dir =
|
|
5896
|
+
const dir = resolve3(local.cwd(), positionals[0] ?? ".");
|
|
5628
5897
|
const { deployment, uploaded, total } = await deployDirectory(vibiz2, id, dir, {
|
|
5629
5898
|
target: values.preview ? "preview" : "production",
|
|
5630
5899
|
...values.message ? { message: values.message } : {},
|
|
@@ -6995,6 +7264,11 @@ ${await oneKeyLines(vibiz2, id)}`);
|
|
|
6995
7264
|
await dashboardsCommand(io, positionals, values);
|
|
6996
7265
|
return;
|
|
6997
7266
|
}
|
|
7267
|
+
case "library":
|
|
7268
|
+
case "lib": {
|
|
7269
|
+
await libraryCommand(io, positionals, values);
|
|
7270
|
+
return;
|
|
7271
|
+
}
|
|
6998
7272
|
case "replays": {
|
|
6999
7273
|
if (positionals[0] === "frames") {
|
|
7000
7274
|
await framesCommand(io, positionals[1], values);
|
|
@@ -7714,7 +7988,7 @@ Store the key now: it is not shown again.`
|
|
|
7714
7988
|
return;
|
|
7715
7989
|
}
|
|
7716
7990
|
case "docs": {
|
|
7717
|
-
const { DOC_TOPICS, DOCS } = await import("./src-
|
|
7991
|
+
const { DOC_TOPICS, DOCS } = await import("./src-M73GYB5U.js");
|
|
7718
7992
|
const topic = positionals[0];
|
|
7719
7993
|
if (!topic || !DOC_TOPICS.includes(topic)) {
|
|
7720
7994
|
for (const t of DOC_TOPICS) io.log(` vibiz docs ${t.padEnd(13)} ${DOCS[t].title}`);
|
|
@@ -7739,7 +8013,7 @@ ${DOCS[topic].body}`);
|
|
|
7739
8013
|
if (positionals[0])
|
|
7740
8014
|
throw new Error('usage: vibiz mcp (serve over stdio) | vibiz mcp add --clients "<client>"');
|
|
7741
8015
|
io.local();
|
|
7742
|
-
const { serveStdio } = await import("./src-
|
|
8016
|
+
const { serveStdio } = await import("./src-M73GYB5U.js");
|
|
7743
8017
|
await serveStdio({ version: cliVersion() });
|
|
7744
8018
|
return;
|
|
7745
8019
|
}
|
|
@@ -8174,19 +8448,27 @@ function openUrl(url) {
|
|
|
8174
8448
|
} catch {
|
|
8175
8449
|
}
|
|
8176
8450
|
}
|
|
8451
|
+
var runCommand = commandName(process.argv.slice(2));
|
|
8452
|
+
var agentHeaders = {
|
|
8453
|
+
"x-vibiz-session": `cli_${randomUUID()}`,
|
|
8454
|
+
...runCommand ? { "x-vibiz-tool": runCommand } : {}
|
|
8455
|
+
};
|
|
8456
|
+
var CLIENT = `vibiz-cli/${cliVersion()}`;
|
|
8177
8457
|
var terminal = {
|
|
8178
8458
|
log: (...parts) => console.log(format(...parts)),
|
|
8179
8459
|
error: (...parts) => console.error(format(...parts)),
|
|
8180
8460
|
out: (text2) => void process.stdout.write(text2),
|
|
8181
8461
|
err: (text2) => void process.stderr.write(text2),
|
|
8182
8462
|
env: process.env,
|
|
8183
|
-
client: async () => new Vibiz({ ...await login(), client:
|
|
8463
|
+
client: async () => new Vibiz({ ...await login(), client: CLIENT, headers: agentHeaders }),
|
|
8184
8464
|
aiClient: async (project) => {
|
|
8185
8465
|
const { apiKey, baseUrl } = await login();
|
|
8186
8466
|
const headers = project ? { "x-vibiz-project": project } : void 0;
|
|
8187
8467
|
return new Vibiz({
|
|
8188
8468
|
apiKey,
|
|
8189
8469
|
baseUrl,
|
|
8470
|
+
client: CLIENT,
|
|
8471
|
+
headers: agentHeaders,
|
|
8190
8472
|
...headers ? {
|
|
8191
8473
|
fetch: ((url, init) => fetch(url, {
|
|
8192
8474
|
...init,
|
|
@@ -8196,12 +8478,16 @@ var terminal = {
|
|
|
8196
8478
|
});
|
|
8197
8479
|
},
|
|
8198
8480
|
project: async () => {
|
|
8199
|
-
for (let dir = process.cwd(); ; dir =
|
|
8481
|
+
for (let dir = process.cwd(); ; dir = dirname8(dir)) {
|
|
8200
8482
|
const linked = await readJson2(join9(dir, PROJECT_FILE));
|
|
8201
8483
|
if (linked?.project_id) return linked.project_id;
|
|
8202
|
-
if (
|
|
8484
|
+
if (dirname8(dir) === dir) break;
|
|
8203
8485
|
}
|
|
8204
|
-
const list2 = await new Vibiz(
|
|
8486
|
+
const list2 = await new Vibiz({
|
|
8487
|
+
...await login(),
|
|
8488
|
+
client: CLIENT,
|
|
8489
|
+
headers: agentHeaders
|
|
8490
|
+
}).projects.list();
|
|
8205
8491
|
const wanted = process.env.VIBIZ_PROJECT?.trim().toLowerCase();
|
|
8206
8492
|
if (wanted) {
|
|
8207
8493
|
const p = list2.find((x) => [x.id, x.slug, x.name.toLowerCase()].includes(wanted));
|
package/package.json
CHANGED