@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-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.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",
|
|
@@ -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((
|
|
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
|
-
|
|
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((
|
|
167345
|
+
const answer = await new Promise((resolve21) => {
|
|
167199
167346
|
rl.question(`${question}${d}: `, (a2) => {
|
|
167200
167347
|
rl.close();
|
|
167201
|
-
|
|
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((
|
|
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
|
-
|
|
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
|
|
167402
|
-
import { join as
|
|
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 =
|
|
167606
|
+
skillDir = join86(process.cwd(), ".opencode", "skills");
|
|
167460
167607
|
} else {
|
|
167461
167608
|
const dirs = getOpenCodeSkillDirs({ binary: "opencode" });
|
|
167462
|
-
skillDir = dirs[0] ??
|
|
167609
|
+
skillDir = dirs[0] ?? join86(getHomeDirectory(), ".config", "opencode", "skills");
|
|
167463
167610
|
}
|
|
167464
|
-
const skillPath =
|
|
167465
|
-
const skillFile =
|
|
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 (!
|
|
167480
|
-
|
|
167481
|
-
|
|
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((
|
|
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
|
-
|
|
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((
|
|
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
|
-
|
|
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
|
|
167630
|
-
import { resolve as
|
|
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(
|
|
167641
|
-
if (!
|
|
167787
|
+
function loadGatewayEnv(path30 = ENV_PATH) {
|
|
167788
|
+
if (!existsSync80(path30))
|
|
167642
167789
|
return {};
|
|
167643
|
-
const text = readFileSync64(
|
|
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 =
|
|
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
|
|
167792
|
-
import { resolve as
|
|
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((
|
|
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) =>
|
|
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 =
|
|
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 (!
|
|
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((
|
|
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) =>
|
|
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((
|
|
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) =>
|
|
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
|
|
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 =
|
|
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
|
|
168125
|
-
import { join as
|
|
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
|
|
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
|
-
|
|
168235
|
-
const
|
|
168236
|
-
|
|
168237
|
-
return
|
|
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
|
|
168283
|
-
return { ok: true, path:
|
|
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, {
|
|
@@ -189474,6 +189474,16 @@ function createDashboardServer(dataProvider, config5) {
|
|
|
189474
189474
|
if (req.method === "OPTIONS") {
|
|
189475
189475
|
return new Response(null, { headers: corsHeaders });
|
|
189476
189476
|
}
|
|
189477
|
+
if (config5.dashboardPassphrase) {
|
|
189478
|
+
const isHealth = path25 === "/api/health";
|
|
189479
|
+
const isGatewayToken = path25 === "/api/gateway/token";
|
|
189480
|
+
if (path25.startsWith("/api/") && !isHealth && !isGatewayToken) {
|
|
189481
|
+
const provided = req.headers.get("x-passphrase");
|
|
189482
|
+
if (!provided || provided !== config5.dashboardPassphrase) {
|
|
189483
|
+
return Response.json({ error: "Unauthorized \u2014 dashboard passphrase required" }, { status: 401, headers: corsHeaders });
|
|
189484
|
+
}
|
|
189485
|
+
}
|
|
189486
|
+
}
|
|
189477
189487
|
if (path25.startsWith("/api/")) {
|
|
189478
189488
|
if (path25 === "/api/logs/stream") {
|
|
189479
189489
|
const headers = new Headers({
|
|
@@ -189751,7 +189761,7 @@ async function dashboardCli(options) {
|
|
|
189751
189761
|
console.log(`[dashboard] frontend: ${frontendDir}`);
|
|
189752
189762
|
try {
|
|
189753
189763
|
const dataProvider = createDataProvider();
|
|
189754
|
-
const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase });
|
|
189764
|
+
const server2 = createDashboardServer(dataProvider, { port: port3, host, frontendDir, gatewayPassphrase, dashboardPassphrase: gatewayPassphrase });
|
|
189755
189765
|
server2.start();
|
|
189756
189766
|
console.log(`[dashboard] ready \u2014 http://${host}:${port3}`);
|
|
189757
189767
|
if (!options.daemon) {
|
|
@@ -190367,6 +190377,20 @@ project.command("add-doc <slug> <file>").description("Copy a document into the p
|
|
|
190367
190377
|
process.stdout.write(JSON.stringify({ ok: true, dest }, null, 2) + `
|
|
190368
190378
|
`);
|
|
190369
190379
|
});
|
|
190380
|
+
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", `
|
|
190381
|
+
Examples:
|
|
190382
|
+
$ matrixos project init my-app # dry-run
|
|
190383
|
+
$ matrixos project init my-app --apply # write files
|
|
190384
|
+
`).action(async (name2, options) => {
|
|
190385
|
+
const { projectInit: projectInit2 } = await Promise.resolve().then(() => (init_project_init(), exports_project_init));
|
|
190386
|
+
const code = projectInit2({
|
|
190387
|
+
name: name2,
|
|
190388
|
+
path: options.path,
|
|
190389
|
+
apply: options.apply ?? false,
|
|
190390
|
+
json: options.json ?? false
|
|
190391
|
+
});
|
|
190392
|
+
process.exit(code);
|
|
190393
|
+
});
|
|
190370
190394
|
var gateway2 = program2.command("gateway").description("Gateway configuration \u2014 bot token management");
|
|
190371
190395
|
var gatewayAdopt = gateway2.command("adopt").description("Adopt a gateway channel (Telegram, Discord, WhatsApp)");
|
|
190372
190396
|
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 +190662,6 @@ prepare.command("submit <pr>").description("Mark a prepared PR as ready (human v
|
|
|
190638
190662
|
const code = submitPr2({ pr, json: options.json ?? false });
|
|
190639
190663
|
process.exit(code);
|
|
190640
190664
|
});
|
|
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
190665
|
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
190666
|
if (action !== "install" && action !== "uninstall") {
|
|
190658
190667
|
console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
|
|
@@ -22,8 +22,20 @@ const API={
|
|
|
22
22
|
cronRemove:(id)=>fetchJSON(`/cron?id=${encodeURIComponent(id)}`,{method:'DELETE'}),
|
|
23
23
|
gatewayToken:(type,token,passphrase)=>fetch('/api/gateway/token',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({type,token,passphrase})}).then(r=>r.json())
|
|
24
24
|
}
|
|
25
|
-
async function fetchJSON(e,opts){
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
async function fetchJSON(e, opts) {
|
|
26
|
+
opts = opts || {}
|
|
27
|
+
opts.headers = Object.assign({ "x-passphrase": localStorage.getItem("matrixos_dashboard_passphrase") || "" }, opts.headers || {})
|
|
28
|
+
const r = await fetch(`/api${e}`, opts)
|
|
29
|
+
if (r.status === 401) {
|
|
30
|
+
const tried = localStorage.getItem("matrixos_dashboard_passphrase")
|
|
31
|
+
if (!tried) {
|
|
32
|
+
const p = prompt("Dashboard passphrase required:")
|
|
33
|
+
if (p) {
|
|
34
|
+
localStorage.setItem("matrixos_dashboard_passphrase", p)
|
|
35
|
+
return fetchJSON(e, opts)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!r.ok) throw new Error(`API ${e}: ${r.status}`)
|
|
28
40
|
return r.json()
|
|
29
41
|
}
|