pageship 0.0.1 → 0.1.0

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.
Files changed (3) hide show
  1. package/README.md +94 -6
  2. package/dist/cli.mjs +1591 -6
  3. package/package.json +6 -8
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Pageship
2
2
 
3
- Pageship is a planned HTML publishing service. This package is its early CLI
4
- development skeleton. It currently displays help and version information only;
5
- hosting, authentication, and publishing are not implemented.
3
+ Pageship is an HTML publishing service in development. This CLI checks a server's API
4
+ compatibility, authorizes an installation through a browser, and identifies your
5
+ personal workspace. It publishes HTML documents and revisions behind stable addresses. Private browser delivery requires the owner to sign in.
6
6
 
7
7
  Requires Node.js 24.11 or newer.
8
8
 
@@ -10,15 +10,92 @@ Requires Node.js 24.11 or newer.
10
10
  npx pageship
11
11
  npx pageship --help
12
12
  npx pageship --version
13
+ npx pageship status --server http://localhost:8787
14
+ npx pageship --json status --server http://localhost:8787
13
15
  ```
14
16
 
17
+ `status` accepts an HTTP or HTTPS server base URL and checks the API major this CLI
18
+ requires against the majors advertised by the server. Package versions do not
19
+ determine API compatibility. The request times out after 10 seconds.
20
+
21
+ The `--json` flag is global and may appear before or after `status`, including on
22
+ help, version, and invalid invocations. JSON mode writes one JSON value to stdout
23
+ without human output or prompts. Like other flags, `--json` after the `--` separator
24
+ is treated as an argument. Interactive wizard and shell-completion options are
25
+ available only in human mode.
26
+
27
+ - Exit `0`: compatible server, help, or version.
28
+ - Exit `1`: invalid arguments, network failure, or invalid server response.
29
+ - Exit `2`: incompatible API major. The result explains whether the CLI or server
30
+ needs updating, or the requested major is unsupported.
31
+
32
+ JSON status results contain `ok`, `command: "status"`, `status`, `requiredApiMajor`,
33
+ `server`, and `message`. `status` is `compatible`, `client_too_old`, `server_too_old`,
34
+ or `unsupported`. The server object contains `serverVersion`, `currentApiMajor`,
35
+ and `supportedApiMajors`. Failures contain `ok: false` and an `error` object with
36
+ `code` and `message`; codes are `usage_error`, `request_failed`, or `internal_error`.
37
+ Help and version use `command: "help"` and `command: "version"`, respectively.
38
+
39
+ ## Browser authorization
40
+
41
+ Run `pageship login --server https://api.example.com`, open the displayed link on
42
+ any machine, and approve the code using your invited GitHub account. Interactive
43
+ terminals wait for approval. JSON and non-TTY calls return immediately with a link,
44
+ code and completion arguments; then run `pageship login --complete --server
45
+ https://api.example.com`. Run `pageship whoami --server https://api.example.com`
46
+ to reuse the stored credential in a new process. Add global `--json` for structured
47
+ results. Pending or denied authorization exits 2, success exits 0, request/storage
48
+ failures exit 1, and interrupted waiting exits 130.
49
+
50
+ Credentials stay outside projects in an owner-only POSIX directory or Windows
51
+ DPAPI-protected storage under the current user's local app data.
52
+ `PAGESHIP_CONFIG_DIR` selects an absolute private directory. They are bound to the
53
+ exact HTTPS server origin; HTTP is allowed only on loopback for development.
54
+ Use `login --restart` for a new code. Address selection and publication are not
55
+ required for authorization. No credentials appear in command output.
56
+
57
+ ## Publish HTML
58
+
59
+ Run `pageship publish report.html --server https://api.example.com` after login.
60
+ Absolute file arguments work too. Add `--json` for structured success, source-path
61
+ collisions and address choices. If publication fails after transfer, retry with
62
+ the returned `--idempotency-key`. Reusing that key with the same input returns the
63
+ same document; a different input produces a conflict. Ordinary path collisions
64
+ never update or duplicate a document without an explicit choice.
65
+
66
+ In a terminal, select `o <number>` to open a matching document, `r <number>` to
67
+ revise it, `n` to create a separate private document, or `q` to cancel. Opening and
68
+ cancellation do not change published content. JSON returns candidates and
69
+ `resolutions` containing complete follow-up command arguments. Run those arguments
70
+ in another invocation to choose explicitly.
71
+
72
+ Use `--new` to create a separate document even when its source path matches. Use
73
+ `--revise <documentId> --expected-revision <revisionId>` from a returned candidate
74
+ to publish a revision. A concurrent publication returns `revision_conflict` and
75
+ does not overwrite the newer revision. Revisions retain document identity, URL,
76
+ visibility and old immutable content. An interrupted action returns `next` arguments
77
+ including its operation key and selected target; repeat those with unchanged bytes.
78
+ Explicit actions require a server that advertises support; an older server returns
79
+ upgrade guidance before HTML upload.
80
+
81
+ The default per-file limit is 10,000,000 bytes, configurable by the server. The CLI
82
+ checks it before upload. Source paths are relative to the file's Git root, containing
83
+ working directory, or parent for outside-cwd non-Git files. Git origin URLs contribute
84
+ a normalized, credential-free hashed context. No local manifest is required.
85
+
86
+ Generated address choices use `--address-choice <choiceId>` or
87
+ `--refresh-addresses`; arbitrary subdomain input is not supported. An interactive
88
+ terminal can select, refresh or cancel. JSON and non-TTY output never waits for a
89
+ choice. Published results exit 0; unresolved choices, collisions, access and size
90
+ failures exit 2; file/request/usage failures exit 1. See the repository's
91
+ [publishing contract](../../docs/publishing.md) for details.
92
+
15
93
  ## Development
16
94
 
17
- Install the [Vite+ CLI](https://viteplus.dev/guide/) and use the exact pnpm version
18
- pinned in `package.json`.
95
+ Install dependencies from the workspace root as described in the
96
+ [root README](../../README.md). From this directory:
19
97
 
20
98
  ```sh
21
- vp install
22
99
  pnpm run check
23
100
  pnpm run build
24
101
  node dist/cli.mjs --help
@@ -27,6 +104,17 @@ npm pack --dry-run
27
104
 
28
105
  The CLI uses TypeScript and Effect v4's unstable CLI API. Effect and its Node
29
106
  platform package are pinned to matching release candidates.
107
+ The shared generated API client is a workspace development dependency bundled
108
+ into `dist/cli.mjs`. Installing the published CLI does not require the private
109
+ workspace package or a checkout of this repository.
110
+
111
+ ## Revoke installation access
112
+
113
+ `whoami --server <origin>` shows this CLI installation's non-secret ID. JSON mode
114
+ returns it in `installation.id`. Match that ID in the signed-in dashboard's CLI
115
+ installations list and select Revoke access. The next protected request returns
116
+ exit 2 with sign-in guidance; other installations remain authorized. Run `login`
117
+ with the same server to authorize again explicitly.
30
118
 
31
119
  ## License
32
120