Skip to content

runtime: GitCommand enum has no handler for checkout/merge/remote/cherry-pick/rebase/reset/tag #85

Closed

Description

@thehoff

Symptom

Even if the rewrite hook is taught to rewrite `git checkout`, `git merge`, etc. (see #83), the runtime cannot execute them — `src/cmds/git/git.rs:83` only matches:

```rust
GitCommand::Diff | Log | Status | Show | Add | Commit | Push | Pull |
Branch | Fetch | Stash { .. } | Worktree
```

Anything else doesn't exist as a clap subcommand → `contextcrawler git checkout …` would fail at parse time.

Fix

Add a catch-all variant with passthrough-plus-tracking semantics, e.g.:

```rust
#[derive(Debug, Parser)]
enum GitCommand {
// existing variants…
#[command(external_subcommand)]
Other(Vec),
}
```

Then `run`:

```rust
GitCommand::Other(args) => run_git_passthrough(&args, verbose, global_args),
```

where `run_git_passthrough`:

  1. Records command via `tracking::TimedExecution` (raw stdout count → savings = 0 baseline, but still gives us call-frequency data for future filter design).
  2. Execs `git` with the original args, inherits stdio.
  3. Propagates exit code.

Acceptance

  • `contextcrawler git checkout -b foo develop` works identically to bare `git checkout -b foo develop`.
  • `contextcrawler git merge --no-ff foo` works identically to bare `git merge --no-ff foo`.
  • Tracking DB records each invocation with command bucket = "git \<sub\>".
  • Existing variants (`diff`, `log`, etc.) keep their filters — `Other` is a fallback, not a replacement.

Notes

This is the runtime half of #83. Land them together or land this first.

Down the track, individual passthrough variants can be promoted to filtered variants when their output justifies the work (e.g. `git remote -v` could benefit from compact formatting; `git checkout` probably never will).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions