@kl-c/matrixos 0.3.53 → 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.53",
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)
@@ -168480,153 +168627,6 @@ function submitPr(options) {
168480
168627
  }
168481
168628
  var init_prepare = () => {};
168482
168629
 
168483
- // packages/omo-opencode/src/cli/project-init.ts
168484
- var exports_project_init = {};
168485
- __export(exports_project_init, {
168486
- projectInit: () => projectInit
168487
- });
168488
- import * as fs24 from "fs";
168489
- import * as path29 from "path";
168490
- function projectInit(options) {
168491
- const target = path29.resolve(options.path ?? process.cwd(), options.name);
168492
- const apply = options.apply ?? false;
168493
- if (fs24.existsSync(target) && fs24.readdirSync(target).length > 0) {
168494
- console.error(`[project] target exists and is not empty: ${target}`);
168495
- return 1;
168496
- }
168497
- const files = Object.entries(TEMPLATES).map(([rel, fn]) => ({ rel, content: fn(options.name) }));
168498
- if (!apply) {
168499
- console.log(`[dry-run] would create project '${options.name}' at:
168500
- ${target}
168501
- `);
168502
- console.log("Files:");
168503
- for (const f2 of files) {
168504
- console.log(` ${f2.rel}`);
168505
- }
168506
- console.log(`
168507
- [dry-run] re-run with --apply to write the files.`);
168508
- return 0;
168509
- }
168510
- fs24.mkdirSync(path29.join(target, "src"), { recursive: true });
168511
- for (const f2 of files) {
168512
- const full = path29.join(target, f2.rel);
168513
- fs24.mkdirSync(path29.dirname(full), { recursive: true });
168514
- fs24.writeFileSync(full, f2.content);
168515
- console.log(`[project] wrote ${f2.rel}`);
168516
- }
168517
- console.log(`
168518
- [project] '${options.name}' initialized at ${target}`);
168519
- console.log(`[project] Next: cd ${target} && matrixos run --agent Architect 'refine the plan.md'`);
168520
- return 0;
168521
- }
168522
- var TEMPLATES;
168523
- var init_project_init = __esm(() => {
168524
- TEMPLATES = {
168525
- "AGENTS.md": (name2) => `# ${name2}
168526
-
168527
- > Project context for AI agents. Keep this file accurate \u2014 agents read it first.
168528
-
168529
- ## OVERVIEW
168530
-
168531
- One-paragraph description of what this project is and who uses it.
168532
-
168533
- ## CONVENTIONS
168534
-
168535
- - Code style: TBD
168536
- - Tests: TBD
168537
- - Commits: conventional commits
168538
-
168539
- ## STRUCTURE
168540
-
168541
- \`\`\`
168542
- ${name2}/
168543
- \u251C\u2500\u2500 README.md
168544
- \u251C\u2500\u2500 PROJECT.md # project state / roadmap
168545
- \u251C\u2500\u2500 plan.md # current plan
168546
- \u2514\u2500\u2500 src/
168547
- \`\`\`
168548
-
168549
- ## NOTES
168550
-
168551
- - Link the relevant MaTrixOS Goal/Kanban board for tracking.
168552
- `,
168553
- "README.md": (name2) => `# ${name2}
168554
-
168555
- ## Install
168556
-
168557
- \`\`\`bash
168558
- # add your install steps
168559
- \`\`\`
168560
-
168561
- ## Usage
168562
-
168563
- \`\`\`bash
168564
- # add your usage steps
168565
- \`\`\`
168566
-
168567
- ## Development
168568
-
168569
- See AGENTS.md for agent context.
168570
- `,
168571
- ".gitignore": () => `# Dependencies
168572
- node_modules/
168573
- .venv/
168574
- __pycache__/
168575
-
168576
- # Build
168577
- /dist/
168578
- build/
168579
-
168580
- # Env / secrets
168581
- .env
168582
- .env.local
168583
- *.secret
168584
-
168585
- # OS
168586
- .DS_Store
168587
-
168588
- # MaTrixOS
168589
- .omo/
168590
- `,
168591
- "PROJECT.md": (name2) => `# ${name2} \u2014 Project State
168592
-
168593
- ## STATUS
168594
-
168595
- | Item | State |
168596
- |------|-------|
168597
- | Scope | defined / wip / done |
168598
- | Health | green / yellow / red |
168599
-
168600
- ## ROADMAP
168601
-
168602
- - [ ] Milestone 1
168603
- - [ ] Milestone 2
168604
-
168605
- ## LINKS
168606
-
168607
- - MaTrixOS Goal: (create via dashboard)
168608
- - Kanban: (link board)
168609
- `,
168610
- "plan.md": () => `# Plan
168611
-
168612
- ## Goal
168613
-
168614
- What are we trying to achieve?
168615
-
168616
- ## Steps
168617
-
168618
- 1.
168619
- 2.
168620
- 3.
168621
-
168622
- ## Open Questions
168623
-
168624
- -
168625
- `,
168626
- "src/.gitkeep": () => ""
168627
- };
168628
- });
168629
-
168630
168630
  // packages/omo-opencode/src/cli/service.ts
