@vantienkhai/shippage-cli 0.1.0 → 0.1.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/README.md +25 -4
- package/dist/index.js +4 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,15 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Publish HTML, Markdown, and text files into Shippage from AI agents or scripts.
|
|
4
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
npm i -g @vantienkhai/shippage-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Authenticate
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
Sign in to Shippage and open the **Dashboard → CLI access** panel to copy your
|
|
14
|
+
API URL and create a long-lived API key, then export them:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
export SHIPPAGE_API_URL="https://shippage.vantienkhai-uet.workers.dev"
|
|
18
|
+
export SHIPPAGE_TOKEN="<your spg_ API key>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
> API key secrets are shown only once. Store them securely and revoke unused
|
|
22
|
+
> keys from the dashboard.
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
shippage publish ./out/article.html --title "AI Search Glossary" --slug ai-search-glossary --visibility public
|
|
28
|
+
shippage bulk "out/**/*.html" --visibility unlisted
|
|
11
29
|
shippage list
|
|
12
30
|
shippage share abc123 --visibility private --private-token
|
|
13
31
|
shippage domain add docs.example.com
|
|
32
|
+
shippage domain verify docs.example.com
|
|
14
33
|
```
|
|
15
34
|
|
|
16
35
|
For anonymous publishing, omit `SHIPPAGE_TOKEN`. Anonymous pages are ownerless until a later claim flow is added.
|
|
36
|
+
|
|
37
|
+
Visibility controls search behavior automatically: `public` pages are indexable; `unlisted` and `private` pages are `noindex`.
|
package/dist/index.js
CHANGED
|
@@ -58,21 +58,20 @@ async function publishFile(filePath, options) {
|
|
|
58
58
|
if (options.slug) form.set("slug", options.slug);
|
|
59
59
|
if (options.domain) form.set("domain", options.domain);
|
|
60
60
|
if (options.visibility) form.set("visibility", options.visibility);
|
|
61
|
-
if (options.noindex) form.set("noindex", "true");
|
|
62
61
|
return requestJson("/api/upload", {
|
|
63
62
|
method: "POST",
|
|
64
63
|
body: form
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
program.name("shippage").description("CLI for Shippage fast HTML publishing").version("0.1.0");
|
|
68
|
-
program.command("login").description("Print shell export instructions for API auth").option("--token <token>", "
|
|
67
|
+
program.command("login").description("Print shell export instructions for API auth").option("--token <token>", "Shippage API key").option("--api-url <url>", "Shippage API URL").action((options) => {
|
|
69
68
|
if (options.apiUrl) console.log(`export SHIPPAGE_API_URL=${JSON.stringify(options.apiUrl)}`);
|
|
70
69
|
if (options.token) console.log(`export SHIPPAGE_TOKEN=${JSON.stringify(options.token)}`);
|
|
71
70
|
if (!options.apiUrl && !options.token) {
|
|
72
71
|
console.log("Set SHIPPAGE_API_URL and SHIPPAGE_TOKEN in your shell or .env file.");
|
|
73
72
|
}
|
|
74
73
|
});
|
|
75
|
-
program.command("publish").argument("<file>", "HTML, Markdown, or text file").option("--title <title>", "Page title").option("--description <description>", "Page meta description").option("--slug <slug>", "Custom path slug").option("--domain <domain>", "Verified custom domain").option("--visibility <visibility>", "public, unlisted, or private", "unlisted").
|
|
74
|
+
program.command("publish").argument("<file>", "HTML, Markdown, or text file").option("--title <title>", "Page title").option("--description <description>", "Page meta description").option("--slug <slug>", "Custom path slug").option("--domain <domain>", "Verified custom domain").option("--visibility <visibility>", "public, unlisted, or private", "unlisted").action(async (file, options) => {
|
|
76
75
|
const result = await publishFile(file, options);
|
|
77
76
|
console.log(chalk.green("Published"));
|
|
78
77
|
console.log(`${result.title}: ${result.shareUrl}`);
|
|
@@ -80,7 +79,7 @@ program.command("publish").argument("<file>", "HTML, Markdown, or text file").op
|
|
|
80
79
|
console.log(`Custom URL: ${result.customUrl}`);
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
|
-
program.command("bulk").argument("<pattern>", "Glob pattern, for example out/**/*.html").option("--visibility <visibility>", "public, unlisted, or private", "unlisted").
|
|
82
|
+
program.command("bulk").argument("<pattern>", "Glob pattern, for example out/**/*.html").option("--visibility <visibility>", "public, unlisted, or private", "unlisted").action(async (pattern, options) => {
|
|
84
83
|
const files = await globby(pattern, { onlyFiles: true });
|
|
85
84
|
if (!files.length) {
|
|
86
85
|
console.log(chalk.yellow("No files matched."));
|
|
@@ -99,13 +98,12 @@ program.command("list").description("List pages owned by the current token").act
|
|
|
99
98
|
console.log(`${page.share_id} ${page.visibility} ${page.noindex ? "noindex" : "index"} ${page.canonical_path} ${page.title}`);
|
|
100
99
|
}
|
|
101
100
|
});
|
|
102
|
-
program.command("share").argument("<shareId>", "Page share id").option("--visibility <visibility>", "public, unlisted, or private").option("--
|
|
101
|
+
program.command("share").argument("<shareId>", "Page share id").option("--visibility <visibility>", "public, unlisted, or private").option("--private-token", "Generate a private token").option("--domain <domain>", "Attach to a verified custom domain").option("--slug <slug>", "Custom path slug on the domain").action(async (shareId, options) => {
|
|
103
102
|
const payload = await requestJson(`/api/pages/${shareId}`, {
|
|
104
103
|
method: "PATCH",
|
|
105
104
|
headers: { "content-type": "application/json" },
|
|
106
105
|
body: JSON.stringify({
|
|
107
106
|
visibility: options.visibility,
|
|
108
|
-
noindex: options.index ? false : options.noindex ? true : void 0,
|
|
109
107
|
privateToken: options.privateToken,
|
|
110
108
|
domain: options.domain,
|
|
111
109
|
slug: options.slug
|