@mrciphersmith/keryx 0.4.37 → 0.4.39

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/core.js CHANGED
@@ -25103,6 +25103,45 @@ var init_templates2 = __esm(() => {
25103
25103
  ];
25104
25104
  });
25105
25105
 
25106
+ // src/wiki/page-groups.ts
25107
+ function parseGroupSize(raw) {
25108
+ const text = raw.trim();
25109
+ const match = /^(\d+)(?:\s*-\s*(\d+))?$/.exec(text);
25110
+ if (match === null) {
25111
+ throw new Error(`--group-size must be N or MIN-MAX (e.g. 10-20), got "${raw}"`);
25112
+ }
25113
+ const min = Number.parseInt(match[1], 10);
25114
+ const max = match[2] !== undefined ? Number.parseInt(match[2], 10) : min;
25115
+ if (min < 1 || max < min) {
25116
+ throw new Error(`--group-size needs 1 <= MIN <= MAX, got "${raw}"`);
25117
+ }
25118
+ if (max > MAX_GROUP_SIZE) {
25119
+ throw new Error(`--group-size MAX is capped at ${MAX_GROUP_SIZE}, got ${max}`);
25120
+ }
25121
+ return { min, max };
25122
+ }
25123
+ function parsePagesArgument(raw, readFile) {
25124
+ const fromFile = readFile(raw);
25125
+ const text = fromFile ?? raw;
25126
+ const trimmed = text.trim();
25127
+ if (fromFile !== null && trimmed.startsWith("[")) {
25128
+ const parsed = JSON.parse(trimmed);
25129
+ if (!Array.isArray(parsed) || !parsed.every((v) => typeof v === "string")) {
25130
+ throw new Error(`--pages file ${raw} must hold a JSON array of strings`);
25131
+ }
25132
+ return dedupe2(parsed.map((v) => v.trim()).filter((v) => v.length > 0));
25133
+ }
25134
+ return dedupe2(trimmed.split(/[\n,]/).map((v) => v.trim()).filter((v) => v.length > 0 && !v.startsWith("#")));
25135
+ }
25136
+ function dedupe2(values) {
25137
+ return [...new Set(values)];
25138
+ }
25139
+ var DEFAULT_GROUP_SIZE, MAX_GROUP_SIZE = 50;
25140
+ var init_page_groups = __esm(() => {
25141
+ init_backlinks();
25142
+ DEFAULT_GROUP_SIZE = { min: 10, max: 20 };
25143
+ });
25144
+
25106
25145
  // src/wiki/template-structure.ts
