You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
let raw = "On branch feature\n\ninteractive rebase in progress; onto abc1234\nLast command done (1 command done):\n edit abc123 some message\nNo commands remaining.\nYou are currently editing a commit while rebasing branch 'feature' on 'abc1234'.\n (use \"git commit --amend\" to amend the current commit)\n (use \"git rebase --continue\" once you are satisfied with your changes)\n\nnothing to commit, working tree clean\n";
2233
2180
let out = extract_state_header(raw).expect("state expected");
2234
-
assert!(out.contains("rebase in progress"));
2235
-
assert!(out.contains("git rebase --continue"));
2236
-
assert!(out.contains("git commit --amend"));
2237
-
assert!(!out.contains("interactive rebase in progress"));
2238
-
assert!(!out.contains("Last command done"));
2181
+
assert_eq!(out,"rebase in progress");
2239
2182
}
2240
2183
2241
2184
#[test]
2242
2185
fntest_extract_state_header_merge_unresolved(){
2243
2186
let raw = "On branch main\nYou have unmerged paths.\n (fix conflicts and run \"git commit\")\n (use \"git merge --abort\" to abort the merge)\n\nUnmerged paths:\n\tboth modified: src/main.rs\n";
2244
2187
let out = extract_state_header(raw).expect("state expected");
2245
-
assert!(out.contains("merge in progress. unresolved conflicts"));
2246
-
assert!(out.contains("git merge --abort"));
2247
-
assert!(!out.contains("git commit"));
2188
+
assert_eq!(out,"merge in progress. unresolved conflicts");
2248
2189
}
2249
2190
2250
2191
#[test]
2251
2192
fntest_extract_state_header_cherry_pick(){
2252
2193
let raw = "On branch main\n\nYou are currently cherry-picking commit abc1234.\n (fix conflicts and run \"git cherry-pick --continue\")\n (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)\n\nnothing to commit, working tree clean\n";
2253
2194
let out = extract_state_header(raw).expect("state expected");
let raw = "On branch main\n\nYou are currently bisecting, started from branch 'main'.\n (use \"git bisect reset\" to get back to the original branch)\n\nnothing to commit, working tree clean\n";
2262
2201
let out = extract_state_header(raw).expect("state expected");
2263
-
assert!(out.contains("bisect in progress"));
2264
-
assert!(out.contains("git bisect reset"));
2202
+
assert_eq!(out,"bisect in progress");
2265
2203
}
2266
2204
2267
2205
#[test]
2268
2206
fntest_extract_state_header_revert(){
2269
2207
let raw = "On branch main\n\nYou are currently reverting commit abc1234.\n (fix conflicts and run \"git revert --continue\")\n (use \"git revert --abort\" to cancel the revert operation)\n\nnothing to commit, working tree clean\n";
2270
2208
let out = extract_state_header(raw).expect("state expected");
2271
-
assert!(out.contains("revert in progress"));
2272
-
assert!(out.contains("git revert --continue"));
2209
+
assert_eq!(out,"revert in progress");
2273
2210
}
2274
2211
2275
2212
#[test]
2276
2213
fntest_extract_state_header_merge_in_middle(){
2277
2214
let raw = "On branch main\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/main.rs\n";
2278
2215
let out = extract_state_header(raw).expect("state expected");
2279
-
assert!(out.contains("merge in progress. no conflicts"));
// `(use "git add ...)` is generic status hint noise. Confirm that
2286
-
// when we're inside a state block, it's still skipped but the state
2287
-
// itself survives.
2288
-
let raw = "On branch main\n\nYou are currently rebasing branch 'foo' on 'bar'.\n (use \"git add <file>...\" to mark resolution)\n (use \"git rebase --continue\" once done)\n\nnothing to commit, working tree clean\n";
2289
-
let out = extract_state_header(raw).expect("state expected");
2290
-
assert!(out.contains("rebase in progress"));
2291
-
assert!(out.contains("git rebase --continue"));
2292
-
assert!(!out.contains("git add <file>"));
2216
+
assert_eq!(out,"merge in progress. no conflicts");
2293
2217
}
2294
2218
2295
2219
#[test]
2296
2220
fntest_extract_state_header_am_session(){
2297
2221
let raw = "On branch main\n\nYou are in the middle of an am session.\n (use \"git am --continue\" to continue)\n (use \"git am --abort\" to restore the original branch)\n\nnothing to commit, working tree clean\n";
2298
2222
let out = extract_state_header(raw).expect("state expected");
0 commit comments