@sibylline-labs/eris 0.0.0-stage → 0.3.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 +202 -0
- package/NOTICE +2 -0
- package/README.md +146 -2
- package/bin/eris.ts +42 -0
- package/docs/ARCHITECTURE.md +188 -0
- package/docs/COMPLETION.md +106 -0
- package/docs/ERRORS.md +632 -0
- package/docs/OUTPUT-CONTRACT.md +219 -0
- package/docs/README.md +30 -0
- package/docs/UPDATE.md +159 -0
- package/docs/YAK.md +395 -0
- package/docs/dev/ADDING-A-COMMAND.md +79 -0
- package/docs/dev/DEVELOPMENT.md +88 -0
- package/docs/dev/LAYOUT.md +74 -0
- package/docs/dev/PLUGINS.md +382 -0
- package/docs/dev/RELEASING.md +157 -0
- package/docs/dev/TESTING.md +84 -0
- package/docs/dev/surfaces/secrets.md +95 -0
- package/package.json +55 -4
- package/packages/yak-contract/package.json +28 -0
- package/packages/yak-contract/schema/yak-v2.schema.json +416 -0
- package/packages/yak-contract/src/index.ts +1 -0
- package/packages/yak-contract/src/v2.ts +375 -0
- package/plugins/index.ts +12 -0
- package/plugins/yak/handlers.ts +128 -0
- package/plugins/yak/index.ts +51 -0
- package/plugins/yak/login.ts +300 -0
- package/plugins/yak/yak-context.ts +280 -0
- package/plugins/yak/yak-identity.ts +399 -0
- package/plugins/yak/yak-redact.ts +686 -0
- package/plugins/yak/yak-setup.ts +133 -0
- package/plugins/yak/yak-submit.ts +1166 -0
- package/plugins/yak/yak.ts +485 -0
- package/src/build.ts +248 -0
- package/src/cli/args.ts +434 -0
- package/src/cli/commands/completion/bash.ts +24 -0
- package/src/cli/commands/completion/domain.ts +203 -0
- package/src/cli/commands/completion/emit.ts +246 -0
- package/src/cli/commands/completion/shell.ts +24 -0
- package/src/cli/commands/completion/zsh.ts +24 -0
- package/src/cli/commands/completion.ts +48 -0
- package/src/cli/commands/update/github.ts +328 -0
- package/src/cli/commands/update/opt-in.ts +32 -0
- package/src/cli/commands/update/refusal.ts +21 -0
- package/src/cli/commands/update/release.ts +351 -0
- package/src/cli/commands/update/replace.ts +143 -0
- package/src/cli/commands/update/semver.ts +48 -0
- package/src/cli/commands/update.ts +47 -0
- package/src/cli/commands/usage.ts +68 -0
- package/src/cli/commands/version.ts +29 -0
- package/src/cli/compose.ts +273 -0
- package/src/cli/output.ts +81 -0
- package/src/cli/plugin.ts +85 -0
- package/src/cli/registry.ts +180 -0
- package/src/cli/router.ts +31 -0
- package/src/cli/ts-verb.ts +126 -0
- package/src/main.ts +223 -0
- package/src/runtime/env.ts +16 -0
- package/src/runtime/eris-assets.d.ts +5 -0
- package/src/runtime/home.ts +306 -0
- package/src/runtime/logging.ts +43 -0
- package/src/runtime/process.ts +388 -0
- package/src/runtime/settings.ts +191 -0
- package/src/sdk.ts +62 -0
- package/testing/build-child.ts +55 -0
- package/testing/fake-runner.ts +23 -0
- package/testing/index.ts +16 -0
- package/ts/lib/eris-fail.ts +180 -0
- package/ts/lib/pool.ts +63 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Shell Tab Completion
|
|
2
|
+
|
|
3
|
+
`eris completion` emits tab-completion scripts for bash and zsh (the
|
|
4
|
+
`kubectl completion` pattern): command groups, verbs, flags, and file names
|
|
5
|
+
after a file-valued flag.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
eris <TAB> # command groups
|
|
9
|
+
eris yak <TAB> # yak verbs
|
|
10
|
+
eris yak issue --<TAB> # --summary --body --body-file ...
|
|
11
|
+
eris yak issue --body-file <TAB> # file names
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# bash — current shell only
|
|
18
|
+
source <(eris completion bash)
|
|
19
|
+
# bash — every shell
|
|
20
|
+
echo 'source <(eris completion bash)' >> ~/.bashrc
|
|
21
|
+
|
|
22
|
+
# zsh — current shell only
|
|
23
|
+
source <(eris completion zsh)
|
|
24
|
+
# zsh — every shell
|
|
25
|
+
echo 'source <(eris completion zsh)' >> ~/.zshrc
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Sourcing via process substitution is the recommended route: the emitted
|
|
29
|
+
script embeds a snapshot of the command tree derived from the installed eris
|
|
30
|
+
source, so regenerating at shell startup keeps completion in lock-step with
|
|
31
|
+
upgrades. If you prefer a static file (marginally faster shell startup),
|
|
32
|
+
save the output and re-emit after upgrading eris:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
eris completion bash > ~/.eris/completion.bash
|
|
36
|
+
echo 'source ~/.eris/completion.bash' >> ~/.bashrc
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Completion registers for the command name `eris`. If you invoke a checkout
|
|
40
|
+
directly as `./eris`, add `complete -F _eris_completions ./eris` after
|
|
41
|
+
sourcing.
|
|
42
|
+
|
|
43
|
+
## How it works
|
|
44
|
+
|
|
45
|
+
**Static tree — generated from the verb registry.** `eris completion` is a
|
|
46
|
+
TypeScript verb (`src/cli/commands/completion/`). At emission time
|
|
47
|
+
`emit.ts` reads the composed registry (core's `src/cli/registry.ts` plus the
|
|
48
|
+
build's plugins) and generates the groups, each group's subs, nested subs,
|
|
49
|
+
and the long flags of every command path. A row added to the registry, or
|
|
50
|
+
declared by a plugin, completes with no other edit.
|
|
51
|
+
|
|
52
|
+
- **Flags are per command path.** `eris yak issue --<TAB>` offers exactly the
|
|
53
|
+
flags `yak issue` accepts. Before a verb is typed (`eris yak --<TAB>`), or
|
|
54
|
+
after a verb the registry does not know, the group's whole set is offered.
|
|
55
|
+
`--help` is always offered, and `eris <TAB>` offers `--help` and `--version` beside the groups.
|
|
56
|
+
- **Value-taking flags come from the registry too** (`takesValue`): the word
|
|
57
|
+
after one is never completed as a positional and never counted as one.
|
|
58
|
+
A value flag whose row says `file: true` completes file names: yak's
|
|
59
|
+
`--body-file` and `--evidence-file`. A plugin declares its own the same way.
|
|
60
|
+
- **Positional slots are on the row** (`complete`, one entry per slot): literal
|
|
61
|
+
words, `@file` for file names, or a completion domain, whose words only a
|
|
62
|
+
shell function can list at tab-press time. A domain's helper and library texts are
|
|
63
|
+
emitted once and its function is called with the words typed in the earlier slots
|
|
64
|
+
([PLUGINS.md](dev/PLUGINS.md#completion-domains)). A row with no `complete`
|
|
65
|
+
completes no positionals.
|
|
66
|
+
|
|
67
|
+
Emission imports the registry and nothing else. It runs on every shell start,
|
|
68
|
+
so no other verb's source is on its path: a file mid-edit elsewhere in eris
|
|
69
|
+
cannot break a login shell. Emission itself needs no `yq`.
|
|
70
|
+
|
|
71
|
+
**A tab press never invokes eris and never touches the network.** It reads
|
|
72
|
+
only the tree embedded in the script, and offers nothing rather than erroring:
|
|
73
|
+
a tab press must never print to stderr or hang. A domain's helper is held to
|
|
74
|
+
the same: each helper and library text must be exactly one function definition
|
|
75
|
+
in a subset of shell that bash and zsh frame alike, so sourcing the script
|
|
76
|
+
defines it and runs nothing; composition refuses anything else
|
|
77
|
+
(`src/cli/commands/completion/domain.ts`).
|
|
78
|
+
|
|
79
|
+
## zsh route
|
|
80
|
+
|
|
81
|
+
zsh loads the identical completion body through `bashcompinit` (the engine
|
|
82
|
+
sets the `ksharrays` localoption so `COMP_WORDS` indexing matches bash).
|
|
83
|
+
One body for both shells was chosen over a native `_eris` because it halves
|
|
84
|
+
the maintenance surface and the grammar (two-level verbs + positional
|
|
85
|
+
domains) gains little from zsh's `_arguments` machinery. The wrapper runs
|
|
86
|
+
`compinit` only when `compdef` is not already defined, so it composes with
|
|
87
|
+
existing `.zshrc` setups.
|
|
88
|
+
|
|
89
|
+
## Compatibility
|
|
90
|
+
|
|
91
|
+
The emitted script is bash-3.2-clean (macOS `/bin/bash`): no associative
|
|
92
|
+
arrays, no `mapfile`, no `${var,,}`. `eris completion bash` itself runs under
|
|
93
|
+
a 3.2 `/bin/bash` too, because the shim is 3.2-clean and hands the verb to
|
|
94
|
+
bun. `tests/completion.test.ts`
|
|
95
|
+
checks the scripts with `/bin/bash -n` and `zsh -n`, drives `_eris_completions`
|
|
96
|
+
with COMP_WORDS under `/bin/bash` (and the zsh route through a real
|
|
97
|
+
`compinit` + `bashcompinit`), and asserts that a tab press runs neither eris
|
|
98
|
+
nor a network client.
|
|
99
|
+
|
|
100
|
+
If your shell rc caches the emitted script and re-emits when eris changes,
|
|
101
|
+
watch `src/` and `plugins/`: the command tree comes from the composed registry.
|
|
102
|
+
|
|
103
|
+
## Troubleshooting
|
|
104
|
+
|
|
105
|
+
- **New verbs missing after an upgrade** — you saved a static file instead
|
|
106
|
+
of sourcing via process substitution; re-run `eris completion <shell>`.
|