@kevin0181/memoc 1.4.5 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +37 -19
- package/package.json +1 -1
- package/plugins/memoc/.codex-plugin/plugin.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -707,27 +707,45 @@ function ensureCurrentPathLauncher(mark) {
|
|
|
707
707
|
return true;
|
|
708
708
|
}
|
|
709
709
|
|
|
710
|
-
function ensureRuntimeInstall(mark) {
|
|
711
|
-
const runtimeDir = defaultRuntimeDir();
|
|
712
|
-
const sourceRoot = path.join(__dirname, '..');
|
|
713
|
-
const files = [
|
|
714
|
-
[path.join(sourceRoot, 'bin', 'cli.js'), path.join(runtimeDir, 'bin', 'cli.js')],
|
|
715
|
-
[path.join(sourceRoot, 'package.json'), path.join(runtimeDir, 'package.json')],
|
|
716
|
-
];
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
710
|
+
function ensureRuntimeInstall(mark) {
|
|
711
|
+
const runtimeDir = defaultRuntimeDir();
|
|
712
|
+
const sourceRoot = path.join(__dirname, '..');
|
|
713
|
+
const files = [
|
|
714
|
+
[path.join(sourceRoot, 'bin', 'cli.js'), path.join(runtimeDir, 'bin', 'cli.js')],
|
|
715
|
+
[path.join(sourceRoot, 'package.json'), path.join(runtimeDir, 'package.json')],
|
|
716
|
+
];
|
|
717
|
+
const resourceDirs = [
|
|
718
|
+
[path.join(sourceRoot, 'plugins'), path.join(runtimeDir, 'plugins')],
|
|
719
|
+
[path.join(sourceRoot, 'skills'), path.join(runtimeDir, 'skills')],
|
|
720
|
+
];
|
|
721
|
+
|
|
722
|
+
for (const [src, dest] of files) {
|
|
723
|
+
try {
|
|
724
|
+
const content = fs.readFileSync(src, 'utf8');
|
|
725
|
+
const changed = writeIfChanged(dest, content);
|
|
722
726
|
mark(changed, `runtime ${path.relative(runtimeDir, dest)}`);
|
|
723
727
|
} catch {
|
|
724
|
-
mark('skip', `runtime ${path.basename(dest)} unavailable`);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
728
|
+
mark('skip', `runtime ${path.basename(dest)} unavailable`);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
for (const [src, dest] of resourceDirs) {
|
|
733
|
+
try {
|
|
734
|
+
if (!fs.existsSync(src)) {
|
|
735
|
+
mark('skip', `runtime ${path.basename(dest)} unavailable`);
|
|
736
|
+
continue;
|
|
737
|
+
}
|
|
738
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
739
|
+
copyDirSync(src, dest);
|
|
740
|
+
mark(true, `runtime ${path.basename(dest)}`);
|
|
741
|
+
} catch {
|
|
742
|
+
mark('skip', `runtime ${path.basename(dest)} unavailable`);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
chmodExecutable(path.join(runtimeDir, 'bin', 'cli.js'));
|
|
747
|
+
return path.join(runtimeDir, 'bin', 'cli.js');
|
|
748
|
+
}
|
|
731
749
|
|
|
732
750
|
function findWritablePathDir() {
|
|
733
751
|
const dirs = [...new Set((process.env.PATH || '').split(path.delimiter).filter(Boolean))];
|
package/package.json
CHANGED