peakurl 0.2.0 → 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 +100 -13
  2. package/bin/peakurl.js +1202 -112
  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,6 +34,7 @@ peakurl create \
34
34
 
35
35
  peakurl list
36
36
  peakurl whoami
37
+ peakurl status
37
38
  peakurl logout
38
39
  ```
39
40
 
@@ -41,7 +42,7 @@ peakurl logout
41
42
 
42
43
  The CLI uses PeakURL bearer API keys and validates them against `GET /api/v1/users/me` before saving credentials.
43
44
 
44
- - `--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`
45
46
  - API keys are opaque 48-character hex tokens
46
47
  - Credentials are stored in the standard per-user config location for `peakurl`
47
48
  - `peakurl logout` removes the saved config file, but shell environment variables still override auth if they are set
@@ -49,22 +50,26 @@ The CLI uses PeakURL bearer API keys and validates them against `GET /api/v1/use
49
50
  For CI or automation, you can also authenticate with environment variables:
50
51
 
51
52
  ```bash
52
- export PEAKURL_BASE_URL=https://peakurl.org
53
+ export PEAKURL_BASE_URL=https://example.com/api/v1
53
54
  export PEAKURL_API_KEY=0123456789abcdef0123456789abcdef0123456789abcdef
54
55
  ```
55
56
 
56
57
  ## Commands
57
58
 
58
- | Command | Description |
59
- | ------------------------------ | ---------------------------------------------------------- |
60
- | `peakurl login` | Validate and save your PeakURL credentials. |
61
- | `peakurl whoami` | Show the current authenticated account. |
62
- | `peakurl logout` | Remove saved local CLI credentials. |
63
- | `peakurl create <url>` | Create a new short link. |
64
- | `peakurl list` | List links in your account. |
65
- | `peakurl get <id-or-alias>` | Fetch a single link by ID or alias. |
66
- | `peakurl delete <id-or-alias>` | Delete a link by ID or alias. |
67
- | `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. |
68
73
 
69
74
  ## Examples
70
75
 
@@ -97,6 +102,22 @@ Log out from saved local credentials:
97
102
  peakurl logout
98
103
  ```
99
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
+
100
121
  Delete a link:
101
122
 
102
123
  ```bash
@@ -105,6 +126,55 @@ peakurl delete example
105
126
 
106
127
  When `delete` receives an alias or short code, the CLI resolves it to the underlying PeakURL row ID before deleting it.
107
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
+
108
178
  Check the latest available CLI version:
109
179
 
110
180
  ```bash
@@ -135,6 +205,23 @@ export PEAKURL_DISABLE_UPDATE_CHECK=1
135
205
  - `--json` prints machine-readable JSON where supported
136
206
  - `--quiet` minimizes output for scripts
137
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
+
138
225
  ## Links
139
226
 
140
227
  - Website: <https://peakurl.org/>