@openez-graph/cli 0.2.1 → 0.3.1
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/LICENSE +21 -0
- package/README.md +94 -14
- package/dist/cli.cjs +233 -145
- package/dist/web/assets/WorkspaceGraph-CyIfL-tO.js +4112 -0
- package/dist/web/assets/index-C3yC9A2l.css +1 -0
- package/dist/web/assets/index-CDXvHMX8.js +312 -0
- package/dist/web/index.html +23 -0
- package/dist/web/logo.png +0 -0
- package/package.json +33 -2
package/dist/cli.cjs
CHANGED
|
@@ -2912,7 +2912,7 @@ var require_command = __commonJS({
|
|
|
2912
2912
|
var EventEmitter2 = require("events").EventEmitter;
|
|
2913
2913
|
var childProcess = require("child_process");
|
|
2914
2914
|
var path19 = require("path");
|
|
2915
|
-
var
|
|
2915
|
+
var fs17 = require("fs");
|
|
2916
2916
|
var process3 = require("process");
|
|
2917
2917
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
2918
2918
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -3906,7 +3906,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3906
3906
|
* @param {string} subcommandName
|
|
3907
3907
|
*/
|
|
3908
3908
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
3909
|
-
if (
|
|
3909
|
+
if (fs17.existsSync(executableFile)) return;
|
|
3910
3910
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
3911
3911
|
const executableMissing = `'${executableFile}' does not exist
|
|
3912
3912
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -3925,10 +3925,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3925
3925
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
3926
3926
|
function findFile(baseDir, baseName) {
|
|
3927
3927
|
const localBin = path19.resolve(baseDir, baseName);
|
|
3928
|
-
if (
|
|
3928
|
+
if (fs17.existsSync(localBin)) return localBin;
|
|
3929
3929
|
if (sourceExt.includes(path19.extname(baseName))) return void 0;
|
|
3930
3930
|
const foundExt = sourceExt.find(
|
|
3931
|
-
(ext) =>
|
|
3931
|
+
(ext) => fs17.existsSync(`${localBin}${ext}`)
|
|
3932
3932
|
);
|
|
3933
3933
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
3934
3934
|
return void 0;
|
|
@@ -3940,7 +3940,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3940
3940
|
if (this._scriptPath) {
|
|
3941
3941
|
let resolvedScriptPath;
|
|
3942
3942
|
try {
|
|
3943
|
-
resolvedScriptPath =
|
|
3943
|
+
resolvedScriptPath = fs17.realpathSync(this._scriptPath);
|
|
3944
3944
|
} catch {
|
|
3945
3945
|
resolvedScriptPath = this._scriptPath;
|
|
3946
3946
|
}
|
|
@@ -12514,7 +12514,7 @@ var require_package = __commonJS({
|
|
|
12514
12514
|
var require_main = __commonJS({
|
|
12515
12515
|
"../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports2, module3) {
|
|
12516
12516
|
"use strict";
|
|
12517
|
-
var
|
|
12517
|
+
var fs17 = require("fs");
|
|
12518
12518
|
var path19 = require("path");
|
|
12519
12519
|
var os6 = require("os");
|
|
12520
12520
|
var crypto4 = require("crypto");
|
|
@@ -12623,7 +12623,7 @@ var require_main = __commonJS({
|
|
|
12623
12623
|
if (options && options.path && options.path.length > 0) {
|
|
12624
12624
|
if (Array.isArray(options.path)) {
|
|
12625
12625
|
for (const filepath of options.path) {
|
|
12626
|
-
if (
|
|
12626
|
+
if (fs17.existsSync(filepath)) {
|
|
12627
12627
|
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
12628
12628
|
}
|
|
12629
12629
|
}
|
|
@@ -12633,7 +12633,7 @@ var require_main = __commonJS({
|
|
|
12633
12633
|
} else {
|
|
12634
12634
|
possibleVaultPath = path19.resolve(process.cwd(), ".env.vault");
|
|
12635
12635
|
}
|
|
12636
|
-
if (
|
|
12636
|
+
if (fs17.existsSync(possibleVaultPath)) {
|
|
12637
12637
|
return possibleVaultPath;
|
|
12638
12638
|
}
|
|
12639
12639
|
return null;
|
|
@@ -12682,7 +12682,7 @@ var require_main = __commonJS({
|
|
|
12682
12682
|
const parsedAll = {};
|
|
12683
12683
|
for (const path20 of optionPaths) {
|
|
12684
12684
|
try {
|
|
12685
|
-
const parsed = DotenvModule.parse(
|
|
12685
|
+
const parsed = DotenvModule.parse(fs17.readFileSync(path20, { encoding }));
|
|
12686
12686
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
12687
12687
|
} catch (e) {
|
|
12688
12688
|
if (debug) {
|
|
@@ -29609,11 +29609,11 @@ var require_source_map_support = __commonJS({
|
|
|
29609
29609
|
"use strict";
|
|
29610
29610
|
var SourceMapConsumer = require_source_map().SourceMapConsumer;
|
|
29611
29611
|
var path19 = require("path");
|
|
29612
|
-
var
|
|
29612
|
+
var fs17;
|
|
29613
29613
|
try {
|
|
29614
|
-
|
|
29615
|
-
if (!
|
|
29616
|
-
|
|
29614
|
+
fs17 = require("fs");
|
|
29615
|
+
if (!fs17.existsSync || !fs17.readFileSync) {
|
|
29616
|
+
fs17 = null;
|
|
29617
29617
|
}
|
|
29618
29618
|
} catch (err) {
|
|
29619
29619
|
}
|
|
@@ -29684,7 +29684,7 @@ var require_source_map_support = __commonJS({
|
|
|
29684
29684
|
}
|
|
29685
29685
|
var contents = "";
|
|
29686
29686
|
try {
|
|
29687
|
-
if (!
|
|
29687
|
+
if (!fs17) {
|
|
29688
29688
|
var xhr = new XMLHttpRequest();
|
|
29689
29689
|
xhr.open(
|
|
29690
29690
|
"GET",
|
|
@@ -29696,8 +29696,8 @@ var require_source_map_support = __commonJS({
|
|
|
29696
29696
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
29697
29697
|
contents = xhr.responseText;
|
|
29698
29698
|
}
|
|
29699
|
-
} else if (
|
|
29700
|
-
contents =
|
|
29699
|
+
} else if (fs17.existsSync(path20)) {
|
|
29700
|
+
contents = fs17.readFileSync(path20, "utf8");
|
|
29701
29701
|
}
|
|
29702
29702
|
} catch (er) {
|
|
29703
29703
|
}
|
|
@@ -29961,9 +29961,9 @@ var require_source_map_support = __commonJS({
|
|
|
29961
29961
|
var line = +match[2];
|
|
29962
29962
|
var column = +match[3];
|
|
29963
29963
|
var contents = fileContentsCache[source];
|
|
29964
|
-
if (!contents &&
|
|
29964
|
+
if (!contents && fs17 && fs17.existsSync(source)) {
|
|
29965
29965
|
try {
|
|
29966
|
-
contents =
|
|
29966
|
+
contents = fs17.readFileSync(source, "utf8");
|
|
29967
29967
|
} catch (er) {
|
|
29968
29968
|
contents = "";
|
|
29969
29969
|
}
|
|
@@ -33724,10 +33724,10 @@ var require_typescript = __commonJS({
|
|
|
33724
33724
|
function and2(f, g2) {
|
|
33725
33725
|
return (arg) => f(arg) && g2(arg);
|
|
33726
33726
|
}
|
|
33727
|
-
function or2(...
|
|
33727
|
+
function or2(...fs17) {
|
|
33728
33728
|
return (...args) => {
|
|
33729
33729
|
let lastResult;
|
|
33730
|
-
for (const f of
|
|
33730
|
+
for (const f of fs17) {
|
|
33731
33731
|
lastResult = f(...args);
|
|
33732
33732
|
if (lastResult) {
|
|
33733
33733
|
return lastResult;
|
|
@@ -35302,7 +35302,7 @@ ${lanes.join("\n")}
|
|
|
35302
35302
|
var tracing;
|
|
35303
35303
|
var tracingEnabled;
|
|
35304
35304
|
((tracingEnabled2) => {
|
|
35305
|
-
let
|
|
35305
|
+
let fs17;
|
|
35306
35306
|
let traceCount = 0;
|
|
35307
35307
|
let traceFd = 0;
|
|
35308
35308
|
let mode;
|
|
@@ -35311,9 +35311,9 @@ ${lanes.join("\n")}
|
|
|
35311
35311
|
const legend = [];
|
|
35312
35312
|
function startTracing2(tracingMode, traceDir, configFilePath) {
|
|
35313
35313
|
Debug.assert(!tracing, "Tracing already started");
|
|
35314
|
-
if (
|
|
35314
|
+
if (fs17 === void 0) {
|
|
35315
35315
|
try {
|
|
35316
|
-
|
|
35316
|
+
fs17 = require("fs");
|
|
35317
35317
|
} catch (e) {
|
|
35318
35318
|
throw new Error(`tracing requires having fs
|
|
35319
35319
|
(original error: ${e.message || e})`);
|
|
@@ -35324,8 +35324,8 @@ ${lanes.join("\n")}
|
|
|
35324
35324
|
if (legendPath === void 0) {
|
|
35325
35325
|
legendPath = combinePaths(traceDir, "legend.json");
|
|
35326
35326
|
}
|
|
35327
|
-
if (!
|
|
35328
|
-
|
|
35327
|
+
if (!fs17.existsSync(traceDir)) {
|
|
35328
|
+
fs17.mkdirSync(traceDir, { recursive: true });
|
|
35329
35329
|
}
|
|
35330
35330
|
const countPart = mode === "build" ? `.${process.pid}-${++traceCount}` : mode === "server" ? `.${process.pid}` : ``;
|
|
35331
35331
|
const tracePath = combinePaths(traceDir, `trace${countPart}.json`);
|
|
@@ -35335,10 +35335,10 @@ ${lanes.join("\n")}
|
|
|
35335
35335
|
tracePath,
|
|
35336
35336
|
typesPath
|
|
35337
35337
|
});
|
|
35338
|
-
traceFd =
|
|
35338
|
+
traceFd = fs17.openSync(tracePath, "w");
|
|
35339
35339
|
tracing = tracingEnabled2;
|
|
35340
35340
|
const meta = { cat: "__metadata", ph: "M", ts: 1e3 * timestamp(), pid: 1, tid: 1 };
|
|
35341
|
-
|
|
35341
|
+
fs17.writeSync(
|
|
35342
35342
|
traceFd,
|
|
35343
35343
|
"[\n" + [{ name: "process_name", args: { name: "tsc" }, ...meta }, { name: "thread_name", args: { name: "Main" }, ...meta }, { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }].map((v) => JSON.stringify(v)).join(",\n")
|
|
35344
35344
|
);
|
|
@@ -35347,10 +35347,10 @@ ${lanes.join("\n")}
|
|
|
35347
35347
|
function stopTracing() {
|
|
35348
35348
|
Debug.assert(tracing, "Tracing is not in progress");
|
|
35349
35349
|
Debug.assert(!!typeCatalog.length === (mode !== "server"));
|
|
35350
|
-
|
|
35350
|
+
fs17.writeSync(traceFd, `
|
|
35351
35351
|
]
|
|
35352
35352
|
`);
|
|
35353
|
-
|
|
35353
|
+
fs17.closeSync(traceFd);
|
|
35354
35354
|
tracing = void 0;
|
|
35355
35355
|
if (typeCatalog.length) {
|
|
35356
35356
|
dumpTypes(typeCatalog);
|
|
@@ -35422,11 +35422,11 @@ ${lanes.join("\n")}
|
|
|
35422
35422
|
function writeEvent(eventType, phase, name, args, extras, time3 = 1e3 * timestamp()) {
|
|
35423
35423
|
if (mode === "server" && phase === "checkTypes") return;
|
|
35424
35424
|
mark("beginTracing");
|
|
35425
|
-
|
|
35425
|
+
fs17.writeSync(traceFd, `,
|
|
35426
35426
|
{"pid":1,"tid":1,"ph":"${eventType}","cat":"${phase}","ts":${time3},"name":"${name}"`);
|
|
35427
|
-
if (extras)
|
|
35428
|
-
if (args)
|
|
35429
|
-
|
|
35427
|
+
if (extras) fs17.writeSync(traceFd, `,${extras}`);
|
|
35428
|
+
if (args) fs17.writeSync(traceFd, `,"args":${JSON.stringify(args)}`);
|
|
35429
|
+
fs17.writeSync(traceFd, `}`);
|
|
35430
35430
|
mark("endTracing");
|
|
35431
35431
|
measure("Tracing", "beginTracing", "endTracing");
|
|
35432
35432
|
}
|
|
@@ -35448,9 +35448,9 @@ ${lanes.join("\n")}
|
|
|
35448
35448
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
35449
35449
|
mark("beginDumpTypes");
|
|
35450
35450
|
const typesPath = legend[legend.length - 1].typesPath;
|
|
35451
|
-
const typesFd =
|
|
35451
|
+
const typesFd = fs17.openSync(typesPath, "w");
|
|
35452
35452
|
const recursionIdentityMap = /* @__PURE__ */ new Map();
|
|
35453
|
-
|
|
35453
|
+
fs17.writeSync(typesFd, "[");
|
|
35454
35454
|
const numTypes = types.length;
|
|
35455
35455
|
for (let i = 0; i < numTypes; i++) {
|
|
35456
35456
|
const type = types[i];
|
|
@@ -35546,13 +35546,13 @@ ${lanes.join("\n")}
|
|
|
35546
35546
|
flags: Debug.formatTypeFlags(type.flags).split("|"),
|
|
35547
35547
|
display
|
|
35548
35548
|
};
|
|
35549
|
-
|
|
35549
|
+
fs17.writeSync(typesFd, JSON.stringify(descriptor));
|
|
35550
35550
|
if (i < numTypes - 1) {
|
|
35551
|
-
|
|
35551
|
+
fs17.writeSync(typesFd, ",\n");
|
|
35552
35552
|
}
|
|
35553
35553
|
}
|
|
35554
|
-
|
|
35555
|
-
|
|
35554
|
+
fs17.writeSync(typesFd, "]\n");
|
|
35555
|
+
fs17.closeSync(typesFd);
|
|
35556
35556
|
mark("endDumpTypes");
|
|
35557
35557
|
measure("Dump types", "beginDumpTypes", "endDumpTypes");
|
|
35558
35558
|
}
|
|
@@ -35560,7 +35560,7 @@ ${lanes.join("\n")}
|
|
|
35560
35560
|
if (!legendPath) {
|
|
35561
35561
|
return;
|
|
35562
35562
|
}
|
|
35563
|
-
|
|
35563
|
+
fs17.writeFileSync(legendPath, JSON.stringify(legend));
|
|
35564
35564
|
}
|
|
35565
35565
|
tracingEnabled2.dumpLegend = dumpLegend;
|
|
35566
35566
|
})(tracingEnabled || (tracingEnabled = {}));
|
|
@@ -244613,8 +244613,8 @@ var require_utils3 = __commonJS({
|
|
|
244613
244613
|
exports2.array = array2;
|
|
244614
244614
|
var errno = require_errno();
|
|
244615
244615
|
exports2.errno = errno;
|
|
244616
|
-
var
|
|
244617
|
-
exports2.fs =
|
|
244616
|
+
var fs17 = require_fs();
|
|
244617
|
+
exports2.fs = fs17;
|
|
244618
244618
|
var path19 = require_path();
|
|
244619
244619
|
exports2.path = path19;
|
|
244620
244620
|
var pattern = require_pattern();
|
|
@@ -244798,12 +244798,12 @@ var require_fs2 = __commonJS({
|
|
|
244798
244798
|
"use strict";
|
|
244799
244799
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
244800
244800
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
244801
|
-
var
|
|
244801
|
+
var fs17 = require("fs");
|
|
244802
244802
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
244803
|
-
lstat:
|
|
244804
|
-
stat:
|
|
244805
|
-
lstatSync:
|
|
244806
|
-
statSync:
|
|
244803
|
+
lstat: fs17.lstat,
|
|
244804
|
+
stat: fs17.stat,
|
|
244805
|
+
lstatSync: fs17.lstatSync,
|
|
244806
|
+
statSync: fs17.statSync
|
|
244807
244807
|
};
|
|
244808
244808
|
function createFileSystemAdapter(fsMethods) {
|
|
244809
244809
|
if (fsMethods === void 0) {
|
|
@@ -244820,12 +244820,12 @@ var require_settings = __commonJS({
|
|
|
244820
244820
|
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
|
|
244821
244821
|
"use strict";
|
|
244822
244822
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
244823
|
-
var
|
|
244823
|
+
var fs17 = require_fs2();
|
|
244824
244824
|
var Settings = class {
|
|
244825
244825
|
constructor(_options = {}) {
|
|
244826
244826
|
this._options = _options;
|
|
244827
244827
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
244828
|
-
this.fs =
|
|
244828
|
+
this.fs = fs17.createFileSystemAdapter(this._options.fs);
|
|
244829
244829
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
244830
244830
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
244831
244831
|
}
|
|
@@ -244982,8 +244982,8 @@ var require_utils4 = __commonJS({
|
|
|
244982
244982
|
"use strict";
|
|
244983
244983
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
244984
244984
|
exports2.fs = void 0;
|
|
244985
|
-
var
|
|
244986
|
-
exports2.fs =
|
|
244985
|
+
var fs17 = require_fs3();
|
|
244986
|
+
exports2.fs = fs17;
|
|
244987
244987
|
}
|
|
244988
244988
|
});
|
|
244989
244989
|
|
|
@@ -245178,14 +245178,14 @@ var require_fs4 = __commonJS({
|
|
|
245178
245178
|
"use strict";
|
|
245179
245179
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
245180
245180
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
245181
|
-
var
|
|
245181
|
+
var fs17 = require("fs");
|
|
245182
245182
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
245183
|
-
lstat:
|
|
245184
|
-
stat:
|
|
245185
|
-
lstatSync:
|
|
245186
|
-
statSync:
|
|
245187
|
-
readdir:
|
|
245188
|
-
readdirSync:
|
|
245183
|
+
lstat: fs17.lstat,
|
|
245184
|
+
stat: fs17.stat,
|
|
245185
|
+
lstatSync: fs17.lstatSync,
|
|
245186
|
+
statSync: fs17.statSync,
|
|
245187
|
+
readdir: fs17.readdir,
|
|
245188
|
+
readdirSync: fs17.readdirSync
|
|
245189
245189
|
};
|
|
245190
245190
|
function createFileSystemAdapter(fsMethods) {
|
|
245191
245191
|
if (fsMethods === void 0) {
|
|
@@ -245204,12 +245204,12 @@ var require_settings2 = __commonJS({
|
|
|
245204
245204
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
245205
245205
|
var path19 = require("path");
|
|
245206
245206
|
var fsStat = require_out();
|
|
245207
|
-
var
|
|
245207
|
+
var fs17 = require_fs4();
|
|
245208
245208
|
var Settings = class {
|
|
245209
245209
|
constructor(_options = {}) {
|
|
245210
245210
|
this._options = _options;
|
|
245211
245211
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
245212
|
-
this.fs =
|
|
245212
|
+
this.fs = fs17.createFileSystemAdapter(this._options.fs);
|
|
245213
245213
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path19.sep);
|
|
245214
245214
|
this.stats = this._getValue(this._options.stats, false);
|
|
245215
245215
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
@@ -246590,16 +246590,16 @@ var require_settings4 = __commonJS({
|
|
|
246590
246590
|
"use strict";
|
|
246591
246591
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
246592
246592
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
246593
|
-
var
|
|
246593
|
+
var fs17 = require("fs");
|
|
246594
246594
|
var os6 = require("os");
|
|
246595
246595
|
var CPU_COUNT = Math.max(os6.cpus().length, 1);
|
|
246596
246596
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
246597
|
-
lstat:
|
|
246598
|
-
lstatSync:
|
|
246599
|
-
stat:
|
|
246600
|
-
statSync:
|
|
246601
|
-
readdir:
|
|
246602
|
-
readdirSync:
|
|
246597
|
+
lstat: fs17.lstat,
|
|
246598
|
+
lstatSync: fs17.lstatSync,
|
|
246599
|
+
stat: fs17.stat,
|
|
246600
|
+
statSync: fs17.statSync,
|
|
246601
|
+
readdir: fs17.readdir,
|
|
246602
|
+
readdirSync: fs17.readdirSync
|
|
246603
246603
|
};
|
|
246604
246604
|
var Settings = class {
|
|
246605
246605
|
constructor(_options = {}) {
|
|
@@ -279303,30 +279303,30 @@ type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "js
|
|
|
279303
279303
|
yield path20;
|
|
279304
279304
|
}
|
|
279305
279305
|
}
|
|
279306
|
-
var
|
|
279306
|
+
var fs17 = runtime.fs;
|
|
279307
279307
|
var RealFileSystemHost = class {
|
|
279308
279308
|
async delete(path20) {
|
|
279309
279309
|
try {
|
|
279310
|
-
await
|
|
279310
|
+
await fs17.delete(path20);
|
|
279311
279311
|
} catch (err) {
|
|
279312
279312
|
throw this.#getFileNotFoundErrorIfNecessary(err, path20);
|
|
279313
279313
|
}
|
|
279314
279314
|
}
|
|
279315
279315
|
deleteSync(path20) {
|
|
279316
279316
|
try {
|
|
279317
|
-
|
|
279317
|
+
fs17.deleteSync(path20);
|
|
279318
279318
|
} catch (err) {
|
|
279319
279319
|
throw this.#getFileNotFoundErrorIfNecessary(err, path20);
|
|
279320
279320
|
}
|
|
279321
279321
|
}
|
|
279322
279322
|
readDirSync(dirPath) {
|
|
279323
279323
|
try {
|
|
279324
|
-
const entries =
|
|
279324
|
+
const entries = fs17.readDirSync(dirPath);
|
|
279325
279325
|
for (const entry of entries) {
|
|
279326
279326
|
entry.name = FileUtils.pathJoin(dirPath, entry.name);
|
|
279327
279327
|
if (entry.isSymlink) {
|
|
279328
279328
|
try {
|
|
279329
|
-
const info =
|
|
279329
|
+
const info = fs17.statSync(entry.name);
|
|
279330
279330
|
if (info != null) {
|
|
279331
279331
|
entry.isDirectory = info.isDirectory();
|
|
279332
279332
|
entry.isFile = info.isFile();
|
|
@@ -279342,84 +279342,84 @@ type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "js
|
|
|
279342
279342
|
}
|
|
279343
279343
|
async readFile(filePath, encoding = "utf-8") {
|
|
279344
279344
|
try {
|
|
279345
|
-
return await
|
|
279345
|
+
return await fs17.readFile(filePath, encoding);
|
|
279346
279346
|
} catch (err) {
|
|
279347
279347
|
throw this.#getFileNotFoundErrorIfNecessary(err, filePath);
|
|
279348
279348
|
}
|
|
279349
279349
|
}
|
|
279350
279350
|
readFileSync(filePath, encoding = "utf-8") {
|
|
279351
279351
|
try {
|
|
279352
|
-
return
|
|
279352
|
+
return fs17.readFileSync(filePath, encoding);
|
|
279353
279353
|
} catch (err) {
|
|
279354
279354
|
throw this.#getFileNotFoundErrorIfNecessary(err, filePath);
|
|
279355
279355
|
}
|
|
279356
279356
|
}
|
|
279357
279357
|
async writeFile(filePath, fileText) {
|
|
279358
|
-
return
|
|
279358
|
+
return fs17.writeFile(filePath, fileText);
|
|
279359
279359
|
}
|
|
279360
279360
|
writeFileSync(filePath, fileText) {
|
|
279361
|
-
|
|
279361
|
+
fs17.writeFileSync(filePath, fileText);
|
|
279362
279362
|
}
|
|
279363
279363
|
mkdir(dirPath) {
|
|
279364
|
-
return
|
|
279364
|
+
return fs17.mkdir(dirPath);
|
|
279365
279365
|
}
|
|
279366
279366
|
mkdirSync(dirPath) {
|
|
279367
|
-
|
|
279367
|
+
fs17.mkdirSync(dirPath);
|
|
279368
279368
|
}
|
|
279369
279369
|
move(srcPath, destPath) {
|
|
279370
|
-
return
|
|
279370
|
+
return fs17.move(srcPath, destPath);
|
|
279371
279371
|
}
|
|
279372
279372
|
moveSync(srcPath, destPath) {
|
|
279373
|
-
|
|
279373
|
+
fs17.moveSync(srcPath, destPath);
|
|
279374
279374
|
}
|
|
279375
279375
|
copy(srcPath, destPath) {
|
|
279376
|
-
return
|
|
279376
|
+
return fs17.copy(srcPath, destPath);
|
|
279377
279377
|
}
|
|
279378
279378
|
copySync(srcPath, destPath) {
|
|
279379
|
-
|
|
279379
|
+
fs17.copySync(srcPath, destPath);
|
|
279380
279380
|
}
|
|
279381
279381
|
async fileExists(filePath) {
|
|
279382
279382
|
try {
|
|
279383
|
-
return (await
|
|
279383
|
+
return (await fs17.stat(filePath))?.isFile() ?? false;
|
|
279384
279384
|
} catch {
|
|
279385
279385
|
return false;
|
|
279386
279386
|
}
|
|
279387
279387
|
}
|
|
279388
279388
|
fileExistsSync(filePath) {
|
|
279389
279389
|
try {
|
|
279390
|
-
return
|
|
279390
|
+
return fs17.statSync(filePath)?.isFile() ?? false;
|
|
279391
279391
|
} catch {
|
|
279392
279392
|
return false;
|
|
279393
279393
|
}
|
|
279394
279394
|
}
|
|
279395
279395
|
async directoryExists(dirPath) {
|
|
279396
279396
|
try {
|
|
279397
|
-
return (await
|
|
279397
|
+
return (await fs17.stat(dirPath))?.isDirectory() ?? false;
|
|
279398
279398
|
} catch {
|
|
279399
279399
|
return false;
|
|
279400
279400
|
}
|
|
279401
279401
|
}
|
|
279402
279402
|
directoryExistsSync(dirPath) {
|
|
279403
279403
|
try {
|
|
279404
|
-
return
|
|
279404
|
+
return fs17.statSync(dirPath)?.isDirectory() ?? false;
|
|
279405
279405
|
} catch {
|
|
279406
279406
|
return false;
|
|
279407
279407
|
}
|
|
279408
279408
|
}
|
|
279409
279409
|
realpathSync(path20) {
|
|
279410
|
-
return
|
|
279410
|
+
return fs17.realpathSync(path20);
|
|
279411
279411
|
}
|
|
279412
279412
|
getCurrentDirectory() {
|
|
279413
|
-
return FileUtils.standardizeSlashes(
|
|
279413
|
+
return FileUtils.standardizeSlashes(fs17.getCurrentDirectory());
|
|
279414
279414
|
}
|
|
279415
279415
|
glob(patterns) {
|
|
279416
|
-
return
|
|
279416
|
+
return fs17.glob(backSlashesToForward(patterns));
|
|
279417
279417
|
}
|
|
279418
279418
|
globSync(patterns) {
|
|
279419
|
-
return
|
|
279419
|
+
return fs17.globSync(backSlashesToForward(patterns));
|
|
279420
279420
|
}
|
|
279421
279421
|
isCaseSensitive() {
|
|
279422
|
-
return
|
|
279422
|
+
return fs17.isCaseSensitive();
|
|
279423
279423
|
}
|
|
279424
279424
|
#getDirectoryNotFoundErrorIfNecessary(err, path20) {
|
|
279425
279425
|
return FileUtils.isNotExistsError(err) ? new exports2.errors.DirectoryNotFoundError(FileUtils.getStandardizedAbsolutePath(this, path20)) : err;
|
|
@@ -317461,12 +317461,12 @@ var require_dist = __commonJS({
|
|
|
317461
317461
|
throw new Error(`Unknown format "${name}"`);
|
|
317462
317462
|
return f;
|
|
317463
317463
|
};
|
|
317464
|
-
function addFormats(ajv, list,
|
|
317464
|
+
function addFormats(ajv, list, fs17, exportName) {
|
|
317465
317465
|
var _a3;
|
|
317466
317466
|
var _b;
|
|
317467
317467
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
317468
317468
|
for (const f of list)
|
|
317469
|
-
ajv.addFormat(f,
|
|
317469
|
+
ajv.addFormat(f, fs17[f]);
|
|
317470
317470
|
}
|
|
317471
317471
|
module3.exports = exports2 = formatsPlugin;
|
|
317472
317472
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -318403,6 +318403,27 @@ function jsonResponse(result) {
|
|
|
318403
318403
|
]
|
|
318404
318404
|
};
|
|
318405
318405
|
}
|
|
318406
|
+
async function catchUpWorkspaceIndex(workspaceId) {
|
|
318407
|
+
const now = Date.now();
|
|
318408
|
+
const current = catchupState.get(workspaceId);
|
|
318409
|
+
if (current?.inFlight) {
|
|
318410
|
+
await current.inFlight;
|
|
318411
|
+
return;
|
|
318412
|
+
}
|
|
318413
|
+
if (current && now - current.lastRunAt < MCP_CATCHUP_INTERVAL_MS) {
|
|
318414
|
+
return;
|
|
318415
|
+
}
|
|
318416
|
+
const inFlight = indexWorkspace({ workspaceId, mode: "incremental" }).then(() => void 0).catch((error2) => {
|
|
318417
|
+
console.error(`OpenEZ MCP catch-up indexing failed: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
318418
|
+
}).finally(() => {
|
|
318419
|
+
catchupState.set(workspaceId, { lastRunAt: Date.now() });
|
|
318420
|
+
});
|
|
318421
|
+
catchupState.set(workspaceId, { lastRunAt: current?.lastRunAt ?? 0, inFlight });
|
|
318422
|
+
await inFlight;
|
|
318423
|
+
}
|
|
318424
|
+
async function catchUpReadWorkspaces(workspaces2) {
|
|
318425
|
+
await Promise.all(workspaces2.map((workspace) => catchUpWorkspaceIndex(workspace.id)));
|
|
318426
|
+
}
|
|
318406
318427
|
async function createAndStartMcpServer(options) {
|
|
318407
318428
|
const resolver = createWorkspaceResolver(options);
|
|
318408
318429
|
const server2 = new Server(
|
|
@@ -318514,6 +318535,7 @@ async function createAndStartMcpServer(options) {
|
|
|
318514
318535
|
case "memory_query": {
|
|
318515
318536
|
const input = memoryQuerySchema.parse(request.params.arguments ?? {});
|
|
318516
318537
|
const workspaces2 = await resolver.resolveReadWorkspaces(input);
|
|
318538
|
+
await catchUpReadWorkspaces(workspaces2);
|
|
318517
318539
|
const results = await Promise.all(
|
|
318518
318540
|
workspaces2.map(async (workspace) => ({
|
|
318519
318541
|
workspace,
|
|
@@ -318548,6 +318570,7 @@ ${result.answerContext}`).join("\n\n");
|
|
|
318548
318570
|
case "code_context": {
|
|
318549
318571
|
const input = codeContextSchema.parse(request.params.arguments ?? {});
|
|
318550
318572
|
const workspaces2 = await resolver.resolveReadWorkspaces(input);
|
|
318573
|
+
await catchUpReadWorkspaces(workspaces2);
|
|
318551
318574
|
const results = await Promise.all(
|
|
318552
318575
|
workspaces2.map(async (workspace) => ({
|
|
318553
318576
|
workspaceId: workspace.id,
|
|
@@ -318565,6 +318588,7 @@ ${result.answerContext}`).join("\n\n");
|
|
|
318565
318588
|
case "graph_neighbors": {
|
|
318566
318589
|
const input = graphNeighborsSchema.parse(request.params.arguments ?? {});
|
|
318567
318590
|
const workspaces2 = await resolver.resolveReadWorkspaces(input);
|
|
318591
|
+
await catchUpReadWorkspaces(workspaces2);
|
|
318568
318592
|
const results = await Promise.all(
|
|
318569
318593
|
workspaces2.map(async (workspace) => ({
|
|
318570
318594
|
workspaceId: workspace.id,
|
|
@@ -318615,8 +318639,7 @@ async function autoIndexAndSync(searchRoot) {
|
|
|
318615
318639
|
}
|
|
318616
318640
|
}
|
|
318617
318641
|
if (!workspace) {
|
|
318618
|
-
|
|
318619
|
-
await writeLocalWorkspaceConfig(workspace);
|
|
318642
|
+
return;
|
|
318620
318643
|
}
|
|
318621
318644
|
if (workspace.indexingStatus === "pending" || workspace.documentCount === 0) {
|
|
318622
318645
|
try {
|
|
@@ -318624,6 +318647,9 @@ async function autoIndexAndSync(searchRoot) {
|
|
|
318624
318647
|
} catch {
|
|
318625
318648
|
}
|
|
318626
318649
|
}
|
|
318650
|
+
if (!WATCH_ENABLED) {
|
|
318651
|
+
return;
|
|
318652
|
+
}
|
|
318627
318653
|
let debounceTimer = null;
|
|
318628
318654
|
const watcher = esm_default.watch(resolvedRoot, {
|
|
318629
318655
|
ignored: WATCH_IGNORE_PATTERNS,
|
|
@@ -318642,8 +318668,12 @@ async function autoIndexAndSync(searchRoot) {
|
|
|
318642
318668
|
watcher.on("add", triggerReindex);
|
|
318643
318669
|
watcher.on("change", triggerReindex);
|
|
318644
318670
|
watcher.on("unlink", triggerReindex);
|
|
318671
|
+
watcher.on("error", (error2) => {
|
|
318672
|
+
console.error(`OpenEZ MCP auto-sync watcher disabled: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
318673
|
+
void watcher.close();
|
|
318674
|
+
});
|
|
318645
318675
|
}
|
|
318646
|
-
var import_node_fs8, import_node_path12, memoryQuerySchema, codeContextSchema, graphNeighborsSchema, memoryWriteSchema, indexWorkspaceSchema, WATCH_DEBOUNCE_MS, WATCH_IGNORE_PATTERNS;
|
|
318676
|
+
var import_node_fs8, import_node_path12, memoryQuerySchema, codeContextSchema, graphNeighborsSchema, memoryWriteSchema, indexWorkspaceSchema, MCP_CATCHUP_INTERVAL_MS, catchupState, WATCH_DEBOUNCE_MS, WATCH_ENABLED, WATCH_IGNORE_PATTERNS;
|
|
318647
318677
|
var init_mcp_core = __esm({
|
|
318648
318678
|
"../mcp/src/mcp-core.ts"() {
|
|
318649
318679
|
"use strict";
|
|
@@ -318697,7 +318727,10 @@ var init_mcp_core = __esm({
|
|
|
318697
318727
|
path: external_exports.string().optional(),
|
|
318698
318728
|
mode: external_exports.enum(["incremental", "full"]).optional()
|
|
318699
318729
|
});
|
|
318730
|
+
MCP_CATCHUP_INTERVAL_MS = Number(process.env.OPENEZ_MCP_CATCHUP_INTERVAL_MS ?? 5e3);
|
|
318731
|
+
catchupState = /* @__PURE__ */ new Map();
|
|
318700
318732
|
WATCH_DEBOUNCE_MS = 2e3;
|
|
318733
|
+
WATCH_ENABLED = ["1", "true", "yes"].includes((process.env.OPENEZ_MCP_WATCH ?? "").toLowerCase());
|
|
318701
318734
|
WATCH_IGNORE_PATTERNS = [
|
|
318702
318735
|
"**/node_modules/**",
|
|
318703
318736
|
"**/.git/**",
|
|
@@ -319173,24 +319206,42 @@ function mapWorkspace2(ws) {
|
|
|
319173
319206
|
updatedAt: new Date(ws.updatedAt)
|
|
319174
319207
|
};
|
|
319175
319208
|
}
|
|
319209
|
+
function resolveWebDist() {
|
|
319210
|
+
const sourceDist = import_node_path14.default.resolve(__dirname, "..", "dist");
|
|
319211
|
+
if ((0, import_node_fs11.existsSync)(import_node_path14.default.join(sourceDist, "index.html"))) return sourceDist;
|
|
319212
|
+
const cliDist = import_node_path14.default.resolve(__dirname, "web");
|
|
319213
|
+
if ((0, import_node_fs11.existsSync)(import_node_path14.default.join(cliDist, "index.html"))) return cliDist;
|
|
319214
|
+
return null;
|
|
319215
|
+
}
|
|
319176
319216
|
function createWebServer() {
|
|
319217
|
+
const webDist = resolveWebDist();
|
|
319218
|
+
if (webDist) {
|
|
319219
|
+
app.use("/*", (0, import_serve_static.serveStatic)({ root: webDist, rewriteRequestPath: (p) => p }));
|
|
319220
|
+
app.get("*", (c) => {
|
|
319221
|
+
const indexPath = import_node_path14.default.join(webDist, "index.html");
|
|
319222
|
+
const index2 = (0, import_node_fs11.readFileSync)(indexPath, "utf-8");
|
|
319223
|
+
return c.html(index2);
|
|
319224
|
+
});
|
|
319225
|
+
}
|
|
319177
319226
|
return app;
|
|
319178
319227
|
}
|
|
319179
|
-
var import_hono, import_cors, import_node_crypto3, import_node_fs10, import_node_path14, app, DEFAULT_INCLUDE_GLOBS, DEFAULT_EXCLUDE_GLOBS;
|
|
319228
|
+
var import_hono, import_cors, import_serve_static, import_node_crypto3, import_node_fs10, import_node_fs11, import_node_path14, app, DEFAULT_INCLUDE_GLOBS, DEFAULT_EXCLUDE_GLOBS;
|
|
319180
319229
|
var init_server3 = __esm({
|
|
319181
319230
|
"../web/src/server/index.ts"() {
|
|
319182
319231
|
"use strict";
|
|
319183
319232
|
import_hono = require("hono");
|
|
319184
319233
|
import_cors = require("hono/cors");
|
|
319234
|
+
import_serve_static = require("@hono/node-server/serve-static");
|
|
319185
319235
|
import_node_crypto3 = __toESM(require("crypto"), 1);
|
|
319186
319236
|
import_node_fs10 = require("fs");
|
|
319237
|
+
import_node_fs11 = require("fs");
|
|
319187
319238
|
import_node_path14 = __toESM(require("path"), 1);
|
|
319188
319239
|
init_sqlite2();
|
|
319189
319240
|
init_src3();
|
|
319190
319241
|
init_src();
|
|
319191
319242
|
app = new import_hono.Hono();
|
|
319192
319243
|
app.use("/*", (0, import_cors.cors)({
|
|
319193
|
-
origin: ["http://localhost:5173", "http://127.0.0.1:5173", "http://localhost:
|
|
319244
|
+
origin: ["http://localhost:5173", "http://127.0.0.1:5173", "http://localhost:11368", "http://127.0.0.1:11368"],
|
|
319194
319245
|
credentials: true
|
|
319195
319246
|
}));
|
|
319196
319247
|
DEFAULT_INCLUDE_GLOBS = [
|
|
@@ -319559,6 +319610,14 @@ function resolveCliInvocation() {
|
|
|
319559
319610
|
};
|
|
319560
319611
|
}
|
|
319561
319612
|
const repoRoot = import_node_path15.default.resolve(thisDir, "../../..");
|
|
319613
|
+
const builtCliPath = import_node_path15.default.resolve(thisDir, "../dist/cli.cjs");
|
|
319614
|
+
if (import_node_fs12.default.existsSync(builtCliPath)) {
|
|
319615
|
+
return {
|
|
319616
|
+
command: process.execPath,
|
|
319617
|
+
args: [builtCliPath, "serve", "--mcp"],
|
|
319618
|
+
repoRoot
|
|
319619
|
+
};
|
|
319620
|
+
}
|
|
319562
319621
|
const tsxPath = import_node_path15.default.join(repoRoot, "node_modules", ".bin", "tsx");
|
|
319563
319622
|
const cliPath = import_node_path15.default.resolve(thisDir, "./cli.ts");
|
|
319564
319623
|
return {
|
|
@@ -319567,10 +319626,11 @@ function resolveCliInvocation() {
|
|
|
319567
319626
|
repoRoot
|
|
319568
319627
|
};
|
|
319569
319628
|
}
|
|
319570
|
-
var import_node_path15, import_meta4;
|
|
319629
|
+
var import_node_fs12, import_node_path15, import_meta4;
|
|
319571
319630
|
var init_resolve_cli = __esm({
|
|
319572
319631
|
"src/resolve-cli.ts"() {
|
|
319573
319632
|
"use strict";
|
|
319633
|
+
import_node_fs12 = __toESM(require("fs"), 1);
|
|
319574
319634
|
import_node_path15 = __toESM(require("path"), 1);
|
|
319575
319635
|
import_meta4 = {};
|
|
319576
319636
|
}
|
|
@@ -320489,11 +320549,11 @@ function getCodexConfigPath() {
|
|
|
320489
320549
|
}
|
|
320490
320550
|
async function setupCodex(rootPath) {
|
|
320491
320551
|
const resolvedPath = import_node_path16.default.resolve(rootPath);
|
|
320492
|
-
if (!
|
|
320552
|
+
if (!import_node_fs13.default.existsSync(resolvedPath)) {
|
|
320493
320553
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320494
320554
|
process.exit(1);
|
|
320495
320555
|
}
|
|
320496
|
-
if (!
|
|
320556
|
+
if (!import_node_fs13.default.statSync(resolvedPath).isDirectory()) {
|
|
320497
320557
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320498
320558
|
process.exit(1);
|
|
320499
320559
|
}
|
|
@@ -320501,12 +320561,12 @@ async function setupCodex(rootPath) {
|
|
|
320501
320561
|
const label = "openez";
|
|
320502
320562
|
const configPath = getCodexConfigPath();
|
|
320503
320563
|
const configDir = import_node_path16.default.dirname(configPath);
|
|
320504
|
-
if (!
|
|
320505
|
-
|
|
320564
|
+
if (!import_node_fs13.default.existsSync(configDir)) {
|
|
320565
|
+
import_node_fs13.default.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
320506
320566
|
}
|
|
320507
320567
|
let config2 = {};
|
|
320508
|
-
if (
|
|
320509
|
-
const raw =
|
|
320568
|
+
if (import_node_fs13.default.existsSync(configPath)) {
|
|
320569
|
+
const raw = import_node_fs13.default.readFileSync(configPath, "utf-8");
|
|
320510
320570
|
try {
|
|
320511
320571
|
config2 = parse3(raw);
|
|
320512
320572
|
} catch {
|
|
@@ -320524,8 +320584,8 @@ async function setupCodex(rootPath) {
|
|
|
320524
320584
|
};
|
|
320525
320585
|
mcpServers[label] = entry;
|
|
320526
320586
|
const output = stringify2(config2);
|
|
320527
|
-
|
|
320528
|
-
|
|
320587
|
+
import_node_fs13.default.writeFileSync(configPath, output, "utf-8");
|
|
320588
|
+
import_node_fs13.default.chmodSync(configPath, 420);
|
|
320529
320589
|
console.log(`Codex MCP server configured: '${label}'`);
|
|
320530
320590
|
console.log(" Mode: shared multi-workspace MCP");
|
|
320531
320591
|
console.log(` Repo: ${repoRoot}`);
|
|
@@ -320533,11 +320593,11 @@ async function setupCodex(rootPath) {
|
|
|
320533
320593
|
console.log("");
|
|
320534
320594
|
console.log("Restart Codex or open a new session for the changes to take effect.");
|
|
320535
320595
|
}
|
|
320536
|
-
var
|
|
320596
|
+
var import_node_fs13, import_node_os3, import_node_path16;
|
|
320537
320597
|
var init_setup_codex = __esm({
|
|
320538
320598
|
"src/setup-codex.ts"() {
|
|
320539
320599
|
"use strict";
|
|
320540
|
-
|
|
320600
|
+
import_node_fs13 = __toESM(require("fs"), 1);
|
|
320541
320601
|
import_node_os3 = __toESM(require("os"), 1);
|
|
320542
320602
|
import_node_path16 = __toESM(require("path"), 1);
|
|
320543
320603
|
init_resolve_cli();
|
|
@@ -320555,11 +320615,11 @@ function getClaudeConfigPath() {
|
|
|
320555
320615
|
}
|
|
320556
320616
|
async function setupClaude(rootPath) {
|
|
320557
320617
|
const resolvedPath = import_node_path17.default.resolve(rootPath);
|
|
320558
|
-
if (!
|
|
320618
|
+
if (!import_node_fs14.default.existsSync(resolvedPath)) {
|
|
320559
320619
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320560
320620
|
process.exit(1);
|
|
320561
320621
|
}
|
|
320562
|
-
if (!
|
|
320622
|
+
if (!import_node_fs14.default.statSync(resolvedPath).isDirectory()) {
|
|
320563
320623
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320564
320624
|
process.exit(1);
|
|
320565
320625
|
}
|
|
@@ -320567,12 +320627,12 @@ async function setupClaude(rootPath) {
|
|
|
320567
320627
|
const label = "openez";
|
|
320568
320628
|
const configPath = getClaudeConfigPath();
|
|
320569
320629
|
const configDir = import_node_path17.default.dirname(configPath);
|
|
320570
|
-
if (!
|
|
320571
|
-
|
|
320630
|
+
if (!import_node_fs14.default.existsSync(configDir)) {
|
|
320631
|
+
import_node_fs14.default.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
320572
320632
|
}
|
|
320573
320633
|
let config2 = {};
|
|
320574
|
-
if (
|
|
320575
|
-
const raw =
|
|
320634
|
+
if (import_node_fs14.default.existsSync(configPath)) {
|
|
320635
|
+
const raw = import_node_fs14.default.readFileSync(configPath, "utf-8");
|
|
320576
320636
|
try {
|
|
320577
320637
|
config2 = JSON.parse(raw);
|
|
320578
320638
|
} catch {
|
|
@@ -320588,8 +320648,8 @@ async function setupClaude(rootPath) {
|
|
|
320588
320648
|
args,
|
|
320589
320649
|
startupTimeoutSec: 120
|
|
320590
320650
|
};
|
|
320591
|
-
|
|
320592
|
-
|
|
320651
|
+
import_node_fs14.default.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
320652
|
+
import_node_fs14.default.chmodSync(configPath, 420);
|
|
320593
320653
|
console.log(`Claude Code MCP server configured: '${label}'`);
|
|
320594
320654
|
console.log(" Mode: shared multi-workspace MCP");
|
|
320595
320655
|
console.log(` Repo: ${repoRoot}`);
|
|
@@ -320597,11 +320657,11 @@ async function setupClaude(rootPath) {
|
|
|
320597
320657
|
console.log("");
|
|
320598
320658
|
console.log("Restart Claude Code or open a new session for the changes to take effect.");
|
|
320599
320659
|
}
|
|
320600
|
-
var
|
|
320660
|
+
var import_node_fs14, import_node_os4, import_node_path17;
|
|
320601
320661
|
var init_setup_claude = __esm({
|
|
320602
320662
|
"src/setup-claude.ts"() {
|
|
320603
320663
|
"use strict";
|
|
320604
|
-
|
|
320664
|
+
import_node_fs14 = __toESM(require("fs"), 1);
|
|
320605
320665
|
import_node_os4 = __toESM(require("os"), 1);
|
|
320606
320666
|
import_node_path17 = __toESM(require("path"), 1);
|
|
320607
320667
|
init_resolve_cli();
|
|
@@ -320618,11 +320678,11 @@ function getOpenCodeConfigPath() {
|
|
|
320618
320678
|
}
|
|
320619
320679
|
async function setupOpenCode(rootPath) {
|
|
320620
320680
|
const resolvedPath = import_node_path18.default.resolve(rootPath);
|
|
320621
|
-
if (!
|
|
320681
|
+
if (!import_node_fs15.default.existsSync(resolvedPath)) {
|
|
320622
320682
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320623
320683
|
process.exit(1);
|
|
320624
320684
|
}
|
|
320625
|
-
if (!
|
|
320685
|
+
if (!import_node_fs15.default.statSync(resolvedPath).isDirectory()) {
|
|
320626
320686
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320627
320687
|
process.exit(1);
|
|
320628
320688
|
}
|
|
@@ -320630,12 +320690,12 @@ async function setupOpenCode(rootPath) {
|
|
|
320630
320690
|
const label = "openez";
|
|
320631
320691
|
const configPath = getOpenCodeConfigPath();
|
|
320632
320692
|
const configDir = import_node_path18.default.dirname(configPath);
|
|
320633
|
-
if (!
|
|
320634
|
-
|
|
320693
|
+
if (!import_node_fs15.default.existsSync(configDir)) {
|
|
320694
|
+
import_node_fs15.default.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
320635
320695
|
}
|
|
320636
320696
|
let config2 = {};
|
|
320637
|
-
if (
|
|
320638
|
-
const raw =
|
|
320697
|
+
if (import_node_fs15.default.existsSync(configPath)) {
|
|
320698
|
+
const raw = import_node_fs15.default.readFileSync(configPath, "utf-8");
|
|
320639
320699
|
try {
|
|
320640
320700
|
config2 = JSON.parse(raw);
|
|
320641
320701
|
} catch {
|
|
@@ -320650,8 +320710,8 @@ async function setupOpenCode(rootPath) {
|
|
|
320650
320710
|
command,
|
|
320651
320711
|
args
|
|
320652
320712
|
};
|
|
320653
|
-
|
|
320654
|
-
|
|
320713
|
+
import_node_fs15.default.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
320714
|
+
import_node_fs15.default.chmodSync(configPath, 420);
|
|
320655
320715
|
console.log(`OpenCode MCP server configured: '${label}'`);
|
|
320656
320716
|
console.log(" Mode: shared multi-workspace MCP");
|
|
320657
320717
|
console.log(` Repo: ${repoRoot}`);
|
|
@@ -320659,11 +320719,11 @@ async function setupOpenCode(rootPath) {
|
|
|
320659
320719
|
console.log("");
|
|
320660
320720
|
console.log("Restart OpenCode or open a new session for the changes to take effect.");
|
|
320661
320721
|
}
|
|
320662
|
-
var
|
|
320722
|
+
var import_node_fs15, import_node_os5, import_node_path18;
|
|
320663
320723
|
var init_setup_opencode = __esm({
|
|
320664
320724
|
"src/setup-opencode.ts"() {
|
|
320665
320725
|
"use strict";
|
|
320666
|
-
|
|
320726
|
+
import_node_fs15 = __toESM(require("fs"), 1);
|
|
320667
320727
|
import_node_os5 = __toESM(require("os"), 1);
|
|
320668
320728
|
import_node_path18 = __toESM(require("path"), 1);
|
|
320669
320729
|
init_resolve_cli();
|
|
@@ -320671,7 +320731,7 @@ var init_setup_opencode = __esm({
|
|
|
320671
320731
|
});
|
|
320672
320732
|
|
|
320673
320733
|
// src/cli.ts
|
|
320674
|
-
var
|
|
320734
|
+
var import_node_fs16 = __toESM(require("fs"), 1);
|
|
320675
320735
|
var import_node_path19 = __toESM(require("path"), 1);
|
|
320676
320736
|
init_esm2();
|
|
320677
320737
|
|
|
@@ -320696,14 +320756,14 @@ var {
|
|
|
320696
320756
|
init_src();
|
|
320697
320757
|
init_src4();
|
|
320698
320758
|
var program2 = new Command();
|
|
320699
|
-
program2.name("openez").description("OpenEZ Graph - Local-first knowledge retrieval system").version("0.
|
|
320759
|
+
program2.name("openez").description("OpenEZ Graph - Local-first knowledge retrieval system").version("0.3.0");
|
|
320700
320760
|
program2.command("init").description("Initialize a workspace at the given path and run initial index").argument("[path]", "path to the project directory", process.cwd()).option("--no-index", "skip initial indexing").action(async (targetPath, options) => {
|
|
320701
320761
|
const resolvedPath = import_node_path19.default.resolve(targetPath);
|
|
320702
|
-
if (!
|
|
320762
|
+
if (!import_node_fs16.default.existsSync(resolvedPath)) {
|
|
320703
320763
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320704
320764
|
process.exit(1);
|
|
320705
320765
|
}
|
|
320706
|
-
if (!
|
|
320766
|
+
if (!import_node_fs16.default.statSync(resolvedPath).isDirectory()) {
|
|
320707
320767
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320708
320768
|
process.exit(1);
|
|
320709
320769
|
}
|
|
@@ -320740,6 +320800,7 @@ program2.command("index").description("Index files in a workspace").argument("[p
|
|
|
320740
320800
|
});
|
|
320741
320801
|
console.log(`Auto-registered workspace '${workspace.name}' (${workspace.id})`);
|
|
320742
320802
|
}
|
|
320803
|
+
await writeLocalWorkspaceConfig(workspace);
|
|
320743
320804
|
const summary = await indexWorkspace({ workspaceId: workspace.id });
|
|
320744
320805
|
console.log(JSON.stringify(summary, null, 2));
|
|
320745
320806
|
});
|
|
@@ -320751,6 +320812,7 @@ program2.command("reindex").description("Full rebuild of a workspace index").arg
|
|
|
320751
320812
|
console.error(`Error: no workspace registered at ${resolvedPath}. Run 'openez init' first.`);
|
|
320752
320813
|
process.exit(1);
|
|
320753
320814
|
}
|
|
320815
|
+
await writeLocalWorkspaceConfig(workspace);
|
|
320754
320816
|
const summary = await indexWorkspace({ workspaceId: workspace.id, mode: "full" });
|
|
320755
320817
|
console.log(JSON.stringify(summary, null, 2));
|
|
320756
320818
|
});
|
|
@@ -320764,8 +320826,10 @@ program2.command("watch").description("Watch files and re-index on changes").arg
|
|
|
320764
320826
|
});
|
|
320765
320827
|
console.log(`Auto-registered workspace '${workspace.name}' (${workspace.id})`);
|
|
320766
320828
|
}
|
|
320829
|
+
await writeLocalWorkspaceConfig(workspace);
|
|
320830
|
+
const workspaceId = workspace.id;
|
|
320767
320831
|
console.log(`Running initial index for ${resolvedPath}...`);
|
|
320768
|
-
await indexWorkspace({ workspaceId
|
|
320832
|
+
await indexWorkspace({ workspaceId });
|
|
320769
320833
|
const watcher = esm_default.watch(resolvedPath, {
|
|
320770
320834
|
ignored: [
|
|
320771
320835
|
"**/node_modules/**",
|
|
@@ -320780,30 +320844,54 @@ program2.command("watch").description("Watch files and re-index on changes").arg
|
|
|
320780
320844
|
ignoreInitial: true,
|
|
320781
320845
|
persistent: true
|
|
320782
320846
|
});
|
|
320783
|
-
|
|
320784
|
-
|
|
320785
|
-
|
|
320786
|
-
|
|
320847
|
+
let debounceTimer;
|
|
320848
|
+
let isIndexing = false;
|
|
320849
|
+
let hasPendingChange = false;
|
|
320850
|
+
const runReindex = async () => {
|
|
320851
|
+
if (isIndexing) {
|
|
320852
|
+
hasPendingChange = true;
|
|
320853
|
+
return;
|
|
320854
|
+
}
|
|
320855
|
+
isIndexing = true;
|
|
320856
|
+
do {
|
|
320857
|
+
hasPendingChange = false;
|
|
320858
|
+
console.log("Change detected, re-indexing...");
|
|
320859
|
+
try {
|
|
320860
|
+
const summary = await indexWorkspace({ workspaceId });
|
|
320861
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
320862
|
+
} catch (error2) {
|
|
320863
|
+
console.error("Re-index failed:");
|
|
320864
|
+
console.error(error2);
|
|
320865
|
+
}
|
|
320866
|
+
} while (hasPendingChange);
|
|
320867
|
+
isIndexing = false;
|
|
320868
|
+
};
|
|
320869
|
+
const scheduleReindex = () => {
|
|
320870
|
+
if (debounceTimer) {
|
|
320871
|
+
clearTimeout(debounceTimer);
|
|
320872
|
+
}
|
|
320873
|
+
debounceTimer = setTimeout(() => {
|
|
320874
|
+
void runReindex();
|
|
320875
|
+
}, 250);
|
|
320787
320876
|
};
|
|
320788
|
-
watcher.on("add",
|
|
320789
|
-
watcher.on("change",
|
|
320790
|
-
watcher.on("unlink",
|
|
320877
|
+
watcher.on("add", scheduleReindex);
|
|
320878
|
+
watcher.on("change", scheduleReindex);
|
|
320879
|
+
watcher.on("unlink", scheduleReindex);
|
|
320791
320880
|
console.log(`Watching ${resolvedPath} for changes...`);
|
|
320792
320881
|
});
|
|
320793
|
-
program2.command("serve").description("Start the web dashboard or MCP server").option("--mcp", "run as MCP server instead of web").option("--web", "start the web dashboard API server").option("-p, --path <path>", "workspace path").option("--port <port>", "API server port (default:
|
|
320882
|
+
program2.command("serve").description("Start the web dashboard or MCP server").option("--mcp", "run as MCP server instead of web").option("--web", "start the web dashboard API server").option("-p, --path <path>", "workspace path").option("--port <port>", "API server port (default: 11368)").action(async (options) => {
|
|
320794
320883
|
if (options.mcp) {
|
|
320795
320884
|
const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_mcp_bridge(), mcp_bridge_exports));
|
|
320796
320885
|
await startMcpServer2(options.path ? import_node_path19.default.resolve(options.path) : void 0);
|
|
320797
320886
|
} else if (options.web) {
|
|
320798
|
-
const port = options.port ? Number(options.port) : Number(process.env.API_PORT ??
|
|
320887
|
+
const port = options.port ? Number(options.port) : Number(process.env.API_PORT ?? 11368);
|
|
320799
320888
|
process.env.API_PORT = String(port);
|
|
320800
320889
|
const { serve } = await import("@hono/node-server");
|
|
320801
320890
|
const { createWebServer: createWebServer2 } = await Promise.resolve().then(() => (init_web_server(), web_server_exports));
|
|
320802
320891
|
const app2 = createWebServer2();
|
|
320803
320892
|
serve({ fetch: app2.fetch, port }, (info) => {
|
|
320804
320893
|
console.log(`OpenEZ Graph web dashboard:`);
|
|
320805
|
-
console.log(`
|
|
320806
|
-
console.log(` Frontend: http://localhost:5173 (run 'pnpm dev:web' separately)`);
|
|
320894
|
+
console.log(` http://localhost:${info.port}`);
|
|
320807
320895
|
console.log(` Press Ctrl+C to stop`);
|
|
320808
320896
|
});
|
|
320809
320897
|
} else {
|