@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
@@ -11,8 +11,37 @@
11
11
  * planner is intentionally conservative: a gate's `skip` decision is always
12
12
  * accompanied by a reason so the operator can see what was elided.
13
13
  */
14
+ import { existsSync, readFileSync } from 'node:fs';
14
15
  import * as nodePath from 'node:path';
15
16
  export const CHANGED_PREFLIGHT_SCHEMA = 'sharkcraft.changed-preflight/v1';
17
+ /**
18
+ * Cheap, best-effort probe: does this look like a generic JS/TS monorepo
19
+ * (nx / pnpm workspaces / package.json workspaces / apps+libs)? Used to widen
20
+ * the "engine source changed" detection beyond SharkCraft's own
21
+ * `packages/<package-name>/src/` layout. A couple of stat calls — no full inspect.
22
+ */
23
+ function isMonorepoLike(projectRoot) {
24
+ try {
25
+ if (existsSync(nodePath.join(projectRoot, 'nx.json')))
26
+ return true;
27
+ if (existsSync(nodePath.join(projectRoot, 'pnpm-workspace.yaml')))
28
+ return true;
29
+ if (existsSync(nodePath.join(projectRoot, 'apps')) ||
30
+ existsSync(nodePath.join(projectRoot, 'libs'))) {
31
+ return true;
32
+ }
33
+ const pkgPath = nodePath.join(projectRoot, 'package.json');
34
+ if (existsSync(pkgPath)) {
35
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
36
+ if (pkg.workspaces)
37
+ return true;
38
+ }
39
+ }
40
+ catch {
41
+ // Best-effort: treat any read/parse failure as "not obviously a monorepo".
42
+ }
43
+ return false;
44
+ }
16
45
  export var PreflightProfile;
17
46
  (function (PreflightProfile) {
18
47
  PreflightProfile["Quick"] = "quick";
@@ -25,10 +54,23 @@ export var PreflightAction;
25
54
  PreflightAction["Skip"] = "skip";
26
55
  PreflightAction["Recommend"] = "recommend";
27
56
  })(PreflightAction || (PreflightAction = {}));
