@kaynooo/cli-dl 0.0.0-stage → 0.0.1

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/dist/cli.js +2220 -0
  4. 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,40 @@
1
- # Temporary Holding Version
1
+ # @kaynooo/cli-dl
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `dl` downloads a file into a folder of its own and checks its sha256. 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 ls` | the commands `dl` installed and the scripts it ran, with where each came from and when |
15
+
16
+ | Option | What it does |
17
+ | --- | --- |
18
+ | `--sha256 <hex>` | the sha256 the file must have; on a mismatch the file is deleted |
19
+ | `--sums <url>` | a checksums file (`SHA256SUMS`, `sha256sum` or BSD style, or a lone hash) giving the file's sha256 |
20
+ | `--extract`, `-x` | unpacks the archive into a new folder beside it |
21
+ | `--bin [name]` | installs the file, or the one executable its archive holds, into `~/.local/bin`; `--force` replaces a command already there |
22
+ | `--exec` | lists what the script does, then runs it only when `--sha256` or `--sums` pins it, or with `--yes`; arguments after `--` go to the script |
23
+ | `--max-size <size>` | the largest download taken, `2G` by default |
24
+
25
+ An HTML page arriving where a file was expected (an error or sign-in page answered with 200) fails instead of being kept.
26
+
27
+ ## Install scripts
28
+
29
+ `curl -fsSL https://bun.sh/install | bash` runs code nobody read. With `dl`:
30
+
31
+ ```sh
32
+ dl https://bun.sh/install # prints the path and sha256
33
+ dl https://bun.sh/install --exec --sha256 <sha> # runs exactly what was read
34
+ ```
35
+
36
+ `--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.
37
+
38
+ 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.
39
+
40
+ 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.