@shrkcrft/inspector 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (194) hide show
  1. package/dist/agent-brief.d.ts.map +1 -1
  2. package/dist/agent-brief.js +59 -10
  3. package/dist/agent-contract-gate.d.ts.map +1 -1
  4. package/dist/agent-contract-gate.js +25 -2
  5. package/dist/agent-instructions.d.ts.map +1 -1
  6. package/dist/agent-instructions.js +11 -0
  7. package/dist/agent-task-prep.d.ts.map +1 -1
  8. package/dist/agent-task-prep.js +1 -3
  9. package/dist/ai-readiness.d.ts +84 -9
  10. package/dist/ai-readiness.d.ts.map +1 -1
  11. package/dist/ai-readiness.js +181 -35
  12. package/dist/apply-dispatch-trace.d.ts +1 -2
  13. package/dist/apply-dispatch-trace.d.ts.map +1 -1
  14. package/dist/apply-dispatch-trace.js +0 -9
  15. package/dist/area-explore.d.ts.map +1 -1
  16. package/dist/area-explore.js +4 -6
  17. package/dist/area-map.d.ts +0 -5
  18. package/dist/area-map.d.ts.map +1 -1
  19. package/dist/area-map.js +0 -10
  20. package/dist/changed-preflight.d.ts +7 -0
  21. package/dist/changed-preflight.d.ts.map +1 -1
  22. package/dist/changed-preflight.js +56 -9
  23. package/dist/changes-summary.d.ts.map +1 -1
  24. package/dist/changes-summary.js +20 -6
  25. package/dist/check-guardrail-globs.d.ts +16 -0
  26. package/dist/check-guardrail-globs.d.ts.map +1 -0
  27. package/dist/check-guardrail-globs.js +38 -0
  28. package/dist/code-intelligence-doctor.d.ts +21 -0
  29. package/dist/code-intelligence-doctor.d.ts.map +1 -0
  30. package/dist/code-intelligence-doctor.js +985 -0
  31. package/dist/command-recommender.d.ts.map +1 -1
  32. package/dist/command-recommender.js +23 -0
  33. package/dist/compliance-profiles.js +1 -1
  34. package/dist/construct-adoption-diff.d.ts.map +1 -1
  35. package/dist/construct-adoption-diff.js +2 -1
  36. package/dist/construct-adoption.d.ts.map +1 -1
  37. package/dist/construct-adoption.js +10 -11
  38. package/dist/construct-inference.d.ts.map +1 -1
  39. package/dist/construct-inference.js +5 -2
  40. package/dist/construct-registry.d.ts.map +1 -1
  41. package/dist/construct-registry.js +2 -10
  42. package/dist/contract-file-rule.d.ts +8 -0
  43. package/dist/contract-file-rule.d.ts.map +1 -1
  44. package/dist/contract-file-rule.js +8 -3
  45. package/dist/contract-template-registry.d.ts.map +1 -1
  46. package/dist/contract-template-registry.js +2 -10
  47. package/dist/contradictions.d.ts +8 -1
  48. package/dist/contradictions.d.ts.map +1 -1
  49. package/dist/contradictions.js +37 -35
  50. package/dist/convention-registry.d.ts.map +1 -1
  51. package/dist/convention-registry.js +2 -10
  52. package/dist/coverage-report.d.ts.map +1 -1
  53. package/dist/coverage-report.js +14 -1
  54. package/dist/dashboard/dashboard-knowledge.d.ts +8 -0
  55. package/dist/dashboard/dashboard-knowledge.d.ts.map +1 -0
  56. package/dist/dashboard/dashboard-knowledge.js +259 -0
  57. package/dist/decision-records.d.ts.map +1 -1
  58. package/dist/decision-records.js +5 -10
  59. package/dist/delegate-catalog.d.ts +45 -0
  60. package/dist/delegate-catalog.d.ts.map +1 -0
  61. package/dist/delegate-catalog.js +50 -0
  62. package/dist/delegate-doctor.d.ts +15 -0
  63. package/dist/delegate-doctor.d.ts.map +1 -0
  64. package/dist/delegate-doctor.js +36 -0
  65. package/dist/delegate-pack-recipes.d.ts +29 -0
  66. package/dist/delegate-pack-recipes.d.ts.map +1 -0
  67. package/dist/delegate-pack-recipes.js +77 -0
  68. package/dist/demo-script.d.ts +0 -1
  69. package/dist/demo-script.d.ts.map +1 -1
  70. package/dist/demo-script.js +0 -43
  71. package/dist/docs-check.js +1 -1
  72. package/dist/drift-baseline.d.ts.map +1 -1
  73. package/dist/drift-baseline.js +5 -2
  74. package/dist/feedback-ingestion.d.ts.map +1 -1
  75. package/dist/feedback-ingestion.js +2 -16
  76. package/dist/git-helpers.d.ts +15 -0
  77. package/dist/git-helpers.d.ts.map +1 -1
  78. package/dist/git-helpers.js +51 -4
  79. package/dist/helper-registry.d.ts +27 -54
  80. package/dist/helper-registry.d.ts.map +1 -1
  81. package/dist/helper-registry.js +16 -517
  82. package/dist/impact-analysis.d.ts.map +1 -1
  83. package/dist/impact-analysis.js +14 -7
  84. package/dist/index.d.ts +8 -2
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +8 -2
  87. package/dist/ingest-drafts.js +8 -4
  88. package/dist/migration-profile-registry.d.ts.map +1 -1
  89. package/dist/migration-profile-registry.js +2 -10
  90. package/dist/monorepo-onboarding.js +2 -2
  91. package/dist/onboarding-report.d.ts.map +1 -1
  92. package/dist/onboarding-report.js +5 -1
  93. package/dist/onboarding.d.ts +1 -1
  94. package/dist/onboarding.d.ts.map +1 -1
  95. package/dist/onboarding.js +9 -66
  96. package/dist/ownership.js +2 -10
  97. package/dist/pack-contributions-inventory.d.ts +0 -1
  98. package/dist/pack-contributions-inventory.d.ts.map +1 -1
  99. package/dist/pack-contributions-inventory.js +17 -29
  100. package/dist/pack-helper-registry.d.ts.map +1 -1
  101. package/dist/pack-helper-registry.js +2 -10
  102. package/dist/pack-release-check.d.ts.map +1 -1
  103. package/dist/pack-release-check.js +4 -11
  104. package/dist/pack-signature-status.d.ts.map +1 -1
  105. package/dist/pack-signature-status.js +18 -2
  106. package/dist/pack-test-runner.js +2 -10
  107. package/dist/plan-review.d.ts.map +1 -1
  108. package/dist/plan-review.js +5 -10
  109. package/dist/plan-simulation.d.ts +13 -0
  110. package/dist/plan-simulation.d.ts.map +1 -1
  111. package/dist/plan-simulation.js +19 -28
  112. package/dist/playbook-registry.d.ts.map +1 -1
  113. package/dist/playbook-registry.js +2 -10
  114. package/dist/policy-engine.d.ts.map +1 -1
  115. package/dist/policy-engine.js +3 -11
  116. package/dist/policy-test.js +3 -11
  117. package/dist/profile-registry.d.ts +0 -1
  118. package/dist/profile-registry.d.ts.map +1 -1
  119. package/dist/profile-registry.js +4 -32
  120. package/dist/propose-knowledge.d.ts +15 -0
  121. package/dist/propose-knowledge.d.ts.map +1 -1
  122. package/dist/propose-knowledge.js +37 -4
  123. package/dist/quality-baseline.d.ts.map +1 -1
  124. package/dist/quality-baseline.js +3 -1
  125. package/dist/ranker-explainability.d.ts.map +1 -1
  126. package/dist/ranker-explainability.js +3 -9
  127. package/dist/registration-hint-registry.d.ts.map +1 -1
  128. package/dist/registration-hint-registry.js +2 -10
  129. package/dist/registry-lifecycle.d.ts +6 -0
  130. package/dist/registry-lifecycle.d.ts.map +1 -1
  131. package/dist/registry-lifecycle.js +137 -10
  132. package/dist/release-readiness.js +3 -3
  133. package/dist/repo-memory.d.ts.map +1 -1
  134. package/dist/repo-memory.js +3 -1
  135. package/dist/reposet.js +1 -1
  136. package/dist/repository-intelligence.d.ts.map +1 -1
  137. package/dist/repository-intelligence.js +7 -2
  138. package/dist/repository-knowledge-model.d.ts +1 -1
  139. package/dist/repository-knowledge-model.d.ts.map +1 -1
  140. package/dist/repository-stats.d.ts.map +1 -1
  141. package/dist/repository-stats.js +3 -1
  142. package/dist/resolve-verification-commands.d.ts +26 -0
  143. package/dist/resolve-verification-commands.d.ts.map +1 -0
  144. package/dist/resolve-verification-commands.js +55 -0
  145. package/dist/review-packet.d.ts.map +1 -1
  146. package/dist/review-packet.js +14 -17
  147. package/dist/rule-drift.d.ts.map +1 -1
  148. package/dist/rule-drift.js +24 -9
  149. package/dist/rule-scaffold.d.ts.map +1 -1
  150. package/dist/rule-scaffold.js +12 -4
  151. package/dist/scaffold-patterns.js +2 -10
  152. package/dist/schema-inventory.d.ts.map +1 -1
  153. package/dist/schema-inventory.js +3 -1
  154. package/dist/search-tuning-registry.d.ts.map +1 -1
  155. package/dist/search-tuning-registry.js +2 -10
  156. package/dist/self-config-doctor-v2.d.ts +1 -1
  157. package/dist/self-config-doctor-v2.d.ts.map +1 -1
  158. package/dist/self-config-doctor-v2.js +6 -10
  159. package/dist/self-config-doctor.d.ts.map +1 -1
  160. package/dist/self-config-doctor.js +7 -13
  161. package/dist/sharkcraft-inspector.d.ts +14 -0
  162. package/dist/sharkcraft-inspector.d.ts.map +1 -1
  163. package/dist/sharkcraft-inspector.js +103 -1
  164. package/dist/start-here.d.ts +2 -2
  165. package/dist/start-here.d.ts.map +1 -1
  166. package/dist/start-here.js +16 -1
  167. package/dist/synthesize-from-onboarding.d.ts +68 -0
  168. package/dist/synthesize-from-onboarding.d.ts.map +1 -0
  169. package/dist/synthesize-from-onboarding.js +508 -0
  170. package/dist/task-packet.d.ts +13 -0
  171. package/dist/task-packet.d.ts.map +1 -1
  172. package/dist/task-packet.js +59 -6
  173. package/dist/task-ranker.d.ts.map +1 -1
  174. package/dist/task-ranker.js +1 -31
  175. package/dist/task-routing-hint-registry.d.ts.map +1 -1
  176. package/dist/task-routing-hint-registry.js +2 -10
  177. package/dist/template-drift.d.ts +7 -0
  178. package/dist/template-drift.d.ts.map +1 -1
  179. package/dist/template-drift.js +14 -6
  180. package/dist/test-impact.d.ts.map +1 -1
  181. package/dist/test-impact.js +5 -2
  182. package/dist/test-runner.d.ts.map +1 -1
  183. package/dist/test-runner.js +12 -17
  184. package/dist/universal-search.d.ts +0 -1
  185. package/dist/universal-search.d.ts.map +1 -1
  186. package/dist/universal-search.js +0 -12
  187. package/dist/why-file.js +66 -22
  188. package/package.json +18 -18
  189. package/dist/plugin-lifecycle-profile-registry.d.ts +0 -52
  190. package/dist/plugin-lifecycle-profile-registry.d.ts.map +0 -1
  191. package/dist/plugin-lifecycle-profile-registry.js +0 -202
  192. package/dist/plugin-lifecycle.d.ts +0 -132
  193. package/dist/plugin-lifecycle.d.ts.map +0 -1
  194. package/dist/plugin-lifecycle.js +0 -477
