@kl-c/matrixos 0.1.10 → 0.1.12

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/matrixos.js CHANGED
@@ -20,6 +20,38 @@ const require = createRequire(import.meta.url);
20
20
  * Detect libc family on Linux
21
21
  * @returns {string | null} 'glibc', 'musl', or null if detection fails
22
22
  */
23
+ /**
24
+ * Resolve the bun binary path.
25
+ * Order: BUN_BINARY env → `bun` in PATH → common install locations.
26
+ * Returns the first resolvable path, or "bun" as a last resort (spawnSync
27
+ * will surface a clear "not found" error if it truly is missing).
28
+ */
29
+ function resolveBunBinary() {
30
+ if (process.env.BUN_BINARY) return process.env.BUN_BINARY;
31
+
32
+ try {
33
+ const { execSync } = require("node:child_process");
34
+ const found = execSync("command -v bun", { stdio: ["ignore", "pipe", "ignore"] })
35
+ .toString()
36
+ .trim();
37
+ if (found) return found;
38
+ } catch {
39
+ // not in PATH
40
+ }
41
+
42
+ const home = process.env.HOME || "/root";
43
+ const candidates = [
44
+ join(home, ".bun", "bin", "bun"),
45
+ "/usr/local/bin/bun",
46
+ "/opt/bun/bin/bun",
47
+ ];
48
+ for (const candidate of candidates) {
49
+ if (existsSync(candidate)) return candidate;
50
+ }
51
+
52
+ return "bun";
53
+ }
54
+
23
55
  function getLibcFamily() {
24
56
  if (process.platform !== "linux") {
25
57
  return undefined; // Not needed on non-Linux
@@ -185,7 +217,7 @@ function main() {
185
217
  OMO_INVOCATION_NAME: invocationName,
186
218
  OMO_WRAPPER_PACKAGE_ROOT: wrapperRoot,
187
219
  };
188
- const bunBinary = process.env.BUN_BINARY || "bun";
220
+ const bunBinary = resolveBunBinary();
189
221
  const bunResult = spawnSync(bunBinary, [localCli, ...process.argv.slice(2)], {
190
222
  stdio: "inherit",
191
223
  env: fallbackEnv,
package/dist/cli/index.js CHANGED
@@ -2145,7 +2145,7 @@ var package_default;
2145
2145
  var init_package = __esm(() => {
2146
2146
  package_default = {
2147
2147
  name: "@kl-c/matrixos",
2148
- version: "0.1.10",
2148
+ version: "0.1.12",
2149
2149
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2150
2150
  main: "./dist/index.js",
2151
2151
  types: "dist/index.d.ts",
@@ -2145,7 +2145,7 @@ var package_default;
2145
2145
  var init_package = __esm(() => {
2146
2146
  package_default = {
2147
2147
  name: "@kl-c/matrixos",
2148
- version: "0.1.10",
2148
+ version: "0.1.12",
2149
2149
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2150
2150
  main: "./dist/index.js",
2151
2151
  types: "dist/index.d.ts",
package/dist/index.js CHANGED
@@ -367932,7 +367932,7 @@ function getCachedVersion(options = {}) {
367932
367932
  // package.json
367933
367933
  var package_default = {
367934
367934
  name: "@kl-c/matrixos",
367935
- version: "0.1.10",
367935
+ version: "0.1.12",
367936
367936
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
367937
367937
  main: "./dist/index.js",
367938
367938
  types: "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kl-c/matrixos",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "MaTrixOS — Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/postinstall.mjs CHANGED
@@ -1,16 +1,52 @@
1
1
  // postinstall.mjs
2
2
  // MaTrixOS — simplified postinstall (no platform binary packages)
3
3
 
4
- import { readdirSync, rmSync } from "node:fs";
4
+ import { readdirSync, rmSync, cpSync, mkdirSync, existsSync } from "node:fs";
5
5
  import { createRequire } from "node:module";
6
6
  import { homedir } from "node:os";
7
7
  import { join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+
10
+ const __dirname = fileURLToPath(new URL(".", import.meta.url));
8
11
 
9
12
  const require = createRequire(import.meta.url);
10
13
 
11
14
  const MIN_OPENCODE_VERSION = "1.4.0";
12
15
  const MATRIXOS_PLUGIN_PACKAGES = ["@kl-c/matrixos", "oh-my-opencode", "oh-my-openagent"];
13
16
 
17
+ /**
18
+ * Copy MaTrixOS slash commands to the user-level OpenCode command directory
19
+ * so OpenCode discovers them at startup. OpenCode scans
20
+ * `~/.config/opencode/command/*.md` (user-level) and `.opencode/command/*.md`
21
+ * (project-level), but NOT package internals under node_modules. Without this
22
+ * copy, `/adopt` and `/features` are silently unavailable.
23
+ */
24
+ function installUserCommands() {
25
+ const opencodeConfigDir = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "opencode");
26
+ const targetDir = join(opencodeConfigDir, "command");
27
+
28
+ const commandSources = [
29
+ join(__dirname, ".opencode", "command"),
30
+ join(__dirname, ".agents", "command"),
31
+ ];
32
+
33
+ let copied = 0;
34
+ for (const sourceDir of commandSources) {
35
+ if (!existsSync(sourceDir)) continue;
36
+ mkdirSync(targetDir, { recursive: true });
37
+ for (const entry of readdirSync(sourceDir, { withFileTypes: true })) {
38
+ if (entry.isFile() && entry.name.endsWith(".md")) {
39
+ cpSync(join(sourceDir, entry.name), join(targetDir, entry.name), { force: true });
40
+ copied++;
41
+ }
42
+ }
43
+ }
44
+
45
+ if (copied > 0) {
46
+ console.log(` Installed ${copied} MaTrixOS command(s) to ${targetDir}`);
47
+ }
48
+ }
49
+
14
50
  /**
15
51
  * Parse version string into numeric parts
16
52
  * @param {string} version
@@ -91,6 +127,8 @@ function main() {
91
127
  console.warn(` Please update OpenCode to avoid compatibility issues.`);
92
128
  }
93
129
 
130
+ installUserCommands();
131
+
94
132
  console.log(`\u2713 MaTrixOS installed successfully.`);
95
133
  console.log(` Run 'bunx @kl-c/matrixos install' to set up MaTrixOS.`);
96
134
  }