holycodex 0.6.1-dev.29547206710.2 → 0.7.0-dev.29548804255.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.
Files changed (2) hide show
  1. package/dist/cli.js +48 -9
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import { existsSync } from "node:fs";
7
7
  import { pluginRoot } from "@holycodex/plugin";
8
8
  import { Buffer } from "node:buffer";
9
9
  //#region packages/cli/src/catalog.ts
10
- var VERSION = "0.6.1-dev.29547206710.2";
10
+ var VERSION = "0.7.0-dev.29548804255.1";
11
11
  var SKILLS = [
12
12
  "ast-grep",
13
13
  "caveman",
@@ -463,6 +463,11 @@ var START = "# >>> holycodex managed >>>";
463
463
  var END = "# <<< holycodex managed <<<";
464
464
  var ORIGINAL_ROOT = "# holycodex original root: ";
465
465
  var ORIGINAL_TABLE_KEY = "# holycodex original table key: ";
466
+ var ROOT_PREFERENCES = [
467
+ ["model", `model = "${ROOT_MODEL.model}"`],
468
+ ["model_reasoning_effort", `model_reasoning_effort = "${ROOT_MODEL.reasoningEffort}"`],
469
+ ["model_verbosity", "model_verbosity = \"low\""]
470
+ ];
466
471
  var OLD_NAMESPACES = [
467
472
  "marketplaces.sisyphuslabs",
468
473
  "plugins.\"omo@sisyphuslabs\"",
@@ -533,14 +538,35 @@ function rootValue(input, key) {
533
538
  function removeRootValue(input, value) {
534
539
  return value === void 0 ? input : input.replace(value, "");
535
540
  }
541
+ function preserveManagedRootPreferences(input, base) {
542
+ const managedRoot = new RegExp(`^${START}\\r?\\n([\\s\\S]*?)^${END}\\r?$`, "m").exec(input)?.[1];
543
+ if (managedRoot === void 0) return base;
544
+ const firstTable = base.search(/^\s*\[/m);
545
+ const root = firstTable < 0 ? base : base.slice(0, firstTable);
546
+ const tables = firstTable < 0 ? "" : base.slice(firstTable);
547
+ let updatedRoot = root.trim();
548
+ for (const [key, fallback] of ROOT_PREFERENCES) {
549
+ const live = rootValue(managedRoot, key)?.trim();
550
+ if (live === void 0 || live === (rootValue(root, key)?.trim() ?? fallback)) continue;
551
+ updatedRoot = removeRootValue(updatedRoot, rootValue(updatedRoot, key)).trim();
552
+ updatedRoot = `${updatedRoot}${updatedRoot ? "\n" : ""}${live}`;
553
+ }
554
+ if (updatedRoot === root.trim()) return base;
555
+ return `${updatedRoot}${tables ? `\n${tables.trimStart()}` : ""}`;
556
+ }
536
557
  function mergedStatusLine(original) {
537
558
  if (original === void 0) return "[\"model-with-reasoning\", \"context-remaining\", \"current-dir\"]";
538
- const items = [...original.slice(original.indexOf("=") + 1).matchAll(/"((?:\\.|[^"\\])*)"/g)].map((match) => JSON.parse(`"${match[1]}"`));
559
+ const items = [...original.slice(original.indexOf("=") + 1).matchAll(/"((?:\\.|[^"\\])*)"|'([^']*)'/g)].map((match) => {
560
+ if (match[1] === void 0) return match[2] ?? "";
561
+ const parsed = JSON.parse(`"${match[1]}"`);
562
+ if (typeof parsed !== "string") throw new Error("Invalid status-line string");
563
+ return parsed;
564
+ });
539
565
  if (!items.includes("context-remaining")) items.push("context-remaining");
540
566
  return `[${items.map((item) => JSON.stringify(item)).join(", ")}]`;
541
567
  }
