@runfile/cli 1.0.1 → 1.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/README.md +42 -1
- package/bin/darwin-arm64/run +0 -0
- package/bin/darwin-arm64/runfile-lsp +0 -0
- package/bin/darwin-x64/run +0 -0
- package/bin/darwin-x64/runfile-lsp +0 -0
- package/bin/linux-arm64/run +0 -0
- package/bin/linux-arm64/runfile-lsp +0 -0
- package/bin/linux-x64/run +0 -0
- package/bin/linux-x64/runfile-lsp +0 -0
- package/bin/win32-arm64/run.exe +0 -0
- package/bin/win32-arm64/runfile-lsp.exe +0 -0
- package/bin/win32-x64/run.exe +0 -0
- package/bin/win32-x64/runfile-lsp.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,6 +193,39 @@ run _aws -- s3api put-bucket-policy --bucket {{ bucket }} --policy {{ policy }}
|
|
|
193
193
|
`run :format` lays the block out, and a missing brace is underlined in your editor as you type — not reported
|
|
194
194
|
by the far end an hour later.
|
|
195
195
|
|
|
196
|
+
### Reading JSON without jq
|
|
197
|
+
|
|
198
|
+
`json_query` walks a path and answers with a **list**, where `[]` descends into every element the way jq's
|
|
199
|
+
`.[]` does. What comes back is one of the language's own lists — something to loop over and count, not text to
|
|
200
|
+
parse a second time.
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
# runfiles/audit/gate.run
|
|
204
|
+
# Fail when a dependency has a high or critical vulnerability
|
|
205
|
+
|
|
206
|
+
let report = ARG.report ? "osv.json"
|
|
207
|
+
let severities = json_query(read_file(report), "results[].packages[].groups[].max_severity")
|
|
208
|
+
let high = 0
|
|
209
|
+
|
|
210
|
+
for severity in severities
|
|
211
|
+
if severity != "" && number(severity) >= 7
|
|
212
|
+
high = high + 1
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
print("High or critical:", high)
|
|
217
|
+
|
|
218
|
+
if high != 0
|
|
219
|
+
exit(1)
|
|
220
|
+
end
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`json_get` reads one value at a path, and `json_keys` opens an object up — there is no map type, so without it
|
|
224
|
+
an object is text and nothing more. `json_type` says what is at a path, which is the one question `json_get`
|
|
225
|
+
cannot answer: it hands back `""` for a null and the compact text for an object. `json_format` is `jq .`, and
|
|
226
|
+
`json_encode` goes the other way, turning a list into an array. Nothing here is a dependency your machine has
|
|
227
|
+
to already have.
|
|
228
|
+
|
|
196
229
|
### Any language you have installed
|
|
197
230
|
|
|
198
231
|
`exec <command>` runs that command with the block as its **stdin**, so a target can be a Python script, a Node
|
|
@@ -379,7 +412,7 @@ end
|
|
|
379
412
|
`append`, `prepend`, `concat_lists`, `sort`, `reverse`, `unique`, `slice`, `flatten`, `zip`, `index_of` and
|
|
380
413
|
`without`, beside `first`, `last`, `length` and `join`.
|
|
381
414
|
|
|
382
|
-
There are
|
|
415
|
+
There are 83 built-in functions — strings, lists, regex, paths, JSON, hashes, time, files. Your editor lists
|
|
383
416
|
them all with a description and an example; `run :list` is for targets, and the language server is for the
|
|
384
417
|
language.
|
|
385
418
|
|
|
@@ -642,6 +675,9 @@ invoke `run` from.
|
|
|
642
675
|
directory than hide it, `$HOME/runfiles/` and `$HOME/Runfiles/` are read too — but only one of the three may
|
|
643
676
|
hold anything.
|
|
644
677
|
|
|
678
|
+
**Not in CI.** A runner's home directory is nobody's, so `run` reads none of the three there: what runs is
|
|
679
|
+
what is checked in and reviewable. This is also why nothing has to be cleaned up after a job.
|
|
680
|
+
|
|
645
681
|
Everything relative — `.env-file`, `.add-path`, `glob`, `read_file`, `{{ RUN.parent }}`, the working directory
|
|
646
682
|
— resolves against **the parent of `runfiles/`**. One anchor, one rule.
|
|
647
683
|
|
|
@@ -659,6 +695,11 @@ error: `setup` has never been run
|
|
|
659
695
|
It re-triggers when `setup.run` itself changes, so a new dependency is not silently missed. `--dry-run` is
|
|
660
696
|
exempt, CI is exempt, and `RUNFILE_SKIP_PREPARE=1` bypasses it.
|
|
661
697
|
|
|
698
|
+
The record lives in `state.json` in the platform state directory. In CI there is none: a runner is built and
|
|
699
|
+
thrown away, so there is no earlier session whose `setup` this one could be relying on — the gate is not
|
|
700
|
+
enforced and the file is not written. `RUNFILE_SKIP_PREPARE=1` is different: it turns the gate off on a machine
|
|
701
|
+
whose state is still worth keeping, so a `setup` run under it is still recorded.
|
|
702
|
+
|
|
662
703
|
## Commands
|
|
663
704
|
|
|
664
705
|
| Command | |
|
package/bin/darwin-arm64/run
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/darwin-x64/run
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/linux-arm64/run
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/linux-x64/run
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/win32-arm64/run.exe
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/win32-x64/run.exe
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED