Sfoglia il codice sorgente

core: add project update timestamps to track when projects were last modified

Projects now track when they were last updated, making it easier for users
to see recent activity and identify stale projects in their workspace.
Dax Raad 10 mesi fa
parent
commit
036f5d4eef
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      packages/opencode/src/project/project.ts

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

@@ -18,6 +18,7 @@ export namespace Project {
       vcs: z.literal("git").optional(),
       time: z.object({
         created: z.number(),
+        updated: z.number().optional(),
         initialized: z.number().optional(),
       }),
     })
@@ -38,6 +39,7 @@ export namespace Project {
         vcs: Info.shape.vcs.parse(Flag.OPENCODE_FAKE_VCS),
         time: {
           created: Date.now(),
+          updated: Date.now(),
         },
       }
       await Storage.write<Info>(["project", "global"], project)
@@ -84,12 +86,15 @@ export namespace Project {
       await migrateFromGlobal(projectID, worktree)
     }
     const project: Info = {
+      ...existing,
       id: projectID,
       worktree,
       vcsDir,
       vcs: "git",
       time: {
         created: Date.now(),
+        ...existing?.time,
+        updated: Date.now(),
       },
     }
     await Storage.write<Info>(["project", projectID], project)