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:
@@ -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).";
|
||||
}
|
||||
Reference in New Issue
Block a user