Implement fj work resume + local session model #41

Merged
stephen merged 1 commit from feat/work-resume-session into main 2026-06-01 16:34:30 +00:00
Owner

Adds a local-only work session and wires up fj work resume (item #1 of the agreed order).

Session model (<git-dir>/fj/session.json)

New cli/work_session.rs: Session { saved_at, host, repo, remote, branch, dirty, changed_files, pull_request, next_steps, cursor }. Never committed, never sent to the server. derive_next_steps produces advisory, non-destructive suggestions (commit/push/open-PR/track-review) from the context. Stable JSON for future mobile/web consumers.

Behavior

  • work context now persists the session (best-effort — a cache-write failure never sinks the inspect command).
  • work resume loads the session, re-gathers the live context, and prints the saved snapshot plus a diff of what moved (branch / working tree / PR state). Supports --json and --dry-run; errors clearly when no session exists.
  • New git helpers git_dir() / remote_url().

work continue stays a placeholder (next PR advances the cursor).

Tests

Pure logic is unit-tested without git/network: derive_next_steps (5 cases), session JSON round-trip, session_path, to_session, render_session, and diff_session_vs_context (changed + unchanged). +10 tests → 295. clippy -D warnings clean; coverage-strict holds (~76%).

Adds a local-only work session and wires up `fj work resume` (item #1 of the agreed order). ### Session model (`<git-dir>/fj/session.json`) New `cli/work_session.rs`: `Session` { saved_at, host, repo, remote, branch, dirty, changed_files, pull_request, next_steps, cursor }. Never committed, never sent to the server. `derive_next_steps` produces advisory, **non-destructive** suggestions (commit/push/open-PR/track-review) from the context. Stable JSON for future mobile/web consumers. ### Behavior - `work context` now persists the session (best-effort — a cache-write failure never sinks the inspect command). - `work resume` loads the session, re-gathers the live context, and prints the saved snapshot plus a **diff** of what moved (branch / working tree / PR state). Supports `--json` and `--dry-run`; errors clearly when no session exists. - New git helpers `git_dir()` / `remote_url()`. `work continue` stays a placeholder (next PR advances the cursor). ### Tests Pure logic is unit-tested without git/network: `derive_next_steps` (5 cases), session JSON round-trip, `session_path`, `to_session`, `render_session`, and `diff_session_vs_context` (changed + unchanged). +10 tests → **295**. clippy `-D warnings` clean; `coverage-strict` holds (~76%).
Implement fj work resume + local session model
All checks were successful
ci / check (pull_request) Successful in 2m3s
ci / coverage (pull_request) Successful in 2m12s
9ef8c732de
Add a local-only work session at <git-dir>/fj/session.json (never
committed, never sent to the server):

- new module cli/work_session.rs: Session/PrRef, load/save, session_path,
  and derive_next_steps (advisory, non-destructive next steps from the
  context). Pure parts are unit-tested.
- git helpers git_dir() and remote_url() to anchor + describe the session.
- work context now persists the session (best-effort; a cache write never
  sinks the inspect command), carrying timestamp, repo, host, remote,
  branch, dirty summary, PR, next steps, and a cursor.
- work resume loads the session, re-gathers the live context, and shows
  the saved snapshot plus a diff of what changed (branch / working tree /
  PR state); supports --json and --dry-run. Errors clearly when no
  session exists yet.

work continue stays a placeholder (next: advance the cursor). +10 tests
(295 total); clippy clean; coverage-strict holds (~76%).
Sign in to join this conversation.
No reviewers
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
rasterstate/fj!41
No description provided.