@kl-c/matrixos 0.1.4 → 0.1.6
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/architect.d.ts +16 -0
- package/dist/cli/index.js +284 -107
- package/dist/cli-node/index.js +284 -107
- package/dist/index.js +1433 -1198
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2145,7 +2145,7 @@ var package_default;
|
|
|
2145
2145
|
var init_package = __esm(() => {
|
|
2146
2146
|
package_default = {
|
|
2147
2147
|
name: "@kl-c/matrixos",
|
|
2148
|
-
version: "0.1.
|
|
2148
|
+
version: "0.1.6",
|
|
2149
2149
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2150
2150
|
main: "./dist/index.js",
|
|
2151
2151
|
types: "dist/index.d.ts",
|
|
@@ -117554,19 +117554,19 @@ __export(exports_generate, {
|
|
|
117554
117554
|
executeGenerateCommand: () => executeGenerateCommand,
|
|
117555
117555
|
ProfileNotFoundError: () => ProfileNotFoundError
|
|
117556
117556
|
});
|
|
117557
|
-
import { existsSync as
|
|
117558
|
-
import { dirname as dirname28, isAbsolute as isAbsolute6, join as
|
|
117557
|
+
import { existsSync as existsSync69, readFileSync as readFileSync54, realpathSync as realpathSync10 } from "fs";
|
|
117558
|
+
import { dirname as dirname28, isAbsolute as isAbsolute6, join as join74, resolve as resolve16 } from "path";
|
|
117559
117559
|
function profilesDirFor(opts) {
|
|
117560
117560
|
if (opts.profilesDir)
|
|
117561
117561
|
return opts.profilesDir;
|
|
117562
117562
|
if (opts.cwd)
|
|
117563
|
-
return
|
|
117564
|
-
return
|
|
117563
|
+
return join74(opts.cwd, PROFILES_RELATIVE);
|
|
117564
|
+
return join74(REPO_ROOT, PROFILES_RELATIVE);
|
|
117565
117565
|
}
|
|
117566
117566
|
function loadProfile(name2, options = {}) {
|
|
117567
117567
|
const fs21 = options.fs ?? defaultFS2;
|
|
117568
117568
|
const dir = profilesDirFor(options);
|
|
117569
|
-
const path27 =
|
|
117569
|
+
const path27 = join74(dir, `${name2}.json`);
|
|
117570
117570
|
if (!fs21.existsSync(path27)) {
|
|
117571
117571
|
throw new ProfileNotFoundError(name2);
|
|
117572
117572
|
}
|
|
@@ -117579,7 +117579,7 @@ function listProfiles(options = {}) {
|
|
|
117579
117579
|
const known = options.knownNames ?? ["trader", "plumber"];
|
|
117580
117580
|
const out = [];
|
|
117581
117581
|
for (const name2 of known) {
|
|
117582
|
-
const path27 =
|
|
117582
|
+
const path27 = join74(dir, `${name2}.json`);
|
|
117583
117583
|
if (fs21.existsSync(path27)) {
|
|
117584
117584
|
try {
|
|
117585
117585
|
const raw = JSON.parse(fs21.readFileSync(path27, "utf-8"));
|
|
@@ -117652,7 +117652,7 @@ var init_generate = __esm(() => {
|
|
|
117652
117652
|
init_src4();
|
|
117653
117653
|
init_src4();
|
|
117654
117654
|
REPO_ROOT = resolve16(dirname28(new URL(import.meta.url).pathname), "..", "..", "..", "..", "..");
|
|
117655
|
-
defaultFS2 = { existsSync:
|
|
117655
|
+
defaultFS2 = { existsSync: existsSync69, readFileSync: readFileSync54, realpathSync: realpathSync10 };
|
|
117656
117656
|
ProfileNotFoundError = class ProfileNotFoundError extends Error {
|
|
117657
117657
|
profileName;
|
|
117658
117658
|
constructor(profileName) {
|
|
@@ -117669,12 +117669,12 @@ __export(exports_cost_report, {
|
|
|
117669
117669
|
executeCostReportCommand: () => executeCostReportCommand
|
|
117670
117670
|
});
|
|
117671
117671
|
import { Database as Database6 } from "bun:sqlite";
|
|
117672
|
-
import { existsSync as
|
|
117672
|
+
import { existsSync as existsSync70 } from "fs";
|
|
117673
117673
|
import * as path27 from "path";
|
|
117674
117674
|
import * as os13 from "os";
|
|
117675
117675
|
function executeCostReportCommand(args) {
|
|
117676
117676
|
const dbPath = path27.join(os13.homedir(), ".matrixos", "cost.db");
|
|
117677
|
-
if (!
|
|
117677
|
+
if (!existsSync70(dbPath)) {
|
|
117678
117678
|
return { exitCode: 1, stdout: `No cost data available
|
|
117679
117679
|
` };
|
|
117680
117680
|
}
|
|
@@ -117804,8 +117804,8 @@ var exports_profile_resolve = {};
|
|
|
117804
117804
|
__export(exports_profile_resolve, {
|
|
117805
117805
|
executeProfileResolveCommand: () => executeProfileResolveCommand
|
|
117806
117806
|
});
|
|
117807
|
-
import { existsSync as
|
|
117808
|
-
import { join as
|
|
117807
|
+
import { existsSync as existsSync71, readdirSync as readdirSync15, readFileSync as readFileSync55 } from "fs";
|
|
117808
|
+
import { join as join76, resolve as resolve17, dirname as dirname29 } from "path";
|
|
117809
117809
|
function executeProfileResolveCommand(args) {
|
|
117810
117810
|
if (args.options.help) {
|
|
117811
117811
|
return {
|
|
@@ -117830,8 +117830,8 @@ function executeProfileResolveCommand(args) {
|
|
|
117830
117830
|
` };
|
|
117831
117831
|
}
|
|
117832
117832
|
const name2 = nameRaw.endsWith(".json") ? nameRaw.slice(0, -5) : nameRaw;
|
|
117833
|
-
const profilesDir =
|
|
117834
|
-
if (!
|
|
117833
|
+
const profilesDir = join76(REPO_ROOT2, PROFILES_RELATIVE2);
|
|
117834
|
+
if (!existsSync71(profilesDir)) {
|
|
117835
117835
|
return { exitCode: 1, stdout: `error: profiles directory not found at ${profilesDir}
|
|
117836
117836
|
` };
|
|
117837
117837
|
}
|
|
@@ -117850,8 +117850,8 @@ function executeProfileResolveCommand(args) {
|
|
|
117850
117850
|
const registry2 = {};
|
|
117851
117851
|
for (const file3 of profileFiles) {
|
|
117852
117852
|
try {
|
|
117853
|
-
const filePath =
|
|
117854
|
-
const raw = JSON.parse(
|
|
117853
|
+
const filePath = join76(profilesDir, file3);
|
|
117854
|
+
const raw = JSON.parse(readFileSync55(filePath, "utf-8"));
|
|
117855
117855
|
const profile2 = ProfileSchema.parse(raw);
|
|
117856
117856
|
registry2[profile2.name] = profile2;
|
|
117857
117857
|
} catch {}
|
|
@@ -117913,8 +117913,8 @@ __export(exports_export, {
|
|
|
117913
117913
|
getShell: () => getShell,
|
|
117914
117914
|
executeExportCommand: () => executeExportCommand
|
|
117915
117915
|
});
|
|
117916
|
-
import { existsSync as
|
|
117917
|
-
import { isAbsolute as isAbsolute7, join as
|
|
117916
|
+
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync24, copyFileSync as copyFileSync7, realpathSync as realpathSync11, mkdirSync as mkdirSync25 } from "fs";
|
|
117917
|
+
import { isAbsolute as isAbsolute7, join as join77, resolve as resolve18, dirname as dirname30 } from "path";
|
|
117918
117918
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
117919
117919
|
function setShell(shell) {
|
|
117920
117920
|
activeShell = shell;
|
|
@@ -117955,7 +117955,7 @@ function executeExportCommand(args) {
|
|
|
117955
117955
|
return { exitCode: 1, stdout: `error: generate failed: ${message}
|
|
117956
117956
|
` };
|
|
117957
117957
|
}
|
|
117958
|
-
const pkgPath =
|
|
117958
|
+
const pkgPath = join77(absoluteTargetDir, "package.json");
|
|
117959
117959
|
let pkg;
|
|
117960
117960
|
try {
|
|
117961
117961
|
pkg = JSON.parse(fs21.readFileSync(pkgPath, "utf-8"));
|
|
@@ -117995,7 +117995,7 @@ ${packResult.stdout}
|
|
|
117995
117995
|
return { exitCode: 1, stdout: `error: npm pack produced no tarball name in output
|
|
117996
117996
|
` };
|
|
117997
117997
|
}
|
|
117998
|
-
let tgzPath =
|
|
117998
|
+
let tgzPath = join77(absoluteTargetDir, tgzName);
|
|
117999
117999
|
if (args.options.output) {
|
|
118000
118000
|
const outputPath = args.options.output;
|
|
118001
118001
|
const absoluteOutput = isAbsolute7(outputPath) ? outputPath : resolve18(process.cwd(), outputPath);
|
|
@@ -118036,12 +118036,12 @@ var init_export = __esm(() => {
|
|
|
118036
118036
|
};
|
|
118037
118037
|
activeShell = defaultShell;
|
|
118038
118038
|
defaultExportFS = {
|
|
118039
|
-
existsSync:
|
|
118040
|
-
readFileSync:
|
|
118041
|
-
writeFileSync:
|
|
118039
|
+
existsSync: existsSync72,
|
|
118040
|
+
readFileSync: readFileSync56,
|
|
118041
|
+
writeFileSync: writeFileSync24,
|
|
118042
118042
|
copyFileSync: copyFileSync7,
|
|
118043
118043
|
realpathSync: realpathSync11,
|
|
118044
|
-
mkdirSync:
|
|
118044
|
+
mkdirSync: mkdirSync25
|
|
118045
118045
|
};
|
|
118046
118046
|
});
|
|
118047
118047
|
|
|
@@ -135288,6 +135288,63 @@ function formatSearchResults(result) {
|
|
|
135288
135288
|
`);
|
|
135289
135289
|
}
|
|
135290
135290
|
|
|
135291
|
+
// packages/learning-loop/src/improvement.ts
|
|
135292
|
+
import { existsSync as existsSync57, mkdirSync as mkdirSync16, readFileSync as readFileSync45, writeFileSync as writeFileSync14 } from "fs";
|
|
135293
|
+
import { join as join52, basename as basename10 } from "path";
|
|
135294
|
+
function createImprovementStore(improvementsDir) {
|
|
135295
|
+
if (!existsSync57(improvementsDir)) {
|
|
135296
|
+
mkdirSync16(improvementsDir, { recursive: true });
|
|
135297
|
+
}
|
|
135298
|
+
function save(improvement) {
|
|
135299
|
+
const filePath = join52(improvementsDir, `${improvement.id}.json`);
|
|
135300
|
+
writeFileSync14(filePath, JSON.stringify(improvement, null, 2), "utf-8");
|
|
135301
|
+
}
|
|
135302
|
+
function list() {
|
|
135303
|
+
const files = [];
|
|
135304
|
+
try {
|
|
135305
|
+
const entries = readdirSyncSafe(improvementsDir) ?? [];
|
|
135306
|
+
for (const entry of entries) {
|
|
135307
|
+
if (entry.endsWith(".json"))
|
|
135308
|
+
files.push(entry);
|
|
135309
|
+
}
|
|
135310
|
+
} catch {
|
|
135311
|
+
return [];
|
|
135312
|
+
}
|
|
135313
|
+
files.sort().reverse();
|
|
135314
|
+
return files.map((f2) => get(basename10(f2, ".json"))).filter((i3) => i3 !== null);
|
|
135315
|
+
}
|
|
135316
|
+
function get(id) {
|
|
135317
|
+
const filePath = join52(improvementsDir, `${id}.json`);
|
|
135318
|
+
try {
|
|
135319
|
+
const raw = readFileSync45(filePath, "utf-8");
|
|
135320
|
+
return JSON.parse(raw);
|
|
135321
|
+
} catch {
|
|
135322
|
+
return null;
|
|
135323
|
+
}
|
|
135324
|
+
}
|
|
135325
|
+
function updateStatus(id, status2, metadata) {
|
|
135326
|
+
const existing = get(id);
|
|
135327
|
+
if (!existing)
|
|
135328
|
+
return null;
|
|
135329
|
+
const updated = {
|
|
135330
|
+
...existing,
|
|
135331
|
+
...metadata,
|
|
135332
|
+
status: status2
|
|
135333
|
+
};
|
|
135334
|
+
save(updated);
|
|
135335
|
+
return updated;
|
|
135336
|
+
}
|
|
135337
|
+
return { save, list, get, updateStatus };
|
|
135338
|
+
}
|
|
135339
|
+
function readdirSyncSafe(dir) {
|
|
135340
|
+
try {
|
|
135341
|
+
const { readdirSync: readdirSync10 } = __require("fs");
|
|
135342
|
+
return readdirSync10(dir);
|
|
135343
|
+
} catch {
|
|
135344
|
+
return;
|
|
135345
|
+
}
|
|
135346
|
+
}
|
|
135347
|
+
|
|
135291
135348
|
// packages/omo-opencode/src/cli/apply-learnings.ts
|
|
135292
135349
|
import * as nodeFs2 from "fs";
|
|
135293
135350
|
import * as nodePath from "path";
|
|
@@ -135330,7 +135387,7 @@ async function applyLearningsCli(options = {}) {
|
|
|
135330
135387
|
}
|
|
135331
135388
|
|
|
135332
135389
|
// packages/omo-opencode/src/cli/boulder/boulder.ts
|
|
135333
|
-
import { existsSync as
|
|
135390
|
+
import { existsSync as existsSync59 } from "fs";
|
|
135334
135391
|
|
|
135335
135392
|
// packages/omo-opencode/src/cli/boulder/formatter.ts
|
|
135336
135393
|
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
@@ -135467,10 +135524,10 @@ async function boulder(options) {
|
|
|
135467
135524
|
const boulderFilePath = getBoulderFilePath(directory);
|
|
135468
135525
|
const state2 = readBoulderState(directory);
|
|
135469
135526
|
if (!state2) {
|
|
135470
|
-
const message =
|
|
135527
|
+
const message = existsSync59(boulderFilePath) ? formatReadErrorMessage(options.json) : formatNoBoulderMessage(options.json);
|
|
135471
135528
|
process.stderr.write(`${message}
|
|
135472
135529
|
`);
|
|
135473
|
-
return
|
|
135530
|
+
return existsSync59(boulderFilePath) ? 2 : 1;
|
|
135474
135531
|
}
|
|
135475
135532
|
const works = getBoulderWorks(state2);
|
|
135476
135533
|
const filteredWorks = options.workId ? works.filter((work) => work.work_id === options.workId) : works;
|
|
@@ -136397,25 +136454,25 @@ async function refreshModelCapabilities(options, deps = {}) {
|
|
|
136397
136454
|
}
|
|
136398
136455
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loader.ts
|
|
136399
136456
|
init_src();
|
|
136400
|
-
import { join as
|
|
136457
|
+
import { join as join61 } from "path";
|
|
136401
136458
|
|
|
136402
136459
|
// packages/skills-loader-core/src/shared/claude-config-dir.ts
|
|
136403
136460
|
init_src();
|
|
136404
|
-
import { join as
|
|
136461
|
+
import { join as join55 } from "path";
|
|
136405
136462
|
function getClaudeConfigDir() {
|
|
136406
136463
|
const envConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
136407
136464
|
if (envConfigDir) {
|
|
136408
136465
|
return envConfigDir;
|
|
136409
136466
|
}
|
|
136410
|
-
return
|
|
136467
|
+
return join55(getHomeDirectory(), ".claude");
|
|
136411
136468
|
}
|
|
136412
136469
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
136413
|
-
import { basename as
|
|
136470
|
+
import { basename as basename11, dirname as dirname22, join as join57 } from "path";
|
|
136414
136471
|
|
|
136415
136472
|
// packages/skills-loader-core/src/shared/opencode-config-dir.ts
|
|
136416
|
-
import { existsSync as
|
|
136473
|
+
import { existsSync as existsSync61, realpathSync as realpathSync8 } from "fs";
|
|
136417
136474
|
import { homedir as homedir20 } from "os";
|
|
136418
|
-
import { join as
|
|
136475
|
+
import { join as join56, posix as posix5, resolve as resolve12, win32 as win325 } from "path";
|
|
136419
136476
|
|
|
136420
136477
|
// packages/skills-loader-core/src/shared/plugin-identity.ts
|
|
136421
136478
|
init_src();
|
|
@@ -136448,15 +136505,15 @@ function getTauriConfigDir2(identifier) {
|
|
|
136448
136505
|
const platform2 = process.platform;
|
|
136449
136506
|
switch (platform2) {
|
|
136450
136507
|
case "darwin":
|
|
136451
|
-
return
|
|
136508
|
+
return join56(homedir20(), "Library", "Application Support", identifier);
|
|
136452
136509
|
case "win32": {
|
|
136453
|
-
const appData = process.env.APPDATA ||
|
|
136510
|
+
const appData = process.env.APPDATA || join56(homedir20(), "AppData", "Roaming");
|
|
136454
136511
|
return win325.join(appData, identifier);
|
|
136455
136512
|
}
|
|
136456
136513
|
case "linux":
|
|
136457
136514
|
default: {
|
|
136458
|
-
const xdgConfig = process.env.XDG_CONFIG_HOME ||
|
|
136459
|
-
return
|
|
136515
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join56(homedir20(), ".config");
|
|
136516
|
+
return join56(xdgConfig, identifier);
|
|
136460
136517
|
}
|
|
136461
136518
|
}
|
|
136462
136519
|
}
|
|
@@ -136465,7 +136522,7 @@ function resolveConfigPath3(pathValue) {
|
|
|
136465
136522
|
return posix5.normalize(pathValue);
|
|
136466
136523
|
}
|
|
136467
136524
|
const resolvedPath = resolve12(pathValue);
|
|
136468
|
-
if (!
|
|
136525
|
+
if (!existsSync61(resolvedPath))
|
|
136469
136526
|
return resolvedPath;
|
|
136470
136527
|
try {
|
|
136471
136528
|
return realpathSync8(resolvedPath);
|
|
@@ -136499,8 +136556,8 @@ function getWslLinuxHomeDir2(windowsConfigRoot) {
|
|
|
136499
136556
|
function getCliDefaultConfigDir2() {
|
|
136500
136557
|
const envXdgConfig = process.env.XDG_CONFIG_HOME?.trim();
|
|
136501
136558
|
const shouldIgnoreWindowsXdg = envXdgConfig !== undefined && envXdgConfig.length > 0 && isWslEnvironment2() && isWindowsUserConfigRoot2(envXdgConfig);
|
|
136502
|
-
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig ||
|
|
136503
|
-
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") :
|
|
136559
|
+
const xdgConfig = shouldIgnoreWindowsXdg ? posix5.join(getWslLinuxHomeDir2(envXdgConfig) ?? "/home", ".config") : envXdgConfig || join56(homedir20(), ".config");
|
|
136560
|
+
const configDir = isWslEnvironment2() ? posix5.join(xdgConfig, "opencode") : join56(xdgConfig, "opencode");
|
|
136504
136561
|
return resolveConfigPath3(configDir);
|
|
136505
136562
|
}
|
|
136506
136563
|
function getCliCustomConfigDir2() {
|
|
@@ -136533,9 +136590,9 @@ function getOpenCodeConfigDir2(options) {
|
|
|
136533
136590
|
const tauriDir = process.platform === "win32" ? win325.isAbsolute(tauriDirBase) ? win325.normalize(tauriDirBase) : win325.resolve(tauriDirBase) : resolveConfigPath3(tauriDirBase);
|
|
136534
136591
|
if (checkExisting) {
|
|
136535
136592
|
const legacyDir = getCliConfigDir2();
|
|
136536
|
-
const legacyConfig =
|
|
136537
|
-
const legacyConfigC =
|
|
136538
|
-
if (
|
|
136593
|
+
const legacyConfig = join56(legacyDir, "opencode.json");
|
|
136594
|
+
const legacyConfigC = join56(legacyDir, "opencode.jsonc");
|
|
136595
|
+
if (existsSync61(legacyConfig) || existsSync61(legacyConfigC)) {
|
|
136539
136596
|
return legacyDir;
|
|
136540
136597
|
}
|
|
136541
136598
|
}
|
|
@@ -136545,7 +136602,7 @@ function getOpenCodeConfigDir2(options) {
|
|
|
136545
136602
|
// packages/skills-loader-core/src/shared/opencode-command-dirs.ts
|
|
136546
136603
|
function getParentOpencodeConfigDir(configDir) {
|
|
136547
136604
|
const parentDir = dirname22(configDir);
|
|
136548
|
-
if (
|
|
136605
|
+
if (basename11(parentDir) !== "profiles") {
|
|
136549
136606
|
return null;
|
|
136550
136607
|
}
|
|
136551
136608
|
return dirname22(parentDir);
|
|
@@ -136556,21 +136613,21 @@ function getOpenCodeSkillDirs(options) {
|
|
|
136556
136613
|
...configDirs.flatMap((configDir) => {
|
|
136557
136614
|
const parentConfigDir = getParentOpencodeConfigDir(configDir);
|
|
136558
136615
|
return [
|
|
136559
|
-
|
|
136560
|
-
|
|
136561
|
-
...parentConfigDir ? [
|
|
136616
|
+
join57(configDir, "skills"),
|
|
136617
|
+
join57(configDir, "skill"),
|
|
136618
|
+
...parentConfigDir ? [join57(parentConfigDir, "skills"), join57(parentConfigDir, "skill")] : []
|
|
136562
136619
|
];
|
|
136563
136620
|
})
|
|
136564
136621
|
]));
|
|
136565
136622
|
}
|
|
136566
136623
|
// packages/skills-loader-core/src/shared/project-discovery-dirs.ts
|
|
136567
136624
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
136568
|
-
import { existsSync as
|
|
136569
|
-
import { dirname as dirname23, join as
|
|
136625
|
+
import { existsSync as existsSync62, realpathSync as realpathSync9 } from "fs";
|
|
136626
|
+
import { dirname as dirname23, join as join58, resolve as resolve13, win32 as win326 } from "path";
|
|
136570
136627
|
var worktreePathCache2 = new Map;
|
|
136571
136628
|
function normalizePath2(path18) {
|
|
136572
136629
|
const resolvedPath = process.platform !== "win32" && win326.isAbsolute(path18) ? path18 : resolve13(path18);
|
|
136573
|
-
if (!
|
|
136630
|
+
if (!existsSync62(resolvedPath)) {
|
|
136574
136631
|
return resolvedPath;
|
|
136575
136632
|
}
|
|
136576
136633
|
try {
|
|
@@ -136601,8 +136658,8 @@ function findAncestorDirectories(startDirectory, targetPaths, stopDirectory) {
|
|
|
136601
136658
|
const stopDirectoryKey = resolvedStopDirectory ? pathKey2(resolvedStopDirectory) : undefined;
|
|
136602
136659
|
while (true) {
|
|
136603
136660
|
for (const targetPath of targetPaths) {
|
|
136604
|
-
const candidateDirectory =
|
|
136605
|
-
if (!
|
|
136661
|
+
const candidateDirectory = join58(currentDirectory, ...targetPath);
|
|
136662
|
+
if (!existsSync62(candidateDirectory)) {
|
|
136606
136663
|
continue;
|
|
136607
136664
|
}
|
|
136608
136665
|
const normalizedCandidateDirectory = normalizePath2(candidateDirectory);
|
|
@@ -136684,13 +136741,13 @@ function deduplicateSkillsByName(skills2) {
|
|
|
136684
136741
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
136685
136742
|
init_src();
|
|
136686
136743
|
import * as fs19 from "fs/promises";
|
|
136687
|
-
import { join as
|
|
136744
|
+
import { join as join60 } from "path";
|
|
136688
136745
|
|
|
136689
136746
|
// packages/skills-loader-core/src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
136690
136747
|
init_src();
|
|
136691
136748
|
init_src2();
|
|
136692
136749
|
import * as fs18 from "fs/promises";
|
|
136693
|
-
import { basename as
|
|
136750
|
+
import { basename as basename12 } from "path";
|
|
136694
136751
|
|
|
136695
136752
|
// packages/skills-loader-core/src/features/opencode-skill-loader/allowed-tools-parser.ts
|
|
136696
136753
|
function parseAllowedTools(allowedTools) {
|
|
@@ -136705,7 +136762,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
136705
136762
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
136706
136763
|
init_js_yaml();
|
|
136707
136764
|
import * as fs17 from "fs/promises";
|
|
136708
|
-
import { join as
|
|
136765
|
+
import { join as join59 } from "path";
|
|
136709
136766
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
136710
136767
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
136711
136768
|
if (!frontmatterMatch)
|
|
@@ -136724,7 +136781,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
136724
136781
|
return;
|
|
136725
136782
|
}
|
|
136726
136783
|
async function loadMcpJsonFromDir(skillDir) {
|
|
136727
|
-
const mcpJsonPath =
|
|
136784
|
+
const mcpJsonPath = join59(skillDir, "mcp.json");
|
|
136728
136785
|
try {
|
|
136729
136786
|
const content = await fs17.readFile(mcpJsonPath, "utf-8");
|
|
136730
136787
|
const parsed = JSON.parse(content);
|
|
@@ -136806,7 +136863,7 @@ $ARGUMENTS
|
|
|
136806
136863
|
}
|
|
136807
136864
|
}
|
|
136808
136865
|
function inferSkillNameFromFileName(filePath) {
|
|
136809
|
-
return
|
|
136866
|
+
return basename12(filePath, ".md");
|
|
136810
136867
|
}
|
|
136811
136868
|
|
|
136812
136869
|
// packages/skills-loader-core/src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
@@ -136840,10 +136897,10 @@ async function loadSkillsFromDir(options) {
|
|
|
136840
136897
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
136841
136898
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
136842
136899
|
for (const entry of directories) {
|
|
136843
|
-
const entryPath =
|
|
136900
|
+
const entryPath = join60(options.skillsDir, entry.name);
|
|
136844
136901
|
const resolvedPath = await resolveSymlinkAsync(entryPath);
|
|
136845
136902
|
const dirName = entry.name;
|
|
136846
|
-
const skillMdPath =
|
|
136903
|
+
const skillMdPath = join60(resolvedPath, "SKILL.md");
|
|
136847
136904
|
if (await canAccessFile(skillMdPath)) {
|
|
136848
136905
|
const skill = await loadSkillFromPath({
|
|
136849
136906
|
skillPath: skillMdPath,
|
|
@@ -136857,7 +136914,7 @@ async function loadSkillsFromDir(options) {
|
|
|
136857
136914
|
}
|
|
136858
136915
|
continue;
|
|
136859
136916
|
}
|
|
136860
|
-
const namedSkillMdPath =
|
|
136917
|
+
const namedSkillMdPath = join60(resolvedPath, `${dirName}.md`);
|
|
136861
136918
|
if (await canAccessFile(namedSkillMdPath)) {
|
|
136862
136919
|
const skill = await loadSkillFromPath({
|
|
136863
136920
|
skillPath: namedSkillMdPath,
|
|
@@ -136888,7 +136945,7 @@ async function loadSkillsFromDir(options) {
|
|
|
136888
136945
|
}
|
|
136889
136946
|
}
|
|
136890
136947
|
for (const entry of files) {
|
|
136891
|
-
const entryPath =
|
|
136948
|
+
const entryPath = join60(options.skillsDir, entry.name);
|
|
136892
136949
|
const baseName = inferSkillNameFromFileName(entryPath);
|
|
136893
136950
|
const skill = await loadSkillFromPath({
|
|
136894
136951
|
skillPath: entryPath,
|
|
@@ -136940,7 +136997,7 @@ async function discoverAllSkills(directory) {
|
|
|
136940
136997
|
]);
|
|
136941
136998
|
}
|
|
136942
136999
|
async function discoverUserClaudeSkills() {
|
|
136943
|
-
const userSkillsDir =
|
|
137000
|
+
const userSkillsDir = join61(getClaudeConfigDir(), "skills");
|
|
136944
137001
|
return loadSkillsFromDir({ skillsDir: userSkillsDir, scope: "user" });
|
|
136945
137002
|
}
|
|
136946
137003
|
async function discoverProjectClaudeSkills(directory) {
|
|
@@ -136967,7 +137024,7 @@ async function discoverProjectAgentsSkills(directory) {
|
|
|
136967
137024
|
return deduplicateSkillsByName(allSkills.flat());
|
|
136968
137025
|
}
|
|
136969
137026
|
async function discoverGlobalAgentsSkills(homeDirectory = getHomeDirectory()) {
|
|
136970
|
-
const agentsGlobalDir =
|
|
137027
|
+
const agentsGlobalDir = join61(homeDirectory, ".agents", "skills");
|
|
136971
137028
|
return loadSkillsFromDir({ skillsDir: agentsGlobalDir, scope: "user" });
|
|
136972
137029
|
}
|
|
136973
137030
|
// packages/skills-loader-core/src/features/builtin-skills/agent-browser/SKILL.md
|
|
@@ -137713,17 +137770,17 @@ playwright-cli close
|
|
|
137713
137770
|
allowedTools: ["Bash(playwright-cli:*)"]
|
|
137714
137771
|
};
|
|
137715
137772
|
// packages/skills-loader-core/src/features/builtin-skills/skill-file-loader.ts
|
|
137716
|
-
import { readFileSync as
|
|
137717
|
-
import { join as
|
|
137773
|
+
import { readFileSync as readFileSync48 } from "fs";
|
|
137774
|
+
import { join as join62 } from "path";
|
|
137718
137775
|
init_src();
|
|
137719
|
-
function createSharedSkillTemplateLoader(readFile3 =
|
|
137776
|
+
function createSharedSkillTemplateLoader(readFile3 = readFileSync48, skillsRootPath = sharedSkillsRootPath()) {
|
|
137720
137777
|
const cache = new Map;
|
|
137721
137778
|
return (skillName) => {
|
|
137722
137779
|
const cached2 = cache.get(skillName);
|
|
137723
137780
|
if (cached2 !== undefined)
|
|
137724
137781
|
return cached2;
|
|
137725
137782
|
try {
|
|
137726
|
-
const { body } = parseFrontmatter(readFile3(
|
|
137783
|
+
const { body } = parseFrontmatter(readFile3(join62(skillsRootPath, skillName, "SKILL.md"), "utf8"));
|
|
137727
137784
|
cache.set(skillName, body);
|
|
137728
137785
|
return body;
|
|
137729
137786
|
} catch (error51) {
|
|
@@ -138860,7 +138917,7 @@ var gitMasterSkill = {
|
|
|
138860
138917
|
template: GIT_MASTER_TEMPLATE
|
|
138861
138918
|
};
|
|
138862
138919
|
// packages/skills-loader-core/src/features/builtin-skills/skills/dev-browser.ts
|
|
138863
|
-
import { dirname as dirname24, join as
|
|
138920
|
+
import { dirname as dirname24, join as join63 } from "path";
|
|
138864
138921
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
138865
138922
|
var CURRENT_DIR = dirname24(fileURLToPath8(import.meta.url));
|
|
138866
138923
|
var devBrowserSkill = {
|
|
@@ -139080,7 +139137,7 @@ console.log({
|
|
|
139080
139137
|
await client.disconnect();
|
|
139081
139138
|
EOF
|
|
139082
139139
|
\`\`\``,
|
|
139083
|
-
resolvedPath:
|
|
139140
|
+
resolvedPath: join63(CURRENT_DIR, "..", "dev-browser")
|
|
139084
139141
|
};
|
|
139085
139142
|
// packages/skills-loader-core/src/features/builtin-skills/skills/review-work.ts
|
|
139086
139143
|
var reviewWorkSkill = {
|
|
@@ -140073,11 +140130,11 @@ function applySnapshotRetention(options) {
|
|
|
140073
140130
|
// packages/omo-opencode/src/cli/snapshot/snapshot.ts
|
|
140074
140131
|
import { Database as Database3 } from "bun:sqlite";
|
|
140075
140132
|
import {
|
|
140076
|
-
existsSync as
|
|
140077
|
-
mkdirSync as
|
|
140133
|
+
existsSync as existsSync64,
|
|
140134
|
+
mkdirSync as mkdirSync19,
|
|
140078
140135
|
copyFileSync as copyFileSync3,
|
|
140079
|
-
readFileSync as
|
|
140080
|
-
writeFileSync as
|
|
140136
|
+
readFileSync as readFileSync49,
|
|
140137
|
+
writeFileSync as writeFileSync17,
|
|
140081
140138
|
readdirSync as readdirSync10,
|
|
140082
140139
|
statSync as statSync8,
|
|
140083
140140
|
rmSync as rmSync4
|
|
@@ -140089,12 +140146,12 @@ async function snapshotCli(options = {}) {
|
|
|
140089
140146
|
const homeDir = os7.homedir();
|
|
140090
140147
|
const snapshotDir = options.snapshotDir ?? path18.join(homeDir, ".matrixos", "snapshots");
|
|
140091
140148
|
const allPaths = getAllSnapshotPaths(homeDir);
|
|
140092
|
-
const files = allPaths.files.filter((f2) =>
|
|
140149
|
+
const files = allPaths.files.filter((f2) => existsSync64(f2.sourcePath));
|
|
140093
140150
|
const realFs = {
|
|
140094
|
-
existsSync:
|
|
140095
|
-
mkdirSync:
|
|
140096
|
-
readFileSync:
|
|
140097
|
-
writeFileSync:
|
|
140151
|
+
existsSync: existsSync64,
|
|
140152
|
+
mkdirSync: mkdirSync19,
|
|
140153
|
+
readFileSync: readFileSync49,
|
|
140154
|
+
writeFileSync: writeFileSync17,
|
|
140098
140155
|
copyFileSync: copyFileSync3,
|
|
140099
140156
|
readdirSync: readdirSync10,
|
|
140100
140157
|
statSync: statSync8,
|
|
@@ -140156,11 +140213,11 @@ async function snapshotCli(options = {}) {
|
|
|
140156
140213
|
|
|
140157
140214
|
// packages/omo-opencode/src/cli/snapshot/restore.ts
|
|
140158
140215
|
import {
|
|
140159
|
-
existsSync as
|
|
140160
|
-
mkdirSync as
|
|
140216
|
+
existsSync as existsSync65,
|
|
140217
|
+
mkdirSync as mkdirSync20,
|
|
140161
140218
|
copyFileSync as copyFileSync4,
|
|
140162
|
-
readFileSync as
|
|
140163
|
-
writeFileSync as
|
|
140219
|
+
readFileSync as readFileSync50,
|
|
140220
|
+
writeFileSync as writeFileSync18,
|
|
140164
140221
|
readdirSync as readdirSync11,
|
|
140165
140222
|
statSync as statSync9,
|
|
140166
140223
|
rmSync as rmSync5
|
|
@@ -140170,10 +140227,10 @@ import * as os8 from "os";
|
|
|
140170
140227
|
async function restoreCli(options) {
|
|
140171
140228
|
const snapshotDir = options.snapshotDir ?? path19.join(os8.homedir(), ".matrixos", "snapshots");
|
|
140172
140229
|
const realFs = {
|
|
140173
|
-
existsSync:
|
|
140174
|
-
mkdirSync:
|
|
140175
|
-
readFileSync:
|
|
140176
|
-
writeFileSync:
|
|
140230
|
+
existsSync: existsSync65,
|
|
140231
|
+
mkdirSync: mkdirSync20,
|
|
140232
|
+
readFileSync: readFileSync50,
|
|
140233
|
+
writeFileSync: writeFileSync18,
|
|
140177
140234
|
copyFileSync: copyFileSync4,
|
|
140178
140235
|
readdirSync: readdirSync11,
|
|
140179
140236
|
statSync: statSync9,
|
|
@@ -140187,7 +140244,7 @@ async function restoreCli(options) {
|
|
|
140187
140244
|
try {
|
|
140188
140245
|
restoreSnapshot(options.state, { snapshotDir, fs: realFs });
|
|
140189
140246
|
const manifestPath = path19.join(snapshotDir, options.state, "manifest.json");
|
|
140190
|
-
const raw =
|
|
140247
|
+
const raw = readFileSync50(manifestPath).toString("utf-8");
|
|
140191
140248
|
const parsed = JSON.parse(raw);
|
|
140192
140249
|
const fileCount = typeof parsed === "object" && parsed !== null && "files" in parsed && Array.isArray(parsed.files) ? parsed.files.length : 0;
|
|
140193
140250
|
if (options.json) {
|
|
@@ -140208,11 +140265,11 @@ async function restoreCli(options) {
|
|
|
140208
140265
|
|
|
140209
140266
|
// packages/omo-opencode/src/cli/snapshot/list.ts
|
|
140210
140267
|
import {
|
|
140211
|
-
existsSync as
|
|
140212
|
-
mkdirSync as
|
|
140268
|
+
existsSync as existsSync66,
|
|
140269
|
+
mkdirSync as mkdirSync21,
|
|
140213
140270
|
copyFileSync as copyFileSync5,
|
|
140214
|
-
readFileSync as
|
|
140215
|
-
writeFileSync as
|
|
140271
|
+
readFileSync as readFileSync51,
|
|
140272
|
+
writeFileSync as writeFileSync19,
|
|
140216
140273
|
readdirSync as readdirSync12,
|
|
140217
140274
|
statSync as statSync10,
|
|
140218
140275
|
rmSync as rmSync6
|
|
@@ -140232,10 +140289,10 @@ function formatBytes(bytes) {
|
|
|
140232
140289
|
async function snapshotListCli(options) {
|
|
140233
140290
|
const snapshotDir = options.snapshotDir ?? path20.join(os9.homedir(), ".matrixos", "snapshots");
|
|
140234
140291
|
const realFs = {
|
|
140235
|
-
existsSync:
|
|
140236
|
-
mkdirSync:
|
|
140237
|
-
readFileSync:
|
|
140238
|
-
writeFileSync:
|
|
140292
|
+
existsSync: existsSync66,
|
|
140293
|
+
mkdirSync: mkdirSync21,
|
|
140294
|
+
readFileSync: readFileSync51,
|
|
140295
|
+
writeFileSync: writeFileSync19,
|
|
140239
140296
|
copyFileSync: copyFileSync5,
|
|
140240
140297
|
readdirSync: readdirSync12,
|
|
140241
140298
|
statSync: statSync10,
|
|
@@ -140262,11 +140319,11 @@ async function snapshotListCli(options) {
|
|
|
140262
140319
|
|
|
140263
140320
|
// packages/omo-opencode/src/cli/snapshot/prune.ts
|
|
140264
140321
|
import {
|
|
140265
|
-
existsSync as
|
|
140266
|
-
mkdirSync as
|
|
140322
|
+
existsSync as existsSync67,
|
|
140323
|
+
mkdirSync as mkdirSync22,
|
|
140267
140324
|
copyFileSync as copyFileSync6,
|
|
140268
|
-
readFileSync as
|
|
140269
|
-
writeFileSync as
|
|
140325
|
+
readFileSync as readFileSync52,
|
|
140326
|
+
writeFileSync as writeFileSync20,
|
|
140270
140327
|
readdirSync as readdirSync13,
|
|
140271
140328
|
statSync as statSync11,
|
|
140272
140329
|
rmSync as rmSync7
|
|
@@ -140276,10 +140333,10 @@ import * as os10 from "os";
|
|
|
140276
140333
|
async function snapshotPruneCli(options = {}) {
|
|
140277
140334
|
const snapshotDir = options.snapshotDir ?? path21.join(os10.homedir(), ".matrixos", "snapshots");
|
|
140278
140335
|
const realFs = {
|
|
140279
|
-
existsSync:
|
|
140280
|
-
mkdirSync:
|
|
140281
|
-
readFileSync:
|
|
140282
|
-
writeFileSync:
|
|
140336
|
+
existsSync: existsSync67,
|
|
140337
|
+
mkdirSync: mkdirSync22,
|
|
140338
|
+
readFileSync: readFileSync52,
|
|
140339
|
+
writeFileSync: writeFileSync20,
|
|
140283
140340
|
copyFileSync: copyFileSync6,
|
|
140284
140341
|
readdirSync: readdirSync13,
|
|
140285
140342
|
statSync: statSync11,
|
|
@@ -140326,8 +140383,8 @@ function codebaseCli(rootProgram) {
|
|
|
140326
140383
|
try {
|
|
140327
140384
|
const dimension = Number.parseInt(options.dimension, 10) || 384;
|
|
140328
140385
|
const dbDir = path22.dirname(options.db);
|
|
140329
|
-
const { mkdirSync:
|
|
140330
|
-
|
|
140386
|
+
const { mkdirSync: mkdirSync23 } = await import("fs");
|
|
140387
|
+
mkdirSync23(dbDir, { recursive: true });
|
|
140331
140388
|
const store4 = createSqliteVectorStore({ path: options.db, dimension });
|
|
140332
140389
|
if (options.reset) {
|
|
140333
140390
|
store4.clear();
|
|
@@ -140564,7 +140621,7 @@ function printHumanReadable2(r2) {
|
|
|
140564
140621
|
// packages/omo-opencode/src/cli/trace.ts
|
|
140565
140622
|
init_data_path();
|
|
140566
140623
|
import * as path23 from "path";
|
|
140567
|
-
import { writeFileSync as
|
|
140624
|
+
import { writeFileSync as writeFileSync21 } from "fs";
|
|
140568
140625
|
import { Database as Database4 } from "bun:sqlite";
|
|
140569
140626
|
function defaultDbPath() {
|
|
140570
140627
|
return path23.join(getDataDir(), "opencode", "opencode.db");
|
|
@@ -140768,7 +140825,7 @@ function renderMermaid(result, outPath) {
|
|
|
140768
140825
|
const content = lines.join(`
|
|
140769
140826
|
`);
|
|
140770
140827
|
if (outPath && outPath !== "-") {
|
|
140771
|
-
|
|
140828
|
+
writeFileSync21(outPath, content + `
|
|
140772
140829
|
`);
|
|
140773
140830
|
}
|
|
140774
140831
|
return content;
|
|
@@ -141356,6 +141413,117 @@ async function dashboardCli(options) {
|
|
|
141356
141413
|
}
|
|
141357
141414
|
}
|
|
141358
141415
|
|
|
141416
|
+
// packages/omo-opencode/src/cli/architect.ts
|
|
141417
|
+
import { join as join72 } from "path";
|
|
141418
|
+
var IMPROVEMENTS_DIR = ".matrixos/improvements";
|
|
141419
|
+
function getStore(directory) {
|
|
141420
|
+
const baseDir = directory ?? process.cwd();
|
|
141421
|
+
return createImprovementStore(join72(baseDir, IMPROVEMENTS_DIR));
|
|
141422
|
+
}
|
|
141423
|
+
async function architectReview(options) {
|
|
141424
|
+
const store4 = getStore(options.directory);
|
|
141425
|
+
if (options.id) {
|
|
141426
|
+
const improvement = store4.get(options.id);
|
|
141427
|
+
if (!improvement) {
|
|
141428
|
+
console.error(`Improvement not found: ${options.id}`);
|
|
141429
|
+
return 1;
|
|
141430
|
+
}
|
|
141431
|
+
if (options.approve) {
|
|
141432
|
+
store4.updateStatus(improvement.id, "approved", {
|
|
141433
|
+
approvedAt: new Date().toISOString(),
|
|
141434
|
+
reviewedBy: "cli"
|
|
141435
|
+
});
|
|
141436
|
+
console.log(`\u2705 Approved: ${improvement.title} (${improvement.id})`);
|
|
141437
|
+
return 0;
|
|
141438
|
+
}
|
|
141439
|
+
if (options.reject) {
|
|
141440
|
+
store4.updateStatus(improvement.id, "rejected", {
|
|
141441
|
+
rejectedAt: new Date().toISOString(),
|
|
141442
|
+
reviewedBy: "cli"
|
|
141443
|
+
});
|
|
141444
|
+
console.log(`\u274C Rejected: ${improvement.title} (${improvement.id})`);
|
|
141445
|
+
return 0;
|
|
141446
|
+
}
|
|
141447
|
+
if (options.json) {
|
|
141448
|
+
console.log(JSON.stringify(improvement, null, 2));
|
|
141449
|
+
return 0;
|
|
141450
|
+
}
|
|
141451
|
+
console.log(`
|
|
141452
|
+
=== ${improvement.title} ===`);
|
|
141453
|
+
console.log(`ID: ${improvement.id}`);
|
|
141454
|
+
console.log(`Status: ${improvement.status}`);
|
|
141455
|
+
console.log(`Risk: ${improvement.risk}`);
|
|
141456
|
+
console.log(`
|
|
141457
|
+
${improvement.description}`);
|
|
141458
|
+
console.log(`
|
|
141459
|
+
Rationale: ${improvement.rationale}`);
|
|
141460
|
+
console.log(`
|
|
141461
|
+
Changes:`);
|
|
141462
|
+
for (const change of improvement.changes) {
|
|
141463
|
+
console.log(` ${change.action} ${change.target}: ${change.path}`);
|
|
141464
|
+
}
|
|
141465
|
+
if (improvement.rollbackPlan)
|
|
141466
|
+
console.log(`
|
|
141467
|
+
Rollback: ${improvement.rollbackPlan}`);
|
|
141468
|
+
if (improvement.testPlan)
|
|
141469
|
+
console.log(`Test plan: ${improvement.testPlan}`);
|
|
141470
|
+
return 0;
|
|
141471
|
+
}
|
|
141472
|
+
const all = store4.list();
|
|
141473
|
+
const proposals = all.filter((i3) => i3.status === "proposed");
|
|
141474
|
+
const applied = all.filter((i3) => i3.status === "applied");
|
|
141475
|
+
if (options.json) {
|
|
141476
|
+
console.log(JSON.stringify({ proposals, applied, total: all.length }, null, 2));
|
|
141477
|
+
return 0;
|
|
141478
|
+
}
|
|
141479
|
+
console.log(`
|
|
141480
|
+
Architect \u2014 Improvement Proposals
|
|
141481
|
+
`);
|
|
141482
|
+
console.log(`Proposed: ${proposals.length} | Applied: ${applied.length} | Total: ${all.length}
|
|
141483
|
+
`);
|
|
141484
|
+
if (proposals.length > 0) {
|
|
141485
|
+
console.log("--- Pending Review ---");
|
|
141486
|
+
for (const p2 of proposals) {
|
|
141487
|
+
console.log(` [${p2.risk}] ${p2.title} (${p2.id})`);
|
|
141488
|
+
}
|
|
141489
|
+
console.log(`
|
|
141490
|
+
Review: bunx matrixos architect review --id <id>`);
|
|
141491
|
+
console.log(`Approve: bunx matrixos architect review --id <id> --approve`);
|
|
141492
|
+
console.log(`Reject: bunx matrixos architect review --id <id> --reject`);
|
|
141493
|
+
}
|
|
141494
|
+
if (applied.length > 0) {
|
|
141495
|
+
console.log(`
|
|
141496
|
+
--- Applied ---`);
|
|
141497
|
+
for (const a2 of applied) {
|
|
141498
|
+
console.log(` ${a2.title} (${a2.id}) \u2014 ${a2.appliedAt ?? "?"}`);
|
|
141499
|
+
}
|
|
141500
|
+
}
|
|
141501
|
+
return 0;
|
|
141502
|
+
}
|
|
141503
|
+
async function architectRollback(options) {
|
|
141504
|
+
const store4 = getStore(options.directory);
|
|
141505
|
+
const improvement = store4.get(options.id);
|
|
141506
|
+
if (!improvement) {
|
|
141507
|
+
console.error(`Improvement not found: ${options.id}`);
|
|
141508
|
+
return 1;
|
|
141509
|
+
}
|
|
141510
|
+
if (improvement.status !== "applied") {
|
|
141511
|
+
console.error(`Improvement is not applied (status: ${improvement.status}). Cannot rollback.`);
|
|
141512
|
+
return 1;
|
|
141513
|
+
}
|
|
141514
|
+
store4.updateStatus(improvement.id, "rolled_back", {
|
|
141515
|
+
rollbackPlan: `Rolled back via CLI at ${new Date().toISOString()}. See beforeSnapshot for original state.`
|
|
141516
|
+
});
|
|
141517
|
+
console.log(`\u21A9\uFE0F Rolled back: ${improvement.title} (${improvement.id})`);
|
|
141518
|
+
if (improvement.beforeSnapshot) {
|
|
141519
|
+
console.log(` Before-snapshot available for manual restore.`);
|
|
141520
|
+
}
|
|
141521
|
+
if (options.json) {
|
|
141522
|
+
console.log(JSON.stringify({ rolledBack: improvement.id, title: improvement.title }, null, 2));
|
|
141523
|
+
}
|
|
141524
|
+
return 0;
|
|
141525
|
+
}
|
|
141526
|
+
|
|
141359
141527
|
// packages/omo-opencode/src/cli/runtime-commands.ts
|
|
141360
141528
|
init_data_path();
|
|
141361
141529
|
init_shared();
|
|
@@ -141526,6 +141694,15 @@ function configureRuntimeCommands(program2) {
|
|
|
141526
141694
|
});
|
|
141527
141695
|
process.exit(exitCode);
|
|
141528
141696
|
});
|
|
141697
|
+
const architectCmd = program2.command("architect").description("Self-improvement workflow \u2014 review improvement proposals and roll back applied changes");
|
|
141698
|
+
architectCmd.command("review").description("List improvement proposals or approve/reject a specific one").option("-d, --directory <path>", "Project directory").option("--id <id>", "Improvement ID to review").option("--approve", "Approve the improvement").option("--reject", "Reject the improvement").option("--json", "JSON output").action(async (options) => {
|
|
141699
|
+
const exitCode = await architectReview(options);
|
|
141700
|
+
process.exit(exitCode);
|
|
141701
|
+
});
|
|
141702
|
+
architectCmd.command("rollback").description("Roll back an applied improvement").argument("<id>", "Improvement ID to roll back").option("-d, --directory <path>", "Project directory").option("--json", "JSON output").action(async (id, options) => {
|
|
141703
|
+
const exitCode = await architectRollback({ ...options, id });
|
|
141704
|
+
process.exit(exitCode);
|
|
141705
|
+
});
|
|
141529
141706
|
program2.command("dashboard").description("Start the MaTrixOS web dashboard (port 9123)").option("-p, --port <number>", "HTTP port", "9123").option("--host <addr>", "Bind address", "127.0.0.1").option("--daemon", "Run in background (no Ctrl+C)").action(async (options) => {
|
|
141530
141707
|
const exitCode = await dashboardCli({
|
|
141531
141708
|
port: parseInt(options.port ?? "9123", 10),
|