542
568
  function installConfig(input, mode, _platform) {
543
- const base = removeLegacyOmo(removeManaged(input));
569
+ const base = preserveManagedRootPreferences(input, removeLegacyOmo(removeManaged(input)));
544
570
  const firstTable = base.search(/^\s*\[/m);
545
571
  const root = firstTable < 0 ? base : base.slice(0, firstTable);
546
572
  const tables = firstTable < 0 ? "" : base.slice(firstTable);
@@ -554,11 +580,13 @@ function installConfig(input, mode, _platform) {
554
580
  const preservedRoot = controlled.reduce(removeRootValue, root).trim();
555
581
  const hasModel = /^\s*model\s*=/m.test(preservedRoot);
556
582
  const hasEffort = /^\s*model_reasoning_effort\s*=/m.test(preservedRoot);
583
+ const hasVerbosity = /^\s*model_verbosity\s*=/m.test(preservedRoot);
557
584
  const model = hasModel ? "" : `model = "${ROOT_MODEL.model}"\n`;
558
585
  const effort = hasEffort ? "" : `model_reasoning_effort = "${ROOT_MODEL.reasoningEffort}"\n`;
586
+ const verbosity = hasVerbosity ? "" : "model_verbosity = \"low\"\n";
559
587
  const approval = mode === "default" ? "on-request" : "never";
560
588
  const sandbox = mode === "dangerous" ? "danger-full-access" : "workspace-write";
561
- let configured = `${`${START}\n${originalRoot ? `${ORIGINAL_ROOT}${Buffer.from(originalRoot).toString("base64")}\n` : ""}${model}${effort}${preservedRoot ? `${preservedRoot}\n` : ""}approval_policy = "${approval}"\nsandbox_mode = "${sandbox}"\nstatus_line = ${mergedStatusLine(controlled[3])}\n${END}`}${tables ? `\n\n${tables}` : ""}`;
589
+ let configured = `${`${START}\n${originalRoot ? `${ORIGINAL_ROOT}${Buffer.from(originalRoot).toString("base64")}\n` : ""}${model}${effort}${verbosity}${preservedRoot ? `${preservedRoot}\n` : ""}approval_policy = "${approval}"\nsandbox_mode = "${sandbox}"\nstatus_line = ${mergedStatusLine(controlled[3])}\n${END}`}${tables ? `\n\n${tables}` : ""}`;
562
590
  configured = injectTableKey(configured, "features", "default_mode_request_user_input", "true");
563
591
  configured = injectTableKey(configured, "features", "multi_agent", "true");
564
592
  configured = injectTableKey(configured, "agents", "max_threads", "2");
@@ -778,7 +806,10 @@ function renderHelp(version, color) {
778
806
  const title = paint(color, `${BOLD}${CYAN}`, `HOLYCODEX ${version}`);
779
807
  const section = (text) => paint(color, BOLD, text);
780
808
  const muted = (text) => paint(color, DIM, text);
781
- return `${title}\n${muted("Lean Codex toolkit installer and doctor")}\n\n${section("USAGE")}\n holycodex <command> [options]\n\n${section("COMMANDS")}\n install Install or update HolyCodex\n cleanup Remove HolyCodex-owned state\n doctor Diagnose installation and runtime\n\n${section("OPTIONS")}\n --help Show help\n --version Show version\n --no-tui Accepted; commands remain noninteractive\n --codex-autonomous Never ask; keep workspace sandbox\n --no-codex-autonomous Safe interactive defaults\n --dangerous-codex-autonomous Never ask; disable filesystem sandbox\n --json Print machine-readable output\n`;
809
+ return `${title}\n${muted("Lean Codex toolkit installer and doctor")}\n\n${section("USAGE")}\n holycodex <command> [options]\n\n${section("COMMANDS")}\n install Install or update HolyCodex\n cleanup Remove HolyCodex-owned state\n doctor Diagnose installation and runtime\n\n${section("OPTIONS")}\n -h, --help Show help\n -v, --version Show version\n --no-tui Accepted; commands remain noninteractive\n --codex-autonomous Never ask; keep workspace sandbox\n --no-codex-autonomous Safe interactive defaults\n --dangerous-codex-autonomous Never ask; disable filesystem sandbox\n --json Print machine-readable output\n`;
810
+ }
811
+ function renderError(message, color) {
812
+ return `${paint(color, `${BOLD}${RED}`, "✗ ERROR")} ${message}\n ${paint(color, DIM, "Run holycodex --help for usage.")}\n`;
782
813
  }
783
814
  function renderDoctor(result, color) {
784
815
  return `${result.healthy ? paint(color, GREEN, "✓ HolyCodex doctor: healthy") : paint(color, RED, "✗ HolyCodex doctor: issues found")}\n${result.checks.map((item) => {
@@ -799,11 +830,11 @@ async function main() {
799
830
  const args = process$1.argv.slice(2);
800
831
  const stdoutColor = supportsColor(process$1.stdout.isTTY, process$1.env.NO_COLOR);
801
832
  const stderrColor = supportsColor(process$1.stderr.isTTY, process$1.env.NO_COLOR);
802
- if (args.includes("--help") || args.length === 0) {
833
+ if (args.includes("--help") || args.includes("-h") || args.length === 0) {
803
834
  process$1.stdout.write(renderHelp(VERSION, stdoutColor));
804
835
  return;
805
836
  }
806
- if (args.includes("--version")) {
837
+ if (args.includes("--version") || args.includes("-v")) {
807
838
  process$1.stdout.write(`${VERSION}\n`);
808
839
  return;
809
840
  }
@@ -813,7 +844,11 @@ async function main() {
813
844
  "--no-codex-autonomous",
814
845
  "--dangerous-codex-autonomous"
815
846
  ].includes(arg));
816
- if (autonomyFlags.length > 1) throw new Error(`Conflicting autonomy flags: ${autonomyFlags.join(", ")}`);
847
+ if (autonomyFlags.length > 1) {
848
+ process$1.stderr.write(renderError(`Conflicting autonomy flags: ${autonomyFlags.join(", ")}`, stderrColor));
849
+ process$1.exitCode = 1;
850
+ return;
851
+ }
817
852
  const options = {
818
853
  autonomy: args.includes("--dangerous-codex-autonomous") ? "dangerous" : args.includes("--codex-autonomous") ? "autonomous" : "default",
819
854
  json: args.includes("--json")
@@ -827,7 +862,11 @@ async function main() {
827
862
  if (options.autonomy === "dangerous") process$1.stderr.write(renderNotice("warning", "Dangerous autonomy disables approvals and filesystem sandboxing.", stderrColor));
828
863
  else if (options.autonomy === "autonomous") process$1.stderr.write(renderNotice("notice", "--codex-autonomous is now workspace-contained. Use --dangerous-codex-autonomous only for unrestricted behavior.", stderrColor));
829
864
  const result = command === "install" ? await install(options) : command === "cleanup" ? await cleanup(options) : void 0;
830
- if (result === void 0) throw new Error(`Unknown command: ${command ?? ""}`);
865
+ if (result === void 0) {
866
+ process$1.stderr.write(renderError(`Unknown command: ${command ?? args[0] ?? ""}`, stderrColor));
867
+ process$1.exitCode = 1;
868
+ return;
869
+ }
831
870
  process$1.stdout.write(options.json ? `${JSON.stringify(result)}\n` : renderRunResult(result, stdoutColor));
832
871
  }
833
872
  await main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "holycodex",
3
- "version": "0.6.1-dev.29547206710.2",
3
+ "version": "0.7.0-dev.29548804255.1",
4
4
  "description": "Lean Codex-only agent toolkit installer and doctor",
5
5
  "keywords": [
6
6
  "agents",
@@ -39,7 +39,7 @@
39
39
  "prepack": "vp run --workspace-root build"
40
40
  },
41
41
  "dependencies": {
42
- "@holycodex/plugin": "0.6.1-dev.29547206710.2"
42
+ "@holycodex/plugin": "0.7.0-dev.29548804255.1"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=20"