@vectros-ai/cli 0.6.8 → 0.7.0
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/CHANGELOG.md +18 -0
- package/dist/cli.js +141 -9
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +141 -9
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -13423,6 +13423,7 @@ async function runRoleDelete(opts, deps = {}) {
|
|
|
13423
13423
|
}
|
|
13424
13424
|
|
|
13425
13425
|
// src/commands/context.ts
|
|
13426
|
+
import * as readline2 from "readline/promises";
|
|
13426
13427
|
function renderContext(c) {
|
|
13427
13428
|
return formatKeyValues([
|
|
13428
13429
|
["context", c.contextId],
|
|
@@ -13484,6 +13485,80 @@ async function runContextList(opts, deps = {}) {
|
|
|
13484
13485
|
}
|
|
13485
13486
|
});
|
|
13486
13487
|
}
|
|
13488
|
+
async function runContextDestroy(opts, deps = {}) {
|
|
13489
|
+
const { contextId } = opts;
|
|
13490
|
+
if (!opts.force) {
|
|
13491
|
+
const isTty = deps.isTty ?? Boolean(process.stdin.isTTY);
|
|
13492
|
+
if (!isTty) {
|
|
13493
|
+
process.stderr.write(
|
|
13494
|
+
` \u2716 context destroy is irreversible and needs an interactive confirmation.
|
|
13495
|
+
Re-run with --force to destroy '${contextId}' without a prompt.
|
|
13496
|
+
`
|
|
13497
|
+
);
|
|
13498
|
+
return 2;
|
|
13499
|
+
}
|
|
13500
|
+
const promptCtx = deps.createPrompt ? deps.createPrompt() : (() => {
|
|
13501
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
13502
|
+
return { prompt: (q) => rl.question(q), close: () => rl.close() };
|
|
13503
|
+
})();
|
|
13504
|
+
try {
|
|
13505
|
+
process.stdout.write(
|
|
13506
|
+
`
|
|
13507
|
+
\u26A0 Destroying app context '${contextId}' permanently erases it AND all of its
|
|
13508
|
+
records, documents, folders, schemas, roles, and access profiles, and revokes
|
|
13509
|
+
its scoped keys. This cannot be undone.
|
|
13510
|
+
|
|
13511
|
+
`
|
|
13512
|
+
);
|
|
13513
|
+
const typed = await promptCtx.prompt(` Type the context id ('${contextId}') to confirm: `);
|
|
13514
|
+
if (typed.trim() !== contextId) {
|
|
13515
|
+
process.stderr.write(` \u2716 Confirmation did not match \u2014 nothing destroyed.
|
|
13516
|
+
`);
|
|
13517
|
+
return 1;
|
|
13518
|
+
}
|
|
13519
|
+
} finally {
|
|
13520
|
+
promptCtx.close();
|
|
13521
|
+
}
|
|
13522
|
+
}
|
|
13523
|
+
return withAuth({ ...opts, provisioning: true }, deps, async (auth) => {
|
|
13524
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
13525
|
+
const url = `${auth.baseUrl.replace(/\/$/, "")}/developer/app-contexts/${encodeURIComponent(contextId)}?tenant=${encodeURIComponent(auth.tenant)}&confirm=${encodeURIComponent(contextId)}`;
|
|
13526
|
+
try {
|
|
13527
|
+
const res = await fetchImpl(url, {
|
|
13528
|
+
method: "DELETE",
|
|
13529
|
+
headers: { Authorization: `Bearer ${auth.cognitoToken}` }
|
|
13530
|
+
});
|
|
13531
|
+
if (!res.ok) {
|
|
13532
|
+
const body = await res.text().catch(() => "");
|
|
13533
|
+
let message = body;
|
|
13534
|
+
try {
|
|
13535
|
+
const parsed = JSON.parse(body);
|
|
13536
|
+
if (parsed.message) message = parsed.message;
|
|
13537
|
+
} catch {
|
|
13538
|
+
}
|
|
13539
|
+
process.stderr.write(` \u2716 context destroy failed: HTTP ${res.status}${message ? ` \u2014 ${message}` : ""}
|
|
13540
|
+
`);
|
|
13541
|
+
return 1;
|
|
13542
|
+
}
|
|
13543
|
+
if (opts.json) {
|
|
13544
|
+
process.stdout.write(`${formatJson({ contextId, status: "purging" })}
|
|
13545
|
+
`);
|
|
13546
|
+
return 0;
|
|
13547
|
+
}
|
|
13548
|
+
process.stdout.write(
|
|
13549
|
+
`
|
|
13550
|
+
\u2714 teardown of '${contextId}' started \u2014 the context and its contents are being
|
|
13551
|
+
deleted asynchronously (it reports status 'purging' until the drain completes)
|
|
13552
|
+
`
|
|
13553
|
+
);
|
|
13554
|
+
return 0;
|
|
13555
|
+
} catch (err) {
|
|
13556
|
+
process.stderr.write(` \u2716 context destroy failed: ${formatError(err)}
|
|
13557
|
+
`);
|
|
13558
|
+
return 1;
|
|
13559
|
+
}
|
|
13560
|
+
});
|
|
13561
|
+
}
|
|
13487
13562
|
async function runContextGet(opts, deps = {}) {
|
|
13488
13563
|
return withAuth({ ...opts, context: opts.contextId }, deps, async (auth) => {
|
|
13489
13564
|
const client = auth.client;
|
|
@@ -14068,7 +14143,7 @@ async function runBlueprintTest(fileOrName, opts, deps = {}) {
|
|
|
14068
14143
|
|
|
14069
14144
|
// src/build-info.ts
|
|
14070
14145
|
var BUILD_INFO = {
|
|
14071
|
-
cli: true ? "0.
|
|
14146
|
+
cli: true ? "0.7.0" : "dev",
|
|
14072
14147
|
sdk: true ? "0.33.0" : "dev",
|
|
14073
14148
|
blueprints: true ? "0.6.5" : "dev"
|
|
14074
14149
|
};
|
|
@@ -14144,18 +14219,75 @@ function buildProgram(deps = {}) {
|
|
|
14144
14219
|
}
|
|
14145
14220
|
function registerContextCommands(program, deps) {
|
|
14146
14221
|
const context = program.command("context").description("Manage app contexts (the namespace all data lives in).");
|
|
14147
|
-
const create = context.command("create").description("Create (idempotent) an app context.").argument("<contextId>", "context id (3-31 chars; lowercase letter + lowercase/digit/dash)").option("--name <name>", "human-readable name");
|
|
14148
|
-
addCommonAuthOptions(create).action(
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14222
|
+
const create = context.command("create").description("Create (idempotent) an app context.").argument("<contextId>", "context id (3-31 chars; lowercase letter + lowercase/digit/dash)").option("--name <name>", "human-readable name").option("--tenant <tenant>", "tenant to create the context in: 'test' or 'live' (default live)");
|
|
14223
|
+
addCommonAuthOptions(create).action(
|
|
14224
|
+
async (contextId, flags) => {
|
|
14225
|
+
if (flags.tenant !== void 0 && flags.tenant !== "test" && flags.tenant !== "live") {
|
|
14226
|
+
process.stderr.write(` \u2716 --tenant must be 'test' or 'live' (got '${flags.tenant}')
|
|
14227
|
+
`);
|
|
14228
|
+
process.exit(2);
|
|
14229
|
+
}
|
|
14230
|
+
process.exit(
|
|
14231
|
+
await runContextCreate(
|
|
14232
|
+
{
|
|
14233
|
+
...toCommonOptions(flags),
|
|
14234
|
+
contextId,
|
|
14235
|
+
name: flags.name,
|
|
14236
|
+
tenant: flags.tenant
|
|
14237
|
+
},
|
|
14238
|
+
deps
|
|
14239
|
+
)
|
|
14240
|
+
);
|
|
14241
|
+
}
|
|
14242
|
+
);
|
|
14243
|
+
const list = context.command("list").description("List the tenant\u2019s app contexts.").option("--tenant <tenant>", "tenant to list: 'test' or 'live' (default live)");
|
|
14152
14244
|
addCommonAuthOptions(list).action(async (flags) => {
|
|
14153
|
-
|
|
14245
|
+
if (flags.tenant !== void 0 && flags.tenant !== "test" && flags.tenant !== "live") {
|
|
14246
|
+
process.stderr.write(` \u2716 --tenant must be 'test' or 'live' (got '${flags.tenant}')
|
|
14247
|
+
`);
|
|
14248
|
+
process.exit(2);
|
|
14249
|
+
}
|
|
14250
|
+
process.exit(
|
|
14251
|
+
await runContextList({ ...toCommonOptions(flags), tenant: flags.tenant }, deps)
|
|
14252
|
+
);
|
|
14154
14253
|
});
|
|
14155
|
-
const get = context.command("get").description("Show one app context.").argument("<contextId>");
|
|
14254
|
+
const get = context.command("get").description("Show one app context.").argument("<contextId>").option("--tenant <tenant>", "tenant the context lives in: 'test' or 'live' (default live)");
|
|
14156
14255
|
addCommonAuthOptions(get).action(async (contextId, flags) => {
|
|
14157
|
-
|
|
14256
|
+
if (flags.tenant !== void 0 && flags.tenant !== "test" && flags.tenant !== "live") {
|
|
14257
|
+
process.stderr.write(` \u2716 --tenant must be 'test' or 'live' (got '${flags.tenant}')
|
|
14258
|
+
`);
|
|
14259
|
+
process.exit(2);
|
|
14260
|
+
}
|
|
14261
|
+
process.exit(
|
|
14262
|
+
await runContextGet(
|
|
14263
|
+
{ ...toCommonOptions(flags), contextId, tenant: flags.tenant },
|
|
14264
|
+
deps
|
|
14265
|
+
)
|
|
14266
|
+
);
|
|
14158
14267
|
});
|
|
14268
|
+
const destroy = context.command("destroy").description(
|
|
14269
|
+
"Permanently destroy an app context and ALL of its data (irreversible; asks for confirmation)."
|
|
14270
|
+
).argument("<contextId>", "the app context to destroy").option("--force", "skip the interactive confirmation (required when stdin is not a TTY)").option("--tenant <tenant>", "tenant the context lives in: 'test' or 'live' (default live)");
|
|
14271
|
+
addCommonAuthOptions(destroy).action(
|
|
14272
|
+
async (contextId, flags) => {
|
|
14273
|
+
if (flags.tenant !== void 0 && flags.tenant !== "test" && flags.tenant !== "live") {
|
|
14274
|
+
process.stderr.write(` \u2716 --tenant must be 'test' or 'live' (got '${flags.tenant}')
|
|
14275
|
+
`);
|
|
14276
|
+
process.exit(2);
|
|
14277
|
+
}
|
|
14278
|
+
process.exit(
|
|
14279
|
+
await runContextDestroy(
|
|
14280
|
+
{
|
|
14281
|
+
...toCommonOptions(flags),
|
|
14282
|
+
contextId,
|
|
14283
|
+
force: Boolean(flags.force),
|
|
14284
|
+
tenant: flags.tenant
|
|
14285
|
+
},
|
|
14286
|
+
deps
|
|
14287
|
+
)
|
|
14288
|
+
);
|
|
14289
|
+
}
|
|
14290
|
+
);
|
|
14159
14291
|
}
|
|
14160
14292
|
function registerRoleCommands(program, deps) {
|
|
14161
14293
|
const role = program.command("role").description("Manage context-scoped roles (reusable scope rules; bind via `access grant --role`).");
|