@kl-c/matrixos 0.3.51 → 0.3.53
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 +305 -36
- package/dist/cli/prepare.d.ts +14 -0
- package/dist/cli/project-init.d.ts +7 -0
- package/dist/cli-node/index.js +305 -36
- package/dist/index.js +1 -1
- package/package.json +1 -1
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.
|
|
2166
|
+
version: "0.3.53",
|
|
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",
|
|
@@ -168395,46 +168395,278 @@ function executeRgpdConsentCommand(args) {
|
|
|
168395
168395
|
}
|
|
168396
168396
|
}
|
|
168397
168397
|
|
|
168398
|
+
// packages/omo-opencode/src/cli/prepare.ts
|
|
168399
|
+
var exports_prepare = {};
|
|
168400
|
+
__export(exports_prepare, {
|
|
168401
|
+
submitPr: () => submitPr,
|
|
168402
|
+
preparePr: () => preparePr
|
|
168403
|
+
});
|
|
168404
|
+
import { execSync as execSync3 } from "child_process";
|
|
168405
|
+
function sh(cmd) {
|
|
168406
|
+
return execSync3(cmd, { encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
168407
|
+
}
|
|
168408
|
+
function shOk(cmd) {
|
|
168409
|
+
try {
|
|
168410
|
+
execSync3(cmd, { encoding: "utf-8", stdio: "ignore" });
|
|
168411
|
+
return true;
|
|
168412
|
+
} catch {
|
|
168413
|
+
return false;
|
|
168414
|
+
}
|
|
168415
|
+
}
|
|
168416
|
+
function preparePr(options) {
|
|
168417
|
+
const apply = options.apply ?? false;
|
|
168418
|
+
const draft = options.draft ?? true;
|
|
168419
|
+
const base = options.base ?? "main";
|
|
168420
|
+
const steps = [];
|
|
168421
|
+
const run5 = (cmd, label) => {
|
|
168422
|
+
steps.push(`${label}: ${cmd}`);
|
|
168423
|
+
if (!apply)
|
|
168424
|
+
return "";
|
|
168425
|
+
try {
|
|
168426
|
+
return sh(cmd);
|
|
168427
|
+
} catch (e) {
|
|
168428
|
+
console.error(`[prepare] FAILED at: ${label}
|
|
168429
|
+
${e instanceof Error ? e.message : String(e)}`);
|
|
168430
|
+
process.exit(1);
|
|
168431
|
+
}
|
|
168432
|
+
};
|
|
168433
|
+
if (!shOk("git rev-parse --is-inside-work-tree")) {
|
|
168434
|
+
console.error("[prepare] not a git repository");
|
|
168435
|
+
return 1;
|
|
168436
|
+
}
|
|
168437
|
+
const status2 = sh("git status --porcelain");
|
|
168438
|
+
if (!status2 && !apply) {}
|
|
168439
|
+
if (apply && !status2) {
|
|
168440
|
+
console.error("[prepare] nothing to commit (working tree clean)");
|
|
168441
|
+
return 1;
|
|
168442
|
+
}
|
|
168443
|
+
const branch = `feat/matrixos-${Date.now().toString(36)}`;
|
|
168444
|
+
const title = options.title ?? (apply ? sh("git log -1 --pretty=%s") : "Prepared change");
|
|
168445
|
+
const body = options.body ?? "Prepared by matrixos prepare (draft, not yet submitted).";
|
|
168446
|
+
run5(`git checkout -b ${branch}`, "create branch");
|
|
168447
|
+
run5(`git add -A`, "stage");
|
|
168448
|
+
run5(`git commit -m "${title.replace(/"/g, "\\\"")}"`, "commit");
|
|
168449
|
+
run5(`git push -u origin ${branch}`, "push");
|
|
168450
|
+
const prFlags = draft ? "--fill --draft" : "--fill";
|
|
168451
|
+
const prOut = run5(`gh pr create ${prFlags} --base ${base} --title "${title.replace(/"/g, "\\\"")}" --body "${body.replace(/"/g, "\\\"")}"`, "open PR");
|
|
168452
|
+
if (!apply) {
|
|
168453
|
+
console.log(`[dry-run] would execute:
|
|
168454
|
+
` + steps.join(`
|
|
168455
|
+
`));
|
|
168456
|
+
console.log(`
|
|
168457
|
+
[dry-run] would open ${draft ? "DRAFT" : ""} PR on base '${base}' with title: ${title}`);
|
|
168458
|
+
console.log("[dry-run] re-run with --apply to actually create the PR.");
|
|
168459
|
+
return 0;
|
|
168460
|
+
}
|
|
168461
|
+
console.log(`[prepare] PR created: ${prOut}`);
|
|
168462
|
+
console.log(`[prepare] Draft PR is NOT submitted. Run 'matrixos submit <pr-url>' to mark ready.`);
|
|
168463
|
+
return 0;
|
|
168464
|
+
}
|
|
168465
|
+
function submitPr(options) {
|
|
168466
|
+
const pr = options.pr;
|
|
168467
|
+
if (!pr) {
|
|
168468
|
+
console.error("[submit] PR identifier required (URL or number)");
|
|
168469
|
+
return 1;
|
|
168470
|
+
}
|
|
168471
|
+
const prRef = pr.includes("/") || /^\d+$/.test(pr) ? pr : `#${pr}`;
|
|
168472
|
+
try {
|
|
168473
|
+
sh(`gh pr ready ${prRef}`);
|
|
168474
|
+
console.log(`[submit] PR ${prRef} marked ready.`);
|
|
168475
|
+
return 0;
|
|
168476
|
+
} catch (e) {
|
|
168477
|
+
console.error(`[submit] failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
168478
|
+
return 1;
|
|
168479
|
+
}
|
|
168480
|
+
}
|
|
168481
|
+
var init_prepare = () => {};
|
|
168482
|
+
|
|
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
|
+
|
|
168398
168630
|
// packages/omo-opencode/src/cli/service.ts
|
|
168399
168631
|
var exports_service = {};
|
|
168400
168632
|
__export(exports_service, {
|
|
168401
168633
|
serviceInstallCommand: () => serviceInstallCommand
|
|
168402
168634
|
});
|
|
168403
168635
|
import * as os15 from "os";
|
|
168404
|
-
import * as
|
|
168405
|
-
import * as
|
|
168406
|
-
import { execSync as
|
|
168636
|
+
import * as fs25 from "fs";
|
|
168637
|
+
import * as path30 from "path";
|
|
168638
|
+
import { execSync as execSync4 } from "child_process";
|
|
168407
168639
|
function resolveMatrixosBin2() {
|
|
168408
168640
|
try {
|
|
168409
|
-
const p2 =
|
|
168641
|
+
const p2 = execSync4("command -v matrixos", { encoding: "utf-8" }).trim();
|
|
168410
168642
|
if (p2)
|
|
168411
168643
|
return p2;
|
|
168412
168644
|
} catch {}
|
|
168413
|
-
for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos",
|
|
168414
|
-
if (
|
|
168645
|
+
for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path30.join(os15.homedir(), ".bun/bin/matrixos")]) {
|
|
168646
|
+
if (fs25.existsSync(cand))
|
|
168415
168647
|
return cand;
|
|
168416
168648
|
}
|
|
168417
168649
|
return "matrixos";
|
|
168418
168650
|
}
|
|
168419
168651
|
function resolveBunBin() {
|
|
168420
168652
|
try {
|
|
168421
|
-
const p2 =
|
|
168653
|
+
const p2 = execSync4("command -v bun", { encoding: "utf-8" }).trim();
|
|
168422
168654
|
if (p2)
|
|
168423
168655
|
return p2;
|
|
168424
168656
|
} catch {}
|
|
168425
168657
|
return "/usr/bin/bun";
|
|
168426
168658
|
}
|
|
168427
168659
|
function writeFileEnsureDir(filePath, content) {
|
|
168428
|
-
|
|
168429
|
-
|
|
168660
|
+
fs25.mkdirSync(path30.dirname(filePath), { recursive: true });
|
|
168661
|
+
fs25.writeFileSync(filePath, content, "utf-8");
|
|
168430
168662
|
console.log(`[service] written: ${filePath}`);
|
|
168431
168663
|
}
|
|
168432
168664
|
function installSystemd(opts) {
|
|
168433
168665
|
const bin = resolveMatrixosBin2();
|
|
168434
168666
|
const bun = resolveBunBin();
|
|
168435
168667
|
const scope = opts.user ? "--user" : "";
|
|
168436
|
-
const unitDir = opts.user ?
|
|
168437
|
-
const envPath = `/usr/local/bin:/usr/bin:/bin:${
|
|
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)}`;
|
|
168438
168670
|
if (opts.dashboard !== false) {
|
|
168439
168671
|
const unit = `[Unit]
|
|
168440
168672
|
Description=MaTrixOS Dashboard
|
|
@@ -168453,7 +168685,7 @@ RestartSec=5
|
|
|
168453
168685
|
[Install]
|
|
168454
168686
|
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168455
168687
|
`;
|
|
168456
|
-
writeFileEnsureDir(
|
|
168688
|
+
writeFileEnsureDir(path30.join(unitDir, "matrixos-dashboard.service"), unit);
|
|
168457
168689
|
}
|
|
168458
168690
|
if (opts.gateway !== false) {
|
|
168459
168691
|
const unit = `[Unit]
|
|
@@ -168473,7 +168705,7 @@ RestartSec=5
|
|
|
168473
168705
|
[Install]
|
|
168474
168706
|
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168475
168707
|
`;
|
|
168476
|
-
writeFileEnsureDir(
|
|
168708
|
+
writeFileEnsureDir(path30.join(unitDir, "matrixos-gateway.service"), unit);
|
|
168477
168709
|
}
|
|
168478
168710
|
if (opts.cron !== false) {
|
|
168479
168711
|
const unit = `[Unit]
|
|
@@ -168493,45 +168725,45 @@ RestartSec=5
|
|
|
168493
168725
|
[Install]
|
|
168494
168726
|
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168495
168727
|
`;
|
|
168496
|
-
writeFileEnsureDir(
|
|
168728
|
+
writeFileEnsureDir(path30.join(unitDir, "matrixos-cron.service"), unit);
|
|
168497
168729
|
}
|
|
168498
168730
|
console.log("[service] reloading systemd...");
|
|
168499
168731
|
if (scope) {
|
|
168500
|
-
|
|
168732
|
+
execSync4(`${scope} systemctl --user daemon-reload`, { stdio: "inherit" });
|
|
168501
168733
|
if (opts.dashboard !== false)
|
|
168502
|
-
|
|
168734
|
+
execSync4(`${scope} systemctl --user enable matrixos-dashboard.service`, { stdio: "inherit" });
|
|
168503
168735
|
if (opts.gateway !== false)
|
|
168504
|
-
|
|
168736
|
+
execSync4(`${scope} systemctl --user enable matrixos-gateway.service`, { stdio: "inherit" });
|
|
168505
168737
|
if (opts.cron !== false)
|
|
168506
|
-
|
|
168738
|
+
execSync4(`${scope} systemctl --user enable matrixos-cron.service`, { stdio: "inherit" });
|
|
168507
168739
|
if (opts.dashboard !== false)
|
|
168508
|
-
|
|
168740
|
+
execSync4(`${scope} systemctl --user start matrixos-dashboard.service`, { stdio: "inherit" });
|
|
168509
168741
|
if (opts.gateway !== false)
|
|
168510
|
-
|
|
168742
|
+
execSync4(`${scope} systemctl --user start matrixos-gateway.service`, { stdio: "inherit" });
|
|
168511
168743
|
if (opts.cron !== false)
|
|
168512
|
-
|
|
168744
|
+
execSync4(`${scope} systemctl --user start matrixos-cron.service`, { stdio: "inherit" });
|
|
168513
168745
|
} else {
|
|
168514
|
-
|
|
168746
|
+
execSync4("systemctl daemon-reload", { stdio: "inherit" });
|
|
168515
168747
|
if (opts.dashboard !== false)
|
|
168516
|
-
|
|
168748
|
+
execSync4("systemctl enable matrixos-dashboard.service", { stdio: "inherit" });
|
|
168517
168749
|
if (opts.gateway !== false)
|
|
168518
|
-
|
|
168750
|
+
execSync4("systemctl enable matrixos-gateway.service", { stdio: "inherit" });
|
|
168519
168751
|
if (opts.cron !== false)
|
|
168520
|
-
|
|
168752
|
+
execSync4("systemctl enable matrixos-cron.service", { stdio: "inherit" });
|
|
168521
168753
|
if (opts.dashboard !== false)
|
|
168522
|
-
|
|
168754
|
+
execSync4("systemctl start matrixos-dashboard.service", { stdio: "inherit" });
|
|
168523
168755
|
if (opts.gateway !== false)
|
|
168524
|
-
|
|
168756
|
+
execSync4("systemctl start matrixos-gateway.service", { stdio: "inherit" });
|
|
168525
168757
|
if (opts.cron !== false)
|
|
168526
|
-
|
|
168758
|
+
execSync4("systemctl start matrixos-cron.service", { stdio: "inherit" });
|
|
168527
168759
|
}
|
|
168528
168760
|
console.log("[service] systemd units installed and started.");
|
|
168529
168761
|
}
|
|
168530
168762
|
function installLaunchd(opts) {
|
|
168531
168763
|
const bin = resolveMatrixosBin2();
|
|
168532
168764
|
const bun = resolveBunBin();
|
|
168533
|
-
const launchDir =
|
|
168534
|
-
const envPath = `/usr/local/bin:/usr/bin:/bin:${
|
|
168765
|
+
const launchDir = path30.join(os15.homedir(), "Library", "LaunchAgents");
|
|
168766
|
+
const envPath = `/usr/local/bin:/usr/bin:/bin:${path30.dirname(bun)}`;
|
|
168535
168767
|
if (opts.dashboard !== false) {
|
|
168536
168768
|
const label = "com.klc.matrixos.dashboard";
|
|
168537
168769
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -168568,8 +168800,8 @@ function installLaunchd(opts) {
|
|
|
168568
168800
|
</dict>
|
|
168569
168801
|
</plist>
|
|
168570
168802
|
`;
|
|
168571
|
-
writeFileEnsureDir(
|
|
168572
|
-
|
|
168803
|
+
writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
|
|
168804
|
+
execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
168573
168805
|
}
|
|
168574
168806
|
if (opts.gateway !== false) {
|
|
168575
168807
|
const label = "com.klc.matrixos.gateway";
|
|
@@ -168607,8 +168839,8 @@ function installLaunchd(opts) {
|
|
|
168607
168839
|
</dict>
|
|
168608
168840
|
</plist>
|
|
168609
168841
|
`;
|
|
168610
|
-
writeFileEnsureDir(
|
|
168611
|
-
|
|
168842
|
+
writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
|
|
168843
|
+
execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
168612
168844
|
}
|
|
168613
168845
|
console.log("[service] launchd agents installed and loaded.");
|
|
168614
168846
|
}
|
|
@@ -168622,7 +168854,7 @@ async function serviceInstallCommand(options) {
|
|
|
168622
168854
|
const platform2 = process.platform;
|
|
168623
168855
|
console.log(`[service] detected platform: ${platform2}`);
|
|
168624
168856
|
if (platform2 === "linux") {
|
|
168625
|
-
if (!
|
|
168857
|
+
if (!fs25.existsSync("/run/systemd/system") && !fs25.existsSync("/etc/systemd/system")) {
|
|
168626
168858
|
console.error("[service] systemd not detected \u2014 cannot install service automatically.");
|
|
168627
168859
|
console.error(" Start manually: matrixos dashboard --host 0.0.0.0 --daemon");
|
|
168628
168860
|
return 1;
|
|
@@ -190329,6 +190561,43 @@ Examples:
|
|
|
190329
190561
|
process.stdout.write(result.stdout);
|
|
190330
190562
|
process.exit(result.exitCode);
|
|
190331
190563
|
});
|
|
190564
|
+
var prepare = program2.command("prepare").description("Prepare a pull request WITHOUT submitting (draft by default; --apply to create)").option("-t, --title <text>", "PR title").option("-b, --body <text>", "PR body").option("--base <branch>", "Base branch", "main").option("--no-draft", "Open as ready PR (default is draft)").option("--apply", "Actually create the branch/commit/PR (default dry-run)").option("--json", "Output as JSON").addHelpText("after", `
|
|
190565
|
+
Examples:
|
|
190566
|
+
$ matrixos prepare # dry-run: show what would happen
|
|
190567
|
+
$ matrixos prepare --apply # create draft PR on main
|
|
190568
|
+
$ matrixos prepare --apply --title "Fix X" --no-draft
|
|
190569
|
+
`).action(async (options) => {
|
|
190570
|
+
const { preparePr: preparePr2 } = await Promise.resolve().then(() => (init_prepare(), exports_prepare));
|
|
190571
|
+
const code = preparePr2({
|
|
190572
|
+
title: options.title,
|
|
190573
|
+
body: options.body,
|
|
190574
|
+
base: options.base,
|
|
190575
|
+
draft: options.draft ?? true,
|
|
190576
|
+
apply: options.apply ?? false,
|
|
190577
|
+
json: options.json ?? false
|
|
190578
|
+
});
|
|
190579
|
+
process.exit(code);
|
|
190580
|
+
});
|
|
190581
|
+
prepare.command("submit <pr>").description("Mark a prepared PR as ready (human validation gate)").option("--json", "Output as JSON").action(async (pr, options) => {
|
|
190582
|
+
const { submitPr: submitPr2 } = await Promise.resolve().then(() => (init_prepare(), exports_prepare));
|
|
190583
|
+
const code = submitPr2({ pr, json: options.json ?? false });
|
|
190584
|
+
process.exit(code);
|
|
190585
|
+
});
|
|
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
|
+
});
|
|
190332
190601
|
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) => {
|
|
190333
190602
|
if (action !== "install" && action !== "uninstall") {
|
|
190334
190603
|
console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PrepareOptions {
|
|
2
|
+
title?: string;
|
|
3
|
+
body?: string;
|
|
4
|
+
base?: string;
|
|
5
|
+
draft?: boolean;
|
|
6
|
+
apply?: boolean;
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SubmitOptions {
|
|
10
|
+
pr?: string;
|
|
11
|
+
json?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function preparePr(options: PrepareOptions): number;
|
|
14
|
+
export declare function submitPr(options: SubmitOptions): number;
|
package/dist/cli-node/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.
|
|
2166
|
+
version: "0.3.53",
|
|
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",
|
|
@@ -168450,46 +168450,278 @@ function executeRgpdConsentCommand(args) {
|
|
|
168450
168450
|
}
|
|
168451
168451
|
}
|
|
168452
168452
|
|
|
168453
|
+
// packages/omo-opencode/src/cli/prepare.ts
|
|
168454
|
+
var exports_prepare = {};
|
|
168455
|
+
__export(exports_prepare, {
|
|
168456
|
+
submitPr: () => submitPr,
|
|
168457
|
+
preparePr: () => preparePr
|
|
168458
|
+
});
|
|
168459
|
+
import { execSync as execSync3 } from "child_process";
|
|
168460
|
+
function sh(cmd) {
|
|
168461
|
+
return execSync3(cmd, { encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
168462
|
+
}
|
|
168463
|
+
function shOk(cmd) {
|
|
168464
|
+
try {
|
|
168465
|
+
execSync3(cmd, { encoding: "utf-8", stdio: "ignore" });
|
|
168466
|
+
return true;
|
|
168467
|
+
} catch {
|
|
168468
|
+
return false;
|
|
168469
|
+
}
|
|
168470
|
+
}
|
|
168471
|
+
function preparePr(options) {
|
|
168472
|
+
const apply = options.apply ?? false;
|
|
168473
|
+
const draft = options.draft ?? true;
|
|
168474
|
+
const base = options.base ?? "main";
|
|
168475
|
+
const steps = [];
|
|
168476
|
+
const run5 = (cmd, label) => {
|
|
168477
|
+
steps.push(`${label}: ${cmd}`);
|
|
168478
|
+
if (!apply)
|
|
168479
|
+
return "";
|
|
168480
|
+
try {
|
|
168481
|
+
return sh(cmd);
|
|
168482
|
+
} catch (e) {
|
|
168483
|
+
console.error(`[prepare] FAILED at: ${label}
|
|
168484
|
+
${e instanceof Error ? e.message : String(e)}`);
|
|
168485
|
+
process.exit(1);
|
|
168486
|
+
}
|
|
168487
|
+
};
|
|
168488
|
+
if (!shOk("git rev-parse --is-inside-work-tree")) {
|
|
168489
|
+
console.error("[prepare] not a git repository");
|
|
168490
|
+
return 1;
|
|
168491
|
+
}
|
|
168492
|
+
const status2 = sh("git status --porcelain");
|
|
168493
|
+
if (!status2 && !apply) {}
|
|
168494
|
+
if (apply && !status2) {
|
|
168495
|
+
console.error("[prepare] nothing to commit (working tree clean)");
|
|
168496
|
+
return 1;
|
|
168497
|
+
}
|
|
168498
|
+
const branch = `feat/matrixos-${Date.now().toString(36)}`;
|
|
168499
|
+
const title = options.title ?? (apply ? sh("git log -1 --pretty=%s") : "Prepared change");
|
|
168500
|
+
const body = options.body ?? "Prepared by matrixos prepare (draft, not yet submitted).";
|
|
168501
|
+
run5(`git checkout -b ${branch}`, "create branch");
|
|
168502
|
+
run5(`git add -A`, "stage");
|
|
168503
|
+
run5(`git commit -m "${title.replace(/"/g, "\\\"")}"`, "commit");
|
|
168504
|
+
run5(`git push -u origin ${branch}`, "push");
|
|
168505
|
+
const prFlags = draft ? "--fill --draft" : "--fill";
|
|
168506
|
+
const prOut = run5(`gh pr create ${prFlags} --base ${base} --title "${title.replace(/"/g, "\\\"")}" --body "${body.replace(/"/g, "\\\"")}"`, "open PR");
|
|
168507
|
+
if (!apply) {
|
|
168508
|
+
console.log(`[dry-run] would execute:
|
|
168509
|
+
` + steps.join(`
|
|
168510
|
+
`));
|
|
168511
|
+
console.log(`
|
|
168512
|
+
[dry-run] would open ${draft ? "DRAFT" : ""} PR on base '${base}' with title: ${title}`);
|
|
168513
|
+
console.log("[dry-run] re-run with --apply to actually create the PR.");
|
|
168514
|
+
return 0;
|
|
168515
|
+
}
|
|
168516
|
+
console.log(`[prepare] PR created: ${prOut}`);
|
|
168517
|
+
console.log(`[prepare] Draft PR is NOT submitted. Run 'matrixos submit <pr-url>' to mark ready.`);
|
|
168518
|
+
return 0;
|
|
168519
|
+
}
|
|
168520
|
+
function submitPr(options) {
|
|
168521
|
+
const pr = options.pr;
|
|
168522
|
+
if (!pr) {
|
|
168523
|
+
console.error("[submit] PR identifier required (URL or number)");
|
|
168524
|
+
return 1;
|
|
168525
|
+
}
|
|
168526
|
+
const prRef = pr.includes("/") || /^\d+$/.test(pr) ? pr : `#${pr}`;
|
|
168527
|
+
try {
|
|
168528
|
+
sh(`gh pr ready ${prRef}`);
|
|
168529
|
+
console.log(`[submit] PR ${prRef} marked ready.`);
|
|
168530
|
+
return 0;
|
|
168531
|
+
} catch (e) {
|
|
168532
|
+
console.error(`[submit] failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
168533
|
+
return 1;
|
|
168534
|
+
}
|
|
168535
|
+
}
|
|
168536
|
+
var init_prepare = () => {};
|
|
168537
|
+
|
|
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
|
+
|
|
168453
168685
|
// packages/omo-opencode/src/cli/service.ts
|
|
168454
168686
|
var exports_service = {};
|
|
168455
168687
|
__export(exports_service, {
|
|
168456
168688
|
serviceInstallCommand: () => serviceInstallCommand
|
|
168457
168689
|
});
|
|
168458
168690
|
import * as os15 from "os";
|
|
168459
|
-
import * as
|
|
168460
|
-
import * as
|
|
168461
|
-
import { execSync as
|
|
168691
|
+
import * as fs25 from "fs";
|
|
168692
|
+
import * as path30 from "path";
|
|
168693
|
+
import { execSync as execSync4 } from "child_process";
|
|
168462
168694
|
function resolveMatrixosBin2() {
|
|
168463
168695
|
try {
|
|
168464
|
-
const p2 =
|
|
168696
|
+
const p2 = execSync4("command -v matrixos", { encoding: "utf-8" }).trim();
|
|
168465
168697
|
if (p2)
|
|
168466
168698
|
return p2;
|
|
168467
168699
|
} catch {}
|
|
168468
|
-
for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos",
|
|
168469
|
-
if (
|
|
168700
|
+
for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path30.join(os15.homedir(), ".bun/bin/matrixos")]) {
|
|
168701
|
+
if (fs25.existsSync(cand))
|
|
168470
168702
|
return cand;
|
|
168471
168703
|
}
|
|
168472
168704
|
return "matrixos";
|
|
168473
168705
|
}
|
|
168474
168706
|
function resolveBunBin() {
|
|
168475
168707
|
try {
|
|
168476
|
-
const p2 =
|
|
168708
|
+
const p2 = execSync4("command -v bun", { encoding: "utf-8" }).trim();
|
|
168477
168709
|
if (p2)
|
|
168478
168710
|
return p2;
|
|
168479
168711
|
} catch {}
|
|
168480
168712
|
return "/usr/bin/bun";
|
|
168481
168713
|
}
|
|
168482
168714
|
function writeFileEnsureDir(filePath, content) {
|
|
168483
|
-
|
|
168484
|
-
|
|
168715
|
+
fs25.mkdirSync(path30.dirname(filePath), { recursive: true });
|
|
168716
|
+
fs25.writeFileSync(filePath, content, "utf-8");
|
|
168485
168717
|
console.log(`[service] written: ${filePath}`);
|
|
168486
168718
|
}
|
|
168487
168719
|
function installSystemd(opts) {
|
|
168488
168720
|
const bin = resolveMatrixosBin2();
|
|
168489
168721
|
const bun = resolveBunBin();
|
|
168490
168722
|
const scope = opts.user ? "--user" : "";
|
|
168491
|
-
const unitDir = opts.user ?
|
|
168492
|
-
const envPath = `/usr/local/bin:/usr/bin:/bin:${
|
|
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)}`;
|
|
168493
168725
|
if (opts.dashboard !== false) {
|
|
168494
168726
|
const unit = `[Unit]
|
|
168495
168727
|
Description=MaTrixOS Dashboard
|
|
@@ -168508,7 +168740,7 @@ RestartSec=5
|
|
|
168508
168740
|
[Install]
|
|
168509
168741
|
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168510
168742
|
`;
|
|
168511
|
-
writeFileEnsureDir(
|
|
168743
|
+
writeFileEnsureDir(path30.join(unitDir, "matrixos-dashboard.service"), unit);
|
|
168512
168744
|
}
|
|
168513
168745
|
if (opts.gateway !== false) {
|
|
168514
168746
|
const unit = `[Unit]
|
|
@@ -168528,7 +168760,7 @@ RestartSec=5
|
|
|
168528
168760
|
[Install]
|
|
168529
168761
|
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168530
168762
|
`;
|
|
168531
|
-
writeFileEnsureDir(
|
|
168763
|
+
writeFileEnsureDir(path30.join(unitDir, "matrixos-gateway.service"), unit);
|
|
168532
168764
|
}
|
|
168533
168765
|
if (opts.cron !== false) {
|
|
168534
168766
|
const unit = `[Unit]
|
|
@@ -168548,45 +168780,45 @@ RestartSec=5
|
|
|
168548
168780
|
[Install]
|
|
168549
168781
|
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
168550
168782
|
`;
|
|
168551
|
-
writeFileEnsureDir(
|
|
168783
|
+
writeFileEnsureDir(path30.join(unitDir, "matrixos-cron.service"), unit);
|
|
168552
168784
|
}
|
|
168553
168785
|
console.log("[service] reloading systemd...");
|
|
168554
168786
|
if (scope) {
|
|
168555
|
-
|
|
168787
|
+
execSync4(`${scope} systemctl --user daemon-reload`, { stdio: "inherit" });
|
|
168556
168788
|
if (opts.dashboard !== false)
|
|
168557
|
-
|
|
168789
|
+
execSync4(`${scope} systemctl --user enable matrixos-dashboard.service`, { stdio: "inherit" });
|
|
168558
168790
|
if (opts.gateway !== false)
|
|
168559
|
-
|
|
168791
|
+
execSync4(`${scope} systemctl --user enable matrixos-gateway.service`, { stdio: "inherit" });
|
|
168560
168792
|
if (opts.cron !== false)
|
|
168561
|
-
|
|
168793
|
+
execSync4(`${scope} systemctl --user enable matrixos-cron.service`, { stdio: "inherit" });
|
|
168562
168794
|
if (opts.dashboard !== false)
|
|
168563
|
-
|
|
168795
|
+
execSync4(`${scope} systemctl --user start matrixos-dashboard.service`, { stdio: "inherit" });
|
|
168564
168796
|
if (opts.gateway !== false)
|
|
168565
|
-
|
|
168797
|
+
execSync4(`${scope} systemctl --user start matrixos-gateway.service`, { stdio: "inherit" });
|
|
168566
168798
|
if (opts.cron !== false)
|
|
168567
|
-
|
|
168799
|
+
execSync4(`${scope} systemctl --user start matrixos-cron.service`, { stdio: "inherit" });
|
|
168568
168800
|
} else {
|
|
168569
|
-
|
|
168801
|
+
execSync4("systemctl daemon-reload", { stdio: "inherit" });
|
|
168570
168802
|
if (opts.dashboard !== false)
|
|
168571
|
-
|
|
168803
|
+
execSync4("systemctl enable matrixos-dashboard.service", { stdio: "inherit" });
|
|
168572
168804
|
if (opts.gateway !== false)
|
|
168573
|
-
|
|
168805
|
+
execSync4("systemctl enable matrixos-gateway.service", { stdio: "inherit" });
|
|
168574
168806
|
if (opts.cron !== false)
|
|
168575
|
-
|
|
168807
|
+
execSync4("systemctl enable matrixos-cron.service", { stdio: "inherit" });
|
|
168576
168808
|
if (opts.dashboard !== false)
|
|
168577
|
-
|
|
168809
|
+
execSync4("systemctl start matrixos-dashboard.service", { stdio: "inherit" });
|
|
168578
168810
|
if (opts.gateway !== false)
|
|
168579
|
-
|
|
168811
|
+
execSync4("systemctl start matrixos-gateway.service", { stdio: "inherit" });
|
|
168580
168812
|
if (opts.cron !== false)
|
|
168581
|
-
|
|
168813
|
+
execSync4("systemctl start matrixos-cron.service", { stdio: "inherit" });
|
|
168582
168814
|
}
|
|
168583
168815
|
console.log("[service] systemd units installed and started.");
|
|
168584
168816
|
}
|
|
168585
168817
|
function installLaunchd(opts) {
|
|
168586
168818
|
const bin = resolveMatrixosBin2();
|
|
168587
168819
|
const bun = resolveBunBin();
|
|
168588
|
-
const launchDir =
|
|
168589
|
-
const envPath = `/usr/local/bin:/usr/bin:/bin:${
|
|
168820
|
+
const launchDir = path30.join(os15.homedir(), "Library", "LaunchAgents");
|
|
168821
|
+
const envPath = `/usr/local/bin:/usr/bin:/bin:${path30.dirname(bun)}`;
|
|
168590
168822
|
if (opts.dashboard !== false) {
|
|
168591
168823
|
const label = "com.klc.matrixos.dashboard";
|
|
168592
168824
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -168623,8 +168855,8 @@ function installLaunchd(opts) {
|
|
|
168623
168855
|
</dict>
|
|
168624
168856
|
</plist>
|
|
168625
168857
|
`;
|
|
168626
|
-
writeFileEnsureDir(
|
|
168627
|
-
|
|
168858
|
+
writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
|
|
168859
|
+
execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
168628
168860
|
}
|
|
168629
168861
|
if (opts.gateway !== false) {
|
|
168630
168862
|
const label = "com.klc.matrixos.gateway";
|
|
@@ -168662,8 +168894,8 @@ function installLaunchd(opts) {
|
|
|
168662
168894
|
</dict>
|
|
168663
168895
|
</plist>
|
|
168664
168896
|
`;
|
|
168665
|
-
writeFileEnsureDir(
|
|
168666
|
-
|
|
168897
|
+
writeFileEnsureDir(path30.join(launchDir, `${label}.plist`), plist);
|
|
168898
|
+
execSync4(`launchctl load ${path30.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
168667
168899
|
}
|
|
168668
168900
|
console.log("[service] launchd agents installed and loaded.");
|
|
168669
168901
|
}
|
|
@@ -168677,7 +168909,7 @@ async function serviceInstallCommand(options) {
|
|
|
168677
168909
|
const platform2 = process.platform;
|
|
168678
168910
|
console.log(`[service] detected platform: ${platform2}`);
|
|
168679
168911
|
if (platform2 === "linux") {
|
|
168680
|
-
if (!
|
|
168912
|
+
if (!fs25.existsSync("/run/systemd/system") && !fs25.existsSync("/etc/systemd/system")) {
|
|
168681
168913
|
console.error("[service] systemd not detected \u2014 cannot install service automatically.");
|
|
168682
168914
|
console.error(" Start manually: matrixos dashboard --host 0.0.0.0 --daemon");
|
|
168683
168915
|
return 1;
|
|
@@ -190384,6 +190616,43 @@ Examples:
|
|
|
190384
190616
|
process.stdout.write(result.stdout);
|
|
190385
190617
|
process.exit(result.exitCode);
|
|
190386
190618
|
});
|
|
190619
|
+
var prepare = program2.command("prepare").description("Prepare a pull request WITHOUT submitting (draft by default; --apply to create)").option("-t, --title <text>", "PR title").option("-b, --body <text>", "PR body").option("--base <branch>", "Base branch", "main").option("--no-draft", "Open as ready PR (default is draft)").option("--apply", "Actually create the branch/commit/PR (default dry-run)").option("--json", "Output as JSON").addHelpText("after", `
|
|
190620
|
+
Examples:
|
|
190621
|
+
$ matrixos prepare # dry-run: show what would happen
|
|
190622
|
+
$ matrixos prepare --apply # create draft PR on main
|
|
190623
|
+
$ matrixos prepare --apply --title "Fix X" --no-draft
|
|
190624
|
+
`).action(async (options) => {
|
|
190625
|
+
const { preparePr: preparePr2 } = await Promise.resolve().then(() => (init_prepare(), exports_prepare));
|
|
190626
|
+
const code = preparePr2({
|
|
190627
|
+
title: options.title,
|
|
190628
|
+
body: options.body,
|
|
190629
|
+
base: options.base,
|
|
190630
|
+
draft: options.draft ?? true,
|
|
190631
|
+
apply: options.apply ?? false,
|
|
190632
|
+
json: options.json ?? false
|
|
190633
|
+
});
|
|
190634
|
+
process.exit(code);
|
|
190635
|
+
});
|
|
190636
|
+
prepare.command("submit <pr>").description("Mark a prepared PR as ready (human validation gate)").option("--json", "Output as JSON").action(async (pr, options) => {
|
|
190637
|
+
const { submitPr: submitPr2 } = await Promise.resolve().then(() => (init_prepare(), exports_prepare));
|
|
190638
|
+
const code = submitPr2({ pr, json: options.json ?? false });
|
|
190639
|
+
process.exit(code);
|
|
190640
|
+
});
|
|
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
|
+
});
|
|
190387
190656
|
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) => {
|
|
190388
190657
|
if (action !== "install" && action !== "uninstall") {
|
|
190389
190658
|
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.
|
|
368089
|
+
version: "0.3.53",
|
|
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