clone

push a directory of html from the terminal and get a four-character url back. a deno cli on cloudflare

feat: report the installed CLI version

Dami committed 88745de
commit
88745def3687e7dc48236e4ec3fe5a91b33b0274
parent
54d857fd619d929fc4761fafc0fdd9eb6fecc2f8
author
Dami <dami.etoile@gmail.com>
5 files changed, +65 -8
MREADME.md6+++++-
Mcli/README.md6++++++
Mcli/main.ts17++++++++++++++---
Acli/main_test.ts31++++++++++++++++++++++++++++++
Mskills/nzip/SKILL.md13+++++++++----
M README.md +5 -1
M cli/README.md +6 -0
M cli/main.ts +14 -3
@@ -17,6 +17,7 @@
1717 // nzip — push HTML and get a tiny URL back.1818 1919 import { parseArgs } from "@std/cli/parse-args";20+import { VERSION } from "@nzip/shared";2021 import { cmdAuth } from "./commands/auth.ts";2122 import { cmdNotify } from "./commands/notify.ts";2223 import { cmdSiteGroup } from "./commands/site.ts";
@@ -27,6 +28,10 @@ import { fail, setJsonMode } from "./lib/fmt.ts";
2728 2829 const HELP = `nzip — html share tool2930 31+global:32+ nzip --help show this command guide33+ nzip --version [--json] show the installed CLI version34+3035 commands:3136 nzip3237 ├─ auth [--server URL] [--token T] authenticate against the server
@@ -65,8 +70,8 @@ notification privacy: titles and bodies may appear on a lock screen; never inclu
6570 passwords, tokens, private URLs, or sensitive personal data.6671 `;6772 68-async function main(): Promise<void> {69- const args = parseArgs(Deno.args, {73+export async function main(argv = Deno.args): Promise<void> {74+ const args = parseArgs(argv, {7075 string: [7176 "ttl",7277 "to",
@@ -84,17 +89,23 @@ async function main(): Promise<void> {
8489 "yes",8590 "list",8691 "help",92+ "version",8793 "no-password",8894 "overwrite",8995 "json",9096 "no-description",9197 "all",9298 ],93- alias: { h: "help", y: "yes" },99+ alias: { h: "help", V: "version", y: "yes" },94100 });95101 setJsonMode(args.json);96102 const [command, ...rest] = args._.map(String);97103 104+ if (args.version) {105+ console.log(args.json ? JSON.stringify({ version: VERSION }) : `nzip ${VERSION}`);106+ return;107+ }108+98109 if (args.help || !command) {99110 console.log(HELP);100111 return;
A cli/main_test.ts +31 -0
M skills/nzip/SKILL.md +9 -4
@@ -11,7 +11,8 @@ exists, but do not clone or download the nzip repository merely to install the C
1111 1212 ## Setup1313 14-1. Check for the user CLI with `command -v nzip` and `nzip --help`.14+1. Check for the user CLI with `command -v nzip`, then capture its release with15+ `nzip --version --json`.1516 2. If it is missing and Deno is available, install the latest JSR release globally:1617 1718 ```sh
@@ -58,9 +59,12 @@ Only perform these repository steps when creating or revising a local artifact:
5859 Run checks in this order and stop at the first failure that needs user input:5960 6061 1. `command -v nzip` — if missing, follow the JSR installation in Setup.61-2. `nzip --help` — confirm the installed command starts and inspect its supported command surface.62-3. `nzip status --json` — verify saved authentication, server reachability, and token validity.63-4. `nzip vault ls --json` — verify available vaults and the default vault.62+2. `nzip --version --json` — record the installed release without requiring authentication. If the63+ option is unsupported, the CLI predates version reporting; upgrade it from JSR before relying on64+ newer commands.65+3. `nzip --help` — confirm the installed command starts and inspect its supported command surface.66+4. `nzip status --json` — verify saved authentication, server reachability, and token validity.67+5. `nzip vault ls --json` — verify available vaults and the default vault.6468 6569 Use the JSON `error` and `hint` fields as the primary diagnosis. Re-run `nzip auth` for missing or6670 rejected credentials, correct the configured server for reachability failures, and ask the user to
@@ -99,6 +103,7 @@ Prefer `--json` when consuming command output programmatically.
99103 100104 ```text101105 nzip106+├─ --version [--json]102107 ├─ auth [--server URL] [--token T]103108 ├─ status104109 ├─ vault