@openez-graph/cli 0.3.1 → 0.3.2
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.cjs +65 -48
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -318947,6 +318947,9 @@ function initializeWorkspaceSchema2(db) {
|
|
|
318947
318947
|
}
|
|
318948
318948
|
function getWorkspaceDb2(rootPath) {
|
|
318949
318949
|
const normalized = normalizeRootPath2(rootPath);
|
|
318950
|
+
if (normalized === "/" || normalized === "" || !import_node_fs9.default.existsSync(normalized)) {
|
|
318951
|
+
throw new Error(`Workspace root path does not exist: "${rootPath}"`);
|
|
318952
|
+
}
|
|
318950
318953
|
const cached2 = workspaceDbs.get(normalized);
|
|
318951
318954
|
if (cached2) {
|
|
318952
318955
|
return cached2;
|
|
@@ -319208,9 +319211,9 @@ function mapWorkspace2(ws) {
|
|
|
319208
319211
|
}
|
|
319209
319212
|
function resolveWebDist() {
|
|
319210
319213
|
const sourceDist = import_node_path14.default.resolve(__dirname, "..", "dist");
|
|
319211
|
-
if ((0,
|
|
319214
|
+
if ((0, import_node_fs10.existsSync)(import_node_path14.default.join(sourceDist, "index.html"))) return sourceDist;
|
|
319212
319215
|
const cliDist = import_node_path14.default.resolve(__dirname, "web");
|
|
319213
|
-
if ((0,
|
|
319216
|
+
if ((0, import_node_fs10.existsSync)(import_node_path14.default.join(cliDist, "index.html"))) return cliDist;
|
|
319214
319217
|
return null;
|
|
319215
319218
|
}
|
|
319216
319219
|
function createWebServer() {
|
|
@@ -319219,22 +319222,21 @@ function createWebServer() {
|
|
|
319219
319222
|
app.use("/*", (0, import_serve_static.serveStatic)({ root: webDist, rewriteRequestPath: (p) => p }));
|
|
319220
319223
|
app.get("*", (c) => {
|
|
319221
319224
|
const indexPath = import_node_path14.default.join(webDist, "index.html");
|
|
319222
|
-
const index2 = (0,
|
|
319225
|
+
const index2 = (0, import_node_fs10.readFileSync)(indexPath, "utf-8");
|
|
319223
319226
|
return c.html(index2);
|
|
319224
319227
|
});
|
|
319225
319228
|
}
|
|
319226
319229
|
return app;
|
|
319227
319230
|
}
|
|
319228
|
-
var import_hono, import_cors,
|
|
319231
|
+
var import_serve_static, import_hono, import_cors, import_node_crypto3, import_node_fs10, import_node_path14, app, DEFAULT_INCLUDE_GLOBS, DEFAULT_EXCLUDE_GLOBS;
|
|
319229
319232
|
var init_server3 = __esm({
|
|
319230
319233
|
"../web/src/server/index.ts"() {
|
|
319231
319234
|
"use strict";
|
|
319235
|
+
import_serve_static = require("@hono/node-server/serve-static");
|
|
319232
319236
|
import_hono = require("hono");
|
|
319233
319237
|
import_cors = require("hono/cors");
|
|
319234
|
-
import_serve_static = require("@hono/node-server/serve-static");
|
|
319235
319238
|
import_node_crypto3 = __toESM(require("crypto"), 1);
|
|
319236
319239
|
import_node_fs10 = require("fs");
|
|
319237
|
-
import_node_fs11 = require("fs");
|
|
319238
319240
|
import_node_path14 = __toESM(require("path"), 1);
|
|
319239
319241
|
init_sqlite2();
|
|
319240
319242
|
init_src3();
|
|
@@ -319264,7 +319266,13 @@ var init_server3 = __esm({
|
|
|
319264
319266
|
app.get("/api/dashboard", (c) => {
|
|
319265
319267
|
try {
|
|
319266
319268
|
const all = listRegistryWorkspaces();
|
|
319267
|
-
const target = all
|
|
319269
|
+
const target = all.find((ws) => {
|
|
319270
|
+
try {
|
|
319271
|
+
return ws.rootPath && ws.rootPath !== "/" && (0, import_node_fs10.existsSync)(ws.rootPath);
|
|
319272
|
+
} catch {
|
|
319273
|
+
return false;
|
|
319274
|
+
}
|
|
319275
|
+
}) ?? all[0];
|
|
319268
319276
|
if (!target) {
|
|
319269
319277
|
return c.json({
|
|
319270
319278
|
workspace: { id: "", name: "No workspace", root: "" },
|
|
@@ -319345,11 +319353,20 @@ var init_server3 = __esm({
|
|
|
319345
319353
|
try {
|
|
319346
319354
|
const dbPath = resolveRegistryDbPath2();
|
|
319347
319355
|
const all = listRegistryWorkspaces();
|
|
319348
|
-
const data = all.map((ws) =>
|
|
319349
|
-
|
|
319350
|
-
|
|
319351
|
-
|
|
319352
|
-
|
|
319356
|
+
const data = all.map((ws) => {
|
|
319357
|
+
let latestIndexRun = null;
|
|
319358
|
+
let latestGraphRun = null;
|
|
319359
|
+
try {
|
|
319360
|
+
latestIndexRun = getLatestIndexRun(ws.rootPath);
|
|
319361
|
+
latestGraphRun = getLatestGraphRun(ws.rootPath);
|
|
319362
|
+
} catch {
|
|
319363
|
+
}
|
|
319364
|
+
return {
|
|
319365
|
+
...mapWorkspace2(ws),
|
|
319366
|
+
latestIndexRun,
|
|
319367
|
+
latestGraphRun
|
|
319368
|
+
};
|
|
319369
|
+
});
|
|
319353
319370
|
return c.json({ ok: true, data });
|
|
319354
319371
|
} catch (err) {
|
|
319355
319372
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -319611,7 +319628,7 @@ function resolveCliInvocation() {
|
|
|
319611
319628
|
}
|
|
319612
319629
|
const repoRoot = import_node_path15.default.resolve(thisDir, "../../..");
|
|
319613
319630
|
const builtCliPath = import_node_path15.default.resolve(thisDir, "../dist/cli.cjs");
|
|
319614
|
-
if (
|
|
319631
|
+
if (import_node_fs11.default.existsSync(builtCliPath)) {
|
|
319615
319632
|
return {
|
|
319616
319633
|
command: process.execPath,
|
|
319617
319634
|
args: [builtCliPath, "serve", "--mcp"],
|
|
@@ -319626,11 +319643,11 @@ function resolveCliInvocation() {
|
|
|
319626
319643
|
repoRoot
|
|
319627
319644
|
};
|
|
319628
319645
|
}
|
|
319629
|
-
var
|
|
319646
|
+
var import_node_fs11, import_node_path15, import_meta4;
|
|
319630
319647
|
var init_resolve_cli = __esm({
|
|
319631
319648
|
"src/resolve-cli.ts"() {
|
|
319632
319649
|
"use strict";
|
|
319633
|
-
|
|
319650
|
+
import_node_fs11 = __toESM(require("fs"), 1);
|
|
319634
319651
|
import_node_path15 = __toESM(require("path"), 1);
|
|
319635
319652
|
import_meta4 = {};
|
|
319636
319653
|
}
|
|
@@ -320549,11 +320566,11 @@ function getCodexConfigPath() {
|
|
|
320549
320566
|
}
|
|
320550
320567
|
async function setupCodex(rootPath) {
|
|
320551
320568
|
const resolvedPath = import_node_path16.default.resolve(rootPath);
|
|
320552
|
-
if (!
|
|
320569
|
+
if (!import_node_fs12.default.existsSync(resolvedPath)) {
|
|
320553
320570
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320554
320571
|
process.exit(1);
|
|
320555
320572
|
}
|
|
320556
|
-
if (!
|
|
320573
|
+
if (!import_node_fs12.default.statSync(resolvedPath).isDirectory()) {
|
|
320557
320574
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320558
320575
|
process.exit(1);
|
|
320559
320576
|
}
|
|
@@ -320561,12 +320578,12 @@ async function setupCodex(rootPath) {
|
|
|
320561
320578
|
const label = "openez";
|
|
320562
320579
|
const configPath = getCodexConfigPath();
|
|
320563
320580
|
const configDir = import_node_path16.default.dirname(configPath);
|
|
320564
|
-
if (!
|
|
320565
|
-
|
|
320581
|
+
if (!import_node_fs12.default.existsSync(configDir)) {
|
|
320582
|
+
import_node_fs12.default.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
320566
320583
|
}
|
|
320567
320584
|
let config2 = {};
|
|
320568
|
-
if (
|
|
320569
|
-
const raw =
|
|
320585
|
+
if (import_node_fs12.default.existsSync(configPath)) {
|
|
320586
|
+
const raw = import_node_fs12.default.readFileSync(configPath, "utf-8");
|
|
320570
320587
|
try {
|
|
320571
320588
|
config2 = parse3(raw);
|
|
320572
320589
|
} catch {
|
|
@@ -320584,8 +320601,8 @@ async function setupCodex(rootPath) {
|
|
|
320584
320601
|
};
|
|
320585
320602
|
mcpServers[label] = entry;
|
|
320586
320603
|
const output = stringify2(config2);
|
|
320587
|
-
|
|
320588
|
-
|
|
320604
|
+
import_node_fs12.default.writeFileSync(configPath, output, "utf-8");
|
|
320605
|
+
import_node_fs12.default.chmodSync(configPath, 420);
|
|
320589
320606
|
console.log(`Codex MCP server configured: '${label}'`);
|
|
320590
320607
|
console.log(" Mode: shared multi-workspace MCP");
|
|
320591
320608
|
console.log(` Repo: ${repoRoot}`);
|
|
@@ -320593,11 +320610,11 @@ async function setupCodex(rootPath) {
|
|
|
320593
320610
|
console.log("");
|
|
320594
320611
|
console.log("Restart Codex or open a new session for the changes to take effect.");
|
|
320595
320612
|
}
|
|
320596
|
-
var
|
|
320613
|
+
var import_node_fs12, import_node_os3, import_node_path16;
|
|
320597
320614
|
var init_setup_codex = __esm({
|
|
320598
320615
|
"src/setup-codex.ts"() {
|
|
320599
320616
|
"use strict";
|
|
320600
|
-
|
|
320617
|
+
import_node_fs12 = __toESM(require("fs"), 1);
|
|
320601
320618
|
import_node_os3 = __toESM(require("os"), 1);
|
|
320602
320619
|
import_node_path16 = __toESM(require("path"), 1);
|
|
320603
320620
|
init_resolve_cli();
|
|
@@ -320615,11 +320632,11 @@ function getClaudeConfigPath() {
|
|
|
320615
320632
|
}
|
|
320616
320633
|
async function setupClaude(rootPath) {
|
|
320617
320634
|
const resolvedPath = import_node_path17.default.resolve(rootPath);
|
|
320618
|
-
if (!
|
|
320635
|
+
if (!import_node_fs13.default.existsSync(resolvedPath)) {
|
|
320619
320636
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320620
320637
|
process.exit(1);
|
|
320621
320638
|
}
|
|
320622
|
-
if (!
|
|
320639
|
+
if (!import_node_fs13.default.statSync(resolvedPath).isDirectory()) {
|
|
320623
320640
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320624
320641
|
process.exit(1);
|
|
320625
320642
|
}
|
|
@@ -320627,12 +320644,12 @@ async function setupClaude(rootPath) {
|
|
|
320627
320644
|
const label = "openez";
|
|
320628
320645
|
const configPath = getClaudeConfigPath();
|
|
320629
320646
|
const configDir = import_node_path17.default.dirname(configPath);
|
|
320630
|
-
if (!
|
|
320631
|
-
|
|
320647
|
+
if (!import_node_fs13.default.existsSync(configDir)) {
|
|
320648
|
+
import_node_fs13.default.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
320632
320649
|
}
|
|
320633
320650
|
let config2 = {};
|
|
320634
|
-
if (
|
|
320635
|
-
const raw =
|
|
320651
|
+
if (import_node_fs13.default.existsSync(configPath)) {
|
|
320652
|
+
const raw = import_node_fs13.default.readFileSync(configPath, "utf-8");
|
|
320636
320653
|
try {
|
|
320637
320654
|
config2 = JSON.parse(raw);
|
|
320638
320655
|
} catch {
|
|
@@ -320648,8 +320665,8 @@ async function setupClaude(rootPath) {
|
|
|
320648
320665
|
args,
|
|
320649
320666
|
startupTimeoutSec: 120
|
|
320650
320667
|
};
|
|
320651
|
-
|
|
320652
|
-
|
|
320668
|
+
import_node_fs13.default.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
320669
|
+
import_node_fs13.default.chmodSync(configPath, 420);
|
|
320653
320670
|
console.log(`Claude Code MCP server configured: '${label}'`);
|
|
320654
320671
|
console.log(" Mode: shared multi-workspace MCP");
|
|
320655
320672
|
console.log(` Repo: ${repoRoot}`);
|
|
@@ -320657,11 +320674,11 @@ async function setupClaude(rootPath) {
|
|
|
320657
320674
|
console.log("");
|
|
320658
320675
|
console.log("Restart Claude Code or open a new session for the changes to take effect.");
|
|
320659
320676
|
}
|
|
320660
|
-
var
|
|
320677
|
+
var import_node_fs13, import_node_os4, import_node_path17;
|
|
320661
320678
|
var init_setup_claude = __esm({
|
|
320662
320679
|
"src/setup-claude.ts"() {
|
|
320663
320680
|
"use strict";
|
|
320664
|
-
|
|
320681
|
+
import_node_fs13 = __toESM(require("fs"), 1);
|
|
320665
320682
|
import_node_os4 = __toESM(require("os"), 1);
|
|
320666
320683
|
import_node_path17 = __toESM(require("path"), 1);
|
|
320667
320684
|
init_resolve_cli();
|
|
@@ -320678,11 +320695,11 @@ function getOpenCodeConfigPath() {
|
|
|
320678
320695
|
}
|
|
320679
320696
|
async function setupOpenCode(rootPath) {
|
|
320680
320697
|
const resolvedPath = import_node_path18.default.resolve(rootPath);
|
|
320681
|
-
if (!
|
|
320698
|
+
if (!import_node_fs14.default.existsSync(resolvedPath)) {
|
|
320682
320699
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320683
320700
|
process.exit(1);
|
|
320684
320701
|
}
|
|
320685
|
-
if (!
|
|
320702
|
+
if (!import_node_fs14.default.statSync(resolvedPath).isDirectory()) {
|
|
320686
320703
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320687
320704
|
process.exit(1);
|
|
320688
320705
|
}
|
|
@@ -320690,12 +320707,12 @@ async function setupOpenCode(rootPath) {
|
|
|
320690
320707
|
const label = "openez";
|
|
320691
320708
|
const configPath = getOpenCodeConfigPath();
|
|
320692
320709
|
const configDir = import_node_path18.default.dirname(configPath);
|
|
320693
|
-
if (!
|
|
320694
|
-
|
|
320710
|
+
if (!import_node_fs14.default.existsSync(configDir)) {
|
|
320711
|
+
import_node_fs14.default.mkdirSync(configDir, { recursive: true, mode: 493 });
|
|
320695
320712
|
}
|
|
320696
320713
|
let config2 = {};
|
|
320697
|
-
if (
|
|
320698
|
-
const raw =
|
|
320714
|
+
if (import_node_fs14.default.existsSync(configPath)) {
|
|
320715
|
+
const raw = import_node_fs14.default.readFileSync(configPath, "utf-8");
|
|
320699
320716
|
try {
|
|
320700
320717
|
config2 = JSON.parse(raw);
|
|
320701
320718
|
} catch {
|
|
@@ -320710,8 +320727,8 @@ async function setupOpenCode(rootPath) {
|
|
|
320710
320727
|
command,
|
|
320711
320728
|
args
|
|
320712
320729
|
};
|
|
320713
|
-
|
|
320714
|
-
|
|
320730
|
+
import_node_fs14.default.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
320731
|
+
import_node_fs14.default.chmodSync(configPath, 420);
|
|
320715
320732
|
console.log(`OpenCode MCP server configured: '${label}'`);
|
|
320716
320733
|
console.log(" Mode: shared multi-workspace MCP");
|
|
320717
320734
|
console.log(` Repo: ${repoRoot}`);
|
|
@@ -320719,11 +320736,11 @@ async function setupOpenCode(rootPath) {
|
|
|
320719
320736
|
console.log("");
|
|
320720
320737
|
console.log("Restart OpenCode or open a new session for the changes to take effect.");
|
|
320721
320738
|
}
|
|
320722
|
-
var
|
|
320739
|
+
var import_node_fs14, import_node_os5, import_node_path18;
|
|
320723
320740
|
var init_setup_opencode = __esm({
|
|
320724
320741
|
"src/setup-opencode.ts"() {
|
|
320725
320742
|
"use strict";
|
|
320726
|
-
|
|
320743
|
+
import_node_fs14 = __toESM(require("fs"), 1);
|
|
320727
320744
|
import_node_os5 = __toESM(require("os"), 1);
|
|
320728
320745
|
import_node_path18 = __toESM(require("path"), 1);
|
|
320729
320746
|
init_resolve_cli();
|
|
@@ -320731,7 +320748,7 @@ var init_setup_opencode = __esm({
|
|
|
320731
320748
|
});
|
|
320732
320749
|
|
|
320733
320750
|
// src/cli.ts
|
|
320734
|
-
var
|
|
320751
|
+
var import_node_fs15 = __toESM(require("fs"), 1);
|
|
320735
320752
|
var import_node_path19 = __toESM(require("path"), 1);
|
|
320736
320753
|
init_esm2();
|
|
320737
320754
|
|
|
@@ -320759,11 +320776,11 @@ var program2 = new Command();
|
|
|
320759
320776
|
program2.name("openez").description("OpenEZ Graph - Local-first knowledge retrieval system").version("0.3.0");
|
|
320760
320777
|
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) => {
|
|
320761
320778
|
const resolvedPath = import_node_path19.default.resolve(targetPath);
|
|
320762
|
-
if (!
|
|
320779
|
+
if (!import_node_fs15.default.existsSync(resolvedPath)) {
|
|
320763
320780
|
console.error(`Error: path does not exist: ${resolvedPath}`);
|
|
320764
320781
|
process.exit(1);
|
|
320765
320782
|
}
|
|
320766
|
-
if (!
|
|
320783
|
+
if (!import_node_fs15.default.statSync(resolvedPath).isDirectory()) {
|
|
320767
320784
|
console.error(`Error: path is not a directory: ${resolvedPath}`);
|
|
320768
320785
|
process.exit(1);
|
|
320769
320786
|
}
|
package/package.json
CHANGED