@kl-c/matrixos 0.3.52 → 0.3.54

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/cli/index.js CHANGED
@@ -2163,7 +2163,7 @@ var package_default;
2163
2163
  var init_package = __esm(() => {
2164
2164
  package_default = {
2165
2165
  name: "@kl-c/matrixos",
2166
- version: "0.3.52",
2166
+ version: "0.3.54",
2167
2167
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2168
2168
  main: "./dist/index.js",
2169
2169
  types: "dist/index.d.ts",
@@ -167093,6 +167093,153 @@ var init_project_memory = __esm(() => {
167093
167093
  init_project_context();
167094
167094
  });
167095
167095
 
167096
+ // packages/omo-opencode/src/cli/project-init.ts
167097
+ var exports_project_init = {};
167098
+ __export(exports_project_init, {
167099
+ projectInit: () => projectInit
167100
+ });
167101
+ import * as fs24 from "fs";
167102
+ import * as path29 from "path";
167103
+ function projectInit(options) {
167104
+ const target = path29.resolve(options.path ?? process.cwd(), options.name);
167105
+ const apply = options.apply ?? false;
167106
+ if (fs24.existsSync(target) && fs24.readdirSync(target).length > 0) {
167107
+ console.error(`[project] target exists and is not empty: ${target}`);
167108
+ return 1;
167109
+ }
167110
+ const files = Object.entries(TEMPLATES).map(([rel, fn]) => ({ rel, content: fn(options.name) }));
167111
+ if (!apply) {
167112
+ console.log(`[dry-run] would create project '${options.name}' at:
167113
+ ${target}
167114
+ `);
167115
+ console.log("Files:");
167116
+ for (const f2 of files) {
167117
+ console.log(` ${f2.rel}`);
167118
+ }
167119
+ console.log(`
167120
+ [dry-run] re-run with --apply to write the files.`);
167121
+ return 0;
167122
+ }
167123
+ fs24.mkdirSync(path29.join(target, "src"), { recursive: true });
167124
+ for (const f2 of files) {
167125
+ const full = path29.join(target, f2.rel);
167126
+ fs24.mkdirSync(path29.dirname(full), { recursive: true });
167127
+ fs24.writeFileSync(full, f2.content);
167128
+ console.log(`[project] wrote ${f2.rel}`);
167129
+ }
167130
+ console.log(`
167131
+ [project] '${options.name}' initialized at ${target}`);
167132
+ console.log(`[project] Next: cd ${target} && matrixos run --agent Architect 'refine the plan.md'`);
167133
+ return 0;
167134
+ }
167135
+ var TEMPLATES;
167136
+ var init_project_init = __esm(() => {
167137
+ TEMPLATES = {
167138
+ "AGENTS.md": (name2) => `# ${name2}
167139
+
167140
+ > Project context for AI agents. Keep this file accurate \u2014 agents read it first.
167141
+
167142
+ ## OVERVIEW
167143
+
167144
+ One-paragraph description of what this project is and who uses it.
167145
+
167146
+ ## CONVENTIONS
167147
+
167148
+ - Code style: TBD
167149
+ - Tests: TBD
167150
+ - Commits: conventional commits
167151
+
167152
+ ## STRUCTURE
167153
+
167154
+ \`\`\`
167155
+ ${name2}/
167156
+ \u251C\u2500\u2500 README.md
167157
+ \u251C\u2500\u2500 PROJECT.md # project state / roadmap
167158
+ \u251C\u2500\u2500 plan.md # current plan
167159
+ \u2514\u2500\u2500 src/
167160
+ \`\`\`
167161
+
167162
+ ## NOTES
167163
+
167164
+ - Link the relevant MaTrixOS Goal/Kanban board for tracking.
167165
+ `,
167166
+ "README.md": (name2) => `# ${name2}
167167
+
167168
+ ## Install
167169
+
167170
+ \`\`\`bash
167171
+ # add your install steps
167172
+ \`\`\`
167173
+
167174
+ ## Usage
167175
+
167176
+ \`\`\`bash
167177
+ # add your usage steps
167178
+ \`\`\`
167179
+
167180
+ ## Development
167181
+
167182
+ See AGENTS.md for agent context.
167183
+ `,
167184
+ ".gitignore": () => `# Dependencies
167185
+ node_modules/
167186
+ .venv/
167187
+ __pycache__/
167188
+
167189
+ # Build
167190
+ /dist/
167191
+ build/
167192
+
167193
+ # Env / secrets
167194
+ .env
167195
+ .env.local
167196
+ *.secret
167197
+
167198
+ # OS
167199
+ .DS_Store
167200
+
167201
+ # MaTrixOS
167202
+ .omo/
167203
+ `,
167204
+ "PROJECT.md": (name2) => `# ${name2} \u2014 Project State
167205
+
167206
+ ## STATUS
167207
+
167208
+ | Item | State |
167209
+ |------|-------|
167210
+ | Scope | defined / wip / done |
167211
+ | Health | green / yellow / red |
167212
+
167213
+ ## ROADMAP
167214
+
167215
+ - [ ] Milestone 1
167216
+ - [ ] Milestone 2
167217
+
167218
+ ## LINKS
167219
+
167220
+ - MaTrixOS Goal: (create via dashboard)
167221
+ - Kanban: (link board)
167222
+ `,
167223
+ "plan.md": () => `# Plan
167224
+
167225
+ ## Goal
167226
+
167227
+ What are we trying to achieve?
167228
+
167229
+ ## Steps
167230
+
167231
+ 1.
167232
+ 2.
167233
+ 3.
167234
+
167235
+ ## Open Questions
167236
+
167237
+ -
167238
+ `,
167239
+ "src/.gitkeep": () => ""
167240
+ };
167241
+ });
167242
+
167096
167243
  // packages/omo-opencode/src/cli/adopt.ts
167097
167244
  var exports_adopt = {};
167098
167245
  __export(exports_adopt, {
@@ -167103,7 +167250,7 @@ import { chmod } from "fs/promises";
167103
167250
  import { createInterface as createInterface4 } from "readline";
167104
167251
  async function askMasked(prompt) {
167105
167252
  const rl = createInterface4({ input: process.stdin, output: process.stdout });
167106
- const answer = await new Promise((resolve20) => {
167253
+ const answer = await new Promise((resolve21) => {
167107
167254
  process.stdout.write(prompt);
167108
167255
  process.stdin.setRawMode?.(true);
167109
167256
  process.stdin.resume();
@@ -167118,7 +167265,7 @@ async function askMasked(prompt) {
167118
167265
  process.stdout.write(`
167119
167266
  `);
167120
167267
  rl.close();
167121
- resolve20(value);
167268
+ resolve21(value);
167122
167269
  return;
167123
167270
  } else if (ch === "\x03") {
167124
167271
  process.exit(130);
@@ -167140,10 +167287,10 @@ async function askMasked(prompt) {
167140
167287
  async function ask(question, defaultValue) {
167141
167288
  const rl = createInterface4({ input: process.stdin, output: process.stdout });
167142
167289
  const d = defaultValue ? ` (${defaultValue})` : "";
167143
- const answer = await new Promise((resolve20) => {
167290
+ const answer = await new Promise((resolve21) => {
167144
167291
  rl.question(`${question}${d}: `, (a2) => {
167145
167292
  rl.close();
167146
- resolve20(a2);
167293
+ resolve21(a2);
167147
167294
  });
167148
167295
  });
167149
167296
  return answer.trim() || defaultValue || "";
@@ -167246,7 +167393,7 @@ function isValidType(type2) {
167246
167393
  return VALID_TYPES.includes(type2);
167247
167394
  }
167248
167395
  async function readMaskedToken(prompt) {
167249
- return new Promise((resolve20, reject) => {
167396
+ return new Promise((resolve21, reject) => {
167250
167397
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
167251
167398
  reject(new Error("Interactive mode requires a TTY. Use --token <value> instead."));
167252
167399
  return;
@@ -167266,7 +167413,7 @@ async function readMaskedToken(prompt) {
167266
167413
  process.stdin.setRawMode(false);
167267
167414
  process.stdin.pause();
167268
167415
  process.stdin.off("data", onData);
167269
- resolve20(token);
167416
+ resolve21(token);
167270
167417
  return;
167271
167418
  }
167272
167419
  if (code === 127 || code === 8) {
@@ -167343,8 +167490,8 @@ var exports_skill_create = {};
167343
167490
  __export(exports_skill_create, {
167344
167491
  executeSkillCreateCommand: () => executeSkillCreateCommand
167345
167492
  });
167346
- import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync29, existsSync as existsSync78 } from "fs";
167347
- import { join as join85 } from "path";
167493
+ import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync30, existsSync as existsSync79 } from "fs";
167494
+ import { join as join86 } from "path";
167348
167495
  function slugify2(input) {
167349
167496
  return input.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
167350
167497
  }
@@ -167401,13 +167548,13 @@ function executeSkillCreateCommand(options) {
167401
167548
  if (options.targetDir) {
167402
167549
  skillDir = options.targetDir;
167403
167550
  } else if (options.scope === "project") {
167404
- skillDir = join85(process.cwd(), ".opencode", "skills");
167551
+ skillDir = join86(process.cwd(), ".opencode", "skills");
167405
167552
  } else {
167406
167553
  const dirs = getOpenCodeSkillDirs({ binary: "opencode" });
167407
- skillDir = dirs[0] ?? join85(getHomeDirectory(), ".config", "opencode", "skills");
167554
+ skillDir = dirs[0] ?? join86(getHomeDirectory(), ".config", "opencode", "skills");
167408
167555
  }
167409
- const skillPath = join85(skillDir, slug);
167410
- const skillFile = join85(skillPath, "SKILL.md");
167556
+ const skillPath = join86(skillDir, slug);
167557
+ const skillFile = join86(skillPath, "SKILL.md");
167411
167558
  const content = buildSkillMarkdown(options.name.trim(), description, category2);
167412
167559
  const result = {
167413
167560
  ok: true,
@@ -167421,9 +167568,9 @@ function executeSkillCreateCommand(options) {
167421
167568
  return result;
167422
167569
  }
167423
167570
  try {
167424
- if (!existsSync78(skillPath))
167425
- mkdirSync30(skillPath, { recursive: true });
167426
- writeFileSync29(skillFile, content, "utf-8");
167571
+ if (!existsSync79(skillPath))
167572
+ mkdirSync31(skillPath, { recursive: true });
167573
+ writeFileSync30(skillFile, content, "utf-8");
167427
167574
  result.applied = true;
167428
167575
  } catch (e) {
167429
167576
  result.ok = false;
@@ -167451,13 +167598,13 @@ function isTelegramAdoptCommand(env5) {
167451
167598
  }
167452
167599
  async function runCliCommand(args, replyMsg) {
167453
167600
  const started = Date.now();
167454
- return new Promise((resolve20) => {
167601
+ return new Promise((resolve21) => {
167455
167602
  let settled = false;
167456
167603
  const finish = (result) => {
167457
167604
  if (settled)
167458
167605
  return;
167459
167606
  settled = true;
167460
- resolve20({ ...result, durationMs: Date.now() - started });
167607
+ resolve21({ ...result, durationMs: Date.now() - started });
167461
167608
  };
167462
167609
  let child;
167463
167610
  try {
@@ -167483,7 +167630,7 @@ async function handleGatewayMessage(env5, opts = {}) {
167483
167630
  const cwd = opts.cwd ?? process.cwd();
167484
167631
  const timeoutMs = opts.timeoutMs ?? 120000;
167485
167632
  const started = Date.now();
167486
- return new Promise((resolve20) => {
167633
+ return new Promise((resolve21) => {
167487
167634
  let stdout2 = "";
167488
167635
  let stderr = "";
167489
167636
  let settled = false;
@@ -167491,7 +167638,7 @@ async function handleGatewayMessage(env5, opts = {}) {
167491
167638
  if (settled)
167492
167639
  return;
167493
167640
  settled = true;
167494
- resolve20({ ...result, durationMs: Date.now() - started });
167641
+ resolve21({ ...result, durationMs: Date.now() - started });
167495
167642
  };
167496
167643
  let child;
167497
167644
  try {
@@ -167571,8 +167718,8 @@ __export(exports_gateway_start, {
167571
167718
  buildTelegramConfig: () => buildTelegramConfig,
167572
167719
  buildGatewayConfig: () => buildGatewayConfig
167573
167720
  });
167574
- import { readFileSync as readFileSync64, existsSync as existsSync79 } from "fs";
167575
- import { resolve as resolve20 } from "path";
167721
+ import { readFileSync as readFileSync64, existsSync as existsSync80 } from "fs";
167722
+ import { resolve as resolve21 } from "path";
167576
167723
  import { execSync as execSync2 } from "child_process";
167577
167724
  function resolveMatrixosCommand(fallback = "matrixos") {
167578
167725
  try {
@@ -167582,10 +167729,10 @@ function resolveMatrixosCommand(fallback = "matrixos") {
167582
167729
  } catch {}
167583
167730
  return fallback;
167584
167731
  }
167585
- function loadGatewayEnv(path29 = ENV_PATH) {
167586
- if (!existsSync79(path29))
167732
+ function loadGatewayEnv(path30 = ENV_PATH) {
167733
+ if (!existsSync80(path30))
167587
167734
  return {};
167588
- const text = readFileSync64(path29, "utf8");
167735
+ const text = readFileSync64(path30, "utf8");
167589
167736
  const out = {};
167590
167737
  for (const raw of text.split(/\r?\n/)) {
167591
167738
  const line = raw.trim();
@@ -167712,7 +167859,7 @@ var ENV_PATH, DEFAULT_MATRIXOS_COMMAND;
167712
167859
  var init_gateway_start = __esm(() => {
167713
167860
  init_src4();
167714
167861
  init_gateway_handler();
167715
- ENV_PATH = resolve20(process.cwd(), ".klc-gateway.env");
167862
+ ENV_PATH = resolve21(process.cwd(), ".klc-gateway.env");
167716
167863
  DEFAULT_MATRIXOS_COMMAND = resolveMatrixosCommand();
167717
167864
  });
167718
167865
 
@@ -167733,19 +167880,19 @@ var init_deployment_core = __esm(() => {
167733
167880
 
167734
167881
  // packages/omo-opencode/src/deployment/deploy-static.ts
167735
167882
  import { spawn as spawn6 } from "child_process";
167736
- import { existsSync as existsSync80 } from "fs";
167737
- import { resolve as resolve21 } from "path";
167883
+ import { existsSync as existsSync81 } from "fs";
167884
+ import { resolve as resolve22 } from "path";
167738
167885
  function pushStage(stage, message, ok = true) {
167739
167886
  return { stage, message, ok };
167740
167887
  }
167741
167888
  function run2(cmd, args, cwd) {
167742
- return new Promise((resolve22) => {
167889
+ return new Promise((resolve23) => {
167743
167890
  let output = "";
167744
167891
  let error51 = "";
167745
167892
  const child = spawn6(cmd, args, { cwd, shell: false });
167746
167893
  child.stdout.on("data", (d) => output += d.toString());
167747
167894
  child.stderr.on("data", (d) => error51 += d.toString());
167748
- child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
167895
+ child.on("close", (code) => resolve23({ ok: code === 0, output, error: error51 }));
167749
167896
  });
167750
167897
  }
167751
167898
  var deployStatic;
@@ -167754,7 +167901,7 @@ var init_deploy_static = __esm(() => {
167754
167901
  name: "static",
167755
167902
  async deploy(ctx, params) {
167756
167903
  const stages = [];
167757
- const buildDir = resolve21(ctx.projectRoot, params.buildDir ?? "dist");
167904
+ const buildDir = resolve22(ctx.projectRoot, params.buildDir ?? "dist");
167758
167905
  const destination = params.destination;
167759
167906
  const prebuild = params.prebuild ?? "bun run build";
167760
167907
  try {
@@ -167790,7 +167937,7 @@ var init_deploy_static = __esm(() => {
167790
167937
  }
167791
167938
  stages.push(pushStage("build", "build succeeded"));
167792
167939
  }
167793
- if (!existsSync80(buildDir)) {
167940
+ if (!existsSync81(buildDir)) {
167794
167941
  stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
167795
167942
  return { target: "static", ok: false, stages, error: "build directory missing" };
167796
167943
  }
@@ -167827,13 +167974,13 @@ function pushStage2(stage, message, ok = true) {
167827
167974
  return { stage, message, ok };
167828
167975
  }
167829
167976
  function run3(cmd, args, cwd, env5) {
167830
- return new Promise((resolve22) => {
167977
+ return new Promise((resolve23) => {
167831
167978
  let output = "";
167832
167979
  let error51 = "";
167833
167980
  const child = spawn7(cmd, args, { cwd, env: { ...process.env, ...env5 }, shell: false });
167834
167981
  child.stdout.on("data", (d) => output += d.toString());
167835
167982
  child.stderr.on("data", (d) => error51 += d.toString());
167836
- child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
167983
+ child.on("close", (code) => resolve23({ ok: code === 0, output, error: error51 }));
167837
167984
  });
167838
167985
  }
167839
167986
  var deployVercel;
@@ -167899,13 +168046,13 @@ function pushStage3(stage, message, ok = true) {
167899
168046
  return { stage, message, ok };
167900
168047
  }
167901
168048
  function run4(cmd, args, cwd, env5) {
167902
- return new Promise((resolve22) => {
168049
+ return new Promise((resolve23) => {
167903
168050
  let output = "";
167904
168051
  let error51 = "";
167905
168052
  const child = spawn8(cmd, args, { cwd, env: { ...process.env, ...env5 }, shell: false });
167906
168053
  child.stdout.on("data", (d) => output += d.toString());
167907
168054
  child.stderr.on("data", (d) => error51 += d.toString());
167908
- child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
168055
+ child.on("close", (code) => resolve23({ ok: code === 0, output, error: error51 }));
167909
168056
  });
167910
168057
  }
167911
168058
  var deployVps;
@@ -167987,7 +168134,7 @@ var init_deploy_vps = __esm(() => {
167987
168134
  });
167988
168135
 
167989
168136
  // packages/omo-opencode/src/deployment/deploy-cli.ts
167990
- import { resolve as resolve22 } from "path";
168137
+ import { resolve as resolve23 } from "path";
167991
168138
  async function runDeploy(options) {
167992
168139
  const target = getTarget(options.target);
167993
168140
  if (!target) {
@@ -168000,7 +168147,7 @@ async function runDeploy(options) {
168000
168147
  console.error("No active project. Run `matrixos project switch <slug>` or pass --project-root.");
168001
168148
  return 1;
168002
168149
  }
168003
- const projectRoot = resolve22(options.projectRoot ?? getProjectDir(project.slug));
168150
+ const projectRoot = resolve23(options.projectRoot ?? getProjectDir(project.slug));
168004
168151
  const ctx = {
168005
168152
  projectRoot,
168006
168153
  projectSlug: project?.slug,
@@ -168066,10 +168213,10 @@ var init_deployment = __esm(() => {
168066
168213
  });
168067
168214
 
168068
168215
  // packages/omo-opencode/src/audit/self-audit.ts
168069
- import { existsSync as existsSync81, mkdirSync as mkdirSync31, readdirSync as readdirSync18, readFileSync as readFileSync65, writeFileSync as writeFileSync30 } from "fs";
168070
- import { join as join86 } from "path";
168216
+ import { existsSync as existsSync82, mkdirSync as mkdirSync32, readdirSync as readdirSync19, readFileSync as readFileSync65, writeFileSync as writeFileSync31 } from "fs";
168217
+ import { join as join87 } from "path";
168071
168218
  function getAuditDir(cwd = process.cwd()) {
168072
- return join86(cwd, ".matrixos", "audits");
168219
+ return join87(cwd, ".matrixos", "audits");
168073
168220
  }
168074
168221
  function getWeekString(date5 = new Date) {
168075
168222
  const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
@@ -168176,10 +168323,10 @@ function formatAuditReport(report) {
168176
168323
  }
168177
168324
  function writeAuditReport(report, cwd) {
168178
168325
  const dir = getAuditDir(cwd);
168179
- mkdirSync31(dir, { recursive: true });
168180
- const path29 = join86(dir, `${report.week}.md`);
168181
- writeFileSync30(path29, formatAuditReport(report), "utf-8");
168182
- return path29;
168326
+ mkdirSync32(dir, { recursive: true });
168327
+ const path30 = join87(dir, `${report.week}.md`);
168328
+ writeFileSync31(path30, formatAuditReport(report), "utf-8");
168329
+ return path30;
168183
168330
  }
168184
168331
  var init_self_audit = () => {};
168185
168332
 
@@ -168224,8 +168371,8 @@ async function executeSelfAuditCommand(options = {}) {
168224
168371
  project: t2.project || t2.context?.project || undefined,
168225
168372
  errorCount: t2.error_count || t2.errorCount || 0
168226
168373
  })), signals, options.week);
168227
- const path29 = writeAuditReport(report);
168228
- return { ok: true, path: path29, message: `Self-audit written to ${path29}`, report };
168374
+ const path30 = writeAuditReport(report);
168375
+ return { ok: true, path: path30, message: `Self-audit written to ${path30}`, report };
168229
168376
  }
168230
168377
  function normalizeStatus(status2) {
168231
168378
  if (!status2)
@@ -168486,8 +168633,8 @@ __export(exports_service, {
168486
168633
  serviceInstallCommand: () => serviceInstallCommand
168487
168634
  });
168488
168635
  import * as os15 from "os";
168489
- import * as fs24 from "fs";
168490
- import * as path29 from "path";
168636
+ import * as fs25 from "fs";
168637
+ import * as path30 from "path";
168491
168638
  import { execSync as execSync4 } from "child_process";
168492
168639
  function resolveMatrixosBin2() {
168493
168640
  try {
@@ -168495,8 +168642,8 @@ function resolveMatrixosBin2() {
168495
168642
  if (p2)
168496
168643
  return p2;
168497
168644
  } catch {}
168498
- for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path29.join(os15.homedir(), ".bun/bin/matrixos")]) {
168499
- if (fs24.existsSync(cand))
168645
+ for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path30.join(os15.homedir(), ".bun/bin/matrixos")]) {
168646
+ if (fs25.existsSync(cand))
168500
168647
  return cand;
168501
168648
  }
168502
168649
  return "matrixos";
@@ -168510,16 +168657,16 @@ function resolveBunBin() {
168510
168657
  return "/usr/bin/bun";
168511
168658
  }
168512
168659
  function writeFileEnsureDir(filePath, content) {
168513
- fs24.mkdirSync(path29.dirname(filePath), { recursive: true });
168514
- fs24.writeFileSync(filePath, content, "utf-8");
168660
+ fs25.mkdirSync(path30.dirname(filePath), { recursive: true });
168661
+ fs25.writeFileSync(filePath, content, "utf-8");
168515
168662
  console.log(`[service] written: ${filePath}`);
168516
168663
  }
168517
168664
  function installSystemd(opts) {
168518
168665
  const bin = resolveMatrixosBin2();
168519
168666
  const bun = resolveBunBin();
168520
168667
  const scope = opts.user ? "--user" : "";
168521
- const unitDir = opts.user ? path29.join(os15.homedir(), ".config", "systemd", "user") : "/etc/systemd/system";
168522
- const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
168668
+ const unitDir = opts.user ? path30.join(os15.homedir(), ".config", "systemd", "user") : "/etc/systemd/system";
168669
+ const envPath = `/usr/local/bin:/usr/bin:/bin:${path30.dirname(bun)}`;
168523
168670
  if (opts.dashboard !== false) {
168524
168671
  const unit = `[Unit]
168525
168672
  Description=MaTrixOS Dashboard
@@ -168538,7 +168685,7 @@ RestartSec=5
168538
168685
  [Install]
168539
168686
  WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168540
168687
  `;
168541
- writeFileEnsureDir(path29.join(unitDir, "matrixos-dashboard.service"), unit);
168688
+ writeFileEnsureDir(path30.join(unitDir, "matrixos-dashboard.service"), unit);
168542
168689
  }
168543
168690
  if (opts.gateway !== false) {
168544
168691
  const unit = `[Unit]
@@ -168558,7 +168705,7 @@ RestartSec=5
168558
168705
  [Install]
168559
168706
  WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168560
168707
  `;
168561
- writeFileEnsureDir(path29.join(unitDir, "matrixos-gateway.service"), unit);
168708
+ writeFileEnsureDir(path30.join(unitDir, "matrixos-gateway.service"), unit);
168562
168709
  }
168563
168710
  if (opts.cron !== false) {
168564
168711
  const unit = `[Unit]
@@ -168578,7 +168725,7 @@ RestartSec=5
168578
168725
  [Install]
168579
168726
  WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168580
168727
  `;
168581
- writeFileEnsureDir(path29.join(unitDir, "matrixos-cron.service"), unit);
168728
+ writeFileEnsureDir(path30.join(unitDir, "matrixos-cron.service"), unit);
168582
168729
  }
168583
168730
  console.log("[service] reloading systemd...");
168584
168731
  if (scope) {
@@ -168615,8 +168762,8 @@ WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168615
168762
  function installLaunchd(opts) {
168616
168763
  const bin = resolveMatrixosBin2();
168617
168764
  const bun = resolveBunBin();
168618
- const launchDir = path29.join(os15.homedir(), "Library", "LaunchAgents");
168619
- const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
168765
+ const launchDir = path30.join(os15.homedir(), "Library", "LaunchAgents");
168766
+ const envPath = `/usr/local/bin:/usr/bin:/bin:${path30.dirname(bun)}`;
168620
168767
  if (opts.dashboard !== false) {
168621
168768
  const label = "com.klc.matrixos.dashboard";
168622
168769
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
@@ -168653,8 +168800,8 @@ function installLaunchd(opts) {
168653
168800
  </dict>
168654
168801
  </plist>
168655
168802
  `;
168656
- writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
168657
- execSync4(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168803
+ writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
168804
+ execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168658
168805
  }
168659
168806
  if (opts.gateway !== false) {
168660
168807
  const label = "com.klc.matrixos.gateway";
@@ -168692,8 +168839,8 @@ function installLaunchd(opts) {
168692
168839
  </dict>
168693
168840
  </plist>
168694
168841
  `;
168695
- writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
168696
- execSync4(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168842
+ writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
168843
+ execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168697
168844
  }
168698
168845
  console.log("[service] launchd agents installed and loaded.");
168699
168846
  }
@@ -168707,7 +168854,7 @@ async function serviceInstallCommand(options) {
168707
168854
  const platform2 = process.platform;
168708
168855
  console.log(`[service] detected platform: ${platform2}`);
168709
168856
  if (platform2 === "linux") {
168710
- if (!fs24.existsSync("/run/systemd/system") && !fs24.existsSync("/etc/systemd/system")) {
168857
+ if (!fs25.existsSync("/run/systemd/system") && !fs25.existsSync("/etc/systemd/system")) {
168711
168858
  console.error("[service] systemd not detected \u2014 cannot install service automatically.");
168712
168859
  console.error(" Start manually: matrixos dashboard --host 0.0.0.0 --daemon");
168713
168860
  return 1;
@@ -190165,6 +190312,20 @@ project.command("add-doc <slug> <file>").description("Copy a document into the p
190165
190312
  process.stdout.write(JSON.stringify({ ok: true, dest }, null, 2) + `
190166
190313
  `);
190167
190314
  });
190315
+ project.command("init <name>").description("Scaffold a generic project skeleton (AGENTS.md, README, .gitignore, PROJECT.md, plan.md)").option("-p, --path <dir>", "Target directory (default: cwd)").option("--apply", "Actually write the files (default dry-run)").option("--json", "Output as JSON").addHelpText("after", `
190316
+ Examples:
190317
+ $ matrixos project init my-app # dry-run
190318
+ $ matrixos project init my-app --apply # write files
190319
+ `).action(async (name2, options) => {
190320
+ const { projectInit: projectInit2 } = await Promise.resolve().then(() => (init_project_init(), exports_project_init));
190321
+ const code = projectInit2({
190322
+ name: name2,
190323
+ path: options.path,
190324
+ apply: options.apply ?? false,
190325
+ json: options.json ?? false
190326
+ });
190327
+ process.exit(code);
190328
+ });
190168
190329
  var gateway2 = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
190169
190330
  var gatewayAdopt = gateway2.command("adopt").description("Adopt a gateway channel (Telegram, Discord, WhatsApp)");
190170
190331
  var gatewayAdoptTelegram = gatewayAdopt.command("telegram").description("Set up the Telegram gateway: prompt for bot token, validate, write .klc-gateway.env").option("-t, --token <value>", "Bot token (non-interactive)").option("-c, --chat <id>", "Restrict to a single chat id").addHelpText("after", `
@@ -0,0 +1,7 @@
1
+ export interface ProjectInitOptions {
2
+ name: string;
3
+ path?: string;
4
+ apply?: boolean;
5
+ json?: boolean;
6
+ }
7
+ export declare function projectInit(options: ProjectInitOptions): number;
@@ -2163,7 +2163,7 @@ var package_default;
2163
2163
  var init_package = __esm(() => {
2164
2164
  package_default = {
2165
2165
  name: "@kl-c/matrixos",
2166
- version: "0.3.52",
2166
+ version: "0.3.54",
2167
2167
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
2168
2168
  main: "./dist/index.js",
2169
2169
  types: "dist/index.d.ts",
@@ -167148,6 +167148,153 @@ var init_project_memory = __esm(() => {
167148
167148
  init_project_context();
167149
167149
  });
167150
167150
 
167151
+ // packages/omo-opencode/src/cli/project-init.ts
167152
+ var exports_project_init = {};
167153
+ __export(exports_project_init, {
167154
+ projectInit: () => projectInit
167155
+ });
167156
+ import * as fs24 from "fs";
167157
+ import * as path29 from "path";
167158
+ function projectInit(options) {
167159
+ const target = path29.resolve(options.path ?? process.cwd(), options.name);
167160
+ const apply = options.apply ?? false;
167161
+ if (fs24.existsSync(target) && fs24.readdirSync(target).length > 0) {
167162
+ console.error(`[project] target exists and is not empty: ${target}`);
167163
+ return 1;
167164
+ }
167165
+ const files = Object.entries(TEMPLATES).map(([rel, fn]) => ({ rel, content: fn(options.name) }));
167166
+ if (!apply) {
167167
+ console.log(`[dry-run] would create project '${options.name}' at:
167168
+ ${target}
167169
+ `);
167170
+ console.log("Files:");
167171
+ for (const f2 of files) {
167172
+ console.log(` ${f2.rel}`);
167173
+ }
167174
+ console.log(`
167175
+ [dry-run] re-run with --apply to write the files.`);
167176
+ return 0;
167177
+ }
167178
+ fs24.mkdirSync(path29.join(target, "src"), { recursive: true });
167179
+ for (const f2 of files) {
167180
+ const full = path29.join(target, f2.rel);
167181
+ fs24.mkdirSync(path29.dirname(full), { recursive: true });
167182
+ fs24.writeFileSync(full, f2.content);
167183
+ console.log(`[project] wrote ${f2.rel}`);
167184
+ }
167185
+ console.log(`
167186
+ [project] '${options.name}' initialized at ${target}`);
167187
+ console.log(`[project] Next: cd ${target} && matrixos run --agent Architect 'refine the plan.md'`);
167188
+ return 0;
167189
+ }
167190
+ var TEMPLATES;
167191
+ var init_project_init = __esm(() => {
167192
+ TEMPLATES = {
167193
+ "AGENTS.md": (name2) => `# ${name2}
167194
+
167195
+ > Project context for AI agents. Keep this file accurate \u2014 agents read it first.
167196
+
167197
+ ## OVERVIEW
167198
+
167199
+ One-paragraph description of what this project is and who uses it.
167200
+
167201
+ ## CONVENTIONS
167202
+
167203
+ - Code style: TBD
167204
+ - Tests: TBD
167205
+ - Commits: conventional commits
167206
+
167207
+ ## STRUCTURE
167208
+
167209
+ \`\`\`
167210
+ ${name2}/
167211
+ \u251C\u2500\u2500 README.md
167212
+ \u251C\u2500\u2500 PROJECT.md # project state / roadmap
167213
+ \u251C\u2500\u2500 plan.md # current plan
167214
+ \u2514\u2500\u2500 src/
167215
+ \`\`\`
167216
+
167217
+ ## NOTES
167218
+
167219
+ - Link the relevant MaTrixOS Goal/Kanban board for tracking.
167220
+ `,
167221
+ "README.md": (name2) => `# ${name2}
167222
+
167223
+ ## Install
167224
+
167225
+ \`\`\`bash
167226
+ # add your install steps
167227
+ \`\`\`
167228
+
167229
+ ## Usage
167230
+
167231
+ \`\`\`bash
167232
+ # add your usage steps
167233
+ \`\`\`
167234
+
167235
+ ## Development
167236
+
167237
+ See AGENTS.md for agent context.
167238
+ `,
167239
+ ".gitignore": () => `# Dependencies
167240
+ node_modules/
167241
+ .venv/
167242
+ __pycache__/
167243
+
167244
+ # Build
167245
+ /dist/
167246
+ build/
167247
+
167248
+ # Env / secrets
167249
+ .env
167250
+ .env.local
167251
+ *.secret
167252
+
167253
+ # OS
167254
+ .DS_Store
167255
+
167256
+ # MaTrixOS
167257
+ .omo/
167258
+ `,
167259
+ "PROJECT.md": (name2) => `# ${name2} \u2014 Project State
167260
+
167261
+ ## STATUS
167262
+
167263
+ | Item | State |
167264
+ |------|-------|
167265
+ | Scope | defined / wip / done |
167266
+ | Health | green / yellow / red |
167267
+
167268
+ ## ROADMAP
167269
+
167270
+ - [ ] Milestone 1
167271
+ - [ ] Milestone 2
167272
+
167273
+ ## LINKS
167274
+
167275
+ - MaTrixOS Goal: (create via dashboard)
167276
+ - Kanban: (link board)
167277
+ `,
167278
+ "plan.md": () => `# Plan
167279
+
167280
+ ## Goal
167281
+
167282
+ What are we trying to achieve?
167283
+
167284
+ ## Steps
167285
+
167286
+ 1.
167287
+ 2.
167288
+ 3.
167289
+
167290
+ ## Open Questions
167291
+
167292
+ -
167293
+ `,
167294
+ "src/.gitkeep": () => ""
167295
+ };
167296
+ });
167297
+
167151
167298
  // packages/omo-opencode/src/cli/adopt.ts
167152
167299
  var exports_adopt = {};
167153
167300
  __export(exports_adopt, {
@@ -167158,7 +167305,7 @@ import { chmod } from "fs/promises";
167158
167305
  import { createInterface as createInterface4 } from "readline";
167159
167306
  async function askMasked(prompt) {
167160
167307
  const rl = createInterface4({ input: process.stdin, output: process.stdout });
167161
- const answer = await new Promise((resolve20) => {
167308
+ const answer = await new Promise((resolve21) => {
167162
167309
  process.stdout.write(prompt);
167163
167310
  process.stdin.setRawMode?.(true);
167164
167311
  process.stdin.resume();
@@ -167173,7 +167320,7 @@ async function askMasked(prompt) {
167173
167320
  process.stdout.write(`
167174
167321
  `);
167175
167322
  rl.close();
167176
- resolve20(value);
167323
+ resolve21(value);
167177
167324
  return;
167178
167325
  } else if (ch === "\x03") {
167179
167326
  process.exit(130);
@@ -167195,10 +167342,10 @@ async function askMasked(prompt) {
167195
167342
  async function ask(question, defaultValue) {
167196
167343
  const rl = createInterface4({ input: process.stdin, output: process.stdout });
167197
167344
  const d = defaultValue ? ` (${defaultValue})` : "";
167198
- const answer = await new Promise((resolve20) => {
167345
+ const answer = await new Promise((resolve21) => {
167199
167346
  rl.question(`${question}${d}: `, (a2) => {
167200
167347
  rl.close();
167201
- resolve20(a2);
167348
+ resolve21(a2);
167202
167349
  });
167203
167350
  });
167204
167351
  return answer.trim() || defaultValue || "";
@@ -167301,7 +167448,7 @@ function isValidType(type2) {
167301
167448
  return VALID_TYPES.includes(type2);
167302
167449
  }
167303
167450
  async function readMaskedToken(prompt) {
167304
- return new Promise((resolve20, reject) => {
167451
+ return new Promise((resolve21, reject) => {
167305
167452
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
167306
167453
  reject(new Error("Interactive mode requires a TTY. Use --token <value> instead."));
167307
167454
  return;
@@ -167321,7 +167468,7 @@ async function readMaskedToken(prompt) {
167321
167468
  process.stdin.setRawMode(false);
167322
167469
  process.stdin.pause();
167323
167470
  process.stdin.off("data", onData);
167324
- resolve20(token);
167471
+ resolve21(token);
167325
167472
  return;
167326
167473
  }
167327
167474
  if (code === 127 || code === 8) {
@@ -167398,8 +167545,8 @@ var exports_skill_create = {};
167398
167545
  __export(exports_skill_create, {
167399
167546
  executeSkillCreateCommand: () => executeSkillCreateCommand
167400
167547
  });
167401
- import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync29, existsSync as existsSync78 } from "fs";
167402
- import { join as join85 } from "path";
167548
+ import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync30, existsSync as existsSync79 } from "fs";
167549
+ import { join as join86 } from "path";
167403
167550
  function slugify2(input) {
167404
167551
  return input.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
167405
167552
  }
@@ -167456,13 +167603,13 @@ function executeSkillCreateCommand(options) {
167456
167603
  if (options.targetDir) {
167457
167604
  skillDir = options.targetDir;
167458
167605
  } else if (options.scope === "project") {
167459
- skillDir = join85(process.cwd(), ".opencode", "skills");
167606
+ skillDir = join86(process.cwd(), ".opencode", "skills");
167460
167607
  } else {
167461
167608
  const dirs = getOpenCodeSkillDirs({ binary: "opencode" });
167462
- skillDir = dirs[0] ?? join85(getHomeDirectory(), ".config", "opencode", "skills");
167609
+ skillDir = dirs[0] ?? join86(getHomeDirectory(), ".config", "opencode", "skills");
167463
167610
  }
167464
- const skillPath = join85(skillDir, slug);
167465
- const skillFile = join85(skillPath, "SKILL.md");
167611
+ const skillPath = join86(skillDir, slug);
167612
+ const skillFile = join86(skillPath, "SKILL.md");
167466
167613
  const content = buildSkillMarkdown(options.name.trim(), description, category2);
167467
167614
  const result = {
167468
167615
  ok: true,
@@ -167476,9 +167623,9 @@ function executeSkillCreateCommand(options) {
167476
167623
  return result;
167477
167624
  }
167478
167625
  try {
167479
- if (!existsSync78(skillPath))
167480
- mkdirSync30(skillPath, { recursive: true });
167481
- writeFileSync29(skillFile, content, "utf-8");
167626
+ if (!existsSync79(skillPath))
167627
+ mkdirSync31(skillPath, { recursive: true });
167628
+ writeFileSync30(skillFile, content, "utf-8");
167482
167629
  result.applied = true;
167483
167630
  } catch (e) {
167484
167631
  result.ok = false;
@@ -167506,13 +167653,13 @@ function isTelegramAdoptCommand(env5) {
167506
167653
  }
167507
167654
  async function runCliCommand(args, replyMsg) {
167508
167655
  const started = Date.now();
167509
- return new Promise((resolve20) => {
167656
+ return new Promise((resolve21) => {
167510
167657
  let settled = false;
167511
167658
  const finish = (result) => {
167512
167659
  if (settled)
167513
167660
  return;
167514
167661
  settled = true;
167515
- resolve20({ ...result, durationMs: Date.now() - started });
167662
+ resolve21({ ...result, durationMs: Date.now() - started });
167516
167663
  };
167517
167664
  let child;
167518
167665
  try {
@@ -167538,7 +167685,7 @@ async function handleGatewayMessage(env5, opts = {}) {
167538
167685
  const cwd = opts.cwd ?? process.cwd();
167539
167686
  const timeoutMs = opts.timeoutMs ?? 120000;
167540
167687
  const started = Date.now();
167541
- return new Promise((resolve20) => {
167688
+ return new Promise((resolve21) => {
167542
167689
  let stdout2 = "";
167543
167690
  let stderr = "";
167544
167691
  let settled = false;
@@ -167546,7 +167693,7 @@ async function handleGatewayMessage(env5, opts = {}) {
167546
167693
  if (settled)
167547
167694
  return;
167548
167695
  settled = true;
167549
- resolve20({ ...result, durationMs: Date.now() - started });
167696
+ resolve21({ ...result, durationMs: Date.now() - started });
167550
167697
  };
167551
167698
  let child;
167552
167699
  try {
@@ -167626,8 +167773,8 @@ __export(exports_gateway_start, {
167626
167773
  buildTelegramConfig: () => buildTelegramConfig,
167627
167774
  buildGatewayConfig: () => buildGatewayConfig
167628
167775
  });
167629
- import { readFileSync as readFileSync64, existsSync as existsSync79 } from "fs";
167630
- import { resolve as resolve20 } from "path";
167776
+ import { readFileSync as readFileSync64, existsSync as existsSync80 } from "fs";
167777
+ import { resolve as resolve21 } from "path";
167631
167778
  import { execSync as execSync2 } from "child_process";
167632
167779
  function resolveMatrixosCommand(fallback = "matrixos") {
167633
167780
  try {
@@ -167637,10 +167784,10 @@ function resolveMatrixosCommand(fallback = "matrixos") {
167637
167784
  } catch {}
167638
167785
  return fallback;
167639
167786
  }
167640
- function loadGatewayEnv(path29 = ENV_PATH) {
167641
- if (!existsSync79(path29))
167787
+ function loadGatewayEnv(path30 = ENV_PATH) {
167788
+ if (!existsSync80(path30))
167642
167789
  return {};
167643
- const text = readFileSync64(path29, "utf8");
167790
+ const text = readFileSync64(path30, "utf8");
167644
167791
  const out = {};
167645
167792
  for (const raw of text.split(/\r?\n/)) {
167646
167793
  const line = raw.trim();
@@ -167767,7 +167914,7 @@ var ENV_PATH, DEFAULT_MATRIXOS_COMMAND;
167767
167914
  var init_gateway_start = __esm(() => {
167768
167915
  init_src4();
167769
167916
  init_gateway_handler();
167770
- ENV_PATH = resolve20(process.cwd(), ".klc-gateway.env");
167917
+ ENV_PATH = resolve21(process.cwd(), ".klc-gateway.env");
167771
167918
  DEFAULT_MATRIXOS_COMMAND = resolveMatrixosCommand();
167772
167919
  });
167773
167920
 
@@ -167788,19 +167935,19 @@ var init_deployment_core = __esm(() => {
167788
167935
 
167789
167936
  // packages/omo-opencode/src/deployment/deploy-static.ts
167790
167937
  import { spawn as spawn6 } from "child_process";
167791
- import { existsSync as existsSync80 } from "fs";
167792
- import { resolve as resolve21 } from "path";
167938
+ import { existsSync as existsSync81 } from "fs";
167939
+ import { resolve as resolve22 } from "path";
167793
167940
  function pushStage(stage, message, ok = true) {
167794
167941
  return { stage, message, ok };
167795
167942
  }
167796
167943
  function run2(cmd, args, cwd) {
167797
- return new Promise((resolve22) => {
167944
+ return new Promise((resolve23) => {
167798
167945
  let output = "";
167799
167946
  let error51 = "";
167800
167947
  const child = spawn6(cmd, args, { cwd, shell: false });
167801
167948
  child.stdout.on("data", (d) => output += d.toString());
167802
167949
  child.stderr.on("data", (d) => error51 += d.toString());
167803
- child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
167950
+ child.on("close", (code) => resolve23({ ok: code === 0, output, error: error51 }));
167804
167951
  });
167805
167952
  }
167806
167953
  var deployStatic;
@@ -167809,7 +167956,7 @@ var init_deploy_static = __esm(() => {
167809
167956
  name: "static",
167810
167957
  async deploy(ctx, params) {
167811
167958
  const stages = [];
167812
- const buildDir = resolve21(ctx.projectRoot, params.buildDir ?? "dist");
167959
+ const buildDir = resolve22(ctx.projectRoot, params.buildDir ?? "dist");
167813
167960
  const destination = params.destination;
167814
167961
  const prebuild = params.prebuild ?? "bun run build";
167815
167962
  try {
@@ -167845,7 +167992,7 @@ var init_deploy_static = __esm(() => {
167845
167992
  }
167846
167993
  stages.push(pushStage("build", "build succeeded"));
167847
167994
  }
167848
- if (!existsSync80(buildDir)) {
167995
+ if (!existsSync81(buildDir)) {
167849
167996
  stages.push(pushStage("push", `build directory not found: ${buildDir}`, false));
167850
167997
  return { target: "static", ok: false, stages, error: "build directory missing" };
167851
167998
  }
@@ -167882,13 +168029,13 @@ function pushStage2(stage, message, ok = true) {
167882
168029
  return { stage, message, ok };
167883
168030
  }
167884
168031
  function run3(cmd, args, cwd, env5) {
167885
- return new Promise((resolve22) => {
168032
+ return new Promise((resolve23) => {
167886
168033
  let output = "";
167887
168034
  let error51 = "";
167888
168035
  const child = spawn7(cmd, args, { cwd, env: { ...process.env, ...env5 }, shell: false });
167889
168036
  child.stdout.on("data", (d) => output += d.toString());
167890
168037
  child.stderr.on("data", (d) => error51 += d.toString());
167891
- child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
168038
+ child.on("close", (code) => resolve23({ ok: code === 0, output, error: error51 }));
167892
168039
  });
167893
168040
  }
167894
168041
  var deployVercel;
@@ -167954,13 +168101,13 @@ function pushStage3(stage, message, ok = true) {
167954
168101
  return { stage, message, ok };
167955
168102
  }
167956
168103
  function run4(cmd, args, cwd, env5) {
167957
- return new Promise((resolve22) => {
168104
+ return new Promise((resolve23) => {
167958
168105
  let output = "";
167959
168106
  let error51 = "";
167960
168107
  const child = spawn8(cmd, args, { cwd, env: { ...process.env, ...env5 }, shell: false });
167961
168108
  child.stdout.on("data", (d) => output += d.toString());
167962
168109
  child.stderr.on("data", (d) => error51 += d.toString());
167963
- child.on("close", (code) => resolve22({ ok: code === 0, output, error: error51 }));
168110
+ child.on("close", (code) => resolve23({ ok: code === 0, output, error: error51 }));
167964
168111
  });
167965
168112
  }
167966
168113
  var deployVps;
@@ -168042,7 +168189,7 @@ var init_deploy_vps = __esm(() => {
168042
168189
  });
168043
168190
 
168044
168191
  // packages/omo-opencode/src/deployment/deploy-cli.ts
168045
- import { resolve as resolve22 } from "path";
168192
+ import { resolve as resolve23 } from "path";
168046
168193
  async function runDeploy(options) {
168047
168194
  const target = getTarget(options.target);
168048
168195
  if (!target) {
@@ -168055,7 +168202,7 @@ async function runDeploy(options) {
168055
168202
  console.error("No active project. Run `matrixos project switch <slug>` or pass --project-root.");
168056
168203
  return 1;
168057
168204
  }
168058
- const projectRoot = resolve22(options.projectRoot ?? getProjectDir(project.slug));
168205
+ const projectRoot = resolve23(options.projectRoot ?? getProjectDir(project.slug));
168059
168206
  const ctx = {
168060
168207
  projectRoot,
168061
168208
  projectSlug: project?.slug,
@@ -168121,10 +168268,10 @@ var init_deployment = __esm(() => {
168121
168268
  });
168122
168269
 
168123
168270
  // packages/omo-opencode/src/audit/self-audit.ts
168124
- import { existsSync as existsSync81, mkdirSync as mkdirSync31, readdirSync as readdirSync18, readFileSync as readFileSync65, writeFileSync as writeFileSync30 } from "fs";
168125
- import { join as join86 } from "path";
168271
+ import { existsSync as existsSync82, mkdirSync as mkdirSync32, readdirSync as readdirSync19, readFileSync as readFileSync65, writeFileSync as writeFileSync31 } from "fs";
168272
+ import { join as join87 } from "path";
168126
168273
  function getAuditDir(cwd = process.cwd()) {
168127
- return join86(cwd, ".matrixos", "audits");
168274
+ return join87(cwd, ".matrixos", "audits");
168128
168275
  }
168129
168276
  function getWeekString(date5 = new Date) {
168130
168277
  const d = new Date(Date.UTC(date5.getFullYear(), date5.getMonth(), date5.getDate()));
@@ -168231,10 +168378,10 @@ function formatAuditReport(report) {
168231
168378
  }
168232
168379
  function writeAuditReport(report, cwd) {
168233
168380
  const dir = getAuditDir(cwd);
168234
- mkdirSync31(dir, { recursive: true });
168235
- const path29 = join86(dir, `${report.week}.md`);
168236
- writeFileSync30(path29, formatAuditReport(report), "utf-8");
168237
- return path29;
168381
+ mkdirSync32(dir, { recursive: true });
168382
+ const path30 = join87(dir, `${report.week}.md`);
168383
+ writeFileSync31(path30, formatAuditReport(report), "utf-8");
168384
+ return path30;
168238
168385
  }
168239
168386
  var init_self_audit = () => {};
168240
168387
 
@@ -168279,8 +168426,8 @@ async function executeSelfAuditCommand(options = {}) {
168279
168426
  project: t2.project || t2.context?.project || undefined,
168280
168427
  errorCount: t2.error_count || t2.errorCount || 0
168281
168428
  })), signals, options.week);
168282
- const path29 = writeAuditReport(report);
168283
- return { ok: true, path: path29, message: `Self-audit written to ${path29}`, report };
168429
+ const path30 = writeAuditReport(report);
168430
+ return { ok: true, path: path30, message: `Self-audit written to ${path30}`, report };
168284
168431
  }
168285
168432
  function normalizeStatus(status2) {
168286
168433
  if (!status2)
@@ -168541,8 +168688,8 @@ __export(exports_service, {
168541
168688
  serviceInstallCommand: () => serviceInstallCommand
168542
168689
  });
168543
168690
  import * as os15 from "os";
168544
- import * as fs24 from "fs";
168545
- import * as path29 from "path";
168691
+ import * as fs25 from "fs";
168692
+ import * as path30 from "path";
168546
168693
  import { execSync as execSync4 } from "child_process";
168547
168694
  function resolveMatrixosBin2() {
168548
168695
  try {
@@ -168550,8 +168697,8 @@ function resolveMatrixosBin2() {
168550
168697
  if (p2)
168551
168698
  return p2;
168552
168699
  } catch {}
168553
- for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path29.join(os15.homedir(), ".bun/bin/matrixos")]) {
168554
- if (fs24.existsSync(cand))
168700
+ for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path30.join(os15.homedir(), ".bun/bin/matrixos")]) {
168701
+ if (fs25.existsSync(cand))
168555
168702
  return cand;
168556
168703
  }
168557
168704
  return "matrixos";
@@ -168565,16 +168712,16 @@ function resolveBunBin() {
168565
168712
  return "/usr/bin/bun";
168566
168713
  }
168567
168714
  function writeFileEnsureDir(filePath, content) {
168568
- fs24.mkdirSync(path29.dirname(filePath), { recursive: true });
168569
- fs24.writeFileSync(filePath, content, "utf-8");
168715
+ fs25.mkdirSync(path30.dirname(filePath), { recursive: true });
168716
+ fs25.writeFileSync(filePath, content, "utf-8");
168570
168717
  console.log(`[service] written: ${filePath}`);
168571
168718
  }
168572
168719
  function installSystemd(opts) {
168573
168720
  const bin = resolveMatrixosBin2();
168574
168721
  const bun = resolveBunBin();
168575
168722
  const scope = opts.user ? "--user" : "";
168576
- const unitDir = opts.user ? path29.join(os15.homedir(), ".config", "systemd", "user") : "/etc/systemd/system";
168577
- const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
168723
+ const unitDir = opts.user ? path30.join(os15.homedir(), ".config", "systemd", "user") : "/etc/systemd/system";
168724
+ const envPath = `/usr/local/bin:/usr/bin:/bin:${path30.dirname(bun)}`;
168578
168725
  if (opts.dashboard !== false) {
168579
168726
  const unit = `[Unit]
168580
168727
  Description=MaTrixOS Dashboard
@@ -168593,7 +168740,7 @@ RestartSec=5
168593
168740
  [Install]
168594
168741
  WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168595
168742
  `;
168596
- writeFileEnsureDir(path29.join(unitDir, "matrixos-dashboard.service"), unit);
168743
+ writeFileEnsureDir(path30.join(unitDir, "matrixos-dashboard.service"), unit);
168597
168744
  }
168598
168745
  if (opts.gateway !== false) {
168599
168746
  const unit = `[Unit]
@@ -168613,7 +168760,7 @@ RestartSec=5
168613
168760
  [Install]
168614
168761
  WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168615
168762
  `;
168616
- writeFileEnsureDir(path29.join(unitDir, "matrixos-gateway.service"), unit);
168763
+ writeFileEnsureDir(path30.join(unitDir, "matrixos-gateway.service"), unit);
168617
168764
  }
168618
168765
  if (opts.cron !== false) {
168619
168766
  const unit = `[Unit]
@@ -168633,7 +168780,7 @@ RestartSec=5
168633
168780
  [Install]
168634
168781
  WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168635
168782
  `;
168636
- writeFileEnsureDir(path29.join(unitDir, "matrixos-cron.service"), unit);
168783
+ writeFileEnsureDir(path30.join(unitDir, "matrixos-cron.service"), unit);
168637
168784
  }
168638
168785
  console.log("[service] reloading systemd...");
168639
168786
  if (scope) {
@@ -168670,8 +168817,8 @@ WantedBy=${opts.user ? "default.target" : "multi-user.target"}
168670
168817
  function installLaunchd(opts) {
168671
168818
  const bin = resolveMatrixosBin2();
168672
168819
  const bun = resolveBunBin();
168673
- const launchDir = path29.join(os15.homedir(), "Library", "LaunchAgents");
168674
- const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
168820
+ const launchDir = path30.join(os15.homedir(), "Library", "LaunchAgents");
168821
+ const envPath = `/usr/local/bin:/usr/bin:/bin:${path30.dirname(bun)}`;
168675
168822
  if (opts.dashboard !== false) {
168676
168823
  const label = "com.klc.matrixos.dashboard";
168677
168824
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
@@ -168708,8 +168855,8 @@ function installLaunchd(opts) {
168708
168855
  </dict>
168709
168856
  </plist>
168710
168857
  `;
168711
- writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
168712
- execSync4(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168858
+ writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
168859
+ execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168713
168860
  }
168714
168861
  if (opts.gateway !== false) {
168715
168862
  const label = "com.klc.matrixos.gateway";
@@ -168747,8 +168894,8 @@ function installLaunchd(opts) {
168747
168894
  </dict>
168748
168895
  </plist>
168749
168896
  `;
168750
- writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
168751
- execSync4(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168897
+ writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
168898
+ execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
168752
168899
  }
168753
168900
  console.log("[service] launchd agents installed and loaded.");
168754
168901
  }
@@ -168762,7 +168909,7 @@ async function serviceInstallCommand(options) {
168762
168909
  const platform2 = process.platform;
168763
168910
  console.log(`[service] detected platform: ${platform2}`);
168764
168911
  if (platform2 === "linux") {
168765
- if (!fs24.existsSync("/run/systemd/system") && !fs24.existsSync("/etc/systemd/system")) {
168912
+ if (!fs25.existsSync("/run/systemd/system") && !fs25.existsSync("/etc/systemd/system")) {
168766
168913
  console.error("[service] systemd not detected \u2014 cannot install service automatically.");
168767
168914
  console.error(" Start manually: matrixos dashboard --host 0.0.0.0 --daemon");
168768
168915
  return 1;
@@ -190220,6 +190367,20 @@ project.command("add-doc <slug> <file>").description("Copy a document into the p
190220
190367
  process.stdout.write(JSON.stringify({ ok: true, dest }, null, 2) + `
190221
190368
  `);
190222
190369
  });
190370
+ project.command("init <name>").description("Scaffold a generic project skeleton (AGENTS.md, README, .gitignore, PROJECT.md, plan.md)").option("-p, --path <dir>", "Target directory (default: cwd)").option("--apply", "Actually write the files (default dry-run)").option("--json", "Output as JSON").addHelpText("after", `
190371
+ Examples:
190372
+ $ matrixos project init my-app # dry-run
190373
+ $ matrixos project init my-app --apply # write files
190374
+ `).action(async (name2, options) => {
190375
+ const { projectInit: projectInit2 } = await Promise.resolve().then(() => (init_project_init(), exports_project_init));
190376
+ const code = projectInit2({
190377
+ name: name2,
190378
+ path: options.path,
190379
+ apply: options.apply ?? false,
190380
+ json: options.json ?? false
190381
+ });
190382
+ process.exit(code);
190383
+ });
190223
190384
  var gateway2 = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
190224
190385
  var gatewayAdopt = gateway2.command("adopt").description("Adopt a gateway channel (Telegram, Discord, WhatsApp)");
190225
190386
  var gatewayAdoptTelegram = gatewayAdopt.command("telegram").description("Set up the Telegram gateway: prompt for bot token, validate, write .klc-gateway.env").option("-t, --token <value>", "Bot token (non-interactive)").option("-c, --chat <id>", "Restrict to a single chat id").addHelpText("after", `
package/dist/index.js CHANGED
@@ -368086,7 +368086,7 @@ function getCachedVersion(options = {}) {
368086
368086
  // package.json
368087
368087
  var package_default = {
368088
368088
  name: "@kl-c/matrixos",
368089
- version: "0.3.52",
368089
+ version: "0.3.54",
368090
368090
  description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
368091
368091
  main: "./dist/index.js",
368092
368092
  types: "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kl-c/matrixos",
3
- "version": "0.3.52",
3
+ "version": "0.3.54",
4
4
  "description": "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",