opencode-manifold 0.4.13 → 0.4.14
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/dist/index.js +33 -45
- package/dist/tui.js +12 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2851,6 +2851,7 @@ async function handleManifoldModels(api) {
|
|
|
2851
2851
|
}
|
|
2852
2852
|
async function handleManifoldUpdate(api) {
|
|
2853
2853
|
const directory = api.state.path.directory;
|
|
2854
|
+
const { rm } = await import("fs/promises");
|
|
2854
2855
|
const settingsPath = join(directory, "Manifold", "settings.json");
|
|
2855
2856
|
let settings = {};
|
|
2856
2857
|
if (existsSync(settingsPath)) {
|
|
@@ -2859,29 +2860,10 @@ async function handleManifoldUpdate(api) {
|
|
|
2859
2860
|
settings = JSON.parse(content);
|
|
2860
2861
|
} catch {}
|
|
2861
2862
|
}
|
|
2863
|
+
const globalConfigDir = join(homedir(), ".config", "opencode", "manifold");
|
|
2862
2864
|
const configuredPaths = settings.updateCachePaths || [];
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
api.ui.ui.DialogSelect({
|
|
2866
|
-
title: "Manifold Plugin Update",
|
|
2867
|
-
options: [
|
|
2868
|
-
{
|
|
2869
|
-
title: "Configure Cache Paths",
|
|
2870
|
-
value: "configure",
|
|
2871
|
-
description: "Add updateCachePaths to Manifold/settings.json",
|
|
2872
|
-
footer: "Opens settings file"
|
|
2873
|
-
}
|
|
2874
|
-
],
|
|
2875
|
-
onSelect: () => {
|
|
2876
|
-
api.ui.toast({
|
|
2877
|
-
variant: "info",
|
|
2878
|
-
message: "Add updateCachePaths to Manifold/settings.json"
|
|
2879
|
-
});
|
|
2880
|
-
}
|
|
2881
|
-
});
|
|
2882
|
-
return;
|
|
2883
|
-
}
|
|
2884
|
-
const resolvedPaths = configuredPaths.map((p) => {
|
|
2865
|
+
const pathsToClear = [...new Set([...configuredPaths, globalConfigDir])];
|
|
2866
|
+
const resolvedPaths = pathsToClear.map((p) => {
|
|
2885
2867
|
const expanded = p.startsWith("~") ? join(homedir(), p.slice(1)) : p;
|
|
2886
2868
|
return expanded;
|
|
2887
2869
|
});
|
|
@@ -2891,9 +2873,9 @@ async function handleManifoldUpdate(api) {
|
|
|
2891
2873
|
title: "Manifold Plugin Update",
|
|
2892
2874
|
options: [
|
|
2893
2875
|
{
|
|
2894
|
-
title: "Clear Cache",
|
|
2876
|
+
title: "Clear Plugin & Template Cache",
|
|
2895
2877
|
value: "confirm",
|
|
2896
|
-
description: `Will clear ${resolvedPaths.length} path(s)`,
|
|
2878
|
+
description: `Will clear ${resolvedPaths.length} path(s) including global templates`,
|
|
2897
2879
|
footer: resolvedPaths.map((p) => `• ${p}`).join(`
|
|
2898
2880
|
`)
|
|
2899
2881
|
},
|
|
@@ -2908,36 +2890,21 @@ async function handleManifoldUpdate(api) {
|
|
|
2908
2890
|
resolve();
|
|
2909
2891
|
return;
|
|
2910
2892
|
}
|
|
2911
|
-
const { exec } = await import("child_process");
|
|
2912
|
-
const { promisify } = await import("util");
|
|
2913
|
-
const execAsync = promisify(exec);
|
|
2914
2893
|
const cleared = [];
|
|
2915
|
-
const skipped = [];
|
|
2916
2894
|
const blocked = [];
|
|
2917
2895
|
for (const pathStr of resolvedPaths) {
|
|
2918
2896
|
try {
|
|
2919
|
-
|
|
2920
|
-
|
|
2897
|
+
if (existsSync(pathStr)) {
|
|
2898
|
+
await rm(pathStr, { recursive: true, force: true });
|
|
2899
|
+
cleared.push(pathStr);
|
|
2900
|
+
}
|
|
2921
2901
|
} catch (error) {
|
|
2922
|
-
blocked.push({ path: pathStr, reason:
|
|
2902
|
+
blocked.push({ path: pathStr, reason: `${error}` });
|
|
2923
2903
|
}
|
|
2924
2904
|
}
|
|
2925
|
-
let message = "";
|
|
2926
|
-
if (cleared.length > 0) {
|
|
2927
|
-
message += `✅ Cleared: ${cleared.length} path(s)
|
|
2928
|
-
`;
|
|
2929
|
-
}
|
|
2930
|
-
if (blocked.length > 0) {
|
|
2931
|
-
message += `\uD83D\uDEAB Blocked: ${blocked.length} path(s)
|
|
2932
|
-
`;
|
|
2933
|
-
}
|
|
2934
|
-
if (cleared.length > 0) {
|
|
2935
|
-
message += `
|
|
2936
|
-
Restart opencode to pull the latest plugin version.`;
|
|
2937
|
-
}
|
|
2938
2905
|
api.ui.toast({
|
|
2939
2906
|
variant: cleared.length > 0 ? "success" : "error",
|
|
2940
|
-
message: cleared.length > 0 ? `Cache cleared. Restart opencode to update.` : `
|
|
2907
|
+
message: cleared.length > 0 ? `Cache cleared. Restart opencode to update.` : `No paths cleared or update blocked`
|
|
2941
2908
|
});
|
|
2942
2909
|
resolve();
|
|
2943
2910
|
}
|
|
@@ -2974,6 +2941,27 @@ async function dirHasContent(dirPath) {
|
|
|
2974
2941
|
return false;
|
|
2975
2942
|
}
|
|
2976
2943
|
}
|
|
2944
|
+
async function copyMissingFiles(src, dest) {
|
|
2945
|
+
if (!existsSync2(src))
|
|
2946
|
+
return [];
|
|
2947
|
+
await mkdir(dest, { recursive: true });
|
|
2948
|
+
const copied = [];
|
|
2949
|
+
const entries = await readdir2(src, { withFileTypes: true });
|
|
2950
|
+
for (const entry of entries) {
|
|
2951
|
+
const srcPath = join2(src, entry.name);
|
|
2952
|
+
const destPath = join2(dest, entry.name);
|
|
2953
|
+
if (entry.isDirectory()) {
|
|
2954
|
+
const subCopied = await copyMissingFiles(srcPath, destPath);
|
|
2955
|
+
if (subCopied.length > 0) {
|
|
2956
|
+
copied.push(entry.name);
|
|
2957
|
+
}
|
|
2958
|
+
} else if (!existsSync2(destPath)) {
|
|
2959
|
+
await writeFile2(destPath, await readFile2(srcPath));
|
|
2960
|
+
copied.push(entry.name);
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
return copied;
|
|
2964
|
+
}
|
|
2977
2965
|
async function copyFiles(src, dest) {
|
|
2978
2966
|
if (!existsSync2(src))
|
|
2979
2967
|
return [];
|
package/dist/tui.js
CHANGED
|
@@ -2851,6 +2851,7 @@ async function handleManifoldModels(api) {
|
|
|
2851
2851
|
}
|
|
2852
2852
|
async function handleManifoldUpdate(api) {
|
|
2853
2853
|
const directory = api.state.path.directory;
|
|
2854
|
+
const { rm } = await import("fs/promises");
|
|
2854
2855
|
const settingsPath = join(directory, "Manifold", "settings.json");
|
|
2855
2856
|
let settings = {};
|
|
2856
2857
|
if (existsSync(settingsPath)) {
|
|
@@ -2859,29 +2860,10 @@ async function handleManifoldUpdate(api) {
|
|
|
2859
2860
|
settings = JSON.parse(content);
|
|
2860
2861
|
} catch {}
|
|
2861
2862
|
}
|
|
2863
|
+
const globalConfigDir = join(homedir(), ".config", "opencode", "manifold");
|
|
2862
2864
|
const configuredPaths = settings.updateCachePaths || [];
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
api.ui.ui.DialogSelect({
|
|
2866
|
-
title: "Manifold Plugin Update",
|
|
2867
|
-
options: [
|
|
2868
|
-
{
|
|
2869
|
-
title: "Configure Cache Paths",
|
|
2870
|
-
value: "configure",
|
|
2871
|
-
description: "Add updateCachePaths to Manifold/settings.json",
|
|
2872
|
-
footer: "Opens settings file"
|
|
2873
|
-
}
|
|
2874
|
-
],
|
|
2875
|
-
onSelect: () => {
|
|
2876
|
-
api.ui.toast({
|
|
2877
|
-
variant: "info",
|
|
2878
|
-
message: "Add updateCachePaths to Manifold/settings.json"
|
|
2879
|
-
});
|
|
2880
|
-
}
|
|
2881
|
-
});
|
|
2882
|
-
return;
|
|
2883
|
-
}
|
|
2884
|
-
const resolvedPaths = configuredPaths.map((p) => {
|
|
2865
|
+
const pathsToClear = [...new Set([...configuredPaths, globalConfigDir])];
|
|
2866
|
+
const resolvedPaths = pathsToClear.map((p) => {
|
|
2885
2867
|
const expanded = p.startsWith("~") ? join(homedir(), p.slice(1)) : p;
|
|
2886
2868
|
return expanded;
|
|
2887
2869
|
});
|
|
@@ -2891,9 +2873,9 @@ async function handleManifoldUpdate(api) {
|
|
|
2891
2873
|
title: "Manifold Plugin Update",
|
|
2892
2874
|
options: [
|
|
2893
2875
|
{
|
|
2894
|
-
title: "Clear Cache",
|
|
2876
|
+
title: "Clear Plugin & Template Cache",
|
|
2895
2877
|
value: "confirm",
|
|
2896
|
-
description: `Will clear ${resolvedPaths.length} path(s)`,
|
|
2878
|
+
description: `Will clear ${resolvedPaths.length} path(s) including global templates`,
|
|
2897
2879
|
footer: resolvedPaths.map((p) => `• ${p}`).join(`
|
|
2898
2880
|
`)
|
|
2899
2881
|
},
|
|
@@ -2908,36 +2890,21 @@ async function handleManifoldUpdate(api) {
|
|
|
2908
2890
|
resolve();
|
|
2909
2891
|
return;
|
|
2910
2892
|
}
|
|
2911
|
-
const { exec } = await import("child_process");
|
|
2912
|
-
const { promisify } = await import("util");
|
|
2913
|
-
const execAsync = promisify(exec);
|
|
2914
2893
|
const cleared = [];
|
|
2915
|
-
const skipped = [];
|
|
2916
2894
|
const blocked = [];
|
|
2917
2895
|
for (const pathStr of resolvedPaths) {
|
|
2918
2896
|
try {
|
|
2919
|
-
|
|
2920
|
-
|
|
2897
|
+
if (existsSync(pathStr)) {
|
|
2898
|
+
await rm(pathStr, { recursive: true, force: true });
|
|
2899
|
+
cleared.push(pathStr);
|
|
2900
|
+
}
|
|
2921
2901
|
} catch (error) {
|
|
2922
|
-
blocked.push({ path: pathStr, reason:
|
|
2902
|
+
blocked.push({ path: pathStr, reason: `${error}` });
|
|
2923
2903
|
}
|
|
2924
2904
|
}
|
|
2925
|
-
let message = "";
|
|
2926
|
-
if (cleared.length > 0) {
|
|
2927
|
-
message += `✅ Cleared: ${cleared.length} path(s)
|
|
2928
|
-
`;
|
|
2929
|
-
}
|
|
2930
|
-
if (blocked.length > 0) {
|
|
2931
|
-
message += `\uD83D\uDEAB Blocked: ${blocked.length} path(s)
|
|
2932
|
-
`;
|
|
2933
|
-
}
|
|
2934
|
-
if (cleared.length > 0) {
|
|
2935
|
-
message += `
|
|
2936
|
-
Restart opencode to pull the latest plugin version.`;
|
|
2937
|
-
}
|
|
2938
2905
|
api.ui.toast({
|
|
2939
2906
|
variant: cleared.length > 0 ? "success" : "error",
|
|
2940
|
-
message: cleared.length > 0 ? `Cache cleared. Restart opencode to update.` : `
|
|
2907
|
+
message: cleared.length > 0 ? `Cache cleared. Restart opencode to update.` : `No paths cleared or update blocked`
|
|
2941
2908
|
});
|
|
2942
2909
|
resolve();
|
|
2943
2910
|
}
|