@cortex-context/cli 0.0.11 → 0.0.12

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
@@ -5617,7 +5617,7 @@ var require_dist = __commonJS({
5617
5617
  });
5618
5618
  };
5619
5619
  }
5620
- var prompts5 = require_prompts();
5620
+ var prompts6 = require_prompts();
5621
5621
  var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
5622
5622
  var noop = () => {
5623
5623
  };
@@ -5668,7 +5668,7 @@ var require_dist = __commonJS({
5668
5668
  var _question2 = question;
5669
5669
  name = _question2.name;
5670
5670
  type = _question2.type;
5671
- if (prompts5[type] === void 0) {
5671
+ if (prompts6[type] === void 0) {
5672
5672
  throw new Error(`prompt type (${type}) is not defined`);
5673
5673
  }
5674
5674
  if (override2[question.name] !== void 0) {
@@ -5679,7 +5679,7 @@ var require_dist = __commonJS({
5679
5679
  }
5680
5680
  }
5681
5681
  try {
5682
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts5[type](question);
5682
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts6[type](question);
5683
5683
  answers[name] = answer = yield getFormattedAnswer(question, answer, true);
5684
5684
  quit = yield onSubmit(question, answer, answers);
5685
5685
  } catch (err) {
@@ -5711,7 +5711,7 @@ var require_dist = __commonJS({
5711
5711
  }
5712
5712
  module2.exports = Object.assign(prompt, {
5713
5713
  prompt,
5714
- prompts: prompts5,
5714
+ prompts: prompts6,
5715
5715
  inject,
5716
5716
  override
5717
5717
  });
@@ -7798,7 +7798,7 @@ var require_prompts2 = __commonJS({
7798
7798
  var require_lib = __commonJS({
7799
7799
  "node_modules/prompts/lib/index.js"(exports2, module2) {
7800
7800
  "use strict";
7801
- var prompts5 = require_prompts2();
7801
+ var prompts6 = require_prompts2();
7802
7802
  var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
7803
7803
  var noop = () => {
7804
7804
  };
@@ -7830,7 +7830,7 @@ var require_lib = __commonJS({
7830
7830
  throw new Error("prompt message is required");
7831
7831
  }
7832
7832
  ({ name, type } = question);
7833
- if (prompts5[type] === void 0) {
7833
+ if (prompts6[type] === void 0) {
7834
7834
  throw new Error(`prompt type (${type}) is not defined`);
7835
7835
  }
7836
7836
  if (override2[question.name] !== void 0) {
@@ -7841,7 +7841,7 @@ var require_lib = __commonJS({
7841
7841
  }
7842
7842
  }
7843
7843
  try {
7844
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts5[type](question);
7844
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts6[type](question);
7845
7845
  answers[name] = answer = await getFormattedAnswer(question, answer, true);
7846
7846
  quit = await onSubmit(question, answer, answers);
7847
7847
  } catch (err) {
@@ -7864,7 +7864,7 @@ var require_lib = __commonJS({
7864
7864
  function override(answers) {
7865
7865
  prompt._override = Object.assign({}, answers);
7866
7866
  }
7867
- module2.exports = Object.assign(prompt, { prompt, prompts: prompts5, inject, override });
7867
+ module2.exports = Object.assign(prompt, { prompt, prompts: prompts6, inject, override });
7868
7868
  }
7869
7869
  });
7870
7870
 
@@ -28539,6 +28539,70 @@ async function uninstallCommand(options) {
28539
28539
  console.log("");
28540
28540
  }
28541
28541
 
28542
+ // src/commands/reset.ts
28543
+ var import_prompts5 = __toESM(require_prompts3());
28544
+ async function resetCommand(options) {
28545
+ const config2 = readConfig();
28546
+ const url = config2.url;
28547
+ const token = config2.token ?? "";
28548
+ if (!url) {
28549
+ console.error(
28550
+ source_default.red(
28551
+ " \u2717 Cortex URL not configured. Run `cortex-context init` first."
28552
+ )
28553
+ );
28554
+ process.exit(1);
28555
+ }
28556
+ console.log("");
28557
+ console.log(source_default.bold(" \u25C6 Cortex Context \u2014 Reset Graph"));
28558
+ console.log("");
28559
+ console.log(source_default.yellow(" \u26A0 This will delete ALL nodes and relationships from the graph."));
28560
+ console.log(source_default.dim(` Server: ${url}`));
28561
+ console.log("");
28562
+ const confirmed = options.yes || await (0, import_prompts5.default)({
28563
+ type: "confirm",
28564
+ name: "ok",
28565
+ message: "Are you sure you want to wipe the entire graph?",
28566
+ initial: false
28567
+ }).then((r) => r.ok);
28568
+ if (!confirmed) {
28569
+ console.log(source_default.dim(" Aborted."));
28570
+ return;
28571
+ }
28572
+ console.log("");
28573
+ process.stdout.write(source_default.dim(" Sending DELETE /api/v1/graph... "));
28574
+ const endpoint = `${url.replace(/\/$/, "")}/api/v1/graph`;
28575
+ let res;
28576
+ try {
28577
+ res = await fetch(endpoint, {
28578
+ method: "DELETE",
28579
+ headers: {
28580
+ Authorization: `Bearer ${token}`,
28581
+ "Content-Type": "application/json"
28582
+ }
28583
+ });
28584
+ } catch (err) {
28585
+ process.stdout.write("\n");
28586
+ console.error(
28587
+ source_default.red(` \u2717 Network error: ${err instanceof Error ? err.message : String(err)}`)
28588
+ );
28589
+ process.exit(1);
28590
+ }
28591
+ if (!res.ok) {
28592
+ process.stdout.write("\n");
28593
+ const body = await res.text().catch(() => "");
28594
+ console.error(
28595
+ source_default.red(` \u2717 Server returned ${res.status}: ${body || res.statusText}`)
28596
+ );
28597
+ process.exit(1);
28598
+ }
28599
+ const data = await res.json();
28600
+ process.stdout.write("\n");
28601
+ console.log(source_default.green(` \u2713 ${data.message}`));
28602
+ console.log("");
28603
+ console.log(source_default.dim(" Run `cortex-context sync` to re-ingest the graph."));
28604
+ }
28605
+
28542
28606
  // src/cli.ts
28543
28607
  var import_fs14 = require("fs");
28544
28608
  var import_path15 = require("path");
@@ -28588,6 +28652,9 @@ function createCli() {
28588
28652
  "--workspace <path>",
28589
28653
  "Target workspace path (defaults to current directory)"
28590
28654
  ).option("-y, --yes", "Skip confirmation prompt").option("--keep-config", "Preserve ~/.cortex-context/config.json").option("--keep-skills", "Preserve .github/skills/cortex-* directories").option("--keep-hook", "Preserve .git/hooks/post-commit").action(uninstallCommand);
28655
+ program3.command("reset").description(
28656
+ "Wipe all nodes and relationships from the Cortex Knowledge Graph (irreversible)"
28657
+ ).option("-y, --yes", "Skip confirmation prompt").action(resetCommand);
28591
28658
  return program3;
28592
28659
  }
28593
28660