@@ -1 +1 @@
1
- {"version":3,"file":"command-recommender.d.ts","sourceRoot":"","sources":["../src/command-recommender.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2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AC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,OAAO,0BAA0B,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,iEAAiE;IACjE,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAgFD,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,qBAAqB,EACjC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAClD,OAAO,CAAC,4BAA4B,CAAC,CAoFvC"}
@@ -50,8 +50,31 @@ const RECIPES = [
50
50
  { command: 'shrk drift', why: 'Drift report.' },
51
51
  ],
52
52
  },
53
+ {
54
+ match: /code[-\s]?intel|code intelligence|code graph|graph status|graph health|import cycle|unresolved import|blast radius|callers|dependents|who calls|who uses|where is .*\bused|find usages|usages? of|is .*\bwired|wired (up|to)|wire[ds]? .*\bto\b|path (from|between)|reach(es|able)|connected to|who implements|implementations? of|subclass|subtype|load[-\s]?bearing|\bhubs?\b|most[-\s](depended|imported|referenced)|what.*change carefully|important.*\b(code|files?|symbols?)|what breaks if|what calls|call sites?|trace .*\b(symbol|function|usage)/i,
55
+ recommendations: [
56
+ { command: 'shrk graph callers <symbol>', why: 'Who calls / references a symbol, as path:line — the grep replacement for "who calls X / where is X used".' },
57
+ { command: 'shrk graph path <from> <to>', why: 'Is code A actually wired to code B? Shortest import/call/implements path between two files or symbols — the deterministic answer to "is X wired to Y".' },
58
+ { command: 'shrk graph hubs', why: 'The most-depended-on symbols/files (biggest blast radius) — what to change carefully or understand first when onboarding.' },
59
+ { command: 'shrk graph context <file-or-symbol>', why: 'Inspect one file or symbol with imports, callers, subtypes/supertypes, bridge context, and framework hits — answers "is X wired".' },
60
+ { command: 'shrk graph impact <file-or-symbol> --full', why: 'What breaks if you change it: graph-backed dependents, caller files, rules, and likely tests.' },
61
+ { command: 'shrk code-intel', why: 'One-shot health view across the code graph, bridge, and quality gates.' },
62
+ { command: 'shrk graph status', why: 'Check whether the code graph is present, fresh, and internally consistent.' },
63
+ { command: 'shrk graph unresolved', why: 'Find unresolved imports that undercut graph accuracy.' },
64
+ ],
65
+ },
66
+ {
67
+ match: /delegate|mechanical (edit|task|change|refactor)|grunt (work|task)|boilerplate|repetitive edit|hand (this|it|off) (off |over )?to (a |the )?(local |worker|model)|add (a |an )?(barrel )?(export|import)\b|local (llm|model) (do|handle|make)/i,
68
+ recommendations: [
69
+ { command: 'shrk delegate list', why: 'See the MECHANICAL task recipes a local-LLM worker can handle (the engine verifies the result + auto-reverts on failure). Each is fenced to specific files + op kinds.' },
70
+ { command: 'shrk delegate run "<task>" --recipe <id> --apply', why: 'Hand a mechanical, deterministically-verifiable edit to the LOCAL worker — you pay for a compact brief + result instead of reading the whole file and writing the edit. The edit lands only if it passes the recipe verification.' },
71
+ { command: 'shrk delegate explain <id>', why: 'Audit a recipe before trusting it: the allowed ops, guardrail globs, and whether its verification is bound.' },
72
+ ],
73
+ },
53
74
  ];
