Skip to content

Commit 40295e4

Browse files
committed
feat(paths): improve data directory initialization check to include database file validation
1 parent 1a81521 commit 40295e4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/config/paths.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ function hasInitializedDataDir(dir: string): boolean {
7979
try {
8080
const stats = statSync(dir)
8181
if (!stats.isDirectory()) return true
82-
return readdirSync(dir).length > 0
82+
// Check for the database file as proof of actual data initialization.
83+
// A directory with only leftover subdirectories (workspace/, skills/) from
84+
// older versions should NOT be considered initialized — otherwise the
85+
// migration from the legacy data dir would be incorrectly skipped.
86+
return existsSync(resolve(dir, 'youclaw.db'))
8387
} catch {
8488
return false
8589
}

0 commit comments

Comments
 (0)