valise-sh 0.2.0 → 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/CHANGELOG.md +152 -2
- package/README.md +99 -146
- package/bin/valise +57 -5376
- package/docs/architecture.md +77 -121
- package/docs/contrib-modules.md +172 -218
- package/docs/installation.md +137 -83
- package/docs/module-abi.md +125 -126
- package/docs/projects.md +249 -0
- package/docs/release-policy.md +68 -93
- package/docs/shared-modules.md +40 -39
- package/examples/README.md +12 -11
- package/examples/e2e/README.md +59 -66
- package/examples/e2e/bundles.tsv +6 -0
- package/examples/e2e/module.d/e2e_aliases.meta +1 -2
- package/examples/e2e/module.d/e2e_completions_bash.meta +0 -1
- package/examples/e2e/module.d/e2e_completions_zsh.meta +0 -1
- package/examples/e2e/module.d/e2e_env_setup.meta +2 -3
- package/examples/e2e/module.d/e2e_fish_features.meta +0 -1
- package/examples/e2e/module.d/e2e_generated_config.meta +1 -2
- package/examples/e2e/module.d/e2e_ksh_features.meta +0 -1
- package/examples/e2e/module.d/e2e_layer_probe.meta +1 -2
- package/examples/e2e/module.d/e2e_optional_network.meta +1 -2
- package/examples/e2e/module.d/e2e_platform_tools.meta +8 -0
- package/examples/e2e/module.d/e2e_platform_tools_bsd.meta +2 -3
- package/examples/e2e/module.d/e2e_platform_tools_darwin.meta +2 -3
- package/examples/e2e/module.d/e2e_platform_tools_linux.meta +2 -3
- package/examples/e2e/valise.conf +4 -0
- package/examples/e2e/variants.tsv +3 -0
- package/examples/local/module.d/hello_valise.meta +1 -2
- package/examples/profile-project/README.md +78 -108
- package/examples/profile-project/bundles.tsv +8 -0
- package/examples/profile-project/{shell/layers → layers}/demo/module.d/contrib_demo_greeting.meta +1 -2
- package/examples/profile-project/{shell/module.d → module.d}/greeting.meta +1 -2
- package/examples/profile-project/{shell/module.d → module.d}/profile_main.meta +0 -1
- package/examples/profile-project/{shell/modules → modules}/greeting.sh +1 -1
- package/examples/profile-project/valise.conf +4 -0
- package/examples/profile-project/variants.tsv +3 -0
- package/examples/shared/README.md +13 -34
- package/examples/shared/module.d/contrib_shared_paths.meta +2 -3
- package/examples/shared/module.d/contrib_shared_umask.meta +1 -2
- package/examples/shared/modules/shared/contrib_shared_paths.sh +2 -2
- package/lib/capabilities.sh +40 -13
- package/lib/cli/commands.sh +278 -0
- package/lib/cli/common.sh +326 -0
- package/lib/cli/devtools.sh +539 -0
- package/lib/cli/fish-hook.sh +986 -0
- package/lib/cli/integration.sh +337 -0
- package/lib/cli/lifecycle.sh +578 -0
- package/lib/cli/project.sh +1807 -0
- package/lib/cli/store.sh +1023 -0
- package/lib/cli/usage.sh +308 -0
- package/lib/compiler.awk +11 -4
- package/lib/fish/loader.fish +69 -9
- package/lib/fish/metadata.fish +49 -5
- package/lib/fish/profile.fish +170 -0
- package/lib/loader.sh +6 -8
- package/lib/metadata.sh +111 -5
- package/manifests/parser-support.tsv +2 -2
- package/module.d/valise_editor.meta +9 -0
- package/module.d/valise_history.meta +9 -0
- package/module.d/valise_pager.meta +9 -0
- package/module.d/valise_path.meta +9 -0
- package/module.d/{platform_bsd.meta → valise_platform_bsd.meta} +3 -4
- package/module.d/{platform_linux.meta → valise_platform_linux.meta} +3 -4
- package/module.d/{platform_macos.meta → valise_platform_macos.meta} +3 -4
- package/module.d/{platform_posix.meta → valise_platform_posix.meta} +2 -3
- package/module.d/valise_xdg.meta +9 -0
- package/modules/system/{contrib_editor.sh → valise_editor.sh} +2 -2
- package/modules/system/{contrib_history.sh → valise_history.sh} +2 -2
- package/modules/system/{contrib_pager.sh → valise_pager.sh} +2 -2
- package/modules/system/{contrib_path.sh → valise_path.sh} +3 -3
- package/modules/system/{contrib_xdg.sh → valise_xdg.sh} +2 -2
- package/package.json +91 -10
- package/docs/variants.md +0 -327
- package/entrypoints/.gitkeep +0 -0
- package/entrypoints/fish/profile.fish +0 -99
- package/examples/e2e/build-manifest.sh +0 -138
- package/examples/local/.gitkeep +0 -0
- package/examples/profile-project/shell/release/bundle-roots +0 -9
- package/examples/profile-project/shell/release/install-variants +0 -3
- package/examples/profile-project/shell/release/module-registry.tsv +0 -4
- package/examples/profile-project/shell/release/project.conf +0 -3
- package/lib/.gitkeep +0 -0
- package/manifests/.gitkeep +0 -0
- package/module.d/.gitkeep +0 -0
- package/module.d/contrib_editor.meta +0 -10
- package/module.d/contrib_history.meta +0 -10
- package/module.d/contrib_pager.meta +0 -10
- package/module.d/contrib_path.meta +0 -10
- package/module.d/contrib_xdg.meta +0 -10
- package/modules/.gitkeep +0 -0
- /package/examples/profile-project/{shell/layers → layers}/demo/modules/shared/contrib_demo_greeting.sh +0 -0
package/docs/architecture.md
CHANGED
|
@@ -1,146 +1,102 @@
|
|
|
1
1
|
# Architecture and scope
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
valise-sh is a shell-profile engine. It reads module metadata as data,
|
|
4
|
+
compiles a static startup plan for each shell, packages the plans and module
|
|
5
|
+
bodies into a sealed release, installs the release, and verifies it. Your
|
|
6
|
+
profile lives in a separate valise project; the engine supplies the tools
|
|
7
|
+
and a few generic modules.
|
|
7
8
|
|
|
8
9
|
## Components
|
|
9
10
|
|
|
10
11
|
| Path | Responsibility |
|
|
11
12
|
|---|---|
|
|
12
|
-
| `
|
|
13
|
-
| `lib/
|
|
14
|
-
| `lib/
|
|
15
|
-
| `lib/compiler.awk` |
|
|
16
|
-
| `lib/capabilities.sh` |
|
|
17
|
-
| `lib/fish/`
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `manifests/parser-support.tsv` |
|
|
13
|
+
| `bin/valise` | The CLI. It sources the parts under `lib/cli/` and dispatches commands. |
|
|
14
|
+
| `lib/cli/` | CLI parts: `project.sh` (project config, registry, compile, build), `store.sh` (release store, install, `release`), `integration.sh` (startup-file blocks, `doctor`), `fish-hook.sh`, `commands.sh` (published commands), `lifecycle.sh` (rollback, transactions, uninstall, dry runs), `devtools.sh` (`lint`, `test`, `run`, `env`), `usage.sh`, `common.sh`. |
|
|
15
|
+
| `lib/metadata.sh` | Parses and validates `.meta` files as data. |
|
|
16
|
+
| `lib/compiler.awk` | Turns the resolved module graph into a static POSIX plan. |
|
|
17
|
+
| `lib/capabilities.sh` | The `sp_cap_*` helpers. A release carries it as `runtime/capabilities.sh`. |
|
|
18
|
+
| `lib/fish/` | The native Fish metadata reader, loader, and adapter. A release carries them under `runtime/fish/`. |
|
|
19
|
+
| `lib/loader.sh`, `entrypoints/profile.sh` | The development loader, which resolves and sources modules at load time from a checkout. Installed profiles do not use it. |
|
|
20
|
+
| `module.d/`, `modules/` | The engine modules (`valise_*`). |
|
|
21
|
+
| `manifests/parser-support.tsv` | The parsers each shipped file class must pass. |
|
|
21
22
|
| `tests/`, `examples/` | Quarantined tests and runnable examples. |
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[contrib-modules.md](contrib-modules.md)
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
The POSIX integration snippet prefers the compiled plan for the running
|
|
63
|
-
shell and falls back to the loader, so a startup file written by either
|
|
64
|
-
shape loads the release it is pointed at.
|
|
65
|
-
|
|
66
|
-
## Loading modules
|
|
67
|
-
|
|
68
|
-
The POSIX entrypoint is sourced, not executed. A caller can select roots,
|
|
69
|
-
modules, and failure policy explicitly:
|
|
24
|
+
[projects.md](projects.md) describes a project and the compile and build
|
|
25
|
+
contract, [module-abi.md](module-abi.md) the metadata,
|
|
26
|
+
[installation.md](installation.md) installation and the release store, and
|
|
27
|
+
[contrib-modules.md](contrib-modules.md) writing and testing modules.
|
|
28
|
+
|
|
29
|
+
## From metadata to a running shell
|
|
30
|
+
|
|
31
|
+
1. `valise build` reads every `.meta` file in the project (`module.d/`, each
|
|
32
|
+
`layers/<provider>/module.d/`) and the engine's own `module.d/`, as data,
|
|
33
|
+
into an internal table. `valise registry` prints that table; nothing reads
|
|
34
|
+
a saved copy.
|
|
35
|
+
2. For each POSIX shell in the bundle, the compiler resolves the roots'
|
|
36
|
+
closure, applies the variant's exclusions, orders the modules by
|
|
37
|
+
dependency, and writes `plans/<shell>.sh`. A module that publishes
|
|
38
|
+
commands gets its own plan under `plans/commands/`.
|
|
39
|
+
3. The build copies the modules some shell loads, the capability prelude,
|
|
40
|
+
and the Fish runtime when the bundle has Fish roots, then writes
|
|
41
|
+
`manifest.tsv`. The release id is the SHA-256 of the manifest.
|
|
42
|
+
4. `valise install` copies the tree into the release store, verifies it,
|
|
43
|
+
switches the active link, writes the startup-file blocks and the Fish
|
|
44
|
+
hook, and publishes command stubs. If any step fails, install restores
|
|
45
|
+
the previous state.
|
|
46
|
+
5. At startup, the POSIX block picks the plan for the running shell class
|
|
47
|
+
(`bash`, `zsh`, `ksh`, or `sh`) and sources it. The plan contains the
|
|
48
|
+
load order; it reads no metadata. Fish verifies the release, then runs
|
|
49
|
+
the native Fish loader over the release's Fish metadata.
|
|
50
|
+
|
|
51
|
+
There is one release shape. The plan is generated ahead of time so that
|
|
52
|
+
startup does no resolution work and so that you can read exactly what will
|
|
53
|
+
run.
|
|
54
|
+
|
|
55
|
+
## The development loader
|
|
56
|
+
|
|
57
|
+
`entrypoints/profile.sh` and `lib/loader.sh` load modules straight from a
|
|
58
|
+
checkout, resolving dependencies when they are sourced. They are for working
|
|
59
|
+
on the engine's own modules and for the loader's tests; installed profiles
|
|
60
|
+
and `valise run` use compiled plans. The loader honors the same metadata,
|
|
61
|
+
including optional dependencies, platform gating, export checks, and failure
|
|
62
|
+
cleanup:
|
|
70
63
|
|
|
71
64
|
```sh
|
|
72
65
|
VALISE_ROOT=/path/to/valise-sh
|
|
73
|
-
VALISE_MODULE_ROOT=/path/to/
|
|
66
|
+
VALISE_MODULE_ROOT=/path/to/modules
|
|
74
67
|
VALISE_MODULES='module_a module_b'
|
|
75
68
|
VALISE_MODE=strict
|
|
76
69
|
. "$VALISE_ROOT/entrypoints/profile.sh"
|
|
77
70
|
```
|
|
78
71
|
|
|
79
|
-
`VALISE_MODULES` unset means
|
|
80
|
-
|
|
81
|
-
its startup integration. Searching upward from the current directory when
|
|
82
|
-
`VALISE_ROOT` is omitted is a checkout convenience, not an installed-profile
|
|
83
|
-
configuration strategy.
|
|
72
|
+
`VALISE_MODULES` unset means nothing is loaded. Its search path is described
|
|
73
|
+
in [module-abi.md](module-abi.md#the-development-loaders-search-path).
|
|
84
74
|
|
|
85
|
-
|
|
86
|
-
first; present optional dependencies are also considered. Cycles and invalid
|
|
87
|
-
or conflicting records are rejected. Strict mode returns failure for a
|
|
88
|
-
requested module's failure; permissive mode reports the affected module and
|
|
89
|
-
continues with unrelated requests. The loader has no unload operation.
|
|
75
|
+
## Scope boundaries
|
|
90
76
|
|
|
91
|
-
The
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
The engine does not define your modules, your bundles, your workstation
|
|
78
|
+
policy, or wrappers around other tools. Those belong in your project.
|
|
79
|
+
`valise new` writes an empty project so you do not have to invent the
|
|
80
|
+
layout.
|
|
95
81
|
|
|
96
|
-
|
|
82
|
+
Project commands (`module`, `build`, `apply`, `status`, `lint`, `test`,
|
|
83
|
+
`run`, `compile`, `registry`, `explain-variant`, `explain-bundles`) run
|
|
84
|
+
inside a directory that holds `valise.conf`, found by walking up from the
|
|
85
|
+
working directory. Release commands (`install`, `release`, `uninstall`,
|
|
86
|
+
`init`, `doctor`, `make-manifest`) and `new`, `env`, `layer-lint`, and
|
|
87
|
+
`version` run anywhere.
|
|
97
88
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
the catalog itself is still the consumer's to write.
|
|
103
|
-
|
|
104
|
-
The CLI splits into two groups by what they need.
|
|
105
|
-
|
|
106
|
-
Commands that work in a bare checkout: `init`, `install`, `release`,
|
|
107
|
-
`doctor`, `make-manifest`, `version`, and `new`.
|
|
108
|
-
|
|
109
|
-
Commands that need a consuming project, because they read or write the
|
|
110
|
-
project's source tree: `registry`, `module`, `build`, `apply`, `status`,
|
|
111
|
-
`compile`, `explain-variant`, `explain-bundles`, and
|
|
112
|
-
`layer-lint`. A project is recognised by `shell/module.d/` or
|
|
113
|
-
`shell/release/module-registry.tsv`; the project commands run from the
|
|
114
|
-
project root and read their defaults from `shell/release/project.conf`.
|
|
115
|
-
|
|
116
|
-
## The registry is generated, not authored
|
|
117
|
-
|
|
118
|
-
`shell/release/module-registry.tsv` is a build artifact. `valise registry`
|
|
119
|
-
reads every `.meta` file under `shell/module.d/` and
|
|
120
|
-
`shell/layers/<provider>/module.d/` and writes the registry from them, in the
|
|
121
|
-
C locale, so repeated generation is byte-identical. `valise registry --check`
|
|
122
|
-
compares the file against the metadata without rewriting it, which is what
|
|
123
|
-
`valise status` reports as registry freshness. `build` regenerates the
|
|
124
|
-
registry before compiling, so a project that contains only
|
|
125
|
-
metadata and bodies still builds.
|
|
126
|
-
|
|
127
|
-
This makes the `.meta` files the single source of truth. A hand-edited
|
|
128
|
-
registry is not supported: the next build overwrites it.
|
|
129
|
-
|
|
130
|
-
The `updates=` metadata field records identifiers for a consumer's update
|
|
131
|
-
manifest. It does not make this engine a network updater. Shared modules are
|
|
132
|
-
vendored snapshots: consumers review provider changes, update the snapshot,
|
|
133
|
-
and rebuild their release. The engine does not authenticate authors or sign
|
|
134
|
-
releases; its manifest check detects changes to bytes after the manifest is
|
|
135
|
-
created.
|
|
89
|
+
Shared modules are vendored copies. You review a provider's changes, copy
|
|
90
|
+
them into `layers/<provider>/`, and rebuild. The engine does not fetch
|
|
91
|
+
updates, authenticate authors, or sign releases; the manifest detects bytes
|
|
92
|
+
that changed after the release was built.
|
|
136
93
|
|
|
137
94
|
## Verification
|
|
138
95
|
|
|
139
|
-
Run `make check-fast` while developing and `make check` for the
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Actions workflow installs the shell runtimes used by the release check.
|
|
96
|
+
Run `make check-fast` while developing and `make check` for the full suite.
|
|
97
|
+
Extended runtime lanes run when their tools are installed; missing tools are
|
|
98
|
+
visible skips locally and failures in CI. Set `VALISE_REQUIRE_TOOLING=1` to
|
|
99
|
+
require them on a developer machine.
|
|
144
100
|
|
|
145
|
-
|
|
146
|
-
runtime, the docs, and the examples
|
|
101
|
+
The Makefile and the tests live in the source repository. The npm package
|
|
102
|
+
ships the runtime, the docs, and the examples.
|