htmlship 0.1.3 → 0.1.5
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 +3 -3
- package/dist/cli.js +35 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ CLI + MCP server for [HTMLShip](https://htmlship.com) — host and share HTML pa
|
|
|
6
6
|
# Publish an HTML file
|
|
7
7
|
npx htmlship publish report.html
|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
|
|
9
|
+
# Password-protect a page
|
|
10
|
+
npx htmlship publish report.html --password "demo-pass"
|
|
11
11
|
|
|
12
12
|
# Inspect / update / delete using the saved owner key
|
|
13
13
|
npx htmlship get <slug>
|
|
@@ -18,7 +18,7 @@ npx htmlship list-mine
|
|
|
18
18
|
|
|
19
19
|
## MCP server
|
|
20
20
|
|
|
21
|
-
`htmlship mcp` starts a stdio MCP server with three tools: `publish_html
|
|
21
|
+
`htmlship mcp` starts a stdio MCP server with three tools: `publish_html` (with optional `password`), `fetch_html`, `update_html`.
|
|
22
22
|
|
|
23
23
|
### Claude Desktop / Claude Code / Cursor
|
|
24
24
|
|
package/dist/cli.js
CHANGED
|
@@ -56,7 +56,7 @@ var VERSION;
|
|
|
56
56
|
var init_version = __esm({
|
|
57
57
|
"src/version.ts"() {
|
|
58
58
|
"use strict";
|
|
59
|
-
VERSION = "0.1.
|
|
59
|
+
VERSION = "0.1.5";
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
|
|
@@ -207,13 +207,15 @@ function buildMcpServer(client) {
|
|
|
207
207
|
inputSchema: {
|
|
208
208
|
html: z.string().describe("The HTML body to publish."),
|
|
209
209
|
title: z.string().optional().describe("Optional human-readable title."),
|
|
210
|
+
password: z.string().optional().describe("Optional password required before viewing the page."),
|
|
210
211
|
expires_in: z.number().int().min(1).max(60 * 24 * 7).optional().describe("Optional TTL in minutes (1\u201310080, i.e. up to 7 days).")
|
|
211
212
|
}
|
|
212
213
|
},
|
|
213
|
-
async ({ html, title, expires_in }) => {
|
|
214
|
+
async ({ html, title, password, expires_in }) => {
|
|
214
215
|
try {
|
|
215
216
|
const page = await c.publish(html, {
|
|
216
217
|
title: title ?? null,
|
|
218
|
+
password: password ?? null,
|
|
217
219
|
expiresIn: expires_in ?? null
|
|
218
220
|
});
|
|
219
221
|
return {
|
|
@@ -386,23 +388,29 @@ function createKeyStore(overrideDir) {
|
|
|
386
388
|
|
|
387
389
|
// src/commands/delete.ts
|
|
388
390
|
function registerDelete(program) {
|
|
389
|
-
program.command("delete").description("Soft-delete a page.").argument("<slug>", "Page slug").option("--owner-key <key>", "Owner key (defaults to local store)").option("-y, --yes", "Skip confirmation").action(async function(slug, opts) {
|
|
391
|
+
program.command("delete").description("Soft-delete a page.").argument("<slug>", "Page slug").option("--owner-key <key>", "Owner key (defaults to local store, else prompted)").option("-y, --yes", "Skip confirmation").action(async function(slug, opts) {
|
|
390
392
|
const keys = createKeyStore();
|
|
391
|
-
|
|
392
|
-
if (!ownerKey) {
|
|
393
|
-
throw new HTMLShipError(
|
|
394
|
-
`no owner key for '${slug}' in ${keys.file}; pass --owner-key explicitly`
|
|
395
|
-
);
|
|
396
|
-
}
|
|
397
|
-
if (!opts.yes) {
|
|
393
|
+
let ownerKey = opts.ownerKey ?? keys.lookupOwnerKey(slug);
|
|
394
|
+
if (!opts.yes || !ownerKey) {
|
|
398
395
|
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
396
|
+
try {
|
|
397
|
+
if (!opts.yes) {
|
|
398
|
+
const answer = await rl.question(`Delete page '${slug}'? [y/N] `);
|
|
399
|
+
if (!/^y(es)?$/i.test(answer.trim())) {
|
|
400
|
+
process.stderr.write("Aborted.\n");
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (!ownerKey) {
|
|
405
|
+
ownerKey = (await rl.question(`owner_key for '${slug}': `)).trim();
|
|
406
|
+
}
|
|
407
|
+
} finally {
|
|
408
|
+
rl.close();
|
|
404
409
|
}
|
|
405
410
|
}
|
|
411
|
+
if (!ownerKey) {
|
|
412
|
+
throw new HTMLShipError("owner_key is required");
|
|
413
|
+
}
|
|
406
414
|
const apiUrl = this.parent?.opts()?.apiUrl;
|
|
407
415
|
const client = new HTMLShipClient({ baseUrl: apiUrl });
|
|
408
416
|
await client.delete(slug, ownerKey);
|
|
@@ -575,15 +583,22 @@ function registerPublish(program) {
|
|
|
575
583
|
// src/commands/update.ts
|
|
576
584
|
init_client();
|
|
577
585
|
init_errors();
|
|
586
|
+
import { createInterface as createInterface2 } from "readline/promises";
|
|
578
587
|
function registerUpdate(program) {
|
|
579
|
-
program.command("update").description("Replace HTML for an existing page.").argument("<slug>", "Page slug").argument("[source]", "file path, '-' for stdin").option("-f, --file <path>", "HTML file path").option("--title <title>", "Optional new title").option("--owner-key <key>", "Owner key (defaults to local store)").action(async function(slug, source, opts) {
|
|
588
|
+
program.command("update").description("Replace HTML for an existing page.").argument("<slug>", "Page slug").argument("[source]", "file path, '-' for stdin").option("-f, --file <path>", "HTML file path").option("--title <title>", "Optional new title").option("--owner-key <key>", "Owner key (defaults to local store, else prompted)").action(async function(slug, source, opts) {
|
|
580
589
|
const html = readHtmlFromSource(source, opts.file);
|
|
581
590
|
const keys = createKeyStore();
|
|
582
|
-
|
|
591
|
+
let ownerKey = opts.ownerKey ?? keys.lookupOwnerKey(slug);
|
|
583
592
|
if (!ownerKey) {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
593
|
+
const rl = createInterface2({ input: process.stdin, output: process.stderr });
|
|
594
|
+
try {
|
|
595
|
+
ownerKey = (await rl.question(`owner_key for '${slug}': `)).trim();
|
|
596
|
+
} finally {
|
|
597
|
+
rl.close();
|
|
598
|
+
}
|
|
599
|
+
if (!ownerKey) {
|
|
600
|
+
throw new HTMLShipError("owner_key is required");
|
|
601
|
+
}
|
|
587
602
|
}
|
|
588
603
|
const apiUrl = this.parent?.opts()?.apiUrl;
|
|
589
604
|
const client = new HTMLShipClient({ baseUrl: apiUrl });
|