@kl-c/matrixos 0.3.53 → 0.3.55
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 +219 -210
- package/dist/cli-node/index.js +219 -210
- package/dist/features/dashboard/frontend/js/api.js +15 -3
- package/dist/features/dashboard/server.d.ts +2 -0
- 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.55",
|
|
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((
|
|
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
|
-
|
|
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((
|
|
167290
|
+
const answer = await new Promise((resolve21) => {
|
|
167144
167291
|
rl.question(`${question}${d}: `, (a2) => {
|
|
167145
167292
|
rl.close();
|
|
167146
|
-
|
|
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((
|
|
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
|
-
|
|
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
|
|
167347
|
-
import { join as
|
|
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 =
|
|
167551
|
+
skillDir = join86(process.cwd(), ".opencode", "skills");
|
|
167405
167552
|
} else {
|
|
167406
167553
|
const dirs = getOpenCodeSkillDirs({ binary: "opencode" });
|
|
167407
|
-
skillDir = dirs[0] ??
|
|
167554
|
+
skillDir = dirs[0] ?? join86(getHomeDirectory(), ".config", "opencode", "skills");
|
|
167408
167555
|
}
|
|
167409
|
-
const skillPath =
|
|
167410
|
-
const skillFile =
|
|
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 (!
|
|
167425
|
-
|
|
167426
|
-
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
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
|
|
167575
|
-
import { resolve as
|
|
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(
|
|
167586
|
-
if (!
|
|
167732
|
+
function loadGatewayEnv(path30 = ENV_PATH) {
|
|
167733
|
+
if (!existsSync80(path30))
|
|
167587
167734
|
return {};
|
|
167588
|
-
const text = readFileSync64(
|
|
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 =
|
|
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
|
|
167737
|
-
import { resolve as
|
|
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((
|
|
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) =>
|
|
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 =
|
|
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 (!
|
|
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((
|
|
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) =>
|
|
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((
|
|
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) =>
|
|
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
|
|
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 =
|
|
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
|
|
168070
|
-
import { join as
|
|
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
|
|
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
|
-
|
|
168180
|
-
const
|
|
168181
|
-
|
|
168182
|
-
return
|
|
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
|
|
168228
|
-
return { ok: true, path:
|
|
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, {
|
|
@@ -189419,6 +189419,16 @@ function createDashboardServer(dataProvider, config5) {
|
|
|
189419
189419
|
if (req.method === "OPTIONS") {
|
|
189420
189420
|
return new Response(null, { headers: corsHeaders });
|
|
189421
189421
|
}
|
|
189422
|
+
if (config5.dashboardPassphrase) {
|
|
189423
|
+
const isHealth = path25 === "/api/health";
|
|
189424
|
+
const isGatewayToken = path25 === "/api/gateway/token";
|
|
189425
|
+
if (path25.startsWith("/api/") && !isHealth && !isGatewayToken) {
|
|
189426
|
+
const provided = req.headers.get("x-passphrase");
|
|
189427
|
+
if (!provided || provided !== config5.dashboardPassphrase) {
|
|
189428
|
+
return Response.json({ error: "Unauthorized \u2014 dashboard passphrase required" }, { status: 401, headers: corsHeaders });
|
|
189429
|
+
}
|
|
189430
|
+
}
|
|
189431
|
+
}
|
|
189422
189432
|
if (path25.startsWith("/api/")) {
|
|
189423
189433
|
if (path25 === "/api/logs/stream") {
|
|
189424
189434
|
const headers = new Headers({
|
|
@@ -189696,7 +189706,7 @@ async function dashboardCli(options) {
|
|
|
189696
189706
|
console.log(`[dashboard] frontend: ${frontendDir}`);
|
|
189697
189707
|
try {
|
|
189698
189708
|
const dataProvider = createDataProvider();
|
|
189699
|
-
const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase });
|
|
189709
|
+
const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase, dashboardPassphrase: gatewayPassphrase });
|
|
189700
189710
|
server2.start();
|
|
189701
189711
|
console.log(`[dashboard] ready \u2014 http://${host}:${port3}`);
|
|
189702
189712
|
if (!options.daemon) {
|
|
@@ -190312,6 +190322,20 @@ project.command("add-doc <slug> <file>").description("Copy a document into the p
|
|
|
190312
190322
|
process.stdout.write(JSON.stringify({ ok: true, dest }, null, 2) + `
|
|
190313
190323
|
`);
|
|
190314
190324
|
});
|
|
190325
|
+
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", `
|
|
190326
|
+
Examples:
|
|
190327
|
+
$ matrixos project init my-app # dry-run
|
|
190328
|
+
$ matrixos project init my-app --apply # write files
|
|
190329
|
+
`).action(async (name2, options) => {
|
|
190330
|
+
const { projectInit: projectInit2 } = await Promise.resolve().then(() => (init_project_init(), exports_project_init));
|
|
190331
|
+
const code = projectInit2({
|
|
190332
|
+
name: name2,
|
|
190333
|
+
path: options.path,
|
|
190334
|
+
apply: options.apply ?? false,
|
|
190335
|
+
json: options.json ?? false
|
|
190336
|
+
});
|
|
190337
|
+
process.exit(code);
|
|
190338
|
+
});
|
|
190315
190339
|
var gateway2 = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
|
|
190316
190340
|
var gatewayAdopt = gateway2.command("adopt").description("Adopt a gateway channel (Telegram, Discord, WhatsApp)");
|
|
190317
190341
|
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 +190607,6 @@ prepare.command("submit <pr>").description("Mark a prepared PR as ready (human v
|
|
|
190583
190607
|
const code = submitPr2({ pr, json: options.json ?? false });
|
|
190584
190608
|
process.exit(code);
|
|
190585
190609
|
});
|
|
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
190610
|
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
190611
|
if (action !== "install" && action !== "uninstall") {
|
|
190603
190612
|
console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
|