@kaynooo/cli-dev 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +34 -2
- package/dist/cli.js +1421 -0
- package/package.json +39 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kaynooo <contact@kaynooo.fr>
|
|
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
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kaynooo/cli-dev
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`dev` is a toolbox of small developer utilities in one bin, each a command that reads its text from an argument or from stdin.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
bun add -g @kaynooo/cli-dev
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Command | What it does |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `dev password [length] [format] [-b\|--bcrypt [password]]` | `length` random bytes (default 32) as `hex`, `base64` (default) or `base64url`, printed and copied with `wl-copy` when it exists; `--bcrypt` prints the hash of the password given, or of a generated one |
|
|
12
|
+
| `dev jwt [token]` | header and payload of a JWT, `iat`, `nbf` and `exp` as local and UTC dates with how far from now; the signature is not verified |
|
|
13
|
+
| `dev ts [value]` | epoch seconds or milliseconds (told apart by size), an ISO date or date-time, or a duration such as `90m` or `2h30m`, as local and UTC dates; no value is now, `-` reads stdin |
|
|
14
|
+
| `dev uuid [-n <count>] [--v7]` | random UUIDs, version 4 or 7 |
|
|
15
|
+
| `dev ulid [-n <count>]` | random ULIDs |
|
|
16
|
+
| `dev b64 [-d] [--url] [text]` | base64 of the text, or with `-d` the text behind it (either alphabet, padding optional) |
|
|
17
|
+
| `dev url [url]` | the parts of a URL and its decoded query |
|
|
18
|
+
| `dev hash <sha256\|sha1\|md5\|sha512> [file]` | the hex digest of a file or of stdin |
|
|
19
|
+
|
|
20
|
+
`--json` prints the structured result of every command. `jwt` and `ts` take `--zone <IANA zone>` for the local dates instead of the host's.
|
|
21
|
+
|
|
22
|
+
Fish completes it through the bin itself: `dev __complete`, installed for every bin by `cli completions fish --install`.
|
|
23
|
+
|
|
24
|
+
## Passwords and bcrypt
|
|
25
|
+
|
|
26
|
+
The password is read from `crypto.getRandomValues` and written as `openssl rand -hex|-base64` does, `base64url` being that base64 with `+/` swapped for `-_` and the padding dropped. With a clipboard tool (`wl-copy`) the password is copied and `copied to clipboard` is said on stderr; `--no-copy` leaves the clipboard alone.
|
|
27
|
+
|
|
28
|
+
`--bcrypt` hashes at cost 10. Bun writes bcrypt hashes with the `$2b$` prefix where `htpasswd -B` writes `$2y$`: the algorithm is identical, so `dev` rewrites the prefix to `$2y$`, the one Apache, nginx and traefik basic auth all accept (`$2b$` is accepted by fewer of them). With a generated password the hash prints on stdout, the password on stderr, and it is the password that is copied, as the password it replaces did.
|
|
29
|
+
|
|
30
|
+
## Notes
|
|
31
|
+
|
|
32
|
+
- `ts` reads an ISO date-time without a zone, and a bare date, in the local zone (`--zone` to change it); one ending in `Z` or an offset carries its own. A number of 12 digits or more is milliseconds.
|
|
33
|
+
- `ts` reads stdin only for `-`, so a bare `dev ts` always means now, even in a script whose stdin is a pipe.
|
|
34
|
+
- `b64` encodes the bytes it is given, so `echo hi | dev b64` includes the newline, as `base64` does.
|
|
35
|
+
- Exit codes: 0 done, 1 the input could not be read (not a JWT, not base64, no such file), 2 a usage error.
|