@getpagr/cli 1.0.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.
- package/LICENSE +21 -0
- package/README.md +412 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +63 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +15 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +337 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +9 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +52 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +201 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/login.test.d.ts +2 -0
- package/dist/commands/login.test.d.ts.map +1 -0
- package/dist/commands/login.test.js +34 -0
- package/dist/commands/login.test.js.map +1 -0
- package/dist/commands/remove.d.ts +13 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +43 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/upload.d.ts +53 -0
- package/dist/commands/upload.d.ts.map +1 -0
- package/dist/commands/upload.js +186 -0
- package/dist/commands/upload.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +52 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +140 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/config.d.ts +10 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +39 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/meta.d.ts +5 -0
- package/dist/lib/meta.d.ts.map +1 -0
- package/dist/lib/meta.js +35 -0
- package/dist/lib/meta.js.map +1 -0
- package/dist/lib/meta.test.d.ts +2 -0
- package/dist/lib/meta.test.d.ts.map +1 -0
- package/dist/lib/meta.test.js +81 -0
- package/dist/lib/meta.test.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MNM Medieproduksjon AS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
# Pagr CLI
|
|
2
|
+
|
|
3
|
+
Publish and update HTML files from terminals, scripts, CI, and AI-agent workflows.
|
|
4
|
+
|
|
5
|
+
One local `.html` file in, one public Pagr URL out.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js 20 or newer.
|
|
10
|
+
- A Pagr account (optional).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Install the npm package globally. The package is `@getpagr/cli`, and the installed terminal command is `pagr`.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @getpagr/cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Other package managers:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add -g @getpagr/cli
|
|
24
|
+
yarn global add @getpagr/cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pagr login
|
|
31
|
+
pagr upload report.html
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`pagr upload` prints the public URL, copies it to the clipboard, and opens it in the browser. Use `--no-copy` or `--no-open` to skip either step.
|
|
35
|
+
|
|
36
|
+
## Latest Authentication Flow
|
|
37
|
+
|
|
38
|
+
Run `pagr login` to connect the CLI to your Pagr account.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pagr login
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The default browser flow works like this:
|
|
45
|
+
|
|
46
|
+
1. The CLI starts a temporary local callback server on `127.0.0.1`.
|
|
47
|
+
2. The CLI opens `https://app.getpagr.co/cli?callback=...&state=...` in your browser.
|
|
48
|
+
3. The Pagr app authenticates you, creates a CLI API key, and posts it back to the local callback.
|
|
49
|
+
4. The CLI validates the `state`, validates that the key starts with `pagr_`, and stores it in `~/.pagr/config.json`.
|
|
50
|
+
5. The login session times out after 5 minutes.
|
|
51
|
+
|
|
52
|
+
If the browser cannot reach the local callback, the app shows a fallback key. Return to your terminal and run:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pagr login --manual
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Then paste the key shown in the browser.
|
|
59
|
+
|
|
60
|
+
## Authentication Alternatives
|
|
61
|
+
|
|
62
|
+
Paste a key manually:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pagr login --manual
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Save a key directly without opening the browser or prompting:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pagr login --key pagr_...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Save a key through the config command:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pagr config set-key pagr_...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For CI and shared scripts, use an environment variable instead of writing local config:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
export PAGR_API_KEY="pagr_..."
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Configuration File
|
|
87
|
+
|
|
88
|
+
The CLI stores local configuration at:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
~/.pagr/config.json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The file can contain:
|
|
95
|
+
|
|
96
|
+
- `apiKey`: your saved Pagr API key.
|
|
97
|
+
- `workerUrl`: an optional Worker/API base URL override.
|
|
98
|
+
|
|
99
|
+
Environment variables always take precedence over values in `~/.pagr/config.json`.
|
|
100
|
+
|
|
101
|
+
## Command Reference
|
|
102
|
+
|
|
103
|
+
### `pagr login`
|
|
104
|
+
|
|
105
|
+
Authenticate and save an API key to `~/.pagr/config.json`.
|
|
106
|
+
|
|
107
|
+
Usage:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pagr login
|
|
111
|
+
pagr login --manual
|
|
112
|
+
pagr login --key pagr_...
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Flags:
|
|
116
|
+
|
|
117
|
+
- `--manual`: paste an API key manually instead of using browser login.
|
|
118
|
+
- `--key <pagr_...>`: save an API key directly without browser login or prompt.
|
|
119
|
+
|
|
120
|
+
Behavior:
|
|
121
|
+
|
|
122
|
+
- Without flags, the CLI asks how you want to log in:
|
|
123
|
+
- `1. Open browser and log in`
|
|
124
|
+
- `2. Paste API key manually`
|
|
125
|
+
- Browser login opens `/cli` on `PAGR_APP_URL`, or `https://app.getpagr.co` by default.
|
|
126
|
+
- Keys must start with `pagr_`.
|
|
127
|
+
|
|
128
|
+
### `pagr upload <file>`
|
|
129
|
+
|
|
130
|
+
Upload or update an HTML file.
|
|
131
|
+
|
|
132
|
+
Usage:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pagr upload report.html
|
|
136
|
+
pagr upload report.html --title "Weekly report"
|
|
137
|
+
pagr upload report.html --slug weekly-report
|
|
138
|
+
pagr upload report.html --slug weekly-report --title "Weekly report"
|
|
139
|
+
pagr upload report.html --update --slug weekly-report
|
|
140
|
+
pagr upload report.html --inject
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Positional arguments:
|
|
144
|
+
|
|
145
|
+
- `<file>`: required local HTML file to upload.
|
|
146
|
+
|
|
147
|
+
Flags:
|
|
148
|
+
|
|
149
|
+
- `-s, --slug <slug>`: use a custom URL slug.
|
|
150
|
+
- `-t, --title <title>`: override the page title.
|
|
151
|
+
- `-u, --update`: force update mode. Fails if the slug or document is not found.
|
|
152
|
+
- `--inject`: write Pagr metadata tags back into the HTML file after upload.
|
|
153
|
+
|
|
154
|
+
Behavior:
|
|
155
|
+
|
|
156
|
+
- Reads the file as UTF-8.
|
|
157
|
+
- New uploads call `POST /api/upload`.
|
|
158
|
+
- Updates by `pagr-id` when the HTML contains a Pagr document ID meta tag.
|
|
159
|
+
- Falls back to update by `pagr-slug` when the HTML contains a Pagr slug meta tag.
|
|
160
|
+
- With `--slug`, a custom slug is applied through a metadata update after upload when needed.
|
|
161
|
+
- Copies the final URL to the clipboard on supported systems.
|
|
162
|
+
- When `CI` is set, prints machine-readable `PAGR_SLUG` and `PAGR_URL` lines.
|
|
163
|
+
- On new uploads, the CLI injects `pagr-slug` and, when available, `pagr-id` into the source file when no existing `pagr-slug` is present. Passing `--inject` also writes those metadata tags back into the file.
|
|
164
|
+
|
|
165
|
+
### `pagr ls`
|
|
166
|
+
|
|
167
|
+
List published files.
|
|
168
|
+
|
|
169
|
+
Alias:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
pagr list
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Usage:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pagr ls
|
|
179
|
+
pagr ls --limit 20
|
|
180
|
+
pagr list --limit 20
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Flags:
|
|
184
|
+
|
|
185
|
+
- `--limit <count>`: maximum number of files to show. Default: `50`.
|
|
186
|
+
|
|
187
|
+
Output columns:
|
|
188
|
+
|
|
189
|
+
- `slug`
|
|
190
|
+
- `views`
|
|
191
|
+
- `plan`
|
|
192
|
+
- `title`
|
|
193
|
+
- `url`
|
|
194
|
+
|
|
195
|
+
### `pagr rm <slug>`
|
|
196
|
+
|
|
197
|
+
Delete a published file.
|
|
198
|
+
|
|
199
|
+
Alias:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pagr delete <slug>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Usage:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pagr rm weekly-report
|
|
209
|
+
pagr rm weekly-report --yes
|
|
210
|
+
pagr rm weekly-report -y
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Positional arguments:
|
|
214
|
+
|
|
215
|
+
- `<slug>`: required slug to delete.
|
|
216
|
+
|
|
217
|
+
Flags:
|
|
218
|
+
|
|
219
|
+
- `-y, --yes`: skip the confirmation prompt.
|
|
220
|
+
|
|
221
|
+
Behavior:
|
|
222
|
+
|
|
223
|
+
- Prompts before deletion unless `-y` or `--yes` is passed:
|
|
224
|
+
|
|
225
|
+
```text
|
|
226
|
+
Delete <slug>? This cannot be undone. [y/N]
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
- Calls `DELETE /api/files/:slug`.
|
|
230
|
+
|
|
231
|
+
### `pagr config`
|
|
232
|
+
|
|
233
|
+
Manage local CLI configuration.
|
|
234
|
+
|
|
235
|
+
Subcommands:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
pagr config set-key <key>
|
|
239
|
+
pagr config set-url <url>
|
|
240
|
+
pagr config show
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### `pagr config set-key <key>`
|
|
244
|
+
|
|
245
|
+
Save your API key to `~/.pagr/config.json`.
|
|
246
|
+
|
|
247
|
+
Arguments:
|
|
248
|
+
|
|
249
|
+
- `<key>`: required API key. Must start with `pagr_`.
|
|
250
|
+
|
|
251
|
+
#### `pagr config set-url <url>`
|
|
252
|
+
|
|
253
|
+
Save a Worker/API base URL override to `~/.pagr/config.json`.
|
|
254
|
+
|
|
255
|
+
Arguments:
|
|
256
|
+
|
|
257
|
+
- `<url>`: required Worker/API base URL.
|
|
258
|
+
|
|
259
|
+
#### `pagr config show`
|
|
260
|
+
|
|
261
|
+
Print the active configuration.
|
|
262
|
+
|
|
263
|
+
Behavior:
|
|
264
|
+
|
|
265
|
+
- Prints a masked API key.
|
|
266
|
+
- Prints the active worker URL.
|
|
267
|
+
- Respects `PAGR_API_KEY` and `PAGR_WORKER_URL` environment variable overrides.
|
|
268
|
+
|
|
269
|
+
### `pagr init`
|
|
270
|
+
|
|
271
|
+
Initialize Pagr instructions and MCP config in the current project.
|
|
272
|
+
|
|
273
|
+
Usage:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
pagr init
|
|
277
|
+
pagr init --no-claude
|
|
278
|
+
pagr init --no-mcp
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Flags:
|
|
282
|
+
|
|
283
|
+
- `--claude`: create `.claude/skills/pagr.md`. Default: enabled.
|
|
284
|
+
- `--no-claude`: skip `.claude/skills/pagr.md`.
|
|
285
|
+
- `--mcp`: add the Pagr MCP server to `.claude/settings.json`. Default: enabled.
|
|
286
|
+
- `--no-mcp`: skip the MCP config update.
|
|
287
|
+
|
|
288
|
+
Behavior:
|
|
289
|
+
|
|
290
|
+
- Always writes `SKILL.md`.
|
|
291
|
+
- With Claude enabled, writes `.claude/skills/pagr.md`.
|
|
292
|
+
- With MCP enabled, updates `.claude/settings.json`.
|
|
293
|
+
- The MCP server command remains:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
npx -y @pagr/mcp
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## CI Usage
|
|
300
|
+
|
|
301
|
+
Store `PAGR_API_KEY` as a secret in your CI system.
|
|
302
|
+
|
|
303
|
+
```yaml
|
|
304
|
+
- name: Publish HTML report
|
|
305
|
+
run: pagr upload output/report.html --title "Nightly report"
|
|
306
|
+
env:
|
|
307
|
+
PAGR_API_KEY: ${{ secrets.PAGR_API_KEY }}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
When `CI` is set, `pagr upload` also prints machine-readable output:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
PAGR_SLUG=weekly-report
|
|
314
|
+
PAGR_URL=https://uc.pagr.link/weekly-report
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## AI-Agent Usage
|
|
318
|
+
|
|
319
|
+
Run `pagr init` in a project to create agent instructions and Claude Code MCP configuration.
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
pagr init
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
This writes:
|
|
326
|
+
|
|
327
|
+
- `SKILL.md`
|
|
328
|
+
- `.claude/skills/pagr.md`, unless `--no-claude` is passed.
|
|
329
|
+
- `.claude/settings.json` with a Pagr MCP server entry, unless `--no-mcp` is passed.
|
|
330
|
+
|
|
331
|
+
Agents should publish the final HTML artifact with:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
pagr upload <file> --title "<title>"
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
They should return the public URL printed by the CLI.
|
|
338
|
+
|
|
339
|
+
## Environment Variables
|
|
340
|
+
|
|
341
|
+
- `PAGR_API_KEY`: API key used for authenticated commands. Overrides local config.
|
|
342
|
+
- `PAGR_WORKER_URL`: Worker/API base URL. Overrides local config and defaults to `https://pagr.link`.
|
|
343
|
+
- `PAGR_APP_URL`: app URL opened by `pagr login`. Defaults to `https://app.getpagr.co`.
|
|
344
|
+
- `CI`: when set, `pagr upload` prints `PAGR_SLUG` and `PAGR_URL` lines for scripts.
|
|
345
|
+
|
|
346
|
+
## Troubleshooting
|
|
347
|
+
|
|
348
|
+
### No API Key Found
|
|
349
|
+
|
|
350
|
+
Run one of:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
pagr login
|
|
354
|
+
pagr config set-key pagr_...
|
|
355
|
+
export PAGR_API_KEY="pagr_..."
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Browser Login Cannot Reach The Callback
|
|
359
|
+
|
|
360
|
+
Run manual login:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
pagr login --manual
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Paste the fallback key shown in the browser.
|
|
367
|
+
|
|
368
|
+
### Invalid API Key Format
|
|
369
|
+
|
|
370
|
+
Pagr CLI keys must start with `pagr_`. Generate or copy a CLI API key from the Pagr app, then run:
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
pagr login --key pagr_...
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Cannot Read File
|
|
377
|
+
|
|
378
|
+
Confirm the path exists and points to a readable HTML file:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
pagr upload ./report.html
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Slug Not Found On Update
|
|
385
|
+
|
|
386
|
+
`pagr upload --update --slug <slug>` only updates files owned by your account. If the file does not exist, upload without `--update` to create a new page:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
pagr upload report.html --slug weekly-report
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Custom Slug Plan Restrictions
|
|
393
|
+
|
|
394
|
+
Custom slugs may be plan-gated. If your account cannot use a custom slug, the API returns a plan error. Upload without `--slug` to let Pagr generate a slug.
|
|
395
|
+
|
|
396
|
+
### Clipboard Copy Not Available
|
|
397
|
+
|
|
398
|
+
The CLI tries to copy uploaded URLs using platform clipboard tools: `pbcopy` on macOS, `clip` on Windows, and `xclip` or `xsel` on Linux. If no supported clipboard tool is available, the upload still succeeds and the URL is printed.
|
|
399
|
+
|
|
400
|
+
## Publishing Note
|
|
401
|
+
|
|
402
|
+
The npm package is:
|
|
403
|
+
|
|
404
|
+
```text
|
|
405
|
+
@getpagr/cli
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
The terminal command is still:
|
|
409
|
+
|
|
410
|
+
```text
|
|
411
|
+
pagr
|
|
412
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,qDA2DxB,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineCommand } from 'citty';
|
|
2
|
+
import { readConfig, writeConfig } from '../lib/config.js';
|
|
3
|
+
export const configCommand = defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: 'config',
|
|
6
|
+
description: 'Manage CLI configuration',
|
|
7
|
+
},
|
|
8
|
+
subCommands: {
|
|
9
|
+
'set-key': defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: 'set-key',
|
|
12
|
+
description: 'Save your Pagr API key (~/.pagr/config.json)',
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
key: {
|
|
16
|
+
type: 'positional',
|
|
17
|
+
description: 'Pagr API key',
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
run({ args }) {
|
|
22
|
+
if (!args.key.startsWith('pagr_')) {
|
|
23
|
+
console.error('Invalid API key format. Keys must start with "pagr_".');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const current = readConfig();
|
|
27
|
+
writeConfig({ ...current, apiKey: args.key });
|
|
28
|
+
console.log('API key saved to ~/.pagr/config.json');
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
'set-url': defineCommand({
|
|
32
|
+
meta: {
|
|
33
|
+
name: 'set-url',
|
|
34
|
+
description: 'Override the worker URL',
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
url: {
|
|
38
|
+
type: 'positional',
|
|
39
|
+
description: 'Worker URL',
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
run({ args }) {
|
|
44
|
+
const current = readConfig();
|
|
45
|
+
writeConfig({ ...current, workerUrl: args.url });
|
|
46
|
+
console.log(`Worker URL set to ${args.url}`);
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
show: defineCommand({
|
|
50
|
+
meta: {
|
|
51
|
+
name: 'show',
|
|
52
|
+
description: 'Show current configuration',
|
|
53
|
+
},
|
|
54
|
+
run() {
|
|
55
|
+
const cfg = readConfig();
|
|
56
|
+
const apiKey = process.env.PAGR_API_KEY ?? cfg.apiKey;
|
|
57
|
+
console.log('API key:', apiKey ? `${apiKey.slice(0, 13)}...` : '(not set)');
|
|
58
|
+
console.log('Worker URL:', process.env.PAGR_WORKER_URL ?? cfg.workerUrl ?? 'https://pagr.link');
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;IACzC,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0BAA0B;KACxC;IACD,WAAW,EAAE;QACX,SAAS,EAAE,aAAa,CAAC;YACvB,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,8CAA8C;aAC5D;YACD,IAAI,EAAE;gBACJ,GAAG,EAAE;oBACH,IAAI,EAAE,YAAY;oBAClB,WAAW,EAAE,cAAc;oBAC3B,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,GAAG,CAAC,EAAE,IAAI,EAAE;gBACV,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;oBAClC,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;oBACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;gBACjB,CAAC;gBACD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;gBAC5B,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;gBAC7C,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;YACrD,CAAC;SACF,CAAC;QACF,SAAS,EAAE,aAAa,CAAC;YACvB,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,yBAAyB;aACvC;YACD,IAAI,EAAE;gBACJ,GAAG,EAAE;oBACH,IAAI,EAAE,YAAY;oBAClB,WAAW,EAAE,YAAY;oBACzB,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,GAAG,CAAC,EAAE,IAAI,EAAE;gBACV,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;gBAC5B,WAAW,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;gBAChD,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;YAC9C,CAAC;SACF,CAAC;QACF,IAAI,EAAE,aAAa,CAAC;YAClB,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,4BAA4B;aAC1C;YACD,GAAG;gBACD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAA;gBACxB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,MAAM,CAAA;gBACrD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;gBAC3E,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,SAAS,IAAI,mBAAmB,CAAC,CAAA;YACjG,CAAC;SACF,CAAC;KACH;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const initCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly claude: {
|
|
3
|
+
readonly type: "boolean";
|
|
4
|
+
readonly default: true;
|
|
5
|
+
readonly description: "Create the Claude Code skill file";
|
|
6
|
+
readonly negativeDescription: "Skip creating the Claude Code skill file";
|
|
7
|
+
};
|
|
8
|
+
readonly mcp: {
|
|
9
|
+
readonly type: "boolean";
|
|
10
|
+
readonly default: true;
|
|
11
|
+
readonly description: "Create the Claude Code MCP server config";
|
|
12
|
+
readonly negativeDescription: "Skip creating the Claude Code MCP server config";
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA8QA,eAAO,MAAM,WAAW;;;;;;;;;;;;;EAmDtB,CAAA"}
|