@corvio/cli 0.1.0-beta.13 → 0.1.0-beta.14
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/cli.js +31 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
agentCredentialPath,
|
|
40
40
|
} from "./core.js";
|
|
41
41
|
|
|
42
|
-
const VERSION = "0.1.0-beta.
|
|
42
|
+
const VERSION = "0.1.0-beta.14";
|
|
43
43
|
const DEFAULT_API_BASE = "https://api.corvio.ai/v1";
|
|
44
44
|
const DEFAULT_APP_BASE = "https://corvio.ai";
|
|
45
45
|
const USER_AGENT = `corvio-cli/${VERSION}`;
|
|
@@ -91,14 +91,16 @@ const COMMAND_OPTIONS = Object.freeze({
|
|
|
91
91
|
"conversations:list": ["limit", "cursor"],
|
|
92
92
|
"conversations:get": ["id"],
|
|
93
93
|
"search:": ["query", "limit", "page-id", "node-id"],
|
|
94
|
-
"docs:list": ["limit", "cursor"],
|
|
94
|
+
"docs:list": ["limit", "cursor", "lifecycle"],
|
|
95
95
|
"docs:get": ["id", "output"],
|
|
96
96
|
"docs:create": ["title", "file", "markdown", "parent-node-id", "idempotency-key"],
|
|
97
97
|
"docs:update": ["id", "title", "file", "markdown", "expected-revision", "change-summary"],
|
|
98
98
|
"docs:move": ["id", "parent-node-id", "before-node-id", "after-node-id", "idempotency-key"],
|
|
99
99
|
"docs:archive": ["id"],
|
|
100
|
+
"docs:restore": ["id"],
|
|
100
101
|
"docs:share": ["id", "display-name"],
|
|
101
102
|
"docs:open": ["id"],
|
|
103
|
+
"projects:list": ["limit"],
|
|
102
104
|
"projects:create": ["title", "idempotency-key"],
|
|
103
105
|
"files:list": ["limit"],
|
|
104
106
|
"files:get": ["id"],
|
|
@@ -127,8 +129,8 @@ Usage:
|
|
|
127
129
|
corvio questions list|get [id]
|
|
128
130
|
corvio conversations list|get [id]
|
|
129
131
|
corvio search <query>
|
|
130
|
-
corvio docs list|get|create|update|move|archive|share|open [id]
|
|
131
|
-
corvio projects create
|
|
132
|
+
corvio docs list|get|create|update|move|archive|restore|share|open [id]
|
|
133
|
+
corvio projects list|create
|
|
132
134
|
corvio files list|get|download|upload|organize|open [id]
|
|
133
135
|
corvio sync init|status|plan|pull|push|resolve
|
|
134
136
|
corvio update check
|
|
@@ -155,8 +157,8 @@ const COMMAND_HELP = Object.freeze({
|
|
|
155
157
|
questions: `Usage:\n corvio questions list [--limit <n>] [--cursor <cursor>] [--conversation-id <id>]\n corvio questions get <question-id>`,
|
|
156
158
|
conversations: `Usage:\n corvio conversations list [--limit <n>] [--cursor <cursor>]\n corvio conversations get <conversation-id>`,
|
|
157
159
|
search: `Usage: corvio search <query> [--limit <n>] [--page-id <id>] [--node-id <id>]`,
|
|
158
|
-
docs: `Usage:\n corvio docs list [--limit <n>] [--cursor <cursor>]\n corvio docs get <id> [--output <path>]\n corvio docs create --title <title> [--file <path>|--markdown <text>] [--parent-node-id <id>] [--idempotency-key <key>]\n corvio docs update <id> [--title <title>] [--file <path>|--markdown <text>] [--expected-revision <n>] [--change-summary <text>]\n corvio docs move <id> --parent-node-id <id>\n corvio docs archive <id> --yes\n corvio docs share <id> --yes [--display-name <name>]\n corvio docs open <id>\n\
|
|
159
|
-
projects: `Usage
|
|
160
|
+
docs: `Usage:\n corvio docs list [--limit <n>] [--cursor <cursor>] [--lifecycle active|archived]\n corvio docs get <id> [--output <path>]\n corvio docs create --title <title> [--file <path>|--markdown <text>] [--parent-node-id <id>] [--idempotency-key <key>]\n corvio docs update <id> [--title <title>] [--file <path>|--markdown <text>] [--expected-revision <n>] [--change-summary <text>]\n corvio docs move <id> --parent-node-id <id>\n corvio docs archive <id> --yes\n corvio docs restore <id> --yes\n corvio docs share <id> --yes [--display-name <name>]\n corvio docs open <id>\n\nDirect document commands operate on canonical Page/Markdown. Use \`corvio ask --allow-actions\` for Spreadsheet, Presentation, Code, HTML Artifact, or semantic organization. Agent-authenticated document updates require --change-summary and create a visible document-level comment after the guarded update. When a document/comment is the task owner, use \`corvio agent comments|reply|status\` to return verified work to that same collaboration surface.`,
|
|
161
|
+
projects: `Usage:\n corvio projects list [--limit <n>]\n corvio projects create --title <title> [--idempotency-key <key>]\n\nProjects are durable grouping owners in the Corvio Docs tree. Reuse a matching Project instead of creating one ceremonial Project per file. 'corvio folders' is an alias.`,
|
|
160
162
|
files: `Usage:\n corvio files list [--limit <n>]\n corvio files get <id>\n corvio files download <id> [--output <path>]\n corvio files upload --file <path> [--mime-type <type>]\n corvio files organize <id> --instruction <text> --yes [--target-root-node-id <id>]\n corvio files open <id>`,
|
|
161
163
|
sync: `Usage:\n corvio sync init --root-node-id <id> [--dir <path>] [--name <name>]\n corvio sync status|plan|pull [--dir <path>]\n corvio sync push --yes [--dir <path>]\n corvio sync resolve --conflict-id <id> --strategy use-remote|keep-local --yes [--dir <path>]`,
|
|
162
164
|
update: `Usage: corvio update check [--json]\n\nCompare this executable with the reviewed API policy and the npm beta dist-tag.`,
|
|
@@ -180,7 +182,7 @@ function normalizeInvocation(command, action) {
|
|
|
180
182
|
questions: "list",
|
|
181
183
|
conversations: "list",
|
|
182
184
|
docs: "list",
|
|
183
|
-
projects: "
|
|
185
|
+
projects: "list",
|
|
184
186
|
files: "list",
|
|
185
187
|
agents: "list",
|
|
186
188
|
agent: "claim",
|
|
@@ -211,6 +213,7 @@ function validateInvocation(options, positionals) {
|
|
|
211
213
|
"docs:update",
|
|
212
214
|
"docs:move",
|
|
213
215
|
"docs:archive",
|
|
216
|
+
"docs:restore",
|
|
214
217
|
"docs:share",
|
|
215
218
|
"docs:open",
|
|
216
219
|
"files:get",
|
|
@@ -2246,9 +2249,19 @@ async function docs(options, action, id) {
|
|
|
2246
2249
|
const documentId = id || options.id;
|
|
2247
2250
|
let result;
|
|
2248
2251
|
if (action === "list") {
|
|
2249
|
-
|
|
2252
|
+
const lifecycle = String(options.lifecycle || "active").trim().toLowerCase();
|
|
2253
|
+
if (!new Set(["active", "archived"]).has(lifecycle)) {
|
|
2254
|
+
throw new CliError("--lifecycle must be active or archived.", { code: "document_lifecycle_invalid" });
|
|
2255
|
+
}
|
|
2256
|
+
result = await api.request("/documents", { query: { ...pageQuery(options), lifecycle } });
|
|
2250
2257
|
} else if (action === "get") {
|
|
2251
2258
|
result = await api.request(`/documents/${resourcePath(documentId || option(options, "id", { required: true }))}`);
|
|
2259
|
+
if (executionIdentity === "agent") {
|
|
2260
|
+
result = {
|
|
2261
|
+
...result,
|
|
2262
|
+
collaboration_follow_up: "If this document or one of its comments is the task/feedback owner and materially drives your work, reread current state after the work, update an explicit status only when unambiguous, reply on the originating thread with verified evidence, and resolve only after completion. A read-only citation needs no ceremonial comment.",
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2252
2265
|
if (options.output) {
|
|
2253
2266
|
await writeTextFile(options.output, String(result.markdown || ""));
|
|
2254
2267
|
result = { ...result, output: options.output };
|
|
@@ -2361,6 +2374,9 @@ async function docs(options, action, id) {
|
|
|
2361
2374
|
} else if (action === "archive") {
|
|
2362
2375
|
requireConfirmation(options, "Archiving a document");
|
|
2363
2376
|
result = await api.request(`/documents/${resourcePath(documentId || option(options, "id", { required: true }))}`, { method: "DELETE" });
|
|
2377
|
+
} else if (action === "restore") {
|
|
2378
|
+
requireConfirmation(options, "Restoring an archived document");
|
|
2379
|
+
result = await api.request(`/documents/${resourcePath(documentId || option(options, "id", { required: true }))}/restore`, { method: "POST", retrySafe: true });
|
|
2364
2380
|
} else if (action === "share") {
|
|
2365
2381
|
requireConfirmation(options, "Creating a document share link");
|
|
2366
2382
|
result = await api.request(`/documents/${resourcePath(documentId || option(options, "id", { required: true }))}/shares`, {
|
|
@@ -2374,16 +2390,20 @@ async function docs(options, action, id) {
|
|
|
2374
2390
|
const opened = options["no-input"] ? false : await openBrowser(target);
|
|
2375
2391
|
result = { document_id: targetId, url: target, opened };
|
|
2376
2392
|
} else {
|
|
2377
|
-
throw new CliError("docs action must be list, get, create, update, move, archive, share, or open.");
|
|
2393
|
+
throw new CliError("docs action must be list, get, create, update, move, archive, restore, share, or open.");
|
|
2378
2394
|
}
|
|
2379
2395
|
writeResult(result, { json: options.json });
|
|
2380
2396
|
}
|
|
2381
2397
|
|
|
2382
2398
|
async function projects(options, action) {
|
|
2399
|
+
const { api } = await client(options);
|
|
2400
|
+
if (action === "list") {
|
|
2401
|
+
writeResult(await api.request("/projects", { query: { limit: numberOption(options, "limit", 100, { maximum: 100 }) } }), { json: options.json });
|
|
2402
|
+
return;
|
|
2403
|
+
}
|
|
2383
2404
|
if (action !== "create") {
|
|
2384
|
-
throw new CliError("projects action must be create.");
|
|
2405
|
+
throw new CliError("projects action must be list or create.");
|
|
2385
2406
|
}
|
|
2386
|
-
const { api } = await client(options);
|
|
2387
2407
|
const result = await api.request("/projects", {
|
|
2388
2408
|
method: "POST",
|
|
2389
2409
|
headers: { "idempotency-key": idempotencyKey(options) },
|