projscan 0.9.0 → 0.9.2
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 +72 -72
- package/dist/analyzers/deadCodeCheck.d.ts +2 -2
- package/dist/analyzers/deadCodeCheck.js +4 -4
- package/dist/analyzers/unusedDependencyCheck.js +1 -1
- package/dist/cli/index.js +11 -11
- package/dist/core/ast.d.ts +1 -1
- package/dist/core/ast.js +2 -2
- package/dist/core/auditRunner.d.ts +1 -1
- package/dist/core/auditRunner.js +6 -6
- package/dist/core/coverageJoin.d.ts +1 -1
- package/dist/core/coverageJoin.js +1 -1
- package/dist/core/coverageParser.js +3 -3
- package/dist/core/dependencyAnalyzer.js +6 -6
- package/dist/core/embeddings.d.ts +1 -1
- package/dist/core/embeddings.js +2 -2
- package/dist/core/fileInspector.js +6 -6
- package/dist/core/hotspotAnalyzer.js +2 -2
- package/dist/core/importGraph.d.ts +1 -1
- package/dist/core/importGraph.js +1 -1
- package/dist/core/indexCache.d.ts +2 -2
- package/dist/core/indexCache.js +4 -4
- package/dist/core/outdatedDetector.d.ts +1 -1
- package/dist/core/outdatedDetector.js +1 -1
- package/dist/core/searchIndex.js +2 -2
- package/dist/core/semanticSearch.d.ts +1 -1
- package/dist/core/semanticSearch.js +2 -2
- package/dist/core/upgradePreview.d.ts +12 -0
- package/dist/core/upgradePreview.js +55 -3
- package/dist/core/upgradePreview.js.map +1 -1
- package/dist/fixes/prettierFix.js +1 -1
- package/dist/fixes/testFix.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/chunker.d.ts +1 -1
- package/dist/mcp/chunker.js +1 -1
- package/dist/mcp/pagination.d.ts +2 -2
- package/dist/mcp/pagination.js +2 -2
- package/dist/mcp/progress.d.ts +1 -1
- package/dist/mcp/prompts.js +3 -3
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tokenBudget.d.ts +1 -1
- package/dist/mcp/tokenBudget.js +2 -2
- package/dist/mcp/tools.js +8 -8
- package/dist/reporters/consoleReporter.js +11 -11
- package/dist/reporters/markdownReporter.js +14 -14
- package/dist/reporters/sarifReporter.js +1 -1
- package/dist/utils/banner.d.ts +3 -3
- package/dist/utils/banner.js +9 -9
- package/dist/utils/config.js +1 -1
- package/dist/utils/packageJsonLocator.d.ts +1 -1
- package/dist/utils/packageJsonLocator.js +1 -1
- package/package.json +2 -2
|
@@ -2,9 +2,9 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
const DEPRECATED_PACKAGES = {
|
|
4
4
|
moment: 'Consider using date-fns or dayjs instead',
|
|
5
|
-
request: 'Deprecated
|
|
5
|
+
request: 'Deprecated - use node-fetch, undici, or axios instead',
|
|
6
6
|
'node-uuid': 'Renamed to uuid',
|
|
7
|
-
nomnom: 'Deprecated
|
|
7
|
+
nomnom: 'Deprecated - use commander or yargs instead',
|
|
8
8
|
'coffee-script': 'CoffeeScript is no longer maintained',
|
|
9
9
|
};
|
|
10
10
|
const HEAVY_PACKAGES = {
|
|
@@ -42,14 +42,14 @@ export async function analyzeDependencies(rootPath) {
|
|
|
42
42
|
if (totalDeps > 100) {
|
|
43
43
|
risks.push({
|
|
44
44
|
name: 'excessive-dependencies',
|
|
45
|
-
reason: `${totalDeps} production dependencies
|
|
45
|
+
reason: `${totalDeps} production dependencies - consider auditing for unused packages`,
|
|
46
46
|
severity: 'high',
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
else if (totalDeps > 50) {
|
|
50
50
|
risks.push({
|
|
51
51
|
name: 'many-dependencies',
|
|
52
|
-
reason: `${totalDeps} production dependencies
|
|
52
|
+
reason: `${totalDeps} production dependencies - review for opportunities to reduce`,
|
|
53
53
|
severity: 'medium',
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -58,7 +58,7 @@ export async function analyzeDependencies(rootPath) {
|
|
|
58
58
|
if (version === '*' || version.startsWith('>=')) {
|
|
59
59
|
risks.push({
|
|
60
60
|
name,
|
|
61
|
-
reason: `Wildcard version range "${version}"
|
|
61
|
+
reason: `Wildcard version range "${version}" - pin to a specific version for reproducible builds`,
|
|
62
62
|
severity: 'high',
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -68,7 +68,7 @@ export async function analyzeDependencies(rootPath) {
|
|
|
68
68
|
if (!hasLockfile && totalDeps > 0) {
|
|
69
69
|
risks.push({
|
|
70
70
|
name: 'no-lockfile',
|
|
71
|
-
reason: 'No lockfile found
|
|
71
|
+
reason: 'No lockfile found - run npm install to generate package-lock.json',
|
|
72
72
|
severity: 'medium',
|
|
73
73
|
});
|
|
74
74
|
}
|
package/dist/core/embeddings.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thin wrapper around `@xenova/transformers`
|
|
2
|
+
* Thin wrapper around `@xenova/transformers` - imported dynamically so we
|
|
3
3
|
* fail softly when the peer dep is absent.
|
|
4
4
|
*
|
|
5
5
|
* Design goals:
|
|
@@ -32,7 +32,7 @@ async function tryLoadTransformers() {
|
|
|
32
32
|
cachedModule = null;
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
|
-
// Unexpected load error
|
|
35
|
+
// Unexpected load error - treat as unavailable, log to stderr for diagnosis.
|
|
36
36
|
process.stderr.write(`[projscan] embeddings unavailable: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
37
37
|
cachedModule = null;
|
|
38
38
|
return null;
|
|
@@ -86,13 +86,13 @@ export function extractImports(content) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
// ES import
|
|
89
|
+
// ES import - optional `type` keyword for type-only imports.
|
|
90
90
|
const esImportRegex = /import\s+(?:type\s+)?(?:(?:\{[^}]*\}|[\w*]+(?:\s*,\s*\{[^}]*\})?|\*\s+as\s+\w+)\s+from\s+)?['"]([^'"]+)['"]/gm;
|
|
91
91
|
let match;
|
|
92
92
|
while ((match = esImportRegex.exec(content)) !== null) {
|
|
93
93
|
addSource(match[1]);
|
|
94
94
|
}
|
|
95
|
-
// ES re-export
|
|
95
|
+
// ES re-export - `export ... from '...'` counts as an import from the
|
|
96
96
|
// importer's point of view for graph-building purposes.
|
|
97
97
|
const esReexportRegex = /export\s+(?:type\s+)?(?:\{[^}]*\}|\*(?:\s+as\s+\w+)?)\s+from\s+['"]([^'"]+)['"]/gm;
|
|
98
98
|
while ((match = esReexportRegex.exec(content)) !== null) {
|
|
@@ -195,17 +195,17 @@ export function inferPurpose(filePath, exports) {
|
|
|
195
195
|
export function detectFileIssues(content, lineCount) {
|
|
196
196
|
const issues = [];
|
|
197
197
|
if (lineCount > 500)
|
|
198
|
-
issues.push(`Large file (${lineCount} lines)
|
|
198
|
+
issues.push(`Large file (${lineCount} lines) - consider splitting`);
|
|
199
199
|
if (lineCount > 1000)
|
|
200
|
-
issues.push('Very large file
|
|
200
|
+
issues.push('Very large file - strongly consider refactoring');
|
|
201
201
|
if (/console\.(log|warn|error|debug)\s*\(/.test(content)) {
|
|
202
|
-
issues.push('Contains console.log statements
|
|
202
|
+
issues.push('Contains console.log statements - consider using a proper logger');
|
|
203
203
|
}
|
|
204
204
|
if (/TODO|FIXME|HACK|XXX/i.test(content)) {
|
|
205
205
|
issues.push('Contains TODO/FIXME comments');
|
|
206
206
|
}
|
|
207
207
|
if (/:\s*any\b/.test(content) && /\.tsx?$/.test(content)) {
|
|
208
|
-
issues.push('Uses "any" type
|
|
208
|
+
issues.push('Uses "any" type - consider using proper types');
|
|
209
209
|
}
|
|
210
210
|
return issues;
|
|
211
211
|
}
|
|
@@ -18,7 +18,7 @@ export async function analyzeHotspots(rootPath, files, issues, options = {}) {
|
|
|
18
18
|
if (!isRepo) {
|
|
19
19
|
return {
|
|
20
20
|
available: false,
|
|
21
|
-
reason: 'Not a git repository
|
|
21
|
+
reason: 'Not a git repository - hotspot analysis requires git history',
|
|
22
22
|
window: { since: null, commitsScanned: 0 },
|
|
23
23
|
hotspots: [],
|
|
24
24
|
totalFilesRanked: 0,
|
|
@@ -263,7 +263,7 @@ function indexIssuesByFile(issues, files) {
|
|
|
263
263
|
index.set(file, list);
|
|
264
264
|
};
|
|
265
265
|
for (const issue of issues) {
|
|
266
|
-
// Prefer explicit locations when the analyzer supplied them
|
|
266
|
+
// Prefer explicit locations when the analyzer supplied them - this is
|
|
267
267
|
// exact and avoids the substring-false-positive problem where "src/a.ts"
|
|
268
268
|
// would match issues that only mention "src/ab.ts".
|
|
269
269
|
if (issue.locations && issue.locations.length > 0) {
|
|
@@ -10,7 +10,7 @@ export interface ImportGraph {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Walk source files and build an import graph. Now backed by AST-based
|
|
13
|
-
* codeGraph
|
|
13
|
+
* codeGraph - this function is retained for public API compatibility.
|
|
14
14
|
*/
|
|
15
15
|
export declare function buildImportGraph(rootPath: string, files: FileEntry[]): Promise<ImportGraph>;
|
|
16
16
|
/** Convert an import specifier to a bare package name. */
|
package/dist/core/importGraph.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildCodeGraph, toPackageName as graphToPackageName } from './codeGraph.js';
|
|
2
2
|
/**
|
|
3
3
|
* Walk source files and build an import graph. Now backed by AST-based
|
|
4
|
-
* codeGraph
|
|
4
|
+
* codeGraph - this function is retained for public API compatibility.
|
|
5
5
|
*/
|
|
6
6
|
export async function buildImportGraph(rootPath, files) {
|
|
7
7
|
const code = await buildCodeGraph(rootPath, files);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CodeGraph } from './codeGraph.js';
|
|
2
2
|
/**
|
|
3
3
|
* Load a previously cached code graph, if present and valid. Returns undefined
|
|
4
|
-
* when there's no cache or the cache is incompatible
|
|
4
|
+
* when there's no cache or the cache is incompatible - caller should rebuild.
|
|
5
5
|
*/
|
|
6
6
|
export declare function loadCachedGraph(rootPath: string): Promise<CodeGraph | undefined>;
|
|
7
7
|
/**
|
|
8
|
-
* Persist the graph. Creates .projscan-cache/ if needed. Swallows errors
|
|
8
|
+
* Persist the graph. Creates .projscan-cache/ if needed. Swallows errors -
|
|
9
9
|
* caching is best-effort, never blocks a run.
|
|
10
10
|
*/
|
|
11
11
|
export declare function saveCachedGraph(rootPath: string, graph: CodeGraph): Promise<void>;
|
package/dist/core/indexCache.js
CHANGED
|
@@ -5,7 +5,7 @@ const CACHE_FILE = 'graph.json';
|
|
|
5
5
|
const CACHE_VERSION = 1;
|
|
6
6
|
/**
|
|
7
7
|
* Load a previously cached code graph, if present and valid. Returns undefined
|
|
8
|
-
* when there's no cache or the cache is incompatible
|
|
8
|
+
* when there's no cache or the cache is incompatible - caller should rebuild.
|
|
9
9
|
*/
|
|
10
10
|
export async function loadCachedGraph(rootPath) {
|
|
11
11
|
const cachePath = path.join(rootPath, CACHE_DIR, CACHE_FILE);
|
|
@@ -38,7 +38,7 @@ export async function loadCachedGraph(rootPath) {
|
|
|
38
38
|
parseReason: entry.parseReason,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
// Derived indexes are rebuilt on load
|
|
41
|
+
// Derived indexes are rebuilt on load - cheap compared to re-parsing.
|
|
42
42
|
// Return a partial graph the caller will rehydrate via buildCodeGraph.
|
|
43
43
|
return {
|
|
44
44
|
files,
|
|
@@ -49,7 +49,7 @@ export async function loadCachedGraph(rootPath) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Persist the graph. Creates .projscan-cache/ if needed. Swallows errors
|
|
52
|
+
* Persist the graph. Creates .projscan-cache/ if needed. Swallows errors -
|
|
53
53
|
* caching is best-effort, never blocks a run.
|
|
54
54
|
*/
|
|
55
55
|
export async function saveCachedGraph(rootPath, graph) {
|
|
@@ -82,7 +82,7 @@ export async function saveCachedGraph(rootPath, graph) {
|
|
|
82
82
|
await fs.writeFile(gitignorePath, '*\n', 'utf-8');
|
|
83
83
|
}
|
|
84
84
|
catch {
|
|
85
|
-
// ignore
|
|
85
|
+
// ignore - cache is best-effort
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
export async function invalidateCache(rootPath) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OutdatedReport } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Offline outdated check
|
|
3
|
+
* Offline outdated check - compares the version declared in package.json
|
|
4
4
|
* to the version installed under node_modules/<pkg>/package.json.
|
|
5
5
|
*
|
|
6
6
|
* Does not hit the npm registry. `latest` is filled in only when a node_modules
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { drift as semverDrift } from '../utils/semver.js';
|
|
4
4
|
/**
|
|
5
|
-
* Offline outdated check
|
|
5
|
+
* Offline outdated check - compares the version declared in package.json
|
|
6
6
|
* to the version installed under node_modules/<pkg>/package.json.
|
|
7
7
|
*
|
|
8
8
|
* Does not hit the npm registry. `latest` is filled in only when a node_modules
|
package/dist/core/searchIndex.js
CHANGED
|
@@ -5,7 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
*
|
|
6
6
|
* We index three fields per file with different weights:
|
|
7
7
|
* - content (body tokens, BM25 baseline)
|
|
8
|
-
* - symbols (export names
|
|
8
|
+
* - symbols (export names - most informative for code search)
|
|
9
9
|
* - path (file path tokens)
|
|
10
10
|
*
|
|
11
11
|
* Scoring:
|
|
@@ -191,7 +191,7 @@ export function tokenize(input) {
|
|
|
191
191
|
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2');
|
|
192
192
|
const parts = camelSplit.split(/[_\s]+/).filter(Boolean);
|
|
193
193
|
for (const part of parts) {
|
|
194
|
-
// Split embedded digits from letters
|
|
194
|
+
// Split embedded digits from letters - e.g. "v1api" → "v", "1", "api"
|
|
195
195
|
const subparts = part.split(/(\d+)/).filter(Boolean);
|
|
196
196
|
for (const sp of subparts) {
|
|
197
197
|
const lower = sp.toLowerCase();
|
|
@@ -22,7 +22,7 @@ export interface SemanticHit {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Build (or refresh) a semantic index. Reuses cached embeddings for files
|
|
25
|
-
* whose mtime AND content hash match
|
|
25
|
+
* whose mtime AND content hash match - both guards are necessary because
|
|
26
26
|
* git checkouts can preserve mtime while swapping content.
|
|
27
27
|
*
|
|
28
28
|
* Returns null if the peer dep isn't available.
|
|
@@ -27,7 +27,7 @@ const INDEXABLE_EXTS = new Set([
|
|
|
27
27
|
]);
|
|
28
28
|
/**
|
|
29
29
|
* Build (or refresh) a semantic index. Reuses cached embeddings for files
|
|
30
|
-
* whose mtime AND content hash match
|
|
30
|
+
* whose mtime AND content hash match - both guards are necessary because
|
|
31
31
|
* git checkouts can preserve mtime while swapping content.
|
|
32
32
|
*
|
|
33
33
|
* Returns null if the peer dep isn't available.
|
|
@@ -120,7 +120,7 @@ export async function buildSemanticIndex(rootPath, files, options = {}) {
|
|
|
120
120
|
entries,
|
|
121
121
|
};
|
|
122
122
|
await saveCache(rootPath, index).catch(() => {
|
|
123
|
-
// best-effort
|
|
123
|
+
// best-effort - don't fail the search if cache write fails
|
|
124
124
|
});
|
|
125
125
|
return index;
|
|
126
126
|
}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
import type { FileEntry, UpgradePreview } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validate a package name against the npm grammar before any filesystem
|
|
4
|
+
* operation. Rejects traversal (`..`), absolute paths, backslashes, spaces,
|
|
5
|
+
* and any other shape that could escape node_modules/<name>/.
|
|
6
|
+
*
|
|
7
|
+
* This is security-critical: `previewUpgrade` is exposed via MCP
|
|
8
|
+
* (`projscan_upgrade`) where the argument comes from AI agents that can be
|
|
9
|
+
* influenced by untrusted content. A name containing `../` would otherwise
|
|
10
|
+
* escape node_modules and return arbitrary CHANGELOG / package.json contents
|
|
11
|
+
* to the caller.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isValidPackageName(name: string): boolean;
|
|
2
14
|
export declare function previewUpgrade(rootPath: string, pkgName: string, files: FileEntry[]): Promise<UpgradePreview>;
|
|
@@ -11,7 +11,47 @@ const BREAKING_MARKERS = [
|
|
|
11
11
|
/removed\s+support/i,
|
|
12
12
|
/no\s+longer\s+supported/i,
|
|
13
13
|
];
|
|
14
|
+
// npm package-name grammar: optional scope + name, letters/digits/._-
|
|
15
|
+
// No slashes other than the single scope separator. No `..`, no absolute paths.
|
|
16
|
+
const PACKAGE_NAME_RE = /^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*$/i;
|
|
17
|
+
/**
|
|
18
|
+
* Validate a package name against the npm grammar before any filesystem
|
|
19
|
+
* operation. Rejects traversal (`..`), absolute paths, backslashes, spaces,
|
|
20
|
+
* and any other shape that could escape node_modules/<name>/.
|
|
21
|
+
*
|
|
22
|
+
* This is security-critical: `previewUpgrade` is exposed via MCP
|
|
23
|
+
* (`projscan_upgrade`) where the argument comes from AI agents that can be
|
|
24
|
+
* influenced by untrusted content. A name containing `../` would otherwise
|
|
25
|
+
* escape node_modules and return arbitrary CHANGELOG / package.json contents
|
|
26
|
+
* to the caller.
|
|
27
|
+
*/
|
|
28
|
+
export function isValidPackageName(name) {
|
|
29
|
+
if (typeof name !== 'string')
|
|
30
|
+
return false;
|
|
31
|
+
if (name.length === 0 || name.length > 214)
|
|
32
|
+
return false;
|
|
33
|
+
if (name !== name.trim())
|
|
34
|
+
return false;
|
|
35
|
+
if (name.includes('..'))
|
|
36
|
+
return false;
|
|
37
|
+
if (name.includes('\\'))
|
|
38
|
+
return false;
|
|
39
|
+
return PACKAGE_NAME_RE.test(name);
|
|
40
|
+
}
|
|
14
41
|
export async function previewUpgrade(rootPath, pkgName, files) {
|
|
42
|
+
if (!isValidPackageName(pkgName)) {
|
|
43
|
+
return {
|
|
44
|
+
available: false,
|
|
45
|
+
reason: `Invalid package name: "${pkgName}". Must match the npm package-name grammar.`,
|
|
46
|
+
name: pkgName,
|
|
47
|
+
declared: null,
|
|
48
|
+
installed: null,
|
|
49
|
+
latest: null,
|
|
50
|
+
drift: 'unknown',
|
|
51
|
+
breakingMarkers: [],
|
|
52
|
+
importers: [],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
15
55
|
const declaredVersions = await readDeclaredVersion(rootPath, pkgName);
|
|
16
56
|
const installed = await readInstalledVersion(rootPath, pkgName);
|
|
17
57
|
const latest = installed; // offline mode: best we know without a registry
|
|
@@ -31,7 +71,7 @@ export async function previewUpgrade(rootPath, pkgName, files) {
|
|
|
31
71
|
if (!installed) {
|
|
32
72
|
return {
|
|
33
73
|
available: false,
|
|
34
|
-
reason: `Package "${pkgName}" not installed
|
|
74
|
+
reason: `Package "${pkgName}" not installed - run npm install and retry`,
|
|
35
75
|
name: pkgName,
|
|
36
76
|
declared: declaredVersions,
|
|
37
77
|
installed: null,
|
|
@@ -84,7 +124,11 @@ async function readDeclaredVersion(rootPath, name) {
|
|
|
84
124
|
}
|
|
85
125
|
}
|
|
86
126
|
async function readInstalledVersion(rootPath, name) {
|
|
87
|
-
const
|
|
127
|
+
const nodeModules = path.resolve(rootPath, 'node_modules');
|
|
128
|
+
const pkgDir = path.resolve(nodeModules, name);
|
|
129
|
+
if (!isInside(pkgDir, nodeModules))
|
|
130
|
+
return null;
|
|
131
|
+
const p = path.join(pkgDir, 'package.json');
|
|
88
132
|
try {
|
|
89
133
|
const raw = await fs.readFile(p, 'utf-8');
|
|
90
134
|
const pkg = JSON.parse(raw);
|
|
@@ -95,7 +139,10 @@ async function readInstalledVersion(rootPath, name) {
|
|
|
95
139
|
}
|
|
96
140
|
}
|
|
97
141
|
async function readChangelog(rootPath, name) {
|
|
98
|
-
const
|
|
142
|
+
const nodeModules = path.resolve(rootPath, 'node_modules');
|
|
143
|
+
const base = path.resolve(nodeModules, name);
|
|
144
|
+
if (!isInside(base, nodeModules))
|
|
145
|
+
return undefined;
|
|
99
146
|
for (const filename of CHANGELOG_NAMES) {
|
|
100
147
|
const p = path.join(base, filename);
|
|
101
148
|
try {
|
|
@@ -107,6 +154,11 @@ async function readChangelog(rootPath, name) {
|
|
|
107
154
|
}
|
|
108
155
|
return undefined;
|
|
109
156
|
}
|
|
157
|
+
/** True iff `candidate` resolves to `parent` itself or a path inside `parent`. */
|
|
158
|
+
function isInside(candidate, parent) {
|
|
159
|
+
const rel = path.relative(parent, candidate);
|
|
160
|
+
return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));
|
|
161
|
+
}
|
|
110
162
|
/**
|
|
111
163
|
* Extract the CHANGELOG section strictly *between* two versions (exclusive of
|
|
112
164
|
* the lower version's body, inclusive up to the upper version). If we can't
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradePreview.js","sourceRoot":"","sources":["../../src/core/upgradePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,KAAK,IAAI,WAAW,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC1G,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpE,MAAM,eAAe,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAElF,MAAM,gBAAgB,GAAG;IACvB,oBAAoB;IACpB,qBAAqB;IACrB,iBAAiB;IACjB,WAAW;IACX,oBAAoB;IACpB,0BAA0B;CAC3B,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,OAAe,EACf,KAAkB;IAElB,MAAM,gBAAgB,GAAG,MAAM,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtE,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,gDAAgD;IAE1E,IAAI,CAAC,gBAAgB,IA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1C,IAAI,CAAC,CAAC;gBAAE,SAAS;YACjB,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,CAAC,CAAC;gBAAE,SAAS;YACjB,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpC,MAAM,GAAG,CAAC,CAAC;gBACX,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAY;IACzC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,EAAE,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,GAAW;IACtC,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,iBAAiB,CAAC;AAC7C,CAAC"}
|
|
@@ -34,7 +34,7 @@ export const prettierFix = {
|
|
|
34
34
|
}
|
|
35
35
|
catch (err) {
|
|
36
36
|
if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
|
|
37
|
-
return; // No package.json
|
|
37
|
+
return; // No package.json - nothing to update
|
|
38
38
|
}
|
|
39
39
|
throw err; // Re-throw JSON parse errors or unexpected failures
|
|
40
40
|
}
|
package/dist/fixes/testFix.js
CHANGED
|
@@ -30,7 +30,7 @@ export const testFix = {
|
|
|
30
30
|
}
|
|
31
31
|
catch (err) {
|
|
32
32
|
if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
|
|
33
|
-
return; // No package.json
|
|
33
|
+
return; // No package.json - nothing to update
|
|
34
34
|
}
|
|
35
35
|
throw err; // Re-throw JSON parse errors or unexpected failures
|
|
36
36
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { inspectFile } from './core/fileInspector.js';
|
|
|
8
8
|
export { buildImportGraph, toPackageName, isPackageUsed, filesImporting } from './core/importGraph.js';
|
|
9
9
|
export { detectOutdated } from './core/outdatedDetector.js';
|
|
10
10
|
export { runAudit, auditFindingsToIssues } from './core/auditRunner.js';
|
|
11
|
-
export { previewUpgrade } from './core/upgradePreview.js';
|
|
11
|
+
export { previewUpgrade, isValidPackageName } from './core/upgradePreview.js';
|
|
12
12
|
export { parseCoverage, coverageMap } from './core/coverageParser.js';
|
|
13
13
|
export { joinCoverageWithHotspots } from './core/coverageJoin.js';
|
|
14
14
|
export { parseSource, isParseable } from './core/ast.js';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { inspectFile } from './core/fileInspector.js';
|
|
|
8
8
|
export { buildImportGraph, toPackageName, isPackageUsed, filesImporting } from './core/importGraph.js';
|
|
9
9
|
export { detectOutdated } from './core/outdatedDetector.js';
|
|
10
10
|
export { runAudit, auditFindingsToIssues } from './core/auditRunner.js';
|
|
11
|
-
export { previewUpgrade } from './core/upgradePreview.js';
|
|
11
|
+
export { previewUpgrade, isValidPackageName } from './core/upgradePreview.js';
|
|
12
12
|
export { parseCoverage, coverageMap } from './core/coverageParser.js';
|
|
13
13
|
export { joinCoverageWithHotspots } from './core/coverageJoin.js';
|
|
14
14
|
export { parseSource, isParseable } from './core/ast.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAA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C;AACpE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,OAAO,IAAI,aAAa,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/mcp/chunker.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* emit chunk blocks each containing a slice of the array.
|
|
9
9
|
* - Otherwise, emit a single block.
|
|
10
10
|
*
|
|
11
|
-
* Chunk size defaults to 20 records per block
|
|
11
|
+
* Chunk size defaults to 20 records per block - small enough to be a
|
|
12
12
|
* meaningful streaming unit, big enough to avoid pathological block counts.
|
|
13
13
|
*/
|
|
14
14
|
export interface ContentBlock {
|
package/dist/mcp/chunker.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* emit chunk blocks each containing a slice of the array.
|
|
9
9
|
* - Otherwise, emit a single block.
|
|
10
10
|
*
|
|
11
|
-
* Chunk size defaults to 20 records per block
|
|
11
|
+
* Chunk size defaults to 20 records per block - small enough to be a
|
|
12
12
|
* meaningful streaming unit, big enough to avoid pathological block counts.
|
|
13
13
|
*/
|
|
14
14
|
const DEFAULT_CHUNK_SIZE = 20;
|
package/dist/mcp/pagination.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface Page<T> {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Slice an array into a page. `checksum` should be a cheap identifier of
|
|
22
|
-
* the result-set shape (e.g., `items.length`)
|
|
22
|
+
* the result-set shape (e.g., `items.length`) - if it mismatches a cursor's
|
|
23
23
|
* captured checksum we treat the page as fresh (offset=0) rather than risk
|
|
24
24
|
* returning stale offsets.
|
|
25
25
|
*/
|
|
@@ -31,7 +31,7 @@ interface DecodedCursor {
|
|
|
31
31
|
export declare function encodeCursor(cursor: DecodedCursor): string;
|
|
32
32
|
export declare function decodeCursor(cursor?: string): DecodedCursor | null;
|
|
33
33
|
/**
|
|
34
|
-
* Compute a lightweight checksum for a list. Deliberately weak
|
|
34
|
+
* Compute a lightweight checksum for a list. Deliberately weak - we want
|
|
35
35
|
* cursor invalidation on shape changes (length) but not on micro-changes
|
|
36
36
|
* within items (scores that shift slightly between runs). Agents already
|
|
37
37
|
* handle eventual consistency.
|
package/dist/mcp/pagination.js
CHANGED
|
@@ -12,7 +12,7 @@ const DEFAULT_PAGE_SIZE = 50;
|
|
|
12
12
|
const MAX_PAGE_SIZE = 500;
|
|
13
13
|
/**
|
|
14
14
|
* Slice an array into a page. `checksum` should be a cheap identifier of
|
|
15
|
-
* the result-set shape (e.g., `items.length`)
|
|
15
|
+
* the result-set shape (e.g., `items.length`) - if it mismatches a cursor's
|
|
16
16
|
* captured checksum we treat the page as fresh (offset=0) rather than risk
|
|
17
17
|
* returning stale offsets.
|
|
18
18
|
*/
|
|
@@ -49,7 +49,7 @@ export function decodeCursor(cursor) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Compute a lightweight checksum for a list. Deliberately weak
|
|
52
|
+
* Compute a lightweight checksum for a list. Deliberately weak - we want
|
|
53
53
|
* cursor invalidation on shape changes (length) but not on micro-changes
|
|
54
54
|
* within items (scores that shift slightly between runs). Agents already
|
|
55
55
|
* handle eventual consistency.
|
package/dist/mcp/progress.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Per MCP spec, a client that wants progress sets `_meta.progressToken` on
|
|
5
5
|
* the tool-call request. We capture it at dispatch time and expose a
|
|
6
6
|
* `notify(progress, total?, message?)` callback to the tool handler via an
|
|
7
|
-
* AsyncLocalStorage context
|
|
7
|
+
* AsyncLocalStorage context - which means concurrent tool calls get their
|
|
8
8
|
* own isolated emitters (the naive module-level-variable approach had tools
|
|
9
9
|
* clobbering each other's progress streams under pipelined requests).
|
|
10
10
|
*
|
package/dist/mcp/prompts.js
CHANGED
|
@@ -53,10 +53,10 @@ async function prioritizeRefactoringPrompt(args, rootPath) {
|
|
|
53
53
|
const ownership = h.busFactorOne && h.primaryAuthor
|
|
54
54
|
? ` [BUS FACTOR 1: ${h.primaryAuthor}]`
|
|
55
55
|
: '';
|
|
56
|
-
return `${i + 1}. ${h.relativePath}
|
|
56
|
+
return `${i + 1}. ${h.relativePath} - risk ${h.riskScore.toFixed(1)} (${reasons})${ownership}`;
|
|
57
57
|
})
|
|
58
58
|
.join('\n')
|
|
59
|
-
: '(no hotspots available
|
|
59
|
+
: '(no hotspots available - project may not be a git repository)';
|
|
60
60
|
const topIssues = issues
|
|
61
61
|
.slice(0, 15)
|
|
62
62
|
.map((issue) => `- [${issue.severity}] ${issue.title}`)
|
|
@@ -104,7 +104,7 @@ async function investigateFilePrompt(args, rootPath) {
|
|
|
104
104
|
'Explain in order:',
|
|
105
105
|
'1. What this file does and how it fits in the codebase.',
|
|
106
106
|
'2. What is risky about it right now (cite evidence from the report).',
|
|
107
|
-
'3. Concrete next actions
|
|
107
|
+
'3. Concrete next actions - questions to ask, tests to add, or refactors to attempt.',
|
|
108
108
|
'4. Who to involve (based on ownership, if available).',
|
|
109
109
|
].join('\n');
|
|
110
110
|
return {
|
package/dist/mcp/server.js
CHANGED
|
@@ -32,7 +32,7 @@ export function createMcpServer(rootPath, options = {}) {
|
|
|
32
32
|
let initialized = false;
|
|
33
33
|
async function dispatch(request) {
|
|
34
34
|
const id = request.id ?? null;
|
|
35
|
-
// Notifications (no id)
|
|
35
|
+
// Notifications (no id) - no response expected.
|
|
36
36
|
const isNotification = request.id === undefined || request.id === null;
|
|
37
37
|
try {
|
|
38
38
|
switch (request.method) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Rough token estimator and record-aware truncator for MCP tool output.
|
|
3
3
|
*
|
|
4
4
|
* Uses the widely-used "~4 chars per token" heuristic. Good enough for
|
|
5
|
-
* prioritization
|
|
5
|
+
* prioritization - absolute accuracy is not required.
|
|
6
6
|
*/
|
|
7
7
|
export declare const CHARS_PER_TOKEN = 4;
|
|
8
8
|
export declare function estimateTokens(value: string): number;
|
package/dist/mcp/tokenBudget.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Rough token estimator and record-aware truncator for MCP tool output.
|
|
3
3
|
*
|
|
4
4
|
* Uses the widely-used "~4 chars per token" heuristic. Good enough for
|
|
5
|
-
* prioritization
|
|
5
|
+
* prioritization - absolute accuracy is not required.
|
|
6
6
|
*/
|
|
7
7
|
export const CHARS_PER_TOKEN = 4;
|
|
8
8
|
export function estimateTokens(value) {
|
|
@@ -55,7 +55,7 @@ function safeStringify(value) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Find top-level array field names
|
|
58
|
+
* Find top-level array field names - our convention is that MCP results
|
|
59
59
|
* expose a primary array (hotspots, entries, findings, files) worth
|
|
60
60
|
* trimming before scalar fields.
|
|
61
61
|
*/
|