chore: extract fj-client (keys, client, URL/SSH resolution) (FJ-6) #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/extract-fj-client-fj-6"
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?
Implements FJ-6 (FJ-3 Phase 2 of 5): extract the connection and credential layer into
crates/fj-clientand have thefjbinary consume it. Depends on Phase 1 (the workspace skeleton from FJ-5).What moved into
fj-clientKeyInfo/LoginInfo,keys.jsonload/save, andforgejo_api::Forgejoclient construction (get_api,api_for) -crates/fj/src/keys.rstocrates/fj-client/src/keys.rsvia git rename (4-line delta: the internalcrate::auth::get_client_info_forcall becamecrate::get_client_info_for).ssh_url_parse,host_name,repo_url_host_name,get_ssh_config, theSSH_CONFIGstatic) and theUSER_AGENTconstant - fromcrates/fj/src/main.rsintocrates/fj-client/src/url_resolve.rsandlib.rs.get_client_info_for,parse_client_info_file) - fromcrates/fj/src/auth.rsintocrates/fj-client/src/client_info.rs.What stayed in
crates/fjThe interactive add-key / login flow in
auth.rs(prompts, the OAuth browser dance, ssh-alias discovery) stays in the binary and delegates persistence, client construction, and client-id lookup tofj-client. The binary re-exportsfj-clientunder the historicalcrate::keys/crate::*paths, so the rest of the source compiles unchanged.fj-clientdependencies:forgejo-api,serde,serde_json,url,ssh2-config,directories,eyre,tokio(fs+io-util), andtime(serdefeature, required byLoginInfo::OAuth { expires_at }). Noclap/crossterm/comrak/fluent-*.Behavior change to review
USER_AGENTexpandsCARGO_PKG_NAMEfrom whichever package owns the const. Now that it lives infj-client, the agent string sent to Forgejo isfj-client/0.5.0 (https://codeberg.org/forgejo-contrib/forgejo-cli/)rather thanforgejo-cli/0.5.0 (...). Version and repository URL are unchanged. This is the natural consequence of relocating the const per the issue scope. If you would rather keep theforgejo-cliname in the agent string, say so and I will hardcode it infj-client.Verification (all from the issue's AC)
cargo build --locked(workspace) andcargo build -p fj-client(standalone) both succeed.cargo tree -p fj-client -e normal | grep -E 'clap|crossterm|comrak|fluent'prints nothing.cargo fmt --checkclean; clippy onfj-clientclean;cargo testpasses.fj version/fj version --verboseandfj auth --helpwork.The ~108 pre-existing clippy lints in the
crates/fjbinary are byte-identical toorigin/mainand surfaced only by the newer local clippy (as documented on FJ-5). They are out of scope for this PR.🤖 Generated with Claude Code