peakurl 0.1.2 → 0.3.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 +108 -12
  2. package/bin/peakurl.js +1420 -260
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ Sign in with your PeakURL API key:
20
20
 
21
21
  ```bash
22
22
  peakurl login \
23
- --base-url https://peakurl.org \
23
+ --base-url https://example.com/api/v1 \
24
24
  --api-key 0123456789abcdef0123456789abcdef0123456789abcdef
25
25
  ```
26
26
 
@@ -34,34 +34,42 @@ peakurl create \
34
34
 
35
35
  peakurl list
36
36
  peakurl whoami
37
+ peakurl status
38
+ peakurl logout
37
39
  ```
38
40
 
39
41
  ## Authentication
40
42
 
41
43
  The CLI uses PeakURL bearer API keys and validates them against `GET /api/v1/users/me` before saving credentials.
42
44
 
43
- - `--base-url` accepts either the site root, such as `https://peakurl.org`, or the API base URL, such as `https://peakurl.org/api/v1`
45
+ - `--base-url` expects the explicit API base URL, such as `https://example.com/api/v1`
44
46
  - API keys are opaque 48-character hex tokens
45
47
  - Credentials are stored in the standard per-user config location for `peakurl`
48
+ - `peakurl logout` removes the saved config file, but shell environment variables still override auth if they are set
46
49
 
47
50
  For CI or automation, you can also authenticate with environment variables:
48
51
 
49
52
  ```bash
50
- export PEAKURL_BASE_URL=https://peakurl.org
53
+ export PEAKURL_BASE_URL=https://example.com/api/v1
51
54
  export PEAKURL_API_KEY=0123456789abcdef0123456789abcdef0123456789abcdef
52
55
  ```
53
56
 
54
57
  ## Commands
55
58
 
56
- | Command | Description |
57
- | ------------------------------ | ---------------------------------------------------------- |
58
- | `peakurl login` | Validate and save your PeakURL credentials. |
59
- | `peakurl whoami` | Show the current authenticated account. |
60
- | `peakurl create <url>` | Create a new short link. |
61
- | `peakurl list` | List links in your account. |
62
- | `peakurl get <id-or-alias>` | Fetch a single link by ID or alias. |
63
- | `peakurl delete <id-or-alias>` | Delete a link by ID or alias. |
64
- | `peakurl update` | Show the latest available CLI version and install command. |
59
+ | Command | Description |
60
+ | ------------------------------ | ----------------------------------------------------------- |
61
+ | `peakurl login` | Validate and save your PeakURL credentials. |
62
+ | `peakurl whoami` | Show the current authenticated account. |
63
+ | `peakurl logout` | Remove saved local CLI credentials. |
64
+ | `peakurl status` | Show the current system status snapshot for the site. |
65
+ | `peakurl create <url>` | Create a new short link. |
66
+ | `peakurl import <file>` | Import links from a local CSV, JSON, or XML file. |
67
+ | `peakurl export` | Export accessible links as CSV, JSON, or XML. |
68
+ | `peakurl list` | List links in your account. |
69
+ | `peakurl get <id-or-alias>` | Fetch a single link by ID or alias. |
70
+ | `peakurl delete <id-or-alias>` | Delete a link by ID or alias. |
71
+ | `peakurl webhook <subcommand>` | List, create, delete, and inspect supported webhook events. |
72
+ | `peakurl update` | Show the latest available CLI version and install command. |
65
73
 
66
74
  ## Examples
67
75
 
@@ -88,6 +96,28 @@ Inspect a link:
88
96
  peakurl get example
89
97
  ```
90
98
 
99
+ Log out from saved local credentials:
100
+
101
+ ```bash
102
+ peakurl logout
103
+ ```
104
+
105
+ Show the current system status:
106
+
107
+ ```bash
108
+ peakurl status
109
+ ```
110
+
111
+ The status command calls `GET /api/v1/system/status` and prints summary, checks, plus site, server, database, storage, mail, location, and data tables when that information is available.
112
+
113
+ This route typically requires admin access on the PeakURL install.
114
+
115
+ If you need the raw payload:
116
+
117
+ ```bash
118
+ peakurl status --json
119
+ ```
120
+
91
121
  Delete a link:
92
122
 
93
123
  ```bash
@@ -96,6 +126,55 @@ peakurl delete example
96
126
 
97
127
  When `delete` receives an alias or short code, the CLI resolves it to the underlying PeakURL row ID before deleting it.
98
128
 
129
+ Import links from a local file:
130
+
131
+ ```bash
132
+ peakurl import ./links.csv
133
+ ```
134
+
135
+ The import command accepts dashboard-style CSV, JSON, and XML files, normalizes them locally, and sends the API-native `urls` array to `POST /api/v1/urls/bulk`.
136
+
137
+ Export links as CSV:
138
+
139
+ ```bash
140
+ peakurl export --format csv
141
+ ```
142
+
143
+ Write the exported JSON snapshot to stdout:
144
+
145
+ ```bash
146
+ peakurl export --format json --stdout
147
+ ```
148
+
149
+ List configured webhooks:
150
+
151
+ ```bash
152
+ peakurl webhook list
153
+ ```
154
+
155
+ Create a webhook:
156
+
157
+ ```bash
158
+ peakurl webhook create \
159
+ https://example.com/api/webhooks/peakurl \
160
+ --event link.clicked \
161
+ --event link.created
162
+ ```
163
+
164
+ The create command prints the signing secret once, so save it before closing the terminal output.
165
+
166
+ List supported webhook events:
167
+
168
+ ```bash
169
+ peakurl webhook events
170
+ ```
171
+
172
+ Delete a webhook:
173
+
174
+ ```bash
175
+ peakurl webhook delete webhook_123
176
+ ```
177
+
99
178
  Check the latest available CLI version:
100
179
 
101
180
  ```bash
@@ -126,6 +205,23 @@ export PEAKURL_DISABLE_UPDATE_CHECK=1
126
205
  - `--json` prints machine-readable JSON where supported
127
206
  - `--quiet` minimizes output for scripts
128
207
 
208
+ If you run an authenticated command before logging in, the CLI explains what to do next and shows the command to retry:
209
+
210
+ ```text
211
+ Authentication required.
212
+ PeakURL could not find credentials for this command.
213
+ Use one of the first two steps below, then run the last command.
214
+ +---------------------------+-----------------------------------------------------+-----------------------------------------+
215
+ | Step | Command | Notes |
216
+ +---------------------------+-----------------------------------------------------+-----------------------------------------+
217
+ | Save credentials | peakurl login --base-url https://example.com/api/v1 | Regular use on this machine |
218
+ | | --api-key YOUR_API_KEY | |
219
+ | Set environment variables | PEAKURL_BASE_URL=https://example.com/api/v1 | CI, scripts, or one-off use |
220
+ | | PEAKURL_API_KEY=YOUR_API_KEY | |
221
+ | Then run | peakurl whoami | After completing one of the steps above |
222
+ +---------------------------+-----------------------------------------------------+-----------------------------------------+
223
+ ```
224
+
129
225
  ## Links
130
226
 
131
227
  - Website: <https://peakurl.org/>