mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
Phase 2 of docs/DESIGN.md, no behavior change: - crates/idx-core (library): api, analysis, cache, config file handling and provider selection, curl_impersonate, error, ownership, runtime, plus the shared test fixtures. clap derives are behind an optional `clap` feature so the library does not require clap. - crates/idx-cli (binary `idx`): cli/, output/, and IdxConfig (output format and color resolution). Package and binary names are unchanged. - config.rs is split: file read/write and validation move to core; a CLI test keeps core's OUTPUT_VALUES in sync with OutputSetting. - ownership::db::open_db/db_path drop their unused IdxConfig argument. - One workspace version; shared dependency versions; no third-party version changes in Cargo.lock. LICENSE is symlinked into each crate. - flake: workspace version, new source paths, and a per-crate package check (idx-cli is built from its tarball against packaged idx-core, since idx-core is not on crates.io yet). CI cache key, release path filter, and the golden whitespace-hook exclusion follow the new layout. Parity: all 143 golden outputs match byte for byte without regeneration; 157 core + 17 CLI unit tests (173 before plus the new OUTPUT_VALUES sync test), 62 CLI tests pass. Live A/B against main: 16/16 stocks cases identical; ownership discover got IDX 403 on both (exit 4 vs 1 is the phase 1 exit-code change). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
382 lines
8.5 KiB
TOML
382 lines
8.5 KiB
TOML
# Golden output cases for tests/golden.rs.
|
|
#
|
|
# Each case runs once per entry in `formats` (default: table and json) with
|
|
# `-o <format>` prepended; `formats = []` runs the args as given, which means
|
|
# the auto format: stdout is a pipe here, so auto resolves to compact JSON.
|
|
# Every run uses the mock provider (IDX_USE_MOCK_PROVIDER=1) and an isolated
|
|
# home directory. `ownership = true` seeds the fixture DB; `before` runs setup
|
|
# commands first; `stdin` is piped to the command.
|
|
#
|
|
# `idx version` is excluded on purpose: its output changes with every release.
|
|
|
|
# --- help and shell completions ---------------------------------------------
|
|
|
|
[[case]]
|
|
name = "help-root"
|
|
args = ["--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-stocks"
|
|
args = ["stocks", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-ownership"
|
|
args = ["ownership", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-config"
|
|
args = ["config", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-cache"
|
|
args = ["cache", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "completions-bash"
|
|
args = ["completions", "bash"]
|
|
formats = []
|
|
|
|
# --- config and cache ---------------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "config-path"
|
|
args = ["config", "path"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-init"
|
|
args = ["config", "init"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-get"
|
|
args = ["config", "get", "general.provider"]
|
|
formats = []
|
|
before = [["config", "init"]]
|
|
|
|
[[case]]
|
|
name = "config-set"
|
|
args = ["config", "set", "general.provider", "yahoo"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-set-output-jsonl"
|
|
args = ["config", "set", "general.output", "jsonl"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-set-output-invalid"
|
|
args = ["config", "set", "general.output", "yaml"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-output-table-pins-format"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
formats = []
|
|
before = [["config", "set", "general.output", "table"]]
|
|
|
|
[[case]]
|
|
name = "cache-info-empty"
|
|
args = ["cache", "info"]
|
|
|
|
[[case]]
|
|
name = "cache-clear"
|
|
args = ["cache", "clear"]
|
|
|
|
# --- stocks: MSN (default provider) --------------------------------------------
|
|
|
|
[[case]]
|
|
name = "stocks-quote"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-quote-multi"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "quote", "BBCA,BBRI"]
|
|
|
|
[[case]]
|
|
name = "stocks-history"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "history", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-history-msn"
|
|
args = ["stocks", "history", "BBCA", "--history-provider", "msn"]
|
|
|
|
[[case]]
|
|
name = "stocks-technical"
|
|
args = ["stocks", "technical", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-growth"
|
|
args = ["stocks", "growth", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-valuation"
|
|
args = ["stocks", "valuation", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-valuation-nonfinite"
|
|
args = ["stocks", "valuation", "BBCA"]
|
|
env = { IDX_MOCK_MSN_KEYRATIOS_FIXTURE = "tests/fixtures/msn_keyratios_infinity.json" }
|
|
|
|
[[case]]
|
|
name = "stocks-risk"
|
|
args = ["stocks", "risk", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-fundamental"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "fundamental", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-compare"
|
|
args = ["stocks", "compare", "BBCA", "BBRI"]
|
|
|
|
[[case]]
|
|
name = "stocks-profile"
|
|
args = ["stocks", "profile", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-financials"
|
|
args = ["stocks", "financials", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-financials-income"
|
|
args = ["stocks", "financials", "BBCA", "--statement", "income"]
|
|
|
|
[[case]]
|
|
name = "stocks-earnings"
|
|
args = ["stocks", "earnings", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-earnings-history-quarterly"
|
|
args = ["stocks", "earnings", "BBCA", "--history", "--quarterly"]
|
|
|
|
[[case]]
|
|
name = "stocks-earnings-forecast-annual"
|
|
args = ["stocks", "earnings", "BBCA", "--forecast", "--annual"]
|
|
|
|
[[case]]
|
|
name = "stocks-sentiment"
|
|
args = ["stocks", "sentiment", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-insights"
|
|
args = ["stocks", "insights", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-news"
|
|
args = ["stocks", "news", "BBCA", "--limit", "5"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen"
|
|
args = ["stocks", "screen"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen-worst"
|
|
args = ["stocks", "screen", "--filter", "worst-performers", "--limit", "5"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen-high-volume"
|
|
args = ["stocks", "screen", "--filter", "high-volume"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen-large-cap"
|
|
args = ["stocks", "screen", "--filter", "large-cap"]
|
|
|
|
[[case]]
|
|
name = "auto-format-piped"
|
|
args = ["stocks", "quote", "BBCA,BBRI"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "auto-format-env-table"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
formats = []
|
|
env = { IDX_OUTPUT = "table" }
|
|
|
|
[[case]]
|
|
name = "stocks-quote-stdin"
|
|
args = ["stocks", "quote", "-"]
|
|
stdin = "BBCA\nBBRI\n"
|
|
|
|
[[case]]
|
|
name = "stocks-compare-stdin"
|
|
args = ["stocks", "compare", "-"]
|
|
stdin = "BBCA, BBRI"
|
|
|
|
[[case]]
|
|
name = "error-stdin-empty"
|
|
args = ["stocks", "quote", "-"]
|
|
stdin = ""
|
|
|
|
[[case]]
|
|
name = "error-invalid-output-env"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
formats = []
|
|
env = { IDX_OUTPUT = "yaml" }
|
|
|
|
[[case]]
|
|
name = "stocks-quote-offline-warm"
|
|
args = ["--offline", "stocks", "quote", "BBCA"]
|
|
before = [["stocks", "quote", "BBCA"]]
|
|
|
|
# --- stocks: Yahoo provider -----------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "yahoo-quote"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
[[case]]
|
|
name = "yahoo-history"
|
|
args = ["stocks", "history", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
[[case]]
|
|
name = "yahoo-fundamental"
|
|
args = ["stocks", "fundamental", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
# --- errors ---------------------------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "error-usage-missing-symbol"
|
|
args = ["stocks", "quote"]
|
|
|
|
[[case]]
|
|
name = "error-invalid-provider"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
env = { IDX_PROVIDER = "bogus" }
|
|
|
|
[[case]]
|
|
name = "error-yahoo-profile-unsupported"
|
|
args = ["stocks", "profile", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
[[case]]
|
|
name = "error-industry-only-fundamentals"
|
|
args = ["stocks", "valuation", "BBCA"]
|
|
env = { IDX_MOCK_MSN_KEYRATIOS_FIXTURE = "tests/fixtures/msn_keyratios_industry_only.json" }
|
|
|
|
[[case]]
|
|
name = "error-screen-region"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "screen", "--region", "eu"]
|
|
|
|
[[case]]
|
|
name = "error-offline-no-cache-flags"
|
|
args = ["--offline", "--no-cache", "stocks", "quote", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-offline-cache-miss"
|
|
args = ["--offline", "stocks", "quote", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-provider-failure"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
env = { IDX_MOCK_ERROR = "1" }
|
|
|
|
[[case]]
|
|
name = "error-compare-total-failure"
|
|
args = ["stocks", "compare", "BBCA", "BBRI"]
|
|
env = { IDX_MOCK_ERROR = "1" }
|
|
|
|
[[case]]
|
|
name = "error-fetch-bing-unsupported"
|
|
args = ["ownership", "import", "--fetch-bing", "BBCA"]
|
|
|
|
# --- ownership --------------------------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "ownership-releases-empty"
|
|
args = ["ownership", "releases"]
|
|
|
|
[[case]]
|
|
name = "ownership-ticker-empty"
|
|
args = ["ownership", "ticker", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "ownership-import-xlsx"
|
|
args = ["ownership", "import", "--file", "tests/fixtures/ksei_above1_20260831_excerpt.xlsx"]
|
|
|
|
[[case]]
|
|
name = "ownership-import-archive-txt"
|
|
args = ["ownership", "import", "--file", "tests/fixtures/ksei_balancepos_20260227_excerpt.txt"]
|
|
|
|
[[case]]
|
|
name = "ownership-releases"
|
|
args = ["ownership", "releases"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-ticker"
|
|
args = ["ownership", "ticker", "BBCA"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-ticker-ksei"
|
|
args = ["ownership", "ticker", "BBCA", "--source", "ksei"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-entity"
|
|
args = ["ownership", "entity", "ANTHONI SALIM"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-search"
|
|
args = ["ownership", "search", "salim"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-cross-holders"
|
|
args = ["ownership", "cross-holders", "--min-tickers", "1"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-concentration"
|
|
args = ["ownership", "concentration"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-flow"
|
|
args = ["ownership", "flow", "BBCA"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-changes"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["ownership", "changes", "--from", "2026-01-30", "--to", "2026-02-27"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-graph"
|
|
args = ["ownership", "graph", "BBCA"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-graph-dot"
|
|
args = ["ownership", "graph", "BBCA", "--format", "dot"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-resolve-unresolved"
|
|
args = ["ownership", "resolve", "unresolved"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-resolve-map"
|
|
args = ["ownership", "resolve", "map", "SALIM ANTHONI", "ANTHONI SALIM"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-resolve-merge"
|
|
args = ["ownership", "resolve", "merge", "1", "2"]
|
|
ownership = true
|