A rewrite of the Plan 9 rc shell in Goose for UNIX-like systems and with structured CLI args
rc ARCHITECTURE.md
4.8 kB · 81 lines
Markdown

# Architecture ```text rc2.goose: input, startup, and invocation | +-- editor.goose: terminal input and completion hooks | +-- context.goose: nested completion contexts and scalar prefixes | +-- grapheme.goose, layout.goose: Unicode boundaries and terminal positions | +-- terminal_text.goose: safe terminal text +-- history.goose: complete records and persistence policy | +-- runtime.goose: command evaluation and process coordination | +-- syntax.goose: lexer and parser +-- declaration.goose: literal argument schemas and script metadata +-- jobs.goose: process groups, job state, and terminal ownership policy +-- resources.goose: resource syntax and process-state commands +-- memory.goose: safe-point pool reclamation +-- expand.goose: list and word evaluation | +-- glob.goose: path expansion | +-- pattern.goose: Unicode pattern matching | +-- platform.goose: native interface and descriptor checks +-- native/posix.c: POSIX operations schema.goose +-- cli.goose: argument parsing +-- completion.goose: completion generation data.goose: indexed syntax, text, values, variables, and functions ``` The CLI parser and completion generator use data, not script execution. `declaration.goose` converts the literal `args` block to this schema. Metadata extraction parses a script without command execution. The editor uses the same conversion for automatic script completion. Generated rc completions contain literal option metadata. The editor reads it without command execution. Subcommand declarations form an indexed command tree. Each scope retains its own arguments and its parent index. The selected scopes form the implicit `$subcommand` list. The parser reserves this variable and replaces it on each successful declaration. The argument scanner stops at child-command boundaries without consuming option values as command names. The declaration layer derives scoped help and completion…