opencode-manifold 0.4.14 → 0.4.15

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.
Files changed (3) hide show
  1. package/dist/index.js +1476 -1803
  2. package/dist/tui.js +71 -2
  3. package/package.json +1 -1
package/dist/tui.js CHANGED
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  import { existsSync } from "fs";
6
6
  import { join } from "path";
7
7
  import { homedir } from "os";
8
- import { readFile, writeFile, readdir } from "fs/promises";
8
+ import { readFile, writeFile, readdir, mkdir } from "fs/promises";
9
9
 
10
10
  // node_modules/js-yaml/dist/js-yaml.mjs
11
11
  /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
@@ -2754,6 +2754,15 @@ async function updateAgentModel(agentName, modelId, directory) {
2754
2754
  }
2755
2755
  var tui = async (api) => {
2756
2756
  api.command.register(() => [
2757
+ {
2758
+ title: "Manifold Init",
2759
+ value: "manifold-init",
2760
+ description: "Initialize Manifold agents, skills, and settings in this project",
2761
+ category: "Manifold",
2762
+ slash: {
2763
+ name: "manifold-init"
2764
+ }
2765
+ },
2757
2766
  {
2758
2767
  title: "Manifold Models",
2759
2768
  value: "manifold-models",
@@ -2774,13 +2783,73 @@ var tui = async (api) => {
2774
2783
  }
2775
2784
  ]);
2776
2785
  api.event.on("tui.command.execute", async (event) => {
2777
- if (event.properties.command === "manifold-models") {
2786
+ if (event.properties.command === "manifold-init") {
2787
+ await handleManifoldInit(api);
2788
+ } else if (event.properties.command === "manifold-models") {
2778
2789
  await handleManifoldModels(api);
2779
2790
  } else if (event.properties.command === "manifold-update") {
2780
2791
  await handleManifoldUpdate(api);
2781
2792
  }
2782
2793
  });
2783
2794
  };
2795
+ async function copyMissingFiles(src, dest) {
2796
+ const { existsSync: existsSync2, mkdir: mkdir2, writeFile: writeFile2, readdir: readdir2 } = await import("fs/promises");
2797
+ const { join: join2 } = await import("path");
2798
+ if (!existsSync2(src))
2799
+ return [];
2800
+ await mkdir2(dest, { recursive: true });
2801
+ const copied = [];
2802
+ const entries = await readdir2(src, { withFileTypes: true });
2803
+ for (const entry of entries) {
2804
+ const srcPath = join2(src, entry.name);
2805
+ const destPath = join2(dest, entry.name);
2806
+ if (entry.isDirectory()) {
2807
+ const subCopied = await copyMissingFiles(srcPath, destPath);
2808
+ if (subCopied.length > 0) {
2809
+ copied.push(entry.name);
2810
+ }
2811
+ } else if (!existsSync2(destPath)) {
2812
+ await writeFile2(destPath, await readFile(srcPath));
2813
+ copied.push(entry.name);
2814
+ }
2815
+ }
2816
+ return copied;
2817
+ }
2818
+ async function handleManifoldInit(api) {
2819
+ const directory = api.state.path.directory;
2820
+ const globalTemplatesDir = join(homedir(), ".config", "opencode", "manifold");
2821
+ if (!existsSync(globalTemplatesDir)) {
2822
+ api.ui.toast({
2823
+ variant: "error",
2824
+ message: "Global templates not found. Plugin may not be installed correctly."
2825
+ });
2826
+ return;
2827
+ }
2828
+ const agentsDir = join(directory, ".opencode", "agents");
2829
+ const skillsDir = join(directory, ".opencode", "skills");
2830
+ const manifoldDir = join(directory, "Manifold");
2831
+ await mkdir(agentsDir, { recursive: true });
2832
+ await mkdir(skillsDir, { recursive: true });
2833
+ await mkdir(manifoldDir, { recursive: true });
2834
+ const agentsCopied = await copyMissingFiles(join(globalTemplatesDir, "agents"), agentsDir);
2835
+ const skillsCopied = await copyMissingFiles(join(globalTemplatesDir, "skills"), skillsDir);
2836
+ const manifoldCopied = await copyMissingFiles(join(globalTemplatesDir, "manifold"), manifoldDir);
2837
+ const initialized = [];
2838
+ if (agentsCopied.length > 0) {
2839
+ initialized.push(`agents (${agentsCopied.join(", ")})`);
2840
+ }
2841
+ if (skillsCopied.length > 0) {
2842
+ initialized.push(`skills (${skillsCopied.join(", ")})`);
2843
+ }
2844
+ if (manifoldCopied.length > 0) {
2845
+ initialized.push(`Manifold/ (${manifoldCopied.join(", ")})`);
2846
+ }
2847
+ const message = initialized.length > 0 ? `Manifold initialized: ${initialized.join(", ")}` : "All Manifold files already present.";
2848
+ api.ui.toast({
2849
+ variant: "success",
2850
+ message
2851
+ });
2852
+ }
2784
2853
  async function handleManifoldModels(api) {
2785
2854
  const directory = api.state.path.directory;
2786
2855
  const agents = await getManifoldAgents(directory);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-manifold",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "Multi-agent development system for opencode with persistent knowledge",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",