@cortex-context/cli 0.0.8 → 0.0.9
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/index.js
CHANGED
|
@@ -18220,7 +18220,7 @@ function tryFixLxcSysctl() {
|
|
|
18220
18220
|
return { applied: false };
|
|
18221
18221
|
}
|
|
18222
18222
|
}
|
|
18223
|
-
async function deployLocalStack(workspacePath) {
|
|
18223
|
+
async function deployLocalStack(workspacePath, opts = {}) {
|
|
18224
18224
|
const templatePath = (0, import_path5.join)(
|
|
18225
18225
|
__dirname,
|
|
18226
18226
|
"templates",
|
|
@@ -18234,22 +18234,29 @@ async function deployLocalStack(workspacePath) {
|
|
|
18234
18234
|
if (!(0, import_fs5.existsSync)(destPath)) {
|
|
18235
18235
|
(0, import_fs5.cpSync)(templatePath, destPath);
|
|
18236
18236
|
}
|
|
18237
|
+
const imageTag = opts.embeddings ? "latest-embeddings" : "latest";
|
|
18238
|
+
const cortexImage = `ghcr.io/rodrigoroldan/cortex-context:${imageTag}`;
|
|
18237
18239
|
try {
|
|
18238
18240
|
(0, import_child_process.execSync)(
|
|
18239
18241
|
`docker compose --project-name cortex-local -f "${destPath}" up -d`,
|
|
18240
18242
|
{
|
|
18241
18243
|
cwd: workspacePath,
|
|
18242
|
-
|
|
18244
|
+
// stdout → terminal (user sees progress), stderr → captured for error detection
|
|
18245
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
18246
|
+
env: { ...process.env, CORTEX_IMAGE: cortexImage }
|
|
18243
18247
|
}
|
|
18244
18248
|
);
|
|
18245
18249
|
return { started: true };
|
|
18246
18250
|
} catch (err) {
|
|
18251
|
+
const stderr = err instanceof Error && "stderr" in err ? err.stderr?.toString() ?? "" : "";
|
|
18247
18252
|
const msg = err instanceof Error ? err.message : String(err);
|
|
18248
|
-
const
|
|
18253
|
+
const combined = stderr + msg;
|
|
18254
|
+
const isLxcSysctlError = combined.includes("ip_unprivileged_port_start") || combined.includes("sysctl net.ipv4");
|
|
18249
18255
|
return {
|
|
18250
18256
|
started: false,
|
|
18251
18257
|
isLxcSysctlError,
|
|
18252
|
-
error: `docker compose failed: ${msg}`
|
|
18258
|
+
error: `docker compose failed: ${msg}${stderr ? `
|
|
18259
|
+
${stderr.trim()}` : ""}`
|
|
18253
18260
|
};
|
|
18254
18261
|
}
|
|
18255
18262
|
}
|
|
@@ -28056,6 +28063,13 @@ async function serverCommand(options) {
|
|
|
28056
28063
|
" Installs and starts the Cortex stack (Neo4j + Cortex API) via Docker."
|
|
28057
28064
|
)
|
|
28058
28065
|
);
|
|
28066
|
+
if (options.embeddings) {
|
|
28067
|
+
console.log(
|
|
28068
|
+
source_default.dim(
|
|
28069
|
+
" Mode: embeddings (sentence-transformers + all-MiniLM-L6-v2 baked in, ~1.5 GB image)"
|
|
28070
|
+
)
|
|
28071
|
+
);
|
|
28072
|
+
}
|
|
28059
28073
|
console.log("");
|
|
28060
28074
|
const defaultDir = (0, import_path13.join)((0, import_os4.homedir)(), ".cortex-context");
|
|
28061
28075
|
const workDir = options.dir ?? defaultDir;
|
|
@@ -28161,28 +28175,54 @@ async function serverCommand(options) {
|
|
|
28161
28175
|
console.log(source_default.bold(" Step 3: Starting Cortex stack"));
|
|
28162
28176
|
const sysctlFix = tryFixLxcSysctl();
|
|
28163
28177
|
if (sysctlFix.applied) {
|
|
28164
|
-
console.log(
|
|
28178
|
+
console.log(
|
|
28179
|
+
source_default.dim(
|
|
28180
|
+
" (applied net.ipv4.ip_unprivileged_port_start=0 for LXC compatibility)"
|
|
28181
|
+
)
|
|
28182
|
+
);
|
|
28165
28183
|
}
|
|
28166
28184
|
const startSpinner = ora(" Running docker compose up -d...").start();
|
|
28167
|
-
const startResult = await deployLocalStack(workDir
|
|
28185
|
+
const startResult = await deployLocalStack(workDir, {
|
|
28186
|
+
embeddings: options.embeddings ?? false
|
|
28187
|
+
});
|
|
28168
28188
|
if (!startResult.started) {
|
|
28169
28189
|
startSpinner.fail(source_default.red(" \u2717 Docker Compose failed"));
|
|
28170
28190
|
if (startResult.isLxcSysctlError) {
|
|
28171
28191
|
console.log("");
|
|
28172
|
-
console.log(
|
|
28192
|
+
console.log(
|
|
28193
|
+
source_default.bold.yellow(" \u26A0 Proxmox LXC sysctl restriction detected")
|
|
28194
|
+
);
|
|
28173
28195
|
console.log("");
|
|
28174
|
-
console.log(
|
|
28175
|
-
|
|
28176
|
-
|
|
28196
|
+
console.log(
|
|
28197
|
+
source_default.dim(
|
|
28198
|
+
" runc >= 1.1 tries to configure net.ipv4.ip_unprivileged_port_start"
|
|
28199
|
+
)
|
|
28200
|
+
);
|
|
28201
|
+
console.log(
|
|
28202
|
+
source_default.dim(
|
|
28203
|
+
" inside each container's network namespace. Proxmox LXC containers"
|
|
28204
|
+
)
|
|
28205
|
+
);
|
|
28206
|
+
console.log(
|
|
28207
|
+
source_default.dim(
|
|
28208
|
+
" block this unless the sysctl is explicitly allowed in the LXC config."
|
|
28209
|
+
)
|
|
28210
|
+
);
|
|
28177
28211
|
console.log("");
|
|
28178
28212
|
console.log(source_default.bold(" Fix (run on the Proxmox host):"));
|
|
28179
28213
|
console.log("");
|
|
28180
28214
|
console.log(source_default.cyan(" CTID=<your-container-id>"));
|
|
28181
|
-
console.log(
|
|
28215
|
+
console.log(
|
|
28216
|
+
source_default.cyan(
|
|
28217
|
+
' echo "lxc.sysctl.net.ipv4.ip_unprivileged_port_start = 0" \\'
|
|
28218
|
+
)
|
|
28219
|
+
);
|
|
28182
28220
|
console.log(source_default.cyan(" >> /etc/pve/lxc/${CTID}.conf"));
|
|
28183
28221
|
console.log(source_default.cyan(" pct restart ${CTID}"));
|
|
28184
28222
|
console.log("");
|
|
28185
|
-
console.log(
|
|
28223
|
+
console.log(
|
|
28224
|
+
source_default.dim(" Then run cortex-context server again inside the LXC.")
|
|
28225
|
+
);
|
|
28186
28226
|
} else {
|
|
28187
28227
|
console.log(source_default.dim(` ${startResult.error}`));
|
|
28188
28228
|
}
|
|
@@ -28454,6 +28494,9 @@ function createCli() {
|
|
|
28454
28494
|
).option(
|
|
28455
28495
|
"--skip-docker-install",
|
|
28456
28496
|
"Fail instead of auto-installing Docker when it is not found"
|
|
28497
|
+
).option(
|
|
28498
|
+
"--embeddings",
|
|
28499
|
+
"Use the embeddings-enabled image (includes sentence-transformers + all-MiniLM-L6-v2, ~1.5 GB)"
|
|
28457
28500
|
).action(serverCommand);
|
|
28458
28501
|
program3.command("sync").description("Ingest latest git diff into the Cortex Knowledge Graph").option("--repo <path>", "Repository path (defaults to current directory)").option("--dry-run", "Show diff without sending to Cortex API").action(syncCommand);
|
|
28459
28502
|
program3.command("update").description(
|