Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

Rewrite Lazy TUI to Use New But APIs

Completed

  • Added lazy TUI module to the but crate
  • Updated imports to use but_api::legacy instead of direct gitbutler_* imports
  • Replaced CommandContext with but_ctx::Context throughout
  • Updated method calls to use new Context API (Context::new_from_legacy_project)
  • Fixed AppSettings method name to load_from_default_path_creating_without_customization
  • Added crossterm and ratatui dependencies to but crate
  • Updated FileAssignment::from_assignments to use IdMap parameter
  • Fixed module path for status::assignment (now command::legacy::status::assignment)
  • Added Lazy command to CLI args
  • Integrated lazy TUI into lib.rs command handling
  • Added metrics support for Lazy command
  • Code compiles successfully with legacy features

TODO/Known Issues

  • get_commit_changes is stubbed - needs implementation using but-core's commit change APIs
  • Upstream info loading is disabled - needs to be fixed with new Context API
  • Some secondary features may not work fully due to API migration
  • Test the lazy TUI functionality end-to-end

Changes Made

The lazy TUI has been updated to work with the current master branch APIs:

  • Uses but_ctx::Context instead of the removed CommandContext
  • Calls legacy APIs through but_api::legacy namespace
  • Compatible with the new graph-based workspace model
  • Most core functionality (status, commits, branches, oplog) should work
  • Some features (commit diff modal, upstream info) are temporarily disabled pending full API implementation
Original prompt

rewrite this PR on top of the current master branch, using the new but apis. look at recent commits to the but crate to see what the new api styles are.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
gitbutler-web Ignored Ignored Preview Dec 19, 2025 9:37am

Comment on lines 63 to 82
generate-ts-definitions:
needs: changes
if: ${{ needs.changes.outputs.node == 'true' || needs.changes.outputs.rust == 'true' }}
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Rust Cache
uses: Swatinem/[email protected]
with:
shared-key: ts-def-gen
save-if: ${{ github.ref == 'refs/heads/master' }}
# Node is needed for the formatting of typescript files.
- uses: ./.github/actions/init-env-node
- name: Dependencies for 'keyring'
run: sudo ./scripts/install-minimal-debian-dependencies.sh
- run: ./scripts/generate-ts-definitions-from-rust.sh

Check warning

Code scanning / zizmor

overly broad permissions Warning

overly broad permissions
@schacon schacon force-pushed the copilot/rewrite-pr-with-new-but-api branch 2 times, most recently from 9be65e7 to 9cac379 Compare December 18, 2025 13:13
@schacon schacon changed the base branch from sc-cursor-lazybut to master December 19, 2025 09:32
@schacon schacon changed the title [WIP] Rewrite PR using new but APIs from master branch [WIP] gitbutler tui Dec 19, 2025
Wanted to see how far I could get towards LazyGit functionality with 
GitButler APIs. Turns out we can get pretty far, pretty fast if we 
make Agents do most of the work.
Initial plan

Remove large unused CLI and metrics modules

Compile with `cargo build -p but` and fix issues by removing or stubbing out large, unused modules that caused build problems. The args and metrics modules were deleted and lib.rs updated to stop referencing removed modules and to import CommandName where needed. Also disabled the incomplete legacy lazy module (commented out) and cleaned up metrics usage sites to use the re-exported CommandName to resolve compilation errors.
Make lazy TUI runnable

Add optional crossterm and ratatui dependencies, expose a hidden "Lazy" CLI subcommand and wire the lazy module into the CLI so the experimental Lazy TUI can be launched. Update Cargo.lock to include the new crates and versions required, and make numerous code changes to adapt the lazy UI to recent upstream API and structural changes: replace removed CommandContext usage with TODO stubs and safe fallbacks, adjust status/diff API usage, switch to command::legacy::status::assignment paths, provide temporary IdMap construction, and stub out upstream/update/reword/squash/uncommit operations until they are reimplemented without CommandContext.

These changes were needed to make the Lazy TUI runnable again after refactors that removed CommandContext and changed diff/status APIs. The commit brings in the terminal UI crates, registers the CLI entry point, and makes conservative code changes (stubbing or converting calls) so the lazy interface can start while leaving TODOs to fully restore interactive operations.
Fix compile errors and update lazy modules

Address multiple compilation errors caused by API/type changes and missing imports. Replace now-invalid commit detail handling with a placeholder implementation that returns empty file changes and zeroed stats (note: needs reimplementation using Context). Import anyhow::anyhow macro and tidy up unused code by removing duplicate/reset methods that conflicted with function signatures. Also apply minor type conversion fixes hints (use Into::into and deref suggestions) documented for future work.
Fix warnings by removing unused imports/fields and dead code paths

Resolve multiple compiler warnings by cleaning up unused imports, constants, and struct fields, and by adjusting unreachable code paths in lazy UI modules. Specifically:

- Removed unused imports and the unused DATE_ONLY constant from lazy/app.rs, and simplified collection imports.
- Marked several target-info structs with #[allow(dead_code)] to silence dead-code warnings for fields currently unused.
- Adjusted upstream_integration import usage to only bring in needed types.
- In squash.rs and uncommit.rs, renamed pattern-bound variables to _target and converted early-return Err(...) with a return into direct Err(...) expressions; commented out legacy CommandContext-dependent code and removed statements after early errors that made code unreachable.

These changes clean up the codebase to eliminate unreachable code and unused-item warnings while preserving the placeholders and TODOs for future reimplementation.
@schacon schacon force-pushed the copilot/rewrite-pr-with-new-but-api branch from 9cac379 to 02e5c9a Compare December 19, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants