@tinycloud/cli 1.5.0-beta.12 → 1.5.0-beta.14
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/README.md +58 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy-entry.js +274 -58
- package/dist/legacy-entry.js.map +1 -1
- package/package.json +7 -7
- package/skills/tc-cli/REFERENCE.md +22 -1
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ tc kv list
|
|
|
87
87
|
tc secrets network init
|
|
88
88
|
printf '%s' "$ANTHROPIC_API_KEY" | tc secrets put ANTHROPIC_API_KEY --stdin
|
|
89
89
|
tc secrets get ANTHROPIC_API_KEY
|
|
90
|
+
tc secrets run ANTHROPIC_API_KEY -- python train.py # the value only in the command's environment
|
|
90
91
|
|
|
91
92
|
# Ask the owner for a secret an agent needs, then wait for it
|
|
92
93
|
# (call TinyCloud's CLI by absolute path: a bare `tc` can be iproute2's /usr/sbin/tc)
|
|
@@ -138,6 +139,7 @@ tc delegation create --to did:pkh:eip155:1:0x...
|
|
|
138
139
|
| `tc secrets network show` | Show a secrets decryption network |
|
|
139
140
|
| `tc secrets network init` | Create or fetch the default secrets network |
|
|
140
141
|
| `tc secrets network grant` | Grant `tinycloud.encryption/decrypt` on a secrets network |
|
|
142
|
+
| `tc secrets run` | Run a command with secrets in its environment |
|
|
141
143
|
| `tc secrets request` | Print a Secret Manager link asking the owner to add secrets (offline) |
|
|
142
144
|
| `tc secrets wait` | Wait until secrets exist and are readable (never signs in; needs a stored session; exit 8 pending, 130 interrupted) |
|
|
143
145
|
| `tc secrets manage` | Print or open the Secret Manager page, `{url, opened}` |
|
|
@@ -159,6 +161,62 @@ still exits 0 and installs the rest. If the schema fails after notes were
|
|
|
159
161
|
written, it says "notes saved; tables not set up: run again"; running it again
|
|
160
162
|
is safe.
|
|
161
163
|
|
|
164
|
+
### Running a command with secrets
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
tc secrets run NAME... [--map NAME=ENV_VAR]... [--scope S] [--space S] [--delegation SOURCE] [--private-key HEX] -- <command> [args...]
|
|
168
|
+
|
|
169
|
+
tc secrets run ANTHROPIC_API_KEY OPENAI_API_KEY -- python train.py
|
|
170
|
+
tc secrets run --map ANTHROPIC_KEY=ANTHROPIC_API_KEY -- node server.js
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`tc secrets run` reads every named secret as `tc secrets get` does, then
|
|
174
|
+
starts `<command>` directly, without a shell, with each value in its
|
|
175
|
+
environment: under the secret's name, or under `ENV_VAR` for `--map
|
|
176
|
+
NAME=ENV_VAR`. A value replaces an inherited variable of the same name.
|
|
177
|
+
tc doesn't pass its own `TC_PRIVATE_KEY` to the command. To give the command
|
|
178
|
+
a key from a secret, use `--map NAME=TC_PRIVATE_KEY`.
|
|
179
|
+
Everything after the first `--`, including any further `--`, goes to the
|
|
180
|
+
command unchanged. The command uses tc's stdin, stdout and stderr; tc itself
|
|
181
|
+
writes nothing to stdout, and its own messages go to stderr.
|
|
182
|
+
|
|
183
|
+
Name at least one secret, as an argument or with `--map`. `ENV_VAR` must
|
|
184
|
+
match `[A-Za-z_][A-Za-z0-9_]*`, and two secrets cannot be mapped to the same
|
|
185
|
+
variable (exit 2). If any secret cannot be read, the command does not start
|
|
186
|
+
and tc exits with the code and error `tc secrets get` gives for that secret.
|
|
187
|
+
Otherwise tc exits with the command's exit code. If the command was ended by
|
|
188
|
+
SIGINT, SIGTERM, SIGHUP, SIGKILL, SIGALRM or SIGUSR2, tc ends by the same
|
|
189
|
+
signal (or exits with 128 plus the signal number if that signal doesn't end
|
|
190
|
+
tc). If any other signal ended it, such as SIGQUIT or SIGSEGV, tc exits with
|
|
191
|
+
128 plus the signal number instead, so tc does not cause a core dump
|
|
192
|
+
(SIGUSR1 and SIGPIPE are left out too: Node uses SIGUSR1 for its inspector
|
|
193
|
+
and ignores SIGPIPE).
|
|
194
|
+
|
|
195
|
+
SIGINT, SIGTERM, SIGHUP and SIGQUIT sent to tc go to the command. When tc
|
|
196
|
+
runs in the foreground of a terminal, it doesn't pass on SIGINT, SIGQUIT or
|
|
197
|
+
SIGHUP: the terminal already sends them (Ctrl-C, Ctrl-\, hangup) to the
|
|
198
|
+
command, so the command normally gets each one once. tc checks whether it's
|
|
199
|
+
in the foreground using `/proc`, or `ps` where `/proc` isn't available. If
|
|
200
|
+
neither works, it passes the signals on. When tc runs in the background, it
|
|
201
|
+
passes them on, so a signal sent to the whole job (for example `kill -INT
|
|
202
|
+
%1`) can reach the command twice.
|
|
203
|
+
|
|
204
|
+
From a script, stop the command by sending SIGTERM to tc's process ID. tc
|
|
205
|
+
passes it on, waits for the command to exit, then exits the way the command
|
|
206
|
+
did (the command's own exit code if it handles SIGTERM itself). If the
|
|
207
|
+
command ignores SIGTERM, tc keeps waiting.
|
|
208
|
+
|
|
209
|
+
A command that does not exist exits 127; one that cannot be executed, or
|
|
210
|
+
cannot be started for another reason, exits 126. These cases print one plain
|
|
211
|
+
line on stderr, even with `--json`: `tc secrets run: <command>: command not
|
|
212
|
+
found`, `…: permission denied` or `…: cannot run (<error code>)`.
|
|
213
|
+
|
|
214
|
+
Limits: `tc secrets run` keeps values out of the command line, your shell
|
|
215
|
+
history and tc's own output. It doesn't hide them from the command: the
|
|
216
|
+
command, and anything it starts, receives the values and can print, log or
|
|
217
|
+
pass them on. Other programs running as the same user can often read a
|
|
218
|
+
process's environment too.
|
|
219
|
+
|
|
162
220
|
## Global Options
|
|
163
221
|
|
|
164
222
|
```
|