chore: migrate tag/wiki API calls into fj-core ops (FJ-10) #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/migrate-simple-areas-fj-10"
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?
Summary
FJ-3 Phase 4a (subtask of FJ-8): migrate the simple command areas so their
forgejo-apicalls live infj-coreoperations that returnforgejo-apistructs, leaving each binaryrun()to parse args and render. No user-visible behavior change.Changes
fj-core: newtagmodule (list,create,view,delete) andwikimodule (list_pages,get_page,get_repo), each a thin async wrapper over the matchingforgejo-apiendpoint returning its struct. No clap / fluent / terminal rendering.fj-core/Cargo.toml: addforgejo-api = "0.10.0"(already present transitively viafj-client; now a direct, explicit dependency).fj-core/src/lib.rs: registerpub mod tag;/pub mod wiki;and update the crate doc to note it now holds per-command operations.crates/fj/src/tag.rsandcrates/fj/src/wiki.rs: replace inlineapi.repo_*calls with the newfj_core::tag::*/fj_core::wiki::*operations. Rendering (SpecialRender,markdown, base64 decode), the editor prompt, and the git clone stay in the binary.whoami left unchanged (intentional)
crates/fj/src/whoami.rsmakes noforgejo-apicall: it reads the logged-in username from localKeyInfo(keys.get_login). There is no network operation to lift intofj-core, so the module already satisfies the AC ("no directforgejo-apicalls remain"). The umbrella's example namefj_core::whoami::current_userdoes not match the actual command surface; per the issue's own "(match the actual command surface)" guidance, whoami is left as-is rather than inventing an API round-trip (which would be a user-visible behavior change).Verification
cargo build --locked(workspace) succeeds.cargo tree -p fj-core -e normal | grep -E 'clap|crossterm|fluent'prints nothing: no CLI-coupling crate leaks intofj-core.api.repo_*calls remain inwhoami.rs/tag.rs/wiki.rs.just check(fmt + clippy-D warnings+ build + builder-stage docker) passes.Note on the
comrakpart of the verification grepThe issue's verification line greps
clap|crossterm|comrak|fluent. Thecomrakterm is non-satisfiable and pre-dates this change: Phase 3 (FJ-7) deliberately addedcomraktofj-corefor the issue-template parser (crates/fj-core/src/template/yaml.rs), andlib.rsdocuments "Markdown parsing viacomrakis allowed."comrakis not a CLI-coupling crate (it is reusable by an MCP server), so its presence does not violate Phase 4's actual intent: keeping clap/crossterm/fluent out offj-core. The grep'scomrakterm reads as a copy-paste artifact; the CLI-free intent is verified above.#FJ-10