@bagdock/cli 0.8.0 → 0.9.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/bagdock.js +83 -2
- package/package.json +1 -1
package/dist/bagdock.js
CHANGED
|
@@ -4107,7 +4107,9 @@ Deploying ${config.slug}@${config.version} → ${envLabel}
|
|
|
4107
4107
|
environment,
|
|
4108
4108
|
compatibilityDate: config.compatibilityDate ?? "2024-09-23",
|
|
4109
4109
|
...config.kv ? { kv: config.kv } : {},
|
|
4110
|
-
...config.webhooks ? { webhooks: config.webhooks } : {}
|
|
4110
|
+
...config.webhooks ? { webhooks: config.webhooks } : {},
|
|
4111
|
+
...config.inputs ? { inputs: config.inputs } : {},
|
|
4112
|
+
...config.displays ? { displays: config.displays } : {}
|
|
4111
4113
|
}));
|
|
4112
4114
|
try {
|
|
4113
4115
|
const res = await fetch(`${getApiBase()}/api/v1/developer/apps/${config.slug}/deploy`, {
|
|
@@ -4407,6 +4409,72 @@ async function validate() {
|
|
|
4407
4409
|
}
|
|
4408
4410
|
}
|
|
4409
4411
|
}
|
|
4412
|
+
if (config.inputs !== undefined) {
|
|
4413
|
+
if (!Array.isArray(config.inputs)) {
|
|
4414
|
+
checks.push({ name: "Inputs", status: "fail", message: '"inputs" must be an array of { key, label, type, required }' });
|
|
4415
|
+
} else {
|
|
4416
|
+
const problems = [];
|
|
4417
|
+
const seen = new Set;
|
|
4418
|
+
config.inputs.forEach((inp, i) => {
|
|
4419
|
+
if (!inp || typeof inp !== "object") {
|
|
4420
|
+
problems.push(`#${i} is not an object`);
|
|
4421
|
+
return;
|
|
4422
|
+
}
|
|
4423
|
+
const id = typeof inp.key === "string" && inp.key ? inp.key : `#${i}`;
|
|
4424
|
+
if (typeof inp.key !== "string" || !inp.key.trim())
|
|
4425
|
+
problems.push(`${id} "key" must be a non-empty string`);
|
|
4426
|
+
if (typeof inp.label !== "string" || !inp.label.trim())
|
|
4427
|
+
problems.push(`${id} "label" must be a non-empty string`);
|
|
4428
|
+
if (inp.type !== "text" && inp.type !== "password")
|
|
4429
|
+
problems.push(`${id} type must be "text" or "password" (got "${inp.type}")`);
|
|
4430
|
+
if (typeof inp.required !== "boolean")
|
|
4431
|
+
problems.push(`${id} "required" must be a boolean`);
|
|
4432
|
+
if (inp.help !== undefined && typeof inp.help !== "string")
|
|
4433
|
+
problems.push(`${id} "help" must be a string`);
|
|
4434
|
+
if (inp.placeholder !== undefined && typeof inp.placeholder !== "string")
|
|
4435
|
+
problems.push(`${id} "placeholder" must be a string`);
|
|
4436
|
+
if (typeof inp.key === "string" && inp.key) {
|
|
4437
|
+
if (seen.has(inp.key))
|
|
4438
|
+
problems.push(`duplicate key "${inp.key}"`);
|
|
4439
|
+
seen.add(inp.key);
|
|
4440
|
+
}
|
|
4441
|
+
});
|
|
4442
|
+
if (problems.length) {
|
|
4443
|
+
checks.push({ name: "Inputs", status: "fail", message: problems.join("; ") });
|
|
4444
|
+
} else {
|
|
4445
|
+
checks.push({ name: "Inputs", status: "pass", message: `${config.inputs.length} declared` });
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
if (config.displays !== undefined) {
|
|
4450
|
+
if (!Array.isArray(config.displays)) {
|
|
4451
|
+
checks.push({ name: "Displays", status: "fail", message: '"displays" must be an array of { label, value|template, copyable? }' });
|
|
4452
|
+
} else {
|
|
4453
|
+
const problems = [];
|
|
4454
|
+
config.displays.forEach((d, i) => {
|
|
4455
|
+
if (!d || typeof d !== "object") {
|
|
4456
|
+
problems.push(`#${i} is not an object`);
|
|
4457
|
+
return;
|
|
4458
|
+
}
|
|
4459
|
+
const id = typeof d.label === "string" && d.label ? `"${d.label}"` : `#${i}`;
|
|
4460
|
+
if (typeof d.label !== "string" || !d.label.trim())
|
|
4461
|
+
problems.push(`${id} "label" must be a non-empty string`);
|
|
4462
|
+
if (d.value === undefined && d.template === undefined)
|
|
4463
|
+
problems.push(`${id} needs "value" or "template"`);
|
|
4464
|
+
if (d.value !== undefined && typeof d.value !== "string")
|
|
4465
|
+
problems.push(`${id} "value" must be a string`);
|
|
4466
|
+
if (d.template !== undefined && typeof d.template !== "string")
|
|
4467
|
+
problems.push(`${id} "template" must be a string`);
|
|
4468
|
+
if (d.copyable !== undefined && typeof d.copyable !== "boolean")
|
|
4469
|
+
problems.push(`${id} "copyable" must be a boolean`);
|
|
4470
|
+
});
|
|
4471
|
+
if (problems.length) {
|
|
4472
|
+
checks.push({ name: "Displays", status: "fail", message: problems.join("; ") });
|
|
4473
|
+
} else {
|
|
4474
|
+
checks.push({ name: "Displays", status: "pass", message: `${config.displays.length} declared` });
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4410
4478
|
const linked = resolveSlug();
|
|
4411
4479
|
if (linked && linked !== config.slug) {
|
|
4412
4480
|
checks.push({ name: "Project link", status: "warn", message: `bagdock.json slug "${config.slug}" differs from linked project "${linked}"` });
|
|
@@ -5097,6 +5165,11 @@ var init_logs = __esm(() => {
|
|
|
5097
5165
|
init_output();
|
|
5098
5166
|
});
|
|
5099
5167
|
|
|
5168
|
+
// bin/bagdock.ts
|
|
5169
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
5170
|
+
import { dirname as dirname2, join as join8 } from "node:path";
|
|
5171
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
5172
|
+
|
|
5100
5173
|
// node_modules/commander/esm.mjs
|
|
5101
5174
|
var import__ = __toESM(require_commander(), 1);
|
|
5102
5175
|
var {
|
|
@@ -5428,8 +5501,16 @@ function toPascalCase(s) {
|
|
|
5428
5501
|
// bin/bagdock.ts
|
|
5429
5502
|
init_output();
|
|
5430
5503
|
init_config();
|
|
5504
|
+
var pkgVersion = (() => {
|
|
5505
|
+
try {
|
|
5506
|
+
const here = dirname2(fileURLToPath3(import.meta.url));
|
|
5507
|
+
return JSON.parse(readFileSync5(join8(here, "..", "package.json"), "utf8")).version;
|
|
5508
|
+
} catch {
|
|
5509
|
+
return "0.0.0";
|
|
5510
|
+
}
|
|
5511
|
+
})();
|
|
5431
5512
|
var program2 = new Command;
|
|
5432
|
-
program2.name("bagdock").description("Bagdock developer CLI — built for humans, AI agents, and CI/CD pipelines").version(
|
|
5513
|
+
program2.name("bagdock").description("Bagdock developer CLI — built for humans, AI agents, and CI/CD pipelines").version(pkgVersion).option("--json", "Force JSON output (auto-enabled in non-TTY)").option("-q, --quiet", "Suppress status messages (implies --json)").option("--api-key <key>", "API key to use for this invocation").option("-p, --profile <name>", "Profile to use (overrides BAGDOCK_PROFILE)").option("--env <environment>", "Override environment for this invocation (live, test)").option("--ngrok", "Use API URLs from .env.local (for ngrok tunnels)").hook("preAction", (_thisCommand, actionCommand) => {
|
|
5433
5514
|
const opts = program2.opts();
|
|
5434
5515
|
setOutputMode({ json: opts.json, quiet: opts.quiet });
|
|
5435
5516
|
if (opts.ngrok)
|