Commit Graph

16 Commits

Author SHA1 Message Date
Victor Sumner e91dee568b fix(git): drop state-hint extraction in compact status
KuSh: the in-progress state line ("rebase in progress", "merge in
progress. unresolved conflicts", etc.) is enough — LLMs know which git
commands resolve each state, so the per-state hint list was noise.

Removes STATE_HINTS and extract_state_hint, and reduces extract_state_header
to a short walk that returns the first detected state summary or None.
Existing per-state tests now assert the exact compact summary.
2026-05-01 05:54:24 +02:00
Victor Sumner 316e65ef5b fix(git): address review feedback on status state surfacing
- Drop redundant LANG=C env (LC_ALL=C is sufficient).
- Replace nested if/else chains in detect_status_state and
  extract_state_hint with const slices + iter for readability.
- Drop the 2-space indent prefix on hint lines — adds nothing for
  machine consumption.
2026-05-01 05:54:24 +02:00
Victor Sumner cff391e50b fix(git): compact in-progress status state 2026-05-01 05:54:24 +02:00
Victor Sumner 017d0f9ee6 fix(git): surface in-progress state in compact rtk git status
Default `rtk git status` runs `git status --porcelain -b` to build its
compact view, but porcelain v1 omits the state header git prints when a
rebase, merge, cherry-pick, revert, bisect, am, or sparse checkout is in
progress. That header is correctness-critical — hiding "You are currently
editing a commit while rebasing..." leaves the user thinking the repo is
clean when it isn't.

`run_status` already captures plain `git status` output as `raw_output`
for tracking, so this fix adds `extract_state_header` to pull the state
block out of it and prepends the block to the compact output. Returns
`None` when nothing is in progress so clean repos are unchanged.

Covered states: interactive / regular rebase, merge-with-unmerged-paths,
"still merging after conflicts fixed", cherry-pick, revert, bisect, am,
sparse checkout. Preserves the directive hints git prints alongside
(`git rebase --continue`, `git commit --amend`, `git bisect reset`,
etc.), while still filtering generic `(use "git add")` / `(use "git
restore")` noise.

Design principle: Correctness vs Token Savings — never hide information
that changes the user's understanding of repo state.
2026-05-01 05:54:24 +02:00
binsee 13188a88b2 fix(git): fix empty output when branch name contains '/' in git diff
Branch names containing '/' (e.g. feature/user-auth, main...feature/auth)
were incorrectly treated as file paths by the string heuristic in
normalize_diff_args, causing '--' to be injected before them and making
git treat them as pathspecs — resulting in silent empty output (exit 0).

Replace looks_like_path() with a three-tier detection strategy:
- Explicit path prefixes (. ~) → always a path, no filesystem check needed
- Contains path separator (/ \) → use filesystem existence to distinguish
  branch names (feature/auth, not on disk) from real paths (src/main.rs)
- Bare word with no separator → never inject '--', regardless of filesystem
  state (avoids misfire when a file shares a name with a branch/ref)

Introduce normalize_diff_args_impl with injectable path-checker for
testability. Update all existing tests to use mock existence checks.
Add three regression tests: branch-with-slash, range-with-slash, and
bare-word-that-exists-on-disk.

Fixes: #1431

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 00:24:32 +08:00
aesoft 906dedd75a Merge remote-tracking branch 'origin/develop' into feat-hook-engine 2026-04-13 21:14:55 +02:00
Ousama Ben Younes 9979c69930 fix(git): re-insert -- separator when clap consumes it from git diff args (#1215)
clap's trailing_var_arg=true silently drops -- when it appears as the first
positional argument. This caused `rtk git diff -- <path>` to arrive in
run_diff without the separator, making git treat the path as a revision and
emit "fatal: ambiguous argument". Adds normalize_diff_args() which re-inserts
-- before the first path-like argument (contains /, \, starts with . or ~)
when -- is absent from the args vec. The fix is a no-op when -- is already
present (e.g. rtk git diff HEAD -- file preserves the separator correctly).

Generated by Claude Code
Vibe coded by ousamabenyounes

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-11 10:27:12 +00:00
Adrien Eppling 52643791bc Merge origin/develop into feat/refacto-stream-binary
Integrates ~30 develop commits (PR #997): AWS expansion (8→25 cmds),
SSH signing for git commit/push, go test context, grep stdin leak fix,
default-to-ask permissions, gh pr merge passthrough.

Conflict resolution (4 files):
- git.rs: kept .output()+stdin(inherit) for commit/push (SSH/GPG signing)
- go_cmd.rs: accepted incoming + added pub(crate) visibility
- hook_check.rs: merged binary_hook_registered + other_integration_installed
- hook_cmd.rs: fixed permissions path, println→writeln for Gemini deny

Verified: 1445 tests pass, 0 clippy errors, all manual integration tests pass.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-04 21:21:01 +02:00
aesoft a2312df5f2 feat(stream): standardize command execution with exec_capture() 2026-04-04 20:38:43 +02:00
Nicolas Le Cam c6f35c9771 fix: apply clippy suggestions
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
2026-04-04 01:25:16 +02:00
em0t 09b3ff9424 fix(git): preserve full diff hunk headers
Signed-off-by: em0t <10153971+em0t@users.noreply.github.com>
2026-04-03 18:09:20 +08:00
Patrick szymkowiak 6cee6c60b8 fix(git): inherit stdin for commit and push to preserve SSH signing (#733)
Command::output() sets stdin to Stdio::piped() by default, creating an
empty pipe instead of inheriting the terminal. SSH signing tools
(1Password, YubiKey, gpg-agent with pinentry) need TTY access on stdin
for passphrase prompts or agent communication. This caused signatures
to be silently dropped — commits succeeded but without gpgsig headers.

Fix: add .stdin(Stdio::inherit()) to git commit and git push commands
so they inherit the parent's stdin (terminal or hook pipe). Output
capture via stdout/stderr pipes is preserved.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-02 21:04:46 +02:00
aesoft 7b0f5e1ba9 feat(core): binary hook w/ native cmd exec + streaming
Co-Authored-By: ahundt <ATHundt@gmail.com>
2026-03-31 20:24:34 +02:00
aesoft 32ff4663cd fix(cmds): exit code unified return code flow 2026-03-29 13:40:54 +02:00
aesoft d9be630bef Merge branch 'develop' of https://github.com/rtk-ai/rtk into refacto-folders-and-documentation 2026-03-26 18:11:34 +01:00
aesoft 46fa31c4b8 chore(refacto-codebase): Folders + Technical docs
- codebase more clear for humans and AI agents
- alignement on vision and filter quality in technical docs
2026-03-24 22:14:35 +01:00