refactor(workspace): extract crates/youtrack-config + client bridge (YT-18) #61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/extract-youtrack-config-YT-18"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Subtask 3 of the workspace refactor epic (YT-15). Depends on the merged
youtrack-clientextraction (YT-17).What
Extract the config + multi-instance store into a new reusable library crate
crates/youtrack-config, and collapse the ~23 duplicated per-commandclient_from_cfghelpers into a singleConfig::client()bridge. No behavior change to theytbinary: command surface, output, and instance resolution are unchanged.How
Moved into the crate via
git mv(history preserved):config/mod.rs->lib.rs(Config,ConfigSource, load / save, XDG path logic, secure 0700/0600 writes,token()) andconfig/instances.rs(theInstancesstore,resolve,derive_instance_from_url).Config::client() -> Result<youtrack_client::Client>is the one bridge. It reproduces the exact validation every call site already performed (error when url or token is unset, otherwise construct the client), so everyclient_from_cfg(cfg)?and the inlineClient::new(&cfg.url, cfg.token())inboard.rs/search.rs/auth/verify.rscollapse tocfg.client()?with identical behavior.Presentation moved to the CLI:
print_masked/print_raware gone from the library.config showformats and masks the token inline (carrying themask_tokenunit tests with it),config viewserializes inline. Allcrate::config::...references across the bin crate are nowyoutrack_config::....Library purity
crates/youtrack-configispublish = falseand depends only on youtrack-client, anyhow, secrecy, serde, serde_yml, url (tempfile as a dev-dependency). No clap, comfy-table, or rpassword. Dropped the now-deadsecrecyandurldeps from yt-cli (both moved with the config core).Acceptance criteria
crates/youtrack-configbuilds and tests pass (25 tests, run as part of the workspace).Configinto ayoutrack_client::Client; no command defines its ownclient_from_cfg, andboard.rs/search.rsuse the bridge.print_masked/print_rawlive in the CLI, not the library.crate::config::...references replaced withyoutrack_config::....just pre-commitgreen (fmt, clippy -D warnings, build, 121 tests);config show/view,auth login, and instance resolution behave unchanged.🤖 Generated with Claude Code