diff options
| author | Dax Raad <[email protected]> | 2025-07-01 20:39:43 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-07-01 20:44:12 -0400 |
| commit | 6389858d41f33f2122b871dd4f1ab5be39140994 (patch) | |
| tree | ea15a345e48ef223ce1d1112120e5bfb6f3466b0 | |
| parent | 7e5941e14b8746fbc68c6dc18545007013f6c9bb (diff) | |
| download | opencode-6389858d41f33f2122b871dd4f1ab5be39140994.tar.gz opencode-6389858d41f33f2122b871dd4f1ab5be39140994.zip | |
ignore: add file status command
| -rw-r--r-- | packages/opencode/src/file/index.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/opencode/src/file/index.ts b/packages/opencode/src/file/index.ts index 29331a587..9e269b43d 100644 --- a/packages/opencode/src/file/index.ts +++ b/packages/opencode/src/file/index.ts @@ -24,9 +24,8 @@ export namespace File { const app = App.info() if (!app.git) return [] - // Get all changed files with line counts in one command const diffOutput = await $`git diff --numstat HEAD` - .cwd(app.path.root) + .cwd(app.path.cwd) .quiet() .nothrow() .text() @@ -46,9 +45,8 @@ export namespace File { } } - // Get untracked files const untrackedOutput = await $`git ls-files --others --exclude-standard` - .cwd(app.path.root) + .cwd(app.path.cwd) .quiet() .nothrow() .text() @@ -75,7 +73,7 @@ export namespace File { // Get deleted files const deletedOutput = await $`git diff --name-only --diff-filter=D HEAD` - .cwd(app.path.root) + .cwd(app.path.cwd) .quiet() .nothrow() .text() @@ -102,7 +100,9 @@ export namespace File { using _ = log.time("read", { file }) const app = App.info() const full = path.join(app.path.cwd, file) - const content = await Bun.file(full).text() + const content = await Bun.file(full) + .text() + .then((x) => x.trim()) if (app.git) { const rel = path.relative(app.path.root, full) const diff = await git.status({ @@ -119,9 +119,9 @@ export namespace File { const patch = createPatch(file, original, content, "old", "new", { context: Infinity, }) - return patch + return { type: "patch", content: patch } } } - return content.trim() + return { type: "raw", content } } } |
