Add shell commands without context contribution (!! prefix)

Use !!command to execute bash commands that are shown in the TUI and
saved to session history but excluded from LLM context, compaction
summaries, and branch summaries.

- Add excludeFromContext field to BashExecutionMessage
- Filter excluded messages in convertToLlm()
- Parse !! prefix in interactive mode
- Use dim border color for excluded commands

fixes #414
This commit is contained in:
Mario Zechner 2026-01-03 04:14:35 +01:00
parent bc52509a42
commit 746ec9eb01
5 changed files with 40 additions and 17 deletions

View file

@ -29,12 +29,14 @@ export class BashExecutionComponent extends Container {
private contentContainer: Container;
private ui: TUI;
constructor(command: string, ui: TUI) {
constructor(command: string, ui: TUI, excludeFromContext = false) {
super();
this.command = command;
this.ui = ui;
const borderColor = (str: string) => theme.fg("bashMode", str);
// Use dim border for excluded-from-context commands (!! prefix)
const colorKey = excludeFromContext ? "dim" : "bashMode";
const borderColor = (str: string) => theme.fg(colorKey, str);
// Add spacer
this.addChild(new Spacer(1));
@ -47,13 +49,13 @@ export class BashExecutionComponent extends Container {
this.addChild(this.contentContainer);
// Command header
const header = new Text(theme.fg("bashMode", theme.bold(`$ ${command}`)), 1, 0);
const header = new Text(theme.fg(colorKey, theme.bold(`$ ${command}`)), 1, 0);
this.contentContainer.addChild(header);
// Loader
this.loader = new Loader(
ui,
(spinner) => theme.fg("bashMode", spinner),
(spinner) => theme.fg(colorKey, spinner),
(text) => theme.fg("muted", text),
"Running... (esc to cancel)",
);