fix(dcp): correct storage path to match OpenCode's actual location

DCP was failing to find session messages because it was looking in
~/.config/opencode/sessions instead of ~/.local/share/opencode/storage.
Unified all hooks to use getOpenCodeStorageDir() for cross-platform consistency.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-28 16:13:50 +09:00
parent e3be656f86
commit 7b7c14301e
8 changed files with 20 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
import { join } from "node:path";
import { xdgData } from "xdg-basedir";
import { getOpenCodeStorageDir } from "../../shared/data-path";
export const OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage");
export const OPENCODE_STORAGE = getOpenCodeStorageDir();
export const AGENT_USAGE_REMINDER_STORAGE = join(
OPENCODE_STORAGE,
"agent-usage-reminder",

View File

@@ -1,19 +1,8 @@
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs"
import { homedir } from "node:os"
import { join } from "node:path"
import { xdgData } from "xdg-basedir"
let OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage")
// Fix for macOS where xdg-basedir points to ~/Library/Application Support
// but OpenCode (cli) uses ~/.local/share
if (process.platform === "darwin" && !existsSync(OPENCODE_STORAGE)) {
const localShare = join(homedir(), ".local", "share", "opencode", "storage")
if (existsSync(localShare)) {
OPENCODE_STORAGE = localShare
}
}
import { getOpenCodeStorageDir } from "../../shared/data-path"
const OPENCODE_STORAGE = getOpenCodeStorageDir()
const MESSAGE_STORAGE = join(OPENCODE_STORAGE, "message")
const PART_STORAGE = join(OPENCODE_STORAGE, "part")

View File

@@ -1,7 +1,7 @@
import { join } from "node:path";
import { xdgData } from "xdg-basedir";
import { getOpenCodeStorageDir } from "../../shared/data-path";
export const OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage");
export const OPENCODE_STORAGE = getOpenCodeStorageDir();
export const AGENTS_INJECTOR_STORAGE = join(
OPENCODE_STORAGE,
"directory-agents",

View File

@@ -1,7 +1,7 @@
import { join } from "node:path";
import { xdgData } from "xdg-basedir";
import { getOpenCodeStorageDir } from "../../shared/data-path";
export const OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage");
export const OPENCODE_STORAGE = getOpenCodeStorageDir();
export const README_INJECTOR_STORAGE = join(
OPENCODE_STORAGE,
"directory-readme",

View File

@@ -1,7 +1,7 @@
import { join } from "node:path";
import { xdgData } from "xdg-basedir";
import { getOpenCodeStorageDir } from "../../shared/data-path";
export const OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage");
export const OPENCODE_STORAGE = getOpenCodeStorageDir();
export const INTERACTIVE_BASH_SESSION_STORAGE = join(
OPENCODE_STORAGE,
"interactive-bash-session",

View File

@@ -1,7 +1,7 @@
import { join } from "node:path";
import { xdgData } from "xdg-basedir";
import { getOpenCodeStorageDir } from "../../shared/data-path";
export const OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage");
export const OPENCODE_STORAGE = getOpenCodeStorageDir();
export const RULES_INJECTOR_STORAGE = join(OPENCODE_STORAGE, "rules-injector");
export const PROJECT_MARKERS = [

View File

@@ -1,7 +1,7 @@
import { join } from "node:path"
import { xdgData } from "xdg-basedir"
import { getOpenCodeStorageDir } from "../../shared/data-path"
export const OPENCODE_STORAGE = join(xdgData ?? "", "opencode", "storage")
export const OPENCODE_STORAGE = getOpenCodeStorageDir()
export const MESSAGE_STORAGE = join(OPENCODE_STORAGE, "message")
export const PART_STORAGE = join(OPENCODE_STORAGE, "part")