@vaishnavitron/anton-qa-review 0.1.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.
@@ -0,0 +1,3 @@
1
+ export { hashContent, emptyManifest, loadManifest, saveManifest, diffAgainstManifest, hasPendingReview, approveFlows, formatReviewDiffs, } from "./manifest.js";
2
+ export type { ReviewEntry, ReviewManifest, FlowArtifact, ReviewDiff, } from "./manifest.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { hashContent, emptyManifest, loadManifest, saveManifest, diffAgainstManifest, hasPendingReview, approveFlows, formatReviewDiffs, } from "./manifest.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,35 @@
1
+ export interface ReviewEntry {
2
+ contractId: string;
3
+ platform: string;
4
+ relativePath: string;
5
+ contentHash: string;
6
+ approvedAt: string;
7
+ approvedBy?: string;
8
+ }
9
+ export interface ReviewManifest {
10
+ version: 1;
11
+ entries: ReviewEntry[];
12
+ }
13
+ export declare function hashContent(content: string): string;
14
+ export declare function emptyManifest(): ReviewManifest;
15
+ export declare function loadManifest(manifestPath: string): Promise<ReviewManifest>;
16
+ export declare function saveManifest(manifestPath: string, manifest: ReviewManifest): Promise<void>;
17
+ export interface FlowArtifact {
18
+ contractId: string;
19
+ platform: string;
20
+ relativePath: string;
21
+ content: string;
22
+ }
23
+ export interface ReviewDiff {
24
+ relativePath: string;
25
+ contractId: string;
26
+ platform: string;
27
+ status: "new" | "changed" | "removed" | "approved";
28
+ currentHash?: string;
29
+ approvedHash?: string;
30
+ }
31
+ export declare function diffAgainstManifest(flows: FlowArtifact[], manifest: ReviewManifest): ReviewDiff[];
32
+ export declare function hasPendingReview(diffs: ReviewDiff[]): boolean;
33
+ export declare function approveFlows(manifest: ReviewManifest, flows: FlowArtifact[], approvedBy?: string): ReviewManifest;
34
+ export declare function formatReviewDiffs(diffs: ReviewDiff[]): string;
35
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,aAAa,IAAI,cAAc,CAE9C;AAED,wBAAsB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOhF;AAED,wBAAsB,YAAY,CAChC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EAAE,EACrB,QAAQ,EAAE,cAAc,GACvB,UAAU,EAAE,CA6Cd;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAO7D;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,YAAY,EAAE,EACrB,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CA8BhB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAc7D"}
@@ -0,0 +1,104 @@
1
+ import { createHash } from "node:crypto";
2
+ import { readFile, writeFile, mkdir } from "node:fs/promises";
3
+ import path from "node:path";
4
+ export function hashContent(content) {
5
+ return createHash("sha256").update(content, "utf8").digest("hex");
6
+ }
7
+ export function emptyManifest() {
8
+ return { version: 1, entries: [] };
9
+ }
10
+ export async function loadManifest(manifestPath) {
11
+ try {
12
+ const raw = await readFile(manifestPath, "utf8");
13
+ return JSON.parse(raw);
14
+ }
15
+ catch {
16
+ return emptyManifest();
17
+ }
18
+ }
19
+ export async function saveManifest(manifestPath, manifest) {
20
+ await mkdir(path.dirname(manifestPath), { recursive: true });
21
+ await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
22
+ }
23
+ export function diffAgainstManifest(flows, manifest) {
24
+ const approvedByPath = new Map(manifest.entries.map((entry) => [entry.relativePath, entry]));
25
+ const currentPaths = new Set(flows.map((flow) => flow.relativePath));
26
+ const diffs = [];
27
+ for (const flow of flows) {
28
+ const currentHash = hashContent(flow.content);
29
+ const approved = approvedByPath.get(flow.relativePath);
30
+ if (!approved) {
31
+ diffs.push({
32
+ relativePath: flow.relativePath,
33
+ contractId: flow.contractId,
34
+ platform: flow.platform,
35
+ status: "new",
36
+ currentHash,
37
+ });
38
+ continue;
39
+ }
40
+ diffs.push({
41
+ relativePath: flow.relativePath,
42
+ contractId: flow.contractId,
43
+ platform: flow.platform,
44
+ status: approved.contentHash === currentHash ? "approved" : "changed",
45
+ currentHash,
46
+ approvedHash: approved.contentHash,
47
+ });
48
+ }
49
+ for (const entry of manifest.entries) {
50
+ if (!currentPaths.has(entry.relativePath)) {
51
+ diffs.push({
52
+ relativePath: entry.relativePath,
53
+ contractId: entry.contractId,
54
+ platform: entry.platform,
55
+ status: "removed",
56
+ approvedHash: entry.contentHash,
57
+ });
58
+ }
59
+ }
60
+ return diffs.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
61
+ }
62
+ export function hasPendingReview(diffs) {
63
+ return diffs.some((diff) => diff.status === "new" ||
64
+ diff.status === "changed" ||
65
+ diff.status === "removed");
66
+ }
67
+ export function approveFlows(manifest, flows, approvedBy) {
68
+ const now = new Date().toISOString();
69
+ const nextEntries = new Map(manifest.entries.map((entry) => [entry.relativePath, entry]));
70
+ for (const flow of flows) {
71
+ nextEntries.set(flow.relativePath, {
72
+ contractId: flow.contractId,
73
+ platform: flow.platform,
74
+ relativePath: flow.relativePath,
75
+ contentHash: hashContent(flow.content),
76
+ approvedAt: now,
77
+ approvedBy,
78
+ });
79
+ }
80
+ const flowPaths = new Set(flows.map((flow) => flow.relativePath));
81
+ for (const key of [...nextEntries.keys()]) {
82
+ if (!flowPaths.has(key)) {
83
+ nextEntries.delete(key);
84
+ }
85
+ }
86
+ return {
87
+ version: 1,
88
+ entries: [...nextEntries.values()].sort((a, b) => a.relativePath.localeCompare(b.relativePath)),
89
+ };
90
+ }
91
+ export function formatReviewDiffs(diffs) {
92
+ if (diffs.length === 0) {
93
+ return "No generated flows to review.";
94
+ }
95
+ return diffs
96
+ .map((diff) => {
97
+ const hashInfo = diff.currentHash !== undefined
98
+ ? ` hash=${diff.currentHash.slice(0, 12)}`
99
+ : "";
100
+ return `- [${diff.status}] ${diff.relativePath}${hashInfo}`;
101
+ })
102
+ .join("\n");
103
+ }
104
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAgB7B,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,YAAoB;IACrD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,YAAoB,EACpB,QAAwB;IAEx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S,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;YAC1C,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,MAAM,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,YAAY,GAAG,QAAQ,EAAE,CAAC;IAC9D,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@vaishnavitron/anton-qa-review",
3
+ "version": "0.1.0",
4
+ "description": "Review manifest and approval gate for generated Maestro flows",
5
+ "author": "Vaishnav Chidambar",
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/urbint/anton-qa-agent.git",
10
+ "directory": "packages/review"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org/"
15
+ },
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsc",
30
+ "prepublishOnly": "npm run build",
31
+ "test": "vitest run"
32
+ },
33
+ "dependencies": {
34
+ "@vaishnavitron/anton-qa-contract": "0.1.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "22.15.30",
38
+ "typescript": "5.8.3",
39
+ "vitest": "3.2.1"
40
+ },
41
+ "engines": {
42
+ "node": ">=18.0.0"
43
+ }
44
+ }