Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencode-mem",
"version": "2.23.0",
"version": "2.24.0",
"description": "OpenCode plugin that gives coding agents persistent memory using local Turso/libSQL vector search",
"type": "module",
"main": "dist/plugin.js",
Expand Down
6 changes: 1 addition & 5 deletions src/services/shard-path-migration-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { tursoVectorSearch } from "./turso/vector-search.js";
import { withSqliteFileLockRetry } from "./turso/sqlite-handle-release.js";
import { log } from "./logger.js";
import {
normalizeProjectPath,
shardInventoryService,
type ResolveMigrationSourceOptions,
type ResolvedMigrationSource,
Expand Down Expand Up @@ -362,10 +361,7 @@ export class ShardPathMigrationService {
// recoverable memory migration.
if (source.group.projectPath && target.projectPath) {
try {
await userPromptManager.updateProjectPath(
normalizeProjectPath(source.group.projectPath),
normalizeProjectPath(target.projectPath)
);
await userPromptManager.updateProjectPath(source.group.projectPath, target.projectPath);
} catch (error) {
log("Path migration prompt metadata update failed", { error: String(error) });
}
Expand Down
11 changes: 7 additions & 4 deletions src/services/user-prompt/user-prompt-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,13 @@ export class UserPromptManager {
return 0;
}
const db = await this.ready();
return db.run(`UPDATE user_prompts SET project_path = ? WHERE project_path = ?`, [
newProjectPath,
oldProjectPath,
]);
const normalizedOldPath = oldProjectPath.replace(/\\/g, "/");
return db.run(
`UPDATE user_prompts
SET project_path = ?
WHERE REPLACE(project_path, '\\', '/') = ?`,
[newProjectPath, normalizedOldPath]
);
}

private rowToPrompt(row: Record<string, unknown>): UserPrompt {
Expand Down
22 changes: 22 additions & 0 deletions tests/shard-path-migrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,26 @@ describe("shard path migration", () => {
expect(await tursoShardManager.getAllShards("project", oldHash)).toHaveLength(1);
expect(await tursoShardManager.getAllShards("project", newHash)).toHaveLength(0);
});

it("updates stored Windows prompt paths using separator-independent matching", async () => {
await createProjects();
const { userPromptManager } =
await import("../src/services/user-prompt/user-prompt-manager.js");
const promptId = await userPromptManager.savePrompt(
"windows-session",
"windows-message",
"C:\\workspace\\old-project",
"Windows path prompt"
);

const updated = await userPromptManager.updateProjectPath(
"C:/workspace/old-project",
"C:\\workspace\\new-project"
);

expect(updated).toBe(1);
expect((await userPromptManager.getPromptById(promptId))?.projectPath).toBe(
"C:\\workspace\\new-project"
);
});
});