feat(tui): port Fase 4 TUI logic layer — InputState/Action dispatcher/key controller/slash commands + lightweight ANSI renderer + run loop; 20 test

This commit is contained in:
asepharyana
2026-09-02 22:50:38 +07:00
parent 2e81412605
commit 8098133ba5
13 changed files with 1637 additions and 1 deletions
+26
View File
@@ -0,0 +1,26 @@
/**
* Git diff preview helper — shells out to `git diff` over the workspace
* roots and returns the combined output text. Mirrors
* `apps/interfaces/tui/src/action/git.rs`.
*/
import { execSync } from "node:child_process";
/** Run `git diff` across the given workspace roots and return the output. */
export function gitDiffOutput(workspaceRoots: string[]): string {
for (const root of workspaceRoots) {
try {
const out = execSync("git diff --stat && git diff", {
cwd: root,
encoding: "utf8",
maxBuffer: 4 * 1024 * 1024,
stdio: ["ignore", "pipe", "ignore"],
});
if (out.trim().length > 0) {
return out;
}
} catch {
// Not a git repo or git not available — continue to the next root.
}
}
return "No diff available (not a git repository).";
}