@artifactshare/cli 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +2 -0
- package/dist/index.js +159 -45
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@artifactshare/cli` are documented here.
|
|
4
|
+
For user-facing announcements, see https://artifactshare.com/updates?product=cli.
|
|
5
|
+
|
|
6
|
+
## 0.6.1 - 2026-07-12
|
|
7
|
+
|
|
8
|
+
- Fix `--insecure-localhost` failing every command with `network_failed` on Node 22/24 by routing all CLI HTTP requests through undici's own fetch
|
|
9
|
+
|
|
10
|
+
## 0.6.0 - 2026-07-11
|
|
11
|
+
|
|
12
|
+
- Add Cursor user-scope skill install and update support
|
|
13
|
+
- Move automatic skill install and update to user scope by default
|
|
14
|
+
|
|
15
|
+
## 0.5.2 - 2026-07-09
|
|
16
|
+
|
|
17
|
+
- Auto-update outdated managed user-scope skills after successful commands
|
|
18
|
+
|
|
19
|
+
## 0.5.1 - 2026-07-09
|
|
20
|
+
|
|
21
|
+
- Refresh expired session profiles automatically across authenticated API calls
|
|
22
|
+
|
|
23
|
+
## 0.5.0 - 2026-06-23
|
|
24
|
+
|
|
25
|
+
- Add `logout` to remove saved local credentials
|
|
26
|
+
|
|
27
|
+
## 0.4.1 - 2026-06-22
|
|
28
|
+
|
|
29
|
+
- Start browser approval automatically during non-interactive JSON login
|
|
30
|
+
|
|
31
|
+
## 0.4.0 - 2026-06-21
|
|
32
|
+
|
|
33
|
+
- Expand bundled skill coverage to match current CLI commands
|
|
34
|
+
- Refresh CLI login sessions during normal use
|
|
35
|
+
- Report outdated managed skills from `doctor`
|
|
36
|
+
|
|
37
|
+
## 0.1.0 - 2026-06-11
|
|
38
|
+
|
|
39
|
+
- Initial public releases (0.1.x through 0.3.x): npm publish, agent onboarding with `init` and `open`, bundled skills, `request-access`, and core share, update, download, and comment commands
|
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ runs add versions to the same file.
|
|
|
58
58
|
| `request-access` | Join the waitlist when sharing is not enabled yet |
|
|
59
59
|
| `login` / `logout` / `whoami` | Sign in, remove a saved local credential, and check who you are |
|
|
60
60
|
| `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
|
|
61
|
+
| `changelog` | Show the installed version, this release's notes, and the public updates page |
|
|
61
62
|
| `profiles list / use / import-token / delete` | Switch between local account profiles, import an issued token from stdin, and delete profile entries |
|
|
62
63
|
| `init` | Set up this directory: detect Claude Code, Codex, or Cursor and install the skill in user scope, then show next steps; or save defaults with `--profile` / `--project-id` |
|
|
63
64
|
| `skills ensure / install / list / update / remove` | Install or update the bundled usage guide in your AI agent's skills |
|
|
@@ -95,4 +96,5 @@ Quote paths and free-form text before passing them through a shell. Artifact Sha
|
|
|
95
96
|
## Links
|
|
96
97
|
|
|
97
98
|
- Setup guide for AI tools and terminals: https://artifactshare.com/connect
|
|
99
|
+
- Public updates (Web, CLI, Agent, MCP): https://artifactshare.com/updates
|
|
98
100
|
- Artifact Share: https://artifactshare.com
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { appendFile, chmod, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
3
2
|
import { cli, define, lazy } from "gunshi";
|
|
4
3
|
import { spawn } from "node:child_process";
|
|
4
|
+
import { appendFile, chmod, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import { createReadStream } from "node:fs";
|
|
9
|
+
import { Blob } from "node:buffer";
|
|
9
10
|
import { createHash } from "node:crypto";
|
|
10
11
|
//#region src/constants.ts
|
|
11
12
|
const DEFAULT_BASE_URL = "https://artifactshare.com";
|
|
@@ -86,7 +87,8 @@ const COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
|
86
87
|
"profiles",
|
|
87
88
|
"projects",
|
|
88
89
|
"skills",
|
|
89
|
-
"init"
|
|
90
|
+
"init",
|
|
91
|
+
"changelog"
|
|
90
92
|
]);
|
|
91
93
|
const SUBCOMMANDS = {
|
|
92
94
|
artifacts: ["list", "get"],
|
|
@@ -174,6 +176,16 @@ function mapApiError(status, body, options = {}) {
|
|
|
174
176
|
suggested_command: REQUEST_ACCESS_COMMAND$1
|
|
175
177
|
}
|
|
176
178
|
});
|
|
179
|
+
if (apiCode === "self-upload-disabled") return cliError({
|
|
180
|
+
code: "self_upload_disabled",
|
|
181
|
+
message: "This account cannot upload its own files.",
|
|
182
|
+
why: "Email-code sign-in creates a viewer workspace for shared files only.",
|
|
183
|
+
hint: "Sign in with Google or Microsoft on the Artifact Share website, then retry share.",
|
|
184
|
+
agentRecoverable: false,
|
|
185
|
+
requiresHuman: true,
|
|
186
|
+
recovery: { kind: "ask_human" },
|
|
187
|
+
details: { limit: "self_upload" }
|
|
188
|
+
});
|
|
177
189
|
if (apiCode === "upload-suspended") return cliError({
|
|
178
190
|
code: "upload_suspended",
|
|
179
191
|
message: apiMessage ?? "Your upload permission is suspended.",
|
|
@@ -665,6 +677,7 @@ function normalizeApiCode(value) {
|
|
|
665
677
|
return typeof value === "string" ? value : null;
|
|
666
678
|
}
|
|
667
679
|
function uploadBlockedHint(code) {
|
|
680
|
+
if (code === "self-upload-disabled") return "Sign in with Google or Microsoft on the Artifact Share website, then retry share.";
|
|
668
681
|
if (code === "upload-not-allowed") return `Run ${REQUEST_ACCESS_COMMAND$1} to join the waitlist, then retry share once an operator opens sharing.`;
|
|
669
682
|
if (code === "upload-policy-unavailable") return "Retry doctor later; upload permission could not be checked.";
|
|
670
683
|
return "Resolve the upload issue, then retry share.";
|
|
@@ -1046,6 +1059,7 @@ function humanSuccess(command, data) {
|
|
|
1046
1059
|
if (command === "doctor") return doctorHumanOutput(data);
|
|
1047
1060
|
if (command === "open") return openHumanOutput(data);
|
|
1048
1061
|
if (command === "init") return initHumanOutput(data);
|
|
1062
|
+
if (command === "changelog") return changelogHumanOutput(data);
|
|
1049
1063
|
const output = `${JSON.stringify(data, null, 2)}\n`;
|
|
1050
1064
|
return suffix ? `${output}${suffix}` : output;
|
|
1051
1065
|
}
|
|
@@ -1102,6 +1116,23 @@ function doctorNextCommand(data) {
|
|
|
1102
1116
|
if (!isRecord(data) || !("next_command" in data)) return null;
|
|
1103
1117
|
return typeof data.next_command === "string" ? data.next_command : null;
|
|
1104
1118
|
}
|
|
1119
|
+
function changelogHumanOutput(data) {
|
|
1120
|
+
if (!isRecord(data)) return `${JSON.stringify(data, null, 2)}\n`;
|
|
1121
|
+
const version = typeof data.version === "string" ? data.version : "";
|
|
1122
|
+
const updatesUrl = typeof data.updates_url === "string" ? data.updates_url : "";
|
|
1123
|
+
const lines = [
|
|
1124
|
+
`Artifact Share CLI ${version}`,
|
|
1125
|
+
"",
|
|
1126
|
+
`Updates: ${updatesUrl}`
|
|
1127
|
+
];
|
|
1128
|
+
const latest = data.latest;
|
|
1129
|
+
if (isRecord(latest) && typeof latest.body === "string" && latest.body) {
|
|
1130
|
+
const latestVersion = typeof latest.version === "string" ? latest.version : version;
|
|
1131
|
+
const latestDate = typeof latest.date === "string" ? latest.date : "";
|
|
1132
|
+
lines.push("", `Changes in ${latestVersion} (${latestDate}):`, latest.body);
|
|
1133
|
+
}
|
|
1134
|
+
return `${lines.join("\n")}\n`;
|
|
1135
|
+
}
|
|
1105
1136
|
function shareSuccessFields(data) {
|
|
1106
1137
|
if (!isRecord(data)) return null;
|
|
1107
1138
|
const artifact = data.artifact;
|
|
@@ -1159,16 +1190,32 @@ function downloadManifestFileFields(data) {
|
|
|
1159
1190
|
//#endregion
|
|
1160
1191
|
//#region src/api.ts
|
|
1161
1192
|
let insecureLocalhostDispatcher;
|
|
1193
|
+
let undiciModule$1;
|
|
1194
|
+
async function loadUndici() {
|
|
1195
|
+
return undiciModule$1 ??= await import("undici");
|
|
1196
|
+
}
|
|
1162
1197
|
function baseUrlOf(options) {
|
|
1163
1198
|
return String(options.baseUrl ?? process.env.ARTIFACTSHARE_BASE_URL ?? "https://artifactshare.com").replace(/\/$/, "");
|
|
1164
1199
|
}
|
|
1165
|
-
|
|
1200
|
+
function requestConfig(options) {
|
|
1166
1201
|
if (!insecureLocalhostEnabled(options)) return { init: {} };
|
|
1167
1202
|
const baseUrl = baseUrlOf(options);
|
|
1168
1203
|
const url = new URL(baseUrl);
|
|
1169
1204
|
if (url.protocol !== "https:" || !isLocalHostname(url.hostname)) return { error: validationError("--insecure-localhost only works with local HTTPS base URLs.", "Use it only with https://localhost, https://127.0.0.1, or https://[::1].") };
|
|
1170
|
-
|
|
1171
|
-
|
|
1205
|
+
return { init: { insecureLocalhost: true } };
|
|
1206
|
+
}
|
|
1207
|
+
async function cliFetch(input, init = {}) {
|
|
1208
|
+
const { insecureLocalhost, ...fetchInit } = init;
|
|
1209
|
+
const { fetch, Agent } = await loadUndici();
|
|
1210
|
+
const requestInit = insecureLocalhost ? {
|
|
1211
|
+
...fetchInit,
|
|
1212
|
+
dispatcher: insecureLocalhostDispatcher ??= new Agent({ connect: { rejectUnauthorized: false } })
|
|
1213
|
+
} : fetchInit;
|
|
1214
|
+
try {
|
|
1215
|
+
return await fetch(input, requestInit);
|
|
1216
|
+
} catch (error) {
|
|
1217
|
+
return { networkError: error };
|
|
1218
|
+
}
|
|
1172
1219
|
}
|
|
1173
1220
|
function insecureLocalhostEnabled(options) {
|
|
1174
1221
|
return Boolean(options.insecureLocalhost) || process.env.ARTIFACTSHARE_INSECURE_LOCALHOST === "1";
|
|
@@ -1239,7 +1286,7 @@ async function apiRequest(path, options, init, errorOptions) {
|
|
|
1239
1286
|
return { body };
|
|
1240
1287
|
}
|
|
1241
1288
|
async function apiRequestRaw(path, options, init) {
|
|
1242
|
-
const response = await
|
|
1289
|
+
const response = await cliFetch(apiUrl(path, baseUrlOf(options)), init);
|
|
1243
1290
|
if ("networkError" in response) return { error: networkError(response.networkError) };
|
|
1244
1291
|
return {
|
|
1245
1292
|
response,
|
|
@@ -2070,12 +2117,12 @@ async function runLogin(parsed, mode) {
|
|
|
2070
2117
|
return writeSuccess(command, result.data, mode);
|
|
2071
2118
|
}
|
|
2072
2119
|
async function requestDeviceCode(options, init) {
|
|
2073
|
-
const response = await
|
|
2120
|
+
const response = await cliFetch(apiUrl("/api/auth/device/code", baseUrlOf(options)), {
|
|
2074
2121
|
method: "POST",
|
|
2075
2122
|
headers: { "content-type": "application/json" },
|
|
2076
2123
|
body: JSON.stringify({ client_id: DEVICE_CLIENT_ID }),
|
|
2077
2124
|
...init
|
|
2078
|
-
})
|
|
2125
|
+
});
|
|
2079
2126
|
if ("networkError" in response) return { error: networkError(response.networkError) };
|
|
2080
2127
|
const body = await readJson(response);
|
|
2081
2128
|
if (!response.ok) return { error: mapApiError(response.status, body, { baseUrl: baseUrlOf(options) }) };
|
|
@@ -2083,7 +2130,7 @@ async function requestDeviceCode(options, init) {
|
|
|
2083
2130
|
return body;
|
|
2084
2131
|
}
|
|
2085
2132
|
async function exchangeDeviceTokenOnce(options, deviceCode, init) {
|
|
2086
|
-
const response = await
|
|
2133
|
+
const response = await cliFetch(apiUrl("/api/auth/device/token", baseUrlOf(options)), {
|
|
2087
2134
|
method: "POST",
|
|
2088
2135
|
headers: { "content-type": "application/json" },
|
|
2089
2136
|
body: JSON.stringify({
|
|
@@ -2092,7 +2139,7 @@ async function exchangeDeviceTokenOnce(options, deviceCode, init) {
|
|
|
2092
2139
|
client_id: DEVICE_CLIENT_ID
|
|
2093
2140
|
}),
|
|
2094
2141
|
...init
|
|
2095
|
-
})
|
|
2142
|
+
});
|
|
2096
2143
|
if ("networkError" in response) return { error: networkError(response.networkError) };
|
|
2097
2144
|
const body = await readJson(response);
|
|
2098
2145
|
if (response.ok && isDeviceTokenResponse(body)) return {
|
|
@@ -2125,7 +2172,7 @@ async function pollForToken(options, code, init, profile, deadline) {
|
|
|
2125
2172
|
let networkFailures = 0;
|
|
2126
2173
|
while (Date.now() < deadline) {
|
|
2127
2174
|
await setTimeout$1(intervalMs);
|
|
2128
|
-
const response = await
|
|
2175
|
+
const response = await cliFetch(apiUrl("/api/auth/device/token", baseUrlOf(options)), {
|
|
2129
2176
|
method: "POST",
|
|
2130
2177
|
headers: { "content-type": "application/json" },
|
|
2131
2178
|
body: JSON.stringify({
|
|
@@ -2134,7 +2181,7 @@ async function pollForToken(options, code, init, profile, deadline) {
|
|
|
2134
2181
|
client_id: DEVICE_CLIENT_ID
|
|
2135
2182
|
}),
|
|
2136
2183
|
...init
|
|
2137
|
-
})
|
|
2184
|
+
});
|
|
2138
2185
|
if ("networkError" in response) {
|
|
2139
2186
|
networkFailures += 1;
|
|
2140
2187
|
if (networkFailures >= 5) return { error: networkError(response.networkError) };
|
|
@@ -2473,10 +2520,10 @@ async function fetchArtifact(parsed, target, credential) {
|
|
|
2473
2520
|
const url = apiUrl(`/api/cli/artifacts/${encodeURIComponent(target.artifactId)}`, baseUrlOf(parsed.options));
|
|
2474
2521
|
if (target.offset !== void 0) url.searchParams.set("offset", target.offset);
|
|
2475
2522
|
for (const item of target.include) url.searchParams.append("include", item);
|
|
2476
|
-
const response = await
|
|
2523
|
+
const response = await cliFetch(url, {
|
|
2477
2524
|
headers: { Authorization: `Bearer ${credential.token}` },
|
|
2478
2525
|
...request.init
|
|
2479
|
-
})
|
|
2526
|
+
});
|
|
2480
2527
|
if ("networkError" in response) return { error: networkError(response.networkError) };
|
|
2481
2528
|
const body = await readJson(response);
|
|
2482
2529
|
if (!response.ok) return { error: mapApiError(response.status, body, {
|
|
@@ -2508,10 +2555,10 @@ async function runArtifactsList(parsed, mode) {
|
|
|
2508
2555
|
else if (projectId) url.searchParams.set("project_id", projectId);
|
|
2509
2556
|
if (query) url.searchParams.set("query", query);
|
|
2510
2557
|
const result = await runAuthenticatedApi(credential, parsed.options, async (current) => {
|
|
2511
|
-
const response = await
|
|
2558
|
+
const response = await cliFetch(url, {
|
|
2512
2559
|
headers: { Authorization: `Bearer ${current.token}` },
|
|
2513
2560
|
...request.init
|
|
2514
|
-
})
|
|
2561
|
+
});
|
|
2515
2562
|
if ("networkError" in response) return { error: networkError(response.networkError) };
|
|
2516
2563
|
const body = await readJson(response);
|
|
2517
2564
|
if (!response.ok) return { error: mapApiError(response.status, body, {
|
|
@@ -3303,10 +3350,10 @@ async function runDoctor(parsed, mode) {
|
|
|
3303
3350
|
const request = await requestConfig(parsed.options);
|
|
3304
3351
|
if (request.error) return writeFailure(command, request.error, mode, 1);
|
|
3305
3352
|
const result = await runAuthenticatedApi(credential, parsed.options, async (current) => {
|
|
3306
|
-
const response = await
|
|
3353
|
+
const response = await cliFetch(apiUrl("/api/cli/doctor", baseUrlOf(parsed.options)), {
|
|
3307
3354
|
headers: { Authorization: `Bearer ${current.token}` },
|
|
3308
3355
|
...request.init
|
|
3309
|
-
})
|
|
3356
|
+
});
|
|
3310
3357
|
if ("networkError" in response) return { data: {
|
|
3311
3358
|
kind: "network_failed",
|
|
3312
3359
|
hint: networkError(response.networkError).hint
|
|
@@ -3406,8 +3453,75 @@ function effectiveDiagnostics(project, globalConfig) {
|
|
|
3406
3453
|
};
|
|
3407
3454
|
}
|
|
3408
3455
|
//#endregion
|
|
3456
|
+
//#region src/changelog.ts
|
|
3457
|
+
const CLI_UPDATES_URL = "https://artifactshare.com/updates?product=cli";
|
|
3458
|
+
const SECTION_HEADING = /^## (\S+) - (\d{4}-\d{2}-\d{2})$/;
|
|
3459
|
+
function extractChangelogSection(content, version) {
|
|
3460
|
+
const lines = content.split("\n");
|
|
3461
|
+
let bodyStart = -1;
|
|
3462
|
+
let date = "";
|
|
3463
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
3464
|
+
const match = lines[index]?.match(SECTION_HEADING);
|
|
3465
|
+
if (!match || match[1] !== version) continue;
|
|
3466
|
+
bodyStart = index + 1;
|
|
3467
|
+
date = match[2] ?? "";
|
|
3468
|
+
break;
|
|
3469
|
+
}
|
|
3470
|
+
if (bodyStart === -1) return null;
|
|
3471
|
+
const bodyLines = [];
|
|
3472
|
+
for (let index = bodyStart; index < lines.length; index += 1) {
|
|
3473
|
+
const line = lines[index] ?? "";
|
|
3474
|
+
if (line.startsWith("## ")) break;
|
|
3475
|
+
bodyLines.push(line);
|
|
3476
|
+
}
|
|
3477
|
+
return {
|
|
3478
|
+
version,
|
|
3479
|
+
date,
|
|
3480
|
+
body: bodyLines.join("\n").trim()
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
async function readBundledChangelog() {
|
|
3484
|
+
try {
|
|
3485
|
+
return await readFile(new URL("../CHANGELOG.md", import.meta.url), "utf8");
|
|
3486
|
+
} catch {
|
|
3487
|
+
return null;
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
function changelogDataFromContent(version, content) {
|
|
3491
|
+
return {
|
|
3492
|
+
version,
|
|
3493
|
+
updates_url: CLI_UPDATES_URL,
|
|
3494
|
+
latest: content ? extractChangelogSection(content, version) : null
|
|
3495
|
+
};
|
|
3496
|
+
}
|
|
3497
|
+
async function buildChangelogData(version) {
|
|
3498
|
+
return changelogDataFromContent(version, await readBundledChangelog());
|
|
3499
|
+
}
|
|
3500
|
+
//#endregion
|
|
3501
|
+
//#region src/version.ts
|
|
3502
|
+
async function loadCliVersion() {
|
|
3503
|
+
try {
|
|
3504
|
+
const content = await readFile(new URL("../package.json", import.meta.url), "utf8");
|
|
3505
|
+
const pkg = JSON.parse(content);
|
|
3506
|
+
return typeof pkg.version === "string" ? pkg.version : "0.0.0";
|
|
3507
|
+
} catch {
|
|
3508
|
+
return "0.0.0";
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
//#endregion
|
|
3512
|
+
//#region src/command-runners/changelog.ts
|
|
3513
|
+
async function runChangelog(_parsed, mode) {
|
|
3514
|
+
return writeSuccess("changelog", await buildChangelogData(await loadCliVersion()), mode);
|
|
3515
|
+
}
|
|
3516
|
+
//#endregion
|
|
3409
3517
|
//#region src/files.ts
|
|
3410
|
-
|
|
3518
|
+
let undiciModule;
|
|
3519
|
+
async function createUploadForm() {
|
|
3520
|
+
const { FormData } = undiciModule ??= await import("undici");
|
|
3521
|
+
return new FormData();
|
|
3522
|
+
}
|
|
3523
|
+
async function prepareUploadPayload(targetPath, fileStat, initialForm) {
|
|
3524
|
+
const form = initialForm ?? await createUploadForm();
|
|
3411
3525
|
if (fileStat.isDirectory()) {
|
|
3412
3526
|
let files;
|
|
3413
3527
|
try {
|
|
@@ -3417,16 +3531,16 @@ async function prepareUploadPayload(targetPath, fileStat, initialForm = new Form
|
|
|
3417
3531
|
throw error;
|
|
3418
3532
|
}
|
|
3419
3533
|
if (files.length === 0) return { error: validationError("Directory has no shareable files.", "Add index.html or index.md and retry.") };
|
|
3420
|
-
for (const file of files)
|
|
3534
|
+
for (const file of files) form.append("file", await blobFor(file.path), file.relativePath);
|
|
3421
3535
|
return { payload: {
|
|
3422
|
-
form
|
|
3536
|
+
form,
|
|
3423
3537
|
kind: "static_site"
|
|
3424
3538
|
} };
|
|
3425
3539
|
}
|
|
3426
3540
|
if (fileStat.isFile()) {
|
|
3427
|
-
|
|
3541
|
+
form.append("file", await blobFor(targetPath), basename(targetPath));
|
|
3428
3542
|
return { payload: {
|
|
3429
|
-
form
|
|
3543
|
+
form,
|
|
3430
3544
|
kind: artifactKindForFile(targetPath)
|
|
3431
3545
|
} };
|
|
3432
3546
|
}
|
|
@@ -3582,11 +3696,10 @@ async function runDownload(parsed, mode, isRetry = false) {
|
|
|
3582
3696
|
const request = await requestConfig(parsed.options);
|
|
3583
3697
|
if (request.error) return writeFailure(command, request.error, mode, 1);
|
|
3584
3698
|
const baseUrl = baseUrlOf(parsed.options);
|
|
3585
|
-
const
|
|
3586
|
-
const manifestResponse = await fetch(manifestUrl, {
|
|
3699
|
+
const manifestResponse = await cliFetch(apiUrl(`/api/cli/artifacts/${encodeURIComponent(artifactId)}/download`, baseUrl), {
|
|
3587
3700
|
headers: { Authorization: `Bearer ${credential.token}` },
|
|
3588
3701
|
...request.init
|
|
3589
|
-
})
|
|
3702
|
+
});
|
|
3590
3703
|
if ("networkError" in manifestResponse) return writeFailure(command, networkError(manifestResponse.networkError), mode, 1);
|
|
3591
3704
|
const body = await readJson(manifestResponse);
|
|
3592
3705
|
if (!manifestResponse.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(manifestResponse.status, body, {
|
|
@@ -3604,11 +3717,10 @@ async function runDownload(parsed, mode, isRetry = false) {
|
|
|
3604
3717
|
let backupRoot = null;
|
|
3605
3718
|
try {
|
|
3606
3719
|
for (const file of plan.value.files) {
|
|
3607
|
-
const
|
|
3608
|
-
const fileResponse = await fetch(fileUrl, {
|
|
3720
|
+
const fileResponse = await cliFetch(downloadFileUrl(baseUrl, artifactId, file.path), {
|
|
3609
3721
|
headers: { Authorization: `Bearer ${credential.token}` },
|
|
3610
3722
|
...request.init
|
|
3611
|
-
})
|
|
3723
|
+
});
|
|
3612
3724
|
if ("networkError" in fileResponse) return writeFailure(command, networkError(fileResponse.networkError), mode, 1);
|
|
3613
3725
|
if (!fileResponse.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(fileResponse.status, await readJson(fileResponse), {
|
|
3614
3726
|
authenticated: true,
|
|
@@ -4339,7 +4451,7 @@ async function runShare(parsed, mode, isRetry = false) {
|
|
|
4339
4451
|
}
|
|
4340
4452
|
const destination = resolveDestination(destinationOptions, project.config);
|
|
4341
4453
|
if (destination.error) return writeFailure(command, destination.error, mode, 1);
|
|
4342
|
-
const initialForm =
|
|
4454
|
+
const initialForm = await createUploadForm();
|
|
4343
4455
|
const grantEmails = arrayOption(parsed.options.grantEmail);
|
|
4344
4456
|
const requestedVisibility = parsed.options.visibility ?? (destination.containerId && grantEmails.length === 0 ? "project" : "private");
|
|
4345
4457
|
initialForm.set("visibility", requestedVisibility);
|
|
@@ -4353,12 +4465,12 @@ async function runShare(parsed, mode, isRetry = false) {
|
|
|
4353
4465
|
uploadUrl.searchParams.set("artifact_kind", "static_site");
|
|
4354
4466
|
if (destination.containerId) uploadUrl.searchParams.set("container_id", destination.containerId);
|
|
4355
4467
|
}
|
|
4356
|
-
const response = await
|
|
4468
|
+
const response = await cliFetch(uploadUrl, {
|
|
4357
4469
|
method: "POST",
|
|
4358
4470
|
headers: { Authorization: `Bearer ${credential.token}` },
|
|
4359
4471
|
body: upload.payload.form,
|
|
4360
4472
|
...request.init
|
|
4361
|
-
})
|
|
4473
|
+
});
|
|
4362
4474
|
if ("networkError" in response) return writeFailure(command, networkError(response.networkError), mode, 1);
|
|
4363
4475
|
const body = await readJson(response);
|
|
4364
4476
|
if (!response.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(response.status, body, {
|
|
@@ -4448,10 +4560,10 @@ async function runResolve(parsed, mode) {
|
|
|
4448
4560
|
const url = apiUrl("/api/cli/resolve", baseUrlOf(parsed.options));
|
|
4449
4561
|
url.searchParams.set("q", value);
|
|
4450
4562
|
const result = await runAuthenticatedApi(credential, parsed.options, async (current) => {
|
|
4451
|
-
const response = await
|
|
4563
|
+
const response = await cliFetch(url, {
|
|
4452
4564
|
headers: { Authorization: `Bearer ${current.token}` },
|
|
4453
4565
|
...request.init
|
|
4454
|
-
})
|
|
4566
|
+
});
|
|
4455
4567
|
if ("networkError" in response) return { error: networkError(response.networkError) };
|
|
4456
4568
|
const body = await readJson(response);
|
|
4457
4569
|
if (!response.ok) return { error: mapApiError(response.status, body, {
|
|
@@ -4491,12 +4603,12 @@ async function runUpdate(parsed, mode, isRetry = false) {
|
|
|
4491
4603
|
if (upload.error) return writeFailure(command, upload.error, mode, 1);
|
|
4492
4604
|
const updateUrl = apiUrl(`/api/shareables/${encodeURIComponent(artifactId)}/versions`, baseUrl);
|
|
4493
4605
|
if (upload.payload.kind === "static_site") updateUrl.searchParams.set("artifact_kind", "static_site");
|
|
4494
|
-
const response = await
|
|
4606
|
+
const response = await cliFetch(updateUrl, {
|
|
4495
4607
|
method: "POST",
|
|
4496
4608
|
headers: { Authorization: `Bearer ${credential.token}` },
|
|
4497
4609
|
body: upload.payload.form,
|
|
4498
4610
|
...request.init
|
|
4499
|
-
})
|
|
4611
|
+
});
|
|
4500
4612
|
if ("networkError" in response) return writeFailure(command, networkError(response.networkError), mode, 1);
|
|
4501
4613
|
const body = await readJson(response);
|
|
4502
4614
|
if (!response.ok) return handleAuthenticatedCredentialFailure(command, mapApiError(response.status, body, {
|
|
@@ -4682,6 +4794,10 @@ async function doctorRunner(ctx) {
|
|
|
4682
4794
|
const parsed = parsedArgsFromContext("doctor", ctx);
|
|
4683
4795
|
return await runDoctor(parsed, outputMode(parsed.options));
|
|
4684
4796
|
}
|
|
4797
|
+
async function changelogRunner(ctx) {
|
|
4798
|
+
const parsed = parsedArgsFromContext("changelog", ctx);
|
|
4799
|
+
return await runChangelog(parsed, outputMode(parsed.options));
|
|
4800
|
+
}
|
|
4685
4801
|
async function runWithSkillAutoUpdate(parsed, runner) {
|
|
4686
4802
|
const mode = outputMode(parsed.options);
|
|
4687
4803
|
if (!mode.json) {
|
|
@@ -4761,15 +4877,6 @@ async function main(rawArgv) {
|
|
|
4761
4877
|
});
|
|
4762
4878
|
if (usage) writeText(usage);
|
|
4763
4879
|
}
|
|
4764
|
-
async function loadCliVersion() {
|
|
4765
|
-
try {
|
|
4766
|
-
const content = await readFile(new URL("../package.json", import.meta.url), "utf8");
|
|
4767
|
-
const pkg = JSON.parse(content);
|
|
4768
|
-
return typeof pkg.version === "string" ? pkg.version : "0.0.0";
|
|
4769
|
-
} catch {
|
|
4770
|
-
return "0.0.0";
|
|
4771
|
-
}
|
|
4772
|
-
}
|
|
4773
4880
|
async function runGunshi(argv) {
|
|
4774
4881
|
return cli(argv, entryCommand, {
|
|
4775
4882
|
name: "artifactshare",
|
|
@@ -4791,6 +4898,7 @@ async function runGunshi(argv) {
|
|
|
4791
4898
|
"request-access": lazyCommand(requestAccessDefinition, requestAccessRunner),
|
|
4792
4899
|
whoami: lazyCommand(whoamiDefinition, whoamiRunner),
|
|
4793
4900
|
doctor: lazyCommand(doctorDefinition, doctorRunner),
|
|
4901
|
+
changelog: lazyCommand(changelogDefinition, changelogRunner),
|
|
4794
4902
|
profiles: profilesDefinition,
|
|
4795
4903
|
projects: projectsDefinition,
|
|
4796
4904
|
skills: skillsDefinition,
|
|
@@ -5863,6 +5971,12 @@ const doctorDefinition = define({
|
|
|
5863
5971
|
toKebab: true,
|
|
5864
5972
|
args: commonArgs
|
|
5865
5973
|
});
|
|
5974
|
+
const changelogDefinition = define({
|
|
5975
|
+
name: "changelog",
|
|
5976
|
+
description: "Show the installed CLI version, recent changes, and the public updates page.",
|
|
5977
|
+
toKebab: true,
|
|
5978
|
+
args: { json: commonArgs.json }
|
|
5979
|
+
});
|
|
5866
5980
|
const cliArgv = process.argv.slice(2);
|
|
5867
5981
|
main(cliArgv).catch((error) => {
|
|
5868
5982
|
writeFailure("unknown", unexpectedError(error), outputModeFromArgv(cliArgv), 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artifactshare/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dist",
|
|
26
26
|
"skills",
|
|
27
27
|
"README.md",
|
|
28
|
+
"CHANGELOG.md",
|
|
28
29
|
"LICENSE"
|
|
29
30
|
],
|
|
30
31
|
"publishConfig": {
|