pontive 1.17.0 → 1.18.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 +129 -3
  2. package/dist/cli.js +1225 -36
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,135 @@
1
1
  # pontive
2
2
 
3
- The Pontive CLI.
3
+ The Pontive CLI. It adds Pontive sign-in to an app, and when you have no
4
+ Pontive account yet it creates an **unclaimed development instance** for it:
5
+ everything the app needs to run on your machine, plus a link to claim the
6
+ instance into your workspace whenever you sign up.
4
7
 
5
8
  ```sh
6
- npx pontive@latest --help
9
+ npx pontive@latest init
7
10
  ```
8
11
 
9
- Node.js 20 or later.
12
+ Node.js 20 or later. Nothing to install first.
13
+
14
+ ## Commands
15
+
16
+ | Command | Does |
17
+ | --- | --- |
18
+ | `pontive init` | Detects the framework, installs the pontkit package with your package manager, writes the auth route and middleware, and creates an unclaimed development instance. |
19
+ | `pontive claim` | Mints a claim link, opens it in your browser, and waits up to 5 minutes for the claim. |
20
+ | `pontive status` | The instance, its region, when it is deleted unless claimed (or that it is claimed), and which `PONTIVE_*` variables are set. Names only, never values. |
21
+ | `pontive init --reset` | Creates a new unclaimed instance and points `.env.local` at it, after asking (or with `--yes`). |
22
+
23
+ `pontive <command> --help` lists each command's options.
24
+
25
+ ### `pontive init`
26
+
27
+ | Framework | Detected by | Installs | Writes |
28
+ | --- | --- | --- | --- |
29
+ | Next.js | `next` | `@pontive/pontkit-nextjs` | `lib/pontive.ts`, `app/api/auth/[...pontive]/route.ts`, `middleware.ts` (`proxy.ts` from Next 16); under `src/` when the app is |
30
+ | Vite + React | `vite` and `react` | `@pontive/pontkit-react`, `@pontive/pontkit-loader` | `src/pontive.tsx` (the provider), `vite.pontive.ts` (the dev server's `/__pontive` proxy) |
31
+ | Express | `express` | `@pontive/pontkit-server` | `pontive.ts`: `pontiveRoutes` and `pontiveSession` middleware |
32
+ | Node | anything else | `@pontive/pontkit-server` | `pontive.ts`: `handlePontive(req, res)` for `node:http` |
33
+
34
+ JavaScript projects get `.js`/`.jsx` files, CommonJS ones `require`. The package
35
+ manager is the one whose lockfile is there (npm, pnpm, yarn or bun). `init`
36
+ never overwrites a file: one that exists is skipped and reported with what to
37
+ add to it by hand. `--framework` overrides the detection; `--skip-install`
38
+ leaves the install to you.
39
+
40
+ Then the instance. Signed out (`pontive login` is not available yet, so always
41
+ for now), `init` calls `POST https://api.pontive.com/v1/unclaimed-instances`
42
+ and writes:
43
+
44
+ - **`.env.local`**: `PONTIVE_ISSUER`, `PONTIVE_CLIENT_ID`, `PONTIVE_CLIENT_SECRET`
45
+ (web apps), `PONTIVE_SESSION_SECRET` (generated on your machine),
46
+ `PONTIVE_SECRET_KEY`, `PONTIVE_INSTANCE_ID`. Appended: a line already there
47
+ is never overwritten.
48
+ - **`.pontive/keyless.json`**: the instance, its issuer and app, its region,
49
+ its expiry and the **claim token**, which is the instance's ownership. Keep
50
+ it private.
51
+ - **`.gitignore`**: `.env.local` and `.pontive/`.
52
+
53
+ The secrets come back encrypted to a P-256 key the CLI generates for the call
54
+ and keeps only in memory, so they never travel in a response body anything in
55
+ between could keep. An instance already in `.pontive/keyless.json`, or already
56
+ configured in `.env.local`, is used rather than replaced.
57
+
58
+ | Option | |
59
+ | --- | --- |
60
+ | `--region <us\|eu\|au>` | Where the instance lives, for good. Default `PONTIVE_REGION`, else the region nearest you. |
61
+ | `--name <name>` | The project's name. Default: from `package.json`. |
62
+ | `--tenancy-mode <b2c\|b2b>` | Default `b2c`. |
63
+ | `--mcp <agent>` | Connect `claude-code`, `cursor`, `gemini-cli` or `codex` to Pontive's MCP server with the new secret key. |
64
+ | `--no-mcp` | Do not offer to. |
65
+
66
+ **Connecting your coding agent.** When `init` knows the agent (from its
67
+ environment variable, or a `.mcp.json`, `.cursor/` or `.gemini/` in the
68
+ project), it offers to add Pontive's hosted MCP server, with the secret key, to
69
+ that agent's project config (`.mcp.json`, `.cursor/mcp.json`,
70
+ `.gemini/settings.json`) and gitignores the file. It never writes a key into a
71
+ file git already tracks. Codex keeps its config in your home directory, so
72
+ `init` prints what to add instead.
73
+
74
+ ### Unclaimed instances
75
+
76
+ An unclaimed instance is a development instance with Free's limits that
77
+ Pontive deletes, with its users, **7 days** after it was created unless it is
78
+ claimed. Its sign-in accepts only loopback redirects (`localhost` and
79
+ `127.0.0.1`, any port). At most 3 can be created per IP address per day.
80
+
81
+ `pontive claim` mints a claim link: single use, valid for an hour. Open it,
82
+ sign in or sign up, choose a workspace, and the instance moves into it intact:
83
+ its ids, issuer, users, apps and keys do not change, so nothing in your app
84
+ does. The CLI then removes the claim token from `.pontive/keyless.json`.
85
+ `--no-wait` prints the link and returns; `--timeout <seconds>` changes how long
86
+ it waits.
87
+
88
+ When an unclaimed instance has expired, or was claimed by someone else, the CLI
89
+ says so and stops (exit `5`); it never creates a replacement silently, since
90
+ the new instance would have none of your users. `pontive init --reset` creates
91
+ a new one when you choose to.
92
+
93
+ ## Agent mode
94
+
95
+ On when `CLAUDECODE`, `CURSOR_AGENT`, `CODEX_SANDBOX`, `GEMINI_CLI` or `CI` is
96
+ set, or with `--json`:
97
+
98
+ - no prompts: a confirmation without `--yes` is answered no;
99
+ - exactly one JSON object on stdout (progress goes to stderr);
100
+ - the claim link is printed, never opened;
101
+ - writes outside `.env.local`, `.pontive/` and the files `init` scaffolds (the
102
+ agent's MCP config, say) need `--yes`.
103
+
104
+ ```json
105
+ { "ok": false, "command": "init", "error": { "code": "unclaimed_instance_limit", "message": "…" }, "retry_after": 3600 }
106
+ ```
107
+
108
+ | Exit code | Meaning |
109
+ | --- | --- |
110
+ | `0` | Success |
111
+ | `1` | Error |
112
+ | `2` | Cancelled (declined, or `--yes` missing in agent mode) |
113
+ | `3` | Rate limited; `retry_after` is in seconds |
114
+ | `4` | Sign-in required |
115
+ | `5` | The unclaimed instance expired or was claimed away |
116
+
117
+ An agent that cannot wait 5 minutes runs `pontive claim --no-wait`, gives the
118
+ user the link, and checks later with `pontive status`.
119
+
120
+ The CLI never prints a secret or the claim token. Server errors are retried
121
+ with the same idempotency key, so a retry never creates a second instance.
122
+
123
+ ## Environment
124
+
125
+ | Variable | |
126
+ | --- | --- |
127
+ | `PONTIVE_API_URL` | Where the provisioning routes live. Default `https://api.pontive.com`. |
128
+ | `PONTIVE_REGION` | The default for `--region`. |
129
+ | `PONTIVE_MCP_URL` | The MCP server `init` connects agents to. Default `https://mcp.<region>.pontive.com/mcp`. |
130
+
131
+ ## Development
132
+
133
+ Commands live one per module in `src/commands/`, each exporting `command`; the
134
+ router finds them there, so a new command is a new file. `npm test`,
135
+ `npm run typecheck` and `npm run build` in this directory.