@mrciphersmith/keryx 0.4.29 → 0.4.30

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 (123) hide show
  1. package/dist/cli.js +2408 -1369
  2. package/dist/core.js +90 -27
  3. package/dist/keryx-general-worker-entry.js +82 -25
  4. package/package.json +1 -1
  5. package/src/gdskills/bundled/install-manifest.json +2 -0
  6. package/src/gdskills/bundled/rules/core/api-contracts.mdc +21 -136
  7. package/src/gdskills/bundled/rules/core/async-patterns.mdc +18 -171
  8. package/src/gdskills/bundled/rules/core/clean-architecture.mdc +21 -3
  9. package/src/gdskills/bundled/rules/core/cli-interface-design.mdc +63 -194
  10. package/src/gdskills/bundled/rules/core/code-style-patterns.mdc +36 -49
  11. package/src/gdskills/bundled/rules/core/concurrency-patterns.mdc +32 -0
  12. package/src/gdskills/bundled/rules/core/database-patterns.mdc +26 -148
  13. package/src/gdskills/bundled/rules/core/error-handling.mdc +7 -8
  14. package/src/gdskills/bundled/rules/core/frontend-assistant.mdc +14 -29
  15. package/src/gdskills/bundled/rules/core/layout-rendering.mdc +51 -0
  16. package/src/gdskills/bundled/rules/core/mobx-store-template.mdc +69 -511
  17. package/src/gdskills/bundled/rules/core/nestjs-dto.mdc +18 -36
  18. package/src/gdskills/bundled/rules/core/playwright-testing.mdc +35 -308
  19. package/src/gdskills/bundled/rules/core/security-baseline.mdc +18 -140
  20. package/src/gdskills/bundled/rules/core/solid-principles.mdc +31 -7
  21. package/src/gdskills/bundled/rules/core/storybook-guidelines.mdc +20 -22
  22. package/src/gdskills/bundled/rules/core/tdd-workflow.mdc +37 -74
  23. package/src/gdskills/bundled/rules/core/ui-anti-slop.mdc +48 -37
  24. package/src/gdskills/bundled/skills/quality/deprecation-path/SKILL.md +1 -1
  25. package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +24 -60
  26. package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +13 -65
  27. package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +22 -35
  28. package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +16 -309
  29. package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +7 -21
  30. package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +83 -227
  31. package/src/gdskills/bundled/skills/review/review-layout/SKILL.md +22 -28
  32. package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +8 -8
  33. package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +15 -37
  34. package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +7 -7
  35. package/src/gdskills/bundled/skills/review/review-style/SKILL.md +31 -66
  36. package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +21 -39
  37. package/src/gdskills/bundled/skills/review/review-ui-ux/SKILL.md +42 -82
  38. package/src/gdskills/bundled/stacks/angular/rules/coding-style.mdc +15 -57
  39. package/src/gdskills/bundled/stacks/angular/rules/patterns.mdc +16 -60
  40. package/src/gdskills/bundled/stacks/angular/rules/security.mdc +11 -49
  41. package/src/gdskills/bundled/stacks/angular/rules/testing.mdc +13 -52
  42. package/src/gdskills/bundled/stacks/c-cpp/rules/coding-style.mdc +33 -57
  43. package/src/gdskills/bundled/stacks/c-cpp/rules/patterns.mdc +35 -62
  44. package/src/gdskills/bundled/stacks/c-cpp/rules/security.mdc +35 -62
  45. package/src/gdskills/bundled/stacks/c-cpp/rules/testing.mdc +34 -54
  46. package/src/gdskills/bundled/stacks/ci-github-gitlab/rules/patterns.mdc +27 -56
  47. package/src/gdskills/bundled/stacks/ci-github-gitlab/rules/security.mdc +51 -119
  48. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/coding-style.mdc +42 -74
  49. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/patterns.mdc +45 -84
  50. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/security.mdc +34 -59
  51. package/src/gdskills/bundled/stacks/csharp-dotnet/rules/testing.mdc +33 -62
  52. package/src/gdskills/bundled/stacks/django/rules/coding-style.mdc +15 -56
  53. package/src/gdskills/bundled/stacks/django/rules/patterns.mdc +16 -68
  54. package/src/gdskills/bundled/stacks/django/rules/security.mdc +13 -71
  55. package/src/gdskills/bundled/stacks/django/rules/testing.mdc +16 -62
  56. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/coding-style.mdc +30 -53
  57. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/patterns.mdc +20 -56
  58. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/security.mdc +52 -122
  59. package/src/gdskills/bundled/stacks/docker-k8s-terraform/rules/testing.mdc +23 -42
  60. package/src/gdskills/bundled/stacks/fastapi/rules/coding-style.mdc +13 -47
  61. package/src/gdskills/bundled/stacks/fastapi/rules/patterns.mdc +18 -81
  62. package/src/gdskills/bundled/stacks/fastapi/rules/security.mdc +13 -75
  63. package/src/gdskills/bundled/stacks/fastapi/rules/testing.mdc +14 -58
  64. package/src/gdskills/bundled/stacks/flutter-dart/rules/coding-style.mdc +36 -74
  65. package/src/gdskills/bundled/stacks/flutter-dart/rules/patterns.mdc +30 -66
  66. package/src/gdskills/bundled/stacks/flutter-dart/rules/security.mdc +33 -67
  67. package/src/gdskills/bundled/stacks/flutter-dart/rules/testing.mdc +41 -73
  68. package/src/gdskills/bundled/stacks/go/rules/coding-style.mdc +36 -57
  69. package/src/gdskills/bundled/stacks/go/rules/patterns.mdc +27 -42
  70. package/src/gdskills/bundled/stacks/go/rules/security.mdc +26 -43
  71. package/src/gdskills/bundled/stacks/go/rules/testing.mdc +23 -41
  72. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/coding-style.mdc +18 -37
  73. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/patterns.mdc +26 -43
  74. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/security.mdc +25 -37
  75. package/src/gdskills/bundled/stacks/java-kotlin-spring/rules/testing.mdc +34 -50
  76. package/src/gdskills/bundled/stacks/kotlin-android/rules/coding-style.mdc +28 -65
  77. package/src/gdskills/bundled/stacks/kotlin-android/rules/patterns.mdc +34 -78
  78. package/src/gdskills/bundled/stacks/kotlin-android/rules/security.mdc +35 -68
  79. package/src/gdskills/bundled/stacks/kotlin-android/rules/testing.mdc +34 -68
  80. package/src/gdskills/bundled/stacks/mobx/rules/coding-style.mdc +18 -64
  81. package/src/gdskills/bundled/stacks/mobx/rules/patterns.mdc +13 -66
  82. package/src/gdskills/bundled/stacks/mobx/rules/security.mdc +8 -35
  83. package/src/gdskills/bundled/stacks/mobx/rules/testing.mdc +10 -39
  84. package/src/gdskills/bundled/stacks/nestjs/rules/coding-style.mdc +32 -45
  85. package/src/gdskills/bundled/stacks/nestjs/rules/patterns.mdc +40 -60
  86. package/src/gdskills/bundled/stacks/nestjs/rules/security.mdc +30 -50
  87. package/src/gdskills/bundled/stacks/nestjs/rules/testing.mdc +27 -47
  88. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/coding-style.mdc +14 -48
  89. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/patterns.mdc +15 -67
  90. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/security.mdc +12 -50
  91. package/src/gdskills/bundled/stacks/nextjs-nuxt/rules/testing.mdc +11 -43
  92. package/src/gdskills/bundled/stacks/php-laravel/rules/coding-style.mdc +17 -58
  93. package/src/gdskills/bundled/stacks/php-laravel/rules/patterns.mdc +15 -56
  94. package/src/gdskills/bundled/stacks/php-laravel/rules/security.mdc +13 -50
  95. package/src/gdskills/bundled/stacks/php-laravel/rules/testing.mdc +14 -55
  96. package/src/gdskills/bundled/stacks/python/rules/coding-style.mdc +13 -41
  97. package/src/gdskills/bundled/stacks/python/rules/patterns.mdc +20 -61
  98. package/src/gdskills/bundled/stacks/python/rules/security.mdc +15 -57
  99. package/src/gdskills/bundled/stacks/python/rules/testing.mdc +16 -50
  100. package/src/gdskills/bundled/stacks/react/rules/coding-style.mdc +14 -40
  101. package/src/gdskills/bundled/stacks/react/rules/patterns.mdc +15 -55
  102. package/src/gdskills/bundled/stacks/react/rules/security.mdc +13 -49
  103. package/src/gdskills/bundled/stacks/react/rules/testing.mdc +10 -37
  104. package/src/gdskills/bundled/stacks/ruby-rails/rules/coding-style.mdc +12 -45
  105. package/src/gdskills/bundled/stacks/ruby-rails/rules/patterns.mdc +18 -67
  106. package/src/gdskills/bundled/stacks/ruby-rails/rules/security.mdc +11 -60
  107. package/src/gdskills/bundled/stacks/ruby-rails/rules/testing.mdc +14 -65
  108. package/src/gdskills/bundled/stacks/rust/rules/coding-style.mdc +39 -65
  109. package/src/gdskills/bundled/stacks/rust/rules/patterns.mdc +33 -60
  110. package/src/gdskills/bundled/stacks/rust/rules/security.mdc +35 -57
  111. package/src/gdskills/bundled/stacks/rust/rules/testing.mdc +29 -52
  112. package/src/gdskills/bundled/stacks/sql-db/rules/coding-style.mdc +12 -48
  113. package/src/gdskills/bundled/stacks/sql-db/rules/patterns.mdc +22 -113
  114. package/src/gdskills/bundled/stacks/sql-db/rules/security.mdc +11 -56
  115. package/src/gdskills/bundled/stacks/sql-db/rules/testing.mdc +14 -59
  116. package/src/gdskills/bundled/stacks/swift-ios/rules/coding-style.mdc +29 -65
  117. package/src/gdskills/bundled/stacks/swift-ios/rules/patterns.mdc +41 -88
  118. package/src/gdskills/bundled/stacks/swift-ios/rules/security.mdc +28 -53
  119. package/src/gdskills/bundled/stacks/swift-ios/rules/testing.mdc +32 -65
  120. package/src/gdskills/bundled/stacks/vue/rules/coding-style.mdc +17 -52
  121. package/src/gdskills/bundled/stacks/vue/rules/patterns.mdc +17 -63
  122. package/src/gdskills/bundled/stacks/vue/rules/security.mdc +11 -41
  123. package/src/gdskills/bundled/stacks/vue/rules/testing.mdc +16 -48
