feat: rewrite leddy on flags-2-env, modularize, add offline preview - #4
Merged
Conversation
The CLI was a single main.rs driving clap. It is now a modular crate whose surface is declared in .cli-flags.toml, and it uses all three org layers instead of two. flags-2-env - .cli-flags.toml is the CLI contract. --help and both shell completions are rendered from it by the statically linked C core at runtime, so there is no usage string in Rust to drift. - Command-scoped flags: --width/--height/--at exist under preview only, and are rejected unknown options elsewhere. - src/cli_config.rs is generated from the contract; CI diffs it for drift. - LEDDY_API_TOKEN is an [env] ignore entry: usable from the environment, never a flag, because a flag value is visible in ps output and shell history. new: leddy preview - Renders the message locally as ASCII art with no device and no network, through leddy_lib::render_message_frame — the same renderer the panel runs, so it is not a lookalike reimplementation. - A finished `--repeat once` message reports a blank display rather than failing. org dependencies - leddy-lib is now a real dependency: message cycle length and rendering both come from it. Previously only interfaces and clients were used. - Message and geometry validation is leddy-interfaces' own validate(); the protocol limits are not restated here. - Cargo entries deliberately carry no rev: leddy-lib and leddy-clients depend on leddy-interfaces by plain git URL, and cargo only unifies git sources whose specs match. A rev here would fork leddy-interfaces into two crates. - scripts/check-zed-dependencies.py replaces check-zed-package.py and also verifies every declared zed edge is a real Cargo dependency. layout: main.rs is argv-in/exit-code-out; flags, help, message, commands/, output, and error each do one job. preview and completion never start a runtime or an HTTP client — Command::needs_network decides that once, in the dispatcher. unsafe_code is denied crate-wide, with src/help.rs the single module that opts out for the C bindings. Exit codes: 2 usage, 3 config, 1 runtime. 26 tests pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ORESoftware/flags-2-env#25 merged, so the pin moves from 8a978ae to 8c84655 (flags-2-env 0.2.0). That removes the silent truncation of an inline --flag=value whose token ran past ~97 characters, which affected long paths, URLs, JSON payloads, and bearer tokens. The 'known upstream limitation' note in the README is dropped because it is no longer true. Tests pass on the new rev. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Cross-agent coordination review: this complements DEN-2343 rather than duplicating the API/E2E work. Both |
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CLI was a single
main.rsdriving clap. It is now a modular crate whose surface is declared in.cli-flags.toml, and it uses all three org layers instead of two.flags-2-env
.cli-flags.tomlis the CLI contract.--helpand both shell completions are rendered from it by the statically linked C core at runtime — there is no usage string in Rust to drift, and--helpis subcommand-aware.--width/--height/--atexist underpreviewonly. Elsewhere they are rejected unknown options rather than silently ignored ones.src/cli_config.rsis generated from the contract; CI diffs it against fresh generator output.LEDDY_API_TOKENis an[env] ignoreentry — usable from the environment, never a flag, because a flag value is visible inpsoutput and shell history.New:
leddy previewRenders the message locally as ASCII art with no device and no network, through
leddy_lib::render_message_frame— the same renderer the panel runs, so this is not a lookalike reimplementation:It is the fastest way to check whether a message fits before publishing it. A finished
--repeat oncemessage reports a blank display rather than failing.Org dependencies — all three layers now real
leddy-libis now a real dependency. Previously only interfaces and clients were used; cycle length and rendering both come from it now.leddy-interfaces' ownvalidate(). The protocol limits are not restated here, so they cannot quietly diverge.rev:leddy-libandleddy-clientsboth depend onleddy-interfacesby plain git URL, and cargo only unifies git sources whose specs match. Pinning a rev here would forkleddy-interfacesinto two crates and the shared types would stop being the same type.Cargo.lockstill pins the exact commits.scripts/check-zed-dependencies.pyreplacescheck-zed-package.py. It checks the same three edges and that each one is a real Cargo dependency — a zed manifest that names a repo which does not exist looks right and never resolves.Layout
main.rsis argv-in/exit-code-out.flags,help,message,commands/,output, anderroreach do one job.previewandcompletionnever start a runtime or an HTTP client — being offline is part of what they are, soCommand::needs_networkdecides that once, in the dispatcher.unsafe_codeis denied crate-wide;src/help.rsis the single module that opts itself out for the C bindings.Exit codes
0success ·1runtime (device unreachable) ·2usage ·3unreadable contract.26 tests pass;
cargo clippy -- -D warningsandcargo fmt --checkare clean.🤖 Generated with Claude Code