@vectros-ai/cli 0.6.7 → 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 +28 -0
- package/dist/cli.js +145 -17
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +145 -17
- package/dist/cli.mjs.map +1 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -4898,7 +4898,7 @@ var DocumentsClient = class {
|
|
|
4898
4898
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/documents/{id}");
|
|
4899
4899
|
}
|
|
4900
4900
|
/**
|
|
4901
|
-
* Partially updates a document using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged: keys you send overwrite existing values (recursing into nested objects), a key set to `null` is deleted, and keys you omit are preserved — unlike PUT, which replaces the whole payload. Top-level fields (`title`, `
|
|
4901
|
+
* Partially updates a document using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged: keys you send overwrite existing values (recursing into nested objects), a key set to `null` is deleted, and keys you omit are preserved — unlike PUT, which replaces the whole payload. Top-level fields (`title`, `folderId`, `schemaId`, ownership) are set when present and left unchanged when omitted; sending a top-level field as `null` is rejected. Supplying `text` re-ingests the document body (same as PUT). `indexMode`, `externalId`, and `storeText` (text retention is fixed at ingest) are immutable and rejected if present. The merged result is validated against the bound schema. Pass `expectedVersion` for optimistic concurrency (409 on conflict). Requires the `documents:u` scope.
|
|
4902
4902
|
*
|
|
4903
4903
|
* @param {Vectros.PatchDocumentRequest} request
|
|
4904
4904
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5150,7 +5150,7 @@ var DocumentsClient = class {
|
|
|
5150
5150
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/documents/{id}/download");
|
|
5151
5151
|
}
|
|
5152
5152
|
/**
|
|
5153
|
-
* Returns the full
|
|
5153
|
+
* Returns the document's full text body when it is retained: always available for text-ingested documents, and for file-uploaded documents unless they were uploaded with `storeText=false` (which discards the extracted text once indexing completes — the original file remains available via `GET /{id}/download`). Returns 404 when the document does not exist, its text was not retained, or extraction has not yet completed. Requires the `documents:r` scope.
|
|
5154
5154
|
*
|
|
5155
5155
|
* @param {Vectros.GetDocumentTextRequest} request
|
|
5156
5156
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -11572,11 +11572,7 @@ async function runLoader(client, input) {
|
|
|
11572
11572
|
schemaId,
|
|
11573
11573
|
externalId: rec.externalId,
|
|
11574
11574
|
// Optional structured payload (the document's `fields`); omitted when absent.
|
|
11575
|
-
payload: rec.fields
|
|
11576
|
-
// Retain the raw text so a seeded document is retrievable via
|
|
11577
|
-
// GET /v1/documents/{id}/text (mirrors the MCP document_ingest default) —
|
|
11578
|
-
// a seed's text IS its content, worth keeping for the getting-started graph.
|
|
11579
|
-
storeText: true
|
|
11575
|
+
payload: rec.fields
|
|
11580
11576
|
}
|
|
11581
11577
|
});
|
|
11582
11578
|
if (created.id) seededDocumentIds.push(created.id);
|
|
@@ -13427,6 +13423,7 @@ async function runRoleDelete(opts, deps = {}) {
|
|
|
13427
13423
|
}
|
|
13428
13424
|
|
|
13429
13425
|
// src/commands/context.ts
|
|
13426
|
+
import * as readline2 from "readline/promises";
|
|
13430
13427
|
function renderContext(c) {
|
|
13431
13428
|
return formatKeyValues([
|
|
13432
13429
|
["context", c.contextId],
|
|
@@ -13488,6 +13485,80 @@ async function runContextList(opts, deps = {}) {
|
|
|
13488
13485
|
}
|
|
13489
13486
|
});
|
|
13490
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
|
+
}
|
|
13491
13562
|
async function runContextGet(opts, deps = {}) {
|
|
13492
13563
|
return withAuth({ ...opts, context: opts.contextId }, deps, async (auth) => {
|
|
13493
13564
|
const client = auth.client;
|
|
@@ -14072,8 +14143,8 @@ async function runBlueprintTest(fileOrName, opts, deps = {}) {
|
|
|
14072
14143
|
|
|
14073
14144
|
// src/build-info.ts
|
|
14074
14145
|
var BUILD_INFO = {
|
|
14075
|
-
cli: true ? "0.
|
|
14076
|
-
sdk: true ? "0.
|
|
14146
|
+
cli: true ? "0.7.0" : "dev",
|
|
14147
|
+
sdk: true ? "0.33.0" : "dev",
|
|
14077
14148
|
blueprints: true ? "0.6.5" : "dev"
|
|
14078
14149
|
};
|
|
14079
14150
|
function formatBuildInfo() {
|
|
@@ -14148,18 +14219,75 @@ function buildProgram(deps = {}) {
|
|
|
14148
14219
|
}
|
|
14149
14220
|
function registerContextCommands(program, deps) {
|
|
14150
14221
|
const context = program.command("context").description("Manage app contexts (the namespace all data lives in).");
|
|
14151
|
-
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");
|
|
14152
|
-
addCommonAuthOptions(create).action(
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
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)");
|
|
14156
14244
|
addCommonAuthOptions(list).action(async (flags) => {
|
|
14157
|
-
|
|
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
|
+
);
|
|
14158
14253
|
});
|
|
14159
|
-
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)");
|
|
14160
14255
|
addCommonAuthOptions(get).action(async (contextId, flags) => {
|
|
14161
|
-
|
|
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
|
+
);
|
|
14162
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
|
+
);
|
|
14163
14291
|
}
|
|
14164
14292
|
function registerRoleCommands(program, deps) {
|
|
14165
14293
|
const role = program.command("role").description("Manage context-scoped roles (reusable scope rules; bind via `access grant --role`).");
|