peakurl 0.0.2 → 0.1.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.
package/README.md CHANGED
@@ -2,112 +2,87 @@
2
2
 
3
3
  `peakurl` is the official command-line interface for PeakURL.
4
4
 
5
+ It gives you a fast way to create, inspect, list, and remove short links from the terminal while keeping default output readable for humans and optional `--json` output friendly for scripts.
6
+
5
7
  ## Install
6
8
 
9
+ Requirements: Node.js 20 or later.
10
+
7
11
  ```bash
8
12
  npm install -g peakurl
9
13
  ```
10
14
 
11
- The npm package name is unscoped and the executable is also `peakurl`.
12
-
13
- ## Authentication
14
-
15
- The CLI uses a PeakURL API key and validates it with `GET /api/v1/users/me` before storing it.
16
- PeakURL API keys are opaque 48-character hex bearer tokens, for example `0123456789abcdef0123456789abcdef0123456789abcdef`.
17
- The CLI accepts either the site root URL such as `https://peakurl.org` or the dashboard-exposed API base URL such as `https://peakurl.org/api/v1`.
15
+ ## Quick Start
18
16
 
19
17
  ```bash
20
18
  peakurl login --base-url https://peakurl.org --api-key 0123456789abcdef0123456789abcdef0123456789abcdef
19
+ peakurl create https://example.com/articles/launch --alias launch --title "Launch Post"
20
+ peakurl list
21
+ peakurl whoami
21
22
  ```
22
23
 
23
- You can also provide credentials through environment variables, which is useful in CI:
24
+ ## Authentication
25
+
26
+ The CLI uses PeakURL bearer API keys and validates them with `GET /api/v1/users/me` before storing them.
27
+
28
+ - `--base-url` accepts either the site root such as `https://peakurl.org` or the API base URL such as `https://peakurl.org/api/v1`
29
+ - API keys are opaque 48-character hex tokens
30
+ - credentials are stored in the standard per-user config location for `peakurl`
31
+
32
+ For CI and automation, you can also use environment variables:
24
33
 
25
34
  ```bash
26
35
  export PEAKURL_BASE_URL=https://peakurl.org
27
36
  export PEAKURL_API_KEY=0123456789abcdef0123456789abcdef0123456789abcdef
28
37
  ```
29
38
 
30
- Stored credentials live in the OS-standard per-user config directory for `peakurl`.
31
-
32
39
  ## Commands
33
40
 
34
- ### `peakurl login`
41
+ | Command | Description |
42
+ | ------------------------------ | ------------------------------------------- |
43
+ | `peakurl login` | Validate and save your PeakURL credentials. |
44
+ | `peakurl whoami` | Show the current authenticated account. |
45
+ | `peakurl create <url>` | Create a new short link. |
46
+ | `peakurl list` | List links in your account. |
47
+ | `peakurl get <id-or-alias>` | Fetch a single link by ID or alias. |
48
+ | `peakurl delete <id-or-alias>` | Delete a link by ID or alias. |
35
49
 
36
- ```bash
37
- peakurl login --base-url https://peakurl.org --api-key 0123456789abcdef0123456789abcdef0123456789abcdef
38
- ```
50
+ ## Common Flags
39
51
 
40
- ### `peakurl whoami`
52
+ - `--json` prints machine-readable JSON output
53
+ - `--quiet` minimizes output for scripts
41
54
 
42
- ```bash
43
- peakurl whoami
44
- peakurl whoami --json
45
- ```
55
+ ## Examples
46
56
 
47
- ### `peakurl create <url>`
57
+ Create a short link:
48
58
 
49
59
  ```bash
50
- peakurl create https://example.com/articles/launch --alias launch --title "Launch Post"
51
- peakurl create https://example.com --json
60
+ peakurl create https://example.com --alias example --title "Example"
52
61
  ```
53
62
 
54
- ### `peakurl list`
63
+ List links as JSON:
55
64
 
56
65
  ```bash
57
- peakurl list
58
- peakurl list --search launch --limit 10 --json
66
+ peakurl list --limit 10 --json
59
67
  ```
60
68
 
61
- ### `peakurl get <id-or-alias>`
69
+ Inspect a link:
62
70
 
63
71
  ```bash
64
- peakurl get launch
65
- peakurl get 681f3b63e7e44c0a1e83aa11 --json
72
+ peakurl get example
66
73
  ```
67
74
 
68
- ### `peakurl delete <id-or-alias>`
75
+ Delete a link:
69
76
 
70
77
  ```bash
71
- peakurl delete launch
72
- peakurl delete 681f3b63e7e44c0a1e83aa11 --quiet
78
+ peakurl delete example
73
79
  ```
74
80
 
75
- When you pass an alias or short code to `delete`, the CLI resolves it to the
76
- stable PeakURL row ID first because the current backend delete route operates on
77
- IDs.
78
-
79
- ## Flags
80
-
81
- Common flags:
81
+ When `delete` receives an alias or short code, the CLI resolves it to the underlying PeakURL row ID before deleting it.
82
82
 
83
- - `--json` prints machine-readable output.
84
- - `--quiet` prints minimal output for scripts.
83
+ ## Links
85
84
 
86
- Create flags:
87
-
88
- - `--alias`
89
- - `--title`
90
- - `--password`
91
- - `--status`
92
- - `--expires-at`
93
- - `--utm-source`
94
- - `--utm-medium`
95
- - `--utm-campaign`
96
- - `--utm-term`
97
- - `--utm-content`
98
-
99
- List flags:
100
-
101
- - `--page`
102
- - `--limit`
103
- - `--search`
104
- - `--sort-by`
105
- - `--sort-order`
106
-
107
- ## Development
108
-
109
- ```bash
110
- npm install
111
- npm run typecheck
112
- npm test
113
- ```
85
+ - Website: https://peakurl.org/
86
+ - API docs: https://peakurl.org/docs/api
87
+ - npm package: https://www.npmjs.com/package/peakurl
88
+ - Issues: https://github.com/PeakURL/PeakURL-CLI/issues
package/package.json CHANGED
@@ -1,26 +1,34 @@
1
1
  {
2
2
  "name": "peakurl",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "PeakURL command-line interface",
5
+ "homepage": "https://peakurl.org/",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/PeakURL/PeakURL-CLI.git"
9
+ },
5
10
  "type": "module",
6
11
  "bin": {
7
- "peakurl": "dist/index.js"
12
+ "peakurl": "bin/peakurl.js"
8
13
  },
9
14
  "files": [
10
- "dist"
15
+ "bin"
11
16
  ],
12
17
  "engines": {
13
18
  "node": ">=20"
14
19
  },
15
20
  "scripts": {
16
- "build": "tsup src/index.ts --format esm --target node20 --clean",
21
+ "build": "tsup --config tsup.config.ts",
17
22
  "dev": "tsx src/index.ts",
18
23
  "format": "prettier --write .",
19
24
  "format:check": "prettier --check .",
20
- "test": "tsx --test test/**/*.test.ts",
25
+ "test": "tsx --test test/*.test.ts",
21
26
  "typecheck": "tsc --noEmit",
22
27
  "prepare": "npm run build"
23
28
  },
29
+ "publishConfig": {
30
+ "registry": "https://registry.npmjs.org/"
31
+ },
24
32
  "dependencies": {
25
33
  "commander": "^14.0.0",
26
34
  "env-paths": "^3.0.0"
File without changes