@putdotio/cli 1.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.
- package/LICENSE +21 -0
- package/README.md +132 -0
- package/dist/bin.mjs +44 -0
- package/dist/index.mjs +2 -0
- package/dist/metadata-C1rESM1p.mjs +3288 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) put.io
|
|
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
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<img src="https://static.put.io/images/putio-boncuk.png" width="72">
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<h1>putio-cli</h1>
|
|
7
|
+
|
|
8
|
+
<p>Agent-first CLI for the put.io API</p>
|
|
9
|
+
<p>Built for deterministic automation first, with readable terminal output when humans are driving.</p>
|
|
10
|
+
|
|
11
|
+
<p>
|
|
12
|
+
<a href="https://github.com/putdotio/putio-cli/actions/workflows/ci.yml?query=branch%3Amain" style="text-decoration:none;"><img src="https://img.shields.io/github/actions/workflow/status/putdotio/putio-cli/ci.yml?branch=main&style=flat&label=ci&colorA=000000&colorB=000000" alt="CI"></a>
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Choose the install path that fits your environment.
|
|
19
|
+
|
|
20
|
+
Install with the macOS/Linux helper script:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
curl -fsSL https://raw.githubusercontent.com/putdotio/putio-cli/main/install.sh | sh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The installer downloads the latest release binary, verifies the matching `.sha256` file, and installs `putio` into `~/.local/bin` by default.
|
|
27
|
+
|
|
28
|
+
Useful overrides:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
curl -fsSL https://raw.githubusercontent.com/putdotio/putio-cli/main/install.sh | INSTALL_DIR=/usr/local/bin sh
|
|
32
|
+
curl -fsSL https://raw.githubusercontent.com/putdotio/putio-cli/main/install.sh | PUTIO_CLI_VERSION=1.0.0 sh
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Install with npm if you already want the package through Node.js:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install --global @putdotio/cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This path requires Node `24.14+`.
|
|
42
|
+
|
|
43
|
+
Install manually from GitHub Releases if you prefer to handle the binary yourself or you are on Windows:
|
|
44
|
+
|
|
45
|
+
1. Download the matching asset from [GitHub Releases](https://github.com/putdotio/putio-cli/releases/latest).
|
|
46
|
+
2. Download the matching `.sha256` file for that asset.
|
|
47
|
+
3. Verify the checksum.
|
|
48
|
+
4. Mark the binary executable on macOS/Linux and place it on your `PATH`.
|
|
49
|
+
|
|
50
|
+
Example asset names:
|
|
51
|
+
|
|
52
|
+
- `putio-darwin-arm64`
|
|
53
|
+
- `putio-linux-x64`
|
|
54
|
+
- `putio-win32-x64.exe`
|
|
55
|
+
|
|
56
|
+
Verify a release binary on macOS or Linux:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
shasum -a 256 -c putio-linux-x64.sha256
|
|
60
|
+
chmod +x putio-linux-x64
|
|
61
|
+
mv putio-linux-x64 /usr/local/bin/putio
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Verify a release binary on Windows PowerShell:
|
|
65
|
+
|
|
66
|
+
```powershell
|
|
67
|
+
$expected = (Get-Content .\putio-win32-x64.exe.sha256).Split()[0]
|
|
68
|
+
$actual = (Get-FileHash .\putio-win32-x64.exe -Algorithm SHA256).Hash.ToLower()
|
|
69
|
+
if ($actual -ne $expected) { throw "Checksum mismatch" }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Confirm the installed CLI:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
putio version
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
Inspect the machine-readable command surface before guessing flags or payloads:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
putio describe
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Start the device-link login flow:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
putio auth login --open
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then confirm the linked account:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
putio whoami --output json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
List a small structured file result:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
putio files list --per-page 5 --fields files,total --output json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For larger reads, prefer streamed output:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
putio transfers list --page-all --output ndjson
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Usage Notes
|
|
111
|
+
|
|
112
|
+
- Use `--output json` when you want a stable machine-readable contract for scripts, agents, and automation.
|
|
113
|
+
- Use `--output ndjson` for large or continuous read workflows.
|
|
114
|
+
- Use `--fields` to keep structured responses small.
|
|
115
|
+
- Use `--dry-run` before mutating commands.
|
|
116
|
+
- Set `PUTIO_CLI_TOKEN` when you want fully headless auth.
|
|
117
|
+
- Use `PUTIO_CLI_CONFIG_PATH` to override the default config location.
|
|
118
|
+
- `putio auth login` always prints the approval URL and code, so it still works in headless and remote environments.
|
|
119
|
+
|
|
120
|
+
## Docs
|
|
121
|
+
|
|
122
|
+
- [Architecture](./docs/ARCHITECTURE.md)
|
|
123
|
+
- [Contributing](./CONTRIBUTING.md)
|
|
124
|
+
- [Security](./SECURITY.md)
|
|
125
|
+
|
|
126
|
+
## Contributing
|
|
127
|
+
|
|
128
|
+
Contributor setup, development workflow, and validation live in [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
This project is available under the MIT license. See [LICENSE](./LICENSE).
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { A as translate, C as CliOutput, D as CliConfigLive, E as renderJson, O as CliRuntime, S as CliSdkLive, T as detectOutputModeFromArgv, a as searchCommand, c as brandCommand, i as filesCommand, j as version, k as CliRuntimeLive, l as versionCommand, m as CliStateLive, n as whoamiCommand, o as eventsCommand, r as transfersCommand, s as downloadLinksCommand, t as describeCli, u as makeAuthCommand, w as CliOutputLive } from "./metadata-C1rESM1p.mjs";
|
|
3
|
+
import { Cause, Console, Effect, Layer } from "effect";
|
|
4
|
+
import { Command } from "@effect/cli";
|
|
5
|
+
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
6
|
+
import * as NodeTerminal from "@effect/platform-node/NodeTerminal";
|
|
7
|
+
//#region src/cli.ts
|
|
8
|
+
const authCommand = makeAuthCommand();
|
|
9
|
+
const describeCommand = Command.make("describe", {}, () => Console.log(renderJson(describeCli())));
|
|
10
|
+
const command = Command.make("putio", {}, () => Console.log(translate("cli.root.help"))).pipe(Command.withSubcommands([
|
|
11
|
+
describeCommand,
|
|
12
|
+
brandCommand,
|
|
13
|
+
versionCommand,
|
|
14
|
+
authCommand,
|
|
15
|
+
whoamiCommand,
|
|
16
|
+
downloadLinksCommand,
|
|
17
|
+
eventsCommand,
|
|
18
|
+
filesCommand,
|
|
19
|
+
searchCommand,
|
|
20
|
+
transfersCommand
|
|
21
|
+
]));
|
|
22
|
+
function runCli(args) {
|
|
23
|
+
return Command.run(command, {
|
|
24
|
+
name: "putio",
|
|
25
|
+
version: `v${version}`
|
|
26
|
+
})(args);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/internal/app-layer.ts
|
|
30
|
+
const makeCliAppLayer = (runtime) => {
|
|
31
|
+
const runtimeLayer = runtime ? Layer.succeed(CliRuntime, runtime) : CliRuntimeLive;
|
|
32
|
+
return Layer.mergeAll(NodeContext.layer, NodeTerminal.layer, runtimeLayer, CliOutputLive.pipe(Layer.provide(runtimeLayer)), CliConfigLive.pipe(Layer.provide(runtimeLayer)), CliSdkLive, CliStateLive);
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/bin.ts
|
|
36
|
+
NodeRuntime.runMain(Effect.scoped(Effect.flatMap(CliRuntime, (runtime) => runCli(runtime.argv)).pipe(Effect.catchAllCause((cause) => Effect.gen(function* () {
|
|
37
|
+
const cliOutput = yield* CliOutput;
|
|
38
|
+
const runtime = yield* CliRuntime;
|
|
39
|
+
const outputMode = detectOutputModeFromArgv(runtime.argv, runtime.isInteractiveTerminal);
|
|
40
|
+
yield* cliOutput.error(cliOutput.formatError(Cause.squash(cause), outputMode));
|
|
41
|
+
yield* runtime.setExitCode(1);
|
|
42
|
+
})), Effect.provide(makeCliAppLayer()))));
|
|
43
|
+
//#endregion
|
|
44
|
+
export {};
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as clearPersistedState, b as resolveAuthState, d as AuthStateError, f as AuthStatusSchema, g as ResolvedAuthStateSchema, h as PutioCliConfigSchema, m as CliStateLive, p as CliState, t as describeCli, v as getAuthStatus, x as savePersistedState, y as loadPersistedState } from "./metadata-C1rESM1p.mjs";
|
|
2
|
+
export { AuthStateError, AuthStatusSchema, CliState, CliStateLive, PutioCliConfigSchema, ResolvedAuthStateSchema, clearPersistedState, describeCli, getAuthStatus, loadPersistedState, resolveAuthState, savePersistedState };
|