@shuffl/cli 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shuffl LLC
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,59 @@
1
+ # Shuffl CLI
2
+
3
+ Every public Shuffl API operation as a scriptable command with JSON output. Commands do not start a model or agent.
4
+
5
+ ## Installation
6
+
7
+ Requires Node.js 22 or later.
8
+
9
+ ```sh
10
+ npm install --global @shuffl/cli
11
+ shuffl --version
12
+ shuffl --help
13
+ ```
14
+
15
+ Or run it without installing: `npx @shuffl/cli --help`. To pin it in a project, add `@shuffl/cli` as a dev dependency and run `npx shuffl`. The CLI is built on [`@shuffl/sdk`](https://www.npmjs.com/package/@shuffl/sdk) and released with it under one version; its operation names, help and input flags are generated from the public API contract.
16
+
17
+ `shuffl permissions list --json` discovers endpoint grants. Each command’s `--help` shows its permission ID and Read/Write classification. Create a delegated key with `shuffl credentials api create --input-file key-command.json --json`, using a `permissions` array such as `["users.list", "units.save"]`. The issuer must hold `credentials.api.create` and every requested permission. See [endpoint permissions](https://shuffl-rebuild.vercel.app/docs/api-permissions).
18
+
19
+ ## Authentication and commands
20
+
21
+ Create an API key in **Settings → API keys**, choosing only the endpoint permissions you need, then feed it through stdin:
22
+
23
+ ```sh
24
+ # Your credential manager supplies the token on stdin.
25
+ credential-command | shuffl login --base-url https://YOUR-SHUFFL-HOST --token-stdin
26
+
27
+ shuffl users list --limit 25 --json
28
+ shuffl programs list --json
29
+ shuffl programs preview --id PROGRAM_ID --seed preview-2026-09 --json
30
+ shuffl programs pause --id PROGRAM_ID --json
31
+ shuffl programs create --input-file create-program.json --json
32
+ shuffl programs update --input-file update-program.json --json
33
+ shuffl logout
34
+ ```
35
+
36
+ Alternatively set `SHUFFL_TOKEN` and `SHUFFL_BASE_URL` through your environment. Tokens are never accepted as command-line arguments or printed after login. Saved credentials are stored with mode `0600` under `$XDG_CONFIG_HOME/shuffl/config.json` (default `~/.config/shuffl/config.json`). `SHUFFL_CONFIG_DIR` overrides the Shuffl directory. Logout removes the local copy; revoke the token in Settings to disable other copies.
37
+
38
+ The saved token cannot be used with a different `--base-url`; log into that server or supply an explicit environment token. Login verifies the token before saving it.
39
+
40
+ Select the workspace when creating the token. Each token controls exactly that workspace; switching workspaces requires a token issued there. There is no workspace flag that can broaden the token's authority. `shuffl workspaces current --json` reads back the selected workspace. `users list` accepts `--limit` (1–100) and `--cursor` from the previous response's `nextCursor`; other resources retain the pagination fields shown by their command help.
41
+
42
+ Every operation accepts `--input JSON`, `--input -` for stdin, or `--input-file FILE`. Top-level schema properties also become flags, such as `--id`, `--limit`, and `--expected-revision`. Boolean values are `true` or `false`; nested objects and arrays are JSON. `--help` requires no credentials. Repeated flags and ambiguous inputs are rejected.
43
+
44
+ `--json` writes one JSON value to stdout, including `{ "error": { "code", "message" } }` on failure. Exit codes: `0` success, `1` service failure, `2` usage/validation, `3` authentication/authorization. Human output uses formatted JSON and errors on stderr. Commands do not start a model or agent.
45
+
46
+ Programs are created paused by default. Keep the same `requestKey` for a retry, and use `expectedRevision` to update the version you reviewed. Activating a program enables its schedule. A requested run is queued durably and can be inspected with `shuffl runs get --id RUN_ID`.
47
+
48
+ Management resources use the same nested command names as the [SDK](https://shuffl-rebuild.vercel.app/docs/sdk):
49
+
50
+ ```sh
51
+ shuffl units list --json
52
+ shuffl units save --input-file team-command.json --json
53
+ shuffl commands get --id RECEIPT_ID --json
54
+ shuffl knowledge sources import-pdf --input-file pdf-command.json --json
55
+ ```
56
+
57
+ Management writes require `requestKey` and return `{receipt, result}`. Sensitive writes also require `confirm` equal to the SDK operation name. Keep the same input/key on retry: the duplicate returns only the receipt and `result: null`, without repeating the write or disclosing an old result. Read current resources to reconcile an unknown outcome.
58
+
59
+ Full guide: [Use the Shuffl CLI](https://shuffl-rebuild.vercel.app/docs/cli).
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from './index.js';
3
+ process.exitCode = await runCli(process.argv.slice(2));
@@ -0,0 +1,2 @@
1
+ import type { CommandDefinition } from './types.ts';
2
+ export declare const commands: CommandDefinition[];