168631
168631
  var exports_service = {};
168632
168632
  __export(exports_service, {
@@ -190312,6 +190312,20 @@ project.command("add-doc <slug> <file>").description("Copy a document into the p
190312
190312
  process.stdout.write(JSON.stringify({ ok: true, dest }, null, 2) + `
190313
190313
  `);
190314
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
+ });
190315
190329
  var gateway2 = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
190316
190330
  var gatewayAdopt = gateway2.command("adopt").description("Adopt a gateway channel (Telegram, Discord, WhatsApp)");
190317
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", `
@@ -190583,21 +190597,6 @@ prepare.command("submit <pr>").description("Mark a prepared PR as ready (human v
190583
190597
  const code = submitPr2({ pr, json: options.json ?? false });
190584
190598
  process.exit(code);
190585
190599
  });
190586
- var projectCmd = program2.command("project").description("Project lifecycle helpers (generic scaffolding)");
190587
- projectCmd.command("init <name>").description("Scaffold a generic project (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", `
190588
- Examples:
190589
- $ matrixos project init my-app # dry-run
190590
- $ matrixos project init my-app --apply # write files
190591
- `).action(async (name2, options) => {
190592
- const { projectInit: projectInit2 } = await Promise.resolve().then(() => (init_project_init(), exports_project_init));
190593
- const code = projectInit2({
190594
- name: name2,
190595
- path: options.path,
190596
- apply: options.apply ?? false,
190597
- json: options.json ?? false
190598
- });
190599
- process.exit(code);
190600
- });
190601
190600
  program2.command("service").description("Install MaTrixOS as a persistent OS service (dashboard + gateway)").argument("<action>", "install | uninstall").option("--no-dashboard", "Skip dashboard service").option("--no-gateway", "Skip gateway service").option("--no-cron", "Skip cron scheduler service").option("--user", "Install as current user (systemd --user / launchd user agent)").action(async (action, options) => {
190602
190601
  if (action !== "install" && action !== "uninstall") {
190603
190602
  console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
@@ -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.53",
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)
@@ -168535,153 +168682,6 @@ function submitPr(options) {
168535
168682
  }
168536
168683
  var init_prepare = () => {};
168537
168684
 
168538
- // packages/omo-opencode/src/cli/project-init.ts
168539
- var exports_project_init = {};
168540
- __export(exports_project_init, {
168541
- projectInit: () => projectInit
168542
- });
168543
- import * as fs24 from "fs";
168544
- import * as path29 from "path";
168545
- function projectInit(options) {
168546
- const target = path29.resolve(options.path ?? process.cwd(), options.name);
168547
- const apply = options.apply ?? false;
168548
- if (fs24.existsSync(target) && fs24.readdirSync(target).length > 0) {
168549
- console.error(`[project] target exists and is not empty: ${target}`);
168550
- return 1;
168551
- }
168552
- const files = Object.entries(TEMPLATES).map(([rel, fn]) => ({ rel, content: fn(options.name) }));
168553
- if (!apply) {
168554
- console.log(`[dry-run] would create project '${options.name}' at:
168555
- ${target}
168556
- `);
168557
- console.log("Files:");
168558
- for (const f2 of files) {
168559
- console.log(` ${f2.rel}`);
168560
- }
168561
- console.log(`
168562
- [dry-run] re-run with --apply to write the files.`);
168563
- return 0;
168564
- }
168565
- fs24.mkdirSync(path29.join(target, "src"), { recursive: true });
168566
- for (const f2 of files) {
168567
- const full = path29.join(target, f2.rel);
168568
- fs24.mkdirSync(path29.dirname(full), { recursive: true });
168569
- fs24.writeFileSync(full, f2.content);
168570
- console.log(`[project] wrote ${f2.rel}`);
168571
- }
168572
- console.log(`
168573
- [project] '${options.name}' initialized at ${target}`);
168574
- console.log(`[project] Next: cd ${target} && matrixos run --agent Architect 'refine the plan.md'`);
168575
- return 0;
168576
- }
168577
- var TEMPLATES;
168578
- var init_project_init = __esm(() => {
168579
- TEMPLATES = {
168580
- "AGENTS.md": (name2) => `# ${name2}
168581
-
168582
- > Project context for AI agents. Keep this file accurate \u2014 agents read it first.
168583
-
168584
- ## OVERVIEW
168585
-
168586
- One-paragraph description of what this project is and who uses it.
168587
-
168588
- ## CONVENTIONS
168589
-
168590
- - Code style: TBD
168591
- - Tests: TBD
168592
- - Commits: conventional commits
168593
-
168594
- ## STRUCTURE
168595
-
168596
- \`\`\`
168597
- ${name2}/
168598
- \u251C\u2500\u2500 README.md
168599
- \u251C\u2500\u2500 PROJECT.md # project state / roadmap
168600
- \u251C\u2500\u2500 plan.md # current plan
168601
- \u2514\u2500\u2500 src/
168602
- \`\`\`
168603
-
168604
- ## NOTES
168605
-
168606
- - Link the relevant MaTrixOS Goal/Kanban board for tracking.
168607
- `,
168608
- "README.md": (name2) => `# ${name2}
168609
-
168610
- ## Install
168611
-
168612
- \`\`\`bash
168613
- # add your install steps
168614
- \`\`\`
168615
-
168616
- ## Usage
168617
-
168618
- \`\`\`bash
168619
- # add your usage steps
168620
- \`\`\`
168621
-
168622
- ## Development
168623
-
168624
- See AGENTS.md for agent context.
168625
- `,
168626
- ".gitignore": () => `# Dependencies
168627
- node_modules/
168628
- .venv/
168629
- __pycache__/
168630
-
168631
- # Build
168632
- /dist/
168633
- build/
168634
-
168635
- # Env / secrets
168636
- .env
168637
- .env.local
168638
- *.secret
168639
-
168640
- # OS
168641
- .DS_Store
168642
-
168643
- # MaTrixOS
168644
- .omo/
168645
- `,
168646
- "PROJECT.md": (name2) => `# ${name2} \u2014 Project State
168647
-
168648
- ## STATUS
168649
-
168650
- | Item | State |
168651
- |------|-------|
168652
- | Scope | defined / wip / done |
168653
- | Health | green / yellow / red |
168654
-
168655
- ## ROADMAP
168656
-
168657
- - [ ] Milestone 1
168658
- - [ ] Milestone 2
168659
-
168660
- ## LINKS
168661
-
168662
- - MaTrixOS Goal: (create via dashboard)
168663
- - Kanban: (link board)
168664
- `,
168665
- "plan.md": () => `# Plan
168666
-
168667
- ## Goal
168668
-
168669
- What are we trying to achieve?
168670
-
168671
- ## Steps
168672
-
168673
- 1.
168674
- 2.
168675
- 3.
168676
-
168677
- ## Open Questions
168678
-
168679
- -
168680
- `,
168681
- "src/.gitkeep": () => ""
168682
- };
168683
- });
168684
-
168685
168685
  // packages/omo-opencode/src/cli/service.ts
168686
168686
  var exports_service = {};
168687
168687
  __export(exports_service, {
@@ -190367,6 +190367,20 @@ project.command("add-doc <slug> <file>").description("Copy a document into the p
190367
190367
  process.stdout.write(JSON.stringify({ ok: true, dest }, null, 2) + `
190368
190368
  `);
190369
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
+ });
190370
190384
  var gateway2 = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
190371
190385
  var gatewayAdopt = gateway2.command("adopt").description("Adopt a gateway channel (Telegram, Discord, WhatsApp)");
190372
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", `
@@ -190638,21 +190652,6 @@ prepare.command("submit <pr>").description("Mark a prepared PR as ready (human v
190638
190652
  const code = submitPr2({ pr, json: options.json ?? false });
190639
190653
  process.exit(code);
190640
190654
  });
190641
- var projectCmd = program2.command("project").description("Project lifecycle helpers (generic scaffolding)");
190642
- projectCmd.command("init <name>").description("Scaffold a generic project (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", `
190643
- Examples:
190644
- $ matrixos project init my-app # dry-run
190645
- $ matrixos project init my-app --apply # write files
190646
- `).action(async (name2, options) => {
190647
- const { projectInit: projectInit2 } = await Promise.resolve().then(() => (init_project_init(), exports_project_init));
190648
- const code = projectInit2({
190649
- name: name2,
190650
- path: options.path,
190651
- apply: options.apply ?? false,
190652
- json: options.json ?? false
190653
- });
190654
- process.exit(code);
190655
- });
190656
190655
  program2.command("service").description("Install MaTrixOS as a persistent OS service (dashboard + gateway)").argument("<action>", "install | uninstall").option("--no-dashboard", "Skip dashboard service").option("--no-gateway", "Skip gateway service").option("--no-cron", "Skip cron scheduler service").option("--user", "Install as current user (systemd --user / launchd user agent)").action(async (action, options) => {
190657
190656
  if (action !== "install" && action !== "uninstall") {
190658
190657
  console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
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.53",
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.53",
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",