@useorgx/wizard 0.1.62 → 0.1.64

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/README.md CHANGED
@@ -34,8 +34,8 @@ The wizard modifies local tool configuration only. Depending on the command, it
34
34
  - `work-graph runtime-event --source codex|claude --summary "..."` lets an agent write public-safe runtime evidence that the next AQ profile can collect.
35
35
  - `hooks install [--targets codex,claude-code]` installs bounded local capture hooks. Terminal events write compact session summaries to a durable queue, then request a detached single-flight delivery worker. The hook does not read credentials or perform network I/O. Set `ORGX_SESSION_SUMMARY_AUTO_FLUSH=off` for local-only capture and manual delivery. The legacy transcript-derived execution-graph emit remains off unless `ORGX_EMIT_EXECUTION_GRAPH=1` is set.
36
36
  - `ORGX_SESSION_WORK_CONTEXT` can carry one explicit, bounded JSON annotation for intent, authority, cost, artifact references, and evidence references. The Wizard does not infer this context from prompts; invalid or oversized annotations are omitted, and unknown fields are removed before cloud delivery.
37
- - `hooks flush [--limit 100]` is the manual delivery and recovery path. It uses the same queue lease as automatic delivery and removes each file only after a successful server acknowledgement. Failed or malformed captures stay on disk for inspection and retry.
38
- - `hooks doctor` shows hook wiring, automatic-delivery configuration, the capture-queue count, and the legacy spool count without changing local configuration.
37
+ - `hooks flush [--limit 100]` is the manual delivery and recovery path. It uses the same queue lease as automatic delivery and removes each valid file only after a successful server acknowledgement. Failed captures stay queued for retry; malformed captures move to the owner-only `session-summary-captures/quarantine/` directory and make a manual flush fail visibly without being deleted.
38
+ - `hooks doctor` shows hook wiring, automatic-delivery configuration, active and quarantined capture counts, and the legacy spool count without changing local configuration.
39
39
  - `hooks backfill` previews compact summaries distilled from the legacy spool. It does not upload or archive anything unless you add `--post --yes`; `--truncate` also requires both flags and archives the original spool only after every upload succeeds.
40
40
  - `map [query...] --deep-search` runs the v1 Operating Map discovery flow over connected company signals and cited deep research, prints source health and low-confidence ProcessCards, and keeps ownership/timing/"done" confirmation human-gated. Add `--candidate <id-or-number> --yes` to explicitly propose one card as an OperatingProcess; the wizard never auto-confirms or activates inferred workflow ownership.
41
41
  - `surface list` shows supported surfaces and current status.
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/cli.ts
4
4
 
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="132d0d75-ee1b-5262-9ce6-1091765e2527")}catch(e){}}();
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cf979138-322b-5229-81f2-931f9cdf95d2")}catch(e){}}();
6
6
  import * as clack from "@clack/prompts";
7
7
  import { spawnSync as spawnSync5 } from "child_process";
8
8
  import { readFileSync as readFileSync10 } from "fs";
@@ -3736,8 +3736,8 @@ function encodeRepoPath2(value) {
3736
3736
  return value.split("/").filter((segment) => segment.length > 0).map((segment) => encodeURIComponent(segment)).join("/");
3737
3737
  }
3738
3738
  function isLikelyRepoFilePath(path) {
3739
- const basename6 = path.split("/").pop() ?? path;
3740
- return basename6.includes(".") && !/^\.[^./]+$/.test(basename6);
3739
+ const basename7 = path.split("/").pop() ?? path;
3740
+ return basename7.includes(".") && !/^\.[^./]+$/.test(basename7);
3741
3741
  }
