@kaynooo/cli-dl 0.0.0-stage → 0.0.4
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 +47 -2
- package/dist/cli.js +3100 -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,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kaynooo/cli-dl
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`dl` downloads a file into a folder of its own and checks its sha256, and its signature when asked. It can then extract the file, install it as a command, or run it as a script once a sha256 pins it.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
bun add -g @kaynooo/cli-dl
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
`--extract` and `--bin` on an archive need the archive's extractor on PATH (tar, unzip, unrar or 7z), as `arc extract` does. A changed text file's diff needs git.
|
|
10
|
+
|
|
11
|
+
| Command | What it does |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `dl <url>` | downloads into a new folder under the temp folder (`-o <dir>` to choose one, never overwriting), and prints the path, size, final URL, type, sha256 and how it compares with the last download of that URL |
|
|
14
|
+
| `dl gh:owner/repo[@tag]`, `dl fj:owner/repo[@tag]` | the same for a GitHub release, or one on git.kaynooo.fr: the newest at least two weeks old (`--fresh` the newest), the asset built for this OS, arch and libc (`--asset <part of its name>` when it cannot tell), checked against the checksums file the release ships, else the sha256 GitHub gives (a release with neither installs with a warning); `--key` alone checks the signature shipped beside it. `GITHUB_TOKEN` lifts GitHub's 60 requests an hour |
|
|
15
|
+
| `dl ls` | the commands `dl` installed and the scripts it ran, with where each came from and when |
|
|
16
|
+
| `dl outdated [name...]` | asks each one's source whether it changed since (a conditional request when the server gave an ETag or Last-Modified, else the sha256 of a new download; for a release, whether a later one is two weeks old; one installed with `@tag` stays on it), lists those that did with the age of the install, exit 1 when one did or its source cannot be reached; `--bins` the commands only, `--json` |
|
|
17
|
+
| `dl update [name...]` | downloads again what changed, every one without names, checked as at install (`--sums`, `--sig`), then installs it or shows the script's diff and runs it with its arguments; a script only a sha256 pinned runs with `--yes`. `doctor` lists the commands behind, `dl update <name>` as the fix |
|
|
18
|
+
|
|
19
|
+
| Option | What it does |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `--sha256 <hex>` | the sha256 the file must have; on a mismatch the file is deleted |
|
|
22
|
+
| `--sums <url>` | a checksums file (`SHA256SUMS`, `sha256sum` or BSD style, or a lone hash) giving the file's sha256 |
|
|
23
|
+
| `--sig <url> --key <key>` | a detached signature of the file, or of the `--sums` file when there is one, checked before the file is kept; `--key` is a gpg fingerprint of your keyring or a gpg key file, a minisign key or key file, or a cosign PEM file, and that tool must be on PATH |
|
|
24
|
+
| `--extract`, `-x` | unpacks the archive into a new folder beside it |
|
|
25
|
+
| `--bin [name]` | installs the file, or the one executable its archive holds, into `~/.local/bin`; `--force` replaces a command already there |
|
|
26
|
+
| `--exec` | lists what the script does, then runs it only when `--sha256`, `--sums` or `--sig` pins it, or with `--yes`; arguments after `--` go to the script |
|
|
27
|
+
| `--max-size <size>` | the largest download taken, `2G` by default |
|
|
28
|
+
|
|
29
|
+
An HTML page arriving where a file was expected (an error or sign-in page answered with 200) fails instead of being kept.
|
|
30
|
+
|
|
31
|
+
A download that breaks off keeps its bytes under `~/.local/state/kaynooo-cli/dl`, and the next `dl` of the same URL resumes it with a Range request, when the server gave an ETag or Last-Modified to tell the file did not change; a changed file or a server without ranges starts over, and the sha256 covers the whole file either way. A part left a week unresumed is dropped.
|
|
32
|
+
|
|
33
|
+
## Install scripts
|
|
34
|
+
|
|
35
|
+
`curl -fsSL https://bun.sh/install | bash` runs code nobody read. With `dl`:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
dl https://bun.sh/install # prints the path and sha256
|
|
39
|
+
dl https://bun.sh/install --exec --sha256 <sha> # runs exactly what was read
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`--exec` first lists the lines worth reading: what the script fetches, what it runs with sudo, recursive removals, shell profiles and system folders it touches, code it hands to a shell, and the environment variables it reads.
|
|
43
|
+
|
|
44
|
+
Every URL is remembered under `~/.local/state/kaynooo-cli/dl`. Downloading the same URL again says whether it changed, and a text file under 1 MB shows its diff against the last version, so a script you read before only needs its changes read again.
|
|
45
|
+
|
|
46
|
+
A checksums file fetched from the same server as the file only proves the download arrived whole; a signature proves who published it. Most projects sign the checksums file, so `--sums` and `--sig` together check both.
|
|
47
|
+
|
|
48
|
+
Exits 0 on success, 1 when the download, a check, an extraction, an install or the script fails, or a script nothing pins was not run, 2 on a usage error.
|