mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-15 13:14:35 +00:00
- Rename packages/opencode → packages/tfcode (directory only) - Rename bin/opencode → bin/tfcode (CLI binary) - Rename .opencode → .tfcode (config directory) - Update package.json name and bin field - Update config directory path references (.tfcode) - Keep internal code references as 'opencode' for easy upstream sync - Keep @opencode-ai/* workspace package names This minimal branding approach allows clean merges from upstream opencode repository while providing tfcode branding for users.
36 lines
888 B
TypeScript
36 lines
888 B
TypeScript
import { Process } from "./process"
|
|
|
|
export interface GitResult {
|
|
exitCode: number
|
|
text(): string
|
|
stdout: Buffer
|
|
stderr: Buffer
|
|
}
|
|
|
|
/**
|
|
* Run a git command.
|
|
*
|
|
* Uses Process helpers with stdin ignored to avoid protocol pipe inheritance
|
|
* issues in embedded/client environments.
|
|
*/
|
|
export async function git(args: string[], opts: { cwd: string; env?: Record<string, string> }): Promise<GitResult> {
|
|
return Process.run(["git", ...args], {
|
|
cwd: opts.cwd,
|
|
env: opts.env,
|
|
stdin: "ignore",
|
|
nothrow: true,
|
|
})
|
|
.then((result) => ({
|
|
exitCode: result.code,
|
|
text: () => result.stdout.toString(),
|
|
stdout: result.stdout,
|
|
stderr: result.stderr,
|
|
}))
|
|
.catch((error) => ({
|
|
exitCode: 1,
|
|
text: () => "",
|
|
stdout: Buffer.alloc(0),
|
|
stderr: Buffer.from(error instanceof Error ? error.message : String(error)),
|
|
}))
|
|
}
|