mirror of
https://fastgit.cc/github.com/Yeachan-Heo/oh-my-claudecode
synced 2026-04-20 12:51:30 +08:00
fix(installer): copy hooks lib modules during update
Copy templates/hooks/lib into ~/.claude/hooks/lib for standalone installs and update reconciliation so .mjs hooks keep resolving stdin and atomic-write helpers after omc update. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -603,16 +603,24 @@ function ensureStandaloneHookScripts(log: (msg: string) => void): void {
|
||||
}
|
||||
}
|
||||
|
||||
for (const filename of readdirSync(templatesLibDir)) {
|
||||
if (filename === 'config-dir.mjs') continue; // sourced from scripts/lib/ below
|
||||
const sourcePath = join(templatesLibDir, filename);
|
||||
const targetPath = join(hooksLibDir, filename);
|
||||
copyFileSync(sourcePath, targetPath);
|
||||
if (!isWindows()) {
|
||||
chmodSync(targetPath, 0o755);
|
||||
if (existsSync(templatesLibDir)) {
|
||||
if (!existsSync(hooksLibDir)) {
|
||||
mkdirSync(hooksLibDir, { recursive: true });
|
||||
}
|
||||
|
||||
for (const filename of readdirSync(templatesLibDir)) {
|
||||
if (!filename.endsWith('.mjs') || filename === 'config-dir.mjs') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const sourcePath = join(templatesLibDir, filename);
|
||||
const targetPath = join(hooksLibDir, filename);
|
||||
copyFileSync(sourcePath, targetPath);
|
||||
if (!isWindows()) {
|
||||
chmodSync(targetPath, 0o755);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// config-dir.mjs: canonical source is scripts/lib/, not templates (avoids duplication)
|
||||
const configDirHelperMjs = join(packageDir, 'scripts', 'lib', 'config-dir.mjs');
|
||||
const configDirHelperMjsDest = join(hooksLibDir, 'config-dir.mjs');
|
||||
@@ -620,7 +628,6 @@ function ensureStandaloneHookScripts(log: (msg: string) => void): void {
|
||||
if (!isWindows()) {
|
||||
chmodSync(configDirHelperMjsDest, 0o755);
|
||||
}
|
||||
|
||||
if (!isWindows()) {
|
||||
const findNodeSrc = join(packageDir, 'scripts', 'find-node.sh');
|
||||
const findNodeDest = join(HOOKS_DIR, 'find-node.sh');
|
||||
|
||||
Reference in New Issue
Block a user