diff options
| author | Aiden Cline <[email protected]> | 2025-08-27 15:59:33 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-27 15:59:33 -0500 |
| commit | 2d794ed03d2baacf5da829dccc65047c08d7aa04 (patch) | |
| tree | 826a1f44674f074e97e9b9711be0122864e668fc | |
| parent | 8749c0c707330550489a2928802f5e994660a424 (diff) | |
| download | opencode-2d794ed03d2baacf5da829dccc65047c08d7aa04.tar.gz opencode-2d794ed03d2baacf5da829dccc65047c08d7aa04.zip | |
fix: ensure / commands dont try to resolve @ references from cmd outputs (#2282)
| -rw-r--r-- | packages/opencode/src/session/index.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index 7cb244001..4a9a6785d 100644 --- a/packages/opencode/src/session/index.ts +++ b/packages/opencode/src/session/index.ts @@ -1183,6 +1183,10 @@ export namespace Session { let template = command.template.replace("$ARGUMENTS", input.arguments) + // intentionally doing match regex doing bash regex replacements + // this is because bash commands can output "@" references + const fileMatches = template.matchAll(fileRegex) + const bash = Array.from(template.matchAll(bashRegex)) if (bash.length > 0) { const results = await Promise.all( @@ -1205,10 +1209,9 @@ export namespace Session { }, ] as ChatInput["parts"] - const matches = template.matchAll(fileRegex) const app = App.info() - for (const match of matches) { + for (const match of fileMatches) { const file = path.join(app.path.cwd, match[1]) parts.push({ type: "file", |
