@shrkcrft/inspector 0.1.0-alpha.7 → 0.1.0-alpha.9
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/README.md +1 -1
- package/dist/adoption-state.js +1 -1
- package/dist/area-map.d.ts +14 -0
- package/dist/area-map.d.ts.map +1 -1
- package/dist/area-map.js +17 -0
- package/dist/ci-permissions-fix.d.ts +1 -1
- package/dist/ci-permissions-fix.d.ts.map +1 -1
- package/dist/ci-permissions-fix.js +182 -1
- package/dist/construct-adoption-diff.d.ts.map +1 -1
- package/dist/construct-adoption-diff.js +1 -2
- package/dist/construct-adoption.d.ts.map +1 -1
- package/dist/construct-adoption.js +10 -2
- package/dist/construct-inference.d.ts.map +1 -1
- package/dist/construct-inference.js +1 -2
- package/dist/construct-registry.d.ts.map +1 -1
- package/dist/construct-registry.js +10 -2
- package/dist/contract-template-registry.d.ts.map +1 -1
- package/dist/contract-template-registry.js +10 -2
- package/dist/convention-registry.d.ts.map +1 -1
- package/dist/convention-registry.js +10 -2
- package/dist/decision-records.d.ts.map +1 -1
- package/dist/decision-records.js +9 -2
- package/dist/feedback-ingestion.js +10 -2
- package/dist/git-helpers.d.ts +12 -0
- package/dist/git-helpers.d.ts.map +1 -1
- package/dist/git-helpers.js +63 -0
- package/dist/impact-render.d.ts.map +1 -1
- package/dist/impact-render.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/ingest-drafts.js +4 -8
- package/dist/migration-profile-registry.d.ts.map +1 -1
- package/dist/migration-profile-registry.js +10 -2
- package/dist/onboarding-drafts-merge.d.ts +71 -0
- package/dist/onboarding-drafts-merge.d.ts.map +1 -0
- package/dist/onboarding-drafts-merge.js +174 -0
- package/dist/onboarding-drafts.d.ts +14 -0
- package/dist/onboarding-drafts.d.ts.map +1 -1
- package/dist/onboarding-drafts.js +39 -5
- package/dist/ownership.js +10 -2
- package/dist/pack-helper-registry.d.ts.map +1 -1
- package/dist/pack-helper-registry.js +10 -2
- package/dist/pack-release-check.d.ts.map +1 -1
- package/dist/pack-release-check.js +10 -3
- package/dist/pack-symbol-compat.d.ts +17 -4
- package/dist/pack-symbol-compat.d.ts.map +1 -1
- package/dist/pack-symbol-compat.js +155 -7
- package/dist/pack-test-runner.js +10 -2
- package/dist/playbook-registry.d.ts.map +1 -1
- package/dist/playbook-registry.js +10 -2
- package/dist/plugin-lifecycle-profile-registry.d.ts.map +1 -1
- package/dist/plugin-lifecycle-profile-registry.js +10 -2
- package/dist/policy-engine.d.ts.map +1 -1
- package/dist/policy-engine.js +11 -3
- package/dist/policy-test.js +11 -3
- package/dist/product-coherence.js +5 -5
- package/dist/registration-hint-registry.d.ts.map +1 -1
- package/dist/registration-hint-registry.js +10 -2
- package/dist/release-readiness.js +2 -2
- package/dist/review-packet-v2.d.ts.map +1 -1
- package/dist/review-packet-v2.js +13 -3
- package/dist/rule-scaffold.d.ts.map +1 -1
- package/dist/rule-scaffold.js +4 -12
- package/dist/scaffold-patterns.js +10 -2
- package/dist/search-tuning-registry.d.ts.map +1 -1
- package/dist/search-tuning-registry.js +10 -2
- package/dist/sharkcraft-inspector.d.ts.map +1 -1
- package/dist/sharkcraft-inspector.js +0 -1
- package/dist/task-routing-hint-registry.d.ts.map +1 -1
- package/dist/task-routing-hint-registry.js +10 -2
- package/dist/test-runner.d.ts.map +1 -1
- package/dist/test-runner.js +11 -3
- package/dist/upgrade-advisor.js +1 -1
- package/package.json +21 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-release-check.d.ts","sourceRoot":"","sources":["../src/pack-release-check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack-release-check.d.ts","sourceRoot":"","sources":["../src/pack-release-check.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,yBAAyB,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACzC,MAAM,EAAE,OAAO,CAAC;CACjB;AA6ED,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAgLtF"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
3
11
|
import { validatePackManifest } from '@shrkcrft/plugin-api';
|
|
4
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
5
12
|
export const PACK_RELEASE_CHECK_SCHEMA = 'sharkcraft.pack-release-check/v1';
|
|
6
13
|
function findManifest(packPath) {
|
|
7
14
|
const pkgFile = nodePath.join(packPath, 'package.json');
|
|
@@ -26,7 +33,7 @@ async function loadManifest(file) {
|
|
|
26
33
|
return JSON.parse(readFileSync(file, 'utf8'));
|
|
27
34
|
}
|
|
28
35
|
const { pathToFileURL } = await import('node:url');
|
|
29
|
-
const mod = (await
|
|
36
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
30
37
|
return mod.default ?? mod.manifest ?? null;
|
|
31
38
|
}
|
|
32
39
|
catch {
|
|
@@ -199,7 +206,7 @@ export async function runPackReleaseCheck(packPath) {
|
|
|
199
206
|
if (/\.(ts|js|mjs|cjs)$/.test(rel)) {
|
|
200
207
|
try {
|
|
201
208
|
const { pathToFileURL } = await import('node:url');
|
|
202
|
-
await
|
|
209
|
+
await import(__rewriteRelativeImportExtension(pathToFileURL(full).href));
|
|
203
210
|
}
|
|
204
211
|
catch (e) {
|
|
205
212
|
const message = e.message;
|
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
* and reports which symbols the pack uses that the consumer's plugin-api
|
|
7
7
|
* does not export.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Default mode (`'ts'`) walks ESM exports with the TypeScript compiler
|
|
10
|
+
* API — multi-line export blocks, multi-declarator `export const`,
|
|
11
|
+
* `export type { … }`, and transitive `export * from` re-exports are
|
|
12
|
+
* resolved correctly. CJS bundles (`Object.defineProperty(exports, 'X')`,
|
|
13
|
+
* `exports.X = …`) still use the regex scanner, since those shapes don't
|
|
14
|
+
* surface as `ExportDeclaration` nodes in the AST.
|
|
15
|
+
*
|
|
16
|
+
* `mode: 'fast'` falls back to the legacy regex-only scanner — useful
|
|
17
|
+
* when the typescript module can't be loaded or when speed matters more
|
|
18
|
+
* than completeness.
|
|
13
19
|
*/
|
|
14
20
|
export declare const PACK_SYMBOL_COMPAT_SCHEMA = "sharkcraft.pack-symbol-compat/v1";
|
|
15
21
|
export interface IPluginApiImport {
|
|
@@ -50,11 +56,18 @@ export interface IPackSymbolCompatReport {
|
|
|
50
56
|
/** Files inspected when collecting available symbols. */
|
|
51
57
|
filesInspected: readonly string[];
|
|
52
58
|
}
|
|
59
|
+
export type PackSymbolCompatMode = 'ts' | 'fast';
|
|
53
60
|
export interface IPackSymbolCompatInput {
|
|
54
61
|
packPath: string;
|
|
55
62
|
consumerRoot?: string | null;
|
|
56
63
|
/** Scan dist/*.js patterns even when TS source is present. */
|
|
57
64
|
distAware?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* `'ts'` (default) walks ESM exports with the TypeScript compiler API and
|
|
67
|
+
* follows `export * from` chains transitively. `'fast'` uses the legacy
|
|
68
|
+
* regex-only scanner.
|
|
69
|
+
*/
|
|
70
|
+
mode?: PackSymbolCompatMode;
|
|
58
71
|
}
|
|
59
72
|
export declare function checkPackSymbolCompat(input: IPackSymbolCompatInput): IPackSymbolCompatReport;
|
|
60
73
|
//# sourceMappingURL=pack-symbol-compat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-symbol-compat.d.ts","sourceRoot":"","sources":["../src/pack-symbol-compat.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pack-symbol-compat.d.ts","sourceRoot":"","sources":["../src/pack-symbol-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,K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,oBAAoB,CAAC;CAC7B;AAUD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,CAsHzB"}
|
|
@@ -6,13 +6,20 @@
|
|
|
6
6
|
* and reports which symbols the pack uses that the consumer's plugin-api
|
|
7
7
|
* does not export.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Default mode (`'ts'`) walks ESM exports with the TypeScript compiler
|
|
10
|
+
* API — multi-line export blocks, multi-declarator `export const`,
|
|
11
|
+
* `export type { … }`, and transitive `export * from` re-exports are
|
|
12
|
+
* resolved correctly. CJS bundles (`Object.defineProperty(exports, 'X')`,
|
|
13
|
+
* `exports.X = …`) still use the regex scanner, since those shapes don't
|
|
14
|
+
* surface as `ExportDeclaration` nodes in the AST.
|
|
15
|
+
*
|
|
16
|
+
* `mode: 'fast'` falls back to the legacy regex-only scanner — useful
|
|
17
|
+
* when the typescript module can't be loaded or when speed matters more
|
|
18
|
+
* than completeness.
|
|
13
19
|
*/
|
|
14
20
|
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
15
21
|
import * as nodePath from 'node:path';
|
|
22
|
+
import * as ts from 'typescript';
|
|
16
23
|
export const PACK_SYMBOL_COMPAT_SCHEMA = 'sharkcraft.pack-symbol-compat/v1';
|
|
17
24
|
const NAMED_IMPORT_RE = /^\s*import\s*(?:type\s+)?\{([^}]+)\}\s*from\s*['"]@shrkcrft\/plugin-api['"]/;
|
|
18
25
|
const DEFAULT_IMPORT_RE = /^\s*import\s+(\w+)\s*(?:,\s*\{([^}]+)\})?\s*from\s*['"]@shrkcrft\/plugin-api['"]/;
|
|
@@ -193,6 +200,112 @@ const EXPORT_NAMED_RE = /^\s*export\s+(?:async\s+)?(?:declare\s+)?(?:function|cl
|
|
|
193
200
|
const EXPORT_BLOCK_RE = /^\s*export\s*\{([^}]+)\}/;
|
|
194
201
|
const RE_EXPORT_RE = /^\s*export\s*\*\s+from\s*['"]([^'"]+)['"]/;
|
|
195
202
|
const RE_EXPORT_NAMED_RE = /^\s*export\s*\{([^}]+)\}\s*from\s*['"]([^'"]+)['"]/;
|
|
203
|
+
function scriptKindFor(file) {
|
|
204
|
+
if (file.endsWith('.tsx'))
|
|
205
|
+
return ts.ScriptKind.TSX;
|
|
206
|
+
if (file.endsWith('.jsx'))
|
|
207
|
+
return ts.ScriptKind.JSX;
|
|
208
|
+
if (file.endsWith('.js') || file.endsWith('.mjs') || file.endsWith('.cjs'))
|
|
209
|
+
return ts.ScriptKind.JS;
|
|
210
|
+
return ts.ScriptKind.TS;
|
|
211
|
+
}
|
|
212
|
+
function hasExportModifier(node) {
|
|
213
|
+
const modifiers = (ts.canHaveModifiers(node) ? ts.getModifiers(node) : undefined) ?? [];
|
|
214
|
+
return modifiers.some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
|
|
215
|
+
}
|
|
216
|
+
function collectBindingNames(name, out) {
|
|
217
|
+
if (ts.isIdentifier(name)) {
|
|
218
|
+
out.add(name.text);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
if (ts.isObjectBindingPattern(name) || ts.isArrayBindingPattern(name)) {
|
|
222
|
+
for (const element of name.elements) {
|
|
223
|
+
if (ts.isBindingElement(element)) {
|
|
224
|
+
collectBindingNames(element.name, out);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Walk ESM exports of `file` using the TypeScript compiler API, following
|
|
231
|
+
* `export * from` re-exports transitively. CJS-specific shapes are NOT
|
|
232
|
+
* resolved here — call {@link collectJsExports} alongside for those.
|
|
233
|
+
*
|
|
234
|
+
* Returns an empty set on parse failure so callers can union with the
|
|
235
|
+
* regex fallback.
|
|
236
|
+
*/
|
|
237
|
+
function collectExportsTs(file, visited) {
|
|
238
|
+
if (visited.has(file))
|
|
239
|
+
return new Set();
|
|
240
|
+
visited.add(file);
|
|
241
|
+
const out = new Set();
|
|
242
|
+
let body;
|
|
243
|
+
try {
|
|
244
|
+
body = readFileSync(file, 'utf8');
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return out;
|
|
248
|
+
}
|
|
249
|
+
let source;
|
|
250
|
+
try {
|
|
251
|
+
source = ts.createSourceFile(file, body, ts.ScriptTarget.Latest, /*setParentNodes*/ false, scriptKindFor(file));
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
return out;
|
|
255
|
+
}
|
|
256
|
+
for (const stmt of source.statements) {
|
|
257
|
+
if (ts.isExportDeclaration(stmt)) {
|
|
258
|
+
const moduleSpec = stmt.moduleSpecifier && ts.isStringLiteral(stmt.moduleSpecifier) ? stmt.moduleSpecifier.text : null;
|
|
259
|
+
if (!stmt.exportClause) {
|
|
260
|
+
// `export * from '...'` — recurse through the barrel.
|
|
261
|
+
if (moduleSpec) {
|
|
262
|
+
const target = resolveRelative(file, moduleSpec);
|
|
263
|
+
if (target) {
|
|
264
|
+
for (const sym of collectExportsTs(target, visited))
|
|
265
|
+
out.add(sym);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (ts.isNamedExports(stmt.exportClause)) {
|
|
271
|
+
for (const spec of stmt.exportClause.elements) {
|
|
272
|
+
out.add(spec.name.text);
|
|
273
|
+
}
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
if (ts.isNamespaceExport(stmt.exportClause)) {
|
|
277
|
+
// `export * as ns from '...'` — the namespace itself is the export.
|
|
278
|
+
out.add(stmt.exportClause.name.text);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else if (ts.isFunctionDeclaration(stmt) && stmt.name && hasExportModifier(stmt)) {
|
|
283
|
+
out.add(stmt.name.text);
|
|
284
|
+
}
|
|
285
|
+
else if (ts.isClassDeclaration(stmt) && stmt.name && hasExportModifier(stmt)) {
|
|
286
|
+
out.add(stmt.name.text);
|
|
287
|
+
}
|
|
288
|
+
else if (ts.isInterfaceDeclaration(stmt) && hasExportModifier(stmt)) {
|
|
289
|
+
out.add(stmt.name.text);
|
|
290
|
+
}
|
|
291
|
+
else if (ts.isTypeAliasDeclaration(stmt) && hasExportModifier(stmt)) {
|
|
292
|
+
out.add(stmt.name.text);
|
|
293
|
+
}
|
|
294
|
+
else if (ts.isEnumDeclaration(stmt) && hasExportModifier(stmt)) {
|
|
295
|
+
out.add(stmt.name.text);
|
|
296
|
+
}
|
|
297
|
+
else if (ts.isModuleDeclaration(stmt) && stmt.name && hasExportModifier(stmt)) {
|
|
298
|
+
if (ts.isIdentifier(stmt.name))
|
|
299
|
+
out.add(stmt.name.text);
|
|
300
|
+
}
|
|
301
|
+
else if (ts.isVariableStatement(stmt) && hasExportModifier(stmt)) {
|
|
302
|
+
for (const decl of stmt.declarationList.declarations) {
|
|
303
|
+
collectBindingNames(decl.name, out);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return out;
|
|
308
|
+
}
|
|
196
309
|
function collectExports(file, visited) {
|
|
197
310
|
if (visited.has(file))
|
|
198
311
|
return new Set();
|
|
@@ -246,18 +359,33 @@ function resolveRelative(fromFile, rel) {
|
|
|
246
359
|
return null;
|
|
247
360
|
const base = nodePath.resolve(nodePath.dirname(fromFile), rel);
|
|
248
361
|
const candidates = [
|
|
362
|
+
base, // Verbatim with extension (e.g. './foo.ts' under NodeNext).
|
|
249
363
|
base + '.ts',
|
|
250
364
|
base + '.tsx',
|
|
365
|
+
base + '.d.ts',
|
|
366
|
+
base + '.mts',
|
|
367
|
+
base + '.cts',
|
|
251
368
|
base + '.js',
|
|
252
369
|
base + '.mjs',
|
|
253
370
|
base + '.cjs',
|
|
254
371
|
nodePath.join(base, 'index.ts'),
|
|
255
372
|
nodePath.join(base, 'index.tsx'),
|
|
373
|
+
nodePath.join(base, 'index.d.ts'),
|
|
374
|
+
nodePath.join(base, 'index.mts'),
|
|
256
375
|
nodePath.join(base, 'index.js'),
|
|
376
|
+
nodePath.join(base, 'index.mjs'),
|
|
257
377
|
];
|
|
258
|
-
for (const c of candidates)
|
|
259
|
-
if (existsSync(c))
|
|
260
|
-
|
|
378
|
+
for (const c of candidates) {
|
|
379
|
+
if (existsSync(c)) {
|
|
380
|
+
try {
|
|
381
|
+
if (statSync(c).isFile())
|
|
382
|
+
return c;
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
261
389
|
return null;
|
|
262
390
|
}
|
|
263
391
|
function confidenceFor(mode, count) {
|
|
@@ -278,9 +406,25 @@ export function checkPackSymbolCompat(input) {
|
|
|
278
406
|
const filesInspected = [];
|
|
279
407
|
let availableSet = new Set();
|
|
280
408
|
let usedMode = resolved.sourceMode;
|
|
409
|
+
const useTs = (input.mode ?? 'ts') === 'ts';
|
|
281
410
|
if (resolved.source.length > 0) {
|
|
282
411
|
if (resolved.sourceMode === 'dist-js') {
|
|
412
|
+
// CJS shapes only show up in the regex scanner; ESM shapes show up
|
|
413
|
+
// in either. Union the two so a bundle that mixes both is covered.
|
|
283
414
|
availableSet = collectJsExports(resolved.source);
|
|
415
|
+
if (useTs) {
|
|
416
|
+
for (const sym of collectExportsTs(resolved.source, new Set()))
|
|
417
|
+
availableSet.add(sym);
|
|
418
|
+
}
|
|
419
|
+
filesInspected.push(resolved.source);
|
|
420
|
+
}
|
|
421
|
+
else if (useTs) {
|
|
422
|
+
availableSet = collectExportsTs(resolved.source, new Set());
|
|
423
|
+
// Fallback union — if the TS walker returns nothing (parse failure),
|
|
424
|
+
// we still want a best-effort symbol list from the regex scanner.
|
|
425
|
+
if (availableSet.size === 0) {
|
|
426
|
+
availableSet = collectExports(resolved.source, new Set());
|
|
427
|
+
}
|
|
284
428
|
filesInspected.push(resolved.source);
|
|
285
429
|
}
|
|
286
430
|
else {
|
|
@@ -299,6 +443,10 @@ export function checkPackSymbolCompat(input) {
|
|
|
299
443
|
const full = nodePath.join(distDir, entry);
|
|
300
444
|
for (const s of collectJsExports(full))
|
|
301
445
|
availableSet.add(s);
|
|
446
|
+
if (useTs) {
|
|
447
|
+
for (const s of collectExportsTs(full, new Set()))
|
|
448
|
+
availableSet.add(s);
|
|
449
|
+
}
|
|
302
450
|
filesInspected.push(full);
|
|
303
451
|
}
|
|
304
452
|
if (resolved.sourceMode === 'declaration')
|
package/dist/pack-test-runner.js
CHANGED
|
@@ -13,11 +13,19 @@
|
|
|
13
13
|
* `mustNotIncludeIds`, optionally capping the token budget.
|
|
14
14
|
* 4. Emits a structured diagnostic report.
|
|
15
15
|
*/
|
|
16
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
17
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
18
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
19
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return path;
|
|
23
|
+
};
|
|
16
24
|
import { existsSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
17
25
|
import { join } from 'node:path';
|
|
26
|
+
import { pathToFileURL } from 'node:url';
|
|
18
27
|
import { inspectSharkcraft } from "./sharkcraft-inspector.js";
|
|
19
28
|
import { buildTaskPacket } from "./task-packet.js";
|
|
20
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
21
29
|
export function definePackTest(t) {
|
|
22
30
|
return t;
|
|
23
31
|
}
|
|
@@ -35,7 +43,7 @@ function findTestsFile(packPath) {
|
|
|
35
43
|
return null;
|
|
36
44
|
}
|
|
37
45
|
async function loadTestCases(file) {
|
|
38
|
-
const mod = (await
|
|
46
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
39
47
|
const list = mod.default ?? mod.tests ?? [];
|
|
40
48
|
return [...list];
|
|
41
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-registry.d.ts","sourceRoot":"","sources":["../src/playbook-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playbook-registry.d.ts","sourceRoot":"","sources":["../src/playbook-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,wBAAwB,oCAAoC,CAAC;AAE1E,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAmCD,wBAAsB,aAAa,CACjC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAiD/B;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,SAAS,EAAE,CAGrF;AAED,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAExF;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,GAAG,gBAAgB,CAWlE;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,SAAS,EAAE,EAC/B,IAAI,EAAE,MAAM,GACX,SAAS,uBAAuB,EAAE,CA+BpC"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
3
|
-
import {
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
4
12
|
export const PLAYBOOK_REGISTRY_SCHEMA = 'sharkcraft.playbook-registry/v1';
|
|
5
13
|
const CACHE = new Map();
|
|
6
14
|
async function importDefault(file) {
|
|
7
|
-
const mod = (await
|
|
15
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
8
16
|
if (Array.isArray(mod.default))
|
|
9
17
|
return mod.default;
|
|
10
18
|
if (mod.default && typeof mod.default === 'object')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-lifecycle-profile-registry.d.ts","sourceRoot":"","sources":["../src/plugin-lifecycle-profile-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-lifecycle-profile-registry.d.ts","sourceRoot":"","sources":["../src/plugin-lifecycle-profile-registry.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,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AC,CAGxD;AAED,wBAAgB,gCAAgC,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAG3E;AAED,MAAM,WAAW,sBAAsB;IACrC,iDAAiD;IACjD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAyBhC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Plugin lifecycle profile registry.
|
|
3
11
|
*
|
|
@@ -7,8 +15,8 @@
|
|
|
7
15
|
*/
|
|
8
16
|
import { existsSync } from 'node:fs';
|
|
9
17
|
import * as nodePath from 'node:path';
|
|
18
|
+
import { pathToFileURL } from 'node:url';
|
|
10
19
|
import { validatePluginLifecycleProfile, } from '@shrkcrft/plugin-api';
|
|
11
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
12
20
|
export const PLUGIN_LIFECYCLE_PROFILE_REGISTRY_SCHEMA = 'sharkcraft.plugin-lifecycle-profile-registry/v1';
|
|
13
21
|
export var PluginLifecycleProfileSource;
|
|
14
22
|
(function (PluginLifecycleProfileSource) {
|
|
@@ -24,7 +32,7 @@ export var ProfileDoctorSeverity;
|
|
|
24
32
|
})(ProfileDoctorSeverity || (ProfileDoctorSeverity = {}));
|
|
25
33
|
const CACHE = new Map();
|
|
26
34
|
async function importDefaultProfiles(file) {
|
|
27
|
-
const mod = (await
|
|
35
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
28
36
|
if (Array.isArray(mod.default))
|
|
29
37
|
return mod.default;
|
|
30
38
|
if (mod.default && typeof mod.default === 'object')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-engine.d.ts","sourceRoot":"","sources":["../src/policy-engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy-engine.d.ts","sourceRoot":"","sources":["../src/policy-engine.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YA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ACnD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6EAA6E;IAC7E,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,wBAAsB,cAAc,CAClC,UAAU,EAAE,qBAAqB,EACjC,KAAK,GAAE,oBAAyB,GAC/B,OAAO,CAAC,aAAa,CAAC,CA8QxB"}
|
package/dist/policy-engine.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
10
|
import * as nodePath from 'node:path';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
3
12
|
import { evaluateBoundaries, loadTsconfigPaths, scanImports } from '@shrkcrft/boundaries';
|
|
4
13
|
import { impactFor, loadOwnershipRules } from "./ownership.js";
|
|
5
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
6
14
|
export const POLICY_REPORT_SCHEMA = 'sharkcraft.policy-report/v1';
|
|
7
15
|
export var PolicySeverity;
|
|
8
16
|
(function (PolicySeverity) {
|
|
@@ -184,7 +192,7 @@ export async function evaluatePolicy(inspection, input = {}) {
|
|
|
184
192
|
if (!existsSync(full))
|
|
185
193
|
continue;
|
|
186
194
|
try {
|
|
187
|
-
const mod = (await
|
|
195
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(full).href)));
|
|
188
196
|
const decls = mod.default ?? mod.policyChecks ?? [];
|
|
189
197
|
for (const d of decls) {
|
|
190
198
|
runDecl(d, {
|
|
@@ -242,7 +250,7 @@ export async function evaluatePolicy(inspection, input = {}) {
|
|
|
242
250
|
if (!existsSync(full))
|
|
243
251
|
continue;
|
|
244
252
|
try {
|
|
245
|
-
const mod = (await
|
|
253
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(full).href)));
|
|
246
254
|
const decls = mod.default ?? mod.policyChecks ?? [];
|
|
247
255
|
for (const d of decls) {
|
|
248
256
|
runDecl(d, {
|
package/dist/policy-test.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
import { createHash } from 'node:crypto';
|
|
2
10
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
11
|
import * as nodePath from 'node:path';
|
|
4
|
-
import {
|
|
12
|
+
import { pathToFileURL } from 'node:url';
|
|
5
13
|
import { evaluatePolicy, PolicySeverity, } from "./policy-engine.js";
|
|
6
14
|
export const POLICY_TEST_SCHEMA = 'sharkcraft.policy-test/v1';
|
|
7
15
|
export const POLICY_SNAPSHOT_SCHEMA = 'sharkcraft.policy-snapshot/v1';
|
|
@@ -52,7 +60,7 @@ async function loadLocalPolicyChecks(inspection, localFiles) {
|
|
|
52
60
|
if (!existsSync(file))
|
|
53
61
|
continue;
|
|
54
62
|
try {
|
|
55
|
-
const mod = (await
|
|
63
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
56
64
|
const decls = mod.default ?? mod.policyChecks ?? [];
|
|
57
65
|
for (const d of decls)
|
|
58
66
|
out.push({ check: d, sourceFile: file, isLocal: true });
|
|
@@ -69,7 +77,7 @@ async function loadLocalPolicyChecks(inspection, localFiles) {
|
|
|
69
77
|
if (!existsSync(file))
|
|
70
78
|
continue;
|
|
71
79
|
try {
|
|
72
|
-
const mod = (await
|
|
80
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
73
81
|
const decls = mod.default ?? mod.policyChecks ?? [];
|
|
74
82
|
for (const d of decls)
|
|
75
83
|
out.push({ check: d, sourceFile: file, isLocal: false });
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - README links to release notes / limitations / external quickstart.
|
|
10
10
|
* - docs/commands-taxonomy.md presence (when expected).
|
|
11
11
|
* - docs/public-alpha-checklist.md mentions final validation gates.
|
|
12
|
-
* - docs/releases/0.1.0-alpha.
|
|
12
|
+
* - docs/releases/0.1.0-alpha.9.md states "not production stable" or equivalent.
|
|
13
13
|
*
|
|
14
14
|
* `--strict` converts warnings to errors.
|
|
15
15
|
*
|
|
@@ -21,7 +21,7 @@ export const PRODUCT_COHERENCE_SCHEMA = 'sharkcraft.product-coherence/v1';
|
|
|
21
21
|
const REQUIRED_DOCS = [
|
|
22
22
|
'README.md',
|
|
23
23
|
'docs/safety-model.md',
|
|
24
|
-
'docs/releases/0.1.0-alpha.
|
|
24
|
+
'docs/releases/0.1.0-alpha.9.md',
|
|
25
25
|
'docs/public-alpha-limitations.md',
|
|
26
26
|
'docs/external-repo-quickstart.md',
|
|
27
27
|
'CHANGELOG.md',
|
|
@@ -38,7 +38,7 @@ const README_RECOMMENDED_LINKS = [
|
|
|
38
38
|
{
|
|
39
39
|
phrase: /docs\/releases\/[^\s\)]+|release[-\s]?notes/i,
|
|
40
40
|
id: 'readme-link-release-notes',
|
|
41
|
-
message: 'README should link to release notes (e.g. docs/releases/0.1.0-alpha.
|
|
41
|
+
message: 'README should link to release notes (e.g. docs/releases/0.1.0-alpha.9.md).',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
phrase: /docs\/public[-\s]?alpha[-\s]?limitations/i,
|
|
@@ -77,14 +77,14 @@ function checkChangelog(root, findings) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
function checkReleaseNotes(root, findings) {
|
|
80
|
-
const rel = readFileText(root, 'docs/releases/0.1.0-alpha.
|
|
80
|
+
const rel = readFileText(root, 'docs/releases/0.1.0-alpha.9.md');
|
|
81
81
|
if (!rel)
|
|
82
82
|
return;
|
|
83
83
|
if (!/not\s+production[-\s]?stable|public[-\s]?alpha|preview|early[-\s]?stage/i.test(rel)) {
|
|
84
84
|
findings.push({
|
|
85
85
|
id: 'release-notes-stability-disclaimer',
|
|
86
86
|
severity: 'warning',
|
|
87
|
-
message: 'docs/releases/0.1.0-alpha.
|
|
87
|
+
message: 'docs/releases/0.1.0-alpha.9.md should state the release is not production-stable (or equivalent).',
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration-hint-registry.d.ts","sourceRoot":"","sources":["../src/registration-hint-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registration-hint-registry.d.ts","sourceRoot":"","sources":["../src/registration-hint-registry.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAE5F,oBAAY,sBAAsB;IAChC,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AA4BD,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC;IACT,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC3C,MAAM,EAAE,SAAS,4BAA4B,EAAE,CAAC;CACjD,CAAC,CAoFD;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,qBAAqB,GAChC,OAAO,C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UAAU,EAAE,qBAAqB,EACjC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAgD1C;AA6FD,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,4BAA4B,EAAE,CAAC,CAwClD"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Registration hint registry. Pack- and local-contributed hints
|
|
3
11
|
* surface downstream registration steps that constructs typically need
|
|
@@ -10,8 +18,8 @@
|
|
|
10
18
|
*/
|
|
11
19
|
import { existsSync, readFileSync } from 'node:fs';
|
|
12
20
|
import * as nodePath from 'node:path';
|
|
21
|
+
import { pathToFileURL } from 'node:url';
|
|
13
22
|
import { validateRegistrationHint, } from '@shrkcrft/plugin-api';
|
|
14
|
-
import { importModuleViaLoader } from '@shrkcrft/core';
|
|
15
23
|
export const REGISTRATION_HINT_REGISTRY_SCHEMA = 'sharkcraft.registration-hint-registry/v1';
|
|
16
24
|
export var RegistrationHintSource;
|
|
17
25
|
(function (RegistrationHintSource) {
|
|
@@ -20,7 +28,7 @@ export var RegistrationHintSource;
|
|
|
20
28
|
RegistrationHintSource["Fixture"] = "fixture";
|
|
21
29
|
})(RegistrationHintSource || (RegistrationHintSource = {}));
|
|
22
30
|
async function importDefault(file) {
|
|
23
|
-
const mod = (await
|
|
31
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
24
32
|
if (Array.isArray(mod.default))
|
|
25
33
|
return mod.default;
|
|
26
34
|
if (mod.default && typeof mod.default === 'object')
|
|
@@ -304,12 +304,12 @@ export async function buildReleaseReadiness(inspection, options = {}) {
|
|
|
304
304
|
})();
|
|
305
305
|
const releaseNotesDir = nodePath.join(projectRoot, 'docs', 'releases');
|
|
306
306
|
const releaseNotesFile = versionFile ? nodePath.join(releaseNotesDir, `${versionFile}.md`) : null;
|
|
307
|
-
const releaseNotesAlpha = nodePath.join(releaseNotesDir, '0.1.0-alpha.
|
|
307
|
+
const releaseNotesAlpha = nodePath.join(releaseNotesDir, '0.1.0-alpha.9.md');
|
|
308
308
|
const limitsFile = nodePath.join(projectRoot, 'docs', 'public-alpha-limitations.md');
|
|
309
309
|
const externalQuickstart = nodePath.join(projectRoot, 'docs', 'external-repo-quickstart.md');
|
|
310
310
|
const releaseNotesExists = (releaseNotesFile && existsSync(releaseNotesFile)) || existsSync(releaseNotesAlpha);
|
|
311
311
|
if (!releaseNotesExists) {
|
|
312
|
-
checks.push(warn('release-notes', 'Public alpha release notes', `Missing docs/releases/${versionFile ?? '<version>'}.md or docs/releases/0.1.0-alpha.
|
|
312
|
+
checks.push(warn('release-notes', 'Public alpha release notes', `Missing docs/releases/${versionFile ?? '<version>'}.md or docs/releases/0.1.0-alpha.9.md`, 'Add release notes — strict release readiness treats this as a blocker.'));
|
|
313
313
|
}
|
|
314
314
|
else {
|
|
315
315
|
checks.push(pass('release-notes', 'Public alpha release notes', 'Release notes file present.'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-packet-v2.d.ts","sourceRoot":"","sources":["../src/review-packet-v2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,yBAAyB,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3G,OAAO,EAAiB,KAAK,eAAe,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,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,eAAe,CAAC,CAmD1B"}
|
package/dist/review-packet-v2.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import { buildReviewPacket } from "./review-packet.js";
|
|
2
2
|
import { analyzeImpact } from "./impact-analysis.js";
|
|
3
3
|
import { analyzeTestImpact } from "./test-impact.js";
|
|
4
|
-
import { buildAreaMap } from "./area-map.js";
|
|
4
|
+
import { buildAreaMap, filterAreaMap } from "./area-map.js";
|
|
5
5
|
import { impactFor, loadOwnershipRules } from "./ownership.js";
|
|
6
6
|
import { evaluatePolicy } from "./policy-engine.js";
|
|
7
7
|
import { compareQualityBaseline } from "./quality-baseline.js";
|
|
8
8
|
export const REVIEW_PACKET_V2_SCHEMA = 'sharkcraft.review-packet-v2/v1';
|
|
9
9
|
export async function buildReviewPacketV2(inspection, options = {}) {
|
|
10
10
|
const base = buildReviewPacket(inspection, options);
|
|
11
|
-
const
|
|
11
|
+
const fullAreaMap = buildAreaMap(inspection);
|
|
12
|
+
// 50 is enough for an AI reviewer to see the shape of the impact without
|
|
13
|
+
// blowing the packet up — `shrk impact` keeps the full 200 default for
|
|
14
|
+
// ad-hoc debugging.
|
|
12
15
|
const impact = await analyzeImpact(inspection, {
|
|
13
16
|
files: base.changedFiles,
|
|
14
|
-
areaMap,
|
|
17
|
+
areaMap: fullAreaMap,
|
|
18
|
+
limit: 50,
|
|
15
19
|
});
|
|
20
|
+
// Slim the area map to only the areas touched by the diff. Cuts the
|
|
21
|
+
// packet payload by ~75% on typical diffs without losing reviewer-facing
|
|
22
|
+
// context — the consumer can re-derive neighbours from the full map via
|
|
23
|
+
// `shrk map` if needed.
|
|
24
|
+
const affectedIds = impact.affectedAreas.map((a) => a.id);
|
|
25
|
+
const areaMap = affectedIds.length > 0 ? filterAreaMap(fullAreaMap, affectedIds) : fullAreaMap;
|
|
16
26
|
const testImpact = analyzeTestImpact(inspection, { files: base.changedFiles });
|
|
17
27
|
const { rules } = await loadOwnershipRules(inspection.projectRoot, options.ownershipFiles);
|
|
18
28
|
const ownership = impactFor(base.changedFiles, rules);
|