mirrorbook 0.1.0 → 0.1.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/SKILL.md +2 -2
- package/dist/cli.js +5 -5
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mirrorbook
|
|
3
|
-
description: Publish a static HTML page, folder, or zip to a public URL on mirrorbook.
|
|
3
|
+
description: Publish a static HTML page, folder, or zip to a public URL on mirrorbook.mixdao.world with the `mirrorbook` CLI. Use when the user wants to share, host, or deploy an HTML file or a built static site.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Publishing HTML with mirrorbook
|
|
7
7
|
|
|
8
|
-
Sign in once with `npx mirrorbook login https://mirrorbook.
|
|
8
|
+
Sign in once with `npx mirrorbook login https://mirrorbook.mixdao.world`. It prints a URL and a code, opens the browser, and waits until the user approves. Ask the user to approve it; don't try to approve it yourself. In CI, set `MIRRORBOOK_TOKEN` (and `MIRRORBOOK_API_URL` for a non-default server) instead.
|
|
9
9
|
|
|
10
10
|
Several servers can be saved: `mirrorbook servers` lists them, `mirrorbook use <name>` switches, `--server <name>` picks one for a single command.
|
|
11
11
|
|
package/dist/cli.js
CHANGED
|
@@ -130,7 +130,7 @@ import { homedir } from "os";
|
|
|
130
130
|
import path from "path";
|
|
131
131
|
var DIR = path.join(process.env.XDG_CONFIG_HOME ?? path.join(homedir(), ".config"), "mirrorbook");
|
|
132
132
|
var FILE = path.join(DIR, "config.json");
|
|
133
|
-
var DEFAULT_API_URL = "https://mirrorbook.
|
|
133
|
+
var DEFAULT_API_URL = "https://mirrorbook.mixdao.world";
|
|
134
134
|
var configPath = FILE;
|
|
135
135
|
function serverNameFromUrl(url) {
|
|
136
136
|
const u = new URL(url);
|
|
@@ -249,19 +249,19 @@ var package_default = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
// src/cli.ts
|
|
252
|
-
var program = new Command().name("mirrorbook").description("Publish HTML to a shareable URL on mirrorbook.
|
|
252
|
+
var program = new Command().name("mirrorbook").description("Publish HTML to a shareable URL on mirrorbook.mixdao.world").version(package_default.version).addOption(new Option("--json", "print one JSON object to stdout (also MIRRORBOOK_JSON=1)").default(process.env.MIRRORBOOK_JSON === "1")).option("-n, --server <name>", "use a saved server for this command (env MIRRORBOOK_SERVER); see `mirrorbook servers`").option("--api-url <url>", "server URL, overrides the saved one (env MIRRORBOOK_API_URL)").option("--token <token>", "API token, overrides the saved one (env MIRRORBOOK_TOKEN)").showHelpAfterError().addHelpText(
|
|
253
253
|
"after",
|
|
254
254
|
`
|
|
255
255
|
Exit codes: 0 ok \xB7 1 error \xB7 2 usage \xB7 3 auth \xB7 4 quota \xB7 5 deployment failed or rejected
|
|
256
256
|
|
|
257
257
|
Examples:
|
|
258
|
-
$ mirrorbook login https://mirrorbook.
|
|
258
|
+
$ mirrorbook login https://mirrorbook.mixdao.world # opens the browser to approve
|
|
259
259
|
$ mirrorbook deploy ./dist --slug my-demo --wait --json
|
|
260
260
|
$ cat page.html | mirrorbook deploy - --slug quick-note
|
|
261
261
|
$ mirrorbook deploy notes.md --slug my-notes # Markdown \u2192 web page
|
|
262
262
|
$ pbpaste | mirrorbook deploy - --format markdown
|
|
263
263
|
$ mirrorbook servers # saved servers; switch with \`mirrorbook use <name>\`
|
|
264
|
-
$ MIRRORBOOK_TOKEN=mb_xxx MIRRORBOOK_API_URL=https://mirrorbook.
|
|
264
|
+
$ MIRRORBOOK_TOKEN=mb_xxx MIRRORBOOK_API_URL=https://mirrorbook.mixdao.world mirrorbook ls --json`
|
|
265
265
|
);
|
|
266
266
|
var g = () => program.opts();
|
|
267
267
|
function out(human, data) {
|
|
@@ -411,7 +411,7 @@ async function applyAccess(api, slug, o) {
|
|
|
411
411
|
return (await api.updateSite(slug, body)).site;
|
|
412
412
|
}
|
|
413
413
|
var accessLine = (s) => s.passwordProtected ? `password-protected${s.passwordExpiresAt ? `, expires ${s.passwordExpiresAt.slice(0, 16).replace("T", " ")} UTC` : ", no expiry"}` : s.visibility === "unlisted" ? "unlisted" : "public";
|
|
414
|
-
program.command("deploy").description("Publish a directory, .zip, .html, .md, or .txt file. Markdown and text are turned into a web page. Re-deploying the same slug publishes a new version.").argument("<path>", "directory (with index.html or README.md), a .zip/.html/.md/.txt file, or - for stdin").option("-s, --slug <slug>", "subdomain: <slug>.mirrorbook.
|
|
414
|
+
program.command("deploy").description("Publish a directory, .zip, .html, .md, or .txt file. Markdown and text are turned into a web page. Re-deploying the same slug publishes a new version.").argument("<path>", "directory (with index.html or README.md), a .zip/.html/.md/.txt file, or - for stdin").option("-s, --slug <slug>", "subdomain: <slug>.mirrorbook.mixdao.world (random if omitted; a suffix is added if it's taken)").option("--strict-slug", "fail with exit code 2 instead of adding a suffix when the slug is taken").option("-t, --title <title>", "site title").addOption(new Option("-f, --format <format>", "treat the input as html, markdown, or text (default: from the file extension; stdin is auto-detected)").choices(["html", "markdown", "text"])).option("-w, --wait", "wait until processing finishes").option("--timeout <sec>", "max seconds to wait", "300").option("--password <password>", "protect the site with a password (makes it unlisted; env MIRRORBOOK_SITE_PASSWORD avoids shell history)").option("--expires <when>", "how long the password stays valid: 7d, 12h, a date like 2026-12-31, or never").action(async (input, o) => {
|
|
415
415
|
const api = await client();
|
|
416
416
|
const { blob, name, files, format } = await pack(input, o.format);
|
|
417
417
|
const form = new FormData();
|