mirror of
https://github.com/MarkusZoppelt/portfolio_rs.git
synced 2026-11-28 13:02:12 +01:00
The README had grown to ~600 lines, mostly MCP and HTTP API reference. It now keeps the pitch, installation, quick start, a short TUI section, the command table and an index of docs/. The reference material moved to docs/ (tui, agents, mcp, http-api, library, quotes, configuration), and the MCP docs test now checks docs/mcp.md. The TUI screenshots and the CLI demo gif were outdated and are removed; img/ is excluded from the published crate. Em-dashes are gone from the README, the new docs and the crate description.
3.3 KiB
3.3 KiB
AGENTS.md
Rust CLI/TUI for portfolio management. Single crate, bin + lib: src/main.rs just calls
cli::run() in src/cli.rs (clap builder + dispatch). Subcommand handlers live in
src/commands/, domain logic in src/*.rs (portfolio, position, policy, review,
workspace, ...), quote fetching in src/services/ (Yahoo Finance). Static workspace/skill
templates (INVESTMENT_POLICY.md, AGENTS.md, CLAUDE.md, SKILL.md) live as plain
Markdown under templates/ and are compiled in via include_str!.
Verify (matches CI, .github/workflows/rust.yml)
cargo build
cargo test # unit tests + tests/{e2e_offline,api_offline}.rs
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --check # rustfmt.toml: max_width = 100
- Network tests are all
#[ignore]:cargo test --test e2e_network -- --ignored(requires internet / Yahoo Finance). Don't un-ignore them. - Single test:
cargo test test_nameorcargo test --test e2e_offline test_name. - CI also runs
nix flake checkandnix fmt -- --check .(alejandra). If you touchflake.nix, format it withnix fmtor CI fails.
Gotchas
- The full command surface (context, review, simulate, policy, decision, report,
doctor, validate, init-workspace, agent, mcp, api) is defined in
src/cli.rs; README.md (command table) anddocs/document it; keep them in sync when adding commands.tests/mcp_offline.rschecks thatdocs/mcp.mdlists every MCP tool and resource. - CLI handlers in
src/commands/returneyre::Resultand propagate tomainfor non-zero exit codes.validateuses exit code 2 for validation failures. state::AppState+ its DTOs are the public facade consumed by the HTTP API and the external Tauri GUI (separate repo, depends on this crate by path). Changing DTO shapes (all camelCase serde) is a breaking change for the GUI.positions.jsonanddatabase/at repo root are the user's real data (gitignored). Never commit them; useexample_data.jsonin tests/examples.- Running the app opens a sled DB at
./databaserelative to CWD (src/services/persistence.rs) — a side effect of runningbalances/TUI locally. .gpgportfolio files are decrypted by shelling out togpg; decrypted content must never be written to disk.- Portfolio writes go through the atomic helper (
src/services/atomic_write.rs) and keep a single.bak. - User config is loaded via confy (YAML) from the user config dir;
create_live_portfoliodegrades gracefully offline (returnsNetworkStatus), so most code paths must not assume live quotes. - Dev shell: nix flake + direnv (
.envrc=use flake). Repo is a colocated jujutsu (.jj/) + git repo. - The Nix build's source filter (
flake.nix,craneLib.filterCargoSources) only admits.rs/.toml/Cargo.lockby default;.jsonand.mdare explicitly allow-listed there forexample_data.jsonand thetemplates/include_str!s. Any newinclude_str!/include_bytes!target needs its extension added to that filter ornix build/nix flake checkfails even thoughcargo buildsucceeds locally. - Release: pushing a
v*tag triggers the GitHub release workflow; version lives inCargo.toml. The same workflow publishes to crates.io via Trusted Publishing (no stored token); running it manually (workflow_dispatch) only does a dry run.