artifacty 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli.js +35 -23
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -2,42 +2,24 @@
|
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import {
|
|
6
|
-
archiveArtifact,
|
|
7
|
-
checkStoreIntegrity,
|
|
8
|
-
createArtifact,
|
|
9
|
-
createStore,
|
|
10
|
-
getArtifact,
|
|
11
|
-
importUsersFromCsv,
|
|
12
|
-
listAuditEvents,
|
|
13
|
-
listArtifactsPage,
|
|
14
|
-
rebuildSearchIndex,
|
|
15
|
-
restoreArtifact,
|
|
16
|
-
updateArtifact
|
|
17
|
-
} from "./lib/storage.js";
|
|
18
|
-
import { exportStore, importStore, defaultBackupPath } from "./lib/backup.js";
|
|
19
|
-
import { convertAgentArtifact } from "./lib/converters.js";
|
|
20
|
-
import { checkMcpTools } from "./lib/check.js";
|
|
21
|
-
import { installAgent } from "./lib/installer.js";
|
|
22
|
-
import { serviceCommand } from "./lib/service.js";
|
|
23
|
-
import { backgroundStatus, startBackgroundServer, stopBackgroundServer } from "./lib/background.js";
|
|
24
|
-
import { resolvePublicBaseUrl } from "./lib/server-state.js";
|
|
25
5
|
import { generateToken } from "./lib/token.js";
|
|
26
|
-
import { runDoctor } from "./lib/doctor.js";
|
|
27
|
-
import { startServer } from "./server.js";
|
|
28
6
|
|
|
29
7
|
const PACKAGE_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
30
8
|
|
|
31
9
|
async function main() {
|
|
32
10
|
const [command, ...args] = process.argv.slice(2);
|
|
33
11
|
const options = parseArgs(args);
|
|
34
|
-
const store = createStore({ home: options.home });
|
|
35
12
|
|
|
36
13
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
37
14
|
printHelp();
|
|
38
15
|
return;
|
|
39
16
|
}
|
|
40
17
|
|
|
18
|
+
if (command === "version" || command === "--version" || command === "-v") {
|
|
19
|
+
process.stdout.write(`${await packageVersion()}\n`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
41
23
|
if (command === "token" || command === "generate-token") {
|
|
42
24
|
const token = generateToken(options);
|
|
43
25
|
if (options.raw) {
|
|
@@ -48,6 +30,29 @@ async function main() {
|
|
|
48
30
|
return;
|
|
49
31
|
}
|
|
50
32
|
|
|
33
|
+
const {
|
|
34
|
+
archiveArtifact,
|
|
35
|
+
checkStoreIntegrity,
|
|
36
|
+
createArtifact,
|
|
37
|
+
createStore,
|
|
38
|
+
getArtifact,
|
|
39
|
+
importUsersFromCsv,
|
|
40
|
+
listAuditEvents,
|
|
41
|
+
listArtifactsPage,
|
|
42
|
+
rebuildSearchIndex,
|
|
43
|
+
restoreArtifact,
|
|
44
|
+
updateArtifact
|
|
45
|
+
} = await import("./lib/storage.js");
|
|
46
|
+
const { exportStore, importStore, defaultBackupPath } = await import("./lib/backup.js");
|
|
47
|
+
const { convertAgentArtifact } = await import("./lib/converters.js");
|
|
48
|
+
const { checkMcpTools } = await import("./lib/check.js");
|
|
49
|
+
const { installAgent } = await import("./lib/installer.js");
|
|
50
|
+
const { serviceCommand } = await import("./lib/service.js");
|
|
51
|
+
const { backgroundStatus, startBackgroundServer, stopBackgroundServer } = await import("./lib/background.js");
|
|
52
|
+
const { runDoctor } = await import("./lib/doctor.js");
|
|
53
|
+
const { startServer } = await import("./server.js");
|
|
54
|
+
const store = createStore({ home: options.home });
|
|
55
|
+
|
|
51
56
|
if (command === "serve") {
|
|
52
57
|
if (options.detach && options.foreground) {
|
|
53
58
|
throw new Error("Use either --foreground or --detach, not both");
|
|
@@ -412,6 +417,7 @@ function shouldReadFileAsBase64(options, filePath) {
|
|
|
412
417
|
}
|
|
413
418
|
|
|
414
419
|
async function withUrls(store, artifact) {
|
|
420
|
+
const { resolvePublicBaseUrl } = await import("./lib/server-state.js");
|
|
415
421
|
const publicBaseUrl = await resolvePublicBaseUrl(store);
|
|
416
422
|
return {
|
|
417
423
|
...artifact,
|
|
@@ -442,10 +448,16 @@ function printJson(data) {
|
|
|
442
448
|
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
443
449
|
}
|
|
444
450
|
|
|
451
|
+
async function packageVersion() {
|
|
452
|
+
const packageJson = JSON.parse(await readFile(path.join(PACKAGE_ROOT, "package.json"), "utf8"));
|
|
453
|
+
return packageJson.version;
|
|
454
|
+
}
|
|
455
|
+
|
|
445
456
|
function printHelp() {
|
|
446
457
|
process.stdout.write(`Artifacty
|
|
447
458
|
|
|
448
459
|
Usage:
|
|
460
|
+
artifacty --version
|
|
449
461
|
artifacty token [--bytes 32] [--raw]
|
|
450
462
|
artifacty serve [--host 127.0.0.1] [--port 8787] [--home ~/.artifacty] [--api-token token] [--generate-token] [--bytes 32] [--mcp-http] [--foreground]
|
|
451
463
|
artifacty serve --foreground [--generate-token]
|