@artis-lab/cli 0.10.0 → 0.12.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/README.md +25 -9
- package/package.json +8 -9
- package/src/bin.js +20 -13
- package/src/index.js +70 -3
- package/src/lib/args.js +10 -19
- package/src/lib/chunk-H32QAUSA.js +49 -0
- package/src/lib/chunk-IZYFOV2K.js +8 -0
- package/src/lib/chunk-KY47KP5E.js +67 -0
- package/src/lib/chunk-OBEJTKCR.js +319 -0
- package/src/lib/chunk-QDQQASRY.js +117 -0
- package/src/lib/chunk-QNS7GLAA.js +63 -0
- package/src/lib/chunk-U3ZF6SRR.js +25 -0
- package/src/lib/chunk-YAZGW7Y4.js +10781 -0
- package/src/lib/chunk-YXGHBN47.js +2126 -0
- package/src/lib/cli.d.ts +61 -12
- package/src/lib/cli.js +70 -1206
- package/src/lib/config.js +16 -58
- package/src/lib/exit-codes.js +13 -48
- package/src/lib/files.d.ts +19 -0
- package/src/lib/files.js +13 -0
- package/src/lib/revision-bases.d.ts +2 -3
- package/src/lib/revision-bases.js +11 -75
- package/src/lib/skill-install.d.ts +1 -1
- package/src/lib/skill-install.js +15 -323
- package/src/lib/verify.d.ts +83 -4
- package/src/lib/verify.js +32 -395
- package/src/lib/version.d.ts +6 -4
- package/src/lib/version.js +6 -11
|
@@ -0,0 +1,2126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
installSkillFromCli
|
|
3
|
+
} from "./chunk-OBEJTKCR.js";
|
|
4
|
+
import {
|
|
5
|
+
VerifyUnavailableError,
|
|
6
|
+
composeSlidesFiles,
|
|
7
|
+
formatVerifyReport,
|
|
8
|
+
verifyHtml,
|
|
9
|
+
verifyTypes
|
|
10
|
+
} from "./chunk-YAZGW7Y4.js";
|
|
11
|
+
import {
|
|
12
|
+
artisCliVersion
|
|
13
|
+
} from "./chunk-IZYFOV2K.js";
|
|
14
|
+
import {
|
|
15
|
+
hasFlag,
|
|
16
|
+
parseFlagValue
|
|
17
|
+
} from "./chunk-U3ZF6SRR.js";
|
|
18
|
+
import {
|
|
19
|
+
changedFiles,
|
|
20
|
+
readFilesDir,
|
|
21
|
+
writeFilesDir
|
|
22
|
+
} from "./chunk-QDQQASRY.js";
|
|
23
|
+
import {
|
|
24
|
+
CliError,
|
|
25
|
+
exitCodeForResponse,
|
|
26
|
+
exitCodes,
|
|
27
|
+
usageError
|
|
28
|
+
} from "./chunk-H32QAUSA.js";
|
|
29
|
+
import {
|
|
30
|
+
getRememberedBase,
|
|
31
|
+
rememberBase
|
|
32
|
+
} from "./chunk-KY47KP5E.js";
|
|
33
|
+
import {
|
|
34
|
+
ARTIS_DEFAULT_HOST,
|
|
35
|
+
findProfileForHost,
|
|
36
|
+
getConfigPath,
|
|
37
|
+
normalizeHost,
|
|
38
|
+
readCliConfig,
|
|
39
|
+
saveDefaultProfile
|
|
40
|
+
} from "./chunk-QNS7GLAA.js";
|
|
41
|
+
|
|
42
|
+
// packages/cli/src/lib/cli.ts
|
|
43
|
+
import { spawn } from "node:child_process";
|
|
44
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
45
|
+
import { basename, extname } from "node:path";
|
|
46
|
+
|
|
47
|
+
// packages/api-contract/src/client.ts
|
|
48
|
+
var htmlUploadContentType = "text/html; charset=utf-8";
|
|
49
|
+
var ApiError = class extends Error {
|
|
50
|
+
constructor(status, code, message, body, headers) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.status = status;
|
|
53
|
+
this.code = code;
|
|
54
|
+
this.body = body;
|
|
55
|
+
this.name = "ApiError";
|
|
56
|
+
const retryAfter = Number(headers?.get("retry-after"));
|
|
57
|
+
this.retryAfter = Number.isFinite(retryAfter) && retryAfter > 0 ? retryAfter : void 0;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function appendQuery(query, name, value) {
|
|
61
|
+
if (value === void 0 || value === null) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(value)) {
|
|
65
|
+
for (const item of value) appendQuery(query, name, item);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
query.append(
|
|
69
|
+
name,
|
|
70
|
+
typeof value === "object" ? JSON.stringify(value) : String(value)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function buildRequest(baseUrl, key, input = {}) {
|
|
74
|
+
const space = key.indexOf(" ");
|
|
75
|
+
const method = key.slice(0, space);
|
|
76
|
+
const path = key.slice(space + 1).replace(/\{([^}]+)\}/g, (_, name) => {
|
|
77
|
+
const value = input.params?.[name];
|
|
78
|
+
if (value === void 0) {
|
|
79
|
+
throw new Error(`${key}: missing path parameter ${name}`);
|
|
80
|
+
}
|
|
81
|
+
return encodeURIComponent(value);
|
|
82
|
+
});
|
|
83
|
+
const query = new URLSearchParams();
|
|
84
|
+
for (const [name, value] of Object.entries(input.query ?? {})) {
|
|
85
|
+
appendQuery(query, name, value);
|
|
86
|
+
}
|
|
87
|
+
const search = query.toString();
|
|
88
|
+
const headers = {};
|
|
89
|
+
let body;
|
|
90
|
+
if (typeof input.body === "string" || input.body instanceof Uint8Array) {
|
|
91
|
+
const bytes = typeof input.body === "string" ? new TextEncoder().encode(input.body) : input.body;
|
|
92
|
+
headers["content-type"] = htmlUploadContentType;
|
|
93
|
+
headers["content-length"] = String(bytes.byteLength);
|
|
94
|
+
body = bytes;
|
|
95
|
+
} else if (input.body !== void 0) {
|
|
96
|
+
headers["content-type"] = "application/json";
|
|
97
|
+
body = JSON.stringify(input.body);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
url: `${baseUrl.replace(/\/+$/, "")}${path}${search ? `?${search}` : ""}`,
|
|
101
|
+
init: {
|
|
102
|
+
method,
|
|
103
|
+
headers: { ...headers, ...input.headers },
|
|
104
|
+
...body === void 0 ? {} : { body }
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async function readBody(response) {
|
|
109
|
+
const text = await response.text();
|
|
110
|
+
if (!text) {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
const type = response.headers.get("content-type") ?? "";
|
|
114
|
+
if (!/json/i.test(type)) {
|
|
115
|
+
return text;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
return JSON.parse(text);
|
|
119
|
+
} catch {
|
|
120
|
+
return text;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function errorOf(response, body) {
|
|
124
|
+
const record = body && typeof body === "object" && !Array.isArray(body) ? body : void 0;
|
|
125
|
+
const message = typeof record?.["error"] === "string" ? record["error"] : `Request failed with ${response.status}.`;
|
|
126
|
+
const code = typeof record?.["code"] === "string" ? record["code"] : "http_error";
|
|
127
|
+
return new ApiError(response.status, code, message, record, response.headers);
|
|
128
|
+
}
|
|
129
|
+
function createApiClient(options) {
|
|
130
|
+
const fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
131
|
+
async function send(key, input = {}) {
|
|
132
|
+
const { url, init } = buildRequest(
|
|
133
|
+
options.baseUrl,
|
|
134
|
+
key,
|
|
135
|
+
input
|
|
136
|
+
);
|
|
137
|
+
const headers = init.headers;
|
|
138
|
+
if (options.auth && options.auth !== "cookie") {
|
|
139
|
+
headers["authorization"] = `Bearer ${options.auth.bearer}`;
|
|
140
|
+
}
|
|
141
|
+
const response = await fetchImpl(url, {
|
|
142
|
+
...init,
|
|
143
|
+
...options.auth === "cookie" ? { credentials: "include" } : {},
|
|
144
|
+
...input["signal"] ? { signal: input["signal"] } : {}
|
|
145
|
+
});
|
|
146
|
+
const body = await readBody(response);
|
|
147
|
+
if (!response.ok) {
|
|
148
|
+
throw errorOf(response, body);
|
|
149
|
+
}
|
|
150
|
+
return { status: response.status, body, headers: response.headers };
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
send,
|
|
154
|
+
call: (async (key, input) => (await send(key, input)).body),
|
|
155
|
+
withAuth: (auth) => createApiClient({ ...options, auth })
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// packages/sdk/src/lib/annotation.ts
|
|
160
|
+
function annotationIdFromIri(iri) {
|
|
161
|
+
return iri.replace(/\/+$/, "").split("/").pop() ?? iri;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// packages/sdk/src/lib/agent-handoff.ts
|
|
165
|
+
function isReviewClosed(status) {
|
|
166
|
+
return status === "resolved";
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// packages/sdk/src/lib/sdk.ts
|
|
170
|
+
var artifactShareRoles = [
|
|
171
|
+
"viewer",
|
|
172
|
+
"commenter",
|
|
173
|
+
"contributor",
|
|
174
|
+
"editor"
|
|
175
|
+
];
|
|
176
|
+
var artifactListLimits = { default: 50, max: 100 };
|
|
177
|
+
function formatRevisionConflictMessage(message, details) {
|
|
178
|
+
if (!details?.currentRevisionId) {
|
|
179
|
+
return message;
|
|
180
|
+
}
|
|
181
|
+
let text = `${message} Current revision: ${details.currentRevisionId}.`;
|
|
182
|
+
if (typeof details.currentVersion === "number") {
|
|
183
|
+
const [firstLine] = revisionSummaryLines(details.currentSummary ?? "");
|
|
184
|
+
text += firstLine ? ` Version ${details.currentVersion}: ${firstLine}` : ` Version ${details.currentVersion}.`;
|
|
185
|
+
}
|
|
186
|
+
return text;
|
|
187
|
+
}
|
|
188
|
+
function revisionSummaryLines(summary) {
|
|
189
|
+
return summary.split(/\r?\n/).map((line) => line.replace(/^\s*(?:[-*•]\s+)?/, "").trim()).filter(Boolean);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// packages/sdk/src/lib/page-storage.ts
|
|
193
|
+
var storageLimits = {
|
|
194
|
+
/** One document, serialized as UTF-8 JSON. */
|
|
195
|
+
maxDocBytes: 256 * 1024,
|
|
196
|
+
/** A document on a `{viewer}` path, unless its rule raises `maxBytes`. */
|
|
197
|
+
maxViewerDocBytes: 16 * 1024,
|
|
198
|
+
maxDepth: 32,
|
|
199
|
+
maxPathBytes: 512,
|
|
200
|
+
maxSegments: 16,
|
|
201
|
+
maxSegmentBytes: 128,
|
|
202
|
+
maxArtifactDocuments: 25e3,
|
|
203
|
+
maxArtifactBytes: 16 * 1024 * 1024,
|
|
204
|
+
maxOwnerBytes: 256 * 1024 * 1024,
|
|
205
|
+
maxRules: 64,
|
|
206
|
+
maxBatchOps: 50,
|
|
207
|
+
/** Sum of the serialized values and patches in one batch. */
|
|
208
|
+
maxBatchBytes: 1024 * 1024,
|
|
209
|
+
maxListLimit: 1e3,
|
|
210
|
+
idempotencyTtlMs: 24 * 60 * 60 * 1e3
|
|
211
|
+
};
|
|
212
|
+
var encoder = new TextEncoder();
|
|
213
|
+
var storageOnlyCodes = /* @__PURE__ */ new Set([
|
|
214
|
+
"version_conflict",
|
|
215
|
+
"storage_not_declared",
|
|
216
|
+
"rules_changed",
|
|
217
|
+
"revision_stale",
|
|
218
|
+
"quota_exceeded",
|
|
219
|
+
"too_large",
|
|
220
|
+
"invalid_path",
|
|
221
|
+
"invalid_value",
|
|
222
|
+
"idempotency_in_progress",
|
|
223
|
+
"idempotency_key_used",
|
|
224
|
+
"idempotency_key_reused"
|
|
225
|
+
]);
|
|
226
|
+
function formatStorageErrorMessage(message, body) {
|
|
227
|
+
if (!body) return message;
|
|
228
|
+
const storageCode = typeof body["code"] === "string" && storageOnlyCodes.has(body["code"]);
|
|
229
|
+
const details = [];
|
|
230
|
+
if (typeof body["code"] === "string") details.push(`code ${body["code"]}`);
|
|
231
|
+
if (typeof body["index"] === "number")
|
|
232
|
+
details.push(`write #${body["index"]}`);
|
|
233
|
+
if (typeof body["path"] === "string") details.push(`path ${body["path"]}`);
|
|
234
|
+
if (body["current"]) {
|
|
235
|
+
details.push(`current ${JSON.stringify(body["current"])}`);
|
|
236
|
+
}
|
|
237
|
+
if (body["quota"]) details.push(`quota ${JSON.stringify(body["quota"])}`);
|
|
238
|
+
return storageCode || details.length > 1 ? `${message} (${details.join("; ")})` : message;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// packages/sdk/src/lib/ids.ts
|
|
242
|
+
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
243
|
+
function isUuid(value) {
|
|
244
|
+
return typeof value === "string" && UUID_PATTERN.test(value);
|
|
245
|
+
}
|
|
246
|
+
var BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
247
|
+
var SHORT_ID_LENGTH = 22;
|
|
248
|
+
function artifactShortId(id) {
|
|
249
|
+
if (!isUuid(id)) throw new Error(`Not a uuid: ${id}`);
|
|
250
|
+
const hex = id.replace(/-/g, "");
|
|
251
|
+
const bytes = [];
|
|
252
|
+
for (let i = 0; i < 32; i += 2) bytes.push(parseInt(hex.slice(i, i + 2), 16));
|
|
253
|
+
let out = "";
|
|
254
|
+
for (let digit = 0; digit < SHORT_ID_LENGTH; digit += 1) {
|
|
255
|
+
let remainder = 0;
|
|
256
|
+
for (let i = 0; i < bytes.length; i += 1) {
|
|
257
|
+
const value = remainder * 256 + bytes[i];
|
|
258
|
+
bytes[i] = Math.floor(value / 62);
|
|
259
|
+
remainder = value % 62;
|
|
260
|
+
}
|
|
261
|
+
out = BASE62[remainder] + out;
|
|
262
|
+
}
|
|
263
|
+
return out;
|
|
264
|
+
}
|
|
265
|
+
function artifactIdFromShortId(value) {
|
|
266
|
+
if (value.length !== SHORT_ID_LENGTH) return void 0;
|
|
267
|
+
const bytes = new Array(16).fill(0);
|
|
268
|
+
for (const char of value) {
|
|
269
|
+
const digit = BASE62.indexOf(char);
|
|
270
|
+
if (digit < 0) return void 0;
|
|
271
|
+
let carry = digit;
|
|
272
|
+
for (let i = 15; i >= 0; i -= 1) {
|
|
273
|
+
const next = bytes[i] * 62 + carry;
|
|
274
|
+
bytes[i] = next % 256;
|
|
275
|
+
carry = Math.floor(next / 256);
|
|
276
|
+
}
|
|
277
|
+
if (carry !== 0) return void 0;
|
|
278
|
+
}
|
|
279
|
+
const hex = bytes.map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
280
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
281
|
+
}
|
|
282
|
+
function artifactIdFromReference(reference) {
|
|
283
|
+
const value = reference.trim();
|
|
284
|
+
if (isUuid(value)) return value;
|
|
285
|
+
const short = artifactIdFromShortId(value);
|
|
286
|
+
if (short) return short;
|
|
287
|
+
let url;
|
|
288
|
+
try {
|
|
289
|
+
url = new URL(value);
|
|
290
|
+
} catch {
|
|
291
|
+
return void 0;
|
|
292
|
+
}
|
|
293
|
+
const page = /^\/a\/([0-9A-Za-z]+)\/?$/.exec(url.pathname);
|
|
294
|
+
if (page) return artifactIdFromShortId(page[1]);
|
|
295
|
+
const label = url.hostname.split(".")[0];
|
|
296
|
+
return isUuid(label) ? label : void 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// packages/cli/src/lib/cli.ts
|
|
300
|
+
function isRootAnnotation(annotation) {
|
|
301
|
+
return annotation.motivation === "commenting";
|
|
302
|
+
}
|
|
303
|
+
async function readHtmlUpload(filePath, what) {
|
|
304
|
+
const bytes = await readFile(filePath);
|
|
305
|
+
if (!/<html/i.test(bytes.toString("latin1"))) {
|
|
306
|
+
throw new Error(`${what} must be self-contained HTML including <html>.`);
|
|
307
|
+
}
|
|
308
|
+
return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
309
|
+
}
|
|
310
|
+
var commands = [
|
|
311
|
+
"annotate",
|
|
312
|
+
"annotation",
|
|
313
|
+
"artifact",
|
|
314
|
+
"data",
|
|
315
|
+
"guidelines",
|
|
316
|
+
"help",
|
|
317
|
+
"install-skill",
|
|
318
|
+
"login",
|
|
319
|
+
"publish",
|
|
320
|
+
"reply",
|
|
321
|
+
"revise",
|
|
322
|
+
"share",
|
|
323
|
+
"types",
|
|
324
|
+
"version",
|
|
325
|
+
"watch",
|
|
326
|
+
"whoami"
|
|
327
|
+
];
|
|
328
|
+
var cliVisibilityOptions = ["public", "unlisted", "private"];
|
|
329
|
+
var cliAnnotationStatusOptions = ["open", "resolved"];
|
|
330
|
+
var valueFlags = /* @__PURE__ */ new Set([
|
|
331
|
+
"--after",
|
|
332
|
+
"--api-key",
|
|
333
|
+
"--as-role",
|
|
334
|
+
"--depth",
|
|
335
|
+
"--idempotency-key",
|
|
336
|
+
"--if-match",
|
|
337
|
+
"--ops",
|
|
338
|
+
"--order",
|
|
339
|
+
"--patch",
|
|
340
|
+
"--value",
|
|
341
|
+
"--author",
|
|
342
|
+
"--comment",
|
|
343
|
+
"--css",
|
|
344
|
+
"--cursor",
|
|
345
|
+
"--description",
|
|
346
|
+
"--dir",
|
|
347
|
+
"--email",
|
|
348
|
+
"--harness",
|
|
349
|
+
"--host",
|
|
350
|
+
// Removed (ADR 0015); still a value flag so its value is not read as a
|
|
351
|
+
// positional before rejectRemovedKindFlag() refuses it.
|
|
352
|
+
"--kind",
|
|
353
|
+
"--limit",
|
|
354
|
+
"--output",
|
|
355
|
+
"--pin-label",
|
|
356
|
+
"--quote",
|
|
357
|
+
"--quote-prefix",
|
|
358
|
+
"--quote-suffix",
|
|
359
|
+
"--query",
|
|
360
|
+
"--rect",
|
|
361
|
+
"--requested-change",
|
|
362
|
+
// Removed; still a value flag so its value is not read as a positional
|
|
363
|
+
// before rejectRemovedResolveFlag() refuses it.
|
|
364
|
+
"--resolve",
|
|
365
|
+
"--revision",
|
|
366
|
+
"--role",
|
|
367
|
+
"--root",
|
|
368
|
+
"--since",
|
|
369
|
+
"--status",
|
|
370
|
+
"--base",
|
|
371
|
+
"--capabilities",
|
|
372
|
+
"--contract",
|
|
373
|
+
"--summary",
|
|
374
|
+
"--tag",
|
|
375
|
+
"--text-end",
|
|
376
|
+
"--text-start",
|
|
377
|
+
"--timeout",
|
|
378
|
+
"--title",
|
|
379
|
+
"--type",
|
|
380
|
+
"--types",
|
|
381
|
+
"--url",
|
|
382
|
+
"--visibility"
|
|
383
|
+
]);
|
|
384
|
+
function getPositionals(args) {
|
|
385
|
+
const positionals = [];
|
|
386
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
387
|
+
const arg = args[index];
|
|
388
|
+
if (arg.startsWith("-")) {
|
|
389
|
+
if (valueFlags.has(arg)) {
|
|
390
|
+
index += 1;
|
|
391
|
+
}
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
positionals.push(arg);
|
|
395
|
+
}
|
|
396
|
+
return positionals;
|
|
397
|
+
}
|
|
398
|
+
function inferTitleFromPath(filePath) {
|
|
399
|
+
const fileName = basename(filePath);
|
|
400
|
+
const extension = extname(fileName);
|
|
401
|
+
return extension ? fileName.slice(0, -extension.length) : fileName;
|
|
402
|
+
}
|
|
403
|
+
function parseVisibility(value) {
|
|
404
|
+
if (cliVisibilityOptions.includes(value)) {
|
|
405
|
+
return value;
|
|
406
|
+
}
|
|
407
|
+
throw usageError(
|
|
408
|
+
`Invalid visibility "${value}". Expected one of: ${cliVisibilityOptions.join(", ")}`
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
async function parseCapabilitiesFlag(value) {
|
|
412
|
+
if (value === void 0) {
|
|
413
|
+
return void 0;
|
|
414
|
+
}
|
|
415
|
+
let source = value;
|
|
416
|
+
if (!value.trim().startsWith("{")) {
|
|
417
|
+
try {
|
|
418
|
+
source = await readFile(value, "utf8");
|
|
419
|
+
} catch {
|
|
420
|
+
throw usageError(
|
|
421
|
+
`--capabilities must be a JSON object or a path to a JSON file; could not read "${value}".`
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
let parsed;
|
|
426
|
+
try {
|
|
427
|
+
parsed = JSON.parse(source);
|
|
428
|
+
} catch {
|
|
429
|
+
throw usageError("--capabilities is not valid JSON.");
|
|
430
|
+
}
|
|
431
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
432
|
+
throw usageError(
|
|
433
|
+
`--capabilities must be a JSON object, e.g. '{"<name>":true}' ({} clears them on revise).`
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
return parsed;
|
|
437
|
+
}
|
|
438
|
+
function parseContractFlag(value) {
|
|
439
|
+
if (value === void 0) {
|
|
440
|
+
return void 0;
|
|
441
|
+
}
|
|
442
|
+
if (value === "latest") {
|
|
443
|
+
return value;
|
|
444
|
+
}
|
|
445
|
+
if (/^\d+$/.test(value)) {
|
|
446
|
+
return Number(value);
|
|
447
|
+
}
|
|
448
|
+
throw usageError(
|
|
449
|
+
`Invalid --contract "${value}". Expected a version number or latest.`
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
function parseTypeFlag(value) {
|
|
453
|
+
if (value === void 0) {
|
|
454
|
+
return void 0;
|
|
455
|
+
}
|
|
456
|
+
if (!value.trim()) {
|
|
457
|
+
throw usageError("--type must name a type, e.g. slides.");
|
|
458
|
+
}
|
|
459
|
+
return value.trim();
|
|
460
|
+
}
|
|
461
|
+
function describeType(declaration) {
|
|
462
|
+
return declaration.type && declaration.type !== "html" ? `${declaration.type} (format ${declaration.typeFormat})` : void 0;
|
|
463
|
+
}
|
|
464
|
+
function parseAnnotationStatus(value) {
|
|
465
|
+
if (cliAnnotationStatusOptions.includes(value)) {
|
|
466
|
+
return value;
|
|
467
|
+
}
|
|
468
|
+
throw usageError(
|
|
469
|
+
`Invalid status "${value}". Expected one of: ${cliAnnotationStatusOptions.join(", ")}`
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
function parseShareRole(value) {
|
|
473
|
+
if (artifactShareRoles.includes(value)) {
|
|
474
|
+
return value;
|
|
475
|
+
}
|
|
476
|
+
throw usageError(
|
|
477
|
+
`Invalid role "${value}". Expected one of: ${artifactShareRoles.join(", ")}`
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
function parseRectSelector(value) {
|
|
481
|
+
if (!value) {
|
|
482
|
+
return void 0;
|
|
483
|
+
}
|
|
484
|
+
const parts = value.split(",").map((part) => Number(part.trim()));
|
|
485
|
+
if (parts.length !== 2 && parts.length !== 4 || parts.some((part) => !Number.isFinite(part))) {
|
|
486
|
+
throw usageError(
|
|
487
|
+
`Invalid --rect "${value}". Expected "x,y" or "x,y,w,h" percentages.`
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
const [x, y, width = 0, height = 0] = parts;
|
|
491
|
+
return {
|
|
492
|
+
type: "FragmentSelector",
|
|
493
|
+
conformsTo: "http://www.w3.org/TR/media-frags/",
|
|
494
|
+
value: `xywh=percent:${x},${y},${width},${height}`
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function buildAnnotationSelectors(args) {
|
|
498
|
+
const selectors = [];
|
|
499
|
+
const quote = parseFlagValue(args, "--quote");
|
|
500
|
+
if (quote) {
|
|
501
|
+
const textQuote = {
|
|
502
|
+
type: "TextQuoteSelector",
|
|
503
|
+
exact: quote
|
|
504
|
+
};
|
|
505
|
+
const prefix = parseFlagValue(args, "--quote-prefix");
|
|
506
|
+
const suffix = parseFlagValue(args, "--quote-suffix");
|
|
507
|
+
if (prefix) {
|
|
508
|
+
textQuote.prefix = prefix;
|
|
509
|
+
}
|
|
510
|
+
if (suffix) {
|
|
511
|
+
textQuote.suffix = suffix;
|
|
512
|
+
}
|
|
513
|
+
selectors.push(textQuote);
|
|
514
|
+
}
|
|
515
|
+
const textStart = parseFlagValue(args, "--text-start");
|
|
516
|
+
const textEnd = parseFlagValue(args, "--text-end");
|
|
517
|
+
if (textStart !== void 0 && textEnd !== void 0) {
|
|
518
|
+
const start = Number(textStart);
|
|
519
|
+
const end = Number(textEnd);
|
|
520
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) {
|
|
521
|
+
throw usageError("--text-start and --text-end must be numbers.");
|
|
522
|
+
}
|
|
523
|
+
selectors.push({ type: "TextPositionSelector", start, end });
|
|
524
|
+
}
|
|
525
|
+
const css = parseFlagValue(args, "--css");
|
|
526
|
+
if (css) {
|
|
527
|
+
selectors.push({ type: "CssSelector", value: css });
|
|
528
|
+
}
|
|
529
|
+
const rect = parseRectSelector(parseFlagValue(args, "--rect"));
|
|
530
|
+
if (rect) {
|
|
531
|
+
selectors.push(rect);
|
|
532
|
+
}
|
|
533
|
+
return selectors;
|
|
534
|
+
}
|
|
535
|
+
function resolveBaseUrl(args, config) {
|
|
536
|
+
const host = parseFlagValue(args, "--host") || parseFlagValue(args, "--url") || process.env["ARTIS_URL"] || config?.defaultHost || ARTIS_DEFAULT_HOST;
|
|
537
|
+
return normalizeHost(host);
|
|
538
|
+
}
|
|
539
|
+
function resolveApiKey(args, config, baseUrl) {
|
|
540
|
+
const flagApiKey = parseFlagValue(args, "--api-key");
|
|
541
|
+
if (flagApiKey) {
|
|
542
|
+
return { apiKey: flagApiKey, apiKeySource: "flag" };
|
|
543
|
+
}
|
|
544
|
+
if (process.env["ARTIS_API_KEY"]) {
|
|
545
|
+
return { apiKey: process.env["ARTIS_API_KEY"], apiKeySource: "env" };
|
|
546
|
+
}
|
|
547
|
+
const profileApiKey = findProfileForHost(config, baseUrl)?.apiKey;
|
|
548
|
+
if (profileApiKey) {
|
|
549
|
+
return { apiKey: profileApiKey, apiKeySource: "config" };
|
|
550
|
+
}
|
|
551
|
+
return {};
|
|
552
|
+
}
|
|
553
|
+
async function resolveCredentials(args) {
|
|
554
|
+
const config = await readCliConfig();
|
|
555
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
556
|
+
const { apiKey } = resolveApiKey(args, config, baseUrl);
|
|
557
|
+
if (!apiKey) {
|
|
558
|
+
throw new CliError(
|
|
559
|
+
`Missing API key. Run "artis login --host ${baseUrl}" or set ARTIS_API_KEY.`,
|
|
560
|
+
exitCodes.auth
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
return { apiKey, baseUrl };
|
|
564
|
+
}
|
|
565
|
+
async function resolveOptionalTarget(args) {
|
|
566
|
+
const config = await readCliConfig();
|
|
567
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
568
|
+
const { apiKey, apiKeySource } = resolveApiKey(args, config, baseUrl);
|
|
569
|
+
return { apiKey, apiKeySource, baseUrl };
|
|
570
|
+
}
|
|
571
|
+
async function guidelinesFromCli(args) {
|
|
572
|
+
const [section] = getPositionals(args);
|
|
573
|
+
const contract = parseContractFlag(parseFlagValue(args, "--contract"));
|
|
574
|
+
const config = await readCliConfig();
|
|
575
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
576
|
+
const query = new URLSearchParams({ section: section ?? "index" });
|
|
577
|
+
if (contract !== void 0) {
|
|
578
|
+
query.set("contract", String(contract));
|
|
579
|
+
}
|
|
580
|
+
const response = await fetch(`${baseUrl}/skills.md?${query.toString()}`);
|
|
581
|
+
const text = await response.text();
|
|
582
|
+
if (!response.ok) {
|
|
583
|
+
throw new CliError(
|
|
584
|
+
text.trim() || `Guidelines request failed with ${response.status}.`,
|
|
585
|
+
exitCodeForResponse(response.status)
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
process.stdout.write(text.endsWith("\n") ? text : `${text}
|
|
589
|
+
`);
|
|
590
|
+
}
|
|
591
|
+
function rejectRemovedKindFlag(args) {
|
|
592
|
+
if (args.includes("--kind")) {
|
|
593
|
+
throw usageError(
|
|
594
|
+
"--kind was removed: artifacts no longer have a kind. Use --type for the type an artifact is written in (html by default), or tags to group artifacts."
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function rejectRemovedResolveFlag(args) {
|
|
599
|
+
if (args.includes("--resolve")) {
|
|
600
|
+
throw usageError(
|
|
601
|
+
'--resolve was removed: a revision no longer changes review status. Reply in each thread you addressed with "artis reply"; the reviewers resolve it.'
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
async function parsePublishOptions(args) {
|
|
606
|
+
rejectRemovedKindFlag(args);
|
|
607
|
+
const [filePath] = getPositionals(args);
|
|
608
|
+
const root = parseFlagValue(args, "--root");
|
|
609
|
+
if (!filePath && !root) {
|
|
610
|
+
throw usageError(
|
|
611
|
+
"Missing artifact HTML file path (or --root <dir> for a typed artifact made of files)."
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
if (filePath && root) {
|
|
615
|
+
throw usageError("Pass an HTML file or --root <dir>, not both.");
|
|
616
|
+
}
|
|
617
|
+
const credentials = await resolveCredentials(args);
|
|
618
|
+
const visibility = parseVisibility(
|
|
619
|
+
parseFlagValue(args, "--visibility") ?? "unlisted"
|
|
620
|
+
);
|
|
621
|
+
return {
|
|
622
|
+
filePath,
|
|
623
|
+
root,
|
|
624
|
+
apiKey: credentials.apiKey,
|
|
625
|
+
baseUrl: credentials.baseUrl,
|
|
626
|
+
title: parseFlagValue(args, "--title"),
|
|
627
|
+
description: parseFlagValue(args, "--description") ?? "Published from Artis CLI.",
|
|
628
|
+
visibility,
|
|
629
|
+
authorName: parseFlagValue(args, "--author") ?? "Artis CLI",
|
|
630
|
+
capabilities: await parseCapabilitiesFlag(
|
|
631
|
+
parseFlagValue(args, "--capabilities")
|
|
632
|
+
),
|
|
633
|
+
contract: parseContractFlag(parseFlagValue(args, "--contract")),
|
|
634
|
+
type: parseTypeFlag(parseFlagValue(args, "--type")),
|
|
635
|
+
json: hasFlag(args, "--json")
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
function cliErrorOf(error) {
|
|
639
|
+
if (!(error instanceof ApiError)) {
|
|
640
|
+
return error;
|
|
641
|
+
}
|
|
642
|
+
let message = formatStorageErrorMessage(
|
|
643
|
+
formatRevisionConflictMessage(error.message, error.body),
|
|
644
|
+
error.body
|
|
645
|
+
);
|
|
646
|
+
if (error.status === 429 && error.retryAfter) {
|
|
647
|
+
message += ` Retry after ${error.retryAfter} s.`;
|
|
648
|
+
}
|
|
649
|
+
return new CliError(message, exitCodeForResponse(error.status, error.code));
|
|
650
|
+
}
|
|
651
|
+
function apiClient(target) {
|
|
652
|
+
return createApiClient({
|
|
653
|
+
baseUrl: target.baseUrl,
|
|
654
|
+
auth: target.apiKey ? { bearer: target.apiKey } : void 0
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
async function apiCall(credentials, key, ...input) {
|
|
658
|
+
try {
|
|
659
|
+
return await apiClient(credentials).call(key, ...input);
|
|
660
|
+
} catch (error) {
|
|
661
|
+
throw cliErrorOf(error);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
async function apiCallOptional(target, key, ...input) {
|
|
665
|
+
try {
|
|
666
|
+
return await apiClient(target).call(key, ...input);
|
|
667
|
+
} catch (error) {
|
|
668
|
+
if (!(error instanceof ApiError) || error.status !== 401 || !target.apiKey || target.apiKeySource !== "config") {
|
|
669
|
+
throw cliErrorOf(error);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
try {
|
|
673
|
+
const result = await apiClient({ baseUrl: target.baseUrl }).call(
|
|
674
|
+
key,
|
|
675
|
+
...input
|
|
676
|
+
);
|
|
677
|
+
console.warn(
|
|
678
|
+
`Saved API key was rejected by ${target.baseUrl}; retried without credentials. Run "artis login --host ${target.baseUrl}" to refresh local credentials.`
|
|
679
|
+
);
|
|
680
|
+
return result;
|
|
681
|
+
} catch (error) {
|
|
682
|
+
throw cliErrorOf(error);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function assertSafeLoginUrl(url, baseUrl) {
|
|
686
|
+
let parsed;
|
|
687
|
+
try {
|
|
688
|
+
parsed = new URL(url);
|
|
689
|
+
} catch {
|
|
690
|
+
throw new Error("Login host returned an invalid verification URL.");
|
|
691
|
+
}
|
|
692
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
693
|
+
throw new Error("Login host returned an unsafe verification URL scheme.");
|
|
694
|
+
}
|
|
695
|
+
let expected;
|
|
696
|
+
try {
|
|
697
|
+
expected = new URL(baseUrl);
|
|
698
|
+
} catch {
|
|
699
|
+
throw new Error("Configured login host is not a valid URL.");
|
|
700
|
+
}
|
|
701
|
+
if (parsed.hostname !== expected.hostname || parsed.port !== expected.port) {
|
|
702
|
+
throw new Error(
|
|
703
|
+
"Login host returned a verification URL that does not match the configured host."
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function openBrowser(url) {
|
|
708
|
+
let protocol;
|
|
709
|
+
try {
|
|
710
|
+
protocol = new URL(url).protocol;
|
|
711
|
+
} catch {
|
|
712
|
+
throw new Error("Refusing to open an invalid URL in the browser.");
|
|
713
|
+
}
|
|
714
|
+
if (protocol !== "http:" && protocol !== "https:") {
|
|
715
|
+
throw new Error("Refusing to open a non-http(s) URL in the browser.");
|
|
716
|
+
}
|
|
717
|
+
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
718
|
+
const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
719
|
+
const child = spawn(command, args, {
|
|
720
|
+
detached: true,
|
|
721
|
+
stdio: "ignore"
|
|
722
|
+
});
|
|
723
|
+
child.unref();
|
|
724
|
+
}
|
|
725
|
+
function sleep(ms) {
|
|
726
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
727
|
+
}
|
|
728
|
+
function buildArtifactUrl(baseUrl, pathOrUrl) {
|
|
729
|
+
return pathOrUrl.startsWith("http") ? pathOrUrl : `${baseUrl}${pathOrUrl}`;
|
|
730
|
+
}
|
|
731
|
+
function getCliHelp() {
|
|
732
|
+
return `artis
|
|
733
|
+
|
|
734
|
+
Host, share, and collaborate on AI-generated HTML artifacts.
|
|
735
|
+
|
|
736
|
+
Usage:
|
|
737
|
+
artis --version
|
|
738
|
+
artis login [--host <url>]
|
|
739
|
+
artis whoami [--host <url>]
|
|
740
|
+
artis guidelines [section] [--contract <n|latest>] [--host <url>]
|
|
741
|
+
artis types [name [reference]] [--json] [--host <url>]
|
|
742
|
+
artis install-skill [--harness <id>]... [--yes] [--dir <path>] [--force] [--list] [--json]
|
|
743
|
+
artis publish artifact.html [options]
|
|
744
|
+
artis publish --root <dir> --type <type> [options]
|
|
745
|
+
artis artifact get <artifact> [--json]
|
|
746
|
+
artis artifact html <artifact> [--output <path>] [--revision <revision-id>] [--json]
|
|
747
|
+
artis artifact files <artifact> [path] [--output <dir>] [--revision <revision-id>] [--json]
|
|
748
|
+
artis artifact feedback <artifact> [--json] [--revision <revision-id>]
|
|
749
|
+
artis artifact list [--query <text>] [--tag <tag>] [--type <type>] [--limit <n>] [--cursor <cursor>] [--json]
|
|
750
|
+
artis artifact visibility <artifact> <public|unlisted|private> [--json]
|
|
751
|
+
artis artifact delete <artifact> --yes
|
|
752
|
+
artis verify <artifact.html | artifact> [--type slides] [--revision <revision-id>] [--json]
|
|
753
|
+
artis verify --root <dir> --type slides [--json]
|
|
754
|
+
artis share <artifact> [--email <email> --role <viewer|commenter|contributor|editor>] [--remove]
|
|
755
|
+
artis revise <artifact> (artifact.html | --root <dir>) --summary <text> [--base <revision-id>] [--capabilities <json|file>] [--contract <n|latest>] [--type <type>]
|
|
756
|
+
artis annotate <artifact> --comment <text> [anchor options]
|
|
757
|
+
artis reply <annotation-id> --comment <text>
|
|
758
|
+
artis annotation edit <annotation-id> [--comment <text>] [--title <text>] [--requested-change <text>]
|
|
759
|
+
artis annotation retract <annotation-id>
|
|
760
|
+
artis watch <artifact> [--since <cursor>] [--once] [--timeout <duration>] [--include-self] [--types <families>]
|
|
761
|
+
artis data get <artifact> <path> [--as-role <role>]
|
|
762
|
+
artis data list <artifact> [prefix] [--depth children|all] [--order path|created] [--limit <n>] [--after <next>] [--as-role <role>]
|
|
763
|
+
artis data set <artifact> <path> --value <json|file|-> [--if-match <id>@<version> | --if-absent] [--idempotency-key <key>]
|
|
764
|
+
artis data update <artifact> <path> --patch <json|file|-> [--if-match <id>@<version> | --if-absent] [--idempotency-key <key>]
|
|
765
|
+
artis data delete <artifact> <path> [--if-match <id>@<version>] [--idempotency-key <key>]
|
|
766
|
+
artis data batch <artifact> --ops <json|file|-> [--idempotency-key <key>]
|
|
767
|
+
artis data export <artifact> [--output <path>] [--as-role <role>]
|
|
768
|
+
artis data usage <artifact>
|
|
769
|
+
|
|
770
|
+
Options:
|
|
771
|
+
--api-key <key> API key. Defaults to ARTIS_API_KEY or ~/.artis/config.json. Run "artis login" to obtain one.
|
|
772
|
+
--host, --url <url> Artis server URL. Falls back to ARTIS_URL, then a saved login, then https://artis.xiispace.eu.org.
|
|
773
|
+
--title <title> Artifact title. Defaults to the file name.
|
|
774
|
+
--description <text> Artifact description.
|
|
775
|
+
--visibility <value> public, unlisted, or private. Defaults to unlisted.
|
|
776
|
+
--type <type> The type the artifact is created with, e.g. slides (publish, revise, verify; artifact list keeps your artifacts of that type). It is fixed at publish: revise keeps it, and may only repeat it. Verify of a published artifact reads it from the revision.
|
|
777
|
+
--author <name> Artifact author/agent name. Defaults to Artis CLI.
|
|
778
|
+
--summary <text> Revision summary. Write one change per line; they render as a list.
|
|
779
|
+
--base <revision-id> Revision the file was edited from. Defaults to the revision this machine last published, read (artifact html), or revised. Refuses the revise if someone revised since.
|
|
780
|
+
--capabilities <json|file> Page capabilities as a JSON object or JSON file (publish, revise). Revise keeps the previous set without it; '{}' clears it.
|
|
781
|
+
--contract <n|latest> Page contract version (publish, revise, guidelines). Publish defaults to latest; revise keeps the pinned version.
|
|
782
|
+
--comment <text> Annotation or reply comment text (annotate, reply).
|
|
783
|
+
--requested-change <text> Structured change request for the artifact author (annotate).
|
|
784
|
+
--status <value> Annotation status: open or resolved. Defaults to open.
|
|
785
|
+
--quote <text> Exact artifact text to anchor to (annotate, TextQuoteSelector).
|
|
786
|
+
--quote-prefix <text> Text just before --quote, to disambiguate repeats.
|
|
787
|
+
--quote-suffix <text> Text just after --quote, to disambiguate repeats.
|
|
788
|
+
--css <selector> CSS selector to anchor to (annotate, CssSelector).
|
|
789
|
+
--text-start <n> Document offset where the quote starts (annotate, TextPositionSelector).
|
|
790
|
+
--text-end <n> Document offset where the quote ends (annotate, TextPositionSelector).
|
|
791
|
+
--rect <x,y,w,h> Canvas point/rect as percentages (annotate, FragmentSelector). w,h default to 0.
|
|
792
|
+
--pin-label <text> Short label shown on the artifact canvas pin (annotate).
|
|
793
|
+
--output <path> Write the artifact HTML to this file (artifact html), or every file of a files revision under this directory (artifact files). Without it, the document goes to stdout.
|
|
794
|
+
--root <dir> A typed artifact made of files (ADR 0015): publish every file under the directory, or revise with the ones that differ from the base revision (removed files are removed); verify composes a slides deck from it. Dotfiles are skipped.
|
|
795
|
+
--revision <revision-id> Revision to read (artifact html, artifact feedback). Defaults to the current revision.
|
|
796
|
+
--query <text> Text to find in your artifacts' titles and descriptions (artifact list).
|
|
797
|
+
--tag <tag> Only your artifacts carrying this tag (artifact list).
|
|
798
|
+
--limit <n> Artifacts per page, 1-100 (artifact list). Defaults to 50.
|
|
799
|
+
--cursor <cursor> Continue after the page that printed it (artifact list).
|
|
800
|
+
--email <email> Email address for artis share.
|
|
801
|
+
--role <role> Share role: viewer, commenter, contributor or editor. Defaults to viewer.
|
|
802
|
+
--remove Remove the email from an artifact share list.
|
|
803
|
+
--harness <id> Agent harness to install the artis skill into (install-skill). Repeatable: claude-code, cursor, codex, openclaw, pi, hermes.
|
|
804
|
+
--yes Install the skill into every detected harness (install-skill); confirm a delete (artifact delete).
|
|
805
|
+
--dir <path> Install the skill into a custom skills directory (install-skill).
|
|
806
|
+
--force Overwrite an already-installed skill (install-skill).
|
|
807
|
+
--list List harnesses, detection, and install paths (install-skill).
|
|
808
|
+
--since <cursor> Feedback cursor to watch from (watch). Defaults to now; 0 replays every event.
|
|
809
|
+
--once Exit after the first batch of events, printed as {events, cursor} (watch).
|
|
810
|
+
--timeout <duration> Give up after this long, e.g. 30s, 10m (watch). Exits 6 if nothing happened.
|
|
811
|
+
--include-self Also report events caused by this API key (watch).
|
|
812
|
+
--types <families> Only these event families, comma-separated: annotation, revision (watch). Defaults to all.
|
|
813
|
+
--value <json|file|-> The whole document, a JSON object: inline, a file, or - for stdin (data set).
|
|
814
|
+
--patch <json|file|-> A JSON object deep-merged into the document (data update).
|
|
815
|
+
--ops <json|file|-> Writes for data batch: [{"op":"set","path":"...","value":{...}}, ...] or {"ops":[...]}.
|
|
816
|
+
--if-match <id>@<version> Write only if this document is still at this version (data set, update, delete).
|
|
817
|
+
--if-absent Write only if nothing is at the path, a claim (data set, update).
|
|
818
|
+
--idempotency-key <key> Make a data write safe to retry: the same key and body within 24 h replays the first result.
|
|
819
|
+
--as-role <role> Read data as a lower role (viewer, commenter, contributor) to check your path rules.
|
|
820
|
+
--depth <children|all> data list: direct children only, or the whole subtree (default).
|
|
821
|
+
--order <path|created> data list order. Defaults to path.
|
|
822
|
+
--after <next> data list: continue after the page that printed this next.
|
|
823
|
+
--json Print machine-readable JSON for supported commands.
|
|
824
|
+
|
|
825
|
+
Exit codes:
|
|
826
|
+
0 success, 1 error, 2 usage, 3 auth, 4 not found (data get: no document at the path), 5 conflict (a revision, or a data document's version: re-read, reapply, retry), 6 watch timeout, 7 rate limited, 8 verify found problems.
|
|
827
|
+
|
|
828
|
+
Examples (--host is optional; without it commands target https://artis.xiispace.eu.org):
|
|
829
|
+
artis publish report.html
|
|
830
|
+
artis login
|
|
831
|
+
artis publish report.html --host https://artis.example.com --visibility private
|
|
832
|
+
artis share 4kq9Zt2LmX8vRbP3nWc7Hy --host https://artis.example.com --email reviewer@example.com --role commenter
|
|
833
|
+
artis artifact get 4kq9Zt2LmX8vRbP3nWc7Hy --host https://artis.example.com --json
|
|
834
|
+
artis artifact html 4kq9Zt2LmX8vRbP3nWc7Hy --output report.html
|
|
835
|
+
artis verify report.html
|
|
836
|
+
artis verify deck.html --type slides
|
|
837
|
+
artis artifact feedback 4kq9Zt2LmX8vRbP3nWc7Hy --host https://artis.example.com --json
|
|
838
|
+
artis annotate 4kq9Zt2LmX8vRbP3nWc7Hy --host https://artis.example.com --comment "Tighten this heading" --quote "Checkout latency" --requested-change "Add the affected checkout count"
|
|
839
|
+
artis reply annotation-123 --host https://artis.example.com --comment "Addressed in the latest revision"
|
|
840
|
+
artis annotation edit annotation-123 --host https://artis.example.com --comment "Corrected: the latency spike is on checkout, not search"
|
|
841
|
+
artis annotation retract annotation-123 --host https://artis.example.com
|
|
842
|
+
artis watch 4kq9Zt2LmX8vRbP3nWc7Hy --since 42
|
|
843
|
+
artis guidelines authoring
|
|
844
|
+
artis types slides
|
|
845
|
+
artis install-skill --yes
|
|
846
|
+
artis revise 4kq9Zt2LmX8vRbP3nWc7Hy report.html --host https://artis.example.com --summary "Addressed open feedback" --base <revision-id>`;
|
|
847
|
+
}
|
|
848
|
+
async function publishArtifactFromCli(args) {
|
|
849
|
+
const options = await parsePublishOptions(args);
|
|
850
|
+
const credentials = { apiKey: options.apiKey, baseUrl: options.baseUrl };
|
|
851
|
+
const source = options.root ?? options.filePath ?? "";
|
|
852
|
+
const title = options.title ?? inferTitleFromPath(source);
|
|
853
|
+
const query = {
|
|
854
|
+
title,
|
|
855
|
+
description: options.description,
|
|
856
|
+
visibility: options.visibility,
|
|
857
|
+
authorName: options.authorName,
|
|
858
|
+
source: "cli",
|
|
859
|
+
capabilities: options.capabilities,
|
|
860
|
+
contract: options.contract,
|
|
861
|
+
type: options.type
|
|
862
|
+
};
|
|
863
|
+
let result;
|
|
864
|
+
if (options.root) {
|
|
865
|
+
if (!options.type || options.type === "html") {
|
|
866
|
+
throw usageError(
|
|
867
|
+
"--root publishes an artifact made of files: pass the type it is written in, e.g. --type slides. An html artifact is one HTML file."
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
const files = await readFilesDir(options.root);
|
|
871
|
+
({ result } = await apiCall(credentials, "POST /api/artifacts/files", {
|
|
872
|
+
query,
|
|
873
|
+
body: { files }
|
|
874
|
+
}));
|
|
875
|
+
} else {
|
|
876
|
+
const html = await readHtmlUpload(source, "Artifact file");
|
|
877
|
+
({ result } = await apiCall(credentials, "POST /api/artifacts", {
|
|
878
|
+
query,
|
|
879
|
+
body: html
|
|
880
|
+
}));
|
|
881
|
+
}
|
|
882
|
+
await rememberBase(options.baseUrl, [result.artifactId], result.revisionId);
|
|
883
|
+
return {
|
|
884
|
+
artifactId: result.artifactId,
|
|
885
|
+
revisionId: result.revisionId,
|
|
886
|
+
title,
|
|
887
|
+
url: buildArtifactUrl(options.baseUrl, result.url),
|
|
888
|
+
visibility: options.visibility,
|
|
889
|
+
// Absent from a server that predates types.
|
|
890
|
+
type: result.type ?? null,
|
|
891
|
+
typeFormat: result.typeFormat ?? null
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
async function loginFromCli(args) {
|
|
895
|
+
const config = await readCliConfig();
|
|
896
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
897
|
+
const api = apiClient({ baseUrl });
|
|
898
|
+
let login;
|
|
899
|
+
try {
|
|
900
|
+
login = await api.call("POST /api/cli/auth/start");
|
|
901
|
+
} catch (error) {
|
|
902
|
+
throw cliErrorOf(error);
|
|
903
|
+
}
|
|
904
|
+
assertSafeLoginUrl(login.verificationUrl, baseUrl);
|
|
905
|
+
console.log(`Opening ${login.verificationUrl}`);
|
|
906
|
+
console.log(`Code: ${login.userCode}`);
|
|
907
|
+
try {
|
|
908
|
+
openBrowser(login.verificationUrl);
|
|
909
|
+
} catch {
|
|
910
|
+
console.log("Could not open a browser automatically.");
|
|
911
|
+
}
|
|
912
|
+
const intervalMs = login.intervalSeconds * 1e3;
|
|
913
|
+
while (Date.now() < Date.parse(login.expiresAt)) {
|
|
914
|
+
await sleep(intervalMs);
|
|
915
|
+
let poll;
|
|
916
|
+
try {
|
|
917
|
+
poll = await api.call("POST /api/cli/auth/poll", {
|
|
918
|
+
body: { deviceCode: login.deviceCode }
|
|
919
|
+
});
|
|
920
|
+
} catch (error) {
|
|
921
|
+
if (error instanceof ApiError && error.status === 429) {
|
|
922
|
+
await sleep((error.retryAfter ?? 10) * 1e3);
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
throw cliErrorOf(error);
|
|
926
|
+
}
|
|
927
|
+
if (poll.status === "pending") {
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
await saveDefaultProfile({ apiKey: poll.token, host: baseUrl });
|
|
931
|
+
console.log(`Saved artis credentials to ${getConfigPath()}`);
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
throw new Error("Login expired. Run artis login again.");
|
|
935
|
+
}
|
|
936
|
+
async function typesFromCli(args) {
|
|
937
|
+
const [name, file] = getPositionals(args);
|
|
938
|
+
const config = await readCliConfig();
|
|
939
|
+
const baseUrl = resolveBaseUrl(args, config);
|
|
940
|
+
const json = hasFlag(args, "--json");
|
|
941
|
+
const call = async (key, ...input) => {
|
|
942
|
+
try {
|
|
943
|
+
return await apiClient({ baseUrl }).call(key, ...input);
|
|
944
|
+
} catch (error) {
|
|
945
|
+
throw cliErrorOf(error);
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
if (!name) {
|
|
949
|
+
const { types } = await call("GET /api/types");
|
|
950
|
+
if (json) {
|
|
951
|
+
console.log(JSON.stringify(types, null, 2));
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
if (!types.length) {
|
|
955
|
+
console.log("No types are installed on this server.");
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
for (const type2 of types) {
|
|
959
|
+
console.log(
|
|
960
|
+
`${type2.name} format ${type2.format} ${type2.release} ${type2.description}`
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
if (file) {
|
|
966
|
+
const result = await call("GET /api/types/{name}/files/{path}", {
|
|
967
|
+
params: { name, path: file }
|
|
968
|
+
});
|
|
969
|
+
if (json) {
|
|
970
|
+
console.log(JSON.stringify(result, null, 2));
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
process.stdout.write(
|
|
974
|
+
result.content.endsWith("\n") ? result.content : `${result.content}
|
|
975
|
+
`
|
|
976
|
+
);
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
const { type } = await call("GET /api/types/{name}", { params: { name } });
|
|
980
|
+
if (json) {
|
|
981
|
+
console.log(JSON.stringify(type, null, 2));
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
if (type.guidance) {
|
|
985
|
+
process.stdout.write(
|
|
986
|
+
type.guidance.endsWith("\n") ? type.guidance : `${type.guidance}
|
|
987
|
+
`
|
|
988
|
+
);
|
|
989
|
+
} else {
|
|
990
|
+
console.log(`${type.title}: ${type.description}`);
|
|
991
|
+
}
|
|
992
|
+
if (type.references.length) {
|
|
993
|
+
console.log(
|
|
994
|
+
`
|
|
995
|
+
References (artis types ${type.name} <path>):
|
|
996
|
+
${type.references.map((reference) => ` ${reference}`).join("\n")}`
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
async function whoamiFromCli(args) {
|
|
1001
|
+
const credentials = await resolveCredentials(args);
|
|
1002
|
+
const result = await apiCall(credentials, "GET /api/me");
|
|
1003
|
+
console.log(
|
|
1004
|
+
`Signed in to ${credentials.baseUrl} as ${result.principal.name ?? result.principal.userId}`
|
|
1005
|
+
);
|
|
1006
|
+
console.log(`Principal: ${result.principal.kind}`);
|
|
1007
|
+
}
|
|
1008
|
+
function artifactIdArg(value) {
|
|
1009
|
+
return artifactIdFromReference(value) ?? value;
|
|
1010
|
+
}
|
|
1011
|
+
async function getArtifactFromCli(args) {
|
|
1012
|
+
const [artifactRef] = getPositionals(args);
|
|
1013
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1014
|
+
if (!artifactId) {
|
|
1015
|
+
throw usageError("Missing artifact id or link.");
|
|
1016
|
+
}
|
|
1017
|
+
const target = await resolveOptionalTarget(args);
|
|
1018
|
+
const result = await apiCallOptional(
|
|
1019
|
+
target,
|
|
1020
|
+
"GET /api/artifacts/{artifactId}",
|
|
1021
|
+
{ params: { artifactId } }
|
|
1022
|
+
);
|
|
1023
|
+
if (hasFlag(args, "--json")) {
|
|
1024
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
console.log(`${result.artifact.metadata.title}`);
|
|
1028
|
+
console.log(`Artifact: ${result.artifact.id}`);
|
|
1029
|
+
console.log(`Revision: ${result.artifact.currentRevisionId}`);
|
|
1030
|
+
const current = result.artifact.revisions.find(
|
|
1031
|
+
(revision) => revision.id === result.artifact.currentRevisionId
|
|
1032
|
+
);
|
|
1033
|
+
const currentType = current && describeType(current);
|
|
1034
|
+
if (currentType) {
|
|
1035
|
+
console.log(`Type: ${currentType}`);
|
|
1036
|
+
}
|
|
1037
|
+
console.log(
|
|
1038
|
+
`Open annotations: ${result.annotations.filter((annotation) => isRootAnnotation(annotation) && !isReviewClosed(annotation["artis:status"])).length}`
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
async function getArtifactFilesFromCli(args) {
|
|
1042
|
+
const [artifactRef, filePath] = getPositionals(args);
|
|
1043
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1044
|
+
if (!artifactId) {
|
|
1045
|
+
throw usageError(
|
|
1046
|
+
"Usage: artis artifact files <artifact> [path] [--output <dir>] [--revision <revision-id>] [--json]"
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
const target = await resolveOptionalTarget(args);
|
|
1050
|
+
const revisionId = parseFlagValue(args, "--revision");
|
|
1051
|
+
const json = hasFlag(args, "--json");
|
|
1052
|
+
if (filePath) {
|
|
1053
|
+
const file = await apiCallOptional(
|
|
1054
|
+
target,
|
|
1055
|
+
"GET /api/artifacts/{artifactId}/files/{path}",
|
|
1056
|
+
{ params: { artifactId, path: filePath }, query: { revisionId } }
|
|
1057
|
+
);
|
|
1058
|
+
if (json) {
|
|
1059
|
+
console.log(JSON.stringify(file, null, 2));
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
process.stdout.write(
|
|
1063
|
+
file.content.endsWith("\n") ? file.content : `${file.content}
|
|
1064
|
+
`
|
|
1065
|
+
);
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
const listed = await apiCallOptional(
|
|
1069
|
+
target,
|
|
1070
|
+
"GET /api/artifacts/{artifactId}/files",
|
|
1071
|
+
{ params: { artifactId }, query: { revisionId } }
|
|
1072
|
+
);
|
|
1073
|
+
const output = parseFlagValue(args, "--output");
|
|
1074
|
+
if (output) {
|
|
1075
|
+
const files = [];
|
|
1076
|
+
for (const file of listed.files) {
|
|
1077
|
+
const read = await apiCallOptional(
|
|
1078
|
+
target,
|
|
1079
|
+
"GET /api/artifacts/{artifactId}/files/{path}",
|
|
1080
|
+
{
|
|
1081
|
+
params: { artifactId, path: file.path },
|
|
1082
|
+
query: { revisionId: listed.revisionId }
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
files.push({ path: file.path, content: read.content });
|
|
1086
|
+
}
|
|
1087
|
+
await writeFilesDir(output, files);
|
|
1088
|
+
await rememberBase(
|
|
1089
|
+
target.baseUrl,
|
|
1090
|
+
[artifactId, listed.artifactId],
|
|
1091
|
+
listed.revisionId
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
if (json) {
|
|
1095
|
+
console.log(JSON.stringify(listed, null, 2));
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
for (const file of listed.files) {
|
|
1099
|
+
console.log(`${file.path} ${file.size}`);
|
|
1100
|
+
}
|
|
1101
|
+
console.log(
|
|
1102
|
+
output ? `Wrote ${listed.files.length} files of revision ${listed.revisionId} (v${listed.version}) to ${output}.` : `Revision ${listed.revisionId} (v${listed.version})${listed.isLatest ? "" : ", not the latest"}.`
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
async function getArtifactHtmlFromCli(args) {
|
|
1106
|
+
const [artifactRef] = getPositionals(args);
|
|
1107
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1108
|
+
if (!artifactId) {
|
|
1109
|
+
throw usageError(
|
|
1110
|
+
"Usage: artis artifact html <artifact> [--output <path>] [--revision <revision-id>]"
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
const target = await resolveOptionalTarget(args);
|
|
1114
|
+
const result = await apiCallOptional(
|
|
1115
|
+
target,
|
|
1116
|
+
"GET /api/artifacts/{artifactId}/html",
|
|
1117
|
+
{
|
|
1118
|
+
params: { artifactId },
|
|
1119
|
+
query: { revisionId: parseFlagValue(args, "--revision") }
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
if (typeof result.html !== "string") {
|
|
1123
|
+
throw new Error("Artifact response did not include revision HTML.");
|
|
1124
|
+
}
|
|
1125
|
+
await rememberBase(
|
|
1126
|
+
target.baseUrl,
|
|
1127
|
+
[artifactId, result.artifactId],
|
|
1128
|
+
result.revisionId
|
|
1129
|
+
);
|
|
1130
|
+
if (result.isLatest === false) {
|
|
1131
|
+
console.error(
|
|
1132
|
+
`Note: version ${result.version} is not the latest. The latest is version ${result.latestVersion} (revision ${result.latestRevisionId}); a revise based on this one will be refused.`
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
if (hasFlag(args, "--json")) {
|
|
1136
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
const outputPath = parseFlagValue(args, "--output");
|
|
1140
|
+
if (!outputPath) {
|
|
1141
|
+
process.stdout.write(result.html);
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
await writeFile(outputPath, result.html, "utf8");
|
|
1145
|
+
console.log(`Wrote ${outputPath}`);
|
|
1146
|
+
console.log(`Revision: ${result.revisionId}`);
|
|
1147
|
+
console.log(`Version: ${result.version}`);
|
|
1148
|
+
}
|
|
1149
|
+
function parseVerifyType(value) {
|
|
1150
|
+
const type = parseTypeFlag(value);
|
|
1151
|
+
if (type === void 0 || type === "html") {
|
|
1152
|
+
return void 0;
|
|
1153
|
+
}
|
|
1154
|
+
if (!verifyTypes.includes(type)) {
|
|
1155
|
+
throw usageError(
|
|
1156
|
+
`Unknown type "${type}". Expected one of: ${verifyTypes.join(", ")}.`
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
return type;
|
|
1160
|
+
}
|
|
1161
|
+
async function verifyFromCli(args) {
|
|
1162
|
+
const [target] = getPositionals(args);
|
|
1163
|
+
const root = parseFlagValue(args, "--root");
|
|
1164
|
+
if (!target && !root) {
|
|
1165
|
+
throw usageError(
|
|
1166
|
+
"Usage: artis verify <artifact.html | artifact> [--type slides] [--revision <revision-id>] [--json]\n artis verify --root <dir> --type slides [--json]"
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
if (root) {
|
|
1170
|
+
return verifyFilesDirFromCli(args, root, target);
|
|
1171
|
+
}
|
|
1172
|
+
let type = parseVerifyType(parseFlagValue(args, "--type"));
|
|
1173
|
+
let html;
|
|
1174
|
+
let label;
|
|
1175
|
+
const referenced = artifactIdFromReference(target);
|
|
1176
|
+
const looksLikePath = !referenced && (/[\\/]/.test(target) || /\.html?$/i.test(target));
|
|
1177
|
+
const local = await readFile(target, "utf8").catch(
|
|
1178
|
+
(error) => error
|
|
1179
|
+
);
|
|
1180
|
+
if (typeof local === "string" || looksLikePath) {
|
|
1181
|
+
if (typeof local !== "string") {
|
|
1182
|
+
throw local.code === "ENOENT" ? new CliError(`File not found: ${target}`, exitCodes.notFound) : usageError(`Cannot read ${target}: ${local.message}`);
|
|
1183
|
+
}
|
|
1184
|
+
if (parseFlagValue(args, "--revision")) {
|
|
1185
|
+
throw usageError(
|
|
1186
|
+
"--revision applies to a published artifact, not a local file."
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
html = local;
|
|
1190
|
+
label = target;
|
|
1191
|
+
} else {
|
|
1192
|
+
const remote = await resolveOptionalTarget(args);
|
|
1193
|
+
const result = await apiCallOptional(
|
|
1194
|
+
remote,
|
|
1195
|
+
"GET /api/artifacts/{artifactId}/html",
|
|
1196
|
+
{
|
|
1197
|
+
params: { artifactId: referenced ?? target },
|
|
1198
|
+
query: { revisionId: parseFlagValue(args, "--revision") }
|
|
1199
|
+
}
|
|
1200
|
+
);
|
|
1201
|
+
html = result.html;
|
|
1202
|
+
label = `${target} v${result.version}`;
|
|
1203
|
+
if (type === void 0) {
|
|
1204
|
+
const { artifact } = await apiCallOptional(
|
|
1205
|
+
remote,
|
|
1206
|
+
"GET /api/artifacts/{artifactId}",
|
|
1207
|
+
{ params: { artifactId: referenced ?? target } }
|
|
1208
|
+
);
|
|
1209
|
+
const declared = artifact.revisions.find(
|
|
1210
|
+
(revision) => revision.id === result.revisionId
|
|
1211
|
+
)?.type;
|
|
1212
|
+
if (declared && declared !== "html") {
|
|
1213
|
+
if (!verifyTypes.includes(declared)) {
|
|
1214
|
+
throw new CliError(
|
|
1215
|
+
`${label} is of type ${declared}, which this CLI cannot verify. Update the CLI.`,
|
|
1216
|
+
exitCodes.error
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
type = declared;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
await runVerify(args, html, label, type);
|
|
1224
|
+
}
|
|
1225
|
+
async function verifyFilesDirFromCli(args, root, target) {
|
|
1226
|
+
if (target) {
|
|
1227
|
+
throw usageError("--root takes no file or artifact argument.");
|
|
1228
|
+
}
|
|
1229
|
+
if (parseFlagValue(args, "--revision")) {
|
|
1230
|
+
throw usageError("--revision applies to a published artifact.");
|
|
1231
|
+
}
|
|
1232
|
+
const type = parseVerifyType(parseFlagValue(args, "--type"));
|
|
1233
|
+
if (type !== "slides") {
|
|
1234
|
+
throw usageError("--root needs --type slides: a deck as files.");
|
|
1235
|
+
}
|
|
1236
|
+
const composed = composeSlidesFiles(await readFilesDir(root));
|
|
1237
|
+
if (!composed.ok) {
|
|
1238
|
+
console.error(composed.error);
|
|
1239
|
+
throw new CliError("", exitCodes.verifyFailed);
|
|
1240
|
+
}
|
|
1241
|
+
await runVerify(args, composed.value, root, type);
|
|
1242
|
+
}
|
|
1243
|
+
async function runVerify(args, html, label, type) {
|
|
1244
|
+
const json = hasFlag(args, "--json");
|
|
1245
|
+
const title = `Verified ${label}${type ? ` (type ${type})` : ""}`;
|
|
1246
|
+
let report;
|
|
1247
|
+
try {
|
|
1248
|
+
report = await verifyHtml(html, { type });
|
|
1249
|
+
} catch (error) {
|
|
1250
|
+
if (error instanceof VerifyUnavailableError) {
|
|
1251
|
+
if (error.partial && !json) {
|
|
1252
|
+
console.log(title);
|
|
1253
|
+
for (const line of formatVerifyReport(error.partial)) {
|
|
1254
|
+
console.log(line);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
throw new CliError(
|
|
1258
|
+
error.partial ? `Rendering checks did not run: ${error.message}` : error.message,
|
|
1259
|
+
exitCodes.error
|
|
1260
|
+
);
|
|
1261
|
+
}
|
|
1262
|
+
throw error;
|
|
1263
|
+
}
|
|
1264
|
+
if (json) {
|
|
1265
|
+
console.log(JSON.stringify(report, null, 2));
|
|
1266
|
+
} else {
|
|
1267
|
+
console.log(title);
|
|
1268
|
+
for (const line of formatVerifyReport(report)) {
|
|
1269
|
+
console.log(line);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
if (!report.ok) {
|
|
1273
|
+
throw new CliError("", exitCodes.verifyFailed);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
async function listArtifactsFromCli(args) {
|
|
1277
|
+
rejectRemovedKindFlag(args);
|
|
1278
|
+
const credentials = await resolveCredentials(args);
|
|
1279
|
+
const query = parseFlagValue(args, "--query");
|
|
1280
|
+
const tag = parseFlagValue(args, "--tag");
|
|
1281
|
+
const type = parseTypeFlag(parseFlagValue(args, "--type"));
|
|
1282
|
+
const limit = parseFlagValue(args, "--limit");
|
|
1283
|
+
const cursor = parseFlagValue(args, "--cursor");
|
|
1284
|
+
if (limit !== void 0 && (!/^\d+$/.test(limit) || Number(limit) < 1 || Number(limit) > artifactListLimits.max)) {
|
|
1285
|
+
throw usageError(
|
|
1286
|
+
`Invalid --limit "${limit}". Pass a whole number from 1 to ${artifactListLimits.max}.`
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
const result = await apiCall(credentials, "GET /api/artifacts", {
|
|
1290
|
+
query: {
|
|
1291
|
+
owner: "me",
|
|
1292
|
+
q: query || void 0,
|
|
1293
|
+
tag: tag || void 0,
|
|
1294
|
+
type,
|
|
1295
|
+
limit: limit ? Number(limit) : void 0,
|
|
1296
|
+
cursor: cursor || void 0
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
if (hasFlag(args, "--json")) {
|
|
1300
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
const { artifacts } = result;
|
|
1304
|
+
if (!artifacts.length) {
|
|
1305
|
+
console.log(
|
|
1306
|
+
cursor ? "No more artifacts." : query || tag ? "No artifacts match." : "You have no artifacts yet."
|
|
1307
|
+
);
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
for (const artifact of artifacts) {
|
|
1311
|
+
const tags = artifact.metadata.tags?.length ? ` #${artifact.metadata.tags.join(" #")}` : "";
|
|
1312
|
+
console.log(
|
|
1313
|
+
`${artifactShortId(artifact.id)} ${artifact.metadata.visibility} ${artifact.metadata.title}${tags}`
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
if (result.nextCursor) {
|
|
1317
|
+
console.log(
|
|
1318
|
+
`More artifacts: rerun with --cursor ${result.nextCursor} (same filters).`
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
async function getArtifactFeedbackFromCli(args) {
|
|
1323
|
+
const [artifactRef] = getPositionals(args);
|
|
1324
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1325
|
+
if (!artifactId) {
|
|
1326
|
+
throw usageError("Missing artifact id or link.");
|
|
1327
|
+
}
|
|
1328
|
+
const target = await resolveOptionalTarget(args);
|
|
1329
|
+
const result = await apiCallOptional(
|
|
1330
|
+
target,
|
|
1331
|
+
"GET /api/artifacts/{artifactId}/feedback",
|
|
1332
|
+
{
|
|
1333
|
+
params: { artifactId },
|
|
1334
|
+
query: { revisionId: parseFlagValue(args, "--revision") }
|
|
1335
|
+
}
|
|
1336
|
+
);
|
|
1337
|
+
if (hasFlag(args, "--json")) {
|
|
1338
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1339
|
+
return;
|
|
1340
|
+
}
|
|
1341
|
+
console.log(result.prompt);
|
|
1342
|
+
console.log(
|
|
1343
|
+
`
|
|
1344
|
+
Feedback cursor: ${result.cursor} (artis watch ${artifactId} --since ${result.cursor})`
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1347
|
+
async function shareArtifactFromCli(args) {
|
|
1348
|
+
const [artifactRef] = getPositionals(args);
|
|
1349
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1350
|
+
if (!artifactId) {
|
|
1351
|
+
throw usageError(
|
|
1352
|
+
"Usage: artis share <artifact> [--email <email> --role <viewer|commenter|contributor|editor>] [--remove]"
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
const email = parseFlagValue(args, "--email")?.trim().toLowerCase();
|
|
1356
|
+
const credentials = await resolveCredentials(args);
|
|
1357
|
+
if (!email) {
|
|
1358
|
+
const result2 = await apiCall(
|
|
1359
|
+
credentials,
|
|
1360
|
+
"GET /api/artifacts/{artifactId}/shares",
|
|
1361
|
+
{ params: { artifactId } }
|
|
1362
|
+
);
|
|
1363
|
+
if (hasFlag(args, "--json")) {
|
|
1364
|
+
console.log(JSON.stringify(result2, null, 2));
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
const { shares } = result2;
|
|
1368
|
+
if (!shares.length) {
|
|
1369
|
+
console.log("No invited people yet.");
|
|
1370
|
+
return;
|
|
1371
|
+
}
|
|
1372
|
+
for (const share of shares) {
|
|
1373
|
+
console.log(`${share.email} ${share.role}`);
|
|
1374
|
+
}
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
if (hasFlag(args, "--remove")) {
|
|
1378
|
+
await apiCall(
|
|
1379
|
+
credentials,
|
|
1380
|
+
"DELETE /api/artifacts/{artifactId}/shares/{email}",
|
|
1381
|
+
{ params: { artifactId, email } }
|
|
1382
|
+
);
|
|
1383
|
+
console.log(`Removed ${email}`);
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
const role = parseShareRole(parseFlagValue(args, "--role") ?? "viewer");
|
|
1387
|
+
const result = await apiCall(
|
|
1388
|
+
credentials,
|
|
1389
|
+
"POST /api/artifacts/{artifactId}/shares",
|
|
1390
|
+
{ params: { artifactId }, body: { email, role } }
|
|
1391
|
+
);
|
|
1392
|
+
if (hasFlag(args, "--json")) {
|
|
1393
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
console.log(`Shared with ${result.share.email} as ${result.share.role}`);
|
|
1397
|
+
}
|
|
1398
|
+
async function setArtifactVisibilityFromCli(args) {
|
|
1399
|
+
const [artifactRef, value] = getPositionals(args);
|
|
1400
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1401
|
+
if (!artifactId || !value) {
|
|
1402
|
+
throw usageError(
|
|
1403
|
+
`Usage: artis artifact visibility <artifact> <${cliVisibilityOptions.join("|")}>`
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
const visibility = parseVisibility(value);
|
|
1407
|
+
const credentials = await resolveCredentials(args);
|
|
1408
|
+
const result = await apiCall(
|
|
1409
|
+
credentials,
|
|
1410
|
+
"PATCH /api/artifacts/{artifactId}",
|
|
1411
|
+
{ params: { artifactId }, body: { visibility } }
|
|
1412
|
+
);
|
|
1413
|
+
if (hasFlag(args, "--json")) {
|
|
1414
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
console.log(`Visibility: ${result.artifact.metadata.visibility}`);
|
|
1418
|
+
}
|
|
1419
|
+
async function deleteArtifactFromCli(args) {
|
|
1420
|
+
const [artifactRef] = getPositionals(args);
|
|
1421
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1422
|
+
if (!artifactId) {
|
|
1423
|
+
throw usageError("Usage: artis artifact delete <artifact> --yes");
|
|
1424
|
+
}
|
|
1425
|
+
if (!hasFlag(args, "--yes")) {
|
|
1426
|
+
throw usageError(
|
|
1427
|
+
"Deleting an artifact removes every revision, annotation and share, and cannot be undone. Pass --yes to confirm."
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
const credentials = await resolveCredentials(args);
|
|
1431
|
+
await apiCall(credentials, "DELETE /api/artifacts/{artifactId}", {
|
|
1432
|
+
params: { artifactId }
|
|
1433
|
+
});
|
|
1434
|
+
console.log(`Deleted ${artifactId}`);
|
|
1435
|
+
}
|
|
1436
|
+
async function reviseArtifactFromCli(args) {
|
|
1437
|
+
rejectRemovedResolveFlag(args);
|
|
1438
|
+
const [artifactRef, filePath] = getPositionals(args);
|
|
1439
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1440
|
+
const summary = parseFlagValue(args, "--summary");
|
|
1441
|
+
const root = parseFlagValue(args, "--root");
|
|
1442
|
+
if (!artifactId || !filePath && !root || filePath && root) {
|
|
1443
|
+
throw usageError(
|
|
1444
|
+
"Usage: artis revise <artifact> (artifact.html | --root <dir>) --summary <text> [--base <revision-id>]"
|
|
1445
|
+
);
|
|
1446
|
+
}
|
|
1447
|
+
if (!summary) {
|
|
1448
|
+
throw usageError("Missing --summary for revision.");
|
|
1449
|
+
}
|
|
1450
|
+
const capabilities = await parseCapabilitiesFlag(
|
|
1451
|
+
parseFlagValue(args, "--capabilities")
|
|
1452
|
+
);
|
|
1453
|
+
const contract = parseContractFlag(parseFlagValue(args, "--contract"));
|
|
1454
|
+
const type = parseTypeFlag(parseFlagValue(args, "--type"));
|
|
1455
|
+
const credentials = await resolveCredentials(args);
|
|
1456
|
+
const explicitBase = parseFlagValue(args, "--base");
|
|
1457
|
+
const baseRevisionId = explicitBase ?? await getRememberedBase(credentials.baseUrl, artifactId);
|
|
1458
|
+
const query = {
|
|
1459
|
+
authorName: parseFlagValue(args, "--author") ?? "Artis CLI",
|
|
1460
|
+
baseRevisionId,
|
|
1461
|
+
source: "cli",
|
|
1462
|
+
summary,
|
|
1463
|
+
capabilities,
|
|
1464
|
+
contract,
|
|
1465
|
+
type
|
|
1466
|
+
};
|
|
1467
|
+
let result;
|
|
1468
|
+
if (root) {
|
|
1469
|
+
const local = await readFilesDir(root);
|
|
1470
|
+
const remote = await apiCall(
|
|
1471
|
+
credentials,
|
|
1472
|
+
"GET /api/artifacts/{artifactId}/files",
|
|
1473
|
+
{ params: { artifactId }, query: { revisionId: baseRevisionId } }
|
|
1474
|
+
);
|
|
1475
|
+
const files = changedFiles(local, remote.files);
|
|
1476
|
+
if (Object.keys(files).length === 0) {
|
|
1477
|
+
console.log(
|
|
1478
|
+
`No files differ from revision ${remote.revisionId}; nothing to revise.`
|
|
1479
|
+
);
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
result = await apiCall(
|
|
1483
|
+
credentials,
|
|
1484
|
+
"POST /api/artifacts/{artifactId}/revisions/files",
|
|
1485
|
+
{ params: { artifactId }, query, body: { files } }
|
|
1486
|
+
);
|
|
1487
|
+
if (!hasFlag(args, "--json")) {
|
|
1488
|
+
const removed = Object.values(files).filter(
|
|
1489
|
+
(content) => content === null
|
|
1490
|
+
);
|
|
1491
|
+
console.log(
|
|
1492
|
+
`Sent ${Object.keys(files).length - removed.length} changed and ${removed.length} removed of ${Object.keys(local).length} files.`
|
|
1493
|
+
);
|
|
1494
|
+
}
|
|
1495
|
+
} else {
|
|
1496
|
+
const html = await readHtmlUpload(filePath ?? "", "Revision file");
|
|
1497
|
+
result = await apiCall(
|
|
1498
|
+
credentials,
|
|
1499
|
+
"POST /api/artifacts/{artifactId}/revisions",
|
|
1500
|
+
{ params: { artifactId }, query, body: html }
|
|
1501
|
+
);
|
|
1502
|
+
}
|
|
1503
|
+
await rememberBase(
|
|
1504
|
+
credentials.baseUrl,
|
|
1505
|
+
[artifactId],
|
|
1506
|
+
result.revision.id,
|
|
1507
|
+
baseRevisionId
|
|
1508
|
+
);
|
|
1509
|
+
if (hasFlag(args, "--json")) {
|
|
1510
|
+
console.log(JSON.stringify({ revision: result.revision }, null, 2));
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
console.log(`Revision ${result.revision.id}`);
|
|
1514
|
+
console.log(`Version ${result.revision.version}`);
|
|
1515
|
+
const revisionType = describeType(result.revision);
|
|
1516
|
+
if (revisionType) {
|
|
1517
|
+
console.log(`Type ${revisionType}`);
|
|
1518
|
+
}
|
|
1519
|
+
if (baseRevisionId && !explicitBase) {
|
|
1520
|
+
console.log(`Base ${baseRevisionId} (remembered from this machine)`);
|
|
1521
|
+
} else if (!baseRevisionId) {
|
|
1522
|
+
console.log(
|
|
1523
|
+
"No base revision: pass --base, or read the artifact with publish or artifact html first, so a concurrent revision is refused instead of overwritten."
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
async function createAnnotationFromCli(args) {
|
|
1528
|
+
const [artifactRef] = getPositionals(args);
|
|
1529
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1530
|
+
const comment = parseFlagValue(args, "--comment");
|
|
1531
|
+
if (!artifactId || !comment) {
|
|
1532
|
+
throw usageError(
|
|
1533
|
+
"Usage: artis annotate <artifact> --comment <text> [--title <text>] [--quote <text>] [--css <selector>] [--text-start <n> --text-end <n>] [--rect <x,y,w,h>] [--pin-label <text>] [--requested-change <text>] [--status <open|resolved>]"
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
const selectors = buildAnnotationSelectors(args);
|
|
1537
|
+
const credentials = await resolveCredentials(args);
|
|
1538
|
+
const result = await apiCall(
|
|
1539
|
+
credentials,
|
|
1540
|
+
"POST /api/artifacts/{artifactId}/annotations",
|
|
1541
|
+
{
|
|
1542
|
+
params: { artifactId },
|
|
1543
|
+
body: {
|
|
1544
|
+
authorName: parseFlagValue(args, "--author") ?? "Artis CLI",
|
|
1545
|
+
comment,
|
|
1546
|
+
pinLabel: parseFlagValue(args, "--pin-label"),
|
|
1547
|
+
requestedChange: parseFlagValue(args, "--requested-change"),
|
|
1548
|
+
role: "agent",
|
|
1549
|
+
selectors: selectors.length ? selectors : void 0,
|
|
1550
|
+
status: parseAnnotationStatus(
|
|
1551
|
+
parseFlagValue(args, "--status") ?? "open"
|
|
1552
|
+
),
|
|
1553
|
+
title: parseFlagValue(args, "--title")
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
);
|
|
1557
|
+
console.log(`Annotation ${annotationIdFromIri(result.annotation.id)}`);
|
|
1558
|
+
console.log(`Status ${result.annotation["artis:status"]}`);
|
|
1559
|
+
}
|
|
1560
|
+
async function replyFromCli(args) {
|
|
1561
|
+
const [annotationId] = getPositionals(args);
|
|
1562
|
+
const comment = parseFlagValue(args, "--comment");
|
|
1563
|
+
if (!annotationId || !comment) {
|
|
1564
|
+
throw usageError("Usage: artis reply <annotation-id> --comment <text>");
|
|
1565
|
+
}
|
|
1566
|
+
const credentials = await resolveCredentials(args);
|
|
1567
|
+
const result = await apiCall(
|
|
1568
|
+
credentials,
|
|
1569
|
+
"POST /api/annotations/{annotationId}/replies",
|
|
1570
|
+
{
|
|
1571
|
+
params: { annotationId },
|
|
1572
|
+
body: {
|
|
1573
|
+
authorName: parseFlagValue(args, "--author") ?? "Artis CLI",
|
|
1574
|
+
comment,
|
|
1575
|
+
role: "agent"
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
);
|
|
1579
|
+
console.log(`Reply ${annotationIdFromIri(result.annotation.id)}`);
|
|
1580
|
+
}
|
|
1581
|
+
async function editAnnotationFromCli(args) {
|
|
1582
|
+
const [annotationId] = getPositionals(args);
|
|
1583
|
+
const comment = parseFlagValue(args, "--comment");
|
|
1584
|
+
const title = parseFlagValue(args, "--title");
|
|
1585
|
+
const requestedChange = parseFlagValue(args, "--requested-change");
|
|
1586
|
+
if (!annotationId || comment === void 0 && title === void 0 && requestedChange === void 0) {
|
|
1587
|
+
throw usageError(
|
|
1588
|
+
"Usage: artis annotation edit <annotation-id> [--comment <text>] [--title <text>] [--requested-change <text>]"
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
const credentials = await resolveCredentials(args);
|
|
1592
|
+
const result = await apiCall(
|
|
1593
|
+
credentials,
|
|
1594
|
+
"PATCH /api/annotations/{annotationId}",
|
|
1595
|
+
{ params: { annotationId }, body: { comment, title, requestedChange } }
|
|
1596
|
+
);
|
|
1597
|
+
console.log(`Annotation ${annotationIdFromIri(result.annotation.id)} edited`);
|
|
1598
|
+
}
|
|
1599
|
+
async function retractAnnotationFromCli(args) {
|
|
1600
|
+
const [annotationId] = getPositionals(args);
|
|
1601
|
+
if (!annotationId) {
|
|
1602
|
+
throw usageError("Usage: artis annotation retract <annotation-id>");
|
|
1603
|
+
}
|
|
1604
|
+
const credentials = await resolveCredentials(args);
|
|
1605
|
+
const result = await apiCall(
|
|
1606
|
+
credentials,
|
|
1607
|
+
"DELETE /api/annotations/{annotationId}",
|
|
1608
|
+
{ params: { annotationId } }
|
|
1609
|
+
);
|
|
1610
|
+
console.log(
|
|
1611
|
+
`Annotation ${annotationIdFromIri(result.annotation.id)} retracted`
|
|
1612
|
+
);
|
|
1613
|
+
}
|
|
1614
|
+
var watchMaxWaitSeconds = 25;
|
|
1615
|
+
var watchInitialBackoffMs = 1e3;
|
|
1616
|
+
var watchMaxBackoffMs = 6e4;
|
|
1617
|
+
function parseDuration(value) {
|
|
1618
|
+
const match = /^(\d+(?:\.\d+)?)(ms|s|m|h)?$/.exec(value.trim());
|
|
1619
|
+
if (!match) {
|
|
1620
|
+
throw usageError(
|
|
1621
|
+
`Invalid duration "${value}". Use e.g. 30s, 5m, 1h, or 500ms.`
|
|
1622
|
+
);
|
|
1623
|
+
}
|
|
1624
|
+
const unitMs = { ms: 1, s: 1e3, m: 6e4, h: 36e5 }[match[2] ?? "s"];
|
|
1625
|
+
return Number(match[1]) * unitMs;
|
|
1626
|
+
}
|
|
1627
|
+
async function watchArtifactFromCli(args) {
|
|
1628
|
+
const [artifactRef] = getPositionals(args);
|
|
1629
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1630
|
+
if (!artifactId) {
|
|
1631
|
+
throw usageError(
|
|
1632
|
+
"Usage: artis watch <artifact> [--since <cursor>] [--once] [--timeout <duration>] [--include-self] [--types <families>]"
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
const typesFlag = parseFlagValue(args, "--types");
|
|
1636
|
+
const types = typesFlag?.split(",").map((type) => type.trim()).filter(Boolean);
|
|
1637
|
+
let cursor = parseFlagValue(args, "--since");
|
|
1638
|
+
if (cursor !== void 0 && !/^\d+$/.test(cursor)) {
|
|
1639
|
+
throw usageError(
|
|
1640
|
+
`Invalid --since "${cursor}". Pass a cursor from artifact feedback or a previous event.`
|
|
1641
|
+
);
|
|
1642
|
+
}
|
|
1643
|
+
const timeoutFlag = parseFlagValue(args, "--timeout");
|
|
1644
|
+
const deadline = timeoutFlag !== void 0 ? Date.now() + parseDuration(timeoutFlag) : void 0;
|
|
1645
|
+
const once = hasFlag(args, "--once");
|
|
1646
|
+
const includeSelf = hasFlag(args, "--include-self");
|
|
1647
|
+
const credentials = await resolveCredentials(args);
|
|
1648
|
+
const api = apiClient(credentials);
|
|
1649
|
+
let backoffMs = watchInitialBackoffMs;
|
|
1650
|
+
let delivered = false;
|
|
1651
|
+
const timedOut = () => new CliError(
|
|
1652
|
+
`No feedback events within ${timeoutFlag}.${cursor ? ` Resume with --since ${cursor}.` : ""}`,
|
|
1653
|
+
exitCodes.watchTimeout
|
|
1654
|
+
);
|
|
1655
|
+
const backOff = async () => {
|
|
1656
|
+
const remaining = deadline === void 0 ? Infinity : deadline - Date.now();
|
|
1657
|
+
if (remaining <= backoffMs) {
|
|
1658
|
+
if (delivered) {
|
|
1659
|
+
return false;
|
|
1660
|
+
}
|
|
1661
|
+
throw timedOut();
|
|
1662
|
+
}
|
|
1663
|
+
await sleep(backoffMs);
|
|
1664
|
+
backoffMs = Math.min(backoffMs * 2, watchMaxBackoffMs);
|
|
1665
|
+
return true;
|
|
1666
|
+
};
|
|
1667
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
1668
|
+
const remainingMs = deadline === void 0 ? Infinity : deadline - Date.now();
|
|
1669
|
+
if (attempt > 0 && remainingMs < 1e3) {
|
|
1670
|
+
if (delivered) {
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
throw timedOut();
|
|
1674
|
+
}
|
|
1675
|
+
let page;
|
|
1676
|
+
try {
|
|
1677
|
+
page = await api.call("GET /api/artifacts/{artifactId}/events", {
|
|
1678
|
+
params: { artifactId },
|
|
1679
|
+
query: {
|
|
1680
|
+
wait: Math.min(watchMaxWaitSeconds, Math.floor(remainingMs / 1e3)),
|
|
1681
|
+
since: cursor,
|
|
1682
|
+
includeSelf: includeSelf || void 0,
|
|
1683
|
+
types
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1686
|
+
} catch (error) {
|
|
1687
|
+
if (!(error instanceof ApiError)) {
|
|
1688
|
+
if (await backOff()) {
|
|
1689
|
+
continue;
|
|
1690
|
+
}
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
if ((error.status === 429 || error.status >= 500) && !once) {
|
|
1694
|
+
if (await backOff()) {
|
|
1695
|
+
continue;
|
|
1696
|
+
}
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
throw new CliError(
|
|
1700
|
+
error.status === 410 ? `${error.message} Re-read feedback (artis artifact feedback ${artifactId} --json) and watch from its cursor.` : error.message,
|
|
1701
|
+
exitCodeForResponse(error.status, error.code)
|
|
1702
|
+
);
|
|
1703
|
+
}
|
|
1704
|
+
backoffMs = watchInitialBackoffMs;
|
|
1705
|
+
const { events } = page;
|
|
1706
|
+
cursor = page.cursor;
|
|
1707
|
+
if (events.length === 0) {
|
|
1708
|
+
continue;
|
|
1709
|
+
}
|
|
1710
|
+
if (once) {
|
|
1711
|
+
console.log(JSON.stringify({ events, cursor }));
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
for (const event of events) {
|
|
1715
|
+
process.stdout.write(`${JSON.stringify(event)}
|
|
1716
|
+
`);
|
|
1717
|
+
}
|
|
1718
|
+
delivered = true;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
var dataActions = [
|
|
1722
|
+
"get",
|
|
1723
|
+
"list",
|
|
1724
|
+
"set",
|
|
1725
|
+
"update",
|
|
1726
|
+
"delete",
|
|
1727
|
+
"batch",
|
|
1728
|
+
"export",
|
|
1729
|
+
"usage"
|
|
1730
|
+
];
|
|
1731
|
+
var dataAsRoles = ["viewer", "commenter", "contributor"];
|
|
1732
|
+
var dataUsage = "Usage: artis data <get|list|set|update|delete|batch|export|usage> <artifact> [path] [options]. Run artis help.";
|
|
1733
|
+
function parseIfMatchFlag(value) {
|
|
1734
|
+
if (value === void 0) return void 0;
|
|
1735
|
+
const match = /^([^@\s]+)@([1-9]\d*)$/.exec(value);
|
|
1736
|
+
if (!match?.[1] || !match[2]) {
|
|
1737
|
+
throw usageError(
|
|
1738
|
+
`Invalid --if-match "${value}". Expected <id>@<version>, e.g. doc-abc@3.`
|
|
1739
|
+
);
|
|
1740
|
+
}
|
|
1741
|
+
return { id: match[1], version: Number(match[2]) };
|
|
1742
|
+
}
|
|
1743
|
+
function parseDataCommand(args) {
|
|
1744
|
+
const [action, artifactRef, path, extra] = getPositionals(args);
|
|
1745
|
+
const artifactId = artifactRef && artifactIdArg(artifactRef);
|
|
1746
|
+
if (!dataActions.includes(action) || !artifactId) {
|
|
1747
|
+
throw usageError(dataUsage);
|
|
1748
|
+
}
|
|
1749
|
+
const command = { action, artifactId };
|
|
1750
|
+
const is = (...actions) => actions.includes(command.action);
|
|
1751
|
+
if (is("get", "set", "update", "delete") && !path) {
|
|
1752
|
+
throw usageError(`Usage: artis data ${command.action} <artifact> <path>`);
|
|
1753
|
+
}
|
|
1754
|
+
if (extra !== void 0 || path !== void 0 && is("batch", "export", "usage")) {
|
|
1755
|
+
throw usageError(dataUsage);
|
|
1756
|
+
}
|
|
1757
|
+
if (path !== void 0) command.path = path;
|
|
1758
|
+
const asRole = parseFlagValue(args, "--as-role");
|
|
1759
|
+
if (asRole !== void 0) {
|
|
1760
|
+
if (!is("get", "list", "export")) {
|
|
1761
|
+
throw usageError("--as-role applies to data get, list and export.");
|
|
1762
|
+
}
|
|
1763
|
+
if (!dataAsRoles.includes(asRole)) {
|
|
1764
|
+
throw usageError(
|
|
1765
|
+
`Invalid --as-role "${asRole}". Expected one of: ${dataAsRoles.join(", ")}.`
|
|
1766
|
+
);
|
|
1767
|
+
}
|
|
1768
|
+
command.asRole = asRole;
|
|
1769
|
+
}
|
|
1770
|
+
const ifMatch = parseIfMatchFlag(parseFlagValue(args, "--if-match"));
|
|
1771
|
+
const ifAbsent = hasFlag(args, "--if-absent");
|
|
1772
|
+
if (ifMatch && ifAbsent) {
|
|
1773
|
+
throw usageError("Pass --if-match or --if-absent, not both.");
|
|
1774
|
+
}
|
|
1775
|
+
if (ifMatch) {
|
|
1776
|
+
if (!is("set", "update", "delete")) {
|
|
1777
|
+
throw usageError("--if-match applies to data set, update and delete.");
|
|
1778
|
+
}
|
|
1779
|
+
command.ifMatch = ifMatch;
|
|
1780
|
+
}
|
|
1781
|
+
if (ifAbsent) {
|
|
1782
|
+
if (!is("set", "update")) {
|
|
1783
|
+
throw usageError("--if-absent applies to data set and update.");
|
|
1784
|
+
}
|
|
1785
|
+
command.ifAbsent = true;
|
|
1786
|
+
}
|
|
1787
|
+
const key = parseFlagValue(args, "--idempotency-key");
|
|
1788
|
+
if (key !== void 0) {
|
|
1789
|
+
if (!is("set", "update", "delete", "batch")) {
|
|
1790
|
+
throw usageError("--idempotency-key applies to data writes.");
|
|
1791
|
+
}
|
|
1792
|
+
if (!/^[\x21-\x7e]{1,255}$/.test(key)) {
|
|
1793
|
+
throw usageError(
|
|
1794
|
+
"--idempotency-key must be 1-255 printable characters without spaces."
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1797
|
+
command.idempotencyKey = key;
|
|
1798
|
+
}
|
|
1799
|
+
return command;
|
|
1800
|
+
}
|
|
1801
|
+
async function readStdin() {
|
|
1802
|
+
const chunks = [];
|
|
1803
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
1804
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
1805
|
+
}
|
|
1806
|
+
async function readJsonFlag(args, flag) {
|
|
1807
|
+
const value = parseFlagValue(args, flag);
|
|
1808
|
+
if (value === void 0) {
|
|
1809
|
+
throw usageError(`Missing ${flag} <json|file|->.`);
|
|
1810
|
+
}
|
|
1811
|
+
let source = value;
|
|
1812
|
+
if (value === "-") {
|
|
1813
|
+
source = await readStdin();
|
|
1814
|
+
} else if (!/^\s*[[{]/.test(value)) {
|
|
1815
|
+
try {
|
|
1816
|
+
source = await readFile(value, "utf8");
|
|
1817
|
+
} catch {
|
|
1818
|
+
throw usageError(
|
|
1819
|
+
`${flag} must be JSON, a path to a JSON file, or - for stdin; could not read "${value}".`
|
|
1820
|
+
);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
try {
|
|
1824
|
+
return JSON.parse(source);
|
|
1825
|
+
} catch {
|
|
1826
|
+
throw usageError(`${flag} is not valid JSON.`);
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
async function readJsonObjectFlag(args, flag) {
|
|
1830
|
+
const value = await readJsonFlag(args, flag);
|
|
1831
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1832
|
+
throw usageError(`${flag} must be a JSON object.`);
|
|
1833
|
+
}
|
|
1834
|
+
return value;
|
|
1835
|
+
}
|
|
1836
|
+
function printJson(value) {
|
|
1837
|
+
console.log(JSON.stringify(value, null, 2));
|
|
1838
|
+
}
|
|
1839
|
+
async function dataFromCli(args) {
|
|
1840
|
+
const command = parseDataCommand(args);
|
|
1841
|
+
const credentials = await resolveCredentials(args);
|
|
1842
|
+
const { artifactId } = command;
|
|
1843
|
+
const path = command.path ?? "";
|
|
1844
|
+
const headers = command.idempotencyKey ? { "idempotency-key": command.idempotencyKey } : void 0;
|
|
1845
|
+
const condition = {
|
|
1846
|
+
...command.ifMatch ? { ifMatch: command.ifMatch } : {},
|
|
1847
|
+
...command.ifAbsent ? { ifAbsent: true } : {}
|
|
1848
|
+
};
|
|
1849
|
+
switch (command.action) {
|
|
1850
|
+
case "get": {
|
|
1851
|
+
const { document } = await apiCall(
|
|
1852
|
+
credentials,
|
|
1853
|
+
"GET /api/artifacts/{artifactId}/data/docs/{path}",
|
|
1854
|
+
{ params: { artifactId, path }, query: { asRole: command.asRole } }
|
|
1855
|
+
);
|
|
1856
|
+
printJson(document);
|
|
1857
|
+
if (!document) {
|
|
1858
|
+
throw new CliError(`No document at "${path}".`, exitCodes.notFound);
|
|
1859
|
+
}
|
|
1860
|
+
return;
|
|
1861
|
+
}
|
|
1862
|
+
case "list": {
|
|
1863
|
+
const limit = parseFlagValue(args, "--limit");
|
|
1864
|
+
if (limit !== void 0 && (!/^\d+$/.test(limit) || Number(limit) < 1 || Number(limit) > 1e3)) {
|
|
1865
|
+
throw usageError(
|
|
1866
|
+
`Invalid --limit "${limit}". Pass a whole number from 1 to 1000.`
|
|
1867
|
+
);
|
|
1868
|
+
}
|
|
1869
|
+
const depth = parseFlagValue(args, "--depth");
|
|
1870
|
+
if (depth !== void 0 && depth !== "children" && depth !== "all") {
|
|
1871
|
+
throw usageError("--depth must be children or all.");
|
|
1872
|
+
}
|
|
1873
|
+
const order = parseFlagValue(args, "--order");
|
|
1874
|
+
if (order !== void 0 && order !== "path" && order !== "created") {
|
|
1875
|
+
throw usageError("--order must be path or created.");
|
|
1876
|
+
}
|
|
1877
|
+
printJson(
|
|
1878
|
+
await apiCall(credentials, "GET /api/artifacts/{artifactId}/data", {
|
|
1879
|
+
params: { artifactId },
|
|
1880
|
+
query: {
|
|
1881
|
+
prefix: command.path,
|
|
1882
|
+
depth,
|
|
1883
|
+
order,
|
|
1884
|
+
limit: limit ? Number(limit) : void 0,
|
|
1885
|
+
after: parseFlagValue(args, "--after"),
|
|
1886
|
+
asRole: command.asRole
|
|
1887
|
+
}
|
|
1888
|
+
})
|
|
1889
|
+
);
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
case "set": {
|
|
1893
|
+
const value = await readJsonObjectFlag(args, "--value");
|
|
1894
|
+
const { document } = await apiCall(
|
|
1895
|
+
credentials,
|
|
1896
|
+
"PUT /api/artifacts/{artifactId}/data/docs/{path}",
|
|
1897
|
+
{
|
|
1898
|
+
params: { artifactId, path },
|
|
1899
|
+
body: { value, ...condition },
|
|
1900
|
+
headers
|
|
1901
|
+
}
|
|
1902
|
+
);
|
|
1903
|
+
printJson(document);
|
|
1904
|
+
return;
|
|
1905
|
+
}
|
|
1906
|
+
case "update": {
|
|
1907
|
+
const patch = await readJsonObjectFlag(args, "--patch");
|
|
1908
|
+
const { document } = await apiCall(
|
|
1909
|
+
credentials,
|
|
1910
|
+
"PATCH /api/artifacts/{artifactId}/data/docs/{path}",
|
|
1911
|
+
{
|
|
1912
|
+
params: { artifactId, path },
|
|
1913
|
+
body: { patch, ...condition },
|
|
1914
|
+
headers
|
|
1915
|
+
}
|
|
1916
|
+
);
|
|
1917
|
+
printJson(document);
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
case "delete": {
|
|
1921
|
+
const ifMatch = command.ifMatch ? `${command.ifMatch.id}@${command.ifMatch.version}` : void 0;
|
|
1922
|
+
printJson(
|
|
1923
|
+
await apiCall(
|
|
1924
|
+
credentials,
|
|
1925
|
+
"DELETE /api/artifacts/{artifactId}/data/docs/{path}",
|
|
1926
|
+
{ params: { artifactId, path }, query: { ifMatch }, headers }
|
|
1927
|
+
)
|
|
1928
|
+
);
|
|
1929
|
+
return;
|
|
1930
|
+
}
|
|
1931
|
+
case "batch": {
|
|
1932
|
+
const raw = await readJsonFlag(args, "--ops");
|
|
1933
|
+
const ops = Array.isArray(raw) ? raw : raw?.ops;
|
|
1934
|
+
if (!Array.isArray(ops)) {
|
|
1935
|
+
throw usageError(
|
|
1936
|
+
'--ops must be a JSON array of writes, or {"ops": [...]}.'
|
|
1937
|
+
);
|
|
1938
|
+
}
|
|
1939
|
+
printJson(
|
|
1940
|
+
await apiCall(
|
|
1941
|
+
credentials,
|
|
1942
|
+
"POST /api/artifacts/{artifactId}/data/batch",
|
|
1943
|
+
// The server checks each write.
|
|
1944
|
+
{ params: { artifactId }, body: { ops }, headers }
|
|
1945
|
+
)
|
|
1946
|
+
);
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
case "export": {
|
|
1950
|
+
let exported;
|
|
1951
|
+
try {
|
|
1952
|
+
exported = await apiClient(credentials).send(
|
|
1953
|
+
"GET /api/artifacts/{artifactId}/data/export",
|
|
1954
|
+
{ params: { artifactId }, query: { asRole: command.asRole } }
|
|
1955
|
+
);
|
|
1956
|
+
} catch (error) {
|
|
1957
|
+
throw cliErrorOf(error);
|
|
1958
|
+
}
|
|
1959
|
+
const text = typeof exported.body === "string" ? exported.body : "";
|
|
1960
|
+
const output = parseFlagValue(args, "--output");
|
|
1961
|
+
if (output) {
|
|
1962
|
+
await writeFile(output, text);
|
|
1963
|
+
} else {
|
|
1964
|
+
process.stdout.write(text);
|
|
1965
|
+
}
|
|
1966
|
+
const count = text.split("\n").filter((line) => line.trim()).length;
|
|
1967
|
+
const left = exported.headers.get("artis-private-documents");
|
|
1968
|
+
console.error(
|
|
1969
|
+
`Exported ${count} document${count === 1 ? "" : "s"}${output ? ` to ${output}` : ""}${left === null ? "" : `; ${left} in private subtrees left out`}.`
|
|
1970
|
+
);
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
case "usage": {
|
|
1974
|
+
printJson(
|
|
1975
|
+
await apiCall(
|
|
1976
|
+
credentials,
|
|
1977
|
+
"GET /api/artifacts/{artifactId}/data/usage",
|
|
1978
|
+
{ params: { artifactId } }
|
|
1979
|
+
)
|
|
1980
|
+
);
|
|
1981
|
+
return;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
async function runArtisCli(args = process.argv.slice(2)) {
|
|
1986
|
+
const [command, ...rest] = args;
|
|
1987
|
+
if (command === "version" || command === "--version" || command === "-v") {
|
|
1988
|
+
console.log(`artis ${artisCliVersion}`);
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
if (!command || command === "help" || hasFlag(args, "--help")) {
|
|
1992
|
+
console.log(getCliHelp());
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1995
|
+
if (command === "install-skill") {
|
|
1996
|
+
await installSkillFromCli(rest);
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
if (command === "login") {
|
|
2000
|
+
await loginFromCli(rest);
|
|
2001
|
+
return;
|
|
2002
|
+
}
|
|
2003
|
+
if (command === "whoami") {
|
|
2004
|
+
await whoamiFromCli(rest);
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
if (command === "guidelines") {
|
|
2008
|
+
await guidelinesFromCli(rest);
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
if (command === "types") {
|
|
2012
|
+
await typesFromCli(rest);
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
if (command === "publish") {
|
|
2016
|
+
const published = await publishArtifactFromCli(rest);
|
|
2017
|
+
if (hasFlag(rest, "--json")) {
|
|
2018
|
+
console.log(JSON.stringify(published, null, 2));
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2021
|
+
console.log(`Published "${published.title}"`);
|
|
2022
|
+
console.log(`Artifact: ${published.artifactId}`);
|
|
2023
|
+
console.log(`Revision: ${published.revisionId}`);
|
|
2024
|
+
console.log(`Visibility: ${published.visibility}`);
|
|
2025
|
+
const publishedType = describeType(published);
|
|
2026
|
+
if (publishedType) {
|
|
2027
|
+
console.log(`Type: ${publishedType}`);
|
|
2028
|
+
}
|
|
2029
|
+
console.log(published.url);
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
if (command === "artifact" && rest[0] === "get") {
|
|
2033
|
+
await getArtifactFromCli(rest.slice(1));
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
if (command === "artifact" && rest[0] === "html") {
|
|
2037
|
+
await getArtifactHtmlFromCli(rest.slice(1));
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
if (command === "artifact" && rest[0] === "files") {
|
|
2041
|
+
await getArtifactFilesFromCli(rest.slice(1));
|
|
2042
|
+
return;
|
|
2043
|
+
}
|
|
2044
|
+
if (command === "verify") {
|
|
2045
|
+
await verifyFromCli(rest);
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
if (command === "artifact" && rest[0] === "list") {
|
|
2049
|
+
await listArtifactsFromCli(rest.slice(1));
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
2052
|
+
if (command === "artifact" && rest[0] === "visibility") {
|
|
2053
|
+
await setArtifactVisibilityFromCli(rest.slice(1));
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
if (command === "artifact" && rest[0] === "delete") {
|
|
2057
|
+
await deleteArtifactFromCli(rest.slice(1));
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
if (command === "artifact" && rest[0] === "feedback") {
|
|
2061
|
+
await getArtifactFeedbackFromCli(rest.slice(1));
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
if (command === "share") {
|
|
2065
|
+
await shareArtifactFromCli(rest);
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2068
|
+
if (command === "revise") {
|
|
2069
|
+
await reviseArtifactFromCli(rest);
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
if (command === "annotate") {
|
|
2073
|
+
await createAnnotationFromCli(rest);
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
if (command === "watch") {
|
|
2077
|
+
await watchArtifactFromCli(rest);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
if (command === "reply") {
|
|
2081
|
+
await replyFromCli(rest);
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
if (command === "annotation" && rest[0] === "edit") {
|
|
2085
|
+
await editAnnotationFromCli(rest.slice(1));
|
|
2086
|
+
return;
|
|
2087
|
+
}
|
|
2088
|
+
if (command === "annotation" && rest[0] === "retract") {
|
|
2089
|
+
await retractAnnotationFromCli(rest.slice(1));
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
if (command === "data") {
|
|
2093
|
+
await dataFromCli(rest);
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
throw usageError(`Unknown command "${args.join(" ")}". Run artis help.`);
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
export {
|
|
2100
|
+
commands,
|
|
2101
|
+
guidelinesFromCli,
|
|
2102
|
+
assertSafeLoginUrl,
|
|
2103
|
+
getCliHelp,
|
|
2104
|
+
publishArtifactFromCli,
|
|
2105
|
+
loginFromCli,
|
|
2106
|
+
typesFromCli,
|
|
2107
|
+
whoamiFromCli,
|
|
2108
|
+
getArtifactFromCli,
|
|
2109
|
+
getArtifactFilesFromCli,
|
|
2110
|
+
getArtifactHtmlFromCli,
|
|
2111
|
+
verifyFromCli,
|
|
2112
|
+
listArtifactsFromCli,
|
|
2113
|
+
getArtifactFeedbackFromCli,
|
|
2114
|
+
shareArtifactFromCli,
|
|
2115
|
+
setArtifactVisibilityFromCli,
|
|
2116
|
+
deleteArtifactFromCli,
|
|
2117
|
+
reviseArtifactFromCli,
|
|
2118
|
+
createAnnotationFromCli,
|
|
2119
|
+
replyFromCli,
|
|
2120
|
+
editAnnotationFromCli,
|
|
2121
|
+
retractAnnotationFromCli,
|
|
2122
|
+
watchArtifactFromCli,
|
|
2123
|
+
parseDataCommand,
|
|
2124
|
+
dataFromCli,
|
|
2125
|
+
runArtisCli
|
|
2126
|
+
};
|