28
- function classifyChangedFiles(files) {
57
+ function classifyChangedFiles(files, opts = {}) {
29
58
  const norm = files.map((f) => f.replace(/\\/g, '/'));
30
59
  const match = (re) => norm.some((p) => re.test(p));
31
- const anyEngineSource = match(/^packages\/[^/]+\/src\//);
60
+ let anyEngineSource = match(/^packages\/[^/]+\/src\//);
61
+ // Monorepo-aware: on an nx / workspaces / apps+libs repo, source also lives
62
+ // under apps/*/src, libs/*/src, or a project-root src/ — not only
63
+ // SharkCraft's own packages/*/src/. Without this, a large nx change is
64
+ // misclassified as "no engine src changed" and every src-sensitive gate is
65
+ // skipped. Only widen when a monorepo signal is present, so this repo's own
66
+ // classification is unchanged.
67
+ if (!anyEngineSource && opts.projectRoot && isMonorepoLike(opts.projectRoot)) {
68
+ anyEngineSource = match(/^(apps|libs|packages)\/[^/]+\/(src|lib)\//) || match(/^src\//);
69
+ }
70
+ // Caller-supplied source roots (e.g. derived from config) always count.
71
+ if (!anyEngineSource && opts.sourceGlobs?.length) {
72
+ anyEngineSource = norm.some((p) => opts.sourceGlobs.some((g) => p.startsWith(g)));
73
+ }
32
74
  const anyPackages = match(/^packages\//);
33
75
  const anyTests = match(/__tests__\/|\.test\.ts$|e2e\//);
34
76
  const anySharkcraftAssets = match(/^sharkcraft\//);
@@ -71,7 +113,12 @@ function classifyChangedFiles(files) {
71
113
  */
72
114
  export function planChangedPreflight(options) {
73
115
  const profile = options.profile ?? PreflightProfile.Standard;
74
- const cls = classifyChangedFiles(options.changedFiles);
116
+ const cls = classifyChangedFiles(options.changedFiles, {
117
+ projectRoot: options.projectRoot,
118
+ ...(options.sourceGlobs ? { sourceGlobs: options.sourceGlobs } : {}),
119
+ });
120
+ const testCmd = options.testCommand ?? 'bun test';
121
+ const typecheckCmd = options.typecheckCommand ?? 'bun x tsc -p tsconfig.base.json --noEmit';
75
122
  const explanations = [];
76
123
  const gates = [];
77
124
  // 1) Boundary check — needed when engine src changed.
@@ -249,7 +296,7 @@ export function planChangedPreflight(options) {
249
296
  gates.push({
250
297
  id: 'tests',
251
298
  title: 'Bun test suite (focused subset where possible)',
252
- command: 'bun test',
299
+ command: testCmd,
253
300
  action: PreflightAction.Run,
254
301
  reason: 'strict profile + engine src changed',
255
302
  canFail: false,
@@ -259,7 +306,7 @@ export function planChangedPreflight(options) {
259
306
  gates.push({
260
307
  id: 'tests',
261
308
  title: 'Bun test suite',
262
- command: 'bun test',
309
+ command: testCmd,
263
310
  action: PreflightAction.Recommend,
264
311
  reason: 'engine src or tests changed; full suite not auto-run',
265
312
  canFail: true,
@@ -269,7 +316,7 @@ export function planChangedPreflight(options) {
269
316
  gates.push({
270
317
  id: 'tests',
271
318
  title: 'Bun test suite',
272
- command: 'bun test',
319
+ command: testCmd,
273
320
  action: PreflightAction.Skip,
274
321
  reason: 'no engine src or test changes',
275
322
  canFail: true,
@@ -281,7 +328,7 @@ export function planChangedPreflight(options) {
281
328
  gates.push({
282
329
  id: 'typecheck',
283
330
  title: 'TypeScript --noEmit',
284
- command: 'bun x tsc -p tsconfig.base.json --noEmit',
331
+ command: typecheckCmd,
285
332
  action: PreflightAction.Recommend,
286
333
  reason: 'engine src changed; not auto-run on quick profile',
287
334
  canFail: true,
@@ -291,7 +338,7 @@ export function planChangedPreflight(options) {
291
338
  gates.push({
292
339
  id: 'typecheck',
293
340
  title: 'TypeScript --noEmit',
294
- command: 'bun x tsc -p tsconfig.base.json --noEmit',
341
+ command: typecheckCmd,
295
342
  action: PreflightAction.Run,
296
343
  reason: 'engine src changed',
297
344
  canFail: false,
@@ -302,7 +349,7 @@ export function planChangedPreflight(options) {
302
349
  gates.push({
303
350
  id: 'typecheck',
304
351
  title: 'TypeScript --noEmit',
305
- command: 'bun x tsc -p tsconfig.base.json --noEmit',
352
+ command: typecheckCmd,
306
353
  action: PreflightAction.Skip,
307
354
  reason: 'no engine src changed',
308
355
  canFail: true,
@@ -1 +1 @@
1
- {"version":3,"file":"changes-summary.d.ts","sourceRoot":"","sources":["../src/changes-summary.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,oBAAY,UAAU;IACpB,GAAG,QAAQ;IACX,SAAS,eAAe;IACxB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,SAAS,eAAe;IACxB,QAAQ,a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AE,SAAS,MAAM,EAAE,CAAC;IACrC,qCAAqC;IACrC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,0CAA0C;IAC1C,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChC,wCAAwC;IACxC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,qCAAqC;IACrC,2BAA2B,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAyKD,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAsDhC;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAiDlF"}
@@ -12,6 +12,7 @@
12
12
  * Read-only; no AI; deterministic. Schema: sharkcraft.changes-summary/v1.
13
13
  */
14
14
  import { getChangedFiles } from "./git-helpers.js";
15
+ import { resolveVerificationCommands } from "./resolve-verification-commands.js";
15
16
  export const CHANGES_SUMMARY_SCHEMA = 'sharkcraft.changes-summary/v1';
16
17
  export var ChangeArea;
17
18
  (function (ChangeArea) {
@@ -90,6 +91,11 @@ function classifyArea(file) {
90
91
  if (/(?:^|\/)[\w-]*sharkcraft-pack\//.test(file)) {
91
92
  return ChangeArea.PackContrib;
92
93
  }
94
+ // Extension fallback so the summary stays useful in non-SharkCraft repos
95
+ // (e.g. a foreign monorepo's `architecture/*.md`) instead of bucketing every
96
+ // doc as `unknown`.
97
+ if (/\.mdx?$/i.test(file))
98
+ return ChangeArea.Docs;
93
99
  return ChangeArea.Unknown;
94
100
  }
95
101
  function classifyFile(file) {
@@ -170,10 +176,14 @@ function computeRisk(files) {
170
176
  return { risk: 'medium', reasons };
171
177
  return { risk: 'low', reasons };
172
178
  }
173
- function suggestValidationCommands(files) {
174
- const out = new Set();
175
- out.add('bun x tsc -p tsconfig.base.json --noEmit');
176
- out.add('bun test');
179
+ function suggestValidationCommands(files, inspection) {
180
+ // Project-aware base gates: prefer the repo's OWN configured
181
+ // verificationCommands (e.g. `nx build <app>` on an Nx repo) over the generic
182
+ // tsc/test pair, matching plan-simulate / review-packet / task-packet. The
183
+ // file-type conditional adds below are shrk meta-checks valid on any repo.
184
+ const out = new Set(resolveVerificationCommands(inspection, {
185
+ knowledgeDefaults: ['bun x tsc -p tsconfig.base.json --noEmit', 'bun test'],
186
+ }));
177
187
  if (files.some((f) => f.isMcpTool)) {
178
188
  out.add('shrk safety audit --deep');
179
189
  out.add('shrk commands doctor');
@@ -229,7 +239,11 @@ export async function buildChangesSummary(inspection, options = {}) {
229
239
  ref = options.since;
230
240
  }
231
241
  else {
232
- changedFiles = getChangedFiles(cwd, {});
242
+ // Default working-tree view must include untracked files — otherwise a
243
+ // brand-new (never-staged) file is invisible to the summary, which made
244
+ // `totalFiles` undercount whole untracked directories. Mirrors every other
245
+ // working-tree caller (boundaries / propose-knowledge / architecture).
246
+ changedFiles = getChangedFiles(cwd, { includeWorktree: true });
233
247
  source = 'working-tree';
234
248
  }
235
249
  const classified = changedFiles.map(classifyFile);
@@ -260,7 +274,7 @@ export async function buildChangesSummary(inspection, options = {}) {
260
274
  safetyRelevantFiles,
261
275
  risk,
262
276
  riskReasons: reasons,
263
- suggestedValidationCommands: suggestValidationCommands(classified),
277
+ suggestedValidationCommands: suggestValidationCommands(classified, inspection),
264
278
  likelyPrSummary: buildPrSummary(classified),
265
279
  };
266
280
  }
@@ -0,0 +1,16 @@
1
+ export interface IGuardrailGlobResult {
2
+ /** Target paths covered by at least one guardrail glob. */
3
+ allowed: readonly string[];
4
+ /** Target paths covered by NO guardrail glob — these must not be written. */
5
+ refused: readonly string[];
6
+ /** True when every target path is allowed. */
7
+ ok: boolean;
8
+ }
9
+ /**
10
+ * Partition `targetPaths` into allowed / refused against the recipe's
11
+ * `guardrailGlobs` (allow-list). An empty glob list refuses everything — a
12
+ * recipe with no blast-radius fence must not write (the config validator also
13
+ * rejects this, but the check is defensive here too).
14
+ */
15
+ export declare function checkGuardrailGlobs(targetPaths: readonly string[], guardrailGlobs: readonly string[]): IGuardrailGlobResult;
16
+ //# sourceMappingURL=check-guardrail-globs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-guardrail-globs.d.ts","sourceRoot":"","sources":["../src/check-guardrail-globs.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,6EAA6E;IAC7E,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,8CAA8C;IAC9C,EAAE,EAAE,OAAO,CAAC;CACb;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,oBAAoB,CAWtB"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Guardrail-glob enforcement for the delegate worker.
3
+ *
4
+ * A recipe declares an ALLOW-LIST of globs (`guardrailGlobs`). A worker-emitted
5
+ * target path that matches NONE of them is refused before any write — this is
6
+ * one of the deterministic fences the model cannot influence, layered ON TOP of
7
+ * the generator's `safeResolveTargetPath` floor.
8
+ *
9
+ * CRITICAL: the caller MUST pass the NORMALIZED relative path that will actually
10
+ * be written (the output of `safeResolveTargetPath`), not the raw string a
11
+ * worker emitted — otherwise a `../` traversal whose `**` the glob swallows
12
+ * would pass the fence yet write elsewhere in-root. Matching here is
13
+ * CASE-SENSITIVE (file paths are case-significant on the platforms that matter),
14
+ * so `src/**` does not also grant `SRC/…`.
15
+ *
16
+ * Pure: deterministic glob match; no I/O, no model.
17
+ */
18
+ import { globToRegex, toPosix } from "./contract-file-rule.js";
19
+ /**
20
+ * Partition `targetPaths` into allowed / refused against the recipe's
21
+ * `guardrailGlobs` (allow-list). An empty glob list refuses everything — a
22
+ * recipe with no blast-radius fence must not write (the config validator also
23
+ * rejects this, but the check is defensive here too).
24
+ */
25
+ export function checkGuardrailGlobs(targetPaths, guardrailGlobs) {
26
+ const matchers = guardrailGlobs.map((g) => globToRegex(toPosix(g)));
27
+ const allowed = [];
28
+ const refused = [];
29
+ for (const path of targetPaths) {
30
+ const f = toPosix(path);
31
+ const covered = matchers.some((re) => re.test(f));
32
+ if (covered)
33
+ allowed.push(path);
34
+ else
35
+ refused.push(path);
36
+ }
37
+ return { allowed, refused, ok: refused.length === 0 };
38
+ }
@@ -0,0 +1,21 @@
1
+ import { type IDoctorCheck } from './doctor-result.js';
2
+ export interface ICodeIntelligenceDoctorOptions {
3
+ /**
4
+ * Overrides `Date.now()`. Used by tests to make age computations
5
+ * deterministic without touching the system clock.
6
+ */
7
+ nowMs?: number;
8
+ /**
9
+ * Override the stale-data threshold (days). Default 7. Tests use this
10
+ * to flip a fresh fixture into "stale" without changing mtime.
11
+ */
12
+ staleThresholdDays?: number;
13
+ }
14
+ /**
15
+ * Read every code-intelligence package's persisted state and produce a
16
+ * compact set of doctor findings. The function is sync (matches the
17
+ * rest of `runDoctor`) and silent when no state is present (e.g. the
18
+ * user has never run `shrk graph index`).
19
+ */
20
+ export declare function buildCodeIntelligenceChecks(projectRoot: string, options?: ICodeIntelligenceDoctorOptions): IDoctorCheck[];
21
+ //# sourceMappingURL=code-intelligence-doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-intelligence-doctor.d.ts","sourceRoot":"","sources":["../src/code-intelligence-doctor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAoKvE,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,8BAAmC,GAC3C,YAAY,EAAE,CAkBhB"}