54
75
  function safetyLevelFor(command) {
76
+ if (/^shrk delegate run/i.test(command))
77
+ return 'writes-source';
55
78
  if (/^shrk (gen|init|apply|import|presets apply --write|packs (sign|new))/i.test(command))
56
79
  return 'writes-source';
57
80
  if (/^shrk (onboard|brief|dev start|handoff|export|report site|impact|ci scaffold|simulate|orchestrate)/i.test(command))
@@ -105,7 +105,7 @@ export async function runComplianceCheck(inspection, profileId) {
105
105
  }
106
106
  // MCP read-only contract — info only; the canonical check is the
107
107
  // separate `shrk safety audit` command, which has access to the MCP
108
- // tool list. We surface a hint here so adopters know to run it.
108
+ // tool list. We surface a hint here so consumers know to run it.
109
109
  if (profile.requiredMcpReadOnly) {
110
110
  findings.push({
111
111
  profileId: profile.id,
@@ -1 +1 @@
1
- {"version":3,"file":"construct-adoption-diff.d.ts","sourceRoot":"","sources":["../src/construct-adoption-diff.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,8BAA8B,0CAA0C,CAAC;AAEtF,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhF,oBAAY,sBAAsB;IAChC,YAAY,kBAAkB;IAC9B,QAAQ,cAAc;IACtB,UAAU,gBAAgB;IAC1B,aAAa,mBAAmB;IAChC,cAAc,oBAAoB;IAClC,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,wEAAwE;IACxE,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,8BAA8B,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,yEAAyE;IACzE,oBAAoB,EAAE,OAAO,CAAC;IAC9B,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAC;IAC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AA2B,CACzC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,EAAE,2BAA2B,GAClC,MAAM,CAKR"}
@@ -159,7 +159,8 @@ function renderProposedFilePreview(existingSource, plan) {
159
159
  .join('\n');
160
160
  if (!existingSource) {
161
161
  return [
162
- "import { defineConstruct } from '@shrkcrft/plugin-api';",
162
+ '// Self-contained no @shrkcrft/* imports required.',
163
+ 'function defineConstruct<T>(construct: T): T { return construct; }',
163
164
  '',
164
165
  'export default [',
165
166
  additionBlock,
@@ -1 +1 @@
1
- {"version":3,"file":"construct-adoption.d.ts","sourceRoot":"","sources":["../src/construct-adoption.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,2BAA2B,EAC3B,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF,oBAAY,yBAAyB;IACnC,WAAW,kBAAkB;IAC7B,YAAY,kBAAkB;IAC9B,aAAa,mBAAmB;IAChC,cAAc,oBAAoB;IAClC,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,yBAAyB,CAAC;IACpC,UAAU,EAAE,2BAA2B,CAAC;IACxC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,yBAAyB,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,SAAS,uBAAuB,E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3B,6BAA6B,CAc/B;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,yCAAyC,CAAC;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CACnD;AAED,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,qBAAqB,GAChC,wBAAwB,CAkC1B"}
@@ -1,16 +1,8 @@
1
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
- });
6
- }
7
- return path;
8
- };
9
1
  import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
10
2
  import * as nodePath from 'node:path';
11
- import { pathToFileURL } from 'node:url';
12
3
  import { listConstructs } from "./construct-registry.js";
13
4
  import { InferredConstructConfidence, } from "./construct-inference.js";
5
+ import { importModuleViaLoader } from '@shrkcrft/core';
14
6
  export const CONSTRUCT_ADOPTION_SCHEMA = 'sharkcraft.construct-adoption-plan/v1';
15
7
  export var ConstructAdoptionCategory;
16
8
  (function (ConstructAdoptionCategory) {
@@ -33,7 +25,7 @@ async function loadDrafts(file) {
33
25
  if (!existsSync(file))
34
26
  return [];
35
27
  try {
36
- const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
28
+ const mod = (await importModuleViaLoader(file));
37
29
  if (Array.isArray(mod.default))
38
30
  return mod.default;
39
31
  if (Array.isArray(mod.constructs))
@@ -203,7 +195,14 @@ export function renderConstructAdoptionMarkdown(plan) {
203
195
  lines.push('# Construct adoption plan');
204
196
  lines.push('');
205
197
  lines.push(`Generated: ${plan.generatedAt}`);
206
- lines.push(`Drafts: ${plan.draftsFile ?? '(none)'}`);
198
+ // Render the drafts path relative to the project root so the rendered
199
+ // markdown (which often gets committed) doesn't leak absolute paths.
200
+ const relDrafts = plan.draftsFile
201
+ ? plan.draftsFile.startsWith(plan.projectRoot + nodePath.sep)
202
+ ? plan.draftsFile.slice(plan.projectRoot.length + 1)
203
+ : nodePath.basename(plan.draftsFile)
204
+ : '(none)';
205
+ lines.push(`Drafts: ${relDrafts}`);
207
206
  lines.push('');
208
207
  lines.push('## Summary');
209
208
  lines.push('');
@@ -1 +1 @@
1
- {"version":3,"file":"construct-inference.d.ts","sourceRoot":"","sources":["../src/construct-inference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E,oBAAY,2BAA2B;IACrC,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,2BAA2B,CAAC;IACxC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC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,MAAM,CAAC;IACd,UAAU,EAAE,2BAA2B,CAAC;IACxC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC5C,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,2BAA2B,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,OAAO,0BAA0B,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC1C,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AA0OD,wBAAsB,eAAe,CACnC,UAAU,EAAE,qBAAqB,EACjC,KAAK,GAAE,wBAA6B,GACnC,OAAO,CAAC,yBAAyB,CAAC,CAyJpC;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,yBAAyB,GAChC,MAAM,CAmBR"}
@@ -306,7 +306,9 @@ export async function inferConstructs(inspection, input = {}) {
306
306
  }
307
307
  // Pass 3: facet detection (events/tokens).
308
308
  for (const b of builders.values()) {
309
- for (const f of [...b.files].slice(0, 8)) {
309
+ // Sort before slicing: the files Set is in readdir order, so an unsorted
310
+ // first-8 would make the inferred events/tokens filesystem-order-dependent.
311
+ for (const f of [...b.files].sort().slice(0, 8)) {
310
312
  const abs = nodePath.join(projectRoot, f);
311
313
  const facets = scanFacets(abs);
312
314
  for (const e of facets.events)
@@ -379,7 +381,8 @@ export function renderConstructDraftsModule(result) {
379
381
  lines.push(" * SharkCraft does NOT load this file automatically.");
380
382
  lines.push(` * Generated: ${result.generatedAt}`);
381
383
  lines.push(" */");
382
- lines.push("import { defineConstruct } from '@shrkcrft/plugin-api';");
384
+ lines.push('// Self-contained no @shrkcrft/* imports required.');
385
+ lines.push('function defineConstruct<T>(construct: T): T { return construct; }');
383
386
  lines.push('');
384
387
  lines.push('export default [');
385
388
  for (const c of result.candidates) {
@@ -1 +1 @@
1
- {"version":3,"file":"construct-registry.d.ts","sourceRoot":"","sources":["../src/construct-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;CAAG;AA+DhE,wBAAsB,cAAc,CAClC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAwFhC;AAED;wEACwE;AACxE,wBAAgB,cAAc,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,UAAU,EAAE,CAGvF;AAED,wEAAwE;AACxE,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF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AAc,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,UAAU,EAAE,CAGvF;AAED,wEAAwE;AACxE,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,UAAU,CAAC;IACtB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC,CAAC;IACxD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,UAAU,GAAG,eAAe,CAmBrE"}
@@ -1,14 +1,6 @@
1
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
- });
6
- }
7
- return path;
8
- };
9
1
  import { existsSync, readFileSync } from 'node:fs';
10
2
  import * as nodePath from 'node:path';
11
- import { pathToFileURL } from 'node:url';
3
+ import { importModuleViaLoader } from '@shrkcrft/core';
12
4
  export const CONSTRUCT_REGISTRY_SCHEMA = 'sharkcraft.construct-registry/v1';
13
5
  const CACHE = new Map();
14
6
  function readJsonOrEmpty(file) {
@@ -22,7 +14,7 @@ function readJsonOrEmpty(file) {
22
14
  }
23
15
  }
24
16
  async function importDefault(file) {
25
- const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
17
+ const mod = (await importModuleViaLoader(file));
26
18
  const def = mod.default;
27
19
  if (Array.isArray(def))
28
20
  return def;
@@ -19,6 +19,14 @@ export interface IContractFileRule {
19
19
  reason?: string;
20
20
  severity?: ContractFileRuleSeverity;
21
21
  }
22
+ export declare function toPosix(p: string): string;
23
+ /**
24
+ * Translate a deterministic POSIX-style glob to a regex anchored at both ends.
25
+ * Case-sensitive by itself — `matchContractFileRule` lowercases its inputs for
26
+ * the contract use-case, but security-sensitive callers (the delegate guardrail)
27
+ * use this directly to keep file-path case significant.
28
+ */
29
+ export declare function globToRegex(pattern: string): RegExp;
22
30
  /** Pure matcher — returns true when `file` is covered by `rule`. */
23
31
  export declare function matchContractFileRule(rule: IContractFileRule, file: string): boolean;
24
32
  export interface IContractFileRuleMatch {
@@ -1 +1 @@
1
- {"version":3,"file":"contract-file-rule.d.ts","sourceRoot":"","sources":["../src/contract-file-rule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,UAAU,gBAAgB;IAC1B,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED,oBAAY,wBAAwB;IAClC,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC;AAyCD,oEAAoE;AACpE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,EAAE,I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zB;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,iBAAiB,EAAE,EACnC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,SAAS,sBAAsB,EAAE,CAQnC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,SAAS,iBAAiB,EAAE,CAE9B;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAQxE"}
@@ -15,14 +15,19 @@ export var ContractFileRuleSeverity;
15
15
  ContractFileRuleSeverity["Error"] = "error";
16
16
  ContractFileRuleSeverity["Warning"] = "warning";
17
17
  })(ContractFileRuleSeverity || (ContractFileRuleSeverity = {}));
18
- function toPosix(p) {
18
+ export function toPosix(p) {
19
19
  return p.replace(/\\/g, '/').replace(/^\.\//, '');
20
20
  }
21
21
  function escapeRegex(s) {
22
22
  return s.replace(/[.+^$(){}|\\[\]]/g, '\\$&');
23
23
  }
24
- /** Translate a deterministic POSIX-style glob to a regex anchored at both ends. */
25
- function globToRegex(pattern) {
24
+ /**
25
+ * Translate a deterministic POSIX-style glob to a regex anchored at both ends.
26
+ * Case-sensitive by itself — `matchContractFileRule` lowercases its inputs for
27
+ * the contract use-case, but security-sensitive callers (the delegate guardrail)
28
+ * use this directly to keep file-path case significant.
29
+ */
30
+ export function globToRegex(pattern) {
26
31
  const p = toPosix(pattern);
27
32
  let re = '';
28
33
  let i = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"contract-template-registry.d.ts","sourceRoot":"","sources":["../src/contract-template-registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAE5F,oBAAY,sBAAsB;IAChC,OAAO,Y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;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+CD,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC;IACT,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,MAAM,EAAE,SAAS,8BAA8B,EAAE,CAAC;CACnD,CAAC,CAkGD;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAG5C;AAED,wBAAgB,kCAAkC,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAG7E"}
@@ -1,19 +1,11 @@
1
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
- });
6
- }
7
- return path;
8
- };
9
1
  /**
10
2
  * Contract template registry. Merges engine built-ins with
11
3
  * pack-contributed contract templates via `contractTemplateFiles`.
12
4
  */
13
5
  import { existsSync } from 'node:fs';
14
6
  import * as nodePath from 'node:path';
15
- import { pathToFileURL } from 'node:url';
16
7
  import { ALL_CONTRACT_TEMPLATES, AGENT_CONTRACT_TEMPLATE_SCHEMA, } from "./agent-contract-templates.js";
8
+ import { importModuleViaLoader } from '@shrkcrft/core';
17
9
  export const CONTRACT_TEMPLATE_REGISTRY_SCHEMA = 'sharkcraft.contract-template-registry/v1';
18
10
  export var ContractTemplateSource;
19
11
  (function (ContractTemplateSource) {
@@ -23,7 +15,7 @@ export var ContractTemplateSource;
23
15
  })(ContractTemplateSource || (ContractTemplateSource = {}));
24
16
  const CACHE = new Map();
25
17
  async function importDefault(file) {
26
- const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
18
+ const mod = (await importModuleViaLoader(file));
27
19
  if (Array.isArray(mod.default))
28
20
  return mod.default;
29
21
  if (mod.default && typeof mod.default === 'object')
@@ -39,10 +39,17 @@ export interface IContradictionReport {
39
39
  }
40
40
  export interface IBuildContradictionReportOptions {
41
41
  inspection: ISharkcraftInspection;
42
- /** Max doc files to scan. Default 80. */
42
+ /** Max doc files to scan. Default 5000 (effectively the whole docs tree). */
43
43
  docScanLimit?: number;
44
44
  /** Max bytes per doc. Default 200_000. */
45
45
  bytesPerDoc?: number;
46
+ /**
47
+ * Authoritative set of CLI command names (top-level verbs) used to flag
48
+ * `shrk <verb>` references to non-existent commands. Injected by the CLI from
49
+ * its own command catalogue (inspector must not import cli). When omitted,
50
+ * missing-command findings are suppressed — the safe failure mode.
51
+ */
52
+ cliCommandNames?: ReadonlySet<string>;
46
53
  }
47
54
  export declare function buildContradictionReport(options: IBuildContradictionReportOptions): IContradictionReport;
48
55
  export declare function renderContradictionReportText(report: IContradictionReport): string;
@@ -1 +1 @@
1
- {"version":3,"file":"contradictions.d.ts","sourceRoot":"","sources":["../src/contradictions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBA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EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,gCAAgC;IAC/C,UAAU,EAAE,qBAAqB,CAAC;IAClC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC;AA8BD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,gCAAgC,GACxC,oBAAoB,CA8LtB;AAmFD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAgClF;AAED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CA2BtF;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAOlF;AAMD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAElF"}
@@ -17,7 +17,10 @@ export var ContradictionSeverity;
17
17
  ContradictionSeverity["Warning"] = "warning";
18
18
  ContradictionSeverity["Info"] = "info";
19
19
  })(ContradictionSeverity || (ContradictionSeverity = {}));
20
- const DEFAULT_DOC_SCAN_LIMIT = 80;
20
+ // High ceiling, not a sampling cap: docs are byte-bounded already, so scanning
21
+ // the whole tree is cheap and avoids the silent "scanned an arbitrary 80-file
22
+ // prefix" failure mode.
23
+ const DEFAULT_DOC_SCAN_LIMIT = 5000;
21
24
  const DEFAULT_BYTES_PER_DOC = 200_000;
22
25
  const DOC_EXTS = new Set(['.md', '.mdx', '.rst', '.txt']);
23
26
  const DOC_DIR_NAMES = new Set(['docs', 'documentation', 'doc']);
@@ -50,7 +53,7 @@ export function buildContradictionReport(options) {
50
53
  const knownScripts = new Set();
51
54
  for (const script of Object.keys(inspection.workspace.scripts ?? {}))
52
55
  knownScripts.add(script);
53
- const cliCommandNames = collectShrkCommandNames();
56
+ const cliCommandNames = options.cliCommandNames ?? new Set();
54
57
  for (const doc of docs) {
55
58
  let body = '';
56
59
  try {
@@ -91,20 +94,30 @@ export function buildContradictionReport(options) {
91
94
  continue;
92
95
  if (cleaned.startsWith('http://') || cleaned.startsWith('https://'))
93
96
  continue;
94
- const probe = cleaned.startsWith('./') ? cleaned.slice(2) : cleaned;
95
- if (seenOnLine.has(probe))
97
+ // Strip a trailing source-location suffix (`:91`, `:91-125`, `#L91`,
98
+ // `#L91-L99`) — a `file.ts:91` reference is about file.ts, not a path
99
+ // literally named "file.ts:91".
100
+ const bare = (cleaned.startsWith('./') ? cleaned.slice(2) : cleaned).replace(/[:#]L?\d+(?:[-:]L?\d+)?$/i, '');
101
+ if (!bare)
96
102
  continue;
97
- seenOnLine.add(probe);
98
- const abs = nodePath.join(projectRoot, probe);
99
- if (!existsSync(abs)) {
103
+ if (seenOnLine.has(bare))
104
+ continue;
105
+ seenOnLine.add(bare);
106
+ // Resolve against the project root OR — for bare sibling links that
107
+ // aren't source-tree-prefixed (e.g. a `./a.md` link inside docs/) —
108
+ // relative to the referencing doc's directory.
109
+ const resolvesAtRoot = existsSync(nodePath.join(projectRoot, bare));
110
+ const resolvesDocRelative = !SOURCE_PREFIX_RE.test(bare) &&
111
+ existsSync(nodePath.resolve(nodePath.dirname(doc.abs), bare));
112
+ if (!resolvesAtRoot && !resolvesDocRelative) {
100
113
  findings.push({
101
- id: `missing-path:${doc.rel}:${i + 1}:${probe}`,
114
+ id: `missing-path:${doc.rel}:${i + 1}:${bare}`,
102
115
  kind: ContradictionKind.MissingPath,
103
116
  severity: ContradictionSeverity.Warning,
104
- message: `Doc references missing path \`${probe}\`.`,
117
+ message: `Doc references missing path \`${bare}\`.`,
105
118
  source: doc.rel,
106
119
  line: i + 1,
107
- reference: probe,
120
+ reference: bare,
108
121
  suggestion: 'Update the doc or restore the file.',
109
122
  reason: 'Doc-vs-tree consistency.',
110
123
  });
@@ -153,7 +166,16 @@ export function buildContradictionReport(options) {
153
166
  // npm/bun script references.
154
167
  if ((head === 'bun' || head === 'npm' || head === 'pnpm' || head === 'yarn') && (next === 'run' || next === 'x')) {
155
168
  const script = tokens[2];
156
- if (script && !script.startsWith('-') && next === 'run' && knownScripts.size > 0 && !knownScripts.has(script)) {
169
+ // A real `bun run <script>` target is a bare script id, never a path.
170
+ // Skip path-shaped candidates (`bun run ../scripts/x.ts`) to avoid the
171
+ // false positive of treating a script-path as a missing package script.
172
+ const scriptLooksLikePath = !!script && (script.includes('/') || script.startsWith('.') || script.includes('.'));
173
+ if (script &&
174
+ !script.startsWith('-') &&
175
+ !scriptLooksLikePath &&
176
+ next === 'run' &&
177
+ knownScripts.size > 0 &&
178
+ !knownScripts.has(script)) {
157
179
  findings.push({
158
180
  id: `missing-command:${doc.rel}:${i + 1}:${script}`,
159
181
  kind: ContradictionKind.MissingCommand,
@@ -264,6 +286,10 @@ function looksLikePath(s) {
264
286
  return false;
265
287
  if (s.startsWith('http'))
266
288
  return false;
289
+ if (/^[a-z][\w.+-]*:/i.test(s))
290
+ return false; // URI scheme (file:, mailto:, …), not a tree path
291
+ if (/\/:[A-Za-z]/.test(s))
292
+ return false; // URL route param (`/api/:id/…`)
267
293
  if (s.includes(' '))
268
294
  return false;
269
295
  if (/[<>{}]/.test(s))
@@ -288,30 +314,6 @@ function looksLikePath(s) {
288
314
  return false;
289
315
  return true;
290
316
  }
291
- function collectShrkCommandNames() {
292
- // Hard-coded list of well-known top-level commands. Importing the CLI here
293
- // would create a layering violation (inspector → cli) — instead we mirror
294
- // the catalogue that `shrk commands` would print. Missing entries simply
295
- // suppress contradiction findings for those commands, which is the safe
296
- // failure mode.
297
- return new Set([
298
- 'init', 'inspect', 'doctor', 'context', 'gen', 'apply', 'export', 'import',
299
- 'task', 'next', 'find', 'explain', 'check', 'watch', 'drift', 'graph',
300
- 'coverage', 'review', 'onboard', 'test', 'plan', 'session', 'dev', 'ask',
301
- 'mcp', 'version', 'quality', 'ci', 'commands', 'safety', 'infer', 'report',
302
- 'dashboard', 'bundle', 'impact', 'search', 'brief', 'demo', 'release',
303
- 'start-here', 'handoff', 'map', 'intent', 'orchestrate', 'simulate', 'view',
304
- 'recommend', 'risk', 'migration', 'contract', 'languages', 'help',
305
- 'memory', 'heal', 'agent', 'docs', 'examples', 'self', 'install',
306
- 'diagnostics', 'intelligence', 'architecture', 'decisions', 'compliance',
307
- 'policy', 'product', 'reposet', 'packs', 'upgrade', 'api', 'boundaries',
308
- 'repo', 'owners', 'ownership', 'runtime', 'constructs', 'playbooks',
309
- 'presets', 'pipelines', 'paths', 'rules', 'templates', 'knowledge',
310
- 'schemas', 'scaffolds', 'tests',
311
- // Additions
312
- 'ingest', 'understand-task', 'validate-change', 'contradictions', 'generated', 'stability',
313
- ]);
314
- }
315
317
  export function renderContradictionReportText(report) {
316
318
  const lines = [];
317
319
  lines.push('=== Contradictions report ===');
@@ -1 +1 @@
1
- {"version":3,"file":"convention-registry.d.ts","sourceRoot":"","sources":["../src/convention-registry.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC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EAAE,EAAE,MAAM,GACT,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAGlC;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAG5C;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,gCAAgC,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAAC;CAC9C;AAiBD,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,qBAAqB,EACjC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAAC,sBAAsB,CAAC,CAqCjC"}
@@ -1,11 +1,3 @@
1
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
- });
6
- }
7
- return path;
8
- };
9
1
  /**
10
2
  * Convention registry. Loads pack + local conventions and validates
11
3
  * them. Engine has no built-in conventions; everything comes from
@@ -13,8 +5,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
13
5
  */
14
6
  import { existsSync } from 'node:fs';
15
7
  import * as nodePath from 'node:path';
16
- import { pathToFileURL } from 'node:url';
17
8
  import { validateConvention, } from '@shrkcrft/plugin-api';
9
+ import { importModuleViaLoader } from '@shrkcrft/core';
18
10
  export const CONVENTION_REGISTRY_SCHEMA = 'sharkcraft.convention-registry/v1';
19
11
  export var ConventionSource;
20
12
  (function (ConventionSource) {
@@ -23,7 +15,7 @@ export var ConventionSource;
23
15
  ConventionSource["Fixture"] = "fixture";
24
16
  })(ConventionSource || (ConventionSource = {}));
25
17
  async function importDefault(file) {
26
- const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
18
+ const mod = (await importModuleViaLoader(file));
27
19
  if (Array.isArray(mod.default))
28
20
  return mod.default;
29
21
  if (mod.default && typeof mod.default === 'object')
@@ -1 +1 @@
1
- {"version":3,"file":"coverage-report.d.ts","sourceRoot":"","sources":["../src/coverage-report.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAOD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,GAAG,eAAe,CAiLtF"}
1
+ {"version":3,"file":"coverage-report.d.ts","sourceRoot":"","sources":["../src/coverage-report.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAOD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,GAAG,eAAe,CA6LtF"}
@@ -181,7 +181,20 @@ export function buildCoverageReport(inspection) {
181
181
  missing,
182
182
  });
183
183
  }
184
- const overall = Math.round(categories.reduce((s, c) => s + c.score, 0) / Math.max(categories.length, 1));
184
+ // `overall` measures how well the USER has grounded THIS repo, so two kinds
185
+ // of category must not inflate it:
186
+ // 1. Empty categories (total === 0) — they vacuously score 100 (see `pct`),
187
+ // so a repo that just hasn't configured boundaries/packs would read as
188
+ // perfectly grounded and tell the agent to skip adding rules.
189
+ // 2. `preset-references` — it scores the BUILT-IN preset registry's
190
+ // validity (≈72/72 always), not the user's configuration, so on an
191
+ // otherwise-empty repo it alone would peg the overall at 100.
192
+ // Both stay as displayed categories; they're just out of the average.
193
+ // 0 when nothing user-authored is configured (honest: no coverage to report).
194
+ const scored = categories.filter((c) => c.total > 0 && c.id !== 'preset-references');
195
+ const overall = scored.length > 0
196
+ ? Math.round(scored.reduce((s, c) => s + c.score, 0) / scored.length)
197
+ : 0;
185
198
  if (overall < 60)
186
199
  suggestions.push('Pair every critical rule with action hints + verification commands.');
187
200
  if (overall < 80)
@@ -0,0 +1,8 @@
1
+ import type { IDashboardKnowledgeEntryResponse, IDashboardKnowledgeGraphResponse, IDashboardKnowledgeListResponse, IDashboardKnowledgeSimilarResponse } from '@shrkcrft/dashboard-api';
2
+ import type { ISharkcraftInspection } from '../sharkcraft-inspector.js';
3
+ export declare function buildDashboardKnowledgeList(inspection: ISharkcraftInspection): IDashboardKnowledgeListResponse;
4
+ export declare function buildDashboardKnowledgeEntry(inspection: ISharkcraftInspection, id: string): IDashboardKnowledgeEntryResponse;
5
+ export declare function buildDashboardKnowledgeGraph(inspection: ISharkcraftInspection): IDashboardKnowledgeGraphResponse;
6
+ /** Relevance-ranked "more like this" for one entry (lexical, deterministic). */
7
+ export declare function buildDashboardKnowledgeSimilar(inspection: ISharkcraftInspection, id: string): IDashboardKnowledgeSimilarResponse;
8
+ //# sourceMappingURL=dashboard-knowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-knowledge.d.ts","sourceRoot":"","sources":["../../src/dashboard/dashboard-knowledge.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAGV,gCAAgC,EAGhC,gCAAgC,EAEhC,+BAA+B,EAG/B,kCAAkC,EAGnC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAuHxE,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,qBAAqB,GAChC,+BAA+B,CAoBjC;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,qBAAqB,EACjC,EAAE,EAAE,MAAM,GACT,gCAAgC,CAkDlC;AAKD,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,qBAAqB,GAChC,gCAAgC,CA8ClC;AAED,gFAAgF;AAChF,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,qBAAqB,EACjC,EAAE,EAAE,MAAM,GACT,kCAAkC,CAqBpC"}