@artifactshare/cli 0.1.8 → 0.2.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 +16 -15
- package/dist/index.js +112 -120
- package/package.json +1 -2
- package/skills/artifactshare/SKILL.md +22 -21
- package/skills/artifactshare/artifactshare.mdc +8 -8
package/README.md
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
# Artifact Share CLI
|
|
2
2
|
|
|
3
|
-
The official CLI to
|
|
3
|
+
The official CLI to open, share, and update files, folders, and static sites on [Artifact Share](https://artifactshare.com) from terminals, AI agents, and automation. Share HTML, Markdown, and exported sites to stable URLs, update existing files, and emit `--json` for scripts and agents.
|
|
4
4
|
|
|
5
|
-
Artifact Share hosts AI-built reports, documents, and static sites so you can share them with teammates and clients. This CLI
|
|
5
|
+
Artifact Share hosts AI-built reports, documents, and static sites so you can share them with teammates and clients. This CLI shares a single file or a whole folder (HTML, Markdown, exported SPAs, images included), updates versions, opens shared URLs for agents, reads content and comments back, and works the same for humans, terminal agents (Claude Code, Codex, Cursor Agent), and automation.
|
|
6
6
|
|
|
7
7
|
## Quick start
|
|
8
8
|
|
|
9
9
|
Requires Node.js 22 or later.
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npx --yes @artifactshare/cli
|
|
12
|
+
npx --yes @artifactshare/cli share ./report.html
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
`--yes` lets agents and CI fetch the package without stopping for an npx install prompt.
|
|
16
16
|
|
|
17
|
-
On the first run in an interactive terminal, the CLI prints a sign-in link — open it in your browser, and the
|
|
17
|
+
On the first run in an interactive terminal, the CLI prints a sign-in link — open it in your browser, and the share completes and prints the share URL. Folders work too:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
npx --yes @artifactshare/cli
|
|
20
|
+
npx --yes @artifactshare/cli open <artifact-id-or-url> --json
|
|
21
|
+
npx --yes @artifactshare/cli share ./dist --project 'Weekly Reports'
|
|
21
22
|
npx --yes @artifactshare/cli projects create 'Client reports' --json
|
|
22
23
|
npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
|
|
23
24
|
npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
|
|
@@ -28,13 +29,13 @@ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
|
|
|
28
29
|
|
|
29
30
|
To keep an existing share URL, update it with
|
|
30
31
|
`npx --yes @artifactshare/cli update <artifact-id-or-url> <path>` instead of
|
|
31
|
-
|
|
32
|
-
`
|
|
32
|
+
sharing again. For CI, scheduled reports, or other repeat jobs, use
|
|
33
|
+
`share <path> --key <key>`: the first run creates the shared file, and later
|
|
33
34
|
runs add versions to the same file.
|
|
34
35
|
|
|
35
36
|
## Authentication
|
|
36
37
|
|
|
37
|
-
- **Interactive**: run `npx --yes @artifactshare/cli login`, or run `
|
|
38
|
+
- **Interactive**: run `npx --yes @artifactshare/cli login`, or run `share`, `update`, or `download` directly — those commands start sign-in for you when unauthenticated (the CLI prints a link and code to open in your browser).
|
|
38
39
|
- **CI / non-interactive**: issue a token at `https://artifactshare.com/settings/tokens`, then set `ARTIFACTSHARE_TOKEN` (or pass `--token`). Without a token, non-interactive runs fail with `error.code: "auth_required"` instead of hanging.
|
|
39
40
|
- Multiple accounts: keep one local profile per account (`profiles list` / `profiles use <name>`). In non-interactive agents, pipe an issued token into `profiles import-token --profile <name> --json` to create a saved profile without browser login.
|
|
40
41
|
|
|
@@ -42,18 +43,18 @@ runs add versions to the same file.
|
|
|
42
43
|
|
|
43
44
|
| Command | What it does |
|
|
44
45
|
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
45
|
-
| `
|
|
46
|
+
| `open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
|
|
47
|
+
| `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`) |
|
|
46
48
|
| `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
|
|
47
49
|
| `edit <target>` | Change title, sharing, explicit viewers, or project placement |
|
|
48
|
-
| `delete <target>` | Permanently delete a file you
|
|
50
|
+
| `delete <target>` | Permanently delete a file you shared |
|
|
49
51
|
| `resolve <value>` | Find files by URL, ID, title, or project name |
|
|
50
|
-
| `agent open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
|
|
51
52
|
| `artifacts get <target>` | Read a file's content and metadata back |
|
|
52
53
|
| `download <target>` | Save a file or a whole static site locally |
|
|
53
54
|
| `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
|
|
54
55
|
| `projects list / create / edit` | List, create, and edit project destinations and audience |
|
|
55
56
|
| `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
|
|
56
|
-
| `request-access` | Join the waitlist when
|
|
57
|
+
| `request-access` | Join the waitlist when sharing is not enabled yet |
|
|
57
58
|
| `login` / `whoami` | Sign in and check who you are |
|
|
58
59
|
| `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
|
|
59
60
|
| `profiles list / use / import-token` | Switch between local account profiles and import an issued token from stdin |
|
|
@@ -65,7 +66,7 @@ runs add versions to the same file.
|
|
|
65
66
|
When an agent receives an Artifact Share URL, start here:
|
|
66
67
|
|
|
67
68
|
```sh
|
|
68
|
-
npx --yes @artifactshare/cli
|
|
69
|
+
npx --yes @artifactshare/cli open <artifact-id-or-url> --json
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
This installs or updates the local skill first, then reads single-file artifacts. Static sites and multi-file artifacts return a `download` next command.
|
|
@@ -80,10 +81,10 @@ npx --yes @artifactshare/cli skills ensure --tool auto --scope project --json
|
|
|
80
81
|
|
|
81
82
|
Comment deletion is permanent. Use `comments delete <target> --thread-id <id> --message-id <id> --json` for one message, or omit `--message-id` only when deleting the whole thread.
|
|
82
83
|
|
|
83
|
-
All commands emit stable JSON when run non-interactively, piped, or with `--json`: success on stdout as `{ "schema_version":
|
|
84
|
+
All commands emit stable JSON when run non-interactively, piped, or with `--json`: success on stdout as `{ "schema_version": 2, "ok": true, "command": ..., "data": ... }`, failures on stderr as `{ "schema_version": 2, "ok": false, "command": ..., "error": ... }` with exit code 1. The `error` object carries a machine-readable `code`, a `hint`, and a structured `recovery` field (for example `{ "kind": "run_command", ... }`), so agents and scripts can branch and recover without parsing prose.
|
|
84
85
|
|
|
85
86
|
```sh
|
|
86
|
-
npx --yes @artifactshare/cli
|
|
87
|
+
npx --yes @artifactshare/cli share ./dist --json
|
|
87
88
|
```
|
|
88
89
|
|
|
89
90
|
Quote paths and free-form text before passing them through a shell. Artifact Share route files and user files can contain `$`, spaces, or glob characters, so prefer single quotes such as `'apps/web/app/routes/a.$id/index.tsx'` and `--body 'Looks good'`.
|
package/dist/index.js
CHANGED
|
@@ -68,13 +68,13 @@ const VALUE_FLAGS = new Set([
|
|
|
68
68
|
]);
|
|
69
69
|
const COMMAND_NAMES = new Set([
|
|
70
70
|
"login",
|
|
71
|
-
"
|
|
71
|
+
"share",
|
|
72
|
+
"open",
|
|
72
73
|
"update",
|
|
73
74
|
"edit",
|
|
74
75
|
"delete",
|
|
75
76
|
"resolve",
|
|
76
77
|
"download",
|
|
77
|
-
"agent",
|
|
78
78
|
"move",
|
|
79
79
|
"artifacts",
|
|
80
80
|
"comments",
|
|
@@ -87,7 +87,6 @@ const COMMAND_NAMES = new Set([
|
|
|
87
87
|
"init"
|
|
88
88
|
]);
|
|
89
89
|
const SUBCOMMANDS = {
|
|
90
|
-
agent: ["open"],
|
|
91
90
|
artifacts: ["list", "get"],
|
|
92
91
|
comments: [
|
|
93
92
|
"list",
|
|
@@ -158,9 +157,9 @@ function mapApiError(status, body, options = {}) {
|
|
|
158
157
|
}
|
|
159
158
|
if (apiCode === "upload-not-allowed") return cliError({
|
|
160
159
|
code: "upload_not_allowed",
|
|
161
|
-
message: "This account cannot
|
|
162
|
-
why: "Artifact Share is currently limiting who can
|
|
163
|
-
hint: `Run ${REQUEST_ACCESS_COMMAND$1} to join the early-access waitlist; an operator opens
|
|
160
|
+
message: "This account cannot share yet.",
|
|
161
|
+
why: "Artifact Share is currently limiting who can share.",
|
|
162
|
+
hint: `Run ${REQUEST_ACCESS_COMMAND$1} to join the early-access waitlist; an operator opens sharing afterwards.`,
|
|
164
163
|
agentRecoverable: false,
|
|
165
164
|
requiresHuman: true,
|
|
166
165
|
recovery: {
|
|
@@ -176,7 +175,7 @@ function mapApiError(status, body, options = {}) {
|
|
|
176
175
|
code: "upload_suspended",
|
|
177
176
|
message: apiMessage ?? "Your upload permission is suspended.",
|
|
178
177
|
why: "Artifact Share suspended upload access for this account.",
|
|
179
|
-
hint: "Ask an operator to restore upload access, then retry
|
|
178
|
+
hint: "Ask an operator to restore upload access, then retry share.",
|
|
180
179
|
agentRecoverable: false,
|
|
181
180
|
requiresHuman: true,
|
|
182
181
|
recovery: { kind: "ask_human" }
|
|
@@ -219,7 +218,7 @@ function mapApiError(status, body, options = {}) {
|
|
|
219
218
|
});
|
|
220
219
|
if (apiCode !== null && ["invalid-container"].includes(apiCode)) return cliError({
|
|
221
220
|
code: "project_not_found",
|
|
222
|
-
message: apiMessage ?? "The
|
|
221
|
+
message: apiMessage ?? "The share destination is invalid.",
|
|
223
222
|
why: "The project ID does not exist or is not available in this workspace.",
|
|
224
223
|
hint: "Retry with a valid --project-id or use --home.",
|
|
225
224
|
agentRecoverable: true,
|
|
@@ -333,7 +332,7 @@ function mapApiError(status, body, options = {}) {
|
|
|
333
332
|
code: "key_target_moved",
|
|
334
333
|
message: apiMessage ?? "The artifact for this key moved.",
|
|
335
334
|
why: "The artifact this key points to now lives in a different destination, so the key no longer updates it.",
|
|
336
|
-
hint: "Find the artifact with resolve --json, then update it by ID or
|
|
335
|
+
hint: "Find the artifact with resolve --json, then update it by ID or share with a new key.",
|
|
337
336
|
agentRecoverable: true,
|
|
338
337
|
requiresHuman: false,
|
|
339
338
|
recovery: { kind: "change_input" }
|
|
@@ -342,16 +341,16 @@ function mapApiError(status, body, options = {}) {
|
|
|
342
341
|
code: "key_kind_mismatch",
|
|
343
342
|
message: apiMessage ?? "The artifact for this key is a different kind.",
|
|
344
343
|
why: "The key points to an artifact whose kind (single file or static site) does not match this input.",
|
|
345
|
-
hint: "Check the existing artifact by ID, or
|
|
344
|
+
hint: "Check the existing artifact by ID, or share with a new key.",
|
|
346
345
|
agentRecoverable: true,
|
|
347
346
|
requiresHuman: false,
|
|
348
347
|
recovery: { kind: "change_input" }
|
|
349
348
|
});
|
|
350
349
|
if (apiCode === "key-conflict") return cliError({
|
|
351
350
|
code: "key_conflict",
|
|
352
|
-
message: apiMessage ?? "Another
|
|
353
|
-
why: "Two
|
|
354
|
-
hint: "Retry the same command; it will update the artifact the other
|
|
351
|
+
message: apiMessage ?? "Another share created this key first.",
|
|
352
|
+
why: "Two share commands raced to create the same key, and the other one won.",
|
|
353
|
+
hint: "Retry the same command; it will update the artifact the other share created.",
|
|
355
354
|
agentRecoverable: true,
|
|
356
355
|
requiresHuman: false,
|
|
357
356
|
recovery: { kind: "retry_later" }
|
|
@@ -411,7 +410,7 @@ function mapApiError(status, body, options = {}) {
|
|
|
411
410
|
].includes(apiCode)) return cliError({
|
|
412
411
|
code: "validation_failed",
|
|
413
412
|
message: apiMessage ?? "The upload input is invalid.",
|
|
414
|
-
why: "The file, directory, or
|
|
413
|
+
why: "The file, directory, or share options failed server-side validation.",
|
|
415
414
|
hint: "Check the path, file types, and visibility options, then retry.",
|
|
416
415
|
agentRecoverable: true,
|
|
417
416
|
requiresHuman: false,
|
|
@@ -644,14 +643,14 @@ function normalizeApiCode(value) {
|
|
|
644
643
|
return typeof value === "string" ? value : null;
|
|
645
644
|
}
|
|
646
645
|
function uploadBlockedHint(code) {
|
|
647
|
-
if (code === "upload-not-allowed") return `Run ${REQUEST_ACCESS_COMMAND$1} to join the waitlist, then retry
|
|
646
|
+
if (code === "upload-not-allowed") return `Run ${REQUEST_ACCESS_COMMAND$1} to join the waitlist, then retry share once an operator opens sharing.`;
|
|
648
647
|
if (code === "upload-policy-unavailable") return "Retry doctor later; upload permission could not be checked.";
|
|
649
|
-
return "Resolve the upload issue, then retry
|
|
648
|
+
return "Resolve the upload issue, then retry share.";
|
|
650
649
|
}
|
|
651
650
|
function projectNotFoundByNameError() {
|
|
652
651
|
return cliError({
|
|
653
652
|
code: "project_not_found",
|
|
654
|
-
message: "The
|
|
653
|
+
message: "The share destination project was not found.",
|
|
655
654
|
why: "No project in the current workspace matches the given project name exactly.",
|
|
656
655
|
hint: `Run ${PROJECTS_LIST_COMMAND}, then retry with --project-id <id>.`,
|
|
657
656
|
agentRecoverable: true,
|
|
@@ -665,7 +664,7 @@ function projectNotFoundByNameError() {
|
|
|
665
664
|
function projectAmbiguousError(candidates) {
|
|
666
665
|
return cliError({
|
|
667
666
|
code: "project_ambiguous",
|
|
668
|
-
message: "The
|
|
667
|
+
message: "The share destination project is ambiguous.",
|
|
669
668
|
why: "Multiple projects in the current workspace match the given project name exactly.",
|
|
670
669
|
hint: "Retry with --project-id <id> from the candidates.",
|
|
671
670
|
agentRecoverable: true,
|
|
@@ -764,9 +763,9 @@ function resolveArtifactId(input) {
|
|
|
764
763
|
}
|
|
765
764
|
const TARGET_COMMAND_LABELS = {
|
|
766
765
|
update: "Update",
|
|
766
|
+
open: "Open",
|
|
767
767
|
"artifacts get": "Artifacts get",
|
|
768
768
|
download: "Download",
|
|
769
|
-
"agent open": "Agent open",
|
|
770
769
|
"comments list": "Comments list",
|
|
771
770
|
"comments post": "Comments post",
|
|
772
771
|
"comments edit": "Comments edit",
|
|
@@ -863,14 +862,14 @@ function validateRawArgs(argv, command) {
|
|
|
863
862
|
const eqIndex = arg.indexOf("=");
|
|
864
863
|
if (eqIndex === -1) {
|
|
865
864
|
const rawName = arg.slice(2);
|
|
866
|
-
const artifactIdError =
|
|
865
|
+
const artifactIdError = unsupportedShareArtifactId(rawName, command);
|
|
867
866
|
if (artifactIdError) return artifactIdError;
|
|
868
867
|
const next = argv[i + 1];
|
|
869
868
|
if (VALUE_FLAGS.has(rawName) && (next === void 0 || isKnownFlagToken(next) || next === "" && !allowsEmptyValue(rawName))) return validationError(`--${rawName} requires a value.`, `Pass --${rawName} <value> and retry.`);
|
|
870
869
|
continue;
|
|
871
870
|
}
|
|
872
871
|
const rawName = arg.slice(2, eqIndex);
|
|
873
|
-
const artifactIdError =
|
|
872
|
+
const artifactIdError = unsupportedShareArtifactId(rawName, command);
|
|
874
873
|
if (artifactIdError) return artifactIdError;
|
|
875
874
|
const value = arg.slice(eqIndex + 1);
|
|
876
875
|
if (BOOLEAN_FLAGS.has(rawName)) return validationError(`--${rawName} does not accept a value.`, `Use --${rawName} without =value.`);
|
|
@@ -878,9 +877,9 @@ function validateRawArgs(argv, command) {
|
|
|
878
877
|
}
|
|
879
878
|
return null;
|
|
880
879
|
}
|
|
881
|
-
function
|
|
882
|
-
if (command !== "
|
|
883
|
-
return validationError("
|
|
880
|
+
function unsupportedShareArtifactId(rawName, command) {
|
|
881
|
+
if (command !== "share" || rawName !== "artifact-id" && rawName !== "artifactId") return null;
|
|
882
|
+
return validationError("Share does not accept --artifact-id.", `To keep an existing share URL, run ${CLI_INVOCATION} update <artifact-id-or-url> <path> --json. For repeat jobs, use share --key <key>.`);
|
|
884
883
|
}
|
|
885
884
|
function allowsEmptyValue(rawName) {
|
|
886
885
|
return rawName === "title" || rawName === "description";
|
|
@@ -965,9 +964,9 @@ function outputMode(options) {
|
|
|
965
964
|
return { json: Boolean(options.json) || process.env.CI === "true" || !process.stdout.isTTY };
|
|
966
965
|
}
|
|
967
966
|
function writeSuccess(command, data, mode) {
|
|
968
|
-
if (!mode.json && command === "
|
|
967
|
+
if (!mode.json && command === "share" && !shareSuccessFields(data)) return writeFailure(command, serviceError("Share succeeded but the response did not include an artifact id and URL."), mode, 1);
|
|
969
968
|
const payload = {
|
|
970
|
-
schema_version:
|
|
969
|
+
schema_version: 2,
|
|
971
970
|
ok: true,
|
|
972
971
|
command,
|
|
973
972
|
data
|
|
@@ -980,7 +979,7 @@ function writeSuccess(command, data, mode) {
|
|
|
980
979
|
}
|
|
981
980
|
function writeFailure(command, error, mode, exitCode) {
|
|
982
981
|
const payload = {
|
|
983
|
-
schema_version:
|
|
982
|
+
schema_version: 2,
|
|
984
983
|
ok: false,
|
|
985
984
|
command,
|
|
986
985
|
error
|
|
@@ -996,11 +995,11 @@ function writeEvent(data) {
|
|
|
996
995
|
process.stderr.write(`${JSON.stringify(data)}\n`);
|
|
997
996
|
}
|
|
998
997
|
function humanSuccess(command, data) {
|
|
999
|
-
if (command === "
|
|
1000
|
-
const fields =
|
|
998
|
+
if (command === "share") {
|
|
999
|
+
const fields = shareSuccessFields(data);
|
|
1001
1000
|
if (!fields) return `${JSON.stringify(data, null, 2)}\n`;
|
|
1002
1001
|
return [
|
|
1003
|
-
"
|
|
1002
|
+
"Shared",
|
|
1004
1003
|
`Artifact ID: ${fields.artifactId}`,
|
|
1005
1004
|
`URL: ${fields.url}`,
|
|
1006
1005
|
`Destination: ${fields.destinationType}${fields.projectId ? ` (${fields.projectId})` : ""}`,
|
|
@@ -1009,20 +1008,20 @@ function humanSuccess(command, data) {
|
|
|
1009
1008
|
].join("\n");
|
|
1010
1009
|
}
|
|
1011
1010
|
if (command === "doctor") return doctorHumanOutput(data);
|
|
1012
|
-
if (command === "
|
|
1011
|
+
if (command === "open") return openHumanOutput(data);
|
|
1013
1012
|
return `${JSON.stringify(data, null, 2)}\n`;
|
|
1014
1013
|
}
|
|
1015
|
-
function
|
|
1014
|
+
function openHumanOutput(data) {
|
|
1016
1015
|
const body = `${JSON.stringify(data, null, 2)}`;
|
|
1017
|
-
const nextCommand =
|
|
1016
|
+
const nextCommand = openNextCommand(data);
|
|
1018
1017
|
if (!nextCommand) return `${body}\n`;
|
|
1019
1018
|
return `${body}\nNext command: ${nextCommand}\n`;
|
|
1020
1019
|
}
|
|
1021
|
-
function
|
|
1022
|
-
if (!
|
|
1020
|
+
function openNextCommand(data) {
|
|
1021
|
+
if (!isOpenData(data)) return null;
|
|
1023
1022
|
return data.open.kind === "download_required" ? data.open.next_command : null;
|
|
1024
1023
|
}
|
|
1025
|
-
function
|
|
1024
|
+
function isOpenData(data) {
|
|
1026
1025
|
if (!isRecord(data)) return false;
|
|
1027
1026
|
const open = data.open;
|
|
1028
1027
|
if (!isRecord(open)) return false;
|
|
@@ -1039,7 +1038,7 @@ function doctorNextCommand(data) {
|
|
|
1039
1038
|
if (!isRecord(data) || !("next_command" in data)) return null;
|
|
1040
1039
|
return typeof data.next_command === "string" ? data.next_command : null;
|
|
1041
1040
|
}
|
|
1042
|
-
function
|
|
1041
|
+
function shareSuccessFields(data) {
|
|
1043
1042
|
if (!isRecord(data)) return null;
|
|
1044
1043
|
const artifact = data.artifact;
|
|
1045
1044
|
const destination = data.destination;
|
|
@@ -1220,8 +1219,8 @@ function resolveDestination(options, config) {
|
|
|
1220
1219
|
if (containerId) return { containerId };
|
|
1221
1220
|
return { error: cliError({
|
|
1222
1221
|
code: "destination_required",
|
|
1223
|
-
message: "A
|
|
1224
|
-
why: "Non-interactive
|
|
1222
|
+
message: "A share destination is required.",
|
|
1223
|
+
why: "Non-interactive share never guesses a project or home destination.",
|
|
1225
1224
|
hint: "Retry with --project-id <id>, configure .artifactshare/config.local.json, or pass --home.",
|
|
1226
1225
|
agentRecoverable: true,
|
|
1227
1226
|
requiresHuman: false,
|
|
@@ -1933,7 +1932,7 @@ function whoamiProfile(body) {
|
|
|
1933
1932
|
//#endregion
|
|
1934
1933
|
//#region src/command-runners/auto-login.ts
|
|
1935
1934
|
const JSON_PENDING_AUTH_COMMANDS = new Set([
|
|
1936
|
-
"
|
|
1935
|
+
"share",
|
|
1937
1936
|
"update",
|
|
1938
1937
|
"download",
|
|
1939
1938
|
"artifacts get"
|
|
@@ -2437,9 +2436,9 @@ async function runSkillsRemove(parsed, mode) {
|
|
|
2437
2436
|
await runActions(command, planned, parsed.options.dryRun === true, mode);
|
|
2438
2437
|
}
|
|
2439
2438
|
//#endregion
|
|
2440
|
-
//#region src/command-runners/
|
|
2441
|
-
async function
|
|
2442
|
-
const command = "
|
|
2439
|
+
//#region src/command-runners/open.ts
|
|
2440
|
+
async function runOpen(parsed, mode) {
|
|
2441
|
+
const command = "open";
|
|
2443
2442
|
const skills = await ensureSkills({
|
|
2444
2443
|
...parsed,
|
|
2445
2444
|
options: {
|
|
@@ -2833,7 +2832,7 @@ async function prepareUploadPayload(targetPath, fileStat, initialForm = new Form
|
|
|
2833
2832
|
if (error instanceof CollectDirectoryFilesError) return { error: validationError(error.message, error.hint) };
|
|
2834
2833
|
throw error;
|
|
2835
2834
|
}
|
|
2836
|
-
if (files.length === 0) return { error: validationError("Directory has no
|
|
2835
|
+
if (files.length === 0) return { error: validationError("Directory has no shareable files.", "Add index.html or index.md and retry.") };
|
|
2837
2836
|
for (const file of files) initialForm.append("file", await blobFor(file.path), file.relativePath);
|
|
2838
2837
|
return { payload: {
|
|
2839
2838
|
form: initialForm,
|
|
@@ -2942,7 +2941,7 @@ async function collectDirectoryFiles(root) {
|
|
|
2942
2941
|
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
2943
2942
|
if (entry.name === "__MACOSX") continue;
|
|
2944
2943
|
const fullPath = join(dir, entry.name);
|
|
2945
|
-
if (entry.isSymbolicLink()) throw new CollectDirectoryFilesError("Directory contains a symbolic link.", "Remove or replace symlinked files and directories before
|
|
2944
|
+
if (entry.isSymbolicLink()) throw new CollectDirectoryFilesError("Directory contains a symbolic link.", "Remove or replace symlinked files and directories before sharing.");
|
|
2946
2945
|
if (entry.isDirectory()) {
|
|
2947
2946
|
if (EXCLUDED_DIR_NAMES.has(entry.name) || entry.name.startsWith(".")) continue;
|
|
2948
2947
|
await visit(fullPath);
|
|
@@ -3455,7 +3454,7 @@ async function runProjectsList(parsed, mode) {
|
|
|
3455
3454
|
default_project_id: defaultProjectId,
|
|
3456
3455
|
projects
|
|
3457
3456
|
}, mode);
|
|
3458
|
-
if (!mode.json && projects.length === 0) writeText("No projects yet. Create one on the web, then
|
|
3457
|
+
if (!mode.json && projects.length === 0) writeText("No projects yet. Create one on the web, then share with --project-id.\n");
|
|
3459
3458
|
}
|
|
3460
3459
|
async function runProjectsCreate(parsed, mode) {
|
|
3461
3460
|
const command = "projects create";
|
|
@@ -3487,7 +3486,7 @@ async function runProjectsCreate(parsed, mode) {
|
|
|
3487
3486
|
description: configString(project?.description),
|
|
3488
3487
|
base_visibility: configString(project?.base_visibility)
|
|
3489
3488
|
},
|
|
3490
|
-
next_command: `npx --yes @artifactshare/cli
|
|
3489
|
+
next_command: `npx --yes @artifactshare/cli share <path> --project-id ${id} --json`
|
|
3491
3490
|
}, mode);
|
|
3492
3491
|
}
|
|
3493
3492
|
async function runProjectsEdit(parsed, mode) {
|
|
@@ -3576,20 +3575,20 @@ function parseProjectsEditData(body) {
|
|
|
3576
3575
|
};
|
|
3577
3576
|
}
|
|
3578
3577
|
//#endregion
|
|
3579
|
-
//#region src/command-runners/
|
|
3580
|
-
const
|
|
3581
|
-
async function
|
|
3582
|
-
const command = "
|
|
3578
|
+
//#region src/command-runners/share.ts
|
|
3579
|
+
const MAX_SHARE_KEY_LENGTH = 128;
|
|
3580
|
+
async function runShare(parsed, mode, isRetry = false) {
|
|
3581
|
+
const command = "share";
|
|
3583
3582
|
const targetPath = parsed.positionals[0];
|
|
3584
|
-
if (!targetPath) return writeFailure(command, validationError("Path is required.", "Pass a file or directory to
|
|
3585
|
-
let
|
|
3583
|
+
if (!targetPath) return writeFailure(command, validationError("Path is required.", "Pass a file or directory to share."), mode, 1);
|
|
3584
|
+
let shareKey = null;
|
|
3586
3585
|
if ("key" in parsed.options) {
|
|
3587
|
-
|
|
3588
|
-
if (
|
|
3586
|
+
shareKey = (typeof parsed.options.key === "string" ? parsed.options.key : "").trim();
|
|
3587
|
+
if (shareKey.length === 0 || shareKey.length > MAX_SHARE_KEY_LENGTH) return writeFailure(command, validationError(`--key must be 1-${MAX_SHARE_KEY_LENGTH} characters after trimming.`, "Pass a short stable identifier, like a job name or PR number."), mode, 1);
|
|
3589
3588
|
}
|
|
3590
3589
|
const project = await resolveProjectConfig();
|
|
3591
3590
|
const credential = await resolveCredential(parsed.options, project);
|
|
3592
|
-
if (!credential.ok) return handleCredentialFailure(command, credential, parsed.options, mode, () =>
|
|
3591
|
+
if (!credential.ok) return handleCredentialFailure(command, credential, parsed.options, mode, () => runShare(parsed, mode, true), isRetry);
|
|
3593
3592
|
const baseUrl = baseUrlOf(parsed.options);
|
|
3594
3593
|
const hasProjectFlag = "project" in parsed.options;
|
|
3595
3594
|
let destinationOptions = parsed.options;
|
|
@@ -3614,7 +3613,7 @@ async function runPublish(parsed, mode, isRetry = false) {
|
|
|
3614
3613
|
credentialSource: credential.source,
|
|
3615
3614
|
profile: credential.profile
|
|
3616
3615
|
});
|
|
3617
|
-
if (resolved.error) return handleAuthenticatedCredentialFailure(command, resolved.error, credential, parsed.options, mode, () =>
|
|
3616
|
+
if (resolved.error) return handleAuthenticatedCredentialFailure(command, resolved.error, credential, parsed.options, mode, () => runShare(parsed, mode, true), isRetry);
|
|
3618
3617
|
const { project: _project, ...rest } = parsed.options;
|
|
3619
3618
|
destinationOptions = {
|
|
3620
3619
|
...rest,
|
|
@@ -3630,7 +3629,7 @@ async function runPublish(parsed, mode, isRetry = false) {
|
|
|
3630
3629
|
for (const email of grantEmails) initialForm.append("grant_email", email);
|
|
3631
3630
|
if (destination.containerId) initialForm.set("container_id", destination.containerId);
|
|
3632
3631
|
const uploadUrl = apiUrl("/api/shareables/uploads", baseUrl);
|
|
3633
|
-
if (
|
|
3632
|
+
if (shareKey !== null) uploadUrl.searchParams.set("publish_key", shareKey);
|
|
3634
3633
|
const upload = await prepareUploadPayload(targetPath, fileStat, initialForm);
|
|
3635
3634
|
if (upload.error) return writeFailure(command, upload.error, mode, 1);
|
|
3636
3635
|
if (upload.payload.kind === "static_site") {
|
|
@@ -3650,7 +3649,7 @@ async function runPublish(parsed, mode, isRetry = false) {
|
|
|
3650
3649
|
baseUrl,
|
|
3651
3650
|
credentialSource: credential.source,
|
|
3652
3651
|
profile: credential.profile
|
|
3653
|
-
}), credential, parsed.options, mode, () =>
|
|
3652
|
+
}), credential, parsed.options, mode, () => runShare(parsed, mode, true), isRetry);
|
|
3654
3653
|
const id = body?.id ?? null;
|
|
3655
3654
|
return writeSuccess(command, {
|
|
3656
3655
|
artifact: {
|
|
@@ -3660,7 +3659,7 @@ async function runPublish(parsed, mode, isRetry = false) {
|
|
|
3660
3659
|
},
|
|
3661
3660
|
version: { id: body?.versionId ?? null },
|
|
3662
3661
|
result: { created: body?.created ?? true },
|
|
3663
|
-
...
|
|
3662
|
+
...shareKey !== null ? { key: shareKey } : {},
|
|
3664
3663
|
destination: destination.containerId ? {
|
|
3665
3664
|
type: "project",
|
|
3666
3665
|
project_id: destination.containerId
|
|
@@ -3812,9 +3811,9 @@ async function runWhoami(parsed, mode) {
|
|
|
3812
3811
|
}
|
|
3813
3812
|
//#endregion
|
|
3814
3813
|
//#region src/commands.ts
|
|
3815
|
-
async function
|
|
3816
|
-
const parsed = parsedArgsFromContext("
|
|
3817
|
-
return await
|
|
3814
|
+
async function shareRunner(ctx) {
|
|
3815
|
+
const parsed = parsedArgsFromContext("share", ctx);
|
|
3816
|
+
return await runShare(parsed, outputMode(parsed.options));
|
|
3818
3817
|
}
|
|
3819
3818
|
async function loginRunner(ctx) {
|
|
3820
3819
|
const parsed = parsedArgsFromContext("login", ctx);
|
|
@@ -3840,9 +3839,9 @@ async function downloadRunner(ctx) {
|
|
|
3840
3839
|
const parsed = parsedArgsFromContext("download", ctx);
|
|
3841
3840
|
return await runDownload(parsed, outputMode(parsed.options));
|
|
3842
3841
|
}
|
|
3843
|
-
async function
|
|
3844
|
-
const parsed = parsedArgsFromContext("
|
|
3845
|
-
return await
|
|
3842
|
+
async function openRunner(ctx) {
|
|
3843
|
+
const parsed = parsedArgsFromContext("open", ctx);
|
|
3844
|
+
return await runOpen(parsed, outputMode(parsed.options));
|
|
3846
3845
|
}
|
|
3847
3846
|
async function moveRunner(ctx) {
|
|
3848
3847
|
const parsed = parsedArgsFromContext("move", ctx);
|
|
@@ -3988,13 +3987,13 @@ async function runGunshi(argv) {
|
|
|
3988
3987
|
version: await loadCliVersion(),
|
|
3989
3988
|
subCommands: {
|
|
3990
3989
|
login: lazyCommand(loginDefinition, loginRunner),
|
|
3991
|
-
|
|
3990
|
+
share: lazyCommand(shareDefinition, shareRunner),
|
|
3991
|
+
open: lazyCommand(openDefinition, openRunner),
|
|
3992
3992
|
update: lazyCommand(updateDefinition, updateRunner),
|
|
3993
3993
|
edit: lazyCommand(editDefinition, editRunner),
|
|
3994
3994
|
delete: lazyCommand(deleteDefinition, deleteRunner),
|
|
3995
3995
|
resolve: lazyCommand(resolveDefinition, resolveRunner),
|
|
3996
3996
|
download: lazyCommand(downloadDefinition, downloadRunner),
|
|
3997
|
-
agent: agentDefinition,
|
|
3998
3997
|
move: lazyCommand(moveDefinition, moveRunner),
|
|
3999
3998
|
artifacts: artifactsDefinition,
|
|
4000
3999
|
comments: commentsDefinition,
|
|
@@ -4051,7 +4050,8 @@ const entryCommand = define({
|
|
|
4051
4050
|
description: "Artifact Share CLI",
|
|
4052
4051
|
toKebab: true,
|
|
4053
4052
|
args: commonArgs,
|
|
4054
|
-
examples: `npx --yes @artifactshare/cli
|
|
4053
|
+
examples: `npx --yes @artifactshare/cli open <artifact-id-or-url> --json
|
|
4054
|
+
npx --yes @artifactshare/cli share <path> --json
|
|
4055
4055
|
npx --yes @artifactshare/cli update <artifact-id-or-url> <path> --json
|
|
4056
4056
|
npx --yes @artifactshare/cli edit <artifact-id-or-url> --title "New title" --json
|
|
4057
4057
|
npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
|
|
@@ -4071,7 +4071,7 @@ npx --yes @artifactshare/cli projects list --json
|
|
|
4071
4071
|
npx --yes @artifactshare/cli skills install --tool codex --json
|
|
4072
4072
|
npx --yes @artifactshare/cli skills list --json
|
|
4073
4073
|
npx --yes @artifactshare/cli init --profile <name> --project-id <id> --json
|
|
4074
|
-
npx --yes @artifactshare/cli
|
|
4074
|
+
npx --yes @artifactshare/cli share <path> --home --json
|
|
4075
4075
|
npx --yes @artifactshare/cli request-access --json
|
|
4076
4076
|
npx --yes @artifactshare/cli whoami --json
|
|
4077
4077
|
npx --yes @artifactshare/cli doctor --json
|
|
@@ -4104,30 +4104,30 @@ Common failures:
|
|
|
4104
4104
|
auth_expired The device code expired before approval
|
|
4105
4105
|
token_store_unavailable Configure an OS credential store or use the explicit plaintext fallback`
|
|
4106
4106
|
});
|
|
4107
|
-
const
|
|
4108
|
-
name: "
|
|
4109
|
-
description: "
|
|
4107
|
+
const shareDefinition = define({
|
|
4108
|
+
name: "share",
|
|
4109
|
+
description: "Share a file or directory.",
|
|
4110
4110
|
toKebab: true,
|
|
4111
4111
|
args: {
|
|
4112
4112
|
...commonArgs,
|
|
4113
4113
|
path: {
|
|
4114
4114
|
type: "positional",
|
|
4115
|
-
description: "File or directory to
|
|
4115
|
+
description: "File or directory to share"
|
|
4116
4116
|
},
|
|
4117
4117
|
projectId: {
|
|
4118
4118
|
type: "string",
|
|
4119
4119
|
toKebab: true,
|
|
4120
|
-
description: "
|
|
4120
|
+
description: "Share into a project"
|
|
4121
4121
|
},
|
|
4122
4122
|
project: {
|
|
4123
4123
|
type: "string",
|
|
4124
4124
|
toKebab: true,
|
|
4125
|
-
description: "
|
|
4125
|
+
description: "Share into a project by exact name"
|
|
4126
4126
|
},
|
|
4127
4127
|
home: {
|
|
4128
4128
|
type: "boolean",
|
|
4129
4129
|
toKebab: true,
|
|
4130
|
-
description: "
|
|
4130
|
+
description: "Share to home instead of a project"
|
|
4131
4131
|
},
|
|
4132
4132
|
visibility: {
|
|
4133
4133
|
type: "string",
|
|
@@ -4143,21 +4143,21 @@ const publishDefinition = define({
|
|
|
4143
4143
|
key: {
|
|
4144
4144
|
type: "string",
|
|
4145
4145
|
toKebab: true,
|
|
4146
|
-
description: "Stable key for create-or-update: the first
|
|
4146
|
+
description: "Stable key for create-or-update: the first share creates the artifact, repeats add versions. Not a secret; it appears in logs and JSON"
|
|
4147
4147
|
}
|
|
4148
4148
|
},
|
|
4149
|
-
examples: `npx --yes @artifactshare/cli
|
|
4150
|
-
npx --yes @artifactshare/cli
|
|
4149
|
+
examples: `npx --yes @artifactshare/cli share report.html --project-id <id> --json
|
|
4150
|
+
npx --yes @artifactshare/cli share report.html --project-id <id> --key nightly-report --json
|
|
4151
4151
|
|
|
4152
4152
|
To keep an existing share URL, use update:
|
|
4153
4153
|
npx --yes @artifactshare/cli update <artifact-id-or-url> <path> --json
|
|
4154
4154
|
|
|
4155
|
-
For repeat jobs, use --key: first
|
|
4155
|
+
For repeat jobs, use --key: first share creates the artifact, later runs add versions.
|
|
4156
4156
|
|
|
4157
4157
|
Common failures:
|
|
4158
|
-
auth_required Set ARTIFACTSHARE_TOKEN before
|
|
4159
|
-
destination_required Non-interactive
|
|
4160
|
-
upload_not_allowed Your account cannot
|
|
4158
|
+
auth_required Set ARTIFACTSHARE_TOKEN before share
|
|
4159
|
+
destination_required Non-interactive share needs --project-id, config default, or --home
|
|
4160
|
+
upload_not_allowed Your account cannot share yet; request access from an operator
|
|
4161
4161
|
file_too_large Reduce file or directory size and retry
|
|
4162
4162
|
validation_failed Check file type (.html / .md for single files) and directory layout
|
|
4163
4163
|
key_target_moved The artifact for --key moved; update it by ID or use a new key
|
|
@@ -4187,7 +4187,7 @@ Common failures:
|
|
|
4187
4187
|
auth_required Set ARTIFACTSHARE_TOKEN before update
|
|
4188
4188
|
target_not_found Retry with an artifact ID, share URL, or sandbox URL
|
|
4189
4189
|
artifact_kind_mismatch Use a file for single-file artifacts or a directory for static sites
|
|
4190
|
-
upload_not_allowed Your account cannot
|
|
4190
|
+
upload_not_allowed Your account cannot share yet; request access from an operator
|
|
4191
4191
|
file_too_large Reduce file or directory size and retry
|
|
4192
4192
|
validation_failed Check file type (.html / .md for single files) and directory layout`
|
|
4193
4193
|
});
|
|
@@ -4241,7 +4241,7 @@ const editDefinition = define({
|
|
|
4241
4241
|
npx --yes @artifactshare/cli edit abc123def4 --home --json
|
|
4242
4242
|
|
|
4243
4243
|
Edit changes artifact settings without adding a new version. Use update to replace content.
|
|
4244
|
-
Move remains available for placement-only automation; edit is the main command for post-
|
|
4244
|
+
Move remains available for placement-only automation; edit is the main command for post-share settings.
|
|
4245
4245
|
|
|
4246
4246
|
Common failures:
|
|
4247
4247
|
auth_required Set ARTIFACTSHARE_TOKEN before edit
|
|
@@ -4253,7 +4253,7 @@ Common failures:
|
|
|
4253
4253
|
});
|
|
4254
4254
|
const deleteDefinition = define({
|
|
4255
4255
|
name: "delete",
|
|
4256
|
-
description: "Permanently delete an artifact you
|
|
4256
|
+
description: "Permanently delete an artifact you shared.",
|
|
4257
4257
|
toKebab: true,
|
|
4258
4258
|
args: {
|
|
4259
4259
|
...commonArgs,
|
|
@@ -4330,38 +4330,30 @@ Common failures:
|
|
|
4330
4330
|
output_exists Choose another --output path or pass --force
|
|
4331
4331
|
validation_failed Check --output and downloaded file paths`
|
|
4332
4332
|
});
|
|
4333
|
-
const
|
|
4334
|
-
name: "
|
|
4335
|
-
description: "
|
|
4333
|
+
const openDefinition = define({
|
|
4334
|
+
name: "open",
|
|
4335
|
+
description: "Prepare agent skills and read an Artifact Share URL.",
|
|
4336
4336
|
toKebab: true,
|
|
4337
|
-
args:
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
|
|
4348
|
-
}
|
|
4349
|
-
},
|
|
4350
|
-
examples: `npx --yes @artifactshare/cli agent open https://artifactshare.com/a/abc123def4 --json
|
|
4351
|
-
npx --yes @artifactshare/cli agent open abc123def4 --json
|
|
4337
|
+
args: {
|
|
4338
|
+
...commonArgs,
|
|
4339
|
+
artifactIdOrUrl: {
|
|
4340
|
+
type: "positional",
|
|
4341
|
+
toKebab: true,
|
|
4342
|
+
description: "Artifact ID, /a/<id> share URL, or <id>.sandbox.* URL"
|
|
4343
|
+
}
|
|
4344
|
+
},
|
|
4345
|
+
examples: `npx --yes @artifactshare/cli open https://artifactshare.com/a/abc123def4 --json
|
|
4346
|
+
npx --yes @artifactshare/cli open abc123def4 --json
|
|
4352
4347
|
|
|
4353
4348
|
Use this as the first command when an agent receives an Artifact Share URL.
|
|
4354
4349
|
It installs or updates the local Artifact Share skill, then reads single-file artifacts.
|
|
4355
4350
|
For static sites or multi-file artifacts, the JSON includes a download next_command.
|
|
4356
4351
|
|
|
4357
4352
|
Common failures:
|
|
4358
|
-
auth_required Set ARTIFACTSHARE_TOKEN before
|
|
4353
|
+
auth_required Set ARTIFACTSHARE_TOKEN before open
|
|
4359
4354
|
skill_update_conflict Inspect the file or run skills install --tool <tool> --force
|
|
4360
4355
|
target_not_found Retry with an artifact ID, share URL, or sandbox URL
|
|
4361
4356
|
validation_failed Pass a non-empty artifact ID or URL`
|
|
4362
|
-
}), agentOpenRunner) },
|
|
4363
|
-
examples: `npx --yes @artifactshare/cli agent open https://artifactshare.com/a/abc123def4 --json`,
|
|
4364
|
-
run: parentCommandRunner("agent")
|
|
4365
4357
|
});
|
|
4366
4358
|
const moveDefinition = define({
|
|
4367
4359
|
name: "move",
|
|
@@ -4442,7 +4434,7 @@ const artifactsDefinition = define({
|
|
|
4442
4434
|
subCommands: {
|
|
4443
4435
|
list: lazyCommand(define({
|
|
4444
4436
|
name: "list",
|
|
4445
|
-
description: "List artifacts you
|
|
4437
|
+
description: "List artifacts you shared, newest first.",
|
|
4446
4438
|
toKebab: true,
|
|
4447
4439
|
args: {
|
|
4448
4440
|
...commonArgs,
|
|
@@ -4728,17 +4720,17 @@ printf '%s' "$TOKEN" | npx --yes @artifactshare/cli profiles import-token --prof
|
|
|
4728
4720
|
});
|
|
4729
4721
|
const projectsListDefinition = define({
|
|
4730
4722
|
name: "list",
|
|
4731
|
-
description: "List projects you can
|
|
4723
|
+
description: "List projects you can share into.",
|
|
4732
4724
|
toKebab: true,
|
|
4733
4725
|
args: commonArgs,
|
|
4734
4726
|
examples: `npx --yes @artifactshare/cli projects list --json
|
|
4735
4727
|
|
|
4736
4728
|
is_default marks the working-directory default project from .artifactshare/config.json.
|
|
4737
|
-
Use a project id with
|
|
4729
|
+
Use a project id with share --project-id or init --project-id.`
|
|
4738
4730
|
});
|
|
4739
4731
|
const projectsCreateDefinition = define({
|
|
4740
4732
|
name: "create",
|
|
4741
|
-
description: "Create a project you can
|
|
4733
|
+
description: "Create a project you can share into.",
|
|
4742
4734
|
toKebab: true,
|
|
4743
4735
|
args: {
|
|
4744
4736
|
...commonArgs,
|
|
@@ -4760,11 +4752,11 @@ const projectsCreateDefinition = define({
|
|
|
4760
4752
|
examples: `npx --yes @artifactshare/cli projects create "Launch review" --json
|
|
4761
4753
|
npx --yes @artifactshare/cli projects create "Client" --description "Weekly reports" --visibility private --json
|
|
4762
4754
|
|
|
4763
|
-
The response includes project.id and next_command for
|
|
4755
|
+
The response includes project.id and next_command for share --project-id.
|
|
4764
4756
|
|
|
4765
4757
|
Common failures:
|
|
4766
4758
|
auth_required Set ARTIFACTSHARE_TOKEN before projects create
|
|
4767
|
-
upload_not_allowed Your account cannot
|
|
4759
|
+
upload_not_allowed Your account cannot share yet; request access from an operator
|
|
4768
4760
|
validation_failed Pass a non-empty name and valid --visibility`
|
|
4769
4761
|
});
|
|
4770
4762
|
const projectsEditDefinition = define({
|
|
@@ -4829,7 +4821,7 @@ Common failures:
|
|
|
4829
4821
|
});
|
|
4830
4822
|
const projectsDefinition = define({
|
|
4831
4823
|
name: "projects",
|
|
4832
|
-
description: "Create, find, and edit
|
|
4824
|
+
description: "Create, find, and edit share destinations.",
|
|
4833
4825
|
toKebab: true,
|
|
4834
4826
|
args: commonArgs,
|
|
4835
4827
|
subCommands: {
|
|
@@ -4977,7 +4969,7 @@ const initDefinition = define({
|
|
|
4977
4969
|
projectId: {
|
|
4978
4970
|
type: "string",
|
|
4979
4971
|
toKebab: true,
|
|
4980
|
-
description: "Default project for
|
|
4972
|
+
description: "Default project for sharing in this directory"
|
|
4981
4973
|
}
|
|
4982
4974
|
},
|
|
4983
4975
|
examples: `npx --yes @artifactshare/cli init --profile client-a --project-id <id> --json
|
|
@@ -4991,7 +4983,7 @@ Common failures:
|
|
|
4991
4983
|
});
|
|
4992
4984
|
const requestAccessDefinition = define({
|
|
4993
4985
|
name: "request-access",
|
|
4994
|
-
description: "Join the early-access waitlist for
|
|
4986
|
+
description: "Join the early-access waitlist for sharing.",
|
|
4995
4987
|
toKebab: true,
|
|
4996
4988
|
args: {
|
|
4997
4989
|
...commonArgs,
|
|
@@ -5002,9 +4994,9 @@ const requestAccessDefinition = define({
|
|
|
5002
4994
|
}
|
|
5003
4995
|
},
|
|
5004
4996
|
examples: `npx --yes @artifactshare/cli request-access --json
|
|
5005
|
-
npx --yes @artifactshare/cli request-access --note "
|
|
4997
|
+
npx --yes @artifactshare/cli request-access --note "Sharing weekly reports for my team" --json
|
|
5006
4998
|
|
|
5007
|
-
Joining the waitlist does not enable
|
|
4999
|
+
Joining the waitlist does not enable sharing immediately; an operator opens it.
|
|
5008
5000
|
Re-running updates your note without creating a duplicate entry.
|
|
5009
5001
|
|
|
5010
5002
|
Common failures:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artifactshare/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
|
|
5
5
|
"homepage": "https://artifactshare.com/connect",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"share",
|
|
12
12
|
"static-site",
|
|
13
13
|
"automation",
|
|
14
|
-
"publish",
|
|
15
14
|
"ai-agents"
|
|
16
15
|
],
|
|
17
16
|
"type": "module",
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: artifactshare
|
|
3
|
-
description:
|
|
3
|
+
description: Open, share, update, and read back shared files with the Artifact Share CLI. Use when the user asks to open an Artifact Share URL, share an HTML/Markdown report, a static site, or other generated file, or to read back or comment on a shared file.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!-- artifactshare-skill
|
|
7
|
-
version:
|
|
7
|
+
version: 15
|
|
8
8
|
managed: true
|
|
9
9
|
-->
|
|
10
10
|
|
|
11
11
|
# Artifact Share CLI
|
|
12
12
|
|
|
13
13
|
Artifact Share hosts shared files (HTML pages, Markdown documents, static
|
|
14
|
-
sites) with versions and comments. The CLI
|
|
15
|
-
designed for agents: every command supports `--json`
|
|
14
|
+
sites) with versions and comments. The CLI opens shared URLs, shares local
|
|
15
|
+
files and folders, and is designed for agents: every command supports `--json`
|
|
16
|
+
with a stable contract.
|
|
16
17
|
|
|
17
18
|
Run commands with `npx --yes @artifactshare/cli`. When unsure about a
|
|
18
19
|
command or flag, read `npx --yes @artifactshare/cli --help` first.
|
|
@@ -27,7 +28,7 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
|
|
|
27
28
|
|
|
28
29
|
## Output contract
|
|
29
30
|
|
|
30
|
-
- Always pass `--json`. Success prints `{"schema_version":
|
|
31
|
+
- Always pass `--json`. Success prints `{"schema_version":2,"ok":true,"command":...,"data":...}` to stdout; failure prints `{"schema_version":2,"ok":false,"error":...}` to stderr with exit code 1.
|
|
31
32
|
- On failure, read `error.code`, `error.hint`, and `error.recovery`. `recovery.kind` is one of `change_input`, `run_command`, `retry_later`, `ask_human`, `report_issue`. When `error.requires_human` is true, report to the user instead of retrying.
|
|
32
33
|
|
|
33
34
|
## Authentication
|
|
@@ -46,13 +47,13 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
|
|
|
46
47
|
|
|
47
48
|
## Choosing the destination
|
|
48
49
|
|
|
49
|
-
1. `projects list --json` shows the projects this account can
|
|
50
|
-
2. `projects create <name> --json` creates a project and returns `project.id` plus a `next_command` using `
|
|
50
|
+
1. `projects list --json` shows the projects this account can share into; `is_default` marks the working-directory default.
|
|
51
|
+
2. `projects create <name> --json` creates a project and returns `project.id` plus a `next_command` using `share --project-id <id>`.
|
|
51
52
|
3. `projects edit <id> --name 'New name' --json`, `projects edit <id> --visibility private --json`, `projects edit <id> --add-email person@example.com --json`, `projects edit <id> --remove-email person@example.com --json`, `projects edit <id> --archive --json`, and `projects edit <id> --unarchive --json` change the project settings and audience.
|
|
52
53
|
4. `init --project-id <id> --json` saves a default project for the working directory.
|
|
53
|
-
5. `
|
|
54
|
+
5. `share` resolves the destination from `--project-id`, then the saved default, then `--home` (the home destination for files not placed in a project). Without any of these it fails with `destination_required`.
|
|
54
55
|
6. `edit <artifact-id-or-url> --project-id <id> --json` moves an existing file into a project; `edit <artifact-id-or-url> --home --json` moves it back home.
|
|
55
|
-
7. `edit <artifact-id-or-url> --title 'New title' --json`, `edit <artifact-id-or-url> --visibility private --json`, `edit <artifact-id-or-url> --grant-email person@example.com --json`, and `edit <artifact-id-or-url> --revoke-email person@example.com --json` change post-
|
|
56
|
+
7. `edit <artifact-id-or-url> --title 'New title' --json`, `edit <artifact-id-or-url> --visibility private --json`, `edit <artifact-id-or-url> --grant-email person@example.com --json`, and `edit <artifact-id-or-url> --revoke-email person@example.com --json` change post-share settings.
|
|
56
57
|
|
|
57
58
|
`edit` changes settings without adding a new version. Moving a `project`
|
|
58
59
|
visibility artifact home makes it `private`, because home has no project
|
|
@@ -62,9 +63,9 @@ automation, but prefer `edit` for new flows.
|
|
|
62
63
|
## Core commands
|
|
63
64
|
|
|
64
65
|
```bash
|
|
65
|
-
npx --yes @artifactshare/cli
|
|
66
|
-
npx --yes @artifactshare/cli
|
|
67
|
-
npx --yes @artifactshare/cli
|
|
66
|
+
npx --yes @artifactshare/cli open <artifact-id-or-url> --json
|
|
67
|
+
npx --yes @artifactshare/cli share ./report.html --json
|
|
68
|
+
npx --yes @artifactshare/cli share ./site-dir --project-id <id> --json
|
|
68
69
|
npx --yes @artifactshare/cli projects create 'Client reports' --json
|
|
69
70
|
npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
|
|
70
71
|
npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
|
|
@@ -82,14 +83,14 @@ npx --yes @artifactshare/cli comments reopen <artifact-id-or-url> --thread-id <t
|
|
|
82
83
|
npx --yes @artifactshare/cli comments delete <artifact-id-or-url> --thread-id <thread-id> --message-id <message-id> --json
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
- When the user gives an Artifact Share URL, start with `
|
|
86
|
-
- `
|
|
87
|
-
- To keep an existing share URL, do not run `
|
|
88
|
-
- For repeat jobs where the caller can choose a stable name, use `
|
|
86
|
+
- When the user gives an Artifact Share URL, start with `open <artifact-id-or-url> --json`. It ensures this skill is installed or updated, then reads single-file artifacts or returns a `download` next command for static sites and multi-file artifacts.
|
|
87
|
+
- `share` accepts a single `.html` / `.md` file or a static-site directory. The returned `share_url` is the link to give the user.
|
|
88
|
+
- To keep an existing share URL, do not run `share --artifact-id`; run `update <artifact-id-or-url> <path> --json` instead.
|
|
89
|
+
- For repeat jobs where the caller can choose a stable name, use `share <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
|
|
89
90
|
- `update` adds a new version to an existing file; pass the same kind of input (single file vs directory) it was created with. It does not change title, visibility, explicit viewers, or project placement.
|
|
90
|
-
- `edit` changes the display title, visibility, explicit viewers, or project placement after
|
|
91
|
+
- `edit` changes the display title, visibility, explicit viewers, or project placement after sharing.
|
|
91
92
|
- `projects edit` changes a project name, description, sharing scope, audience, or archive state. Use IDs from `projects list --json`.
|
|
92
|
-
- `delete` permanently removes an artifact you
|
|
93
|
+
- `delete` permanently removes an artifact you shared, including its version history. Use it only when the user explicitly asks to delete.
|
|
93
94
|
- Use `artifacts list --json` to find recent artifact IDs for `update`, `edit`, `move`, `delete`, `artifacts get`, or `comments list`. Filter with `--project-id <id>`, `--home`, or `--query <text>`.
|
|
94
95
|
- Use IDs from `comments list --json` for `comments edit`, `comments resolve`, `comments reopen`, and `comments delete`. Comment deletion cannot be undone; omit `--message-id` only when the user wants the whole thread deleted.
|
|
95
96
|
- When the user gives a title, project name, or URL instead of an ID, run `resolve <value> --json` first and use the returned ID.
|
|
@@ -97,7 +98,7 @@ npx --yes @artifactshare/cli comments delete <artifact-id-or-url> --thread-id <t
|
|
|
97
98
|
|
|
98
99
|
## Upload access
|
|
99
100
|
|
|
100
|
-
If `
|
|
101
|
+
If `share` or `update` fails with `upload_not_allowed`, run
|
|
101
102
|
`request-access --note '<why>' --json` to join the waitlist, then tell the
|
|
102
|
-
user that
|
|
103
|
-
|
|
103
|
+
user that sharing stays closed until an operator opens it. Do not retry
|
|
104
|
+
share in a loop.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Use the Artifact Share CLI to
|
|
2
|
+
description: Use the Artifact Share CLI to open, share, update, and read back shared files.
|
|
3
3
|
alwaysApply: false
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!-- artifactshare-skill
|
|
7
|
-
version:
|
|
7
|
+
version: 15
|
|
8
8
|
managed: true
|
|
9
9
|
-->
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ managed: true
|
|
|
12
12
|
|
|
13
13
|
Artifact Share hosts shared files (HTML pages, Markdown documents, static
|
|
14
14
|
sites) with versions and comments. Use `npx --yes @artifactshare/cli` to
|
|
15
|
-
|
|
15
|
+
open shared URLs and share local files from the terminal, and read
|
|
16
16
|
`npx --yes @artifactshare/cli --help` before choosing a command.
|
|
17
17
|
|
|
18
18
|
Use the CLI for local files and folders. The remote MCP tools accept HTML or
|
|
@@ -27,16 +27,16 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
|
|
|
27
27
|
- In agents, CI, or scripts, ask the user to issue an API token at `https://artifactshare.com/settings/tokens`, then run normal commands with `ARTIFACTSHARE_TOKEN` or `--token`; do not pass API tokens to `login`.
|
|
28
28
|
- To save that token as a named profile without TTY or browser login, pipe it on standard input: `printf '%s' "$TOKEN" | npx --yes @artifactshare/cli profiles import-token --profile <name> --json`. Add `--allow-plaintext-token-store` only on a trusted machine without a native token store.
|
|
29
29
|
- Use `login --profile <name>` only in an interactive terminal where the user can approve the browser device flow.
|
|
30
|
-
- When the user gives an Artifact Share URL, start with `
|
|
30
|
+
- When the user gives an Artifact Share URL, start with `open <artifact-id-or-url> --json`. It ensures this rule is installed or updated, then reads single-file artifacts or returns a `download` next command for static sites and multi-file artifacts.
|
|
31
31
|
- Pick the destination with `projects list --json`, `projects create <name> --json`, `init --project-id <id>`, or `--project-id`.
|
|
32
32
|
- Change project settings with `projects edit <id> --name 'New name' --json`, `projects edit <id> --visibility private --json`, `projects edit <id> --add-email person@example.com --json`, `projects edit <id> --remove-email person@example.com --json`, `projects edit <id> --archive --json`, or `projects edit <id> --unarchive --json`.
|
|
33
|
-
- Change post-
|
|
33
|
+
- Change post-share settings with `edit <artifact-id-or-url> --title 'New title' --json`, `edit <artifact-id-or-url> --visibility private --json`, `edit <artifact-id-or-url> --grant-email person@example.com --json`, `edit <artifact-id-or-url> --revoke-email person@example.com --json`, `edit <artifact-id-or-url> --project-id <id> --json`, or `edit <artifact-id-or-url> --home --json`. Moving a `project` visibility file home makes it `private`.
|
|
34
34
|
- `move <artifact-id-or-url> --project-id <id> --json` and `move <artifact-id-or-url> --home --json` remain available for placement-only automation, but prefer `edit` for new flows.
|
|
35
|
-
-
|
|
36
|
-
- For repeat jobs with a stable caller-owned name, use `
|
|
35
|
+
- Share with `share <path> --json`. To keep an existing share URL, do not use `share --artifact-id`; add a version with `update <artifact-id-or-url> <path> --json`.
|
|
36
|
+
- For repeat jobs with a stable caller-owned name, use `share <path> --key <key> --json`: the first run creates the artifact, later runs add versions to the same artifact.
|
|
37
37
|
- Permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
|
|
38
38
|
- Find recent artifact IDs with `artifacts list --json`; filter with `--project-id <id>`, `--home`, or `--query <text>`.
|
|
39
39
|
- Resolve titles, project names, and URLs to IDs with `resolve <value> --json` before writing.
|
|
40
40
|
- Read back with `artifacts get` / `download`; comment with `comments list` / `comments post`; use `comments edit`, `comments resolve`, `comments reopen`, and `comments delete` with IDs from `comments list`.
|
|
41
41
|
- Comment deletion cannot be undone. Omit `--message-id` from `comments delete` only when the user wants the whole thread deleted.
|
|
42
|
-
- On `upload_not_allowed`, run `request-access --note '<why>' --json` and tell the user an operator opens
|
|
42
|
+
- On `upload_not_allowed`, run `request-access --note '<why>' --json` and tell the user an operator opens sharing; do not retry in a loop.
|