Manifest Schema is inadequate for multiplexed commands (Subcommands, Contextual Autocompletion, and Dynamic Outputs) #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The current TOML manifest schema (as shown in
PROGRAMS.md) models commands as a flat list of arguments and options. While this works well for single-purpose utilities likelistorsearch, it breaks down for multiplexed binaries (e.g.,git,pkg,network).Currently, the schema treats subcommands (like
commitorinstall) as standard string arguments. This flat architecture introduces severe limitations in autocompletion, output rendering, and capability security.1: Subcommands have distinct argument and flag schemas
Right now, the manifest for
gitspecifies a singlesubcommandargument, followed by anargumentsstring.For devs: The terminal has no way to perform ahead-of-time validation. If a user types
git commit --branch main, the terminal parses--branchas a valid flag (if defined globally) or an invalid one, without knowing that--branchbelongs tocheckout, notcommit— we would lose the declarative CLI validation that is central to the shell's design.For users:
Autocompletion is effectively broken. If a user types
pkg <TAB>, the shell doesn't know whether to suggestinstall,remove, orsearch. If they typepkg install <TAB>, the shell cannot intelligently swap to package-name completion, because it doesn't understand thatinstallchanged the context of the subsequent arguments.2: Context-Blind Dynamic Autocompletion
The manifest allows for
type = "dynamic"with aprovider = "get_branches"IPC endpoint. However, completions are rarely context-free.For devs:
If a user types
git push origin <TAB>, the terminal needs to query thegitautocomplete provider for branches. But to provide accurate results, the daemon needs to know thatoriginwas the preceding argument (so it can fetch remote branches instead of local ones). Furthermore, querying an IPC endpoint for completion might require the program's daemon to spin up or access the filesystem. The current schema provides no mechanism for the terminal to pass the current AST or context state to the IPC provider.3: Polymorphic Output Fields
PROGRAMS.mdspecifies that a program declares its output type (e.g.,output = "record_list"). The terminal uses this to format the data.For devs:
git statusmight emit arecord_listcontaining[file_path, file_state].git branchmight emit arecord_listcontaining[branch_name, upstream_tracking, is_active].If the output type is declared at the root level of the
gitmanifest, the terminal's formatting engine doesn't know which fields to expect. Downstream pipeline tools (likewhereorslice) also cannot inspect the manifest to validate user expressions (e.g.,git branch | where is_active = true) before execution.4: Security and Capability Over-scoping
ZerOS relies on a strict capability-based security model. A process is only granted the capabilities it needs to execute.
For devs:
Consider the
pkgcommand.pkg searchneeds network access (or read access to/var/pkg_index).pkg installneeds network access and write access to/pkg/.If capabilities are resolved at the program level before the ELF binary is spawned via
sys_spawn, the OS must grant write access to/pkg/every time the user runspkg search. This violates the principle of least privilege. The OS needs a way to scope required capabilities to the specific subcommand being invoked, before the process is spawned.Examples to Test Against
Any proposed redesign of the TOML schema and shell parser must be able to gracefully handle the following scenarios:
ping 1.1.1.1(Standard arg validation)git push origin main(Subcommand with its own positional args and contextual completion)pkg install <TAB>(Subcommand requiring dynamic completion and elevated filesystem capabilities)systemvssystem --raw(Ensuring the global flag doesn't interfere with subcommand parsing)