package/dist/core.js CHANGED
@@ -10243,33 +10243,33 @@ var init_skill_length_ceilings = __esm(() => {
10243
10243
  "quality/tests-creator": 360,
10244
10244
  "quality/ui-craft": 173,
10245
10245
  "review/code-learned-review": 283,
10246
- "review/review-architecture": 373,
10247
- "review/review-backend": 359,
10248
- "review/review-clean-code": 217,
10246
+ "review/review-architecture": 337,
10247
+ "review/review-backend": 307,
10248
+ "review/review-clean-code": 204,
10249
10249
  "review/review-core-boundaries": 158,
10250
10250
  "review/review-degradation": 191,
10251
10251
  "review/review-flow-graph": 183,
10252
- "review/review-frontend": 610,
10253
- "review/review-frontend-conventions": 206,
10254
- "review/review-highload": 472,
10252
+ "review/review-frontend": 317,
10253
+ "review/review-frontend-conventions": 192,
10254
+ "review/review-highload": 328,
10255
10255
  "review/review-jev-comments": 179,
10256
10256
  "review/review-jev-contract": 188,
10257
10257
  "review/review-jev-docs": 184,
10258
10258
  "review/review-jev-risk": 185,
10259
10259
  "review/review-jev-rules": 262,
10260
10260
  "review/review-jev-scenarios": 182,
10261
- "review/review-layout": 237,
10261
+ "review/review-layout": 231,
10262
10262
  "review/review-logic": 364,
10263
10263
  "review/review-orchestrator": 1565,
10264
- "review/review-performance": 354,
10264
+ "review/review-performance": 332,
10265
10265
  "review/review-pr-contract": 190,
10266
10266
  "review/review-pr-feedback": 893,
10267
10267
  "review/review-premise": 180,
10268
10268
  "review/review-regression": 212,
10269
10269
  "review/review-security-code": 358,
10270
- "review/review-style": 350,
10271
- "review/review-testing-practices": 293,
10272
- "review/review-ui-ux": 267,
10270
+ "review/review-style": 315,
10271
+ "review/review-testing-practices": 275,
10272
+ "review/review-ui-ux": 227,
10273
10273
  "review/review-verifier": 299
10274
10274
  };
10275
10275
  SKILL_LENGTH_CEILINGS = new Map(Object.entries(CEILINGS_BY_KEY));
@@ -28953,23 +28953,24 @@ var TAG_MARKERS = {
28953
28953
  "http-server": ["express", "fastify", "koa", "hono", "@nestjs/core", "@hapi/hapi"]
28954
28954
  };
28955
28955
  var DEPENDENCY_FIELDS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
28956
- async function detectProjectStack(cwd, options = {}) {
28957
- const readFile = options.readFile ?? defaultReadFile;
28958
- const manifestPath = `${cwd.replace(/\/+$/, "")}/package.json`;
28956
+ async function readManifest(manifestPath, readFile) {
28959
28957
  let raw;
28960
28958
  try {
28961
28959
  raw = await readFile(manifestPath);
28962
28960
  } catch {
28963
- return uncertainStack(`package.json not found at ${manifestPath}`);
28961
+ return { kind: "missing" };
28964
28962
  }
28965
28963
  let parsed;
28966
28964
  try {
28967
28965
  parsed = JSON.parse(raw);
28968
28966
  } catch (error) {
28969
- return uncertainStack(`package.json at ${manifestPath} did not parse as JSON: ${error instanceof Error ? error.message : String(error)}`);
28967
+ return {
28968
+ kind: "invalid",
28969
+ reason: `package.json at ${manifestPath} did not parse as JSON: ${error instanceof Error ? error.message : String(error)}`
28970
+ };
28970
28971
  }
28971
28972
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
28972
- return uncertainStack(`package.json at ${manifestPath} is not a JSON object`);
28973
+ return { kind: "invalid", reason: `package.json at ${manifestPath} is not a JSON object` };
28973
28974
  }
28974
28975
  const record = parsed;
28975
28976
  const names = new Set;
@@ -28981,12 +28982,68 @@ async function detectProjectStack(cwd, options = {}) {
28981
28982
  }
28982
28983
  }
28983
28984
  }
