@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.
- package/dist/agent-brief.d.ts.map +1 -1
- package/dist/agent-brief.js +59 -10
- package/dist/agent-contract-gate.d.ts.map +1 -1
- package/dist/agent-contract-gate.js +25 -2
- package/dist/agent-instructions.d.ts.map +1 -1
- package/dist/agent-instructions.js +11 -0
- package/dist/agent-task-prep.d.ts.map +1 -1
- package/dist/agent-task-prep.js +1 -3
- package/dist/ai-readiness.d.ts +84 -9
- package/dist/ai-readiness.d.ts.map +1 -1
- package/dist/ai-readiness.js +181 -35
- package/dist/apply-dispatch-trace.d.ts +1 -2
- package/dist/apply-dispatch-trace.d.ts.map +1 -1
- package/dist/apply-dispatch-trace.js +0 -9
- package/dist/area-explore.d.ts.map +1 -1
- package/dist/area-explore.js +4 -6
- package/dist/area-map.d.ts +0 -5
- package/dist/area-map.d.ts.map +1 -1
- package/dist/area-map.js +0 -10
- package/dist/changed-preflight.d.ts +7 -0
- package/dist/changed-preflight.d.ts.map +1 -1
- package/dist/changed-preflight.js +56 -9
- package/dist/changes-summary.d.ts.map +1 -1
- package/dist/changes-summary.js +20 -6
- package/dist/check-guardrail-globs.d.ts +16 -0
- package/dist/check-guardrail-globs.d.ts.map +1 -0
- package/dist/check-guardrail-globs.js +38 -0
- package/dist/code-intelligence-doctor.d.ts +21 -0
- package/dist/code-intelligence-doctor.d.ts.map +1 -0
- package/dist/code-intelligence-doctor.js +985 -0
- package/dist/command-recommender.d.ts.map +1 -1
- package/dist/command-recommender.js +23 -0
- package/dist/compliance-profiles.js +1 -1
- package/dist/construct-adoption-diff.d.ts.map +1 -1
- package/dist/construct-adoption-diff.js +2 -1
- package/dist/construct-adoption.d.ts.map +1 -1
- package/dist/construct-adoption.js +10 -11
- package/dist/construct-inference.d.ts.map +1 -1
- package/dist/construct-inference.js +5 -2
- package/dist/construct-registry.d.ts.map +1 -1
- package/dist/construct-registry.js +2 -10
- package/dist/contract-file-rule.d.ts +8 -0
- package/dist/contract-file-rule.d.ts.map +1 -1
- package/dist/contract-file-rule.js +8 -3
- package/dist/contract-template-registry.d.ts.map +1 -1
- package/dist/contract-template-registry.js +2 -10
- package/dist/contradictions.d.ts +8 -1
- package/dist/contradictions.d.ts.map +1 -1
- package/dist/contradictions.js +37 -35
- package/dist/convention-registry.d.ts.map +1 -1
- package/dist/convention-registry.js +2 -10
- package/dist/coverage-report.d.ts.map +1 -1
- package/dist/coverage-report.js +14 -1
- package/dist/dashboard/dashboard-knowledge.d.ts +8 -0
- package/dist/dashboard/dashboard-knowledge.d.ts.map +1 -0
- package/dist/dashboard/dashboard-knowledge.js +259 -0
- package/dist/decision-records.d.ts.map +1 -1
- package/dist/decision-records.js +5 -10
- package/dist/delegate-catalog.d.ts +45 -0
- package/dist/delegate-catalog.d.ts.map +1 -0
- package/dist/delegate-catalog.js +50 -0
- package/dist/delegate-doctor.d.ts +15 -0
- package/dist/delegate-doctor.d.ts.map +1 -0
- package/dist/delegate-doctor.js +36 -0
- package/dist/delegate-pack-recipes.d.ts +29 -0
- package/dist/delegate-pack-recipes.d.ts.map +1 -0
- package/dist/delegate-pack-recipes.js +77 -0
- package/dist/demo-script.d.ts +0 -1
- package/dist/demo-script.d.ts.map +1 -1
- package/dist/demo-script.js +0 -43
- package/dist/docs-check.js +1 -1
- package/dist/drift-baseline.d.ts.map +1 -1
- package/dist/drift-baseline.js +5 -2
- package/dist/feedback-ingestion.d.ts.map +1 -1
- package/dist/feedback-ingestion.js +2 -16
- package/dist/git-helpers.d.ts +15 -0
- package/dist/git-helpers.d.ts.map +1 -1
- package/dist/git-helpers.js +51 -4
- package/dist/helper-registry.d.ts +27 -54
- package/dist/helper-registry.d.ts.map +1 -1
- package/dist/helper-registry.js +16 -517
- package/dist/impact-analysis.d.ts.map +1 -1
- package/dist/impact-analysis.js +14 -7
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/ingest-drafts.js +8 -4
- package/dist/migration-profile-registry.d.ts.map +1 -1
- package/dist/migration-profile-registry.js +2 -10
- package/dist/monorepo-onboarding.js +2 -2
- package/dist/onboarding-report.d.ts.map +1 -1
- package/dist/onboarding-report.js +5 -1
- package/dist/onboarding.d.ts +1 -1
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +9 -66
- package/dist/ownership.js +2 -10
- package/dist/pack-contributions-inventory.d.ts +0 -1
- package/dist/pack-contributions-inventory.d.ts.map +1 -1
- package/dist/pack-contributions-inventory.js +17 -29
- package/dist/pack-helper-registry.d.ts.map +1 -1
- package/dist/pack-helper-registry.js +2 -10
- package/dist/pack-release-check.d.ts.map +1 -1
- package/dist/pack-release-check.js +4 -11
- package/dist/pack-signature-status.d.ts.map +1 -1
- package/dist/pack-signature-status.js +18 -2
- package/dist/pack-test-runner.js +2 -10
- package/dist/plan-review.d.ts.map +1 -1
- package/dist/plan-review.js +5 -10
- package/dist/plan-simulation.d.ts +13 -0
- package/dist/plan-simulation.d.ts.map +1 -1
- package/dist/plan-simulation.js +19 -28
- package/dist/playbook-registry.d.ts.map +1 -1
- package/dist/playbook-registry.js +2 -10
- package/dist/policy-engine.d.ts.map +1 -1
- package/dist/policy-engine.js +3 -11
- package/dist/policy-test.js +3 -11
- package/dist/profile-registry.d.ts +0 -1
- package/dist/profile-registry.d.ts.map +1 -1
- package/dist/profile-registry.js +4 -32
- package/dist/propose-knowledge.d.ts +15 -0
- package/dist/propose-knowledge.d.ts.map +1 -1
- package/dist/propose-knowledge.js +37 -4
- package/dist/quality-baseline.d.ts.map +1 -1
- package/dist/quality-baseline.js +3 -1
- package/dist/ranker-explainability.d.ts.map +1 -1
- package/dist/ranker-explainability.js +3 -9
- package/dist/registration-hint-registry.d.ts.map +1 -1
- package/dist/registration-hint-registry.js +2 -10
- package/dist/registry-lifecycle.d.ts +6 -0
- package/dist/registry-lifecycle.d.ts.map +1 -1
- package/dist/registry-lifecycle.js +137 -10
- package/dist/release-readiness.js +3 -3
- package/dist/repo-memory.d.ts.map +1 -1
- package/dist/repo-memory.js +3 -1
- package/dist/reposet.js +1 -1
- package/dist/repository-intelligence.d.ts.map +1 -1
- package/dist/repository-intelligence.js +7 -2
- package/dist/repository-knowledge-model.d.ts +1 -1
- package/dist/repository-knowledge-model.d.ts.map +1 -1
- package/dist/repository-stats.d.ts.map +1 -1
- package/dist/repository-stats.js +3 -1
- package/dist/resolve-verification-commands.d.ts +26 -0
- package/dist/resolve-verification-commands.d.ts.map +1 -0
- package/dist/resolve-verification-commands.js +55 -0
- package/dist/review-packet.d.ts.map +1 -1
- package/dist/review-packet.js +14 -17
- package/dist/rule-drift.d.ts.map +1 -1
- package/dist/rule-drift.js +24 -9
- package/dist/rule-scaffold.d.ts.map +1 -1
- package/dist/rule-scaffold.js +12 -4
- package/dist/scaffold-patterns.js +2 -10
- package/dist/schema-inventory.d.ts.map +1 -1
- package/dist/schema-inventory.js +3 -1
- package/dist/search-tuning-registry.d.ts.map +1 -1
- package/dist/search-tuning-registry.js +2 -10
- package/dist/self-config-doctor-v2.d.ts +1 -1
- package/dist/self-config-doctor-v2.d.ts.map +1 -1
- package/dist/self-config-doctor-v2.js +6 -10
- package/dist/self-config-doctor.d.ts.map +1 -1
- package/dist/self-config-doctor.js +7 -13
- package/dist/sharkcraft-inspector.d.ts +14 -0
- package/dist/sharkcraft-inspector.d.ts.map +1 -1
- package/dist/sharkcraft-inspector.js +103 -1
- package/dist/start-here.d.ts +2 -2
- package/dist/start-here.d.ts.map +1 -1
- package/dist/start-here.js +16 -1
- package/dist/synthesize-from-onboarding.d.ts +68 -0
- package/dist/synthesize-from-onboarding.d.ts.map +1 -0
- package/dist/synthesize-from-onboarding.js +508 -0
- package/dist/task-packet.d.ts +13 -0
- package/dist/task-packet.d.ts.map +1 -1
- package/dist/task-packet.js +59 -6
- package/dist/task-ranker.d.ts.map +1 -1
- package/dist/task-ranker.js +1 -31
- package/dist/task-routing-hint-registry.d.ts.map +1 -1
- package/dist/task-routing-hint-registry.js +2 -10
- package/dist/template-drift.d.ts +7 -0
- package/dist/template-drift.d.ts.map +1 -1
- package/dist/template-drift.js +14 -6
- package/dist/test-impact.d.ts.map +1 -1
- package/dist/test-impact.js +5 -2
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +12 -17
- package/dist/universal-search.d.ts +0 -1
- package/dist/universal-search.d.ts.map +1 -1
- package/dist/universal-search.js +0 -12
- package/dist/why-file.js +66 -22
- package/package.json +18 -18
- package/dist/plugin-lifecycle-profile-registry.d.ts +0 -52
- package/dist/plugin-lifecycle-profile-registry.d.ts.map +0 -1
- package/dist/plugin-lifecycle-profile-registry.js +0 -202
- package/dist/plugin-lifecycle.d.ts +0 -132
- package/dist/plugin-lifecycle.d.ts.map +0 -1
- 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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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":"
|
|
1
|
+
{"version":3,"file":"changes-summary.d.ts","sourceRoot":"","sources":["../src/changes-summary.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EA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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
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
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"}
|