Dax Raad 2 months ago
parent
commit
8bff3cdae8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      packages/opencode/src/project/project.ts

+ 5 - 2
packages/opencode/src/project/project.ts

@@ -38,7 +38,7 @@ export namespace Project {
   export type Info = z.infer<typeof Info>
   export type Info = z.infer<typeof Info>
 
 
   export const Event = {
   export const Event = {
-    Updated: BusEvent.define("project.updated", z.object(Info)),
+    Updated: BusEvent.define("project.updated", Info),
   }
   }
 
 
   export async function fromDirectory(directory: string) {
   export async function fromDirectory(directory: string) {
@@ -100,6 +100,7 @@ export namespace Project {
         await migrateFromGlobal(id, worktree)
         await migrateFromGlobal(id, worktree)
       }
       }
     }
     }
+    if (!existing.icon) discover(existing)
     await Storage.write<Info>(["project", id], {
     await Storage.write<Info>(["project", id], {
       ...existing,
       ...existing,
       worktree,
       worktree,
@@ -115,9 +116,11 @@ export namespace Project {
         properties: existing,
         properties: existing,
       },
       },
     })
     })
-    return existing!
+    return existing
   }
   }
 
 
+  async function discover(input: Pick<Info, "id" | "worktree">) {}
+
   async function migrateFromGlobal(newProjectID: string, worktree: string) {
   async function migrateFromGlobal(newProjectID: string, worktree: string) {
     const globalProject = await Storage.read<Info>(["project", "global"]).catch(() => undefined)
     const globalProject = await Storage.read<Info>(["project", "global"]).catch(() => undefined)
     if (!globalProject) return
     if (!globalProject) return