@nebutra/next-unicorn-skill 1.0.0
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/CHANGELOG.md +57 -0
- package/LICENSE +21 -0
- package/README.md +316 -0
- package/SKILL.md +318 -0
- package/dist/analyzer/pattern-catalog.d.ts +35 -0
- package/dist/analyzer/pattern-catalog.d.ts.map +1 -0
- package/dist/analyzer/pattern-catalog.js +342 -0
- package/dist/analyzer/pattern-catalog.js.map +1 -0
- package/dist/analyzer/scanner.d.ts +33 -0
- package/dist/analyzer/scanner.d.ts.map +1 -0
- package/dist/analyzer/scanner.js +302 -0
- package/dist/analyzer/scanner.js.map +1 -0
- package/dist/auditor/ux-auditor.d.ts +26 -0
- package/dist/auditor/ux-auditor.d.ts.map +1 -0
- package/dist/auditor/ux-auditor.js +272 -0
- package/dist/auditor/ux-auditor.js.map +1 -0
- package/dist/checker/peer-dependency-checker.d.ts +62 -0
- package/dist/checker/peer-dependency-checker.d.ts.map +1 -0
- package/dist/checker/peer-dependency-checker.js +94 -0
- package/dist/checker/peer-dependency-checker.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +325 -0
- package/dist/index.js.map +1 -0
- package/dist/planner/migration-planner.d.ts +47 -0
- package/dist/planner/migration-planner.d.ts.map +1 -0
- package/dist/planner/migration-planner.js +144 -0
- package/dist/planner/migration-planner.js.map +1 -0
- package/dist/pr-creator/git-operations.d.ts +29 -0
- package/dist/pr-creator/git-operations.d.ts.map +1 -0
- package/dist/pr-creator/git-operations.js +10 -0
- package/dist/pr-creator/git-operations.js.map +1 -0
- package/dist/pr-creator/platform-client.d.ts +47 -0
- package/dist/pr-creator/platform-client.d.ts.map +1 -0
- package/dist/pr-creator/platform-client.js +9 -0
- package/dist/pr-creator/platform-client.js.map +1 -0
- package/dist/pr-creator/pr-description-builder.d.ts +23 -0
- package/dist/pr-creator/pr-description-builder.d.ts.map +1 -0
- package/dist/pr-creator/pr-description-builder.js +187 -0
- package/dist/pr-creator/pr-description-builder.js.map +1 -0
- package/dist/pr-creator/pr-executor.d.ts +30 -0
- package/dist/pr-creator/pr-executor.d.ts.map +1 -0
- package/dist/pr-creator/pr-executor.js +109 -0
- package/dist/pr-creator/pr-executor.js.map +1 -0
- package/dist/pr-creator/pr-strategy.d.ts +56 -0
- package/dist/pr-creator/pr-strategy.d.ts.map +1 -0
- package/dist/pr-creator/pr-strategy.js +125 -0
- package/dist/pr-creator/pr-strategy.js.map +1 -0
- package/dist/schemas/input.schema.d.ts +231 -0
- package/dist/schemas/input.schema.d.ts.map +1 -0
- package/dist/schemas/input.schema.js +159 -0
- package/dist/schemas/input.schema.js.map +1 -0
- package/dist/schemas/output.schema.d.ts +2543 -0
- package/dist/schemas/output.schema.d.ts.map +1 -0
- package/dist/schemas/output.schema.js +199 -0
- package/dist/schemas/output.schema.js.map +1 -0
- package/dist/scorer/impact-scorer.d.ts +45 -0
- package/dist/scorer/impact-scorer.d.ts.map +1 -0
- package/dist/scorer/impact-scorer.js +243 -0
- package/dist/scorer/impact-scorer.js.map +1 -0
- package/dist/security/osv-client.d.ts +72 -0
- package/dist/security/osv-client.d.ts.map +1 -0
- package/dist/security/osv-client.js +36 -0
- package/dist/security/osv-client.js.map +1 -0
- package/dist/security/vuln-report-builder.d.ts +18 -0
- package/dist/security/vuln-report-builder.d.ts.map +1 -0
- package/dist/security/vuln-report-builder.js +141 -0
- package/dist/security/vuln-report-builder.js.map +1 -0
- package/dist/security/vulnerability-scanner.d.ts +65 -0
- package/dist/security/vulnerability-scanner.d.ts.map +1 -0
- package/dist/security/vulnerability-scanner.js +140 -0
- package/dist/security/vulnerability-scanner.js.map +1 -0
- package/dist/updater/changelog-verifier.d.ts +29 -0
- package/dist/updater/changelog-verifier.d.ts.map +1 -0
- package/dist/updater/changelog-verifier.js +80 -0
- package/dist/updater/changelog-verifier.js.map +1 -0
- package/dist/updater/registry-client.d.ts +49 -0
- package/dist/updater/registry-client.d.ts.map +1 -0
- package/dist/updater/registry-client.js +10 -0
- package/dist/updater/registry-client.js.map +1 -0
- package/dist/updater/update-plan-builder.d.ts +23 -0
- package/dist/updater/update-plan-builder.d.ts.map +1 -0
- package/dist/updater/update-plan-builder.js +93 -0
- package/dist/updater/update-plan-builder.js.map +1 -0
- package/dist/updater/update-policy.d.ts +50 -0
- package/dist/updater/update-policy.d.ts.map +1 -0
- package/dist/updater/update-policy.js +118 -0
- package/dist/updater/update-policy.js.map +1 -0
- package/dist/updater/update-scorer.d.ts +51 -0
- package/dist/updater/update-scorer.d.ts.map +1 -0
- package/dist/updater/update-scorer.js +166 -0
- package/dist/updater/update-scorer.js.map +1 -0
- package/dist/utils/constraint-filter.d.ts +44 -0
- package/dist/utils/constraint-filter.d.ts.map +1 -0
- package/dist/utils/constraint-filter.js +69 -0
- package/dist/utils/constraint-filter.js.map +1 -0
- package/dist/utils/serializer.d.ts +17 -0
- package/dist/utils/serializer.d.ts.map +1 -0
- package/dist/utils/serializer.js +24 -0
- package/dist/utils/serializer.js.map +1 -0
- package/dist/utils/skill-parser.d.ts +29 -0
- package/dist/utils/skill-parser.d.ts.map +1 -0
- package/dist/utils/skill-parser.js +175 -0
- package/dist/utils/skill-parser.js.map +1 -0
- package/dist/verifier/context7.d.ts +48 -0
- package/dist/verifier/context7.d.ts.map +1 -0
- package/dist/verifier/context7.js +97 -0
- package/dist/verifier/context7.js.map +1 -0
- package/examples/backend-node/input.json +28 -0
- package/examples/backend-node/output.json +343 -0
- package/examples/frontend-nextjs/input.json +37 -0
- package/examples/frontend-nextjs/output.json +302 -0
- package/package.json +79 -0
- package/templates/deletion-checklist.md +42 -0
- package/templates/migration-plan.md +61 -0
- package/templates/prd-template.md +123 -0
- package/templates/summary-table.md +28 -0
- package/templates/update-plan.md +61 -0
- package/templates/vuln-report.md +50 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { RecommendedChange } from '../schemas/output.schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolved peer dependency metadata for a library.
|
|
4
|
+
* Maps peer dependency name → required version range.
|
|
5
|
+
*/
|
|
6
|
+
export type PeerDependencyMap = Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Interface for resolving peer dependency metadata.
|
|
9
|
+
* Injected for testability — real implementation reads from npm registry or package.json.
|
|
10
|
+
*/
|
|
11
|
+
export interface PeerDependencyResolver {
|
|
12
|
+
resolve(libraryName: string, version: string): Promise<PeerDependencyMap>;
|
|
13
|
+
}
|
|
14
|
+
export type WarningSeverity = 'conflict' | 'missing' | 'compatible';
|
|
15
|
+
export interface PeerDependencyWarning {
|
|
16
|
+
recommendedLibrary: string;
|
|
17
|
+
peerDependency: string;
|
|
18
|
+
requiredRange: string;
|
|
19
|
+
installedVersion: string | null;
|
|
20
|
+
severity: WarningSeverity;
|
|
21
|
+
}
|
|
22
|
+
export interface PeerCheckResult {
|
|
23
|
+
warnings: PeerDependencyWarning[];
|
|
24
|
+
recommendations: RecommendedChange[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Classify the severity of a peer dependency relationship.
|
|
28
|
+
*
|
|
29
|
+
* - If the peer dependency is not installed (undefined), returns "missing"
|
|
30
|
+
* - If the installed version cannot be coerced to a valid semver, returns "conflict"
|
|
31
|
+
* - If the installed version satisfies the required range, returns "compatible"
|
|
32
|
+
* - Otherwise, returns "conflict"
|
|
33
|
+
*
|
|
34
|
+
* Requirements: 2.1, 2.2, 2.3
|
|
35
|
+
*/
|
|
36
|
+
export declare function classifySeverity(requiredRange: string, installedVersion: string | undefined): WarningSeverity;
|
|
37
|
+
/**
|
|
38
|
+
* Escalate migration risk when conflict or missing peer dependencies are detected.
|
|
39
|
+
*
|
|
40
|
+
* - If no conflict/missing, preserves current risk
|
|
41
|
+
* - If current risk is "high", preserves "high"
|
|
42
|
+
* - Otherwise bumps to "medium"
|
|
43
|
+
*
|
|
44
|
+
* Requirements: 3.1, 3.2, 3.3
|
|
45
|
+
*/
|
|
46
|
+
export declare function escalateRisk(currentRisk: 'low' | 'medium' | 'high', hasConflictOrMissing: boolean): 'low' | 'medium' | 'high';
|
|
47
|
+
/**
|
|
48
|
+
* Check peer dependencies for all recommendations against currentLibraries.
|
|
49
|
+
*
|
|
50
|
+
* For each recommendation:
|
|
51
|
+
* 1. Resolve peer dependency metadata via the resolver
|
|
52
|
+
* 2. For each peer dep, compare against currentLibraries using semver
|
|
53
|
+
* 3. Classify as "compatible", "conflict", or "missing"
|
|
54
|
+
* 4. If any peer dep is "conflict" or "missing", escalate migrationRisk to at least "medium"
|
|
55
|
+
*
|
|
56
|
+
* On resolver error for a specific library: catch error, produce zero warnings,
|
|
57
|
+
* preserve original migrationRisk, and continue processing.
|
|
58
|
+
*
|
|
59
|
+
* Requirements: 1.1, 1.2, 2.1, 2.2, 2.3, 2.4, 3.1, 3.2, 3.3
|
|
60
|
+
*/
|
|
61
|
+
export declare function checkPeerDependencies(recommendations: RecommendedChange[], currentLibraries: Record<string, string>, resolver: PeerDependencyResolver): Promise<PeerCheckResult>;
|
|
62
|
+
//# sourceMappingURL=peer-dependency-checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer-dependency-checker.d.ts","sourceRoot":"","sources":["../../src/checker/peer-dependency-checker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAEpE,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,eAAe,EAAE,iBAAiB,EAAE,CAAC;CACtC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM,GAAG,SAAS,GACnC,eAAe,CAKjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,WAAW,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,EACtC,oBAAoB,EAAE,OAAO,GAC5B,KAAK,GAAG,QAAQ,GAAG,MAAM,CAI3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CACzC,eAAe,EAAE,iBAAiB,EAAE,EACpC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,QAAQ,EAAE,sBAAsB,GAC/B,OAAO,CAAC,eAAe,CAAC,CA0D1B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import semver from 'semver';
|
|
2
|
+
/**
|
|
3
|
+
* Classify the severity of a peer dependency relationship.
|
|
4
|
+
*
|
|
5
|
+
* - If the peer dependency is not installed (undefined), returns "missing"
|
|
6
|
+
* - If the installed version cannot be coerced to a valid semver, returns "conflict"
|
|
7
|
+
* - If the installed version satisfies the required range, returns "compatible"
|
|
8
|
+
* - Otherwise, returns "conflict"
|
|
9
|
+
*
|
|
10
|
+
* Requirements: 2.1, 2.2, 2.3
|
|
11
|
+
*/
|
|
12
|
+
export function classifySeverity(requiredRange, installedVersion) {
|
|
13
|
+
if (installedVersion === undefined)
|
|
14
|
+
return 'missing';
|
|
15
|
+
const coerced = semver.coerce(installedVersion);
|
|
16
|
+
if (!coerced)
|
|
17
|
+
return 'conflict';
|
|
18
|
+
return semver.satisfies(coerced, requiredRange) ? 'compatible' : 'conflict';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Escalate migration risk when conflict or missing peer dependencies are detected.
|
|
22
|
+
*
|
|
23
|
+
* - If no conflict/missing, preserves current risk
|
|
24
|
+
* - If current risk is "high", preserves "high"
|
|
25
|
+
* - Otherwise bumps to "medium"
|
|
26
|
+
*
|
|
27
|
+
* Requirements: 3.1, 3.2, 3.3
|
|
28
|
+
*/
|
|
29
|
+
export function escalateRisk(currentRisk, hasConflictOrMissing) {
|
|
30
|
+
if (!hasConflictOrMissing)
|
|
31
|
+
return currentRisk;
|
|
32
|
+
if (currentRisk === 'high')
|
|
33
|
+
return 'high';
|
|
34
|
+
return 'medium';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check peer dependencies for all recommendations against currentLibraries.
|
|
38
|
+
*
|
|
39
|
+
* For each recommendation:
|
|
40
|
+
* 1. Resolve peer dependency metadata via the resolver
|
|
41
|
+
* 2. For each peer dep, compare against currentLibraries using semver
|
|
42
|
+
* 3. Classify as "compatible", "conflict", or "missing"
|
|
43
|
+
* 4. If any peer dep is "conflict" or "missing", escalate migrationRisk to at least "medium"
|
|
44
|
+
*
|
|
45
|
+
* On resolver error for a specific library: catch error, produce zero warnings,
|
|
46
|
+
* preserve original migrationRisk, and continue processing.
|
|
47
|
+
*
|
|
48
|
+
* Requirements: 1.1, 1.2, 2.1, 2.2, 2.3, 2.4, 3.1, 3.2, 3.3
|
|
49
|
+
*/
|
|
50
|
+
export async function checkPeerDependencies(recommendations, currentLibraries, resolver) {
|
|
51
|
+
const allWarnings = [];
|
|
52
|
+
const updatedRecommendations = [];
|
|
53
|
+
for (const rec of recommendations) {
|
|
54
|
+
let peerDeps = {};
|
|
55
|
+
try {
|
|
56
|
+
const resolved = await resolver.resolve(rec.recommendedLibrary.name, rec.recommendedLibrary.version);
|
|
57
|
+
// Validate resolved data — filter out non-string values (malformed data)
|
|
58
|
+
for (const [key, value] of Object.entries(resolved)) {
|
|
59
|
+
if (typeof key === 'string' && typeof value === 'string') {
|
|
60
|
+
peerDeps[key] = value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Resolver error: produce zero warnings, preserve original risk, continue
|
|
66
|
+
updatedRecommendations.push(rec);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const recWarnings = [];
|
|
70
|
+
for (const [peerName, requiredRange] of Object.entries(peerDeps)) {
|
|
71
|
+
const installedVersion = currentLibraries[peerName];
|
|
72
|
+
const severity = classifySeverity(requiredRange, installedVersion);
|
|
73
|
+
recWarnings.push({
|
|
74
|
+
recommendedLibrary: rec.recommendedLibrary.name,
|
|
75
|
+
peerDependency: peerName,
|
|
76
|
+
requiredRange,
|
|
77
|
+
installedVersion: installedVersion ?? null,
|
|
78
|
+
severity,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const hasConflictOrMissing = recWarnings.some((w) => w.severity === 'conflict' || w.severity === 'missing');
|
|
82
|
+
const escalatedRisk = escalateRisk(rec.migrationRisk, hasConflictOrMissing);
|
|
83
|
+
updatedRecommendations.push({
|
|
84
|
+
...rec,
|
|
85
|
+
migrationRisk: escalatedRisk,
|
|
86
|
+
});
|
|
87
|
+
allWarnings.push(...recWarnings);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
warnings: allWarnings,
|
|
91
|
+
recommendations: updatedRecommendations,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=peer-dependency-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer-dependency-checker.js","sourceRoot":"","sources":["../../src/checker/peer-dependency-checker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAgC5B;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,C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|
+
*
|
|
4
|
+
* Scans codebases and recommends replacing hand-rolled implementations
|
|
5
|
+
* with battle-tested third-party libraries.
|
|
6
|
+
*
|
|
7
|
+
* This is the orchestrator that wires the full pipeline:
|
|
8
|
+
* validate input → scan → verify → score → plan → audit → filter →
|
|
9
|
+
* vuln scan → auto-update → serialize → PR creation
|
|
10
|
+
*/
|
|
11
|
+
import { OutputSchema } from './schemas/output.schema.js';
|
|
12
|
+
import { type Context7Client } from './verifier/context7.js';
|
|
13
|
+
import { type ExclusionRecord } from './utils/constraint-filter.js';
|
|
14
|
+
import { type PeerDependencyResolver } from './checker/peer-dependency-checker.js';
|
|
15
|
+
import type { VulnerabilityClient } from './security/osv-client.js';
|
|
16
|
+
import type { RegistryClient } from './updater/registry-client.js';
|
|
17
|
+
import type { PlatformClient } from './pr-creator/platform-client.js';
|
|
18
|
+
import type { GitOperations } from './pr-creator/git-operations.js';
|
|
19
|
+
export declare const VERSION = "2.0.0";
|
|
20
|
+
export interface AnalyzeOptions {
|
|
21
|
+
/** Raw input to be validated against InputSchema */
|
|
22
|
+
input: unknown;
|
|
23
|
+
/** Injected Context7 client for testability — no real HTTP calls in tests */
|
|
24
|
+
context7Client: Context7Client;
|
|
25
|
+
/** Optional — if provided, enables vulnerability scanning */
|
|
26
|
+
vulnClient?: VulnerabilityClient;
|
|
27
|
+
/** Optional — if provided, enables auto-update recommendations */
|
|
28
|
+
registryClient?: RegistryClient;
|
|
29
|
+
/** Required only if prPolicy.enabled is true */
|
|
30
|
+
platformClient?: PlatformClient;
|
|
31
|
+
/** Required only if prPolicy.enabled is true */
|
|
32
|
+
gitOps?: GitOperations;
|
|
33
|
+
/** Optional — if provided, resolves peer dependency metadata for recommended libraries */
|
|
34
|
+
peerDependencyResolver?: PeerDependencyResolver;
|
|
35
|
+
}
|
|
36
|
+
export type AnalyzeResult = {
|
|
37
|
+
success: true;
|
|
38
|
+
output: OutputSchema;
|
|
39
|
+
json: string;
|
|
40
|
+
prettyJson: string;
|
|
41
|
+
exclusions: ExclusionRecord[];
|
|
42
|
+
} | {
|
|
43
|
+
success: false;
|
|
44
|
+
error: string;
|
|
45
|
+
issues?: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type { Context7Client, VerificationResult } from './verifier/context7.js';
|
|
48
|
+
export type { ExclusionRecord } from './utils/constraint-filter.js';
|
|
49
|
+
export type { InputSchema } from './schemas/input.schema.js';
|
|
50
|
+
export type { OutputSchema } from './schemas/output.schema.js';
|
|
51
|
+
export type { VulnerabilityClient } from './security/osv-client.js';
|
|
52
|
+
export type { RegistryClient } from './updater/registry-client.js';
|
|
53
|
+
export type { PlatformClient } from './pr-creator/platform-client.js';
|
|
54
|
+
export type { GitOperations } from './pr-creator/git-operations.js';
|
|
55
|
+
export type { PeerDependencyResolver } from './checker/peer-dependency-checker.js';
|
|
56
|
+
/**
|
|
57
|
+
* Run the full Next-Unicorn analysis pipeline.
|
|
58
|
+
*
|
|
59
|
+
* Pipeline steps:
|
|
60
|
+
* 1. Validate input with InputSchema Zod schema
|
|
61
|
+
* 2. Scan codebase with scanCodebase
|
|
62
|
+
* 3. Verify all detections with Context7
|
|
63
|
+
* 4. Score each detection
|
|
64
|
+
* 5. Build RecommendedChange objects
|
|
65
|
+
* 6. Apply dependency conflict detection
|
|
66
|
+
* 6.5 Vulnerability scanning (optional — Phase 2)
|
|
67
|
+
* 7. Apply license filtering
|
|
68
|
+
* 8. Build migration plan
|
|
69
|
+
* 9. Audit UX completeness
|
|
70
|
+
* 10. Auto-update existing dependencies (optional — Phase 2)
|
|
71
|
+
* 11. Assemble OutputSchema, serialize
|
|
72
|
+
* 12. PR auto-creation (optional — Phase 2)
|
|
73
|
+
* 13. Return result
|
|
74
|
+
*
|
|
75
|
+
* Requirements: 1.1, 7.3, 10.*, 11.*, 12.*
|
|
76
|
+
*/
|
|
77
|
+
export declare function analyze(options: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 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ACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAMN,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjF,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAMnF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAwT7E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next-Unicorn SKILL — Analyze and Recommend Third-Party Optimizations
|
|
3
|
+
*
|
|
4
|
+
* Scans codebases and recommends replacing hand-rolled implementations
|
|
5
|
+
* with battle-tested third-party libraries.
|
|
6
|
+
*
|
|
7
|
+
* This is the orchestrator that wires the full pipeline:
|
|
8
|
+
* validate input → scan → verify → score → plan → audit → filter →
|
|
9
|
+
* vuln scan → auto-update → serialize → PR creation
|
|
10
|
+
*/
|
|
11
|
+
import { ZodError } from 'zod';
|
|
12
|
+
import { InputSchema } from './schemas/input.schema.js';
|
|
13
|
+
import { scanCodebase } from './analyzer/scanner.js';
|
|
14
|
+
import { getPatternCatalog } from './analyzer/pattern-catalog.js';
|
|
15
|
+
import { verifyAllRecommendations, } from './verifier/context7.js';
|
|
16
|
+
import { computeImpactScore } from './scorer/impact-scorer.js';
|
|
17
|
+
import { buildMigrationPlan } from './planner/migration-planner.js';
|
|
18
|
+
import { auditUxCompleteness } from './auditor/ux-auditor.js';
|
|
19
|
+
import { filterByLicense, detectDependencyConflicts, } from './utils/constraint-filter.js';
|
|
20
|
+
import { serializeOutput, prettyPrint } from './utils/serializer.js';
|
|
21
|
+
import { checkPeerDependencies, } from './checker/peer-dependency-checker.js';
|
|
22
|
+
import { scanVulnerabilities } from './security/vulnerability-scanner.js';
|
|
23
|
+
import { applyUpdatePolicy } from './updater/update-policy.js';
|
|
24
|
+
import { verifyChangelog } from './updater/changelog-verifier.js';
|
|
25
|
+
import { scoreUpdate } from './updater/update-scorer.js';
|
|
26
|
+
import { buildUpdatePlan } from './updater/update-plan-builder.js';
|
|
27
|
+
import { planPRs } from './pr-creator/pr-strategy.js';
|
|
28
|
+
import { executePRPlans } from './pr-creator/pr-executor.js';
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Version
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
export const VERSION = '2.0.0';
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// analyze — main orchestrator
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* Run the full Next-Unicorn analysis pipeline.
|
|
38
|
+
*
|
|
39
|
+
* Pipeline steps:
|
|
40
|
+
* 1. Validate input with InputSchema Zod schema
|
|
41
|
+
* 2. Scan codebase with scanCodebase
|
|
42
|
+
* 3. Verify all detections with Context7
|
|
43
|
+
* 4. Score each detection
|
|
44
|
+
* 5. Build RecommendedChange objects
|
|
45
|
+
* 6. Apply dependency conflict detection
|
|
46
|
+
* 6.5 Vulnerability scanning (optional — Phase 2)
|
|
47
|
+
* 7. Apply license filtering
|
|
48
|
+
* 8. Build migration plan
|
|
49
|
+
* 9. Audit UX completeness
|
|
50
|
+
* 10. Auto-update existing dependencies (optional — Phase 2)
|
|
51
|
+
* 11. Assemble OutputSchema, serialize
|
|
52
|
+
* 12. PR auto-creation (optional — Phase 2)
|
|
53
|
+
* 13. Return result
|
|
54
|
+
*
|
|
55
|
+
* Requirements: 1.1, 7.3, 10.*, 11.*, 12.*
|
|
56
|
+
*/
|
|
57
|
+
export async function analyze(options) {
|
|
58
|
+
const { input, context7Client } = options;
|
|
59
|
+
// -------------------------------------------------------------------------
|
|
60
|
+
// Step 1: Validate input
|
|
61
|
+
// -------------------------------------------------------------------------
|
|
62
|
+
let validatedInput;
|
|
63
|
+
try {
|
|
64
|
+
validatedInput = InputSchema.parse(input);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
if (err instanceof ZodError) {
|
|
68
|
+
return {
|
|
69
|
+
success: false,
|
|
70
|
+
error: `Input validation failed: ${err.errors.map((e) => e.message).join(', ')}`,
|
|
71
|
+
issues: err.errors,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
error: `Input validation failed: ${String(err)}`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// -------------------------------------------------------------------------
|
|
80
|
+
// Step 2: Scan codebase
|
|
81
|
+
// -------------------------------------------------------------------------
|
|
82
|
+
const scanResult = await scanCodebase(validatedInput);
|
|
83
|
+
// -------------------------------------------------------------------------
|
|
84
|
+
// Step 3: Verify all detections with Context7
|
|
85
|
+
// -------------------------------------------------------------------------
|
|
86
|
+
const verificationMap = await verifyAllRecommendations(context7Client, scanResult.detections);
|
|
87
|
+
// -------------------------------------------------------------------------
|
|
88
|
+
// Step 4 & 5: Score each detection and build RecommendedChange objects
|
|
89
|
+
// -------------------------------------------------------------------------
|
|
90
|
+
const catalog = getPatternCatalog();
|
|
91
|
+
const catalogMap = new Map(catalog.map((p) => [p.id, p]));
|
|
92
|
+
const recommendations = scanResult.detections.map((detection, index) => {
|
|
93
|
+
const verification = verificationMap.get(index) ?? {
|
|
94
|
+
status: 'unavailable',
|
|
95
|
+
note: 'No verification result available',
|
|
96
|
+
};
|
|
97
|
+
const scoringOutput = computeImpactScore({
|
|
98
|
+
detection,
|
|
99
|
+
verification,
|
|
100
|
+
weights: validatedInput.impactWeights,
|
|
101
|
+
priorityFocusAreas: validatedInput.priorityFocusAreas,
|
|
102
|
+
});
|
|
103
|
+
// Look up the pattern definition for version and license info
|
|
104
|
+
const patternDef = catalogMap.get(detection.patternCategory);
|
|
105
|
+
return {
|
|
106
|
+
currentImplementation: {
|
|
107
|
+
filePath: detection.filePath,
|
|
108
|
+
lineRange: detection.lineRange,
|
|
109
|
+
patternCategory: detection.patternCategory,
|
|
110
|
+
confidenceScore: detection.confidenceScore,
|
|
111
|
+
},
|
|
112
|
+
recommendedLibrary: {
|
|
113
|
+
name: detection.suggestedLibrary,
|
|
114
|
+
version: patternDef?.suggestedVersion ?? 'latest',
|
|
115
|
+
license: patternDef?.license ?? 'MIT',
|
|
116
|
+
documentationUrl: verification.documentationUrl,
|
|
117
|
+
},
|
|
118
|
+
domain: detection.domain,
|
|
119
|
+
impactScores: scoringOutput.scores,
|
|
120
|
+
migrationRisk: scoringOutput.migrationRisk,
|
|
121
|
+
estimatedEffort: scoringOutput.estimatedEffort,
|
|
122
|
+
verificationStatus: verification.status,
|
|
123
|
+
verificationNote: verification.note,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
// -------------------------------------------------------------------------
|
|
127
|
+
// Step 6: Apply dependency conflict detection
|
|
128
|
+
// -------------------------------------------------------------------------
|
|
129
|
+
const conflictChecked = detectDependencyConflicts(recommendations, validatedInput.projectMetadata.currentLibraries);
|
|
130
|
+
// -------------------------------------------------------------------------
|
|
131
|
+
// Step 6.25: Check peer dependencies
|
|
132
|
+
// -------------------------------------------------------------------------
|
|
133
|
+
let peerWarnings = [];
|
|
134
|
+
let peerCheckedRecommendations = conflictChecked;
|
|
135
|
+
try {
|
|
136
|
+
const resolver = options.peerDependencyResolver ?? {
|
|
137
|
+
resolve: async () => ({}),
|
|
138
|
+
};
|
|
139
|
+
const peerCheckResult = await checkPeerDependencies(conflictChecked, validatedInput.projectMetadata.currentLibraries, resolver);
|
|
140
|
+
peerWarnings = peerCheckResult.warnings;
|
|
141
|
+
peerCheckedRecommendations = peerCheckResult.recommendations;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// Unexpected error — fall back to empty warnings and original recommendations
|
|
145
|
+
peerWarnings = [];
|
|
146
|
+
peerCheckedRecommendations = conflictChecked;
|
|
147
|
+
}
|
|
148
|
+
// -------------------------------------------------------------------------
|
|
149
|
+
// Step 6.5: Vulnerability scanning (optional — Phase 2)
|
|
150
|
+
// -------------------------------------------------------------------------
|
|
151
|
+
let vulnerabilityReport;
|
|
152
|
+
if (options.vulnClient) {
|
|
153
|
+
const defaultEcosystem = detectDefaultEcosystem(validatedInput.projectMetadata.packageManagers);
|
|
154
|
+
const vulnResult = await scanVulnerabilities({
|
|
155
|
+
currentLibraries: validatedInput.projectMetadata.currentLibraries,
|
|
156
|
+
recommendedChanges: peerCheckedRecommendations,
|
|
157
|
+
target: 'both',
|
|
158
|
+
defaultEcosystem,
|
|
159
|
+
}, options.vulnClient);
|
|
160
|
+
vulnerabilityReport = {
|
|
161
|
+
findings: vulnResult.findings.map((f) => ({
|
|
162
|
+
source: f.source,
|
|
163
|
+
packageName: f.packageName,
|
|
164
|
+
installedVersion: f.installedVersion,
|
|
165
|
+
ecosystem: f.ecosystem,
|
|
166
|
+
vulnerabilityId: f.vulnerability.id,
|
|
167
|
+
aliases: f.vulnerability.aliases,
|
|
168
|
+
severity: f.vulnerability.severity,
|
|
169
|
+
cvssScore: f.vulnerability.cvssScore,
|
|
170
|
+
summary: f.vulnerability.summary,
|
|
171
|
+
fixAvailable: f.fixAvailable,
|
|
172
|
+
recommendationIndex: f.recommendationIndex,
|
|
173
|
+
})),
|
|
174
|
+
summary: vulnResult.summary,
|
|
175
|
+
serviceUnavailable: vulnResult.serviceUnavailable,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
// -------------------------------------------------------------------------
|
|
179
|
+
// Step 7: Apply license filtering
|
|
180
|
+
// -------------------------------------------------------------------------
|
|
181
|
+
const { recommendations: filteredRecommendations, exclusions } = filterByLicense(peerCheckedRecommendations, validatedInput.constraints.licenseAllowlist);
|
|
182
|
+
// -------------------------------------------------------------------------
|
|
183
|
+
// Step 8: Build migration plan
|
|
184
|
+
// -------------------------------------------------------------------------
|
|
185
|
+
const migrationPlan = buildMigrationPlan(filteredRecommendations);
|
|
186
|
+
// -------------------------------------------------------------------------
|
|
187
|
+
// Step 9: Audit UX completeness
|
|
188
|
+
// -------------------------------------------------------------------------
|
|
189
|
+
const uxAuditResult = auditUxCompleteness(scanResult, validatedInput.projectMetadata);
|
|
190
|
+
// -------------------------------------------------------------------------
|
|
191
|
+
// Step 10: Auto-update existing dependencies (optional — Phase 2)
|
|
192
|
+
// -------------------------------------------------------------------------
|
|
193
|
+
let updatePlan;
|
|
194
|
+
if (validatedInput.updatePolicy?.enabled &&
|
|
195
|
+
options.registryClient) {
|
|
196
|
+
const policy = validatedInput.updatePolicy;
|
|
197
|
+
const defaultEcosystem = detectDefaultEcosystem(validatedInput.projectMetadata.packageManagers);
|
|
198
|
+
try {
|
|
199
|
+
// Fetch version info for all current libraries
|
|
200
|
+
const queries = Object.entries(validatedInput.projectMetadata.currentLibraries).map(([name, version]) => ({
|
|
201
|
+
ecosystem: defaultEcosystem,
|
|
202
|
+
packageName: name,
|
|
203
|
+
currentVersion: version,
|
|
204
|
+
}));
|
|
205
|
+
const versionInfoMap = await options.registryClient.getVersionInfoBatch(queries);
|
|
206
|
+
// Apply update policy
|
|
207
|
+
const candidates = applyUpdatePolicy(versionInfoMap, {
|
|
208
|
+
defaultStrategy: policy.defaultStrategy,
|
|
209
|
+
packageOverrides: policy.packageOverrides,
|
|
210
|
+
maxUpdates: policy.maxUpdates,
|
|
211
|
+
minAgeDays: policy.minAgeDays,
|
|
212
|
+
groupRelatedPackages: policy.groupRelatedPackages,
|
|
213
|
+
pinned: policy.pinned,
|
|
214
|
+
}, defaultEcosystem);
|
|
215
|
+
// Verify changelogs via Context7
|
|
216
|
+
const changelogs = await Promise.all(candidates.map((c) => verifyChangelog(context7Client, c.packageName, c.currentVersion, c.targetVersion)));
|
|
217
|
+
// Score each update
|
|
218
|
+
const scores = candidates.map((candidate, index) => scoreUpdate({
|
|
219
|
+
candidate,
|
|
220
|
+
changelog: changelogs[index],
|
|
221
|
+
}));
|
|
222
|
+
// Build update plan
|
|
223
|
+
updatePlan = buildUpdatePlan(candidates, scores, changelogs);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
// Registry unavailable — skip update plan silently
|
|
227
|
+
updatePlan = undefined;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// -------------------------------------------------------------------------
|
|
231
|
+
// Step 11: Assemble OutputSchema
|
|
232
|
+
// -------------------------------------------------------------------------
|
|
233
|
+
// Compute lines saved estimate from deletion checklist
|
|
234
|
+
const linesSavedEstimate = migrationPlan.deletionChecklist.reduce((total, item) => {
|
|
235
|
+
if (item.lineRange) {
|
|
236
|
+
return total + (item.lineRange.end - item.lineRange.start + 1);
|
|
237
|
+
}
|
|
238
|
+
return total;
|
|
239
|
+
}, 0);
|
|
240
|
+
// Collect files to delete from the deletion checklist
|
|
241
|
+
const filesToDelete = [
|
|
242
|
+
...new Set(migrationPlan.deletionChecklist.map((item) => item.filePath)),
|
|
243
|
+
];
|
|
244
|
+
const output = {
|
|
245
|
+
recommendedChanges: filteredRecommendations,
|
|
246
|
+
filesToDelete,
|
|
247
|
+
linesSavedEstimate,
|
|
248
|
+
uxAudit: uxAuditResult.items,
|
|
249
|
+
migrationPlan: {
|
|
250
|
+
phases: migrationPlan.phases,
|
|
251
|
+
deletionChecklist: migrationPlan.deletionChecklist,
|
|
252
|
+
peerDependencyWarnings: peerWarnings,
|
|
253
|
+
},
|
|
254
|
+
// Phase 2 optional sections
|
|
255
|
+
vulnerabilityReport,
|
|
256
|
+
updatePlan,
|
|
257
|
+
};
|
|
258
|
+
// -------------------------------------------------------------------------
|
|
259
|
+
// Step 12: PR auto-creation (optional — Phase 2)
|
|
260
|
+
// -------------------------------------------------------------------------
|
|
261
|
+
if (validatedInput.prPolicy?.enabled &&
|
|
262
|
+
options.platformClient &&
|
|
263
|
+
options.gitOps) {
|
|
264
|
+
const prPolicy = validatedInput.prPolicy;
|
|
265
|
+
const prPlans = planPRs({
|
|
266
|
+
output,
|
|
267
|
+
policy: {
|
|
268
|
+
enabled: prPolicy.enabled,
|
|
269
|
+
maxOpenPRs: prPolicy.maxOpenPRs,
|
|
270
|
+
groupUpdates: prPolicy.groupUpdates,
|
|
271
|
+
separateSecurityPRs: prPolicy.separateSecurityPRs,
|
|
272
|
+
createMigrationPRs: prPolicy.createMigrationPRs,
|
|
273
|
+
labels: prPolicy.labels,
|
|
274
|
+
reviewers: prPolicy.reviewers,
|
|
275
|
+
draft: prPolicy.draft,
|
|
276
|
+
branchPrefix: prPolicy.branchPrefix,
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
const prResults = await executePRPlans({
|
|
280
|
+
plans: prPlans,
|
|
281
|
+
platformClient: options.platformClient,
|
|
282
|
+
gitOps: options.gitOps,
|
|
283
|
+
labels: prPolicy.labels,
|
|
284
|
+
reviewers: prPolicy.reviewers,
|
|
285
|
+
draft: prPolicy.draft,
|
|
286
|
+
});
|
|
287
|
+
output.pullRequests = prResults;
|
|
288
|
+
}
|
|
289
|
+
// -------------------------------------------------------------------------
|
|
290
|
+
// Step 13: Serialize and return
|
|
291
|
+
// -------------------------------------------------------------------------
|
|
292
|
+
const json = serializeOutput(output);
|
|
293
|
+
const prettyJson = prettyPrint(output);
|
|
294
|
+
return {
|
|
295
|
+
success: true,
|
|
296
|
+
output,
|
|
297
|
+
json,
|
|
298
|
+
prettyJson,
|
|
299
|
+
exclusions,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
// Helpers
|
|
304
|
+
// ---------------------------------------------------------------------------
|
|
305
|
+
/**
|
|
306
|
+
* Detect default ecosystem from package manager list.
|
|
307
|
+
*/
|
|
308
|
+
function detectDefaultEcosystem(packageManagers) {
|
|
309
|
+
const ecosystemMap = {
|
|
310
|
+
npm: 'npm',
|
|
311
|
+
pnpm: 'npm',
|
|
312
|
+
yarn: 'npm',
|
|
313
|
+
bun: 'npm',
|
|
314
|
+
pip: 'PyPI',
|
|
315
|
+
cargo: 'crates.io',
|
|
316
|
+
go: 'Go',
|
|
317
|
+
};
|
|
318
|
+
for (const pm of packageManagers) {
|
|
319
|
+
const eco = ecosystemMap[pm];
|
|
320
|
+
if (eco)
|
|
321
|
+
return eco;
|
|
322
|
+
}
|
|
323
|
+
return 'npm';
|
|
324
|
+
}
|
|
325
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAOxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,wBAAwB,GAEzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,yBAAyB,GAE1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACL,qBAAqB,GAGtB,MAAM,sCAAsC,CAAC;AAI9C,OAAO,EAAE,mBAAmB,E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AG,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM;QACN,IAAI;QACJ,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;GAEG;AACH,SAAS,sBAAsB,CAAC,eAAyB;IACvD,MAAM,YAAY,GAA2B;QAC3C,GAAG,EAAE,KAAK;QACV,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,WAAW;QAClB,EAAE,EAAE,IAAI;KACT,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC;IACtB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RecommendedChange, AdapterStrategy } from '../schemas/output.schema.js';
|
|
2
|
+
export interface MigrationPlan {
|
|
3
|
+
phases: MigrationPhase[];
|
|
4
|
+
deletionChecklist: DeletionItem[];
|
|
5
|
+
}
|
|
6
|
+
export interface MigrationPhase {
|
|
7
|
+
phase: number;
|
|
8
|
+
name: string;
|
|
9
|
+
steps: MigrationStep[];
|
|
10
|
+
}
|
|
11
|
+
export interface MigrationStep {
|
|
12
|
+
recommendationIndex: number;
|
|
13
|
+
description: string;
|
|
14
|
+
adapterStrategy?: AdapterStrategy;
|
|
15
|
+
}
|
|
16
|
+
export interface DeletionItem {
|
|
17
|
+
filePath: string;
|
|
18
|
+
lineRange?: {
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
};
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build a phased migration plan from a list of recommendations.
|
|
26
|
+
*
|
|
27
|
+
* Phasing logic:
|
|
28
|
+
* - Phase 1: low-risk items
|
|
29
|
+
* - Phase 2: medium-risk items
|
|
30
|
+
* - Phase 3: high-risk items (with adapter strategies)
|
|
31
|
+
*
|
|
32
|
+
* Within each phase, items are ordered by composite score descending
|
|
33
|
+
* (highest impact first).
|
|
34
|
+
*
|
|
35
|
+
* Only phases that have items are included (empty phases are skipped).
|
|
36
|
+
*
|
|
37
|
+
* High-risk items MUST have an AdapterStrategy generated — if the input
|
|
38
|
+
* recommendation doesn't already have one, a default is generated.
|
|
39
|
+
*
|
|
40
|
+
* The deletion checklist includes EVERY filePath from recommendations.
|
|
41
|
+
*
|
|
42
|
+
* Empty recommendations → empty plan with zero phases.
|
|
43
|
+
*
|
|
44
|
+
* Requirements: 4.1, 4.2, 4.3, 4.4, 9.4
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildMigrationPlan(recommendations: RecommendedChange[]): MigrationPlan;
|
|
47
|
+
//# sourceMappingURL=migration-planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-planner.d.ts","sourceRoot":"","sources":["../../src/planner/migration-planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAMtF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,iBAAiB,EAAE,YAAY,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB;AAgBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,iBAAiB,EAAE,GACnC,aAAa,CAkDf"}
|