@artifactshare/cli 0.7.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +10 -5
- package/dist/index.js +206 -116
- package/package.json +6 -6
- package/skills/artifactshare/SKILL.md +39 -20
- package/skills/artifactshare/artifactshare.mdc +16 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to `@artifactshare/cli` are documented here.
|
|
4
4
|
For user-facing announcements, see https://artifactshare.com/updates?product=cli.
|
|
5
5
|
|
|
6
|
+
## 0.8.2 - 2026-07-26
|
|
7
|
+
|
|
8
|
+
- Add `append` for appending UTF-8 content to single-file Markdown and HTML artifacts.
|
|
9
|
+
|
|
10
|
+
## 0.8.1 - 2026-07-26
|
|
11
|
+
|
|
12
|
+
- Document the `artifacts get --json` readback contract in help, bundled skills, and MCP tool descriptions, including `content`, `version_id`, and continuation fields.
|
|
13
|
+
|
|
14
|
+
## 0.8.0 - 2026-07-15
|
|
15
|
+
|
|
16
|
+
- Remove the `request-access` command. Sharing is open to everyone at sign-up, so there is no waitlist to join.
|
|
17
|
+
|
|
6
18
|
## 0.7.1 - 2026-07-14
|
|
7
19
|
|
|
8
20
|
- Rework `home_audience` guidance in command help and the bundled skill: purpose-based examples for user and repository scopes, the `--visibility` one-time override, and checking the resolved audience with `--scope effective`.
|
package/README.md
CHANGED
|
@@ -23,7 +23,10 @@ npx --yes @artifactshare/cli projects create 'Client reports' --json
|
|
|
23
23
|
npx --yes @artifactshare/cli projects edit <id> --add-email viewer@example.com --json
|
|
24
24
|
npx --yes @artifactshare/cli edit <artifact-id-or-url> --project-id <id> --json
|
|
25
25
|
npx --yes @artifactshare/cli edit <artifact-id-or-url> --visibility private --grant-email viewer@example.com --json
|
|
26
|
+
npx --yes @artifactshare/cli share ./report.html --visibility link --link-expires-at '2026-08-01T00:00:00Z' --json
|
|
27
|
+
npx --yes @artifactshare/cli edit <artifact-id-or-url> --visibility link --no-link-expiry --json
|
|
26
28
|
npx --yes @artifactshare/cli update <artifact-id-or-url> ./dist
|
|
29
|
+
npx --yes @artifactshare/cli append <artifact-id-or-url> ./new-section.md
|
|
27
30
|
npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
|
|
28
31
|
npx --yes @artifactshare/cli logout --profile default --json
|
|
29
32
|
npx --yes @artifactshare/cli config set home_audience private --scope user --json
|
|
@@ -47,9 +50,10 @@ runs add versions to the same file.
|
|
|
47
50
|
| Command | What it does |
|
|
48
51
|
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
52
|
| `open <target>` | First command for agents opening a shared URL; ensures skills, then reads or suggests download |
|
|
50
|
-
| `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key
|
|
53
|
+
| `share <path>` | Share a file or folder as a new shared file (`--project`, `--home`, `--visibility`, `--key`, link expiry options) |
|
|
51
54
|
| `update <target> <path>` | Add a new version to an existing file (ID or share URL) |
|
|
52
|
-
| `
|
|
55
|
+
| `append <target> <path>` | Append a non-empty UTF-8 file exactly as-is to a single-file Markdown or HTML artifact |
|
|
56
|
+
| `edit <target>` | Change title, sharing, link expiry, explicit viewers, or project placement |
|
|
53
57
|
| `delete <target>` | Permanently delete a file you shared |
|
|
54
58
|
| `resolve <value>` | Find files by URL, ID, title, or project name |
|
|
55
59
|
| `artifacts get <target>` | Read a file's content and metadata back |
|
|
@@ -57,7 +61,6 @@ runs add versions to the same file.
|
|
|
57
61
|
| `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
|
|
58
62
|
| `projects list / create / edit` | List, create, and edit project destinations and audience |
|
|
59
63
|
| `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
|
|
60
|
-
| `request-access` | Join the waitlist when sharing is not enabled yet |
|
|
61
64
|
| `login` / `logout` / `whoami` | Sign in, remove a saved local credential, and check who you are |
|
|
62
65
|
| `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
|
|
63
66
|
| `changelog` | Show the installed version, this release's notes, and the public updates page |
|
|
@@ -67,7 +70,7 @@ runs add versions to the same file.
|
|
|
67
70
|
|
|
68
71
|
Public command paths covered by this reference:
|
|
69
72
|
|
|
70
|
-
`artifacts`, `artifacts get`, `artifacts list`, `changelog`, `comments`, `comments delete`, `comments edit`, `comments list`, `comments post`, `comments reopen`, `comments resolve`, `config`, `config get`, `config set`, `config unset`, `delete`, `doctor`, `download`, `edit`, `init`, `login`, `logout`, `move`, `open`, `profiles`, `profiles delete`, `profiles import-token`, `profiles list`, `profiles use`, `projects`, `projects create`, `projects edit`, `projects list`, `
|
|
73
|
+
`append`, `artifacts`, `artifacts get`, `artifacts list`, `changelog`, `comments`, `comments delete`, `comments edit`, `comments list`, `comments post`, `comments reopen`, `comments resolve`, `config`, `config get`, `config set`, `config unset`, `delete`, `doctor`, `download`, `edit`, `init`, `login`, `logout`, `move`, `open`, `profiles`, `profiles delete`, `profiles import-token`, `profiles list`, `profiles use`, `projects`, `projects create`, `projects edit`, `projects list`, `resolve`, `share`, `skills`, `skills ensure`, `skills install`, `skills list`, `skills remove`, `skills update`, `update`, `whoami`.
|
|
71
74
|
|
|
72
75
|
## Where shared files are delivered
|
|
73
76
|
|
|
@@ -80,7 +83,9 @@ npx --yes @artifactshare/cli share ./report.html --visibility private --json
|
|
|
80
83
|
npx --yes @artifactshare/cli config get home_audience --scope effective --json
|
|
81
84
|
```
|
|
82
85
|
|
|
83
|
-
Use `--scope repository` only for a policy agreed by all repository participants, and pass `--visibility private|workspace` for a one-time home override. For project creation, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`.
|
|
86
|
+
Use `--scope repository` only for a policy agreed by all repository participants, and pass `--visibility private|workspace|link` for a one-time home override. For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit both to use the workspace default. For project creation, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`.
|
|
87
|
+
|
|
88
|
+
Link sharing is available on Plus and Team. A workspace policy may allow a finite expiry from 1 to 365 days or no expiration; the initial default is 30 days and the initial maximum is 90 days. Share and edit results include the confirmed `link_expires_at` UTC timestamp or `null`. If a link command fails, use `link_sharing_plan_required` to explain the plan limit, `link_sharing_disabled` to ask a Team owner or admin to enable the workspace setting, or `link_expiry_invalid` to correct the timestamp or choose `--no-link-expiry` when allowed. Follow `error.recovery` instead of retrying unchanged input.
|
|
84
89
|
|
|
85
90
|
For the complete settings reference, `home_audience` is the canonical home key. `default_artifact_visibility` remains a compatibility alias, and `default_project_visibility` is the advanced default for `projects create`. User and repository settings are resolved with repository taking precedence, followed by user and product default `workspace`; home also checks the compatibility alias at each scope. Use `config get home_audience --scope effective --json` to confirm the resolved audience. Keyless `config get --json` returns only `home_audience`; pass an explicit key to read either other setting. These settings only affect new home posts and project creation; update, edit, Web, and MCP defaults are unchanged.
|
|
86
91
|
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ const BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
35
35
|
"help",
|
|
36
36
|
"home",
|
|
37
37
|
"insecure-localhost",
|
|
38
|
+
"no-link-expiry",
|
|
38
39
|
"unarchive"
|
|
39
40
|
]);
|
|
40
41
|
const VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
@@ -46,6 +47,7 @@ const VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
46
47
|
"grant-email",
|
|
47
48
|
"include",
|
|
48
49
|
"key",
|
|
50
|
+
"link-expires-at",
|
|
49
51
|
"message-id",
|
|
50
52
|
"name",
|
|
51
53
|
"note",
|
|
@@ -74,6 +76,7 @@ const COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
|
74
76
|
"share",
|
|
75
77
|
"open",
|
|
76
78
|
"update",
|
|
79
|
+
"append",
|
|
77
80
|
"edit",
|
|
78
81
|
"delete",
|
|
79
82
|
"resolve",
|
|
@@ -81,7 +84,6 @@ const COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
|
81
84
|
"move",
|
|
82
85
|
"artifacts",
|
|
83
86
|
"comments",
|
|
84
|
-
"request-access",
|
|
85
87
|
"whoami",
|
|
86
88
|
"doctor",
|
|
87
89
|
"profiles",
|
|
@@ -143,8 +145,17 @@ function isProfileCredentialSource(source) {
|
|
|
143
145
|
return source === "profile" || source === "local_config" || source === "project_config" || source === "global_profile";
|
|
144
146
|
}
|
|
145
147
|
//#endregion
|
|
148
|
+
//#region src/validators.ts
|
|
149
|
+
function isRecord(value) {
|
|
150
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
151
|
+
}
|
|
152
|
+
function nonEmpty(value) {
|
|
153
|
+
if (typeof value !== "string") return void 0;
|
|
154
|
+
const trimmed = value.trim();
|
|
155
|
+
return trimmed ? trimmed : void 0;
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
146
158
|
//#region src/errors.ts
|
|
147
|
-
const REQUEST_ACCESS_COMMAND$1 = `${CLI_INVOCATION} request-access --json`;
|
|
148
159
|
const PROJECTS_LIST_COMMAND = `${CLI_INVOCATION} projects list --json`;
|
|
149
160
|
function apiError(body) {
|
|
150
161
|
const error = body?.error;
|
|
@@ -168,19 +179,13 @@ function mapApiError(status, body, options = {}) {
|
|
|
168
179
|
}
|
|
169
180
|
if (apiCode === "upload-not-allowed") return cliError({
|
|
170
181
|
code: "upload_not_allowed",
|
|
171
|
-
message: "
|
|
172
|
-
why: "Artifact Share
|
|
173
|
-
hint:
|
|
182
|
+
message: "Sharing is temporarily unavailable.",
|
|
183
|
+
why: "Artifact Share has paused sharing for now.",
|
|
184
|
+
hint: "Contact Artifact Share support if you need sharing enabled.",
|
|
174
185
|
agentRecoverable: false,
|
|
175
186
|
requiresHuman: true,
|
|
176
|
-
recovery: {
|
|
177
|
-
|
|
178
|
-
command: REQUEST_ACCESS_COMMAND$1
|
|
179
|
-
},
|
|
180
|
-
details: {
|
|
181
|
-
limit: "upload_access",
|
|
182
|
-
suggested_command: REQUEST_ACCESS_COMMAND$1
|
|
183
|
-
}
|
|
187
|
+
recovery: { kind: "ask_human" },
|
|
188
|
+
details: { limit: "upload_access" }
|
|
184
189
|
});
|
|
185
190
|
if (apiCode === "self-upload-disabled") return cliError({
|
|
186
191
|
code: "self_upload_disabled",
|
|
@@ -203,9 +208,9 @@ function mapApiError(status, body, options = {}) {
|
|
|
203
208
|
});
|
|
204
209
|
if (apiCode === "contributor-limit-exceeded") return cliError({
|
|
205
210
|
code: "contributor_limit_exceeded",
|
|
206
|
-
message: apiMessage ?? "
|
|
207
|
-
why: "This workspace
|
|
208
|
-
hint: "
|
|
211
|
+
message: apiMessage ?? "This workspace cannot add more contributors. Contact the Artifact Share team.",
|
|
212
|
+
why: "This workspace cannot add more contributors.",
|
|
213
|
+
hint: "Contact the Artifact Share team, then retry.",
|
|
209
214
|
agentRecoverable: false,
|
|
210
215
|
requiresHuman: true,
|
|
211
216
|
recovery: { kind: "ask_human" }
|
|
@@ -331,15 +336,32 @@ function mapApiError(status, body, options = {}) {
|
|
|
331
336
|
requiresHuman: false,
|
|
332
337
|
recovery: { kind: "retry_later" }
|
|
333
338
|
});
|
|
334
|
-
if (options.artifactTarget && apiCode === "copy-forbidden")
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
339
|
+
if (options.artifactTarget && apiCode === "copy-forbidden") {
|
|
340
|
+
const append = options.operation === "append";
|
|
341
|
+
return cliError({
|
|
342
|
+
code: "artifact_kind_mismatch",
|
|
343
|
+
message: apiMessage ?? (append ? "Append only supports single-file Markdown or HTML artifacts." : "The selected artifact cannot be updated with this input."),
|
|
344
|
+
why: append ? "Static sites do not have one source file to append to." : "Single-file artifacts must be updated with a file, and static-site artifacts must be updated with a directory.",
|
|
345
|
+
hint: append ? "Use update to replace the full source, or append to a single Markdown or HTML artifact." : "Retry with the same kind of input that was used to create the artifact.",
|
|
346
|
+
agentRecoverable: true,
|
|
347
|
+
requiresHuman: false,
|
|
348
|
+
recovery: { kind: "change_input" }
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
if (options.artifactTarget && options.operation === "append" && apiCode === "version_conflict") {
|
|
352
|
+
const current = typeof body?.error === "object" ? body.error.details : void 0;
|
|
353
|
+
const currentVersionId = isRecord(current) && typeof current.current_version_id === "string" ? current.current_version_id : null;
|
|
354
|
+
return cliError({
|
|
355
|
+
code: "version_conflict",
|
|
356
|
+
message: apiMessage ?? "The artifact changed before append.",
|
|
357
|
+
why: currentVersionId ? `The current version is ${currentVersionId}.` : "Another update was committed first.",
|
|
358
|
+
hint: "Run the same append command again to append to the latest content.",
|
|
359
|
+
agentRecoverable: true,
|
|
360
|
+
requiresHuman: false,
|
|
361
|
+
recovery: { kind: "retry_later" },
|
|
362
|
+
...currentVersionId ? { details: { current_version_id: currentVersionId } } : {}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
343
365
|
if (apiCode === "project-limit-reached") return cliError({
|
|
344
366
|
code: "project_limit_reached",
|
|
345
367
|
message: apiMessage ?? "You've reached your plan's project limit. Upgrade your plan or archive existing projects.",
|
|
@@ -406,6 +428,15 @@ function mapApiError(status, body, options = {}) {
|
|
|
406
428
|
requiresHuman: false,
|
|
407
429
|
recovery: { kind: "change_input" }
|
|
408
430
|
});
|
|
431
|
+
if (apiCode === "link-sharing-plan-required" || apiCode === "link-sharing-disabled" || apiCode === "link-expiry-invalid") return cliError({
|
|
432
|
+
code: apiCode.replaceAll("-", "_"),
|
|
433
|
+
message: apiMessage ?? "The link sharing option is invalid.",
|
|
434
|
+
why: apiCode === "link-sharing-plan-required" ? "Link sharing is available only on Plus and Team plans." : apiCode === "link-sharing-disabled" ? "The Team workspace has disabled link sharing." : "The requested link expiry does not match the link sharing policy.",
|
|
435
|
+
hint: apiCode === "link-expiry-invalid" ? "Pass a future RFC3339 UTC timestamp within the workspace maximum, or use --no-link-expiry when unlimited expiry is allowed." : "Ask a workspace owner or administrator to review the workspace plan or link sharing policy.",
|
|
436
|
+
agentRecoverable: apiCode === "link-expiry-invalid",
|
|
437
|
+
requiresHuman: apiCode !== "link-expiry-invalid",
|
|
438
|
+
recovery: apiCode === "link-expiry-invalid" ? { kind: "change_input" } : { kind: "ask_human" }
|
|
439
|
+
});
|
|
409
440
|
if ((options.editSettings || options.projectTarget) && apiCode === "too-many-grants") return cliError({
|
|
410
441
|
code: "too_many_grants",
|
|
411
442
|
message: apiMessage ?? "Too many people are shared.",
|
|
@@ -684,7 +715,7 @@ function normalizeApiCode(value) {
|
|
|
684
715
|
}
|
|
685
716
|
function uploadBlockedHint(code) {
|
|
686
717
|
if (code === "self-upload-disabled") return "Sign in with Google or Microsoft on the Artifact Share website, then retry share.";
|
|
687
|
-
if (code === "upload-not-allowed") return
|
|
718
|
+
if (code === "upload-not-allowed") return "Contact Artifact Share support; sharing is temporarily unavailable.";
|
|
688
719
|
if (code === "upload-policy-unavailable") return "Retry doctor later; upload permission could not be checked.";
|
|
689
720
|
return "Resolve the upload issue, then retry share.";
|
|
690
721
|
}
|
|
@@ -736,6 +767,20 @@ function networkError(error) {
|
|
|
736
767
|
recovery: { kind: "retry_later" }
|
|
737
768
|
});
|
|
738
769
|
}
|
|
770
|
+
function appendOutcomeUnknownError(artifactId, error) {
|
|
771
|
+
return cliError({
|
|
772
|
+
code: "append_outcome_unknown",
|
|
773
|
+
message: "The append result is unknown.",
|
|
774
|
+
why: error instanceof Error ? `The connection ended before confirmation: ${error.message}` : "The connection ended before Artifact Share confirmed whether the append was saved.",
|
|
775
|
+
hint: `Run ${CLI_INVOCATION} artifacts get ${artifactId} --json and inspect the end of content before deciding whether to retry append.`,
|
|
776
|
+
agentRecoverable: true,
|
|
777
|
+
requiresHuman: false,
|
|
778
|
+
recovery: {
|
|
779
|
+
kind: "run_command",
|
|
780
|
+
command: `${CLI_INVOCATION} artifacts get ${artifactId} --json`
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
}
|
|
739
784
|
function unexpectedError(error) {
|
|
740
785
|
return cliError({
|
|
741
786
|
code: "unexpected_error",
|
|
@@ -803,6 +848,7 @@ function resolveArtifactId(input) {
|
|
|
803
848
|
return null;
|
|
804
849
|
}
|
|
805
850
|
const TARGET_COMMAND_LABELS = {
|
|
851
|
+
append: "Append",
|
|
806
852
|
update: "Update",
|
|
807
853
|
open: "Open",
|
|
808
854
|
"artifacts get": "Artifacts get",
|
|
@@ -987,16 +1033,6 @@ function normalizeArgvForGunshi(argv, commandCandidate) {
|
|
|
987
1033
|
] : [head, ...rest];
|
|
988
1034
|
}
|
|
989
1035
|
//#endregion
|
|
990
|
-
//#region src/validators.ts
|
|
991
|
-
function isRecord(value) {
|
|
992
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
993
|
-
}
|
|
994
|
-
function nonEmpty(value) {
|
|
995
|
-
if (typeof value !== "string") return void 0;
|
|
996
|
-
const trimmed = value.trim();
|
|
997
|
-
return trimmed ? trimmed : void 0;
|
|
998
|
-
}
|
|
999
|
-
//#endregion
|
|
1000
1036
|
//#region src/output.ts
|
|
1001
1037
|
function outputModeFromArgv(argv) {
|
|
1002
1038
|
return outputMode({ json: argv.includes("--json") });
|
|
@@ -1172,13 +1208,13 @@ function resolveSuccessFields(data) {
|
|
|
1172
1208
|
}
|
|
1173
1209
|
function artifactGetSuccessFields(data) {
|
|
1174
1210
|
if (!isRecord(data)) return false;
|
|
1175
|
-
return typeof data.id === "string" && typeof data.share_url === "string" && typeof data.version_id === "string" && (data.format === "html" || data.format === "markdown") && typeof data.content === "string" && typeof data.size_bytes === "number" && typeof data.truncated === "boolean" && (typeof data.next_offset === "number" || data.next_offset === null);
|
|
1211
|
+
return typeof data.id === "string" && typeof data.share_url === "string" && typeof data.version_id === "string" && (data.format === "html" || data.format === "markdown") && typeof data.content === "string" && typeof data.size_bytes === "number" && typeof data.truncated === "boolean" && (typeof data.next_offset === "number" || data.next_offset === null) && (data.link_expires_at === void 0 || typeof data.link_expires_at === "string" || data.link_expires_at === null);
|
|
1176
1212
|
}
|
|
1177
1213
|
function artifactsListSuccessFields(data) {
|
|
1178
1214
|
if (!isRecord(data)) return false;
|
|
1179
1215
|
return Array.isArray(data.artifacts) && data.artifacts.every((item) => {
|
|
1180
1216
|
if (!isRecord(item)) return false;
|
|
1181
|
-
return typeof item.id === "string" && typeof item.title === "string" && typeof item.share_url === "string" && typeof item.visibility === "string" && typeof item.updated_at === "string" && (typeof item.project_id === "string" || item.project_id === null);
|
|
1217
|
+
return typeof item.id === "string" && typeof item.title === "string" && typeof item.share_url === "string" && typeof item.visibility === "string" && (item.link_expires_at === void 0 || typeof item.link_expires_at === "string" || item.link_expires_at === null) && typeof item.updated_at === "string" && (typeof item.project_id === "string" || item.project_id === null);
|
|
1182
1218
|
}) && typeof data.limit === "number" && typeof data.has_more === "boolean" && (typeof data.next_cursor === "string" || data.next_cursor === null);
|
|
1183
1219
|
}
|
|
1184
1220
|
function deleteSuccessFields(data) {
|
|
@@ -3419,7 +3455,6 @@ async function runDelete(parsed, mode) {
|
|
|
3419
3455
|
//#endregion
|
|
3420
3456
|
//#region src/command-runners/doctor.ts
|
|
3421
3457
|
const LOGIN_COMMAND = `${CLI_INVOCATION} login`;
|
|
3422
|
-
const REQUEST_ACCESS_COMMAND = `${CLI_INVOCATION} request-access`;
|
|
3423
3458
|
function bearerTokenBlocksLogin(data) {
|
|
3424
3459
|
return data.auth.credential_source === "env" || data.auth.credential_source === "token_option";
|
|
3425
3460
|
}
|
|
@@ -3433,11 +3468,6 @@ function resolveDoctorNextCommand(data) {
|
|
|
3433
3468
|
return LOGIN_COMMAND;
|
|
3434
3469
|
}
|
|
3435
3470
|
if ((data.auth.code === "auth_required" || data.auth.code === "token_invalid") && !bearerTokenBlocksLogin(data)) return data.auth.profile ? `${LOGIN_COMMAND} --profile ${data.auth.profile}` : LOGIN_COMMAND;
|
|
3436
|
-
if (!data.network.ok) return null;
|
|
3437
|
-
if (data.upload.checked && !data.upload.ok) {
|
|
3438
|
-
if (data.upload.code === "upload-not-allowed") return REQUEST_ACCESS_COMMAND;
|
|
3439
|
-
return null;
|
|
3440
|
-
}
|
|
3441
3471
|
return null;
|
|
3442
3472
|
}
|
|
3443
3473
|
function authRecovery(data, nextCommand) {
|
|
@@ -3945,16 +3975,24 @@ async function runEdit(parsed, mode) {
|
|
|
3945
3975
|
function buildEditPayload(parsed) {
|
|
3946
3976
|
const body = {};
|
|
3947
3977
|
let hasChange = false;
|
|
3978
|
+
if (parsed.options.linkExpiresAt !== void 0 && parsed.options.noLinkExpiry === true) return { error: validationError("Choose only one link expiry option.", "Pass --link-expires-at <RFC3339 UTC> or --no-link-expiry, not both.") };
|
|
3948
3979
|
if (parsed.options.title !== void 0) {
|
|
3949
3980
|
body.title = parsed.options.title;
|
|
3950
3981
|
hasChange = true;
|
|
3951
3982
|
}
|
|
3952
3983
|
if (parsed.options.visibility !== void 0) {
|
|
3953
3984
|
const visibility = parsed.options.visibility.trim();
|
|
3954
|
-
if (visibility !== "private" && visibility !== "workspace") return { error: validationError("--visibility must be private or
|
|
3985
|
+
if (visibility !== "private" && visibility !== "workspace" && visibility !== "link") return { error: validationError("--visibility must be private, workspace, or link.", "Retry with --visibility private, --visibility workspace, or --visibility link.") };
|
|
3955
3986
|
body.visibility = visibility;
|
|
3956
3987
|
hasChange = true;
|
|
3957
3988
|
}
|
|
3989
|
+
if (parsed.options.linkExpiresAt !== void 0) {
|
|
3990
|
+
body.link_expires_at = parsed.options.linkExpiresAt;
|
|
3991
|
+
hasChange = true;
|
|
3992
|
+
} else if (parsed.options.noLinkExpiry === true) {
|
|
3993
|
+
body.link_expires_at = null;
|
|
3994
|
+
hasChange = true;
|
|
3995
|
+
}
|
|
3958
3996
|
const addEmails = normalizedEmailOptions$1(parsed.options.grantEmail);
|
|
3959
3997
|
if (addEmails.error) return { error: addEmails.error };
|
|
3960
3998
|
if (parsed.options.grantEmail !== void 0) {
|
|
@@ -3977,7 +4015,7 @@ function buildEditPayload(parsed) {
|
|
|
3977
4015
|
body.destination = { project_id: projectId };
|
|
3978
4016
|
hasChange = true;
|
|
3979
4017
|
}
|
|
3980
|
-
if (!hasChange) return { error: validationError("At least one edit option is required.", "Pass --title, --visibility, --grant-email, --revoke-email, --project-id, or --home.") };
|
|
4018
|
+
if (!hasChange) return { error: validationError("At least one edit option is required.", "Pass --title, --visibility, --link-expires-at, --no-link-expiry, --grant-email, --revoke-email, --project-id, or --home.") };
|
|
3981
4019
|
return { body };
|
|
3982
4020
|
}
|
|
3983
4021
|
function normalizedEmailOptions$1(value) {
|
|
@@ -3998,7 +4036,10 @@ function parseEditData(body) {
|
|
|
3998
4036
|
url: typeof artifact.url === "string" ? artifact.url : null
|
|
3999
4037
|
},
|
|
4000
4038
|
title: body.title,
|
|
4001
|
-
share: {
|
|
4039
|
+
share: {
|
|
4040
|
+
visibility: share.visibility,
|
|
4041
|
+
link_expires_at: typeof share.link_expires_at === "string" || share.link_expires_at === null ? share.link_expires_at : null
|
|
4042
|
+
}
|
|
4002
4043
|
};
|
|
4003
4044
|
if (destination.type === "project") {
|
|
4004
4045
|
if (typeof destination.project_id !== "string") return null;
|
|
@@ -4557,6 +4598,7 @@ async function runShare(parsed, mode, isRetry = false) {
|
|
|
4557
4598
|
const command = "share";
|
|
4558
4599
|
const targetPath = parsed.positionals[0];
|
|
4559
4600
|
if (!targetPath) return writeFailure(command, validationError("Path is required.", "Pass a file or directory to share."), mode, 1);
|
|
4601
|
+
if (parsed.options.linkExpiresAt !== void 0 && parsed.options.noLinkExpiry === true) return writeFailure(command, validationError("Choose only one link expiry option.", "Pass --link-expires-at <RFC3339 UTC> or --no-link-expiry, not both."), mode, 1);
|
|
4560
4602
|
let shareKey = null;
|
|
4561
4603
|
if ("key" in parsed.options) {
|
|
4562
4604
|
shareKey = (typeof parsed.options.key === "string" ? parsed.options.key : "").trim();
|
|
@@ -4607,6 +4649,8 @@ async function runShare(parsed, mode, isRetry = false) {
|
|
|
4607
4649
|
initialForm.set("visibility", requestedVisibility);
|
|
4608
4650
|
for (const email of grantEmails) initialForm.append("grant_email", email);
|
|
4609
4651
|
if (destination.containerId) initialForm.set("container_id", destination.containerId);
|
|
4652
|
+
if (parsed.options.linkExpiresAt !== void 0) initialForm.set("link_expires_at", parsed.options.linkExpiresAt);
|
|
4653
|
+
else if (parsed.options.noLinkExpiry === true) initialForm.set("link_expires_at", "null");
|
|
4610
4654
|
const uploadUrl = apiUrl("/api/shareables/uploads", baseUrl);
|
|
4611
4655
|
if (shareKey !== null) uploadUrl.searchParams.set("publish_key", shareKey);
|
|
4612
4656
|
const upload = await prepareUploadPayload(targetPath, fileStat, initialForm);
|
|
@@ -4646,7 +4690,8 @@ async function runShare(parsed, mode, isRetry = false) {
|
|
|
4646
4690
|
} : { type: "home" },
|
|
4647
4691
|
share: {
|
|
4648
4692
|
visibility: body?.visibility ?? requestedVisibility,
|
|
4649
|
-
grant_emails: grantEmails
|
|
4693
|
+
grant_emails: grantEmails,
|
|
4694
|
+
link_expires_at: body?.link_expires_at ?? null
|
|
4650
4695
|
}
|
|
4651
4696
|
}, mode);
|
|
4652
4697
|
}
|
|
@@ -4666,38 +4711,6 @@ async function resolveProjectIdByName(projectName, token, options, init, errorOp
|
|
|
4666
4711
|
return { projectId: candidates[0].project_id };
|
|
4667
4712
|
}
|
|
4668
4713
|
//#endregion
|
|
4669
|
-
//#region src/command-runners/request-access.ts
|
|
4670
|
-
const NOTE_MAX = 2e3;
|
|
4671
|
-
async function runRequestAccess(parsed, mode) {
|
|
4672
|
-
const command = "request-access";
|
|
4673
|
-
const note = parsed.options.note;
|
|
4674
|
-
if (note !== void 0 && note.length > NOTE_MAX) return writeFailure(command, validationError(`A note can be at most ${NOTE_MAX} characters.`, "Shorten --note and retry."), mode, 1);
|
|
4675
|
-
const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
|
|
4676
|
-
if (!credential.ok) return writeFailure(command, credential.error, mode, 1);
|
|
4677
|
-
const request = await requestConfig(parsed.options);
|
|
4678
|
-
if (request.error) return writeFailure(command, request.error, mode, 1);
|
|
4679
|
-
const result = await runAuthenticatedApi(credential, parsed.options, async (current) => {
|
|
4680
|
-
const requested = await apiPost("/api/cli/request-access", current.token, { note }, parsed.options, request.init, {
|
|
4681
|
-
credentialSource: current.source,
|
|
4682
|
-
profile: current.profile,
|
|
4683
|
-
profileCredentialKind: current.profileCredentialKind
|
|
4684
|
-
});
|
|
4685
|
-
return requested.error ? { error: requested.error } : { data: requested.body };
|
|
4686
|
-
});
|
|
4687
|
-
if (result.error) return writeFailure(command, result.error, mode, 1);
|
|
4688
|
-
const body = result.data;
|
|
4689
|
-
const data = {
|
|
4690
|
-
requested: body?.requested === true,
|
|
4691
|
-
already_enabled: body?.already_enabled === true,
|
|
4692
|
-
status: typeof body?.status === "string" ? body.status : null,
|
|
4693
|
-
created: body?.created === true,
|
|
4694
|
-
requires_operator_action: body?.requires_operator_action === true,
|
|
4695
|
-
message: typeof body?.message === "string" ? body.message : ""
|
|
4696
|
-
};
|
|
4697
|
-
writeSuccess(command, data, mode);
|
|
4698
|
-
if (!mode.json && data.message) writeText(`${data.message}\n`);
|
|
4699
|
-
}
|
|
4700
|
-
//#endregion
|
|
4701
4714
|
//#region src/command-runners/resolve.ts
|
|
4702
4715
|
async function runResolve(parsed, mode) {
|
|
4703
4716
|
const command = "resolve";
|
|
@@ -4783,6 +4796,61 @@ async function runUpdate(parsed, mode, isRetry = false) {
|
|
|
4783
4796
|
return writeSuccess(command, result, mode);
|
|
4784
4797
|
}
|
|
4785
4798
|
//#endregion
|
|
4799
|
+
//#region src/command-runners/append.ts
|
|
4800
|
+
async function runAppend(parsed, mode, isRetry = false) {
|
|
4801
|
+
const command = "append";
|
|
4802
|
+
const input = parsed.positionals[0];
|
|
4803
|
+
const path = parsed.positionals[1];
|
|
4804
|
+
if (!input) return writeFailure(command, validationError("Artifact is required.", "Pass an artifact ID or share URL."), mode, 1);
|
|
4805
|
+
if (!path) return writeFailure(command, validationError("Path is required.", "Pass a non-empty UTF-8 file."), mode, 1);
|
|
4806
|
+
const id = resolveArtifactId(input);
|
|
4807
|
+
if (!id) return writeFailure(command, targetResolutionError(input, "append"), mode, 1);
|
|
4808
|
+
const s = await stat(path).catch(() => null);
|
|
4809
|
+
if (!s || !s.isFile() || s.size === 0) return writeFailure(command, validationError("Path must be a non-empty file.", "Append supports one non-empty UTF-8 file for Markdown or HTML artifacts."), mode, 1);
|
|
4810
|
+
const bytes = await readFile(path);
|
|
4811
|
+
let content;
|
|
4812
|
+
try {
|
|
4813
|
+
content = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
4814
|
+
} catch {
|
|
4815
|
+
return writeFailure(command, validationError("File is not valid UTF-8.", "Use a non-empty UTF-8 file and retry."), mode, 1);
|
|
4816
|
+
}
|
|
4817
|
+
const credential = await resolveCredential(parsed.options, await resolveProjectConfig());
|
|
4818
|
+
if (!credential.ok) return handleCredentialFailure(command, credential, parsed.options, mode, () => runAppend(parsed, mode, true), isRetry);
|
|
4819
|
+
const request = await requestConfig(parsed.options);
|
|
4820
|
+
if (request.error) return writeFailure(command, request.error, mode, 1);
|
|
4821
|
+
const response = await cliFetch(apiUrl(`/api/cli/artifacts/${encodeURIComponent(id)}/append`, baseUrlOf(parsed.options)), {
|
|
4822
|
+
method: "POST",
|
|
4823
|
+
headers: {
|
|
4824
|
+
Authorization: `Bearer ${credential.token}`,
|
|
4825
|
+
"Content-Type": "application/json"
|
|
4826
|
+
},
|
|
4827
|
+
body: JSON.stringify({ content }),
|
|
4828
|
+
...request.init
|
|
4829
|
+
});
|
|
4830
|
+
if ("networkError" in response) return writeFailure(command, appendOutcomeUnknownError(id, response.networkError), mode, 1);
|
|
4831
|
+
const body = await readJson(response);
|
|
4832
|
+
if (!response.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(response.status, body, {
|
|
4833
|
+
authenticated: true,
|
|
4834
|
+
artifactTarget: true,
|
|
4835
|
+
operation: "append",
|
|
4836
|
+
baseUrl: baseUrlOf(parsed.options),
|
|
4837
|
+
credentialSource: credential.source,
|
|
4838
|
+
profile: credential.profile,
|
|
4839
|
+
profileCredentialKind: credential.profileCredentialKind
|
|
4840
|
+
}), credential, parsed.options, mode, () => runAppend(parsed, mode, true), isRetry);
|
|
4841
|
+
const success = {
|
|
4842
|
+
artifact: {
|
|
4843
|
+
id: body?.id ?? id,
|
|
4844
|
+
url: body?.shareUrl ?? `${baseUrlOf(parsed.options)}/a/${id}`,
|
|
4845
|
+
kind: body?.artifactKind
|
|
4846
|
+
},
|
|
4847
|
+
version: { id: body?.versionId },
|
|
4848
|
+
result: { appended: true }
|
|
4849
|
+
};
|
|
4850
|
+
if (!updateSuccessFields(success)) return writeFailure(command, validationError("Append succeeded but the response was incomplete.", "Retry the command."), mode, 1);
|
|
4851
|
+
return writeSuccess(command, success, mode);
|
|
4852
|
+
}
|
|
4853
|
+
//#endregion
|
|
4786
4854
|
//#region src/command-runners/whoami.ts
|
|
4787
4855
|
async function runWhoami(parsed, mode) {
|
|
4788
4856
|
const command = "whoami";
|
|
@@ -5026,6 +5094,10 @@ async function updateRunner(ctx) {
|
|
|
5026
5094
|
const parsed = parsedArgsFromContext("update", ctx);
|
|
5027
5095
|
return await runWithSkillAutoUpdate(parsed, () => runUpdate(parsed, outputMode(parsed.options)));
|
|
5028
5096
|
}
|
|
5097
|
+
async function appendRunner(ctx) {
|
|
5098
|
+
const parsed = parsedArgsFromContext("append", ctx);
|
|
5099
|
+
return await runWithSkillAutoUpdate(parsed, () => runAppend(parsed, outputMode(parsed.options)));
|
|
5100
|
+
}
|
|
5029
5101
|
async function editRunner(ctx) {
|
|
5030
5102
|
const parsed = parsedArgsFromContext("edit", ctx);
|
|
5031
5103
|
return await runWithSkillAutoUpdate(parsed, () => runEdit(parsed, outputMode(parsed.options)));
|
|
@@ -5082,10 +5154,6 @@ async function commentsDeleteRunner(ctx) {
|
|
|
5082
5154
|
const parsed = parsedArgsFromContext("comments delete", ctx);
|
|
5083
5155
|
return await runWithSkillAutoUpdate(parsed, () => runCommentsDelete(parsed, outputMode(parsed.options)));
|
|
5084
5156
|
}
|
|
5085
|
-
async function requestAccessRunner(ctx) {
|
|
5086
|
-
const parsed = parsedArgsFromContext("request-access", ctx);
|
|
5087
|
-
return await runWithSkillAutoUpdate(parsed, () => runRequestAccess(parsed, outputMode(parsed.options)));
|
|
5088
|
-
}
|
|
5089
5157
|
async function whoamiRunner(ctx) {
|
|
5090
5158
|
const parsed = parsedArgsFromContext("whoami", ctx);
|
|
5091
5159
|
return await runWithSkillAutoUpdate(parsed, () => runWhoami(parsed, outputMode(parsed.options)));
|
|
@@ -5243,16 +5311,18 @@ async function main(rawArgv) {
|
|
|
5243
5311
|
if (usage) writeText(usage);
|
|
5244
5312
|
}
|
|
5245
5313
|
async function runGunshi(argv) {
|
|
5314
|
+
const version = await loadCliVersion();
|
|
5246
5315
|
return cli(argv, entryCommand, {
|
|
5247
5316
|
name: "artifactshare",
|
|
5248
5317
|
description: "Artifact Share CLI",
|
|
5249
|
-
version
|
|
5318
|
+
version,
|
|
5250
5319
|
subCommands: {
|
|
5251
5320
|
login: lazyCommand(loginDefinition, loginRunner),
|
|
5252
5321
|
logout: lazyCommand(logoutDefinition, logoutRunner),
|
|
5253
5322
|
share: lazyCommand(shareDefinition, shareRunner),
|
|
5254
5323
|
open: lazyCommand(openDefinition, openRunner),
|
|
5255
5324
|
update: lazyCommand(updateDefinition, updateRunner),
|
|
5325
|
+
append: lazyCommand(appendDefinition, appendRunner),
|
|
5256
5326
|
edit: lazyCommand(editDefinition, editRunner),
|
|
5257
5327
|
delete: lazyCommand(deleteDefinition, deleteRunner),
|
|
5258
5328
|
resolve: lazyCommand(resolveDefinition, resolveRunner),
|
|
@@ -5260,7 +5330,6 @@ async function runGunshi(argv) {
|
|
|
5260
5330
|
move: lazyCommand(moveDefinition, moveRunner),
|
|
5261
5331
|
artifacts: artifactsDefinition,
|
|
5262
5332
|
comments: commentsDefinition,
|
|
5263
|
-
"request-access": lazyCommand(requestAccessDefinition, requestAccessRunner),
|
|
5264
5333
|
whoami: lazyCommand(whoamiDefinition, whoamiRunner),
|
|
5265
5334
|
doctor: lazyCommand(doctorDefinition, doctorRunner),
|
|
5266
5335
|
changelog: lazyCommand(changelogDefinition, changelogRunner),
|
|
@@ -5340,7 +5409,6 @@ npx --yes @artifactshare/cli skills install --tool codex --json
|
|
|
5340
5409
|
npx --yes @artifactshare/cli skills list --json
|
|
5341
5410
|
npx --yes @artifactshare/cli init --profile <name> --project-id <id> --json
|
|
5342
5411
|
npx --yes @artifactshare/cli share <path> --home --json
|
|
5343
|
-
npx --yes @artifactshare/cli request-access --json
|
|
5344
5412
|
npx --yes @artifactshare/cli whoami --json
|
|
5345
5413
|
npx --yes @artifactshare/cli doctor --json
|
|
5346
5414
|
|
|
@@ -5352,7 +5420,7 @@ Common failures:
|
|
|
5352
5420
|
auth_required Use ${TOKEN_ENV_VAR} or ${TOKEN_OPTION}; tokens are issued at ${DEFAULT_BASE_URL}/settings/tokens
|
|
5353
5421
|
invalid_destination Choose --project-id <id> or --home
|
|
5354
5422
|
target_not_found Use an artifact ID, share URL, or sandbox URL
|
|
5355
|
-
upload_not_allowed
|
|
5423
|
+
upload_not_allowed Sharing is temporarily unavailable; contact Artifact Share support`,
|
|
5356
5424
|
run: () => {}
|
|
5357
5425
|
});
|
|
5358
5426
|
const loginDefinition = define({
|
|
@@ -5415,7 +5483,17 @@ const shareDefinition = define({
|
|
|
5415
5483
|
visibility: {
|
|
5416
5484
|
type: "string",
|
|
5417
5485
|
toKebab: true,
|
|
5418
|
-
description: "private, workspace, or
|
|
5486
|
+
description: "private, workspace, project, or link (default: project for a project destination, otherwise resolved from config)"
|
|
5487
|
+
},
|
|
5488
|
+
linkExpiresAt: {
|
|
5489
|
+
type: "string",
|
|
5490
|
+
toKebab: true,
|
|
5491
|
+
description: "Set a finite link expiry as an RFC3339 UTC timestamp"
|
|
5492
|
+
},
|
|
5493
|
+
noLinkExpiry: {
|
|
5494
|
+
type: "boolean",
|
|
5495
|
+
toKebab: true,
|
|
5496
|
+
description: "Set link sharing to unlimited expiry"
|
|
5419
5497
|
},
|
|
5420
5498
|
grantEmail: {
|
|
5421
5499
|
type: "string",
|
|
@@ -5438,7 +5516,9 @@ With no destination, share posts to home. Choose the setting by purpose:
|
|
|
5438
5516
|
npx --yes @artifactshare/cli config set home_audience private --scope user --json
|
|
5439
5517
|
Shared policy agreed by all repository participants:
|
|
5440
5518
|
npx --yes @artifactshare/cli config set home_audience workspace --scope repository --json
|
|
5441
|
-
One-time audience for a single post: pass --visibility private|workspace.
|
|
5519
|
+
One-time audience for a single post: pass --visibility private|workspace|link.
|
|
5520
|
+
Link sharing accepts --link-expires-at <RFC3339 UTC> or --no-link-expiry;
|
|
5521
|
+
these expiry options are mutually exclusive.
|
|
5442
5522
|
Check the resolved audience before posting:
|
|
5443
5523
|
npx --yes @artifactshare/cli config get home_audience --scope effective --json
|
|
5444
5524
|
|
|
@@ -5449,7 +5529,7 @@ For repeat jobs, use --key: first share creates the artifact, later runs add ver
|
|
|
5449
5529
|
|
|
5450
5530
|
Common failures:
|
|
5451
5531
|
auth_required Set ARTIFACTSHARE_TOKEN before share
|
|
5452
|
-
upload_not_allowed
|
|
5532
|
+
upload_not_allowed Publishing is temporarily unavailable; contact Artifact Share support
|
|
5453
5533
|
file_too_large Reduce file or directory size and retry
|
|
5454
5534
|
validation_failed Check file type (.html / .md for single files) and directory layout
|
|
5455
5535
|
key_target_moved The artifact for --key moved; update it by ID or use a new key
|
|
@@ -5479,10 +5559,28 @@ Common failures:
|
|
|
5479
5559
|
auth_required Set ARTIFACTSHARE_TOKEN before update
|
|
5480
5560
|
target_not_found Retry with an artifact ID, share URL, or sandbox URL
|
|
5481
5561
|
artifact_kind_mismatch Use a file for single-file artifacts or a directory for static sites
|
|
5482
|
-
upload_not_allowed
|
|
5562
|
+
upload_not_allowed Publishing is temporarily unavailable; contact Artifact Share support
|
|
5483
5563
|
file_too_large Reduce file or directory size and retry
|
|
5484
5564
|
validation_failed Check file type (.html / .md for single files) and directory layout`
|
|
5485
5565
|
});
|
|
5566
|
+
const appendDefinition = define({
|
|
5567
|
+
name: "append",
|
|
5568
|
+
description: "Append a local file to an existing Markdown or HTML artifact.",
|
|
5569
|
+
toKebab: true,
|
|
5570
|
+
args: {
|
|
5571
|
+
...commonArgs,
|
|
5572
|
+
artifactIdOrUrl: {
|
|
5573
|
+
type: "positional",
|
|
5574
|
+
toKebab: true,
|
|
5575
|
+
description: "Artifact ID or share URL"
|
|
5576
|
+
},
|
|
5577
|
+
path: {
|
|
5578
|
+
type: "positional",
|
|
5579
|
+
description: "Non-empty UTF-8 file to append"
|
|
5580
|
+
}
|
|
5581
|
+
},
|
|
5582
|
+
examples: `Append <path> to the current source of an existing artifact.\n\nStatic sites are not supported. Use update to replace the full source instead.`
|
|
5583
|
+
});
|
|
5486
5584
|
const editDefinition = define({
|
|
5487
5585
|
name: "edit",
|
|
5488
5586
|
description: "Edit artifact title, sharing, or project placement.",
|
|
@@ -5502,7 +5600,17 @@ const editDefinition = define({
|
|
|
5502
5600
|
visibility: {
|
|
5503
5601
|
type: "string",
|
|
5504
5602
|
toKebab: true,
|
|
5505
|
-
description: "private or
|
|
5603
|
+
description: "private, workspace, or link"
|
|
5604
|
+
},
|
|
5605
|
+
linkExpiresAt: {
|
|
5606
|
+
type: "string",
|
|
5607
|
+
toKebab: true,
|
|
5608
|
+
description: "Set a finite link expiry as an RFC3339 UTC timestamp"
|
|
5609
|
+
},
|
|
5610
|
+
noLinkExpiry: {
|
|
5611
|
+
type: "boolean",
|
|
5612
|
+
toKebab: true,
|
|
5613
|
+
description: "Set link sharing to unlimited expiry"
|
|
5506
5614
|
},
|
|
5507
5615
|
grantEmail: {
|
|
5508
5616
|
type: "string",
|
|
@@ -5532,6 +5640,8 @@ const editDefinition = define({
|
|
|
5532
5640
|
npx --yes @artifactshare/cli edit https://artifactshare.com/a/abc123def4 --project-id prj123 --json
|
|
5533
5641
|
npx --yes @artifactshare/cli edit abc123def4 --home --json
|
|
5534
5642
|
|
|
5643
|
+
Link sharing accepts --visibility link with either --link-expires-at <RFC3339 UTC> or --no-link-expiry. These expiry options are mutually exclusive.
|
|
5644
|
+
|
|
5535
5645
|
Edit changes artifact settings without adding a new version. Use update to replace content.
|
|
5536
5646
|
Move remains available for placement-only automation; edit is the main command for post-share settings.
|
|
5537
5647
|
|
|
@@ -5714,7 +5824,8 @@ const artifactsGetDefinition = define({
|
|
|
5714
5824
|
npx --yes @artifactshare/cli artifacts get abc123def4 --offset 200000 --json
|
|
5715
5825
|
|
|
5716
5826
|
Use resolve first when a user gives a title or project name, then pass the id here.
|
|
5717
|
-
|
|
5827
|
+
Read the successful JSON from data.content (the source) and data.version_id (the current version).
|
|
5828
|
+
The response also includes data.truncated and data.next_offset. If data.truncated is true, call again with --offset set to data.next_offset and concatenate data.content until data.truncated is false.
|
|
5718
5829
|
|
|
5719
5830
|
Common failures:
|
|
5720
5831
|
auth_required Set ARTIFACTSHARE_TOKEN before artifacts get
|
|
@@ -6161,7 +6272,7 @@ The response includes project.id and next_command for share --project-id.
|
|
|
6161
6272
|
|
|
6162
6273
|
Common failures:
|
|
6163
6274
|
auth_required Set ARTIFACTSHARE_TOKEN before projects create
|
|
6164
|
-
upload_not_allowed
|
|
6275
|
+
upload_not_allowed Publishing is temporarily unavailable; contact Artifact Share support
|
|
6165
6276
|
validation_failed Pass a non-empty name and valid --visibility`
|
|
6166
6277
|
});
|
|
6167
6278
|
const projectsEditDefinition = define({
|
|
@@ -6401,27 +6512,6 @@ Common failures:
|
|
|
6401
6512
|
skill_update_conflict An unmanaged or broken skill file exists; inspect it before overwriting
|
|
6402
6513
|
profile_not_found Run profiles list to see saved profiles, or login --profile <name>`
|
|
6403
6514
|
});
|
|
6404
|
-
const requestAccessDefinition = define({
|
|
6405
|
-
name: "request-access",
|
|
6406
|
-
description: "Join the early-access waitlist for sharing.",
|
|
6407
|
-
toKebab: true,
|
|
6408
|
-
args: {
|
|
6409
|
-
...commonArgs,
|
|
6410
|
-
note: {
|
|
6411
|
-
type: "string",
|
|
6412
|
-
toKebab: true,
|
|
6413
|
-
description: "Optional message for the Artifact Share team (max 2000 characters)"
|
|
6414
|
-
}
|
|
6415
|
-
},
|
|
6416
|
-
examples: `npx --yes @artifactshare/cli request-access --json
|
|
6417
|
-
npx --yes @artifactshare/cli request-access --note "Sharing weekly reports for my team" --json
|
|
6418
|
-
|
|
6419
|
-
Joining the waitlist does not enable sharing immediately; an operator opens it.
|
|
6420
|
-
Re-running updates your note without creating a duplicate entry.
|
|
6421
|
-
|
|
6422
|
-
Common failures:
|
|
6423
|
-
auth_required Set ARTIFACTSHARE_TOKEN, pass --token, or login --profile <name>`
|
|
6424
|
-
});
|
|
6425
6515
|
const whoamiDefinition = define({
|
|
6426
6516
|
name: "whoami",
|
|
6427
6517
|
description: "Show the authenticated CLI user.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artifactshare/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
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",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"gunshi": "^0.
|
|
36
|
-
"undici": "^8.
|
|
35
|
+
"gunshi": "^0.37.0",
|
|
36
|
+
"undici": "^8.7.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "
|
|
40
|
-
"tsdown": "
|
|
39
|
+
"@types/node": "22.20.1",
|
|
40
|
+
"tsdown": "0.22.8",
|
|
41
41
|
"typescript": "6.0.3",
|
|
42
|
-
"vitest": "4.1.
|
|
42
|
+
"vitest": "4.1.10"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsdown",
|
|
@@ -4,7 +4,7 @@ description: Share, publish, upload, host, update, open, or read back existing f
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!-- artifactshare-skill
|
|
7
|
-
version:
|
|
7
|
+
version: 30
|
|
8
8
|
managed: true
|
|
9
9
|
-->
|
|
10
10
|
|
|
@@ -40,21 +40,23 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
|
|
|
40
40
|
|
|
41
41
|
## Quick reference
|
|
42
42
|
|
|
43
|
-
| Task
|
|
44
|
-
|
|
|
45
|
-
| Share a file or folder
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
43
|
+
| Task | Command |
|
|
44
|
+
| ------------------------ | ------------------------------------------------------------------------- |
|
|
45
|
+
| Share a file or folder | `share <path> --json` |
|
|
46
|
+
| Share a link with expiry | `share <path> --visibility link --link-expires-at '<RFC3339 UTC>' --json` |
|
|
47
|
+
| Replace with same URL | `update <target> <path> --json` |
|
|
48
|
+
| Append to same URL | `append <target> <path> --json` |
|
|
49
|
+
| Read back source | `artifacts get <target> --json` |
|
|
50
|
+
| Download a site bundle | `download <target> --output ./out --json` |
|
|
51
|
+
| List your artifacts | `artifacts list --json` |
|
|
52
|
+
| Post a comment | `comments post <target> --body '<text>' --json` |
|
|
53
|
+
| Read comments | `comments list <target> --json` |
|
|
54
|
+
| Change title or sharing | `edit <target> --title 'New' --json` |
|
|
55
|
+
| Move to a project | `edit <target> --project-id <id> --json` |
|
|
56
|
+
| Create a project | `projects create 'Name' --json` |
|
|
57
|
+
| Find an ID from a title | `resolve <value> --json` |
|
|
58
|
+
| Open a share URL | `open <url> --json` |
|
|
59
|
+
| Log out locally | `logout --profile <name> --json` |
|
|
58
60
|
|
|
59
61
|
## Authentication
|
|
60
62
|
|
|
@@ -78,7 +80,9 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
|
|
|
78
80
|
|
|
79
81
|
## Share
|
|
80
82
|
|
|
81
|
-
Use `share` for new files. Use `update` to replace an existing artifact.
|
|
83
|
+
Use `share` for new files. Use `update` to replace an existing artifact. Use
|
|
84
|
+
`append` to add a non-empty UTF-8 file exactly as-is to a single-file Markdown
|
|
85
|
+
or HTML artifact; it adds no newline or separator and does not support sites.
|
|
82
86
|
|
|
83
87
|
```bash
|
|
84
88
|
npx --yes @artifactshare/cli share ./report.html --json
|
|
@@ -97,12 +101,17 @@ npx --yes @artifactshare/cli share ./site-dir --project-id <id> --json
|
|
|
97
101
|
- Choose `home_audience` by purpose: use `config set home_audience private
|
|
98
102
|
--scope user --json` for a personal safe default in this CLI environment,
|
|
99
103
|
use `--scope repository` only for a policy agreed by all participants, and
|
|
100
|
-
use `--visibility private|workspace` for one home post.
|
|
104
|
+
use `--visibility private|workspace|link` for one home post.
|
|
101
105
|
- Confirm the resolved home audience before posting with
|
|
102
106
|
`config get home_audience --scope effective --json`.
|
|
103
|
-
- Set visibility at share time with `--visibility private|workspace|project`.
|
|
107
|
+
- Set visibility at share time with `--visibility private|workspace|project|link`.
|
|
104
108
|
This is a per-post override; `--grant-email` does not change the resolved
|
|
105
109
|
default visibility.
|
|
110
|
+
- For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or
|
|
111
|
+
`--no-link-expiry`. Omit both to use the workspace default.
|
|
112
|
+
- A workspace policy may allow a finite expiry from 1 to 365 days or unlimited
|
|
113
|
+
expiry. The initial default is 30 days and the initial maximum is 90 days.
|
|
114
|
+
`link_expires_at` in the result is the confirmed UTC timestamp or `null`.
|
|
106
115
|
- For repeat jobs with a stable caller-owned name, use
|
|
107
116
|
`share <path> --key <key> --json`: the first run creates the artifact, later
|
|
108
117
|
runs add versions to the same artifact.
|
|
@@ -124,7 +133,7 @@ Use the user scope for a personal safe default in this CLI environment, the
|
|
|
124
133
|
repository scope only for a policy agreed by all participants, and
|
|
125
134
|
`--visibility` for a one-time audience.
|
|
126
135
|
|
|
127
|
-
Use `--visibility private|workspace|project` as a per-post override. For new
|
|
136
|
+
Use `--visibility private|workspace|project|link` as a per-post override. For new
|
|
128
137
|
projects, pass `projects create --visibility private|workspace`; persistent
|
|
129
138
|
project defaults are documented in `projects create --help`.
|
|
130
139
|
|
|
@@ -163,6 +172,7 @@ npx --yes @artifactshare/cli artifacts get <artifact-id-or-url> --include versio
|
|
|
163
172
|
npx --yes @artifactshare/cli download <artifact-id-or-url> --output ./out --json
|
|
164
173
|
```
|
|
165
174
|
|
|
175
|
+
- In the successful JSON response, read the source from `data.content` and the current version from `data.version_id`.
|
|
166
176
|
- If `artifacts get` returns `truncated: true`, call again with `--offset` set
|
|
167
177
|
to `next_offset`.
|
|
168
178
|
- `--include versions` and `--include comments` fetch version history or
|
|
@@ -223,6 +233,15 @@ npx --yes @artifactshare/cli delete <artifact-id-or-url> --json
|
|
|
223
233
|
|
|
224
234
|
- `edit` changes title, visibility, explicit viewers, or project placement
|
|
225
235
|
without adding a new version.
|
|
236
|
+
- Set `--visibility link` with `--link-expires-at <RFC3339 UTC>` for a finite
|
|
237
|
+
expiry or `--no-link-expiry` for unlimited expiry. The expiry options are
|
|
238
|
+
mutually exclusive; omit both to preserve an existing link expiry.
|
|
239
|
+
- If `edit` changes visibility away from `link`, the link expiry is cleared.
|
|
240
|
+
If a link operation fails, do not retry unchanged input: use
|
|
241
|
+
`link_sharing_plan_required` to report that Plus or Team is required,
|
|
242
|
+
`link_sharing_disabled` to ask a Team owner or admin to enable link sharing,
|
|
243
|
+
or `link_expiry_invalid` to pass a future RFC3339 UTC timestamp within policy
|
|
244
|
+
(or use `--no-link-expiry` when the policy allows it).
|
|
226
245
|
- Moving a `project` visibility artifact home makes it `private`, because home
|
|
227
246
|
has no project audience.
|
|
228
247
|
- The older `move` command remains available for placement-only automation, but
|
|
@@ -4,7 +4,7 @@ alwaysApply: false
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!-- artifactshare-skill
|
|
7
|
-
version:
|
|
7
|
+
version: 30
|
|
8
8
|
managed: true
|
|
9
9
|
-->
|
|
10
10
|
|
|
@@ -31,28 +31,41 @@ sites, and Artifact Share URLs.
|
|
|
31
31
|
Use the CLI for local files and folders. The remote MCP tools accept HTML or
|
|
32
32
|
Markdown source strings; they cannot read paths like `/Users/.../report.html`
|
|
33
33
|
from the user's filesystem.
|
|
34
|
+
Use `append <target> <path> --json` to append a non-empty UTF-8 file exactly
|
|
35
|
+
as-is to a single-file Markdown or HTML artifact. It inserts no separator and
|
|
36
|
+
does not support static sites.
|
|
34
37
|
|
|
35
38
|
Quote paths and free-form text before passing them through a shell. Paths may
|
|
36
39
|
contain `$`, spaces, `*`, or `?`; use single quotes such as
|
|
37
40
|
`'apps/web/app/routes/a.$id/index.tsx'` so the shell does not expand them.
|
|
38
41
|
|
|
39
42
|
- Always pass `--json`; on failure read `error.code`, `error.hint`, and `error.recovery`.
|
|
43
|
+
- Link sharing is available on Plus and Team only. Use `--visibility link` with
|
|
44
|
+
exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit
|
|
45
|
+
both to use the workspace default on share or preserve the current expiry on
|
|
46
|
+
edit. Results expose `link_expires_at` as a UTC timestamp or `null`.
|
|
40
47
|
- 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`.
|
|
41
48
|
- 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`. Imported API-token profiles are not renewed by the CLI. Add `--allow-plaintext-token-store` only on a trusted machine without a native token store.
|
|
42
49
|
- Use `login --profile <name> --json` when a user is present for browser approval. The pending event on stderr includes `browser_open`. Profiles created by `login` renew expired CLI sessions automatically.
|
|
43
50
|
- Remove a saved local credential with `logout --profile <name> --json`; this keeps profile metadata and does not revoke API tokens on the server.
|
|
44
51
|
- Switch profiles with `profiles use <name> --json`; list with `profiles list --json`; remove a profile entry and its credential with `profiles delete <name> --json`.
|
|
45
52
|
- 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.
|
|
46
|
-
- Share with `share <path> --json`. In JSON output, give the user `data.artifact.url`; the artifact ID is `data.artifact.id`. Do not rerun `share` just to inspect the JSON shape: without `--key`, each successful run creates a new artifact. Posting to a project delivers to the audience defined by that project. Pick it with `--project-id <id>` or `--project <name>` (by exact name), or use the saved default. With no destination, share posts to home. Choose `home_audience` by purpose: use `config set home_audience private --scope user --json` for a personal safe default in this CLI environment, use `--scope repository` only for a policy agreed by all participants, and use `--visibility private|workspace` for one home post. Confirm the resolved audience with `config get home_audience --scope effective --json`; `--grant-email` does not change the resolved default.
|
|
53
|
+
- Share with `share <path> --json`. In JSON output, give the user `data.artifact.url`; the artifact ID is `data.artifact.id`. Do not rerun `share` just to inspect the JSON shape: without `--key`, each successful run creates a new artifact. Posting to a project delivers to the audience defined by that project. Pick it with `--project-id <id>` or `--project <name>` (by exact name), or use the saved default. With no destination, share posts to home. Choose `home_audience` by purpose: use `config set home_audience private --scope user --json` for a personal safe default in this CLI environment, use `--scope repository` only for a policy agreed by all participants, and use `--visibility private|workspace|link` for one home post. For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit both to use the workspace default. Confirm the resolved audience with `config get home_audience --scope effective --json`; `--grant-email` does not change the resolved default.
|
|
47
54
|
- For new projects, pass `projects create <name> --visibility private|workspace`; persistent project defaults are documented in `projects create --help`. The complete `config --help` reference covers the canonical `home_audience`, user/repository/effective scopes, and resolution. `default_artifact_visibility` is a compatibility alias; `default_project_visibility` is the advanced project-creation default. Home resolution checks repository then user settings, including the alias at each scope, then product default `workspace`. Keyless `config get --json` returns only `home_audience`; pass an explicit key for either other setting. These settings do not change update, edit, Web, or MCP defaults.
|
|
48
55
|
- 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.
|
|
49
56
|
- To keep an existing share URL, do not use `share --artifact-id`; add a version with `update <artifact-id-or-url> <path> --json`. `update` does not change title, visibility, viewers, or placement.
|
|
50
57
|
- Read back with `artifacts get <target> --json`. Pass `--include versions` or `--include comments` to fetch history or comments in one call. If truncated, call again with `--offset` set to `next_offset`.
|
|
58
|
+
- In the successful JSON response, read the source from `data.content` and the current version from `data.version_id`. See `artifacts get --help` for the complete contract and continuation example.
|
|
51
59
|
- Download static-site bundles with `download <target> --output ./out --json`. Pass `--force` to overwrite an existing output directory.
|
|
52
60
|
- Find artifact IDs with `artifacts list --json`; filter with `--project-id <id>`, `--home`, or `--query <text>`. Resolve titles, project names, and URLs to IDs with `resolve <value> --json`.
|
|
53
61
|
- Comment with `comments post <target> --body '<text>' --json`. Reply with `--reply-to <thread-id>`. Anchor to quoted text with `--quote '<text>'`; add `--quote-before`/`--quote-after` to disambiguate. Declare the posting agent with `--agent '<name>'` (e.g. `Claude`); omit for no badge. `comments list` returns an `agent` field on agent-posted messages.
|
|
54
62
|
- Edit, resolve, reopen, and delete comments with `comments edit`, `comments resolve`, `comments reopen`, and `comments delete` using IDs from `comments list`. Comment deletion cannot be undone; omit `--message-id` from `comments delete` only when the user wants the whole thread deleted.
|
|
55
|
-
- Change post-share settings with `edit <target>`: `--title`, `--visibility`, `--grant-email`, `--revoke-email`, `--project-id`, `--home`. Moving a `project` visibility file home makes it `private`. `move` remains for placement-only automation; prefer `edit`.
|
|
63
|
+
- Change post-share settings with `edit <target>`: `--title`, `--visibility private|workspace|link`, `--link-expires-at <RFC3339 UTC>`, `--no-link-expiry`, `--grant-email`, `--revoke-email`, `--project-id`, `--home`. The expiry options are mutually exclusive; omit both to preserve an existing link expiry. Moving a `project` visibility file home makes it `private`. `move` remains for placement-only automation; prefer `edit`.
|
|
64
|
+
- For link errors, `link_sharing_plan_required` means Plus or Team is required,
|
|
65
|
+
`link_sharing_disabled` means a Team owner or admin must enable the workspace
|
|
66
|
+
setting, and `link_expiry_invalid` means the timestamp must be future and
|
|
67
|
+
within policy (or the workspace must allow `--no-link-expiry`). Follow
|
|
68
|
+
`error.recovery`; do not retry unchanged input.
|
|
56
69
|
- Permanently remove an artifact only when the user explicitly asks with `delete <artifact-id-or-url> --json`.
|
|
57
70
|
- Manage projects: `projects list --json`, `projects create <name> --json` (uses `default_project_visibility` when saved, otherwise `workspace`; pass `--visibility private` for a confidential project), `projects edit <id>` for name, description, visibility, audience (`--add-email`/`--remove-email`), and archive state (`--archive`/`--unarchive`).
|
|
58
71
|
- Save a default project with `init --project-id <id> --json`. Preview setup with `init --dry-run --json`.
|