pageship 0.0.1 → 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.
Files changed (3) hide show
  1. package/README.md +95 -6
  2. package/dist/cli.mjs +1564 -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,93 @@ 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 are plaintext JSON outside projects. POSIX uses an owner-only directory
51
+ and 0600 files. Windows uses the current user's local app data and inherits
52
+ user-profile permissions; the CLI does not configure Windows ACLs.
53
+ `PAGESHIP_CONFIG_DIR` selects an absolute private directory. They are bound to the
54
+ exact HTTPS server origin; HTTP is allowed only on loopback for development.
55
+ Use `login --restart` for a new code. Address selection and publication are not
56
+ required for authorization. No credentials appear in command output.
57
+
58
+ ## Publish HTML
59
+
60
+ Run `pageship publish report.html --server https://api.example.com` after login.
61
+ Absolute file arguments work too. Add `--json` for structured success, source-path
62
+ collisions and address choices. If publication fails after transfer, retry with
63
+ the returned `--idempotency-key`. Reusing that key with the same input returns the
64
+ same document; a different input produces a conflict. Ordinary path collisions
65
+ never update or duplicate a document without an explicit choice.
66
+
67
+ In a terminal, select `o <number>` to open a matching document, `r <number>` to
68
+ revise it, `n` to create a separate private document, or `q` to cancel. Opening and
69
+ cancellation do not change published content. JSON returns candidates and
70
+ `resolutions` containing complete follow-up command arguments. Run those arguments
71
+ in another invocation to choose explicitly.
72
+
73
+ Use `--new` to create a separate document even when its source path matches. Use
74
+ `--revise <documentId> --expected-revision <revisionId>` from a returned candidate
75
+ to publish a revision. A concurrent publication returns `revision_conflict` and
76
+ does not overwrite the newer revision. Revisions retain document identity, URL,
77
+ visibility and old immutable content. An interrupted action returns `next` arguments
78
+ including its operation key and selected target; repeat those with unchanged bytes.
79
+ Explicit actions require a server that advertises support; an older server returns
80
+ upgrade guidance before HTML upload.
81
+
82
+ The default per-file limit is 10,000,000 bytes, configurable by the server. The CLI
83
+ checks it before upload. Source paths are relative to the file's Git root, containing
84
+ working directory, or parent for outside-cwd non-Git files. Git origin URLs contribute
85
+ a normalized, credential-free hashed context. No local manifest is required.
86
+
87
+ Generated address choices use `--address-choice <choiceId>` or
88
+ `--refresh-addresses`; arbitrary subdomain input is not supported. An interactive
89
+ terminal can select, refresh or cancel. JSON and non-TTY output never waits for a
90
+ choice. Published results exit 0; unresolved choices, collisions, access and size
91
+ failures exit 2; file/request/usage failures exit 1. See the repository's
92
+ [publishing contract](../../docs/publishing.md) for details.
93
+
15
94
  ## Development
16
95
 
17
- Install the [Vite+ CLI](https://viteplus.dev/guide/) and use the exact pnpm version
18
- pinned in `package.json`.
96
+ Install dependencies from the workspace root as described in the
97
+ [root README](../../README.md). From this directory:
19
98
 
20
99
  ```sh
21
- vp install
22
100
  pnpm run check
23
101
  pnpm run build
24
102
  node dist/cli.mjs --help
@@ -27,6 +105,17 @@ npm pack --dry-run
27
105
 
28
106
  The CLI uses TypeScript and Effect v4's unstable CLI API. Effect and its Node
29
107
  platform package are pinned to matching release candidates.
108
+ The shared generated API client is a workspace development dependency bundled
109
+ into `dist/cli.mjs`. Installing the published CLI does not require the private
110
+ workspace package or a checkout of this repository.
111
+
112
+ ## Revoke installation access
113
+
114
+ `whoami --server <origin>` shows this CLI installation's non-secret ID. JSON mode
115
+ returns it in `installation.id`. Match that ID in the signed-in dashboard's CLI
116
+ installations list and select Revoke access. The next protected request returns
117
+ exit 2 with sign-in guidance; other installations remain authorized. Run `login`
118
+ with the same server to authorize again explicitly.
30
119
 
31
120
  ## License
32
121