@shrkcrft/inspector 0.1.0-alpha.31 → 0.1.0-alpha.32
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-task-prep.d.ts.map +1 -1
- package/dist/agent-task-prep.js +9 -1
- package/dist/codemod-assist.d.ts.map +1 -1
- package/dist/codemod-assist.js +3 -1
- package/dist/comment-syntax.d.ts +15 -0
- package/dist/comment-syntax.d.ts.map +1 -0
- package/dist/comment-syntax.js +15 -0
- package/dist/contribution-load-failures.d.ts +18 -2
- package/dist/contribution-load-failures.d.ts.map +1 -1
- package/dist/contribution-load-failures.js +20 -3
- package/dist/contributions-report.js +2 -2
- package/dist/convention-applicability.d.ts +46 -0
- package/dist/convention-applicability.d.ts.map +1 -0
- package/dist/convention-applicability.js +247 -0
- package/dist/convention-filter-level.d.ts +13 -0
- package/dist/convention-filter-level.d.ts.map +1 -0
- package/dist/convention-filter-level.js +13 -0
- package/dist/convention-registry.d.ts +29 -4
- package/dist/convention-registry.d.ts.map +1 -1
- package/dist/convention-registry.js +58 -23
- package/dist/custom-checks.d.ts.map +1 -1
- package/dist/custom-checks.js +6 -4
- package/dist/decision-records.d.ts +4 -0
- package/dist/decision-records.d.ts.map +1 -1
- package/dist/decision-records.js +165 -66
- package/dist/declared-reference-coverage.d.ts +1 -1
- package/dist/declared-reference-coverage.d.ts.map +1 -1
- package/dist/declared-reference-coverage.js +6 -1
- package/dist/feedback-ingestion.d.ts.map +1 -1
- package/dist/feedback-ingestion.js +7 -1
- package/dist/file-languages.d.ts +9 -0
- package/dist/file-languages.d.ts.map +1 -0
- package/dist/file-languages.js +91 -0
- package/dist/fix-preview.d.ts.map +1 -1
- package/dist/fix-preview.js +78 -17
- package/dist/fuzzy-impact.d.ts.map +1 -1
- package/dist/fuzzy-impact.js +2 -1
- package/dist/git-helpers.d.ts +29 -4
- package/dist/git-helpers.d.ts.map +1 -1
- package/dist/git-helpers.js +69 -10
- package/dist/i-contribution-file-validation.d.ts +8 -0
- package/dist/i-contribution-file-validation.d.ts.map +1 -1
- package/dist/i-convention-applicability-reason.d.ts +29 -0
- package/dist/i-convention-applicability-reason.d.ts.map +1 -0
- package/dist/i-convention-applicability-reason.js +1 -0
- package/dist/i-convention-applicability.d.ts +9 -0
- package/dist/i-convention-applicability.d.ts.map +1 -0
- package/dist/i-convention-applicability.js +1 -0
- package/dist/i-convention-scope.d.ts +19 -0
- package/dist/i-convention-scope.d.ts.map +1 -0
- package/dist/i-convention-scope.js +1 -0
- package/dist/i-file-language.d.ts +11 -0
- package/dist/i-file-language.d.ts.map +1 -0
- package/dist/i-file-language.js +1 -0
- package/dist/i-not-applicable-convention.d.ts +17 -0
- package/dist/i-not-applicable-convention.d.ts.map +1 -0
- package/dist/i-not-applicable-convention.js +1 -0
- package/dist/i-reference-pack-origin.d.ts +13 -0
- package/dist/i-reference-pack-origin.d.ts.map +1 -0
- package/dist/i-reference-pack-origin.js +1 -0
- package/dist/i-stale-path-hint-input.d.ts +18 -0
- package/dist/i-stale-path-hint-input.d.ts.map +1 -0
- package/dist/i-stale-path-hint-input.js +1 -0
- package/dist/i-unverifiable-remedy-group.d.ts +10 -0
- package/dist/i-unverifiable-remedy-group.d.ts.map +1 -0
- package/dist/i-unverifiable-remedy-group.js +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -0
- package/dist/knowledge-authoring.d.ts +1 -1
- package/dist/knowledge-authoring.d.ts.map +1 -1
- package/dist/knowledge-authoring.js +7 -6
- package/dist/knowledge-contribution-slots.d.ts +18 -0
- package/dist/knowledge-contribution-slots.d.ts.map +1 -0
- package/dist/knowledge-contribution-slots.js +25 -0
- package/dist/knowledge-entry-rejections.d.ts +17 -0
- package/dist/knowledge-entry-rejections.d.ts.map +1 -0
- package/dist/knowledge-entry-rejections.js +79 -0
- package/dist/knowledge-entry-verdict-record.d.ts +12 -0
- package/dist/knowledge-entry-verdict-record.d.ts.map +1 -1
- package/dist/knowledge-min-referenced-valve.d.ts +12 -0
- package/dist/knowledge-min-referenced-valve.d.ts.map +1 -0
- package/dist/knowledge-min-referenced-valve.js +12 -0
- package/dist/knowledge-rejected-entry.d.ts +28 -0
- package/dist/knowledge-rejected-entry.d.ts.map +1 -0
- package/dist/knowledge-rejected-entry.js +1 -0
- package/dist/knowledge-rename-command.d.ts +20 -0
- package/dist/knowledge-rename-command.d.ts.map +1 -0
- package/dist/knowledge-rename-command.js +34 -0
- package/dist/knowledge-rename-verb.d.ts +11 -0
- package/dist/knowledge-rename-verb.d.ts.map +1 -0
- package/dist/knowledge-rename-verb.js +11 -0
- package/dist/knowledge-rename.d.ts +1 -1
- package/dist/knowledge-rename.d.ts.map +1 -1
- package/dist/knowledge-rename.js +6 -5
- package/dist/knowledge-stale-gate.d.ts +2 -0
- package/dist/knowledge-stale-gate.d.ts.map +1 -1
- package/dist/knowledge-stale-gate.js +75 -3
- package/dist/knowledge-stale-quality-gate.d.ts.map +1 -1
- package/dist/knowledge-stale-quality-gate.js +34 -4
- package/dist/knowledge-stale.d.ts +10 -0
- package/dist/knowledge-stale.d.ts.map +1 -1
- package/dist/knowledge-stale.js +227 -33
- package/dist/knowledge-unverifiable-remedy.d.ts +56 -0
- package/dist/knowledge-unverifiable-remedy.d.ts.map +1 -0
- package/dist/knowledge-unverifiable-remedy.js +0 -0
- package/dist/pack-contributions-inventory.d.ts.map +1 -1
- package/dist/pack-contributions-inventory.js +4 -2
- package/dist/propose-knowledge.js +3 -2
- package/dist/reference-pack-origin.d.ts +18 -0
- package/dist/reference-pack-origin.d.ts.map +1 -0
- package/dist/reference-pack-origin.js +38 -0
- package/dist/repository-stats.d.ts.map +1 -1
- package/dist/repository-stats.js +3 -77
- package/dist/resolve-project-config.d.ts.map +1 -1
- package/dist/resolve-project-config.js +10 -1
- 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 +76 -12
- package/dist/self-config-doctor.d.ts.map +1 -1
- package/dist/self-config-doctor.js +2 -1
- package/dist/sharkcraft-inspector.d.ts.map +1 -1
- package/dist/sharkcraft-inspector.js +52 -12
- package/dist/stale-path-hint.d.ts +3 -0
- package/dist/stale-path-hint.d.ts.map +1 -0
- package/dist/stale-path-hint.js +47 -0
- package/dist/template-authoring.d.ts +1 -1
- package/dist/template-authoring.d.ts.map +1 -1
- package/dist/template-authoring.js +2 -1
- package/dist/validate-contribution-file.d.ts.map +1 -1
- package/dist/validate-contribution-file.js +15 -10
- package/dist/why-file.d.ts.map +1 -1
- package/dist/why-file.js +5 -4
- package/package.json +17 -17
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as nodePath from 'node:path';
|
|
2
|
+
function origin(inspection, packageName, packageRoot) {
|
|
3
|
+
const rel = nodePath.relative(inspection.projectRoot, packageRoot).split(nodePath.sep).join('/');
|
|
4
|
+
return { packageName, packageRoot, displayRoot: rel === '' ? '.' : rel };
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The contributing pack of an asset whose provenance names it (`entrySources`
|
|
8
|
+
* / `boundarySources` → `{ type: 'pack', packageName }`), with its package
|
|
9
|
+
* directory from THE discovered pack list (`inspection.packs.validPacks`) —
|
|
10
|
+
* the directory the loaders read the pack's contribution files from. A name
|
|
11
|
+
* no valid pack carries has no directory: `undefined`.
|
|
12
|
+
*/
|
|
13
|
+
export function packOriginByName(inspection, packageName) {
|
|
14
|
+
if (!packageName)
|
|
15
|
+
return undefined;
|
|
16
|
+
const pack = (inspection.packs?.validPacks ?? []).find((p) => p.packageName === packageName);
|
|
17
|
+
return pack ? origin(inspection, pack.packageName, pack.packageRoot) : undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The contributing pack of an asset known only by its declaring FILE (a
|
|
21
|
+
* pack's policy check): the valid pack whose package directory contains it —
|
|
22
|
+
* the innermost one, so a pack nested in another pack's `node_modules`
|
|
23
|
+
* resolves to itself.
|
|
24
|
+
*/
|
|
25
|
+
export function packOriginOfFile(inspection, absFile) {
|
|
26
|
+
if (!absFile)
|
|
27
|
+
return undefined;
|
|
28
|
+
const file = nodePath.resolve(absFile);
|
|
29
|
+
let best;
|
|
30
|
+
for (const p of inspection.packs?.validPacks ?? []) {
|
|
31
|
+
const root = nodePath.resolve(p.packageRoot);
|
|
32
|
+
if (!file.startsWith(root + nodePath.sep))
|
|
33
|
+
continue;
|
|
34
|
+
if (!best || root.length > nodePath.resolve(best.packageRoot).length)
|
|
35
|
+
best = p;
|
|
36
|
+
}
|
|
37
|
+
return best ? origin(inspection, best.packageName, best.packageRoot) : undefined;
|
|
38
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository-stats.d.ts","sourceRoot":"","sources":["../src/repository-stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"repository-stats.d.ts","sourceRoot":"","sources":["../src/repository-stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAExE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,uBAAuB,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,UAAU,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAChD,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC7C,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAiKD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAAC,gBAAgB,CAAC,CA8G3B"}
|
package/dist/repository-stats.js
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
15
15
|
import * as nodePath from 'node:path';
|
|
16
|
+
import { CommentSyntax } from "./comment-syntax.js";
|
|
17
|
+
import { fileLanguageOf } from "./file-languages.js";
|
|
16
18
|
export const REPOSITORY_STATS_SCHEMA = 'sharkcraft.repository-stats/v1';
|
|
17
19
|
const IGNORED_DIR_NAMES = new Set([
|
|
18
20
|
'node_modules',
|
|
@@ -40,69 +42,6 @@ const IGNORED_DIR_NAMES = new Set([
|
|
|
40
42
|
'.gradle',
|
|
41
43
|
'.mvn',
|
|
42
44
|
]);
|
|
43
|
-
var CommentSyntax;
|
|
44
|
-
(function (CommentSyntax) {
|
|
45
|
-
CommentSyntax["CFamily"] = "c-family";
|
|
46
|
-
CommentSyntax["Hash"] = "hash";
|
|
47
|
-
CommentSyntax["Html"] = "html";
|
|
48
|
-
CommentSyntax["Sql"] = "sql";
|
|
49
|
-
CommentSyntax["Lua"] = "lua";
|
|
50
|
-
CommentSyntax["Lisp"] = "lisp";
|
|
51
|
-
CommentSyntax["None"] = "none";
|
|
52
|
-
})(CommentSyntax || (CommentSyntax = {}));
|
|
53
|
-
const LANGUAGES = [
|
|
54
|
-
{ id: 'typescript', extensions: ['.ts', '.tsx', '.mts', '.cts'], comment: CommentSyntax.CFamily },
|
|
55
|
-
{ id: 'javascript', extensions: ['.js', '.jsx', '.mjs', '.cjs'], comment: CommentSyntax.CFamily },
|
|
56
|
-
{ id: 'java', extensions: ['.java'], comment: CommentSyntax.CFamily },
|
|
57
|
-
{ id: 'kotlin', extensions: ['.kt', '.kts'], comment: CommentSyntax.CFamily },
|
|
58
|
-
{ id: 'scala', extensions: ['.scala'], comment: CommentSyntax.CFamily },
|
|
59
|
-
{ id: 'groovy', extensions: ['.groovy'], comment: CommentSyntax.CFamily },
|
|
60
|
-
{ id: 'csharp', extensions: ['.cs'], comment: CommentSyntax.CFamily },
|
|
61
|
-
{ id: 'cpp', extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'], comment: CommentSyntax.CFamily },
|
|
62
|
-
{ id: 'c', extensions: ['.c', '.h'], comment: CommentSyntax.CFamily },
|
|
63
|
-
{ id: 'go', extensions: ['.go'], comment: CommentSyntax.CFamily },
|
|
64
|
-
{ id: 'rust', extensions: ['.rs'], comment: CommentSyntax.CFamily },
|
|
65
|
-
{ id: 'swift', extensions: ['.swift'], comment: CommentSyntax.CFamily },
|
|
66
|
-
{ id: 'php', extensions: ['.php'], comment: CommentSyntax.CFamily },
|
|
67
|
-
{ id: 'dart', extensions: ['.dart'], comment: CommentSyntax.CFamily },
|
|
68
|
-
{ id: 'python', extensions: ['.py', '.pyi'], comment: CommentSyntax.Hash },
|
|
69
|
-
{ id: 'ruby', extensions: ['.rb'], comment: CommentSyntax.Hash },
|
|
70
|
-
{ id: 'shell', extensions: ['.sh', '.bash', '.zsh', '.fish'], comment: CommentSyntax.Hash },
|
|
71
|
-
{ id: 'perl', extensions: ['.pl', '.pm'], comment: CommentSyntax.Hash },
|
|
72
|
-
{ id: 'r', extensions: ['.r', '.R'], comment: CommentSyntax.Hash },
|
|
73
|
-
{ id: 'yaml', extensions: ['.yaml', '.yml'], comment: CommentSyntax.Hash },
|
|
74
|
-
{ id: 'toml', extensions: ['.toml'], comment: CommentSyntax.Hash },
|
|
75
|
-
{ id: 'ini', extensions: ['.ini', '.cfg', '.conf'], comment: CommentSyntax.Hash },
|
|
76
|
-
{ id: 'dockerfile', extensions: ['.dockerfile'], comment: CommentSyntax.Hash },
|
|
77
|
-
{ id: 'makefile', extensions: ['.mk'], comment: CommentSyntax.Hash },
|
|
78
|
-
{ id: 'html', extensions: ['.html', '.htm'], comment: CommentSyntax.Html },
|
|
79
|
-
{ id: 'xml', extensions: ['.xml', '.xsd', '.xsl'], comment: CommentSyntax.Html },
|
|
80
|
-
{ id: 'vue', extensions: ['.vue'], comment: CommentSyntax.Html },
|
|
81
|
-
{ id: 'svelte', extensions: ['.svelte'], comment: CommentSyntax.Html },
|
|
82
|
-
{ id: 'sql', extensions: ['.sql'], comment: CommentSyntax.Sql },
|
|
83
|
-
{ id: 'css', extensions: ['.css', '.scss', '.sass', '.less'], comment: CommentSyntax.CFamily },
|
|
84
|
-
{ id: 'lua', extensions: ['.lua'], comment: CommentSyntax.Lua },
|
|
85
|
-
{ id: 'elixir', extensions: ['.ex', '.exs'], comment: CommentSyntax.Hash },
|
|
86
|
-
{ id: 'clojure', extensions: ['.clj', '.cljs'], comment: CommentSyntax.Lisp },
|
|
87
|
-
{ id: 'lisp', extensions: ['.lisp', '.lsp', '.el'], comment: CommentSyntax.Lisp },
|
|
88
|
-
{ id: 'json', extensions: ['.json', '.jsonc'], comment: CommentSyntax.None },
|
|
89
|
-
{ id: 'markdown', extensions: ['.md', '.mdx'], comment: CommentSyntax.None },
|
|
90
|
-
{ id: 'text', extensions: ['.txt'], comment: CommentSyntax.None },
|
|
91
|
-
];
|
|
92
|
-
const EXTENSION_INDEX = (() => {
|
|
93
|
-
const m = new Map();
|
|
94
|
-
for (const def of LANGUAGES) {
|
|
95
|
-
for (const ext of def.extensions) {
|
|
96
|
-
m.set(ext.toLowerCase(), def);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return m;
|
|
100
|
-
})();
|
|
101
|
-
const BASENAME_OVERRIDES = new Map([
|
|
102
|
-
['dockerfile', 'dockerfile'],
|
|
103
|
-
['makefile', 'makefile'],
|
|
104
|
-
['gnumakefile', 'makefile'],
|
|
105
|
-
]);
|
|
106
45
|
function walkRepository(root, maxFiles) {
|
|
107
46
|
const out = [];
|
|
108
47
|
const stack = [root];
|
|
@@ -148,19 +87,6 @@ function walkRepository(root, maxFiles) {
|
|
|
148
87
|
}
|
|
149
88
|
return { files: out, truncated };
|
|
150
89
|
}
|
|
151
|
-
function classify(absPath) {
|
|
152
|
-
const base = nodePath.basename(absPath).toLowerCase();
|
|
153
|
-
const override = BASENAME_OVERRIDES.get(base);
|
|
154
|
-
if (override) {
|
|
155
|
-
const def = LANGUAGES.find((d) => d.id === override);
|
|
156
|
-
if (def)
|
|
157
|
-
return def;
|
|
158
|
-
}
|
|
159
|
-
const ext = nodePath.extname(absPath).toLowerCase();
|
|
160
|
-
if (!ext)
|
|
161
|
-
return null;
|
|
162
|
-
return EXTENSION_INDEX.get(ext) ?? null;
|
|
163
|
-
}
|
|
164
90
|
function countLines(text, syntax) {
|
|
165
91
|
if (text.length === 0)
|
|
166
92
|
return { total: 0, code: 0, comment: 0, blank: 0 };
|
|
@@ -235,7 +161,7 @@ export async function buildRepositoryStats(opts) {
|
|
|
235
161
|
const accs = new Map();
|
|
236
162
|
const allFiles = [];
|
|
237
163
|
for (const abs of walk.files) {
|
|
238
|
-
const def =
|
|
164
|
+
const def = fileLanguageOf(abs);
|
|
239
165
|
if (!def)
|
|
240
166
|
continue;
|
|
241
167
|
if (filter && def.id !== filter)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-project-config.d.ts","sourceRoot":"","sources":["../src/resolve-project-config.ts"],"names":[],"mappings":"AA8BA,OAAO,EAQL,KAAK,QAAQ,EASb,KAAK,MAAM,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAYL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAqBvF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,OAAO,CAE5E;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D;;;;;;OAMG;IACH,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE;QACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,0BAA0B,EAAE,CAAC;QACzD,QAAQ,CAAC,QAAQ,EAAE,SAAS,2BAA2B,EAAE,CAAC;QAC1D,QAAQ,CAAC,YAAY,EAAE,SAAS;YAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;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AE,QAAQ,CAAC,CAAC,CAkLnD"}
|
|
@@ -81,7 +81,9 @@ export function planeElementRejectionReasons(schema, raw) {
|
|
|
81
81
|
* LOCAL array (keyed by `keyOf`), then folds in pack elements only when their
|
|
82
82
|
* key is free. Missing files, non-array default exports, schema-invalid
|
|
83
83
|
* elements, and key collisions all become diagnostics and are skipped — never a
|
|
84
|
-
* throw.
|
|
84
|
+
* throw. A file that failed to import or whose default export is not an array
|
|
85
|
+
* is also a load failure (its rules are unknown); a refused element is a
|
|
86
|
+
* rejection.
|
|
85
87
|
*/
|
|
86
88
|
async function mergePlane(localArr, packContribs, schema, keyOf, planeLabel, diagnostics,
|
|
87
89
|
/** Where the structured outcome is recorded — absent for a plane with no manifest slot. */
|
|
@@ -126,6 +128,13 @@ packGuard) {
|
|
|
126
128
|
const arr = mod.default;
|
|
127
129
|
if (!Array.isArray(arr)) {
|
|
128
130
|
diagnostics.push(`pack ${contrib.packageName}: ${planeLabel} file ${contrib.rel} default export is not an array — skipped`);
|
|
131
|
+
// Its rules are unknown, exactly as for a file that failed to import: one
|
|
132
|
+
// load failure, so every plane reader shows an ERRORED row and `packs
|
|
133
|
+
// contributions` counts it. It was a diagnostic line only, and `gates
|
|
134
|
+
// check` / `policy-lint` printed ✓ at exit 0 over a pack rule file none of
|
|
135
|
+
// whose rules ran (round 15 lane B review; `packs test --load` already
|
|
136
|
+
// refused the file with this message).
|
|
137
|
+
sink.loadFailures.push({ file: full, kind, packageName: contrib.packageName, message: 'default export is not an array' });
|
|
129
138
|
continue;
|
|
130
139
|
}
|
|
131
140
|
arr.forEach((raw, index) => {
|
|
@@ -29,7 +29,7 @@ export declare enum SelfConfigSeverityV2 {
|
|
|
29
29
|
* id resolver / THE key resolver answered. Only `selfKindOf(undefined)`
|
|
30
30
|
* produces it (a source lock holds that; round 12, 12.4).
|
|
31
31
|
*/
|
|
32
|
-
export type SelfConfigKind = 'knowledge' | 'command' | 'helper' | 'template' | 'playbook' | 'pipeline' | 'policy' | 'rule' | 'path' | 'convention' | 'registration-hint' | 'routing-hint' | 'agent-test' | 'decision' | 'construct' | 'preset' | 'migration-profile' | 'workspace-profile' | 'contract-template' | 'pack' | 'schema' | 'file' | 'directory' | 'symbol' | 'package' | 'url' | 'path-convention' | 'boundary-rule' | 'scaffold-pattern' | 'search-tuning' | 'search-document' | 'self-config' | 'construct-facet' | 'feedback-rule' | 'context-test' | 'docs' | 'delegate-recipe' | 'framework-extractor' | 'wiring-rule' | 'registry' | 'registration-idiom' | 'policy-rule' | 'reuse-primitive' | 'baseline' | 'generated-artifact' | 'doc-reference' | 'unknown';
|
|
32
|
+
export type SelfConfigKind = 'framework' | 'language' | 'knowledge' | 'command' | 'helper' | 'template' | 'playbook' | 'pipeline' | 'policy' | 'rule' | 'path' | 'convention' | 'registration-hint' | 'routing-hint' | 'agent-test' | 'decision' | 'construct' | 'preset' | 'migration-profile' | 'workspace-profile' | 'contract-template' | 'pack' | 'schema' | 'file' | 'directory' | 'symbol' | 'package' | 'url' | 'path-convention' | 'boundary-rule' | 'scaffold-pattern' | 'search-tuning' | 'search-document' | 'self-config' | 'construct-facet' | 'feedback-rule' | 'context-test' | 'docs' | 'delegate-recipe' | 'framework-extractor' | 'wiring-rule' | 'registry' | 'registration-idiom' | 'policy-rule' | 'reuse-primitive' | 'baseline' | 'generated-artifact' | 'doc-reference' | 'unknown';
|
|
33
33
|
/**
|
|
34
34
|
* Edge relation taxonomy. Open string to allow future relations.
|
|
35
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-config-doctor-v2.d.ts","sourceRoot":"","sources":["../src/self-config-doctor-v2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"self-config-doctor-v2.d.ts","sourceRoot":"","sources":["../src/self-config-doctor-v2.ts"],"names":[],"mappings":"AAoBA,OAAO,EAIL,cAAc,EAMd,KAAK,aAAa,EAEnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAA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17
17
|
*/
|
|
18
18
|
import { existsSync } from 'node:fs';
|
|
19
19
|
import * as nodePath from 'node:path';
|
|
20
|
+
import { knowledgeReferences } from '@shrkcrft/knowledge';
|
|
20
21
|
import { coverageShortfall, DEAD_SELECTOR_CAUSES, formatCoverage, RejectionCause, settleUnitLiveness, UnitDeadCause, UnitDeadWeight, UnitLivenessState, } from '@shrkcrft/core';
|
|
21
22
|
import { searchTuningKeyProbes } from "./search-tuning-key-probes.js";
|
|
22
23
|
import { ContributionKind } from "./contribution-kind.js";
|
|
23
|
-
import { resolveEntryFile } from "./contribution-load-failures.js";
|
|
24
|
+
import { MARKDOWN_FILE_SLOT, rejectedEntrySlot, resolveEntryFile } from "./contribution-load-failures.js";
|
|
24
25
|
import { UnresolvableReason } from "./unresolvable-reason.js";
|
|
25
26
|
import { listTaskRoutingHintIssues, loadTaskRoutingHints, listTaskRoutingHints, routingHintCanMatch, } from "./task-routing-hint-registry.js";
|
|
26
27
|
import { buildRegistrationHintDoctorReport, listRegistrationHints } from "./registration-hint-registry.js";
|
|
@@ -31,6 +32,8 @@ import { formatReferenceKindDeclaration, isReferenceKindDeclarable, referenceKin
|
|
|
31
32
|
import { PROBED_ID_FIELDS } from "./probed-id-fields.js";
|
|
32
33
|
import { ProbedIdSource } from "./probed-id-source.js";
|
|
33
34
|
import { listConventions } from "./convention-registry.js";
|
|
35
|
+
import { isFrameworkId, listFrameworkIds } from '@shrkcrft/workspace';
|
|
36
|
+
import { fileLanguageForExtension, fileLanguageIds } from "./file-languages.js";
|
|
34
37
|
import { ROUTING_RECOMMENDS_CHANNEL_KEYS, ROUTING_RECOMMENDS_CHANNELS, } from "./routing-recommends-channels.js";
|
|
35
38
|
import { doctorScaffoldPatterns, enumerateScaffoldPatternCandidates, loadScaffoldPatternsFromInspection, scaffoldPatternCoverage, } from "./scaffold-patterns.js";
|
|
36
39
|
import { lintSearchTuning } from "./search-tuning-lint.js";
|
|
@@ -336,17 +339,23 @@ function idProbeCoverage(subject, unit, probe) {
|
|
|
336
339
|
unit,
|
|
337
340
|
expected: probe.probed,
|
|
338
341
|
examined: probe.probed - probe.unverified,
|
|
342
|
+
// The empty-registry reason explains a GAP, so it rides only with one
|
|
343
|
+
// (round 15): a fully examined record printed "could not be checked
|
|
344
|
+
// (their kind's registry is empty …)" beside examined === expected.
|
|
339
345
|
...(probe.unverified > 0
|
|
340
|
-
? {
|
|
346
|
+
? {
|
|
347
|
+
unexamined: probe.unverifiedLabels.slice(0, 20),
|
|
348
|
+
unexaminedTotal: probe.unverified,
|
|
349
|
+
reason: emptyRegistryReason(probe),
|
|
350
|
+
}
|
|
341
351
|
: {}),
|
|
342
|
-
reason: emptyRegistryReason(probe),
|
|
343
352
|
},
|
|
344
353
|
];
|
|
345
354
|
}
|
|
346
355
|
// ─── 1. Knowledge → file references ───────────────────────────────────────
|
|
347
356
|
function checkKnowledgeFileRefs(inspection, findings) {
|
|
348
357
|
for (const k of inspection.knowledgeEntries) {
|
|
349
|
-
for (const ref of k
|
|
358
|
+
for (const ref of knowledgeReferences(k)) {
|
|
350
359
|
if (ref.kind !== 'file' || !ref.path)
|
|
351
360
|
continue;
|
|
352
361
|
const abs = nodePath.isAbsolute(ref.path)
|
|
@@ -930,12 +939,63 @@ async function probeRegistrationHintIds(inspection, findings) {
|
|
|
930
939
|
return { coverage: idProbeCoverage('registration hints', 'related ids', probe), deadUnits: [], refProbe: probe };
|
|
931
940
|
}
|
|
932
941
|
// ─── 8b. Conventions → applicability profile ids ──────────────────────────
|
|
942
|
+
/**
|
|
943
|
+
* The two builtin vocabularies a convention's `appliesTo` names without a
|
|
944
|
+
* reference kind (round 15, 15.1): `frameworks` → THE `FrameworkId` list
|
|
945
|
+
* (`@shrkcrft/workspace`), `languages` → THE file-language table (the `shrk
|
|
946
|
+
* stats` vocabulary). Neither is ever empty, so a miss is a real miss — an
|
|
947
|
+
* info `convention-<framework|language>-missing` finding with a did-you-mean,
|
|
948
|
+
* like `convention-profile-missing`: that value can never match.
|
|
949
|
+
*/
|
|
950
|
+
function checkConventionVocabularies(e, findings) {
|
|
951
|
+
const frameworks = listFrameworkIds();
|
|
952
|
+
for (const id of readIdList(e.convention, 'appliesTo.frameworks') ?? []) {
|
|
953
|
+
if (typeof id !== 'string' || id.length === 0 || isFrameworkId(id))
|
|
954
|
+
continue;
|
|
955
|
+
const nearest = nearestIds(id, frameworks, 1)[0]?.id;
|
|
956
|
+
pushFinding(findings, {
|
|
957
|
+
severity: SelfConfigSeverityV2.Info,
|
|
958
|
+
code: 'convention-framework-missing',
|
|
959
|
+
sourceKind: 'convention',
|
|
960
|
+
sourceId: e.convention.id,
|
|
961
|
+
targetKind: 'framework',
|
|
962
|
+
targetId: id,
|
|
963
|
+
relation: 'related',
|
|
964
|
+
file: e.sourceFile,
|
|
965
|
+
message: `Convention "${e.convention.id}" appliesTo.frameworks names framework "${id}", which is not a framework id the detector reports (${frameworks.join(', ')}) — that value can never match.`,
|
|
966
|
+
...(nearest ? { suggestedFix: `Did you mean "${nearest}"?` } : {}),
|
|
967
|
+
nextCommand: 'shrk inspect',
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
const languages = fileLanguageIds();
|
|
971
|
+
for (const id of readIdList(e.convention, 'appliesTo.languages') ?? []) {
|
|
972
|
+
if (typeof id !== 'string' || id.length === 0 || languages.includes(id))
|
|
973
|
+
continue;
|
|
974
|
+
// `ts` is an extension, not a language — name the language that owns it.
|
|
975
|
+
const nearest = fileLanguageForExtension(id)?.id ?? nearestIds(id, languages, 1)[0]?.id;
|
|
976
|
+
pushFinding(findings, {
|
|
977
|
+
severity: SelfConfigSeverityV2.Info,
|
|
978
|
+
code: 'convention-language-missing',
|
|
979
|
+
sourceKind: 'convention',
|
|
980
|
+
sourceId: e.convention.id,
|
|
981
|
+
targetKind: 'language',
|
|
982
|
+
targetId: id,
|
|
983
|
+
relation: 'related',
|
|
984
|
+
file: e.sourceFile,
|
|
985
|
+
message: `Convention "${e.convention.id}" appliesTo.languages names language "${id}", which is not a language id (the \`shrk stats\` vocabulary, by file extension) — that value can never match.`,
|
|
986
|
+
...(nearest ? { suggestedFix: `Did you mean "${nearest}"?` } : {}),
|
|
987
|
+
nextCommand: 'shrk stats',
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
}
|
|
933
991
|
/**
|
|
934
992
|
* A convention's `appliesTo` id fields, per THE binding table — today
|
|
935
|
-
* `appliesTo.profileIds` → `workspace-profile
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
993
|
+
* `appliesTo.profileIds` → `workspace-profile` — plus the framework and
|
|
994
|
+
* language vocabularies ({@link checkConventionVocabularies}). Round 15: these
|
|
995
|
+
* filters now SCOPE `conventions check` (`conventionApplicability`), so a
|
|
996
|
+
* value that resolves nowhere is a filter that can never match; this family
|
|
997
|
+
* names it. Applicability itself (detected or not) is not a doctor finding —
|
|
998
|
+
* `conventions check` prints a not-applicable convention with its reason.
|
|
939
999
|
*/
|
|
940
1000
|
async function checkConventionApplicability(inspection, findings) {
|
|
941
1001
|
let entries;
|
|
@@ -970,6 +1030,7 @@ async function checkConventionApplicability(inspection, findings) {
|
|
|
970
1030
|
packageName: e.packageName,
|
|
971
1031
|
});
|
|
972
1032
|
}
|
|
1033
|
+
checkConventionVocabularies(e, findings);
|
|
973
1034
|
}
|
|
974
1035
|
return {
|
|
975
1036
|
coverage: idProbeCoverage('conventions', 'applicability profile ids', probe),
|
|
@@ -1251,14 +1312,17 @@ async function checkPackConflicts(inspection, findings) {
|
|
|
1251
1312
|
function checkContributionRejections(findings, rejections) {
|
|
1252
1313
|
for (const r of rejections) {
|
|
1253
1314
|
const f = rejectionFindingOf(r.kind, r.cause);
|
|
1254
|
-
|
|
1255
|
-
|
|
1315
|
+
// THE slot label (round 15 closing, A5): a whole Markdown document reads
|
|
1316
|
+
// `(Markdown file)` — it read `decision at default in <file>.md (default)`.
|
|
1317
|
+
const where = rejectedEntrySlot(r);
|
|
1318
|
+
const markdownFile = where === MARKDOWN_FILE_SLOT;
|
|
1319
|
+
const who = r.entryId !== undefined ? `"${r.entryId}"` : markdownFile ? '(no id)' : `at ${where}`;
|
|
1256
1320
|
for (const reason of r.reasons) {
|
|
1257
1321
|
pushFinding(findings, {
|
|
1258
1322
|
severity: SelfConfigSeverityV2.Error,
|
|
1259
1323
|
code: f.code,
|
|
1260
1324
|
sourceKind: f.kind,
|
|
1261
|
-
sourceId: r.entryId ?? `${r.file}:${where}
|
|
1325
|
+
sourceId: r.entryId ?? (markdownFile ? r.file : `${r.file}:${where}`),
|
|
1262
1326
|
targetKind: 'schema',
|
|
1263
1327
|
targetId: validatorField(reason),
|
|
1264
1328
|
relation: 'validates',
|
|
@@ -1378,7 +1442,7 @@ async function collectCommandSites(inspection) {
|
|
|
1378
1442
|
for (const k of inspection.knowledgeEntries) {
|
|
1379
1443
|
const origin = k.source?.origin ?? undefined;
|
|
1380
1444
|
add('knowledge', k.id, 'actionHints.commands', k.actionHints?.commands, W, 'references', origin);
|
|
1381
|
-
const refCommands = (k
|
|
1445
|
+
const refCommands = knowledgeReferences(k)
|
|
1382
1446
|
.filter((r) => r.kind === 'command')
|
|
1383
1447
|
.map((r) => r.id ?? r.command)
|
|
1384
1448
|
.filter((c) => typeof c === 'string' && c.length > 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"self-config-doctor.d.ts","sourceRoot":"","sources":["../src/self-config-doctor.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"self-config-doctor.d.ts","sourceRoot":"","sources":["../src/self-config-doctor.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAMvE,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM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AW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,EAAE,EAAE,oBAAoB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAChD,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACvD;AAuDD,6EAA6E;AAC7E,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,yBAAyB,GAAG,uBAAuB,CAYxG;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAElC;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAuC3B;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CA0BlF;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAoBtF"}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { existsSync } from 'node:fs';
|
|
20
20
|
import * as nodePath from 'node:path';
|
|
21
|
+
import { knowledgeReferences } from '@shrkcrft/knowledge';
|
|
21
22
|
import { referenceIdsFor, warmReferenceRegistries, } from "./reference-registry.js";
|
|
22
23
|
import { buildSelfConfigDoctorReportV2, } from "./self-config-doctor-v2.js";
|
|
23
24
|
export const SELF_CONFIG_DOCTOR_SCHEMA = 'sharkcraft.self-config-doctor/v1';
|
|
@@ -108,7 +109,7 @@ export async function buildSelfConfigGraph(inspection) {
|
|
|
108
109
|
nodes.push({ id, kind: 'migration-profile' });
|
|
109
110
|
// Edges from knowledge → referenced ids (best-effort).
|
|
110
111
|
for (const k of inspection.knowledgeEntries) {
|
|
111
|
-
for (const ref of k
|
|
112
|
+
for (const ref of knowledgeReferences(k)) {
|
|
112
113
|
const refId = ref.path ?? '';
|
|
113
114
|
if (!refId)
|
|
114
115
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharkcraft-inspector.d.ts","sourceRoot":"","sources":["../src/sharkcraft-inspector.ts"],"names":[],"mappings":"AAWA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAKL,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,cAAc,EAIf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,mBAAmB,EAAyB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,KAAK,mBAAmB,EAAyB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAwC,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAA6B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"sharkcraft-inspector.d.ts","sourceR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} from '@shrkcrft/packs';
|
|
|
23
23
|
import { BUILTIN_PRESETS, loadPresetsFromFile, PresetRegistry } from '@shrkcrft/presets';
|
|
24
24
|
import { BoundaryRegistry, loadBoundaryRulesFromFile } from '@shrkcrft/boundaries';
|
|
25
25
|
import { DoctorSeverity } from "./doctor-result.js";
|
|
26
|
+
import { knowledgeRejectedEntries } from "./knowledge-entry-rejections.js";
|
|
26
27
|
import { registryLifecycleSkipDirsWarning, resolveRegistryLifecycleSkipDirs, } from "./registry-lifecycle.js";
|
|
27
28
|
import { diagnoseActionHints } from "./action-hint-diagnostics.js";
|
|
28
29
|
import { buildCodeIntelligenceChecks, } from "./code-intelligence-doctor.js";
|
|
@@ -516,7 +517,10 @@ export async function inspectSharkcraft(options = {}) {
|
|
|
516
517
|
warnings.push(`pack ${invalid.packageName}@${invalid.packageVersion}: ${invalid.loadError ??
|
|
517
518
|
(invalid.validationIssues.map((i) => `${i.field}: ${i.message}`).join('; ') || 'invalid manifest')}`);
|
|
518
519
|
}
|
|
519
|
-
|
|
520
|
+
// The provenance `root: pack` needs (round 15 follow-up): only a pack's entry has a pack directory.
|
|
521
|
+
const validation = validateKnowledgeEntries(knowledgeEntries, {
|
|
522
|
+
isPackContributed: (e) => entrySources.get(e.id)?.type === 'pack',
|
|
523
|
+
});
|
|
520
524
|
const cleanEntries = validation.uniqueEntries;
|
|
521
525
|
const index = new KnowledgeIndex(cleanEntries);
|
|
522
526
|
const ruleService = new RuleService(cleanEntries);
|
|
@@ -1004,6 +1008,26 @@ export function runDoctor(inspection, options = {}) {
|
|
|
1004
1008
|
fix: v.source ? `Edit ${v.source}` : undefined,
|
|
1005
1009
|
});
|
|
1006
1010
|
}
|
|
1011
|
+
// Round 15 follow-up (F3): a knowledge entry its loader REFUSED never reached
|
|
1012
|
+
// the corpus, so this doctor's "N entries loaded" and "Ready ✓" stood over it
|
|
1013
|
+
// (only `self-config doctor` said so). Named here, and counted UNEXAMINED in
|
|
1014
|
+
// the coverage below — THE list the stale-check and quality read too.
|
|
1015
|
+
const refusedKnowledge = knowledgeRejectedEntries(inspection);
|
|
1016
|
+
for (const r of refusedKnowledge) {
|
|
1017
|
+
checks.push({
|
|
1018
|
+
id: `knowledge-rejected-${r.label}`,
|
|
1019
|
+
title: `Knowledge entry rejected at load (${r.kind})`,
|
|
1020
|
+
severity: DoctorSeverity.Warning,
|
|
1021
|
+
category: 'asset-load-failed',
|
|
1022
|
+
code: 'knowledge-entry-rejected',
|
|
1023
|
+
// The id (a label may carry the declaration site too), then the site once.
|
|
1024
|
+
message: `${r.entryId ?? 'an entry with no id'} in ${r.source}${r.at !== undefined ? ` (${r.at})` : ''}${r.pack !== undefined ? ` — pack ${r.pack}` : ''}: ${r.message}`,
|
|
1025
|
+
fix: r.pack !== undefined
|
|
1026
|
+
? `Fix it upstream in pack ${r.pack} — \`shrk packs test <pack-dir> --load\` names every refused entry.`
|
|
1027
|
+
: `Fix the entry in ${r.source} — \`shrk self-config doctor\` lists every refused entry.`,
|
|
1028
|
+
whyThisMatters: 'A refused entry never reaches the corpus: an agent never sees it, and `knowledge stale-check` never checks what it claims.',
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1007
1031
|
// Surface profile drift advisory. Warn (advisory) when the
|
|
1008
1032
|
// configured `surface.profile` no longer matches what the workspace
|
|
1009
1033
|
// shape suggests today, so the user knows to re-run init or override.
|
|
@@ -1087,17 +1111,33 @@ export function runDoctor(inspection, options = {}) {
|
|
|
1087
1111
|
.filter((f) => f.build.state === 'unrecorded')
|
|
1088
1112
|
.map((f) => f.packageName)
|
|
1089
1113
|
.sort();
|
|
1090
|
-
const coverage =
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1114
|
+
const coverage = [
|
|
1115
|
+
...(unrecordedBuilds.length > 0
|
|
1116
|
+
? [
|
|
1117
|
+
{
|
|
1118
|
+
unit: 'compiled pack builds',
|
|
1119
|
+
expected: compiledBuilds.length,
|
|
1120
|
+
examined: compiledBuilds.length - unrecordedBuilds.length,
|
|
1121
|
+
unexamined: unrecordedBuilds,
|
|
1122
|
+
reason: 'no build record, so the compiled artifacts they serve were never compared with their source (rebuild the pack to record one)',
|
|
1123
|
+
},
|
|
1124
|
+
]
|
|
1125
|
+
: []),
|
|
1126
|
+
// Round 15 follow-up (F3): refused knowledge entries were declared and never
|
|
1127
|
+
// checked — the run settles NOT VERIFIED (2) over them, never "Ready ✓".
|
|
1128
|
+
...(refusedKnowledge.length > 0
|
|
1129
|
+
? [
|
|
1130
|
+
{
|
|
1131
|
+
unit: 'knowledge entries',
|
|
1132
|
+
expected: inspection.knowledgeEntries.length + refusedKnowledge.length,
|
|
1133
|
+
examined: inspection.knowledgeEntries.length,
|
|
1134
|
+
unexamined: refusedKnowledge.slice(0, 20).map((r) => r.label),
|
|
1135
|
+
unexaminedTotal: refusedKnowledge.length,
|
|
1136
|
+
reason: 'rejected at load — not checked (their loader refused them; fix each entry)',
|
|
1137
|
+
},
|
|
1138
|
+
]
|
|
1139
|
+
: []),
|
|
1140
|
+
];
|
|
1101
1141
|
return { passed: summary.errors === 0, checks, summary, ...(coverage.length > 0 ? { coverage } : {}) };
|
|
1102
1142
|
}
|
|
1103
1143
|
function actionHintWhyThisMatters(code) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-path-hint.d.ts","sourceRoot":"","sources":["../src/stale-path-hint.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAIxE,wBAAgB,aAAa,CAAC,CAAC,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAwBxE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE hint for a reference whose path is missing (round 15 closing, A3) — the
|
|
3
|
+
* stale-check row's `suggestion`, and through it the gate violation's hint,
|
|
4
|
+
* the fix preview's draft and the MCP report. It branches on who can fix the
|
|
5
|
+
* reference:
|
|
6
|
+
*
|
|
7
|
+
* - a pack's reference is fixed in the pack: a `root: pack` path missing
|
|
8
|
+
* from the pack is shipped (or fixed) there; a project-rooted path the pack
|
|
9
|
+
* DOES ship names `root: pack`;
|
|
10
|
+
* - a Markdown entry's reference is edited in its `references:` frontmatter —
|
|
11
|
+
* `shrk fix --knowledge-stale --apply`, which lands a `shrk knowledge
|
|
12
|
+
* rename-file` plan, edits TypeScript entries only;
|
|
13
|
+
* - anything else gets the restore-or-rename hint.
|
|
14
|
+
*
|
|
15
|
+
* It used to be three string forks — the generic hint set where the path was
|
|
16
|
+
* checked, two pack overrides layered on after — and a Markdown entry was told
|
|
17
|
+
* to preview a rename that `--apply` then refuses to land.
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync } from 'node:fs';
|
|
20
|
+
import * as nodePath from 'node:path';
|
|
21
|
+
import { KnowledgeSourceFormat } from '@shrkcrft/knowledge';
|
|
22
|
+
import { knowledgeRenameCommand } from "./knowledge-rename-command.js";
|
|
23
|
+
import { KnowledgeRenameVerb } from "./knowledge-rename-verb.js";
|
|
24
|
+
export function stalePathHint(h) {
|
|
25
|
+
if (h.pack !== undefined) {
|
|
26
|
+
if (h.packRooted) {
|
|
27
|
+
return `The path is missing from pack ${h.pack.packageName} (${h.pack.displayRoot}) — ship the file, or fix the reference, in the pack.`;
|
|
28
|
+
}
|
|
29
|
+
return existsSync(nodePath.join(h.pack.packageRoot, h.path))
|
|
30
|
+
? `${h.path} is shipped inside pack ${h.pack.packageName} (${h.pack.displayRoot}/${h.path}), but a pack's path resolves against the consuming project's root — declare root: pack on this reference, in the pack, to resolve it against the pack's directory.`
|
|
31
|
+
: `A pack's path resolves against the consuming project's root, not against pack ${h.pack.packageName}'s directory — declare root: pack for a file the pack ships; fix the reference in the pack.`;
|
|
32
|
+
}
|
|
33
|
+
const what = h.kind === 'directory' ? 'directory' : 'file';
|
|
34
|
+
if (h.sourceFormat === KnowledgeSourceFormat.Markdown) {
|
|
35
|
+
return (`Restore the ${what}, or edit this reference's path in the references: frontmatter of ${h.source ?? 'its Markdown file'} — ` +
|
|
36
|
+
'`shrk fix --knowledge-stale --apply` (which lands a `shrk knowledge rename-file` plan) edits TypeScript entries only.');
|
|
37
|
+
}
|
|
38
|
+
// `rename-file` is a read-only preview already — it takes no `--dry-run`,
|
|
39
|
+
// and the dispatcher refuses the flag (round 15 follow-up, F4). Built by THE
|
|
40
|
+
// rename-command helper, the missing path filled in (lane B, B1).
|
|
41
|
+
if (h.kind === 'file') {
|
|
42
|
+
return `Restore the file, or preview the rename with \`${knowledgeRenameCommand(KnowledgeRenameVerb.RenameFile, h.path)}\`.`;
|
|
43
|
+
}
|
|
44
|
+
if (h.kind === 'directory')
|
|
45
|
+
return 'Move the directory or update the knowledge reference.';
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* `packages/cli/src/commands/templates.command.ts`.
|
|
19
19
|
*/
|
|
20
20
|
import type { ITemplateDefinition } from '@shrkcrft/templates';
|
|
21
|
-
import type
|
|
21
|
+
import { type IKnowledgeEntry } from '@shrkcrft/knowledge';
|
|
22
22
|
import type { IPipelineDefinition } from '@shrkcrft/pipelines';
|
|
23
23
|
import type { IPreset } from '@shrkcrft/presets';
|
|
24
24
|
export declare const TEMPLATE_AUTHORING_SCHEMA = "sharkcraft.template-authoring/v1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-authoring.d.ts","sourceRoot":"","sources":["../src/template-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"template-authoring.d.ts","sourceRoot":"","sources":["../src/template-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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