From a431b8922c9afd4acc0125dc2a495a74e1b43693 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 1 Sep 2025 19:57:14 -0500 Subject: [PATCH] fix: ensure opencode still works if no commits present (#2363) --- packages/opencode/src/project/project.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts index c61a5ca6..b6dfc58b 100644 --- a/packages/opencode/src/project/project.ts +++ b/packages/opencode/src/project/project.ts @@ -53,6 +53,17 @@ export namespace Project { .map((x) => x.trim()) .toSorted(), ) + if (!id) { + const project: Info = { + id: "global", + worktree: "/", + time: { + created: Date.now(), + }, + } + await Storage.write(["project", "global"], project) + return project + } worktree = path.dirname( await $`git rev-parse --path-format=absolute --git-common-dir` .quiet()