25107
25146
  function validateTemplateStructure(pageType, content, options = {}) {
25108
25147
  const kind = options.template ?? templateKindForPageType(pageType);
@@ -25225,6 +25264,7 @@ var init_template_structure = __esm(() => {
25225
25264
  // src/wiki/service.ts
25226
25265
  var exports_service4 = {};
25227
25266
  __export(exports_service4, {
25267
+ DEFAULT_GROUP_SIZE: () => DEFAULT_GROUP_SIZE,
25228
25268
  collectGraphWikiCandidates: () => collectGraphWikiCandidates,
25229
25269
  createGdWikiService: () => createGdWikiService,
25230
25270
  extractModuleApi: () => extractModuleApi,
@@ -25233,6 +25273,8 @@ __export(exports_service4, {
25233
25273
  moduleNameFromProjectPath: () => moduleNameFromProjectPath,
25234
25274
  openWikiWriteContext: () => openWikiWriteContext,
25235
25275
  pageHistoryDir: () => pageHistoryDir,
25276
+ parseGroupSize: () => parseGroupSize,
25277
+ parsePagesArgument: () => parsePagesArgument,
25236
25278
  parseVersionLabel: () => parseVersionLabel,
25237
25279
  printWikiUndoHint: () => printWikiUndoHint,
25238
25280
  readPageHistory: () => readPageHistory,
@@ -26470,6 +26512,7 @@ var init_service4 = __esm(() => {
26470
26512
  init_templates2();
26471
26513
  init_types3();
26472
26514
  init_history();
26515
+ init_page_groups();
26473
26516
  EXTERNAL_LINK = /^(https?:|mailto:|tel:)/i;
26474
26517
  WIKI_PAGE_PRODUCERS = [
26475
26518
  {
@@ -21794,6 +21794,11 @@ var init_templates2 = __esm(() => {
21794
21794
  init_types3();
21795
21795
  });
21796
21796
 
21797
+ // src/wiki/page-groups.ts
21798
+ var init_page_groups = __esm(() => {
21799
+ init_backlinks();
21800
+ });
21801
+
21797
21802
  // src/wiki/service.ts
21798
21803
  var init_service4 = __esm(() => {
21799
21804
  init_data_dir();
@@ -21813,6 +21818,7 @@ var init_service4 = __esm(() => {
21813
21818
  init_templates2();
21814
21819
  init_types3();
21815
21820
  init_history();
21821
+ init_page_groups();
21816
21822
  });
21817
21823
 
21818
21824
  // src/sac/preserved-wrap-up.ts
@@ -29003,7 +29009,7 @@ ${describeBlockers(open, card)}`
29003
29009
  message: `The managed review ${open.reviewId} is not finished: it is finished when the package is closed (${card ? "the operator answers the `review_complete` card and its gates pass" : "`keryx review complete` accepts it"}), not when you stop writing. ` + `It still refuses on:
29004
29010
  ${describeBlockers(open, card)}
29005
29011
  ` + `${nextStep(open, card)}
29006
- ` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
29012
+ ` + "Do the next missing step now. Step 1 (Build Review Context Pack) has no CLI command; it is a prose step, so mark it done and move on. " + "A command that is refused is not a blocker: run `keryx review --help` for the accepted usage and retry with the right flags. " + "A routing refusal is the exception: when `keryx review tier` reports `dispatchable: false`, the operator's routing configuration refuses the reviewer model and no retry changes that, so report it as the one real blocker with the `routing:` lines it printed. " + "A plan item you marked blocked for such a reason is not blocked: mark it in_progress. " + "A tool loop guard or an empty child result is not a reason to ask the operator to resend the request or to continue: change the arguments, retry the failed pass on a smaller slice, and keep going. " + `Stop only after ${card ? "the `review_complete` card has" : "`keryx review complete` has"} closed the package, or report the one real blocker with its evidence.`
29007
29013
  };
29008
29014
  }
29009
29015
 
@@ -29676,6 +29682,7 @@ var GIT_READ_SUBCOMMANDS = new Set([
29676
29682
  "merge-base",
29677
29683
  "blame"
29678
29684
  ]);
29685
+ var GIT_CAT_FILE_CHECK_FLAGS = new Set(["-e", "-t"]);
29679
29686
  var BUN_TEST_FLAGS = new Set(["--bail", "--only", "--todo"]);
29680
29687
  var BUN_TEST_COUNT_FLAGS = new Set(["--rerun-each", "--timeout"]);
29681
29688
  var EXEC_FLAGS = ["--pre", "--hostname-bin", "--output", "--ext-diff", "--exec", "--upload-pack", "--post", "--publish", "--push"];
@@ -29700,6 +29707,7 @@ var TRUST_ROUTINE_KEYRYX = [
29700
29707
  ...rows("review", [
29701
29708
  "attach",
29702
29709
  "start",
29710
+ "plan",
29703
29711
  "scope",
29704
29712
  "slice",
29705
29713
  "dispatch-check",
@@ -29913,6 +29921,9 @@ function isGitReadConfined(words, walk) {
29913
29921
  return false;
29914
29922
  return !words.slice(2).some((w) => !w.startsWith("-") && isEscapingOperand(w, cwd, walk.projectRoot));
29915
29923
  }
29924
+ function isGitObjectCheck(words) {
29925
+ return words.length === 4 && GIT_CAT_FILE_CHECK_FLAGS.has(words[2]) && !words[3].startsWith("-");
29926
+ }
29916
29927
  function isRoutineSegment(words, walk) {
29917
29928
  if (words.length === 0 || stripAssignments(words).length !== words.length)
29918
29929
  return false;
@@ -29927,6 +29938,8 @@ function isRoutineSegment(words, walk) {
29927
29938
  case "bun":
29928
29939
  return words[1] === "test" && isRoutineBunTest(words, walk);
29929
29940
  case "git":
29941
+ if (words[1] === "cat-file")
29942
+ return isGitObjectCheck(words) && isGitReadConfined(words, walk);
29930
29943
  return words[1] !== undefined && GIT_READ_SUBCOMMANDS.has(words[1]) && !hasExecWord(words) && isGitReadConfined(words, walk);
29931
29944
  default:
29932
29945
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.4.37",
3
+ "version": "0.4.39",
4
4
  "description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -14,7 +14,7 @@ triggers:
14
14
  - "review --hierarchical"
15
15
  metadata:
16
16
  author: "MrCipherSmith"
17
- version: "1.16.1"
17
+ version: "1.16.2"
18
18
  category: "review"
19
19
  compatible_harnesses: "cursor,codex,zed,opencode,claude"
20
20
  license: "MIT"
@@ -48,11 +48,11 @@ license: "MIT"
48
48
  - **Host question, four acts:** `confirm-plan`, `waive-mutation`, `override-reviewers`, `decide-premise`. Where no card exists (Claude Code, Codex, other hosts) never send the operator to a terminal or keryx shell for them. Ask with the host's own question tool, as you would on a card, with the verb's options: `yes` or `no`; `waive` or `keep`; `override` or `keep`; `uphold` or `dismiss`. The question names its subject: for `confirm-plan` the plan numbers as the plan card shows them (reviewers, waves, dispatches, minutes, cost); for `waive-mutation` the mutant ids or their count; for `override-reviewers` the reviewer names; for `decide-premise` the finding id. **A Telegram operator:** When the session has the `mcp__helyx-channel__send_poll` tool, the operator reads Telegram and not the terminal, and the host's own question tool never reaches them: `AskUserQuestion` draws a selector in a terminal nobody watches and the session hangs. Ask every question of this skill through `send_poll` instead (`questions: [{question, options}]`, one call for the three start questions), recommended option first, and wait for the `poll_submit:<id>` message; do not re-ask in the terminal. Record the answer with `--answered-by helyx-poll:<poll-id>` and a distinct `:<message-id>` or `/<question>` ref per question.
49
49
  - **Record the answer** with `keryx review <verb> --package <package> --answered-by <source>:<ref> --answer-text "<their words, verbatim>" --question-text "<the question as asked>"`, plus `--reason "<why>"` on `waive-mutation`, `override-reviewers` and `decide-premise` (`decide-premise` also `--finding <global_id> --answer uphold|dismiss`). In keryx shell use the card first: `keryx-shell:<ref>` is only for a plain question the shell itself asked. `claude-code:<ref>` and `codex:<ref>` are for the host harness's own question tool, `<ref>` its question id; `helyx-poll:<poll-id>[:<message-id>]` for a Telegram poll; `other:<ref>` for a host that asks in its reply, `<ref>` the message id or a short label.
50
50
  - **What the record means.** `confirmedVia: "host-question"` keeps the question and the answer so a reviewer can check them; keryx does not verify them, which is why it is weaker than a card. Record only an answer the operator gave: free text that is not one of the options, a decline, an answer naming the other choice, or words you wrote is not a decision. Unattended runs and nested keryx (`KERYX_TOOL_CALL=1`) refuse the flag, and so does a `confirm-plan` question that does not show the current plan numbers.
51
- - **Terminal or card only.** The other acts stay with the operator, who runs the exact command in their own terminal outside keryx shell: `keryx review complete <package> --waive <item> "<their words>"` or `--waive-coverage "<their words>"`, `keryx review chunks estimate --package <package> --answer yes --quote "<their words>"`, `keryx review publish <package>`, `keryx review comments reply … --final`. You wait. Never run `--mode automatic` or `--yes`.
51
+ - **Terminal or card only.** The other acts stay with the operator, who runs the exact command in their own terminal outside keryx shell: `keryx review complete <package> --waive <item> "<their words>"` or `--waive-coverage "<their words>"`, `keryx review chunks estimate --package <package> --answer yes --quote "<their words>"`, `keryx review publish <package>`, `keryx review comments reply … --final`. You wait. Never run `--mode automatic` or `--yes`. **Shell calls in a `trust` or `auto` session.** Once a search, web, MCP or external-agent result has entered the turn, only a routine command runs without asking the operator, so write each call to stay routine: one keryx command per shell call (a short `&&` chain of keryx and read-only git commands is fine, a chain with `gh` or any other program is not); no `$(…)`, backticks or variables inside it, so read a pull request's base and head in a call of their own and pass them as literal SHAs; `keryx agents external list --no-probe`, never without the flag; a revision with braces quoted (`git cat-file -e '<sha>^{commit}'`). A `gh` call still asks: that is expected, so make it once and reuse what it printed.
52
52
 
53
53
  ## Round plan — the order on every host
54
54
 
55
- 1. `keryx review plan --target <pr-url|branch> [--ref <base>] [--head <sha>] --host <host> [--memory-query "<query>"] [--unattended]` is the one command: it runs start, scope (Step 3), blast-radius (Step 3b), slice, required and estimate, writes `<package>/plan.json` and dispatches nothing. Read the round first (Step 1a), then dispatch from step 7.
55
+ 1. `keryx review plan --target <pr-url|branch> [--ref <base>] [--head <sha>] --host <host> [--memory-query "<query>"] [--unattended]` is the one command: it runs start, scope (Step 3), blast-radius (Step 3b), slice, required and estimate, writes `<package>/plan.json` and dispatches nothing. Read the round first (Step 1a), then dispatch from step 7. **A pull request is reviewed at its own head.** Without `--head` the round records the checkout's commit, so read the pull request's head first (`gh pr view <n> --json headRefOid --jq .headRefOid`) and, unless `git rev-parse HEAD` prints the same commit, fetch it (`git fetch origin <sha>`) and pass `--head <sha>`; `review start` and `review plan` refuse a checkout that is at another commit than the pull request.
56
56
  2. Without `plan`, run those stages one by one in this order: `keryx review scope --ref <base> --json > .metaproject/data/review/scope.json`, then `keryx review start --target <kind> --ref <ref> --scope .metaproject/data/review/scope.json --memory-query "<query>" --host <host>` (plus `--unattended` when nobody is at the keyboard); `start` searches every prior-round source (local package, git history, the PR's keryx round block, PR comments, flow) and writes `round.json`.
57
57
  3. `keryx review blast-radius --ref <base> --package <package> --json > blast-radius.json` (Step 3b). Reasoned omissions (`unrelated-symbol`, `hub-damped`, `text-hub`, `test-consumer`) are context, not scope; only cap drops become chunks. Run the tests in `<package>/tests-to-run.json` with the command the radius prints, instead of reading them, and hand the output to the reviewers as context.
58
58
  4. `keryx review slice --ref <base> --package <package> --host <host>`: each slice carries `roles`, `depth` (deep or light) and `audit`.