28984
- const workspaceGlobs = workspacePatterns(record);
28985
- if (workspaceGlobs.length > 0) {
28986
- return uncertainStack(`package.json at ${manifestPath} declares workspaces (${workspaceGlobs.join(", ")}); the dependencies that decide the stack live in the sub-packages, which this module does not walk`);
28985
+ return { kind: "ok", names, workspaces: workspacePatterns(record) };
28986
+ }
28987
+ async function nearestPackageManifests(root, files, readFile) {
28988
+ const nearestByDir = new Map;
28989
+ const reads = new Map;
28990
+ for (const file of files) {
28991
+ const absolute = file.startsWith("/") ? file : `${root}/${file.replace(/^(\.\/)+/, "")}`;
28992
+ if (!absolute.startsWith(`${root}/`) || absolute.split("/").includes(".."))
28993
+ continue;
28994
+ const visited = [];
28995
+ let dir = absolute.slice(0, absolute.lastIndexOf("/"));
28996
+ let nearest;
28997
+ while (dir.startsWith(`${root}/`)) {
28998
+ if (nearestByDir.has(dir)) {
28999
+ nearest = nearestByDir.get(dir);
29000
+ break;
29001
+ }
29002
+ visited.push(dir);
29003
+ const manifestPath = `${dir}/package.json`;
29004
+ const read = await readManifest(manifestPath, readFile);
29005
+ if (read.kind !== "missing") {
29006
+ reads.set(manifestPath, read);
29007
+ nearest = manifestPath;
29008
+ break;
29009
+ }
29010
+ dir = dir.slice(0, dir.lastIndexOf("/"));
29011
+ }
29012
+ for (const seen of visited)
29013
+ nearestByDir.set(seen, nearest);
29014
+ }
29015
+ return reads;
29016
+ }
29017
+ async function detectProjectStack(cwd, options = {}) {
29018
+ const readFile = options.readFile ?? defaultReadFile;
29019
+ const root = cwd.replace(/\/+$/, "");
29020
+ const manifestPath = `${root}/package.json`;
29021
+ const files = options.files ?? [];
29022
+ const rootRead = await readManifest(manifestPath, readFile);
29023
+ if (rootRead.kind === "missing") {
29024
+ return uncertainStack(`package.json not found at ${manifestPath}`);
29025
+ }
29026
+ if (rootRead.kind === "invalid") {
29027
+ return uncertainStack(rootRead.reason);
29028
+ }
29029
+ const names = new Set(rootRead.names);
29030
+ const readPaths = [manifestPath];
29031
+ const nested = files.length > 0 ? await nearestPackageManifests(root, files, readFile) : new Map;
29032
+ for (const [nestedPath, read] of [...nested.entries()].sort(([a], [b]) => a.localeCompare(b))) {
29033
+ if (read.kind === "invalid") {
29034
+ return uncertainStack(read.reason);
29035
+ }
29036
+ if (read.kind !== "ok")
29037
+ continue;
29038
+ readPaths.push(nestedPath);
29039
+ for (const name of read.names)
29040
+ names.add(name);
29041
+ }
29042
+ if (files.length === 0 && rootRead.workspaces.length > 0) {
29043
+ return uncertainStack(`package.json at ${manifestPath} declares workspaces (${rootRead.workspaces.join(", ")}); the dependencies that decide the stack live in the sub-packages, and no scope files were given to find them`);
28987
29044
  }
28988
29045
  if (names.size === 0) {
28989
- return uncertainStack(`package.json at ${manifestPath} declares no dependencies in ${DEPENDENCY_FIELDS.join("/")} \u2014 a manifest that declares nothing has not said the repository uses nothing`);
29046
+ return uncertainStack(`${readPaths.join(", ")} declare${readPaths.length === 1 ? "s" : ""} no dependencies in ${DEPENDENCY_FIELDS.join("/")} \u2014 a manifest that declares nothing has not said the repository uses nothing`);
28990
29047
  }
28991
29048
  const matched = [];
28992
29049
  const nestjsMatches = [...names].filter((name) => name.startsWith("@nestjs/")).sort();
@@ -29000,7 +29057,7 @@ async function detectProjectStack(cwd, options = {}) {
29000
29057
  return {
29001
29058
  tags,
29002
29059
  uncertain: false,
29003
- reason: `detected from ${manifestPath} (${names.size} declared dependenc${names.size === 1 ? "y" : "ies"})`,
29060
+ reason: `detected from ${readPaths.join(", ")} (${names.size} declared dependenc${names.size === 1 ? "y" : "ies"})`,
29004
29061
  matched
29005
29062
  };
29006
29063
  }
@@ -30945,7 +31002,7 @@ function lightConventionsReviewer(roster, inventory) {
30945
31002
  }
30946
31003
  async function requiredReviewers(root, mode, files, options = {}) {
30947
31004
  const inventory = await collectReviewers(root);
30948
- const stack = await detectProjectStack(root);
31005
+ const stack = await detectProjectStack(root, { files });
30949
31006
  const excluded = [];
30950
31007
  const roster = [];
30951
31008
  for (const reviewer of inventory.bundled) {
@@ -31613,7 +31670,7 @@ var COVERAGE_FILE = "coverage.json";
31613
31670
  var SLICE_MANIFEST_COPY = "slice-manifest.json";
31614
31671
  var readJson2 = (file) => readJsonFileOr(file, undefined);
31615
31672
  var text2 = (value) => typeof value === "string" && value.trim().length > 0;
31616
- async function readManifest(packageDir) {
31673
+ async function readManifest2(packageDir) {
31617
31674
  for (const candidate of [path54.join(packageDir, "slices", "manifest.json"), path54.join(packageDir, SLICE_MANIFEST_COPY)]) {
31618
31675
  const found = await readJson2(candidate);
31619
31676
  if (found !== undefined && Array.isArray(found.slices))
@@ -31671,7 +31728,7 @@ async function computeCoverage(packageDir, options = {}) {
31671
31728
  const research = options.research ?? await readJson2(path54.join(packageDir, "research.json"));
31672
31729
  const dispatch = asRecord(asRecord(research)?.dispatch);
31673
31730
  const radius = await readJson2(path54.join(packageDir, "blast-radius.json"));
31674
- const manifest = await readManifest(packageDir);
31731
+ const manifest = await readManifest2(packageDir);
31675
31732
  const retry = await readJson2(path54.join(packageDir, "retry-state.json"));
31676
31733
  const scopeA = await packageScopeFiles(packageDir) ?? [];
31677
31734
  const chunkPass = hasChunkPlan(packageDir) ? await computeChunkPass(packageDir) : null;
@@ -48481,6 +48538,12 @@ var HELP_GROUPS = [
48481
48538
  summary: "Managed review packages and lightweight report-only review mode; `review ledger build` writes the research ledger the completion gate demands."
48482
48539
  },
48483
48540
  { kind: "slash", name: "/flows", group: "Managed work", summary: "Browse project flows and inspect one." },
48541
+ {
48542
+ kind: "slash",
48543
+ name: "/task",
48544
+ group: "Managed work",
48545
+ summary: "Quick start: pick a mode, describe the work, answer a few questions, and the Hub creates and starts the flow."
48546
+ },
48484
48547
  {
48485
48548
  kind: "slash",
48486
48549
  name: "/ac",
@@ -49205,7 +49268,7 @@ async function runValidate(cwd) {
49205
49268
  async function runDoctor(cwd) {
49206
49269
  return validateWorkspace2(cwd);
49207
49270
  }
49208
- async function readManifest2(cwd) {
49271
+ async function readManifest3(cwd) {
49209
49272
  const manifestPath = path150.join(cwd, ".metaproject", "metaproject.json");
49210
49273
  if (!await pathExists(manifestPath)) {
49211
49274
  throw new Error("Metaproject is not initialized (missing .metaproject/metaproject.json). Run `keryx init` first.");
@@ -49218,7 +49281,7 @@ async function readManifest2(cwd) {
49218
49281
  }
49219
49282
  }
49220
49283
  async function runCapabilities(cwd) {
49221
- const manifest = await readManifest2(cwd);
49284
+ const manifest = await readManifest3(cwd);
49222
49285
  return {
49223
49286
  report: extractCapabilities(manifest),
49224
49287
  profiles: await evaluateProfiles(cwd, manifest)
@@ -11343,33 +11343,33 @@ var init_skill_length_ceilings = __esm(() => {
11343
11343
  "quality/tests-creator": 360,
11344
11344
  "quality/ui-craft": 173,
11345
11345
  "review/code-learned-review": 283,
11346
- "review/review-architecture": 373,
11347
- "review/review-backend": 359,
11348
- "review/review-clean-code": 217,
11346
+ "review/review-architecture": 337,
11347
+ "review/review-backend": 307,
11348
+ "review/review-clean-code": 204,
11349
11349
  "review/review-core-boundaries": 158,
11350
11350
  "review/review-degradation": 191,
11351
11351
  "review/review-flow-graph": 183,
11352
- "review/review-frontend": 610,
11353
- "review/review-frontend-conventions": 206,
11354
- "review/review-highload": 472,
11352
+ "review/review-frontend": 317,
11353
+ "review/review-frontend-conventions": 192,
11354
+ "review/review-highload": 328,
11355
11355
  "review/review-jev-comments": 179,
11356
11356
  "review/review-jev-contract": 188,
11357
11357
  "review/review-jev-docs": 184,
11358
11358
  "review/review-jev-risk": 185,
11359
11359
  "review/review-jev-rules": 262,
11360
11360
  "review/review-jev-scenarios": 182,
11361
- "review/review-layout": 237,
11361
+ "review/review-layout": 231,
11362
11362
  "review/review-logic": 364,
11363
11363
  "review/review-orchestrator": 1565,
11364
- "review/review-performance": 354,
11364
+ "review/review-performance": 332,
11365
11365
  "review/review-pr-contract": 190,
11366
11366
  "review/review-pr-feedback": 893,
11367
11367
  "review/review-premise": 180,
11368
11368
  "review/review-regression": 212,
11369
11369
  "review/review-security-code": 358,
11370
- "review/review-style": 350,
11371
- "review/review-testing-practices": 293,
11372
- "review/review-ui-ux": 267,
11370
+ "review/review-style": 315,
11371
+ "review/review-testing-practices": 275,
11372
+ "review/review-ui-ux": 227,
11373
11373
  "review/review-verifier": 299
11374
11374
  };
11375
11375
  SKILL_LENGTH_CEILINGS = new Map(Object.entries(CEILINGS_BY_KEY));
@@ -23428,23 +23428,24 @@ var TAG_MARKERS = {
23428
23428
  "http-server": ["express", "fastify", "koa", "hono", "@nestjs/core", "@hapi/hapi"]
23429
23429
  };
23430
23430
  var DEPENDENCY_FIELDS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
23431
- async function detectProjectStack(cwd, options = {}) {
23432
- const readFile = options.readFile ?? defaultReadFile;
23433
- const manifestPath = `${cwd.replace(/\/+$/, "")}/package.json`;
23431
+ async function readManifest(manifestPath, readFile) {
23434
23432
  let raw;
23435
23433
  try {
23436
23434
  raw = await readFile(manifestPath);
23437
23435
  } catch {
23438
- return uncertainStack(`package.json not found at ${manifestPath}`);
23436
+ return { kind: "missing" };
23439
23437
  }
23440
23438
  let parsed;
23441
23439
  try {
23442
23440
  parsed = JSON.parse(raw);
23443
23441
  } catch (error) {
23444
- return uncertainStack(`package.json at ${manifestPath} did not parse as JSON: ${error instanceof Error ? error.message : String(error)}`);
23442
+ return {
23443
+ kind: "invalid",
23444
+ reason: `package.json at ${manifestPath} did not parse as JSON: ${error instanceof Error ? error.message : String(error)}`
23445
+ };
23445
23446
  }
23446
23447
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
23447
- return uncertainStack(`package.json at ${manifestPath} is not a JSON object`);
23448
+ return { kind: "invalid", reason: `package.json at ${manifestPath} is not a JSON object` };
23448
23449
  }
23449
23450
  const record = parsed;
23450
23451
  const names = new Set;
@@ -23456,12 +23457,68 @@ async function detectProjectStack(cwd, options = {}) {
23456
23457
  }
23457
23458
  }
23458
23459
  }
23459
- const workspaceGlobs = workspacePatterns(record);
23460
- if (workspaceGlobs.length > 0) {
23461
- return uncertainStack(`package.json at ${manifestPath} declares workspaces (${workspaceGlobs.join(", ")}); the dependencies that decide the stack live in the sub-packages, which this module does not walk`);
23460
+ return { kind: "ok", names, workspaces: workspacePatterns(record) };
23461
+ }
23462
+ async function nearestPackageManifests(root, files, readFile) {
23463
+ const nearestByDir = new Map;
23464
+ const reads = new Map;
23465
+ for (const file of files) {
23466
+ const absolute = file.startsWith("/") ? file : `${root}/${file.replace(/^(\.\/)+/, "")}`;
23467
+ if (!absolute.startsWith(`${root}/`) || absolute.split("/").includes(".."))
23468
+ continue;
23469
+ const visited = [];
23470
+ let dir = absolute.slice(0, absolute.lastIndexOf("/"));
23471
+ let nearest;
23472
+ while (dir.startsWith(`${root}/`)) {
23473
+ if (nearestByDir.has(dir)) {
23474
+ nearest = nearestByDir.get(dir);
23475
+ break;
23476
+ }
23477
+ visited.push(dir);
23478
+ const manifestPath = `${dir}/package.json`;
23479
+ const read = await readManifest(manifestPath, readFile);
23480
+ if (read.kind !== "missing") {
23481
+ reads.set(manifestPath, read);
23482
+ nearest = manifestPath;
23483
+ break;
23484
+ }
23485
+ dir = dir.slice(0, dir.lastIndexOf("/"));
23486
+ }
23487
+ for (const seen of visited)
23488
+ nearestByDir.set(seen, nearest);
23489
+ }
23490
+ return reads;
23491
+ }
23492
+ async function detectProjectStack(cwd, options = {}) {
23493
+ const readFile = options.readFile ?? defaultReadFile;
23494
+ const root = cwd.replace(/\/+$/, "");
23495
+ const manifestPath = `${root}/package.json`;
23496
+ const files = options.files ?? [];
23497
+ const rootRead = await readManifest(manifestPath, readFile);
23498
+ if (rootRead.kind === "missing") {
23499
+ return uncertainStack(`package.json not found at ${manifestPath}`);
23500
+ }
23501
+ if (rootRead.kind === "invalid") {
23502
+ return uncertainStack(rootRead.reason);
23503
+ }
23504
+ const names = new Set(rootRead.names);
23505
+ const readPaths = [manifestPath];
23506
+ const nested = files.length > 0 ? await nearestPackageManifests(root, files, readFile) : new Map;
23507
+ for (const [nestedPath, read] of [...nested.entries()].sort(([a], [b]) => a.localeCompare(b))) {
23508
+ if (read.kind === "invalid") {
23509
+ return uncertainStack(read.reason);
23510
+ }
23511
+ if (read.kind !== "ok")
23512
+ continue;
23513
+ readPaths.push(nestedPath);
23514
+ for (const name of read.names)
23515
+ names.add(name);
23516
+ }
23517
+ if (files.length === 0 && rootRead.workspaces.length > 0) {
23518
+ return uncertainStack(`package.json at ${manifestPath} declares workspaces (${rootRead.workspaces.join(", ")}); the dependencies that decide the stack live in the sub-packages, and no scope files were given to find them`);
23462
23519
  }
23463
23520
  if (names.size === 0) {
23464
- return uncertainStack(`package.json at ${manifestPath} declares no dependencies in ${DEPENDENCY_FIELDS.join("/")} \u2014 a manifest that declares nothing has not said the repository uses nothing`);
23521
+ return uncertainStack(`${readPaths.join(", ")} declare${readPaths.length === 1 ? "s" : ""} no dependencies in ${DEPENDENCY_FIELDS.join("/")} \u2014 a manifest that declares nothing has not said the repository uses nothing`);
23465
23522
  }
23466
23523
  const matched = [];
23467
23524
  const nestjsMatches = [...names].filter((name) => name.startsWith("@nestjs/")).sort();
@@ -23475,7 +23532,7 @@ async function detectProjectStack(cwd, options = {}) {
23475
23532
  return {
23476
23533
  tags,
23477
23534
  uncertain: false,
23478
- reason: `detected from ${manifestPath} (${names.size} declared dependenc${names.size === 1 ? "y" : "ies"})`,
23535
+ reason: `detected from ${readPaths.join(", ")} (${names.size} declared dependenc${names.size === 1 ? "y" : "ies"})`,
23479
23536
  matched
23480
23537
  };
23481
23538
  }
@@ -24938,7 +24995,7 @@ function lightConventionsReviewer(roster, inventory) {
24938
24995
  }
24939
24996
  async function requiredReviewers(root, mode, files, options = {}) {
24940
24997
  const inventory = await collectReviewers(root);
24941
- const stack = await detectProjectStack(root);
24998
+ const stack = await detectProjectStack(root, { files });
24942
24999
  const excluded = [];
24943
25000
  const roster = [];
24944
25001
  for (const reviewer of inventory.bundled) {
@@ -25605,7 +25662,7 @@ init_json();
25605
25662
  var SLICE_MANIFEST_COPY = "slice-manifest.json";
25606
25663
  var readJson3 = (file) => readJsonFileOr(file, undefined);
25607
25664
  var text2 = (value) => typeof value === "string" && value.trim().length > 0;
25608
- async function readManifest(packageDir) {
25665
+ async function readManifest2(packageDir) {
25609
25666
  for (const candidate of [path52.join(packageDir, "slices", "manifest.json"), path52.join(packageDir, SLICE_MANIFEST_COPY)]) {
25610
25667
  const found = await readJson3(candidate);
25611
25668
  if (found !== undefined && Array.isArray(found.slices))
@@ -25655,7 +25712,7 @@ async function computeCoverage(packageDir, options = {}) {
25655
25712
  const research = options.research ?? await readJson3(path52.join(packageDir, "research.json"));
25656
25713
  const dispatch = asRecord5(asRecord5(research)?.dispatch);
25657
25714
  const radius = await readJson3(path52.join(packageDir, "blast-radius.json"));
25658
- const manifest = await readManifest(packageDir);
25715
+ const manifest = await readManifest2(packageDir);
25659
25716
  const retry = await readJson3(path52.join(packageDir, "retry-state.json"));
25660
25717
  const scopeA = await packageScopeFiles(packageDir) ?? [];
25661
25718
  const chunkPass = hasChunkPlan(packageDir) ? await computeChunkPass(packageDir) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
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": {
@@ -370,6 +370,7 @@
370
370
  "src/gdskills/bundled/rules/core/code-review-learned-profile.mdc",
371
371
  "src/gdskills/bundled/rules/core/code-style-patterns.mdc",
372
372
  "src/gdskills/bundled/rules/core/commit-message-formatting.mdc",
373
+ "src/gdskills/bundled/rules/core/concurrency-patterns.mdc",
373
374
  "src/gdskills/bundled/rules/core/database-patterns.mdc",
374
375
  "src/gdskills/bundled/rules/core/definition-of-done.mdc",
375
376
  "src/gdskills/bundled/rules/core/documentation-management.mdc",
@@ -381,6 +382,7 @@
381
382
  "src/gdskills/bundled/rules/core/implementation-doc-mandate.mdc",
382
383
  "src/gdskills/bundled/rules/core/implementation-plans.mdc",
383
384
  "src/gdskills/bundled/rules/core/jobs-documentation.mdc",
385
+ "src/gdskills/bundled/rules/core/layout-rendering.mdc",
384
386
  "src/gdskills/bundled/rules/core/model-selection.mdc",
385
387
  "src/gdskills/bundled/rules/core/playwright-testing.mdc",
386
388
  "src/gdskills/bundled/rules/core/requirements-management.mdc",
@@ -1,151 +1,36 @@
1
1
  ---
2
- description: "API contract rules: OpenAPI-first design, semantic versioning, no breaking changes without major version bump, contract testing. Use when designing, modifying, or consuming HTTP APIs."
2
+ description: "API contract standard shared by code writers and reviewers, with the severities reviewers use: spec first, no breaking change without a new major version, one error envelope, 400 for validation failures, idempotency keys on creating mutations, paginated list envelopes. Use when designing, changing or consuming HTTP APIs."
3
3
  alwaysApply: false
4
4
  stack_requires: "http-server"
5
5
  ---
6
6
 
7
7
  # API Contracts
8
8
 
9
- ## Purpose
10
- Prevent silent breaking changes, version drift, and undocumented API behaviour. Enforce OpenAPI-first design and strict versioning discipline.
11
-
12
- ## When To Apply
13
- Apply when creating new API endpoints, modifying existing endpoints, changing DTOs/schemas, or writing API client code.
14
-
15
- ---
16
-
17
- ## Core Principle: Contract Before Code
18
-
19
- The OpenAPI spec (or equivalent schema) is the source of truth. Code is generated from or validated against the spec — not the other way around.
20
-
21
- ```
22
- 1. Design the endpoint in OpenAPI/schema first
23
- 2. Review the contract for breaking changes
24
- 3. Generate or update types/validators from the spec
25
- 4. Implement the handler
26
- 5. Write contract tests that validate the spec is honoured
27
- ```
28
-
29
- ---
9
+ Canon applies: OpenAPI 3, RFC 9110 status-code semantics, semantic versioning. This rule holds only this project's decisions.
30
10
 
31
11
  ## Rules
32
12
 
33
- ### Rule 1: OpenAPI-First for New Endpoints
34
- Every new HTTP endpoint MUST have an OpenAPI 3.x definition before the handler is implemented:
35
-
36
- ```yaml
37
- # Required fields for every endpoint definition
38
- paths:
39
- /users/{id}:
40
- get:
41
- operationId: getUser # unique, stable identifier
42
- summary: Get user by ID
43
- parameters:
44
- - name: id
45
- in: path
46
- required: true
47
- schema: { type: string, format: uuid }
48
- responses:
49
- '200':
50
- description: User found
51
- content:
52
- application/json:
53
- schema: { $ref: '#/components/schemas/User' }
54
- '404':
55
- $ref: '#/components/responses/NotFound'
56
- '401':
57
- $ref: '#/components/responses/Unauthorized'
58
- ```
59
-
60
- **Required for every endpoint:**
61
- - `operationId` (stable, unique)
62
- - All path/query/header parameters documented
63
- - All response codes documented (including 4xx, 5xx)
64
- - Request body schema referenced (not inlined) for reuse
65
-
66
- ### Rule 2: Semantic Versioning for APIs
67
-
68
- | Change Type | Version Impact | Action Required |
69
- |---|---|---|
70
- | Add optional field to response | None / patch | Safe — backwards compatible |
71
- | Add optional field to request | None / patch | Safe — old clients omit it |
72
- | Add new endpoint | Minor bump | Document in changelog |
73
- | Make optional field required | **Major bump** | Breaking change |
74
- | Remove field from response | **Major bump** | Breaking change |
75
- | Rename field | **Major bump** | Breaking change |
76
- | Change field type | **Major bump** | Breaking change |
77
- | Remove endpoint | **Major bump** | Deprecate first, remove in next major |
78
-
79
- **Breaking change protocol:**
80
- 1. Add deprecation notice to old version (`deprecated: true` in OpenAPI)
81
- 2. Implement new version at `/v{N+1}/...` or with new operationId
82
- 3. Run old version in parallel for ≥1 release cycle
83
- 4. Remove old version only after clients have migrated
84
-
85
- ### Rule 3: Contract Testing
86
- Every public API endpoint MUST have at least one contract test that:
87
- - Validates the response shape matches the OpenAPI schema
88
- - Tests the error responses (at minimum: 400, 404, 401 where applicable)
89
- - Uses schema validation, not string matching
90
-
91
- ```typescript
92
- // Example: contract test using a schema validator
93
- describe('GET /users/:id contract', () => {
94
- it('returns User schema on 200', async () => {
95
- const res = await request(app).get('/users/valid-id');
96
- expect(res.status).toBe(200);
97
- expect(res.body).toMatchSchema(UserSchema); // validated against OpenAPI
98
- });
99
-
100
- it('returns 404 with NotFound schema on unknown id', async () => {
101
- const res = await request(app).get('/users/nonexistent');
102
- expect(res.status).toBe(404);
103
- expect(res.body).toMatchSchema(NotFoundSchema);
104
- });
105
- });
106
- ```
107
-
108
- ### Rule 4: No Undocumented Fields
109
- Every field in a request or response body MUST appear in the schema. Fields not in the schema must be stripped from responses (`additionalProperties: false` in JSON Schema).
110
-
111
- ### Rule 5: Consistent Error Schema
112
- All error responses must use the same envelope schema:
113
-
114
- ```typescript
115
- interface ApiError {
116
- code: string; // machine-readable, e.g. "USER_NOT_FOUND"
117
- message: string; // human-readable
118
- details?: unknown; // optional structured context
119
- requestId: string; // for traceability
120
- }
121
- ```
122
-
123
- Never return raw Error objects, stack traces, or ORM error messages to API consumers.
124
-
125
- ### Rule 6: Idempotency Keys for Mutations
126
- POST/PUT/PATCH endpoints that create or modify state MUST support idempotency via `Idempotency-Key` header or a stable `clientId` in the body. This prevents duplicate operations on network retry.
127
-
128
- ---
129
-
130
- ## The three that are not negotiable
131
-
132
- Of the rules above, three carry consequences that outlive the change: no breaking
133
- change ships without a major version bump and a deprecation period; the OpenAPI
134
- spec is updated before the implementation, not after it as documentation; and
135
- error responses use the standard `ApiError` envelope — never a raw exception or
136
- an ad-hoc shape.
13
+ 1. **Spec first.** A new or changed endpoint is in the OpenAPI spec (or the project's equivalent schema) in the same change, before the handler: a stable `operationId`, every parameter, every response code including 4xx, request bodies by reference.
14
+ 2. **No breaking change inside a major version.** Removing, renaming or retyping a field, making an optional field required, removing an endpoint or changing what a status code means ships at `/v{N+1}` next to the old version, which is marked `deprecated` and kept for at least one release. Adding an optional field or a new endpoint is not breaking.
15
+ 3. **Every field in a request or response is in the schema**; undocumented response fields are stripped (`additionalProperties: false`).
16
+ 4. **One error envelope:** `{ code, message, details?, requestId }` for every error response. Never a raw exception, stack trace or ORM message. A validation failure answers `400`.
17
+ 5. **Creating mutations accept an `Idempotency-Key`** (POST that creates a record, moves money or reserves stock). A transition that is idempotent by itself (repeating it leaves the same state) needs none; say so in a comment.
18
+ 6. **Lists** return the same envelope as the API's other lists (e.g. `{ data, meta }`) and are paginated unless the list is bounded small by construction.
19
+ 7. **Contract tests:** each public endpoint has a test that validates its response and its error responses against the schema.
137
20
 
138
21
  ---
139
22
 
140
- ## Red Flags — Stop and re-read this rule if you are thinking:
23
+ ## Review severities (shared with reviewers)
141
24
 
142
- | Rationalization | Why it's wrong |
143
- |---|---|
144
- | "It's just adding a field, that's not breaking" | Removing a field later will be breaking — document it now to establish the contract |
145
- | "The spec can wait, I'll document it later" | Specs written after code document what the code does, not what it should do — bugs get documented too |
146
- | "Renaming a field is internal, consumers will adapt" | Consumers have no way to know a field was renamed — this silently breaks every client |
147
- | "I'll use v2 later if needed, for now v1 is fine" | Delaying versioning means v1 can never be changed without breaking consumers |
148
- | "Contract tests slow down development" | Contract tests catch breaking changes before they reach consumers — not after |
149
- | "The error format doesn't matter as long as the status code is right" | Status codes alone are insufficient for automated error handling — codes and schemas matter |
25
+ `review-backend` rates these patterns by this table. Change a row here, never in a reviewer.
150
26
 
151
- **IRON LAW: A BREAKING CHANGE WITHOUT A VERSION BUMP IS A PRODUCTION INCIDENT WAITING TO HAPPEN.**
27
+ | Signal | A finding when | Default | Not a finding |
28
+ |---|---|---|---|
29
+ | Breaking change inside a major version (Rule 2) | the endpoint is published or clients are generated | `major` | an endpoint with no released consumer |
30
+ | Endpoint, parameter or field missing from the spec (Rules 1, 3) | always | `major` when clients are generated from the spec; else `minor` | — |
31
+ | Error response outside the envelope (Rule 4) | it reaches a client | `major`; a leaked stack trace or ORM message is rated by `review-security-code` | — |
32
+ | Validation failure answered with a status other than `400` (Rule 4) | always | `minor` | — |
33
+ | Creating mutation with no idempotency key (Rule 5) | a retry duplicates money, stock or a record users see | `major`; `minor` for other records | a transition idempotent by itself |
34
+ | List with a different envelope from its siblings (Rule 6) | always | `minor`; changing an existing list's shape is Rule 2 | — |
35
+ | Unbounded list with no pagination (Rule 6) | the size grows with stored data | `major`; `blocker` where an attacker-reachable request exhausts memory | a list bounded small by construction, with the bound read |
36
+ | Public endpoint with no contract test (Rule 7) | always | `minor` | — |