code-provenance 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/output.d.ts +1 -7
- package/dist/output.js +14 -36
- package/dist/output.js.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +2 -2
- package/src/index.ts +1 -1
- package/src/output.ts +16 -55
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { parseCompose, parseImageRef } from "./composeParser.js";
|
|
5
5
|
import { resolveImage } from "./resolver.js";
|
|
6
|
-
import { formatJson,
|
|
6
|
+
import { formatJson, formatText } from "./output.js";
|
|
7
7
|
function printHelp() {
|
|
8
8
|
console.log(`usage: code-provenance [-h] [--json] [compose_file]
|
|
9
9
|
|
|
@@ -64,7 +64,7 @@ async function main() {
|
|
|
64
64
|
console.log(formatJson(results));
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
console.log(
|
|
67
|
+
console.log(formatText(results));
|
|
68
68
|
}
|
|
69
69
|
return 0;
|
|
70
70
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.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IAED,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED,IAAI,EAAE;KACH,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { ImageRef, ImageResult } from "./types.js";
|
|
2
2
|
export { parseCompose, parseImageRef } from "./composeParser.js";
|
|
3
3
|
export { resolveImage } from "./resolver.js";
|
|
4
|
-
export { formatJson,
|
|
4
|
+
export { formatJson, formatText } from "./output.js";
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/output.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { ImageResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Format results as a JSON array.
|
|
4
|
-
*/
|
|
5
2
|
export declare function formatJson(results: ImageResult[]): string;
|
|
6
|
-
|
|
7
|
-
* Format results as a box-drawing table.
|
|
8
|
-
*/
|
|
9
|
-
export declare function formatTable(results: ImageResult[]): string;
|
|
3
|
+
export declare function formatText(results: ImageResult[]): string;
|
package/dist/output.js
CHANGED
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format results as a JSON array.
|
|
3
|
-
*/
|
|
4
1
|
export function formatJson(results) {
|
|
5
2
|
return JSON.stringify(results, null, 2);
|
|
6
3
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
r.confidence || "-",
|
|
22
|
-
]);
|
|
23
|
-
// Calculate column widths
|
|
24
|
-
const widths = columns.map((col, i) => {
|
|
25
|
-
const dataMax = rows.reduce((max, row) => Math.max(max, row[i].length), 0);
|
|
26
|
-
return Math.max(col.length, dataMax);
|
|
27
|
-
});
|
|
28
|
-
const pad = (s, w) => s + " ".repeat(w - s.length);
|
|
29
|
-
// Build lines
|
|
30
|
-
const topBorder = "┌" + widths.map((w) => "─".repeat(w + 2)).join("┬") + "┐";
|
|
31
|
-
const headerSep = "├" + widths.map((w) => "─".repeat(w + 2)).join("┼") + "┤";
|
|
32
|
-
const bottomBorder = "└" + widths.map((w) => "─".repeat(w + 2)).join("┴") + "┘";
|
|
33
|
-
const headerRow = "│" +
|
|
34
|
-
columns.map((col, i) => " " + pad(col, widths[i]) + " ").join("│") +
|
|
35
|
-
"│";
|
|
36
|
-
const dataRows = rows.map((row) => "│" +
|
|
37
|
-
row.map((cell, i) => " " + pad(cell, widths[i]) + " ").join("│") +
|
|
38
|
-
"│");
|
|
39
|
-
return [topBorder, headerRow, headerSep, ...dataRows, bottomBorder].join("\n");
|
|
4
|
+
export function formatText(results) {
|
|
5
|
+
return results
|
|
6
|
+
.map((r) => {
|
|
7
|
+
const commit = r.commit ? r.commit.slice(0, 12) : "-";
|
|
8
|
+
const repo = r.repo?.replace("https://", "") ?? "-";
|
|
9
|
+
const confidence = r.confidence ?? "-";
|
|
10
|
+
return (`${r.service}: ${r.image}\n` +
|
|
11
|
+
` repo: ${repo}\n` +
|
|
12
|
+
` commit: ${commit}\n` +
|
|
13
|
+
` status: ${r.status}\n` +
|
|
14
|
+
` confidence: ${confidence}` +
|
|
15
|
+
(r.commit_url ? `\n url: ${r.commit_url}` : ""));
|
|
16
|
+
})
|
|
17
|
+
.join("\n\n");
|
|
40
18
|
}
|
|
41
19
|
//# sourceMappingURL=output.js.map
|
package/dist/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,OAAsB;IAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAsB;IAC/C,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACtD,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;QACpD,MAAM,UAAU,GAAG,CAAC,CAAC,UAAU,IAAI,GAAG,CAAC;QACvC,OAAO,CACL,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,KAAK,IAAI;YAC5B,iBAAiB,IAAI,IAAI;YACzB,iBAAiB,MAAM,IAAI;YAC3B,iBAAiB,CAAC,CAAC,MAAM,IAAI;YAC7B,iBAAiB,UAAU,EAAE;YAC7B,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACxD,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { readFileSync } from "node:fs";
|
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { parseCompose, parseImageRef } from "./composeParser.js";
|
|
6
6
|
import { resolveImage } from "./resolver.js";
|
|
7
|
-
import { formatJson,
|
|
7
|
+
import { formatJson, formatText } from "./output.js";
|
|
8
8
|
|
|
9
9
|
function printHelp(): void {
|
|
10
10
|
console.log(`usage: code-provenance [-h] [--json] [compose_file]
|
|
@@ -81,7 +81,7 @@ async function main(): Promise<number> {
|
|
|
81
81
|
if (jsonOutput) {
|
|
82
82
|
console.log(formatJson(results));
|
|
83
83
|
} else {
|
|
84
|
-
console.log(
|
|
84
|
+
console.log(formatText(results));
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
return 0;
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { ImageRef, ImageResult } from "./types.js";
|
|
2
2
|
export { parseCompose, parseImageRef } from "./composeParser.js";
|
|
3
3
|
export { resolveImage } from "./resolver.js";
|
|
4
|
-
export { formatJson,
|
|
4
|
+
export { formatJson, formatText } from "./output.js";
|
package/src/output.ts
CHANGED
|
@@ -1,62 +1,23 @@
|
|
|
1
1
|
import type { ImageResult } from "./types.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Format results as a JSON array.
|
|
5
|
-
*/
|
|
6
3
|
export function formatJson(results: ImageResult[]): string {
|
|
7
4
|
return JSON.stringify(results, null, 2);
|
|
8
5
|
}
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
r.commit ? r.commit.slice(0, 12) : "-",
|
|
27
|
-
r.status,
|
|
28
|
-
r.confidence || "-",
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
// Calculate column widths
|
|
32
|
-
const widths = columns.map((col, i) => {
|
|
33
|
-
const dataMax = rows.reduce((max, row) => Math.max(max, row[i].length), 0);
|
|
34
|
-
return Math.max(col.length, dataMax);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const pad = (s: string, w: number) => s + " ".repeat(w - s.length);
|
|
38
|
-
|
|
39
|
-
// Build lines
|
|
40
|
-
const topBorder =
|
|
41
|
-
"┌" + widths.map((w) => "─".repeat(w + 2)).join("┬") + "┐";
|
|
42
|
-
const headerSep =
|
|
43
|
-
"├" + widths.map((w) => "─".repeat(w + 2)).join("┼") + "┤";
|
|
44
|
-
const bottomBorder =
|
|
45
|
-
"└" + widths.map((w) => "─".repeat(w + 2)).join("┴") + "┘";
|
|
46
|
-
|
|
47
|
-
const headerRow =
|
|
48
|
-
"│" +
|
|
49
|
-
columns.map((col, i) => " " + pad(col, widths[i]) + " ").join("│") +
|
|
50
|
-
"│";
|
|
51
|
-
|
|
52
|
-
const dataRows = rows.map(
|
|
53
|
-
(row) =>
|
|
54
|
-
"│" +
|
|
55
|
-
row.map((cell, i) => " " + pad(cell, widths[i]) + " ").join("│") +
|
|
56
|
-
"│"
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
return [topBorder, headerRow, headerSep, ...dataRows, bottomBorder].join(
|
|
60
|
-
"\n"
|
|
61
|
-
);
|
|
7
|
+
export function formatText(results: ImageResult[]): string {
|
|
8
|
+
return results
|
|
9
|
+
.map((r) => {
|
|
10
|
+
const commit = r.commit ? r.commit.slice(0, 12) : "-";
|
|
11
|
+
const repo = r.repo?.replace("https://", "") ?? "-";
|
|
12
|
+
const confidence = r.confidence ?? "-";
|
|
13
|
+
return (
|
|
14
|
+
`${r.service}: ${r.image}\n` +
|
|
15
|
+
` repo: ${repo}\n` +
|
|
16
|
+
` commit: ${commit}\n` +
|
|
17
|
+
` status: ${r.status}\n` +
|
|
18
|
+
` confidence: ${confidence}` +
|
|
19
|
+
(r.commit_url ? `\n url: ${r.commit_url}` : "")
|
|
20
|
+
);
|
|
21
|
+
})
|
|
22
|
+
.join("\n\n");
|
|
62
23
|
}
|