Skip to content

feat(002): stagecraft crate scaffold, layered config, CI - #1

Merged
bartekus merged 1 commit into
mainfrom
feat/002-crate-scaffold
Jul 15, 2026
Merged

feat(002): stagecraft crate scaffold, layered config, CI#1
bartekus merged 1 commit into
mainfrom
feat/002-crate-scaffold

Conversation

@bartekus

Copy link
Copy Markdown
Contributor

Spec 002: crate scaffold, config, CI

Implements specs/002-crate-scaffold/spec.md: the single stagecraft
binary that every later verb hangs off. No network I/O yet (auth and the
API client arrive in 003).

What lands

  • Command tree (clap derive): stub verbs (login/whoami,
    tenants, stamp, fleet, mcp) whose --help names the owning
    spec and whose handlers exit 2; working version, config show, and
    completions <shell>.
  • Layered config: flags > env (STAGECRAFT_*) > config file > default, resolved by a pure, unit-tested function. config show
    prints the effective value of each field with its source.
  • Output discipline: one layer, human text on a TTY and stable JSON
    with --output json. JSON shapes are treated as API from the first
    verb (the MCP face in 005 reuses them).
  • Exit-code contract: 0 ok, 1 operational, 2 usage /
    not-implemented; errors go to stderr only.
  • CI (ci.yml): fmt, clippy -D warnings, test, release build on a
    SHA-pinned actions/checkout. The spec-spine governance gate stays in
    its own spec-spine.yml workflow.

Verification (local)

  • cargo build --release yields target/release/stagecraft; --help
    shows the full tree; stubs exit 2 naming their spec; config show and
    completions zsh work.
  • cargo test: 18 tests (config precedence per field/source, exit
    codes, JSON shape, stdout hygiene).
  • Spine gates green: compile, index, lint --fail-on-warn,
    index check, and couple (11 paths, no drift).

Spec change

Amended 002 (before coding, per the backlog protocol) to declare
clap_complete in the dependency list: the spec required a working
completions verb but omitted the crate that generates the scripts.
Flipped implementation to complete.

Note

directories resolves the config path per platform (Linux
~/.config/stagecraft/config.toml, macOS
~/Library/Application Support/stagecraft/config.toml), consistent with
the spec's "via the directories crate" instruction.

The single `stagecraft` binary lands: a clap command tree whose stub
verbs name their owning spec and exit 2, three working verbs (version,
config show, completions), layered configuration (flags > env > file >
default) with per-field source provenance, and a shared output layer
(human text on TTY, stable JSON with --output json). JSON shapes are
treated as API from the first verb, for the MCP face in spec 005.

Exit-code contract: 0 ok, 1 operational, 2 usage / not-implemented;
errors go to stderr only. CI (ci.yml) runs fmt, clippy -D warnings,
test, and a release build on a SHA-pinned checkout; the spec-spine
governance gate stays in its own workflow.

Amends spec 002 to declare clap_complete (the completions verb's script
generator) in the dependency list, and flips it to implementation:
complete. No network I/O yet; auth and the API client arrive in 003.
@bartekus
bartekus merged commit 141cee6 into main Jul 15, 2026
2 checks passed
@bartekus
bartekus deleted the feat/002-crate-scaffold branch July 15, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant