@mrciphersmith/keryx 0.2.78 → 0.2.80

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 +94 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -43320,6 +43320,10 @@ async function wikiCommand(args) {
43320
43320
  printHelp4();
43321
43321
  return;
43322
43322
  }
43323
+ if (args.includes("--help") || args.includes("-h")) {
43324
+ printHelp4();
43325
+ return;
43326
+ }
43323
43327
  if (command === "status") {
43324
43328
  await runStatus();
43325
43329
  return;
@@ -43677,6 +43681,11 @@ Usage:
43677
43681
  # before the run; enrich can never itself accept a page (issue #391)
43678
43682
  keryx wiki context
43679
43683
  keryx wiki backlinks <wiki-page-or-code-file>
43684
+ keryx wiki freshness # read-only backlog: which pages the code moved under
43685
+ keryx wiki refresh # regenerate managed ## Reference blocks (WRITES pages)
43686
+ keryx wiki verify --page <path> | --baseline
43687
+ # stamp provenance; refuses to stamp the corpus silently
43688
+ keryx wiki migrate-markers # one-off: wrap existing Reference sections in markers
43680
43689
 
43681
43690
  Page types:
43682
43691
  architecture, domain-model, business-rule, user-scenario,
@@ -44178,8 +44187,21 @@ On git pull / branch switch, they run 'keryx sync' (advisory report). Run 'keryx
44178
44187
  continue;
44179
44188
  }
44180
44189
  const diff = await diffSince(cwd, provenance.commit);
44181
- const code = diff ? codeOnly(diff) : null;
44182
- if (!code || totalChanges(code) === 0) {
44190
+ if (diff === null) {
44191
+ anyStale = true;
44192
+ if (apply) {
44193
+ await applyModule(cwd, module, null, at);
44194
+ console.log(` \u2192 rebuilt from scratch; provenance named ${provenance.commit.slice(0, 8)}, which this repository does not have`);
44195
+ } else {
44196
+ console.log(` cannot compare \u2014 provenance names ${provenance.commit.slice(0, 8)}, a revision this repository does not have`);
44197
+ console.log(" (a branch that was squash-merged and deleted leaves exactly this)");
44198
+ console.log(" \u2192 run `keryx sync --apply` to rebuild and re-record");
44199
+ }
44200
+ console.log("");
44201
+ continue;
44202
+ }
44203
+ const code = codeOnly(diff);
44204
+ if (totalChanges(code) === 0) {
44183
44205
  console.log(` up to date (built at ${provenance.commit.slice(0, 8)})`);
44184
44206
  console.log("");
44185
44207
  continue;
@@ -55490,7 +55512,15 @@ var COMMAND_DESCRIPTORS = [
55490
55512
  module: "gdgraph",
55491
55513
  command: "gdgraph build",
55492
55514
  summary: "Build or refresh the code dependency graph for this project.",
55493
- intent: ["\u043F\u043E\u0441\u0442\u0440\u043E\u0439 \u0433\u0440\u0430\u0444", "\u043E\u0431\u043D\u043E\u0432\u0438 \u0433\u0440\u0430\u0444", "build the code graph", "rebuild graph", "reindex dependencies"],
55515
+ intent: [
55516
+ "\u043F\u043E\u0441\u0442\u0440\u043E\u0439 \u0433\u0440\u0430\u0444",
55517
+ "\u043E\u0431\u043D\u043E\u0432\u0438 \u0433\u0440\u0430\u0444",
55518
+ "\u043F\u0435\u0440\u0435\u0441\u0442\u0440\u043E\u0439 \u0433\u0440\u0430\u0444",
55519
+ "build the code graph",
55520
+ "rebuild graph",
55521
+ "update graph",
55522
+ "reindex dependencies"
55523
+ ],
55494
55524
  args: [],
55495
55525
  json: false,
55496
55526
  read: false,
@@ -55656,23 +55686,62 @@ function listDescriptors(module) {
55656
55686
  const filtered = module ? COMMAND_DESCRIPTORS.filter((descriptor) => descriptor.module === module) : COMMAND_DESCRIPTORS;
55657
55687
  return [...filtered].sort((a, b) => sortKey(a) < sortKey(b) ? -1 : sortKey(a) > sortKey(b) ? 1 : 0);
55658
55688
  }
55689
+ var INTENT_FILLER = new Set([
55690
+ "the",
55691
+ "a",
55692
+ "an",
55693
+ "my",
55694
+ "our",
55695
+ "this",
55696
+ "that",
55697
+ "please",
55698
+ "\u0438",
55699
+ "\u043C\u043D\u0435",
55700
+ "\u044D\u0442\u043E\u0442",
55701
+ "\u044D\u0442\u0443",
55702
+ "\u044D\u0442\u043E",
55703
+ "\u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430"
55704
+ ]);
55705
+ function intentTokens(value) {
55706
+ return value.toLowerCase().split(/[^\p{L}\p{N}-]+/u).filter((token) => token.length > 0 && !INTENT_FILLER.has(token));
55707
+ }
55659
55708
  function matchIntent(query) {
55660
55709
  const normalized = query.trim().toLowerCase();
55661
55710
  if (normalized.length === 0) {
55662
55711
  return [];
55663
55712
  }
55713
+ const queryTokens = new Set(intentTokens(normalized));
55664
55714
  const scored = listDescriptors().map((descriptor) => {
55665
55715
  let score = 0;
55666
55716
  for (const phrase of descriptor.intent) {
55667
55717
  const needle = phrase.toLowerCase();
55668
55718
  if (normalized.includes(needle) || needle.includes(normalized)) {
55669
55719
  score = Math.max(score, needle.length);
55720
+ continue;
55721
+ }
55722
+ const phraseTokens = intentTokens(needle);
55723
+ if (phraseTokens.length > 0 && phraseTokens.every((token) => queryTokens.has(token))) {
55724
+ score = Math.max(score, needle.length - 1);
55670
55725
  }
55671
55726
  }
55672
55727
  return { descriptor, score };
55673
55728
  }).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score);
55674
55729
  return scored.map((entry) => entry.descriptor);
55675
55730
  }
55731
+ function suggestIntent(query, limit = 4) {
55732
+ const queryTokens = new Set(intentTokens(query));
55733
+ if (queryTokens.size === 0) {
55734
+ return [];
55735
+ }
55736
+ return listDescriptors().map((descriptor) => {
55737
+ let shared = 0;
55738
+ for (const phrase of descriptor.intent) {
55739
+ const overlap = intentTokens(phrase).filter((token) => queryTokens.has(token)).length;
55740
+ shared = Math.max(shared, overlap);
55741
+ }
55742
+ return { descriptor, shared };
55743
+ }).filter((entry) => entry.shared > 0).sort((a, b) => b.shared - a.shared).slice(0, limit).map((entry) => entry.descriptor);
55744
+ }
55676
55745
  function emitCommandsJson(module) {
55677
55746
  const payload = {
55678
55747
  schemaVersion: 1,
@@ -55759,6 +55828,14 @@ async function commandsCommand(args = []) {
55759
55828
  }
55760
55829
  if (matches.length === 0) {
55761
55830
  console.log(`No command matched intent: ${intent}`);
55831
+ const suggestions = suggestIntent(intent);
55832
+ if (suggestions.length > 0) {
55833
+ console.log("");
55834
+ console.log("Closest commands by shared words (none matched outright):");
55835
+ for (const suggestion of suggestions) {
55836
+ console.log(` keryx ${suggestion.command} \u2014 ${suggestion.summary}`);
55837
+ }
55838
+ }
55762
55839
  process.exitCode = 1;
55763
55840
  return;
55764
55841
  }
@@ -58097,6 +58174,18 @@ async function serveMcp(options) {
58097
58174
  await startStdioTransport(server);
58098
58175
  }
58099
58176
 
58177
+ // src/commands/mcp-serve-root.ts
58178
+ function resolveServeRoot(explicitCwd, processCwd, env) {
58179
+ if (explicitCwd !== undefined && explicitCwd.trim().length > 0) {
58180
+ return explicitCwd;
58181
+ }
58182
+ const fromRuntime = env.CLAUDE_PROJECT_DIR;
58183
+ if (fromRuntime !== undefined && fromRuntime.trim().length > 0) {
58184
+ return fromRuntime;
58185
+ }
58186
+ return processCwd;
58187
+ }
58188
+
58100
58189
  // src/commands/mcp.ts
58101
58190
  async function mcpCommand(args = [], cwd = process.cwd()) {
58102
58191
  const subcommand = args[0];
@@ -58114,7 +58203,7 @@ async function mcpCommand(args = [], cwd = process.cwd()) {
58114
58203
  }
58115
58204
  if (!subcommand || subcommand === "serve") {
58116
58205
  const http = args.includes("--http");
58117
- const projectRoot = path154.resolve(optionValue(args, "--cwd") ?? cwd);
58206
+ const projectRoot = path154.resolve(resolveServeRoot(optionValue(args, "--cwd"), cwd, process.env));
58118
58207
  try {
58119
58208
  await serveMcp({ cwd: projectRoot, http });
58120
58209
  } catch (error) {
@@ -66089,7 +66178,7 @@ import { spawnSync as spawnSync2 } from "child_process";
66089
66178
  // package.json
66090
66179
  var package_default = {
66091
66180
  name: "@mrciphersmith/keryx",
66092
- version: "0.2.78",
66181
+ version: "0.2.80",
66093
66182
  description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
66094
66183
  private: false,
66095
66184
  publishConfig: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.2.78",
3
+ "version": "0.2.80",
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": {