MCPcopy Create free account
hub / github.com/cloudflare/computer / runRm

Function runRm

packages/computer/src/git/cli.ts:579–605  ·  view source on GitHub ↗
(client: GitClient, args: string[], input: GitCliInput)

Source from the content-addressed store, hash-verified

577// ---------------------------------------------------------------
578
579async function runRm(client: GitClient, args: string[], input: GitCliInput): Promise<GitCliResult> {
580 // `git rm <pathspec>...`. We don't surface --cached (yet); the
581 // typed surface lacks it and isomorphic-git's `remove` only
582 // unstages — it does not touch the working tree. Document this
583 // in the docs phase; warn here so a caller piping in --cached
584 // isn't surprised.
585 const parsed = parseFlags(args, {
586 cached: { kind: "bool" },
587 });
588 if ("error" in parsed) {
589 return { stdout: "", stderr: `git rm: ${parsed.error}\n`, exitCode: 129 };
590 }
591 if (parsed.positional.length === 0) {
592 return {
593 stdout: "",
594 stderr: "git rm: no pathspec given on command line\n",
595 exitCode: 129,
596 };
597 }
598 const dir = resolveDir(undefined, input.cwd);
599 try {
600 await client.rm({ dir, paths: parsed.positional });
601 } catch (cause) {
602 return mapGitError("rm", cause);
603 }
604 return { stdout: "", stderr: "", exitCode: 0 };
605}
606
607// ---------------------------------------------------------------
608// commit

Callers 1

runGitCliFunction · 0.85

Calls 4

resolveDirFunction · 0.85
mapGitErrorFunction · 0.85
parseFlagsFunction · 0.70
rmMethod · 0.65

Tested by

no test coverage detected