diff options
| author | adamelmore <[email protected]> | 2026-01-25 12:51:42 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-01-25 13:20:18 -0600 |
| commit | 94ce289dd9103c16a7f69396a7c49d48dc036a6c (patch) | |
| tree | 6919623333f7baa6152cec8b5f79538d730dddbb | |
| parent | d115f33b59d84bda8df8937624504dc2e09731d6 (diff) | |
| download | opencode-94ce289dd9103c16a7f69396a7c49d48dc036a6c.tar.gz opencode-94ce289dd9103c16a7f69396a7c49d48dc036a6c.zip | |
fix(app): run start command after reset
| -rw-r--r-- | packages/opencode/src/worktree/index.ts | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/packages/opencode/src/worktree/index.ts b/packages/opencode/src/worktree/index.ts index 97fe2c4fc..dd165d56f 100644 --- a/packages/opencode/src/worktree/index.ts +++ b/packages/opencode/src/worktree/index.ts @@ -517,8 +517,32 @@ export namespace Worktree { } const dirty = outputText(status.stdout) - if (!dirty) return true + if (dirty) { + throw new ResetFailedError({ message: `Worktree reset left local changes:\n${dirty}` }) + } + + const projectID = Instance.project.id + setTimeout(() => { + const start = async () => { + const project = await Storage.read<Project.Info>(["project", projectID]).catch(() => undefined) + const startup = project?.commands?.start?.trim() ?? "" + if (!startup) return + + const ran = await runStartCommand(worktreePath, startup) + if (ran.exitCode === 0) return - throw new ResetFailedError({ message: `Worktree reset left local changes:\n${dirty}` }) + log.error("worktree start command failed", { + kind: "project", + directory: worktreePath, + message: errorText(ran), + }) + } + + void start().catch((error) => { + log.error("worktree start task failed", { directory: worktreePath, error }) + }) + }, 0) + + return true }) } |
