chore: migrate repo/release/user/actions into fj-core ops (FJ-11) #11

Merged
David merged 1 commit from chore/migrate-medium-areas-fj-11 into main 2026-05-25 16:37:03 +02:00
Owner

FJ-11: Phase 4b - migrate medium areas (repo, release, user, actions)

Subtask of FJ-8 (Phase 4 umbrella), part of FJ-3. Applies the Phase 4 migration pattern established in FJ-10 (batch 4a) to the four medium-sized command areas.

What changed

Every forgejo-api call in crates/fj/src/{repo,release,user,actions}.rs now lives in an fj-core operation that returns forgejo-api structs (or a small owned value). Each binary run()/helper is reduced to: map args to typed params, call the fj-core op, render the result with the existing SpecialRender / markdown / render_label* helpers.

  • New modules: crates/fj-core/src/{actions,release,user}.rs.
  • crates/fj-core/src/repo.rs gains operation fns alongside its existing RepoName/RepoArg types; the module is promoted from mod repo to pub mod repo (the flat fj_core::RepoArg/... re-exports are unchanged).
  • Interactive bits stay in the binary and pass resolved values into the ops: editor, confirmation prompts, the gpg subprocess, SSH key-file discovery, and the git clone/push in repo create.
  • The actions variable create/update wrappers return the raw ForgejoError so the binary keeps its existing CONFLICT / --force create-or-update handling.

No new fj-core dependencies

To avoid widening fj-core's dependency surface, the release lookup uses .all() instead of a futures stream, and byte payloads (repo_get_raw_file, repo_get_archive, download_release_attachment) return Vec<u8> instead of pulling in bytes. Cargo.lock is unchanged and cargo build --locked passes.

Note on the acceptance-criteria wording (comrak)

The issue lists comrak among the crates the fj-core tree must stay free of. comrak is already a direct fj-core dependency (added in FJ-7/FJ-10) and is explicitly allowed by the fj-core lib.rs doc comment ("Markdown parsing via comrak is allowed"). This migration adds no new dependencies, so the tree is unchanged: clap, crossterm, and fluent are absent; comrak remains as before. Flagging in case the AC text should be reconciled with the merged 4a state.

Verification

  • cargo build --locked (workspace): pass.
  • cargo tree -p fj-core -e normal | grep -E 'clap|crossterm|fluent': prints nothing.
  • just check (fmt + clippy -D warnings + build + builder-stage docker compile): pass.
  • cargo test: pass.
  • No direct forgejo-api calls remain in the four binary modules.

Done when

  • repo, release, user, and actions API logic live in fj-core operations returning forgejo-api structs.
  • Each binary run() only parses args and renders; no direct forgejo-api calls remain in these modules.
  • fj-core dependency tree stays free of clap / crossterm / fluent (comrak unchanged, see note above).
  • just check green; no user-visible behavior change.

Refs FJ-11.

## FJ-11: Phase 4b - migrate medium areas (repo, release, user, actions) Subtask of FJ-8 (Phase 4 umbrella), part of FJ-3. Applies the Phase 4 migration pattern established in FJ-10 (batch 4a) to the four medium-sized command areas. ### What changed Every `forgejo-api` call in `crates/fj/src/{repo,release,user,actions}.rs` now lives in an `fj-core` operation that returns `forgejo-api` structs (or a small owned value). Each binary `run()`/helper is reduced to: map args to typed params, call the `fj-core` op, render the result with the existing `SpecialRender` / `markdown` / `render_label*` helpers. - New modules: `crates/fj-core/src/{actions,release,user}.rs`. - `crates/fj-core/src/repo.rs` gains operation fns alongside its existing `RepoName`/`RepoArg` types; the module is promoted from `mod repo` to `pub mod repo` (the flat `fj_core::RepoArg/...` re-exports are unchanged). - Interactive bits stay in the binary and pass resolved values into the ops: editor, confirmation prompts, the `gpg` subprocess, SSH key-file discovery, and the git clone/push in `repo create`. - The actions variable create/update wrappers return the raw `ForgejoError` so the binary keeps its existing `CONFLICT` / `--force` create-or-update handling. ### No new fj-core dependencies To avoid widening `fj-core`'s dependency surface, the release lookup uses `.all()` instead of a `futures` stream, and byte payloads (`repo_get_raw_file`, `repo_get_archive`, `download_release_attachment`) return `Vec<u8>` instead of pulling in `bytes`. `Cargo.lock` is unchanged and `cargo build --locked` passes. ### Note on the acceptance-criteria wording (comrak) The issue lists `comrak` among the crates the `fj-core` tree must stay free of. `comrak` is already a direct `fj-core` dependency (added in FJ-7/FJ-10) and is explicitly allowed by the `fj-core` `lib.rs` doc comment ("Markdown parsing via comrak is allowed"). This migration adds no new dependencies, so the tree is unchanged: `clap`, `crossterm`, and `fluent` are absent; `comrak` remains as before. Flagging in case the AC text should be reconciled with the merged 4a state. ### Verification - `cargo build --locked` (workspace): pass. - `cargo tree -p fj-core -e normal | grep -E 'clap|crossterm|fluent'`: prints nothing. - `just check` (fmt + clippy `-D warnings` + build + builder-stage docker compile): pass. - `cargo test`: pass. - No direct `forgejo-api` calls remain in the four binary modules. ### Done when - [x] repo, release, user, and actions API logic live in `fj-core` operations returning `forgejo-api` structs. - [x] Each binary `run()` only parses args and renders; no direct `forgejo-api` calls remain in these modules. - [x] `fj-core` dependency tree stays free of clap / crossterm / fluent (comrak unchanged, see note above). - [x] `just check` green; no user-visible behavior change. Refs FJ-11.
chore: migrate repo/release/user/actions into fj-core ops (FJ-11)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 36s
Create release / Create release from merged PR (pull_request) Has been skipped
0bb2a89e09
Phase 4b of the fj-core extraction (FJ-3). Lift every forgejo-api call out of the repo, release, user, and actions command modules into fj-core operations that return forgejo-api structs, leaving each binary run()/helper to parse args, call the op, and render.

New fj-core modules: actions, release, user. The repo module gains operation fns alongside its existing name types and is promoted from private to pub. Interactive bits (editor, prompts, the gpg subprocess, key-file discovery, git clone/push) and all rendering stay in the binary, which passes resolved values into the ops.

No new fj-core dependencies: the release lookup uses .all() instead of a futures stream, and byte payloads return Vec<u8> instead of pulling in bytes. fj-core's dependency tree stays free of clap, crossterm, and fluent. comrak remains a direct dep (pre-existing since FJ-7/FJ-10 and explicitly allowed by the lib.rs doc comment); see the PR notes on the AC wording.

The variable create/update wrappers return the raw ForgejoError so the binary keeps its existing CONFLICT/--force handling.

just check (fmt, clippy -D warnings, build, builder-stage docker compile) and cargo test pass.

#FJ-11
David merged commit 8850db4232 into main 2026-05-25 16:37:03 +02:00
David deleted branch chore/migrate-medium-areas-fj-11 2026-05-25 16:37:03 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/forgejo-cli!11
No description provided.