Browse Source

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 2 months ago
parent
commit
036f5d4eef
1 changed files with 5 additions and 0 deletions
  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)