@tractorcow/beefup 0.0.0 → 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/LICENSE +15 -0
- package/README.md +108 -0
- package/dist/__tests__/with-safe-chain-stubs.d.ts +5 -0
- package/dist/__tests__/with-safe-chain-stubs.js +25 -0
- package/dist/__tests__/with-safe-chain-stubs.js.map +1 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +6 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/args.d.ts +18 -0
- package/dist/cli/args.js +88 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.js +81 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/commands/accept.d.ts +16 -0
- package/dist/commands/accept.js +47 -0
- package/dist/commands/accept.js.map +1 -0
- package/dist/commands/report.d.ts +19 -0
- package/dist/commands/report.js +151 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/stage.d.ts +16 -0
- package/dist/commands/stage.js +60 -0
- package/dist/commands/stage.js.map +1 -0
- package/dist/config/load.d.ts +6 -0
- package/dist/config/load.js +103 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/types.d.ts +75 -0
- package/dist/config/types.js +68 -0
- package/dist/config/types.js.map +1 -0
- package/dist/diff/diff.d.ts +21 -0
- package/dist/diff/diff.js +132 -0
- package/dist/diff/diff.js.map +1 -0
- package/dist/diff/group.d.ts +5 -0
- package/dist/diff/group.js +24 -0
- package/dist/diff/group.js.map +1 -0
- package/dist/diff/types.d.ts +37 -0
- package/dist/diff/types.js +7 -0
- package/dist/diff/types.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/fsutil.d.ts +20 -0
- package/dist/fsutil.js +43 -0
- package/dist/fsutil.js.map +1 -0
- package/dist/lockfile/locked.d.ts +9 -0
- package/dist/lockfile/locked.js +15 -0
- package/dist/lockfile/locked.js.map +1 -0
- package/dist/lockfile/npm.d.ts +15 -0
- package/dist/lockfile/npm.js +152 -0
- package/dist/lockfile/npm.js.map +1 -0
- package/dist/lockfile/pnpm.d.ts +27 -0
- package/dist/lockfile/pnpm.js +155 -0
- package/dist/lockfile/pnpm.js.map +1 -0
- package/dist/lockfile/resolve.d.ts +10 -0
- package/dist/lockfile/resolve.js +20 -0
- package/dist/lockfile/resolve.js.map +1 -0
- package/dist/lockfile/types.d.ts +49 -0
- package/dist/lockfile/types.js +2 -0
- package/dist/lockfile/types.js.map +1 -0
- package/dist/pm/cve-lite-bin.d.ts +5 -0
- package/dist/pm/cve-lite-bin.js +36 -0
- package/dist/pm/cve-lite-bin.js.map +1 -0
- package/dist/pm/install.d.ts +24 -0
- package/dist/pm/install.js +30 -0
- package/dist/pm/install.js.map +1 -0
- package/dist/pm/runner.d.ts +17 -0
- package/dist/pm/runner.js +27 -0
- package/dist/pm/runner.js.map +1 -0
- package/dist/pm/safe-chain.d.ts +17 -0
- package/dist/pm/safe-chain.js +65 -0
- package/dist/pm/safe-chain.js.map +1 -0
- package/dist/pm/update.d.ts +16 -0
- package/dist/pm/update.js +25 -0
- package/dist/pm/update.js.map +1 -0
- package/dist/policy/alignment.d.ts +13 -0
- package/dist/policy/alignment.js +171 -0
- package/dist/policy/alignment.js.map +1 -0
- package/dist/policy/evaluate.d.ts +19 -0
- package/dist/policy/evaluate.js +75 -0
- package/dist/policy/evaluate.js.map +1 -0
- package/dist/policy/overrides.d.ts +42 -0
- package/dist/policy/overrides.js +358 -0
- package/dist/policy/overrides.js.map +1 -0
- package/dist/policy/ranges.d.ts +13 -0
- package/dist/policy/ranges.js +58 -0
- package/dist/policy/ranges.js.map +1 -0
- package/dist/project/collect.d.ts +15 -0
- package/dist/project/collect.js +60 -0
- package/dist/project/collect.js.map +1 -0
- package/dist/project/detect.d.ts +5 -0
- package/dist/project/detect.js +76 -0
- package/dist/project/detect.js.map +1 -0
- package/dist/project/direct-deps.d.ts +7 -0
- package/dist/project/direct-deps.js +28 -0
- package/dist/project/direct-deps.js.map +1 -0
- package/dist/project/package-json.d.ts +20 -0
- package/dist/project/package-json.js +6 -0
- package/dist/project/package-json.js.map +1 -0
- package/dist/project/paths.d.ts +31 -0
- package/dist/project/paths.js +45 -0
- package/dist/project/paths.js.map +1 -0
- package/dist/project/types.d.ts +13 -0
- package/dist/project/types.js +6 -0
- package/dist/project/types.js.map +1 -0
- package/dist/project/workspace.d.ts +14 -0
- package/dist/project/workspace.js +80 -0
- package/dist/project/workspace.js.map +1 -0
- package/dist/report/ansi.d.ts +31 -0
- package/dist/report/ansi.js +59 -0
- package/dist/report/ansi.js.map +1 -0
- package/dist/report/html.d.ts +6 -0
- package/dist/report/html.js +260 -0
- package/dist/report/html.js.map +1 -0
- package/dist/report/markdown.d.ts +6 -0
- package/dist/report/markdown.js +234 -0
- package/dist/report/markdown.js.map +1 -0
- package/dist/report/shared.d.ts +25 -0
- package/dist/report/shared.js +32 -0
- package/dist/report/shared.js.map +1 -0
- package/dist/report/text.d.ts +10 -0
- package/dist/report/text.js +156 -0
- package/dist/report/text.js.map +1 -0
- package/dist/report/types.d.ts +20 -0
- package/dist/report/types.js +2 -0
- package/dist/report/types.js.map +1 -0
- package/dist/rewrite/constraints.d.ts +20 -0
- package/dist/rewrite/constraints.js +64 -0
- package/dist/rewrite/constraints.js.map +1 -0
- package/dist/rewrite/repin.d.ts +8 -0
- package/dist/rewrite/repin.js +28 -0
- package/dist/rewrite/repin.js.map +1 -0
- package/dist/rewrite/workspace.d.ts +14 -0
- package/dist/rewrite/workspace.js +40 -0
- package/dist/rewrite/workspace.js.map +1 -0
- package/dist/security/classify.d.ts +48 -0
- package/dist/security/classify.js +86 -0
- package/dist/security/classify.js.map +1 -0
- package/dist/security/cve-lite.d.ts +7 -0
- package/dist/security/cve-lite.js +78 -0
- package/dist/security/cve-lite.js.map +1 -0
- package/dist/security/npm-audit.d.ts +10 -0
- package/dist/security/npm-audit.js +65 -0
- package/dist/security/npm-audit.js.map +1 -0
- package/dist/security/refs.d.ts +63 -0
- package/dist/security/refs.js +218 -0
- package/dist/security/refs.js.map +1 -0
- package/dist/security/scan.d.ts +13 -0
- package/dist/security/scan.js +32 -0
- package/dist/security/scan.js.map +1 -0
- package/dist/strategy/git.d.ts +16 -0
- package/dist/strategy/git.js +92 -0
- package/dist/strategy/git.js.map +1 -0
- package/dist/strategy/index.d.ts +7 -0
- package/dist/strategy/index.js +13 -0
- package/dist/strategy/index.js.map +1 -0
- package/dist/strategy/inplace.d.ts +30 -0
- package/dist/strategy/inplace.js +77 -0
- package/dist/strategy/inplace.js.map +1 -0
- package/dist/strategy/types.d.ts +13 -0
- package/dist/strategy/types.js +2 -0
- package/dist/strategy/types.js.map +1 -0
- package/dist/strategy/worktree.d.ts +26 -0
- package/dist/strategy/worktree.js +74 -0
- package/dist/strategy/worktree.js.map +1 -0
- package/package.json +60 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-deps.js","sourceRoot":"","sources":["../../src/project/direct-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,WAAmB;IAIpE,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;IAChD,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC5D,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAc,EAAE,CAAC,eAAe,CAAC,CAAC;QAChE,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,SAAS;YACX,CAAC;YACD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACtB,IAAI,KAAK,KAAK,sBAAsB,EAAE,CAAC;oBACrC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface PackageJson {
|
|
2
|
+
name?: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
packageManager?: string;
|
|
5
|
+
private?: boolean;
|
|
6
|
+
workspaces?: string[] | {
|
|
7
|
+
packages?: string[];
|
|
8
|
+
};
|
|
9
|
+
dependencies?: Record<string, string>;
|
|
10
|
+
devDependencies?: Record<string, string>;
|
|
11
|
+
optionalDependencies?: Record<string, string>;
|
|
12
|
+
peerDependencies?: Record<string, string>;
|
|
13
|
+
overrides?: Record<string, unknown>;
|
|
14
|
+
beefup?: unknown;
|
|
15
|
+
pnpm?: {
|
|
16
|
+
overrides?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const DIRECT_DEP_FIELDS: readonly ["dependencies", "devDependencies", "optionalDependencies"];
|
|
20
|
+
export type DirectDepField = (typeof DIRECT_DEP_FIELDS)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../src/project/package-json.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,cAAc;IACd,iBAAiB;IACjB,sBAAsB;CACd,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Relative directory name under the project root for Beefup state. */
|
|
2
|
+
export declare const BEEFUP_DIR = ".beefup";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the absolute path to the project's `.beefup` directory.
|
|
5
|
+
*/
|
|
6
|
+
export declare function beefupDir(projectRoot: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the absolute path to the staged proposal directory.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stagedDir(projectRoot: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the absolute path to the upgrade report output directory.
|
|
13
|
+
*/
|
|
14
|
+
export declare function reportDir(projectRoot: string): string;
|
|
15
|
+
/** File names written under `.beefup/report`. */
|
|
16
|
+
export declare const ReportFileNames: {
|
|
17
|
+
readonly Html: "REPORT.html";
|
|
18
|
+
readonly Json: "report.json";
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Returns the absolute path to the git worktree working directory.
|
|
22
|
+
*/
|
|
23
|
+
export declare function worktreeDir(projectRoot: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the absolute path to the inplace-strategy backup directory.
|
|
26
|
+
*/
|
|
27
|
+
export declare function backupDir(projectRoot: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the absolute path to the in-progress marker file.
|
|
30
|
+
*/
|
|
31
|
+
export declare function inProgressPath(projectRoot: string): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
/** Relative directory name under the project root for Beefup state. */
|
|
3
|
+
export const BEEFUP_DIR = ".beefup";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the absolute path to the project's `.beefup` directory.
|
|
6
|
+
*/
|
|
7
|
+
export function beefupDir(projectRoot) {
|
|
8
|
+
return path.join(projectRoot, BEEFUP_DIR);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns the absolute path to the staged proposal directory.
|
|
12
|
+
*/
|
|
13
|
+
export function stagedDir(projectRoot) {
|
|
14
|
+
return path.join(beefupDir(projectRoot), "staged");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns the absolute path to the upgrade report output directory.
|
|
18
|
+
*/
|
|
19
|
+
export function reportDir(projectRoot) {
|
|
20
|
+
return path.join(beefupDir(projectRoot), "report");
|
|
21
|
+
}
|
|
22
|
+
/** File names written under `.beefup/report`. */
|
|
23
|
+
export const ReportFileNames = {
|
|
24
|
+
Html: "REPORT.html",
|
|
25
|
+
Json: "report.json",
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Returns the absolute path to the git worktree working directory.
|
|
29
|
+
*/
|
|
30
|
+
export function worktreeDir(projectRoot) {
|
|
31
|
+
return path.join(beefupDir(projectRoot), "work");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the absolute path to the inplace-strategy backup directory.
|
|
35
|
+
*/
|
|
36
|
+
export function backupDir(projectRoot) {
|
|
37
|
+
return path.join(beefupDir(projectRoot), "backup");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns the absolute path to the in-progress marker file.
|
|
41
|
+
*/
|
|
42
|
+
export function inProgressPath(projectRoot) {
|
|
43
|
+
return path.join(beefupDir(projectRoot), "IN_PROGRESS");
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/project/paths.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,uEAAuE;AACvE,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;CACX,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,WAAmB;IAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Supported Node package managers for lockfile detection and updates. */
|
|
2
|
+
export declare const PackageManagers: {
|
|
3
|
+
readonly Npm: "npm";
|
|
4
|
+
readonly Pnpm: "pnpm";
|
|
5
|
+
};
|
|
6
|
+
/** Detected or configured package manager for a project. */
|
|
7
|
+
export type PackageManager = (typeof PackageManagers)[keyof typeof PackageManagers];
|
|
8
|
+
export interface DetectedProject {
|
|
9
|
+
root: string;
|
|
10
|
+
packageManager: PackageManager;
|
|
11
|
+
lockfileName: string;
|
|
12
|
+
lockfilePath: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/project/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface WorkspacePackage {
|
|
2
|
+
/** POSIX-style relative path from project root; "." for root */
|
|
3
|
+
relativeDir: string;
|
|
4
|
+
packageJsonPath: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Lists the root package plus every workspace package under npm/pnpm workspace globs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function listWorkspacePackages(root: string): Promise<WorkspacePackage[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Lists relative paths Beefup may rewrite: workspace package.json files, lockfile,
|
|
12
|
+
* and optional pnpm-workspace.yaml / .npmrc when present.
|
|
13
|
+
*/
|
|
14
|
+
export declare function listWritableRelativePaths(root: string, lockfileName: string): Promise<string[]>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { glob, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parse as parseYaml } from "yaml";
|
|
4
|
+
import { pathExists, readJsonFile } from "../fsutil.js";
|
|
5
|
+
/**
|
|
6
|
+
* Reads workspace glob patterns from package.json `workspaces` (array or object form).
|
|
7
|
+
*/
|
|
8
|
+
function workspacePatterns(pkg) {
|
|
9
|
+
if (!pkg.workspaces) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(pkg.workspaces)) {
|
|
13
|
+
return pkg.workspaces;
|
|
14
|
+
}
|
|
15
|
+
return pkg.workspaces.packages ?? [];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Lists the root package plus every workspace package under npm/pnpm workspace globs.
|
|
19
|
+
*/
|
|
20
|
+
export async function listWorkspacePackages(root) {
|
|
21
|
+
const packages = [
|
|
22
|
+
{
|
|
23
|
+
relativeDir: ".",
|
|
24
|
+
packageJsonPath: path.join(root, "package.json"),
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const seen = new Set(["."]);
|
|
28
|
+
const pkg = await readJsonFile(path.join(root, "package.json"));
|
|
29
|
+
let patterns = workspacePatterns(pkg);
|
|
30
|
+
const workspaceYaml = path.join(root, "pnpm-workspace.yaml");
|
|
31
|
+
if (await pathExists(workspaceYaml)) {
|
|
32
|
+
const parsed = parseYaml(await readFile(workspaceYaml, "utf8"));
|
|
33
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
34
|
+
const listed = parsed.packages;
|
|
35
|
+
if (Array.isArray(listed)) {
|
|
36
|
+
patterns = listed.filter((item) => typeof item === "string");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const pattern of patterns) {
|
|
41
|
+
if (pattern.startsWith("!")) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const globPattern = path.posix.join(pattern.replace(/\/$/, ""), "package.json");
|
|
45
|
+
for await (const match of glob(globPattern, { cwd: root })) {
|
|
46
|
+
const relDir = path.posix.dirname(match.replaceAll("\\", "/"));
|
|
47
|
+
if (seen.has(relDir)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
seen.add(relDir);
|
|
51
|
+
packages.push({
|
|
52
|
+
relativeDir: relDir,
|
|
53
|
+
packageJsonPath: path.join(root, match),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return packages;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Lists relative paths Beefup may rewrite: workspace package.json files, lockfile,
|
|
61
|
+
* and optional pnpm-workspace.yaml / .npmrc when present.
|
|
62
|
+
*/
|
|
63
|
+
export async function listWritableRelativePaths(root, lockfileName) {
|
|
64
|
+
const rels = [];
|
|
65
|
+
const workspaces = await listWorkspacePackages(root);
|
|
66
|
+
for (const ws of workspaces) {
|
|
67
|
+
rels.push(ws.relativeDir === "."
|
|
68
|
+
? "package.json"
|
|
69
|
+
: path.posix.join(ws.relativeDir, "package.json"));
|
|
70
|
+
}
|
|
71
|
+
rels.push(lockfileName);
|
|
72
|
+
if (await pathExists(path.join(root, "pnpm-workspace.yaml"))) {
|
|
73
|
+
rels.push("pnpm-workspace.yaml");
|
|
74
|
+
}
|
|
75
|
+
if (await pathExists(path.join(root, ".npmrc"))) {
|
|
76
|
+
rels.push(".npmrc");
|
|
77
|
+
}
|
|
78
|
+
return rels;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/project/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AASxD;;GAEG;AACH,SAAS,iBAAiB,CAAC,GAAgB;IACzC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,OAAO,GAAG,CAAC,UAAU,CAAC;IACxB,CAAC;IACD,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAY;IAEZ,MAAM,QAAQ,GAAuB;QACnC;YACE,WAAW,EAAE,GAAG;YAChB,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;SACjD;KACF,CAAC;IACF,MAAM,IAAI,GAA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CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type FindingSeverity } from "../security/classify.js";
|
|
2
|
+
/** Environment variables that enable or disable ANSI colour. */
|
|
3
|
+
export declare const ColorEnv: {
|
|
4
|
+
readonly NoColor: "NO_COLOR";
|
|
5
|
+
readonly ForceColor: "FORCE_COLOR";
|
|
6
|
+
};
|
|
7
|
+
/** ANSI SGR codes used by the colour console report. */
|
|
8
|
+
export declare const Ansi: {
|
|
9
|
+
readonly Reset: "\u001B[0m";
|
|
10
|
+
readonly Bold: "\u001B[1m";
|
|
11
|
+
readonly Dim: "\u001B[2m";
|
|
12
|
+
readonly Red: "\u001B[31m";
|
|
13
|
+
readonly Green: "\u001B[32m";
|
|
14
|
+
readonly Yellow: "\u001B[33m";
|
|
15
|
+
readonly Blue: "\u001B[34m";
|
|
16
|
+
readonly Magenta: "\u001B[35m";
|
|
17
|
+
readonly Cyan: "\u001B[36m";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether ANSI colour should be emitted for console reports.
|
|
21
|
+
* `NO_COLOR` wins; `FORCE_COLOR` enables colour when stdout is not a TTY.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ansiColorEnabled(stdoutTty?: boolean): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Wraps `text` in ANSI codes when colour is enabled.
|
|
26
|
+
*/
|
|
27
|
+
export declare function paint(codes: string | readonly string[], text: string, enabled: boolean): string;
|
|
28
|
+
/**
|
|
29
|
+
* Returns ANSI codes for a vulnerability severity (critical/high stand out).
|
|
30
|
+
*/
|
|
31
|
+
export declare function ansiForSeverity(severity: FindingSeverity): readonly string[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FindingSeverities } from "../security/classify.js";
|
|
2
|
+
/** Environment variables that enable or disable ANSI colour. */
|
|
3
|
+
export const ColorEnv = {
|
|
4
|
+
NoColor: "NO_COLOR",
|
|
5
|
+
ForceColor: "FORCE_COLOR",
|
|
6
|
+
};
|
|
7
|
+
/** ANSI SGR codes used by the colour console report. */
|
|
8
|
+
export const Ansi = {
|
|
9
|
+
Reset: "\x1b[0m",
|
|
10
|
+
Bold: "\x1b[1m",
|
|
11
|
+
Dim: "\x1b[2m",
|
|
12
|
+
Red: "\x1b[31m",
|
|
13
|
+
Green: "\x1b[32m",
|
|
14
|
+
Yellow: "\x1b[33m",
|
|
15
|
+
Blue: "\x1b[34m",
|
|
16
|
+
Magenta: "\x1b[35m",
|
|
17
|
+
Cyan: "\x1b[36m",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Returns whether ANSI colour should be emitted for console reports.
|
|
21
|
+
* `NO_COLOR` wins; `FORCE_COLOR` enables colour when stdout is not a TTY.
|
|
22
|
+
*/
|
|
23
|
+
export function ansiColorEnabled(stdoutTty = process.stdout.isTTY) {
|
|
24
|
+
if (process.env[ColorEnv.NoColor]) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (process.env[ColorEnv.ForceColor]) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return Boolean(stdoutTty);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Wraps `text` in ANSI codes when colour is enabled.
|
|
34
|
+
*/
|
|
35
|
+
export function paint(codes, text, enabled) {
|
|
36
|
+
if (!enabled || text.length === 0) {
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
const prefix = typeof codes === "string" ? codes : codes.join("");
|
|
40
|
+
return `${prefix}${text}${Ansi.Reset}`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns ANSI codes for a vulnerability severity (critical/high stand out).
|
|
44
|
+
*/
|
|
45
|
+
export function ansiForSeverity(severity) {
|
|
46
|
+
switch (severity) {
|
|
47
|
+
case FindingSeverities.Critical:
|
|
48
|
+
return [Ansi.Bold, Ansi.Magenta];
|
|
49
|
+
case FindingSeverities.High:
|
|
50
|
+
return [Ansi.Bold, Ansi.Red];
|
|
51
|
+
case FindingSeverities.Moderate:
|
|
52
|
+
return [Ansi.Yellow];
|
|
53
|
+
case FindingSeverities.Low:
|
|
54
|
+
return [Ansi.Blue];
|
|
55
|
+
case FindingSeverities.Info:
|
|
56
|
+
return [Ansi.Dim];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ansi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../src/report/ansi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,yBAAyB,CAAC;AAElF,gEAAgE;AAChE,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,aAAa;CACjB,CAAC;AAEX,wDAAwD;AACxD,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;CACR,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK;IAC/D,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CACnB,KAAiC,EACjC,IAAY,EACZ,OAAgB;IAEhB,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClE,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAyB;IACvD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,iBAAiB,CAAC,QAAQ;YAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,KAAK,iBAAiB,CAAC,IAAI;YACzB,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,KAAK,iBAAiB,CAAC,QAAQ;YAC7B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,KAAK,iBAAiB,CAAC,GAAG;YACxB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,KAAK,iBAAiB,CAAC,IAAI;YACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { AlignmentActions } from "../config/types.js";
|
|
2
|
+
import { formatUniqueVersions } from "../diff/diff.js";
|
|
3
|
+
import { groupByChangeType } from "../diff/group.js";
|
|
4
|
+
import { META_VULN_TITLE } from "../security/npm-audit.js";
|
|
5
|
+
import { packageChangeCounts, policyIssueCount, SecuritySectionIntros, SecuritySectionTitles, } from "./shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* Escapes text for HTML element content and quoted attributes.
|
|
8
|
+
*/
|
|
9
|
+
function escapeHtml(value) {
|
|
10
|
+
return value
|
|
11
|
+
.replaceAll("&", "&")
|
|
12
|
+
.replaceAll("<", "<")
|
|
13
|
+
.replaceAll(">", ">")
|
|
14
|
+
.replaceAll('"', """);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* CSS class suffix for a finding or policy severity (`sev-high`, `sev-error`, …).
|
|
18
|
+
*/
|
|
19
|
+
function severityClass(severity) {
|
|
20
|
+
return `sev-${severity}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Renders a package name as strong (direct) or em (transitive).
|
|
24
|
+
*/
|
|
25
|
+
function formatPackageName(change) {
|
|
26
|
+
const name = escapeHtml(change.name);
|
|
27
|
+
if (change.direct) {
|
|
28
|
+
return `<strong>${name}</strong>`;
|
|
29
|
+
}
|
|
30
|
+
return `<em>${name}</em>`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Wraps unique version tags in a from or to colour span, leaving empty marks plain.
|
|
34
|
+
*/
|
|
35
|
+
function formatVersionHtml(versions, side) {
|
|
36
|
+
const escaped = escapeHtml(versions);
|
|
37
|
+
if (versions.length === 0 || versions === "—") {
|
|
38
|
+
return escaped;
|
|
39
|
+
}
|
|
40
|
+
return `<span class="ver-${side}">${escaped}</span>`;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Renders advisory links, or a meta-vuln via label.
|
|
44
|
+
*/
|
|
45
|
+
function formatFindingReferences(finding) {
|
|
46
|
+
if (finding.refs.length > 0) {
|
|
47
|
+
return finding.refs
|
|
48
|
+
.map((ref) => `<a href="${escapeHtml(ref.url)}">${escapeHtml(ref.id)}</a>`)
|
|
49
|
+
.join(", ");
|
|
50
|
+
}
|
|
51
|
+
if (finding.viaPackages && finding.viaPackages.length > 0) {
|
|
52
|
+
const via = finding.viaPackages
|
|
53
|
+
.map((name) => `<code>${escapeHtml(name)}</code>`)
|
|
54
|
+
.join(", ");
|
|
55
|
+
return `transitive (via ${via})`;
|
|
56
|
+
}
|
|
57
|
+
return "—";
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Builds an HTML table for changed packages (from/to version columns).
|
|
61
|
+
*/
|
|
62
|
+
function formatChangedTable(changes) {
|
|
63
|
+
const rows = changes.map((change) => {
|
|
64
|
+
return `<tr><td>${formatPackageName(change)}</td><td>${formatVersionHtml(formatUniqueVersions(change.from), "from")}</td><td>${formatVersionHtml(formatUniqueVersions(change.to), "to")}</td></tr>`;
|
|
65
|
+
});
|
|
66
|
+
return `<table><thead><tr><th>Package</th><th>From</th><th>To</th></tr></thead><tbody>${rows.join("")}</tbody></table>`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Builds a single-column version table for added or removed packages.
|
|
70
|
+
*/
|
|
71
|
+
function formatSingleVersionTable(changes, side) {
|
|
72
|
+
const rows = changes.map((change) => {
|
|
73
|
+
const versions = side === "to"
|
|
74
|
+
? formatUniqueVersions(change.to)
|
|
75
|
+
: formatUniqueVersions(change.from);
|
|
76
|
+
return `<tr><td>${formatPackageName(change)}</td><td>${formatVersionHtml(versions, side)}</td></tr>`;
|
|
77
|
+
});
|
|
78
|
+
return `<table><thead><tr><th>Package</th><th>Version</th></tr></thead><tbody>${rows.join("")}</tbody></table>`;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Formats one list of changes into collapsible changed/added/removed blocks.
|
|
82
|
+
*/
|
|
83
|
+
function formatChangeGroups(changes) {
|
|
84
|
+
const byType = groupByChangeType(changes);
|
|
85
|
+
const parts = [];
|
|
86
|
+
if (byType.changed.length > 0) {
|
|
87
|
+
parts.push(`<details open><summary>Changed Packages (${byType.changed.length})</summary>${formatChangedTable(byType.changed)}</details>`);
|
|
88
|
+
}
|
|
89
|
+
if (byType.added.length > 0) {
|
|
90
|
+
parts.push(`<details open><summary>Added Packages (${byType.added.length})</summary>${formatSingleVersionTable(byType.added, "to")}</details>`);
|
|
91
|
+
}
|
|
92
|
+
if (byType.removed.length > 0) {
|
|
93
|
+
parts.push(`<details open><summary>Removed Packages (${byType.removed.length})</summary>${formatSingleVersionTable(byType.removed, "from")}</details>`);
|
|
94
|
+
}
|
|
95
|
+
return parts.join("");
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Splits changes into required vs optional/platform and renders both sections.
|
|
99
|
+
*/
|
|
100
|
+
function formatDependencyBucket(title, changes) {
|
|
101
|
+
if (changes.length === 0) {
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
const required = changes.filter((change) => !change.optional);
|
|
105
|
+
const optional = changes.filter((change) => change.optional);
|
|
106
|
+
const parts = [`<h2>${escapeHtml(title)}</h2>`];
|
|
107
|
+
if (required.length > 0) {
|
|
108
|
+
parts.push(formatChangeGroups(required));
|
|
109
|
+
}
|
|
110
|
+
if (optional.length > 0) {
|
|
111
|
+
parts.push(`<h3>Optional / platform (${optional.length})</h3>`, formatChangeGroups(optional));
|
|
112
|
+
}
|
|
113
|
+
return parts.join("");
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Formats an HTML section listing security findings.
|
|
117
|
+
*/
|
|
118
|
+
function formatFindings(title, intro, findings, kind) {
|
|
119
|
+
if (findings.length === 0) {
|
|
120
|
+
return "";
|
|
121
|
+
}
|
|
122
|
+
const rows = findings.map((item) => {
|
|
123
|
+
const titleText = item.title?.trim() || "—";
|
|
124
|
+
return `<tr><td><span class="badge ${severityClass(item.severity)}">${escapeHtml(item.severity)}</span></td><td>${escapeHtml(titleText)}</td><td>${formatFindingReferences(item)}</td><td><code>${escapeHtml(item.packageName)}</code></td></tr>`;
|
|
125
|
+
});
|
|
126
|
+
return `<section class="findings ${kind}"><h3>${escapeHtml(title)} (${findings.length})</h3><p>${escapeHtml(intro)}</p><table><thead><tr><th>Severity</th><th>Title</th><th>References</th><th>Package</th></tr></thead><tbody>${rows.join("")}</tbody></table></section>`;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Renders the top-of-report summary with package and security counts.
|
|
130
|
+
*/
|
|
131
|
+
function formatSummary(report) {
|
|
132
|
+
const packages = packageChangeCounts(report);
|
|
133
|
+
const { fixed, introduced, unresolved } = report.security;
|
|
134
|
+
const policy = policyIssueCount(report);
|
|
135
|
+
const items = [
|
|
136
|
+
`<li>Mode: <code>${escapeHtml(report.mode)}</code></li>`,
|
|
137
|
+
`<li>Strategy: <code>${escapeHtml(report.strategy)}</code></li>`,
|
|
138
|
+
`<li>Package manager: <code>${escapeHtml(report.packageManager)}</code></li>`,
|
|
139
|
+
];
|
|
140
|
+
if (report.beefupVersion) {
|
|
141
|
+
items.push(`<li>Beefup: <code>${escapeHtml(report.beefupVersion)}</code></li>`);
|
|
142
|
+
}
|
|
143
|
+
if (report.generatedAt) {
|
|
144
|
+
items.push(`<li>Generated: <code>${escapeHtml(report.generatedAt)}</code></li>`);
|
|
145
|
+
}
|
|
146
|
+
items.push(`<li>Packages: <strong>${packages.changed}</strong> changed, <strong>${packages.added}</strong> added, <strong>${packages.removed}</strong> removed</li>`, `<li>Security: <strong class="ver-from">${introduced.length}</strong> introduced, <strong class="unresolved-count">${unresolved.length}</strong> unresolved, <strong class="ver-to">${fixed.length}</strong> fixed</li>`, `<li>Policy: ${policy === 0 ? "<strong>no issues</strong>" : `<strong>${policy}</strong> issue(s)`}</li>`);
|
|
147
|
+
if (introduced.length === 0) {
|
|
148
|
+
items.push("<li>No CVEs introduced by this staged upgrade</li>");
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
items.push(`<li class="warn">Warning: ${introduced.length} CVE(s) introduced — review before accept</li>`);
|
|
152
|
+
}
|
|
153
|
+
return `<section><h2>Summary</h2><ul>${items.join("")}</ul></section>`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Renders the policy section.
|
|
157
|
+
*/
|
|
158
|
+
function formatPolicy(report) {
|
|
159
|
+
if (policyIssueCount(report) === 0) {
|
|
160
|
+
return `<section><h2>Policy</h2><p>No policy issues.</p></section>`;
|
|
161
|
+
}
|
|
162
|
+
const items = [];
|
|
163
|
+
for (const item of report.ranges) {
|
|
164
|
+
items.push(`<li><span class="badge ${severityClass(item.severity)}">${escapeHtml(item.severity)}</span> ${escapeHtml(item.message)}</li>`);
|
|
165
|
+
}
|
|
166
|
+
for (const item of report.overrides) {
|
|
167
|
+
items.push(`<li><span class="badge ${severityClass(AlignmentActions.Error)}">${escapeHtml(AlignmentActions.Error)}</span> [${escapeHtml(item.override)}] ${escapeHtml(item.message)}</li>`);
|
|
168
|
+
}
|
|
169
|
+
for (const item of report.alignment) {
|
|
170
|
+
items.push(`<li><span class="badge ${severityClass(item.severity)}">${escapeHtml(item.severity)}</span> [${escapeHtml(item.group)}] ${escapeHtml(item.message)}</li>`);
|
|
171
|
+
}
|
|
172
|
+
return `<section><h2>Policy</h2><ul>${items.join("")}</ul></section>`;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Embedded stylesheet for the HTML report (severity colours and version diffs).
|
|
176
|
+
*/
|
|
177
|
+
function reportStyles() {
|
|
178
|
+
return `
|
|
179
|
+
:root { color-scheme: light dark; --bg: #f6f7f9; --fg: #1b1f24; --card: #fff; --muted: #5c6570; --line: #d8dee6; --from: #c62828; --to: #2e7d32; --warn: #c62828; --unresolved: #f9a825; }
|
|
180
|
+
@media (prefers-color-scheme: dark) { :root { --bg: #12151a; --fg: #e8eaed; --card: #1c2128; --muted: #9aa3ad; --line: #30363d; --from: #ff8a80; --to: #81c784; --warn: #ff8a80; --unresolved: #ffd54f; } }
|
|
181
|
+
html { font-family: ui-sans-serif, system-ui, sans-serif; background: var(--bg); color: var(--fg); }
|
|
182
|
+
body { margin: 0; }
|
|
183
|
+
main { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
|
|
184
|
+
h1, h2, h3 { line-height: 1.25; }
|
|
185
|
+
h1 { font-size: 1.6rem; }
|
|
186
|
+
section, details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; margin: 1rem 0; }
|
|
187
|
+
.findings.introduced { border-left: 4px solid var(--from); }
|
|
188
|
+
.findings.unresolved { border-left: 4px solid var(--unresolved); }
|
|
189
|
+
.findings.fixed { border-left: 4px solid var(--to); }
|
|
190
|
+
.warn { color: var(--warn); font-weight: 600; }
|
|
191
|
+
.ver-from { color: var(--from); text-decoration: line-through; }
|
|
192
|
+
.ver-to { color: var(--to); font-weight: 600; }
|
|
193
|
+
.unresolved-count { color: var(--unresolved); }
|
|
194
|
+
table { width: 100%; border-collapse: collapse; margin-top: 0.6rem; }
|
|
195
|
+
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
196
|
+
th { color: var(--muted); font-weight: 600; }
|
|
197
|
+
.badge { display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
|
|
198
|
+
.sev-critical { background: #6a1b9a; color: #fff; }
|
|
199
|
+
.sev-high { background: #c62828; color: #fff; }
|
|
200
|
+
.sev-moderate { background: #f9a825; color: #111; }
|
|
201
|
+
.sev-low { background: #1565c0; color: #fff; }
|
|
202
|
+
.sev-info { background: #546e7a; color: #fff; }
|
|
203
|
+
.sev-error { background: #c62828; color: #fff; }
|
|
204
|
+
.sev-warn { background: #f9a825; color: #111; }
|
|
205
|
+
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
|
|
206
|
+
a { color: inherit; }
|
|
207
|
+
footer { color: var(--muted); font-size: 0.9rem; }
|
|
208
|
+
`.trim();
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Renders footer legend and path hints.
|
|
212
|
+
*/
|
|
213
|
+
function formatFooter() {
|
|
214
|
+
return `<footer><h2>Legend</h2><ul><li><strong>Bold</strong> package names are direct dependencies (declared in a workspace <code>package.json</code>).</li><li><em>Italic</em> package names are transitive.</li><li><strong>Optional / platform</strong> sections list packages marked optional in the lockfile or <code>optionalDependencies</code> (still security-scanned).</li><li>Security rows titled “${escapeHtml(META_VULN_TITLE)}” are npm meta-vulns: the package has no advisory of its own but depends on a vulnerable package.</li></ul><h2>Paths</h2><ul><li>Staged proposal: <code>.beefup/staged</code></li><li>This report: <code>.beefup/report</code></li></ul></footer>`;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Renders a stage report as a self-contained HTML document.
|
|
218
|
+
* Uses colour for severity badges and from/to version comparisons.
|
|
219
|
+
*/
|
|
220
|
+
export function renderHtml(report) {
|
|
221
|
+
const security = [
|
|
222
|
+
formatFindings(SecuritySectionTitles.Introduced, SecuritySectionIntros.Introduced, report.security.introduced, "introduced"),
|
|
223
|
+
formatFindings(SecuritySectionTitles.Unresolved, SecuritySectionIntros.Unresolved, report.security.unresolved, "unresolved"),
|
|
224
|
+
formatFindings(SecuritySectionTitles.Fixed, SecuritySectionIntros.Fixed, report.security.fixed, "fixed"),
|
|
225
|
+
]
|
|
226
|
+
.filter((section) => section.length > 0)
|
|
227
|
+
.join("") || "<p>No security findings.</p>";
|
|
228
|
+
const deps = formatDependencyBucket("Dependencies", report.diff.dependencies);
|
|
229
|
+
const devDeps = formatDependencyBucket("Dev Dependencies", report.diff.devDependencies);
|
|
230
|
+
let warnings = "";
|
|
231
|
+
if (report.warnings.length > 0) {
|
|
232
|
+
const items = report.warnings
|
|
233
|
+
.map((warning) => `<li>${escapeHtml(warning)}</li>`)
|
|
234
|
+
.join("");
|
|
235
|
+
warnings = `<section><h2>Warnings</h2><ul>${items}</ul></section>`;
|
|
236
|
+
}
|
|
237
|
+
return `<!DOCTYPE html>
|
|
238
|
+
<html lang="en">
|
|
239
|
+
<head>
|
|
240
|
+
<meta charset="utf-8"/>
|
|
241
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
242
|
+
<title>Beefup upgrade report</title>
|
|
243
|
+
<style>${reportStyles()}</style>
|
|
244
|
+
</head>
|
|
245
|
+
<body>
|
|
246
|
+
<main>
|
|
247
|
+
<h1>Beefup upgrade report</h1>
|
|
248
|
+
${formatSummary(report)}
|
|
249
|
+
<section><h2>Security</h2>${security}</section>
|
|
250
|
+
${formatPolicy(report)}
|
|
251
|
+
${deps}
|
|
252
|
+
${devDeps}
|
|
253
|
+
${warnings}
|
|
254
|
+
${formatFooter()}
|
|
255
|
+
</main>
|
|
256
|
+
</body>
|
|
257
|
+
</html>
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/report/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,QAAgB;IACrC,OAAO,OAAO,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,MAAqB;IAC9C,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,WAAW,IAAI,WAAW,CAAC;IACpC,CAAC;IACD,OAAO,OAAO,IAAI,OAAO,CAAC;AAC5B,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,KAAK,EAC3B,qBAAqB,CAAC,KAAK,EAC3B,MAAM,CAAC,QAAQ,CAAC,KAAK,EACrB,OAAO,CACR;KACF;SACE,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,EAAE,CAAC,IAAI,8BAA8B,CAAC;IAE9C,MAAM,IAAI,GAAG,sBAAsB,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9E,MAAM,OAAO,GAAG,sBAAsB,CACpC,kBAAkB,EAClB,MAAM,CAAC,IAAI,CAAC,eAAe,CAC5B,CAAC;IAEF,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ;aAC1B,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC;aACnD,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,QAAQ,GAAG,iCAAiC,KAAK,iBAAiB,CAAC;IACrE,CAAC;IAED,OAAO;;;;;;SAMA,YAAY,EAAE;;;;;EAKrB,aAAa,CAAC,MAAM,CAAC;4BACK,QAAQ;EAClC,YAAY,CAAC,MAAM,CAAC;EACpB,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,YAAY,EAAE;;;;CAIf,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StageReport } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Renders a stage report as markdown for files or stdout.
|
|
4
|
+
* Order: Summary → Security (Introduced → Unresolved → Fixed) → Policy → package diffs → Warnings → Legend.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderMarkdown(report: StageReport): string;
|