3742
3742
  function buildContentsUrl2(spec, path) {
3743
3743
  const encodedPath = encodeRepoPath2(path);
@@ -6354,7 +6354,7 @@ function initializeWizardSentry() {
6354
6354
  Sentry.init({
6355
6355
  dsn,
6356
6356
  environment: process.env.ORGX_SENTRY_ENVIRONMENT || "production",
6357
- release: "useorgx-wizard@0.1.62",
6357
+ release: "useorgx-wizard@0.1.64",
6358
6358
  tracesSampleRate: sampleRate(process.env.ORGX_SENTRY_TRACES_SAMPLE_RATE),
6359
6359
  enableLogs: true,
6360
6360
  sendDefaultPii: false,
@@ -14546,6 +14546,15 @@ function countSessionSummaryCaptures(path) {
14546
14546
  return 0;
14547
14547
  }
14548
14548
  }
14549
+ function countSessionSummaryQuarantinedCaptures(path) {
14550
+ try {
14551
+ return readdirSync6(join8(path, "quarantine")).filter(
14552
+ (name) => name.includes(".malformed")
14553
+ ).length;
14554
+ } catch {
14555
+ return 0;
14556
+ }
14557
+ }
14549
14558
  function backupPath(path, now) {
14550
14559
  const timestamp = now.toISOString().replace(/[:.]/g, "-");
14551
14560
  return `${path}.bak.${timestamp}`;
@@ -14560,7 +14569,7 @@ function hasOrgxHook(raw) {
14560
14569
  return Boolean(raw?.includes(HOOK_MARKER));
14561
14570
  }
14562
14571
  function codexHooksEnabled(raw) {
14563
- return Boolean(raw && /^\s*codex_hooks\s*=\s*true\s*$/m.test(raw));
14572
+ return Boolean(raw && /^\s*hooks\s*=\s*true\s*$/m.test(raw));
14564
14573
  }
14565
14574
  function codexHasNotify(raw) {
14566
14575
  return Boolean(raw && /^\s*notify\s*=/m.test(raw));
@@ -15019,26 +15028,40 @@ function mergeClaudeHooks(raw, paths) {
15019
15028
  }
15020
15029
  function ensureCodexHooksFeature(raw) {
15021
15030
  const current = raw ?? "";
15022
- if (codexHooksEnabled(current)) {
15023
- return { changed: false, value: current };
15031
+ const withoutDeprecatedFlag = current.replace(
15032
+ /^\s*codex_hooks\s*=\s*(?:true|false)\s*(?:\r?\n|$)/gm,
15033
+ ""
15034
+ );
15035
+ const removedDeprecatedFlag = withoutDeprecatedFlag !== current;
15036
+ if (codexHooksEnabled(withoutDeprecatedFlag)) {
15037
+ return {
15038
+ changed: removedDeprecatedFlag,
15039
+ value: withoutDeprecatedFlag
15040
+ };
15024
15041
  }
15025
- if (/^\s*codex_hooks\s*=\s*false\s*$/m.test(current)) {
15042
+ if (/^\s*hooks\s*=\s*false\s*$/m.test(withoutDeprecatedFlag)) {
15026
15043
  return {
15027
15044
  changed: true,
15028
- value: current.replace(/^\s*codex_hooks\s*=\s*false\s*$/m, "codex_hooks = true")
15045
+ value: withoutDeprecatedFlag.replace(
15046
+ /^\s*hooks\s*=\s*false\s*$/m,
15047
+ "hooks = true"
15048
+ )
15029
15049
  };
15030
15050
  }
15031
- if (/^\s*\[features\]\s*$/m.test(current)) {
15051
+ if (/^\s*\[features\]\s*$/m.test(withoutDeprecatedFlag)) {
15032
15052
  return {
15033
15053
  changed: true,
15034
- value: current.replace(/^(\s*\[features\]\s*)$/m, "$1\ncodex_hooks = true")
15054
+ value: withoutDeprecatedFlag.replace(
15055
+ /^(\s*\[features\]\s*)$/m,
15056
+ "$1\nhooks = true"
15057
+ )
15035
15058
  };
15036
15059
  }
15037
- const suffix = current.trimEnd().length > 0 ? "\n\n" : "";
15060
+ const suffix = withoutDeprecatedFlag.trimEnd().length > 0 ? "\n\n" : "";
15038
15061
  return {
15039
15062
  changed: true,
15040
- value: `${current.trimEnd()}${suffix}[features]
15041
- codex_hooks = true
15063
+ value: `${withoutDeprecatedFlag.trimEnd()}${suffix}[features]
15064
+ hooks = true
15042
15065
  `
15043
15066
  };
15044
15067
  }
@@ -15067,7 +15090,10 @@ function inspectRuntimeHooks(options = {}) {
15067
15090
  notifyPreserved: !codexHasNotify(codexConfigRaw) || !hasOrgxHook(codexConfigRaw)
15068
15091
  },
15069
15092
  outboxEvents: countJsonlLines(paths.outboxPath),
15070
- sessionSummaryCaptures: countSessionSummaryCaptures(paths.sessionSummaryQueueDir)
15093
+ sessionSummaryCaptures: countSessionSummaryCaptures(paths.sessionSummaryQueueDir),
15094
+ sessionSummaryQuarantinedCaptures: countSessionSummaryQuarantinedCaptures(
15095
+ paths.sessionSummaryQueueDir
15096
+ )
15071
15097
  };
15072
15098
  }
15073
15099
  function installRuntimeHooks(targets, options = {}) {
@@ -15158,8 +15184,16 @@ function parseRuntimeHookTargets(value) {
15158
15184
  }
15159
15185
 
15160
15186
  // src/lib/session-summary-queue.ts
15161
- import { existsSync as existsSync10, readdirSync as readdirSync7, readFileSync as readFileSync8, unlinkSync as unlinkSync2 } from "fs";
15162
- import { join as join9 } from "path";
15187
+ import {
15188
+ chmodSync as chmodSync2,
15189
+ existsSync as existsSync10,
15190
+ mkdirSync as mkdirSync5,
15191
+ readdirSync as readdirSync7,
15192
+ readFileSync as readFileSync8,
15193
+ renameSync as renameSync3,
15194
+ unlinkSync as unlinkSync2
15195
+ } from "fs";
15196
+ import { basename as basename6, join as join9 } from "path";
15163
15197
 
15164
15198
  // src/lib/session-summary-backfill.ts
15165
15199
  import { createReadStream, renameSync as renameSync2, statSync as statSync5, writeFileSync as writeFileSync4 } from "fs";
@@ -15546,6 +15580,8 @@ function truncateSpool(spoolPath, post, options = {}) {
15546
15580
  var SESSION_SUMMARY_CAPTURE_VERSION = "orgx-session-summary-capture/v1";
15547
15581
  var SESSION_SUMMARY_CAPTURE_FILE_SUFFIX = ".capture.json";
15548
15582
  var SESSION_SUMMARY_CAPTURE_MAX_BYTES = 16 * 1024;
15583
+ var SESSION_SUMMARY_QUARANTINE_DIR_NAME = "quarantine";
15584
+ var SESSION_SUMMARY_QUARANTINE_FILE_SUFFIX = ".malformed";
15549
15585
  function sessionSummaryCaptureFiles(queueDir) {
15550
15586
  if (!existsSync10(queueDir)) return [];
15551
15587
  try {
@@ -15554,6 +15590,33 @@ function sessionSummaryCaptureFiles(queueDir) {
15554
15590
  return [];
15555
15591
  }
15556
15592
  }
15593
+ function sessionSummaryQuarantineDir(queueDir) {
15594
+ return join9(queueDir, SESSION_SUMMARY_QUARANTINE_DIR_NAME);
15595
+ }
15596
+ function quarantineMalformedCapture(path, queueDir) {
15597
+ const quarantineDir = sessionSummaryQuarantineDir(queueDir);
15598
+ try {
15599
+ mkdirSync5(quarantineDir, { recursive: true, mode: 448 });
15600
+ const baseTarget = join9(
15601
+ quarantineDir,
15602
+ `${basename6(path)}${SESSION_SUMMARY_QUARANTINE_FILE_SUFFIX}`
15603
+ );
15604
+ let target = baseTarget;
15605
+ let collision = 0;
15606
+ while (existsSync10(target)) {
15607
+ collision += 1;
15608
+ target = `${baseTarget}.${collision}`;
15609
+ }
15610
+ renameSync3(path, target);
15611
+ try {
15612
+ chmodSync2(target, 384);
15613
+ } catch {
15614
+ }
15615
+ return target;
15616
+ } catch {
15617
+ return null;
15618
+ }
15619
+ }
15557
15620
  function isRecord4(value) {
15558
15621
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
15559
15622
  }
@@ -15666,14 +15729,20 @@ async function flushSessionSummaryCaptures(options) {
15666
15729
  acknowledged: 0,
15667
15730
  retained: 0,
15668
15731
  malformed: 0,
15732
+ quarantined: 0,
15669
15733
  fallbackAcknowledged: 0
15670
15734
  };
15671
15735
  for (const path of selected) {
15672
15736
  const capture = readSessionSummaryCapture(path);
15673
15737
  if (!capture) {
15674
15738
  result.malformed += 1;
15675
- result.retained += 1;
15676
- result.firstError ??= `Malformed capture retained: ${path}`;
15739
+ const quarantinedPath = quarantineMalformedCapture(path, options.queueDir);
15740
+ if (quarantinedPath) {
15741
+ result.quarantined += 1;
15742
+ } else {
15743
+ result.retained += 1;
15744
+ result.firstError ??= `Malformed capture could not be quarantined: ${path}`;
15745
+ }
15677
15746
  continue;
15678
15747
  }
15679
15748
  result.attempted += 1;
@@ -15711,10 +15780,10 @@ import { randomUUID as randomUUID3 } from "crypto";
15711
15780
  import {
15712
15781
  closeSync as closeSync2,
15713
15782
  fsyncSync,
15714
- mkdirSync as mkdirSync5,
15783
+ mkdirSync as mkdirSync6,
15715
15784
  openSync as openSync2,
15716
15785
  readFileSync as readFileSync9,
15717
- renameSync as renameSync3,
15786
+ renameSync as renameSync4,
15718
15787
  statSync as statSync6,
15719
15788
  unlinkSync as unlinkSync3,
15720
15789
  writeSync
@@ -15791,7 +15860,7 @@ function claimSessionSummaryFlushLease(queueDir, options = {}) {
15791
15860
  const path = join10(queueDir, SESSION_SUMMARY_FLUSH_LOCK_NAME);
15792
15861
  const record = { token, pid, claimed_at: now.toISOString() };
15793
15862
  try {
15794
- mkdirSync5(queueDir, { recursive: true, mode: 448 });
15863
+ mkdirSync6(queueDir, { recursive: true, mode: 448 });
15795
15864
  } catch {
15796
15865
  return { acquired: false, reason: "unavailable" };
15797
15866
  }
@@ -15811,7 +15880,7 @@ function claimSessionSummaryFlushLease(queueDir, options = {}) {
15811
15880
  }
15812
15881
  const stalePath = `${path}.stale-${token}`;
15813
15882
  try {
15814
- renameSync3(path, stalePath);
15883
+ renameSync4(path, stalePath);
15815
15884
  unlinkSync3(stalePath);
15816
15885
  } catch {
15817
15886
  return { acquired: false, reason: "busy" };
@@ -16573,6 +16642,7 @@ function printRuntimeHookInspection(report) {
16573
16642
  console.log(` ${report.installed.summaryHookScript ? ICON.ok : ICON.warn} ${pc3.bold("summary hook")} ${report.installed.summaryHookScript ? pc3.green("installed") : pc3.yellow("missing")} ${pc3.dim(report.paths.summaryHookScriptPath)}`);
16574
16643
  console.log(` ${report.installed.automaticDelivery ? ICON.ok : ICON.warn} ${pc3.bold("auto delivery")} ${report.installed.automaticDelivery ? pc3.green("configured") : pc3.yellow("not configured")} ${pc3.dim("detached, ACK-gated worker")}`);
16575
16644
  console.log(` ${ICON.skip} ${pc3.bold("capture queue")} ${pc3.dim(`${report.sessionSummaryCaptures} capture${report.sessionSummaryCaptures === 1 ? "" : "s"} at ${report.paths.sessionSummaryQueueDir}`)}`);
16645
+ console.log(` ${report.sessionSummaryQuarantinedCaptures === 0 ? ICON.skip : ICON.warn} ${pc3.bold("quarantine ")} ${pc3.dim(`${report.sessionSummaryQuarantinedCaptures} malformed capture${report.sessionSummaryQuarantinedCaptures === 1 ? "" : "s"}, recoverable on disk`)}`);
16576
16646
  console.log(` ${ICON.skip} ${pc3.bold("outbox ")} ${pc3.dim(`${report.outboxEvents} event${report.outboxEvents === 1 ? "" : "s"} at ${report.paths.outboxPath}`)}`);
16577
16647
  }
16578
16648
  function printSessionSummaryFlush(result) {
@@ -16581,7 +16651,7 @@ function printSessionSummaryFlush(result) {
16581
16651
  return;
16582
16652
  }
16583
16653
  const delivered = `${result.acknowledged}/${result.attempted} acknowledged`;
16584
- console.log(` ${result.retained === 0 ? ICON.ok : ICON.warn} ${pc3.bold("captures ")} ${pc3.dim(`${delivered}, ${result.retained} retained, ${result.malformed} malformed`)}`);
16654
+ console.log(` ${result.retained === 0 && result.malformed === 0 ? ICON.ok : ICON.warn} ${pc3.bold("captures ")} ${pc3.dim(`${delivered}, ${result.retained} retained, ${result.quarantined} quarantined, ${result.malformed} malformed`)}`);
16585
16655
  if (result.fallbackAcknowledged > 0) {
16586
16656
  console.log(` ${ICON.warn} ${pc3.bold("fallback ")} ${pc3.dim(`${result.fallbackAcknowledged} capture(s) delivered through the legacy Work Graph endpoint`)}`);
16587
16657
  }
@@ -16598,6 +16668,7 @@ async function runSessionSummaryFlushCommand(options) {
16598
16668
  acknowledged: 0,
16599
16669
  retained: 0,
16600
16670
  malformed: 0,
16671
+ quarantined: 0,
16601
16672
  fallbackAcknowledged: 0,
16602
16673
  skipped: "empty_queue"
16603
16674
  };
@@ -16614,6 +16685,7 @@ async function runSessionSummaryFlushCommand(options) {
16614
16685
  acknowledged: 0,
16615
16686
  retained: 0,
16616
16687
  malformed: 0,
16688
+ quarantined: 0,
16617
16689
  fallbackAcknowledged: 0,
16618
16690
  skipped: "already_running"
16619
16691
  };
@@ -16656,11 +16728,12 @@ async function runSessionSummaryFlushCommand(options) {
16656
16728
  command: "hooks flush",
16657
16729
  attempted: String(result.attempted),
16658
16730
  acknowledged: String(result.acknowledged),
16659
- retained: String(result.retained)
16731
+ retained: String(result.retained),
16732
+ quarantined: String(result.quarantined)
16660
16733
  });
16661
- if (result.retained > 0) process.exitCode = 1;
16734
+ if (result.retained > 0 || result.malformed > 0) process.exitCode = 1;
16662
16735
  if (options.json) {
16663
- console.log(JSON.stringify({ ok: result.retained === 0, queueDir, ...result }, null, 2));
16736
+ console.log(JSON.stringify({ ok: result.retained === 0 && result.malformed === 0, queueDir, ...result }, null, 2));
16664
16737
  return;
16665
16738
  }
16666
16739
  printSessionSummaryFlush(result);
@@ -18434,7 +18507,7 @@ async function main() {
18434
18507
  initializeWizardSentry();
18435
18508
  const program = new Command();
18436
18509
  program.name("orgx-wizard").description("Add OrgX MCP configs, skills/rules, and companion plugins to your local AI tools.").showHelpAfterError();
18437
- const pkgVersion = true ? "0.1.62" : void 0;
18510
+ const pkgVersion = true ? "0.1.64" : void 0;
18438
18511
  program.version(pkgVersion ?? "unknown", "-V, --version");
18439
18512
  program.hook("preAction", (_thisCommand, actionCommand) => {
18440
18513
  if (Boolean(actionCommand.optsWithGlobals().json)) return;
@@ -19478,4 +19551,4 @@ main().catch(async (error) => {
19478
19551
  process.exitCode = 1;
19479
19552
  });
19480
19553
  //# sourceMappingURL=cli.js.map
19481
- //# debugId=132d0d75-ee1b-5262-9ce6-1091765e2527
19554
+ //# debugId=cf979138-322b-5229-81f2-931f9cdf95d2