playwright-intelligence-engine 2.0.4 → 2.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,52 @@
1
+ import { WorktreeInfo } from '../sandbox/worktree-manager.js';
2
+ import { FailureCluster } from './failure-clustering.js';
3
+ import { LlmRepairProposal } from './llm-proposal.js';
4
+ export interface BatchRepairWorkflowInput {
5
+ workspaceRoot?: string | undefined;
6
+ tracePaths?: string[] | undefined;
7
+ execute?: boolean | undefined;
8
+ autoPromote?: boolean | undefined;
9
+ configPath?: string | undefined;
10
+ worktreeId?: string | undefined;
11
+ enableBrowserInvestigation?: boolean | undefined;
12
+ browserUrl?: string | undefined;
13
+ browserAllowedHosts?: string[] | undefined;
14
+ enableTestExecution?: boolean | undefined;
15
+ }
16
+ export type BatchItemStatus = 'PENDING' | 'PROPOSAL_READY' | 'ABSTAINED' | 'VERIFIED' | 'PROMOTED' | 'VERIFICATION_FAILED' | 'REJECTED' | 'FAILED';
17
+ export interface BatchRepairItem {
18
+ tracePath: string;
19
+ testTitle?: string | undefined;
20
+ status: BatchItemStatus;
21
+ category: string;
22
+ confidence: number;
23
+ reason?: string | undefined;
24
+ failedTarget?: string | undefined;
25
+ healedLocator?: string | undefined;
26
+ targetFilePath?: string | undefined;
27
+ testFilePath?: string | undefined;
28
+ className?: string | undefined;
29
+ memberName?: string | undefined;
30
+ pattern?: 'page-object' | 'inline-locator' | 'statement-patch' | undefined;
31
+ proposal?: LlmRepairProposal | undefined;
32
+ fullDiff?: string | undefined;
33
+ }
34
+ export interface BatchRepairWorkflowResult {
35
+ status: 'COMPLETED' | 'PARTIAL' | 'ABSTAINED' | 'FAILED';
36
+ totalTraces: number;
37
+ repairedCount: number;
38
+ abstainedCount: number;
39
+ failedCount: number;
40
+ items: BatchRepairItem[];
41
+ clusters: FailureCluster[];
42
+ worktree?: WorktreeInfo | undefined;
43
+ executionPassed?: boolean | undefined;
44
+ promotedFiles?: string[] | undefined;
45
+ reportJsonPath?: string | undefined;
46
+ }
47
+ /**
48
+ * Executes multi-trace failure diagnosis, clustering, isolated single-worktree
49
+ * batch verification, and atomic promotion for the entire repository.
50
+ */
51
+ export declare function runBatchRepairWorkflow(input: BatchRepairWorkflowInput): Promise<BatchRepairWorkflowResult>;
52
+ //# sourceMappingURL=batch-repair-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-repair-workflow.d.ts","sourceRoot":"","sources":["../../src/intelligence/batch-repair-workflow.ts"],"names":[],"mappings":"AASA,OAAO,EAAmB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,EAAuC,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAItD,MAAM,WAAW,wBAAwB;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,0BAA0B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,UAAU,GACV,qBAAqB,GACrB,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAA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AyB,CAAC,CA6VpC"}
@@ -1,10 +1,11 @@
1
- import { ResolvedElement } from '../trace/snapshot-resolver.js';
2
- export type DisambiguationStrategy = 'UNIQUE_DIRECT_MATCH' | 'VISIBILITY_FILTER' | 'CONTAINER_ANCHOR' | 'LANDMARK_SECTION' | 'EXPLICIT_POSITIONAL_INTENT' | 'ABSTAIN_AMBIGUOUS';
1
+ import { ResolvedElement, BoundingBox } from '../trace/snapshot-resolver.js';
2
+ export type DisambiguationStrategy = 'UNIQUE_DIRECT_MATCH' | 'VISIBILITY_FILTER' | 'CONTAINER_ANCHOR' | 'LANDMARK_SECTION' | 'SPATIAL_COORDINATE_MATCH' | 'EXPLICIT_POSITIONAL_INTENT' | 'ABSTAIN_AMBIGUOUS';
3
3
  export interface DisambiguationContext {
4
4
  originalSelector?: string | undefined;
5
5
  intendedAction?: string | undefined;
6
6
  testIntentText?: string | undefined;
7
7
  rootDom?: ResolvedElement | undefined;
8
+ targetBoundingBox?: BoundingBox | undefined;
8
9
  }
9
10
  export interface DisambiguationResult {
10
11
  strategy: DisambiguationStrategy;
@@ -33,6 +34,7 @@ export declare class LocatorDisambiguationEngine {
33
34
  private static attemptLandmarkScoping;
34
35
  private static verifyExplicitPositionalIntent;
35
36
  private static findPathToElement;
37
+ private static attemptSpatialDisambiguation;
36
38
  private static getCleanText;
37
39
  }
38
40
  //# sourceMappingURL=locator-disambiguation-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locator-disambiguation-engine.d.ts","sourceRoot":"","sources":["../../src/intelligence/locator-disambiguation-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,4BAA4B,GAC5B,mBAAmB,CAAC;AAExB,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,iBAAiB,CAAC,EAAE,eAAe,CAAC;IACpC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,2BAA2B;IACtC;;;;;;;;OAQG;IACH,OAAc,YAAY,CACxB,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,qBAA0B,EACnC,YAAY,SAAS,GACpB,oBAAoB,CAqFtB;IAMD,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAc/B,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAyExC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAyCrC,OAAO,CAAC,MAAM,CAAC,8BAA8B;IAoC7C,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAkBhC,OAAO,CAAC,MAAM,CAAC,YAAY;CAa5B"}
1
+ {"version":3,"file":"locator-disambiguation-engine.d.ts","sourceRoot":"","sources":["../../src/intelligence/locator-disambiguation-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG7E,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,0BAA0B,GAC1B,4BAA4B,GAC5B,mBAAmB,CAAC;AAExB,MAAM,WAAW,qBAAqB;IACpC,gBA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rB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAqFD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAkE3C"}
1
+ {"version":3,"file":"source-mapper.d.ts","sourceRoot":"","sources":["../../src/repair/source-mapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGnE,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AA2GD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAqE3C"}
@@ -1,10 +1,10 @@
1
1
  import { ProjectIntelligenceSnapshot } from '../intelligence/project-intelligence.js';
2
- import { ResolvedElement } from '../trace/snapshot-resolver.js';
2
+ import { ResolvedElement, BoundingBox } from '../trace/snapshot-resolver.js';
3
3
  import { ScoredCandidate } from './abstention-policy.js';
4
4
  export interface RankedRepairCandidate extends ScoredCandidate {
5
5
  locatorExpression: string;
6
6
  }
7
7
  export declare class RepairCandidateRanker {
8
- static rank(candidates: ResolvedElement[], originalSelector?: string, intendedAction?: string, intelligence?: ProjectIntelligenceSnapshot, rootDom?: ResolvedElement, testIntentText?: string): RankedRepairCandidate[];
8
+ static rank(candidates: ResolvedElement[], originalSelector?: string, intendedAction?: string, intelligence?: ProjectIntelligenceSnapshot, rootDom?: ResolvedElement, testIntentText?: string, targetBoundingBox?: BoundingBox): RankedRepairCandidate[];
9
9
  }
10
10
  //# sourceMappingURL=repair-candidate-ranker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"repair-candidate-ranker.d.ts","sourceRoot":"","sources":["../../src/selector/repair-candidate-ranker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAqC,MAAM,yCAAyC,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,qBAAqB;IAChC,OAAc,IAAI,CAChB,UAAU,EAAE,eAAe,EAAE,EAC7B,gBAAgB,CAAC,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,2BAA2B,EAC1C,OAAO,CAAC,EAAE,eAAe,EACzB,cAAc,CAAC,EAAE,MAAM,GACtB,qBAAqB,EAAE,CAuEzB;CACF"}
1
+ {"version":3,"file":"repair-candidate-ranker.d.ts","sourceRoot":"","sources":["../../src/selector/repair-candidate-ranker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAqC,MAAM,yCAAyC,CAAC;AAEzH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,qBAAqB;IAChC,OAAc,IAAI,CAChB,UAAU,EAAE,eAAe,EAAE,EAC7B,gBAAgB,CAAC,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,2BAA2B,EAC1C,OAAO,CAAC,EAAE,eAAe,EACzB,cAAc,CAAC,EAAE,MAAM,EACvB,iBAAiB,CAAC,EAAE,WAAW,GAC9B,qBAAqB,EAAE,CAuEzB;CACF"}
@@ -17,6 +17,8 @@ export interface TraceEntryDiscovery {
17
17
  /** All streams, ordered with explicit failure streams first. */
18
18
  traceEntryNames?: string[] | undefined;
19
19
  networkEntryNames?: string[] | undefined;
20
+ hasFailure?: boolean | undefined;
21
+ failureScore?: number | undefined;
20
22
  }
21
23
  export declare class ArchiveReader {
22
24
  private static readonly DEFAULT_MAX_SIZE;
@@ -1 +1 @@
1
- {"version":3,"file":"archive-reader.d.ts","sourceRoot":"","sources":["../../src/trace/archive-reader.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,gEAAgE;IAChE,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC1C;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAq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E,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IAC7D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IACpD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAM;IACnD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAoB;IAEjE;;;OAGG;IACH,OAAc,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CA0EvE;IAED,iFAAiF;IACjF,OAAoB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAI5F;IAED;;;OAGG;IACH,OAAoB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBvF;IAED;;;OAGG;IACH,OAAoB,YAAY,CAC9B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,qBAAqB,CAAC,CAuGhC;CACF"}
@@ -1,4 +1,10 @@
1
1
  export type NodeSnapshot = string | number | [string, Record<string, string>, ...NodeSnapshot[]];
2
+ export interface BoundingBox {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
2
8
  export interface ResolvedElement {
3
9
  tag: string;
4
10
  attributes: Record<string, string>;
@@ -6,6 +12,7 @@ export interface ResolvedElement {
6
12
  children: ResolvedElement[];
7
13
  role?: string | undefined;
8
14
  accessibleName?: string | undefined;
15
+ boundingBox?: BoundingBox | undefined;
9
16
  }
10
17
  export type SnapshotCompleteness = 'COMPLETE' | 'PARTIAL' | 'UNAVAILABLE';
11
18
  export interface ResolvedSnapshot {
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot-resolver.d.ts","sourceRoot":"","sources":["../../src/trace/snapshot-resolver.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,YAAY,EAAE,oBAAoB,CAAC;IACnC,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,GAAG,EAAE,eAAe,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,KAAK,CAAC,EAAE,QAA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EAAE,GAAG,GAAG,GAAG,EAAE,CAiB5C;IAED;;OAEG;IACH,OAAc,uBAAuB,CACnC,CAAC,EAAE,GAAG,EACN,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,GAAG,EAAE,EACnB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,eAAe,GAAG,MAAM,GAAG,IAAI,CAuFjC;IAED;;OAEG;IACH,OAAc,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAI,GAAG,MAAM,CAajE;IAED;;OAEG;IACH,OAAc,0BAA0B,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,EAAE,CAiCjF;IAED,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAqBhC"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "playwright-intelligence-engine",
3
- "version": "2.0.4",
3
+ "version": "2.1.0",
4
4
  "description": "Enterprise-grade Playwright reliability, failure diagnosis, and intent-preserving test verification engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
9
  "pw-intel": "bin/pw-intel.js",
10
+ "pie": "bin/pw-intel.js",
10
11
  "playwright-intelligence-engine": "bin/pw-intel.js"
11
12
  },
12
13
  "files": [
package/src/cli/index.ts CHANGED
@@ -29,6 +29,7 @@ import { buildTeamDashboard, TeamEvidenceRun } from '../governance/team-dashboar
29
29
  import { parseExternalFailureEvidence, supplementDiagnosticContext } from '../diagnostics/external-failure-evidence.js';
30
30
  import { runRepairWorkflow } from '../repair/repair-workflow.js';
31
31
  import { runAutonomousRepairWorkflow } from '../intelligence/autonomous-repair-workflow.js';
32
+ import { runBatchRepairWorkflow } from '../intelligence/batch-repair-workflow.js';
32
33
  import { normalizeFailureCategory } from '../diagnostics/failure-category.js';
33
34
  import { buildEvaluationScorecard, EvaluationObservation } from '../evaluation/evaluation-scorecard.js';
34
35
  import { buildTestIntelligencePlan, ExistingTestInput, RequirementInput } from '../intelligence/test-intelligence.js';
@@ -56,7 +57,7 @@ function findTraceArchives(targetPath?: string): string[] {
56
57
  process.cwd(),
57
58
  ].filter(Boolean) as string[];
58
59
 
59
- const found: { filePath: string; mtime: number }[] = [];
60
+ const found: { filePath: string; mtime: number; hasFailure: boolean; isTestResults: boolean }[] = [];
60
61
  const seen = new Set<string>();
61
62
 
62
63
  for (const dir of candidateDirs) {
@@ -70,7 +71,13 @@ function findTraceArchives(targetPath?: string): string[] {
70
71
  const stat = fs.statSync(fullPath);
71
72
  if (stat.isFile()) {
72
73
  seen.add(fullPath);
73
- found.push({ filePath: fullPath, mtime: stat.mtimeMs });
74
+ let hasFailure = false;
75
+ try {
76
+ const discovery = ArchiveReader.findTraceFileEntries(fullPath);
77
+ hasFailure = Boolean(discovery.hasFailure);
78
+ } catch {}
79
+ const isTestResults = fullPath.includes('test-results');
80
+ found.push({ filePath: fullPath, mtime: stat.mtimeMs, hasFailure, isTestResults });
74
81
  }
75
82
  } catch {}
76
83
  }
@@ -78,7 +85,13 @@ function findTraceArchives(targetPath?: string): string[] {
78
85
  } catch {}
79
86
  }
80
87
 
81
- return found.sort((a, b) => b.mtime - a.mtime).map((f) => f.filePath);
88
+ return found
89
+ .sort((a, b) => {
90
+ if (a.hasFailure !== b.hasFailure) return a.hasFailure ? -1 : 1;
91
+ if (a.isTestResults !== b.isTestResults) return a.isTestResults ? -1 : 1;
92
+ return b.mtime - a.mtime;
93
+ })
94
+ .map((f) => f.filePath);
82
95
  }
83
96
 
84
97
  export async function runCli(argv: string[]): Promise<void> {
@@ -303,6 +316,84 @@ export async function runCli(argv: string[]): Promise<void> {
303
316
  }
304
317
 
305
318
  if (command === 'autonomous-repair') {
319
+ const option = (name: string): string | undefined => {
320
+ const index = argv.indexOf(name);
321
+ return index >= 0 ? argv[index + 1] : undefined;
322
+ };
323
+
324
+ if (argv.includes('--all')) {
325
+ try {
326
+ const batchResult = await runBatchRepairWorkflow({
327
+ workspaceRoot: option('--workspace') ?? process.cwd(),
328
+ execute: argv.includes('--execute'),
329
+ autoPromote: argv.includes('--promote'),
330
+ configPath: option('--config'),
331
+ worktreeId: option('--worktree-id'),
332
+ enableBrowserInvestigation: argv.includes('--browser'),
333
+ browserUrl: option('--browser-url'),
334
+ browserAllowedHosts: (option('--allow-host') ?? '').split(',').map((h) => h.trim()).filter(Boolean),
335
+ enableTestExecution: argv.includes('--run-tests'),
336
+ });
337
+
338
+ const reportsDir = path.resolve(process.cwd(), '.pie', 'reports');
339
+ await fs.promises.mkdir(reportsDir, { recursive: true });
340
+ const reportJsonPath = path.resolve(reportsDir, 'batch-repair-report.json');
341
+ await fs.promises.writeFile(reportJsonPath, `${JSON.stringify(batchResult, null, 2)}\n`, 'utf8');
342
+
343
+ if (argv.includes('--json')) {
344
+ console.log(JSON.stringify(batchResult, null, 2));
345
+ } else {
346
+ const divider = '─'.repeat(72);
347
+ console.log('');
348
+ console.log('╔══════════════════════════════════════════════════════════════════════╗');
349
+ console.log('║ PLAYWRIGHT INTELLIGENCE ENGINE: BATCH AUTO-HEALING ║');
350
+ console.log('╚══════════════════════════════════════════════════════════════════════╝');
351
+ console.log('');
352
+ console.log(`Discovered Traces : ${batchResult.totalTraces}`);
353
+ console.log(`Repaired & Verified: ${batchResult.repairedCount}`);
354
+ console.log(`Abstained : ${batchResult.abstainedCount}`);
355
+ console.log(`Failed : ${batchResult.failedCount}`);
356
+ console.log(`Batch Status : ${batchResult.status}`);
357
+ console.log(divider);
358
+ console.log('Failure Clusters:');
359
+ if (batchResult.clusters.length > 0) {
360
+ for (const c of batchResult.clusters) {
361
+ console.log(` • [${c.severity.toUpperCase()}] ${c.fingerprint.category} (count: ${c.count})`);
362
+ }
363
+ } else {
364
+ console.log(' • None');
365
+ }
366
+ console.log(divider);
367
+ console.log('Test Repair Summary:');
368
+ for (const item of batchResult.items) {
369
+ const icon = item.status === 'PROMOTED' || item.status === 'VERIFIED' ? '✅' : item.status === 'ABSTAINED' ? '⚠️' : item.status === 'PROPOSAL_READY' ? '💡' : '❌';
370
+ const spec = item.testTitle ?? path.basename(item.tracePath);
371
+ console.log(` ${icon} [${item.status}] ${spec}`);
372
+ if (item.failedTarget) console.log(` Failed Target : ${item.failedTarget}`);
373
+ if (item.healedLocator) console.log(` Healed Locator: ${item.healedLocator}`);
374
+ if (item.targetFilePath) console.log(` Target File : ${path.relative(process.cwd(), item.targetFilePath)}`);
375
+ if (item.reason && item.status === 'ABSTAINED') console.log(` Abstain Reason: ${item.reason}`);
376
+ }
377
+ console.log(divider);
378
+ if (batchResult.promotedFiles && batchResult.promotedFiles.length > 0) {
379
+ console.log('Promoted Files:');
380
+ for (const file of batchResult.promotedFiles) {
381
+ console.log(` 🎉 ${file}`);
382
+ }
383
+ console.log(divider);
384
+ }
385
+ console.log(`Report JSON : ${path.relative(process.cwd(), reportJsonPath)}`);
386
+ console.log('(Pass --json to view full machine-readable payload)');
387
+ }
388
+
389
+ if (batchResult.status === 'FAILED') process.exitCode = 1;
390
+ return;
391
+ } catch (err: any) {
392
+ console.error(`Batch repair failed: ${err?.message ?? String(err)}`);
393
+ process.exit(1);
394
+ }
395
+ }
396
+
306
397
  const candidateArg = argv[3];
307
398
  const traces = findTraceArchives(candidateArg);
308
399
  if (traces.length === 0) {
@@ -320,10 +411,6 @@ export async function runCli(argv: string[]): Promise<void> {
320
411
  console.log(`[pw-intel] Auto-discovered trace: ${path.relative(process.cwd(), tracePath)}`);
321
412
  }
322
413
  try {
323
- const option = (name: string): string | undefined => {
324
- const index = argv.indexOf(name);
325
- return index >= 0 ? argv[index + 1] : undefined;
326
- };
327
414
  const result = await runAutonomousRepairWorkflow({
328
415
  tracePath,
329
416
  workspaceRoot: option('--workspace') ?? process.cwd(),
@@ -341,21 +428,88 @@ export async function runCli(argv: string[]): Promise<void> {
341
428
  autoPromote: argv.includes('--promote'),
342
429
  execute: argv.includes('--execute'),
343
430
  });
344
- console.log(JSON.stringify({
345
- provenance: getRuntimeProvenance(process.cwd()),
346
- status: result.status,
347
- reason: result.reason,
348
- agent: {
349
- state: result.proposalRun.agent.state,
350
- modelInvoked: result.proposalRun.agent.modelInvoked,
351
- classification: result.proposalRun.agent.classification,
352
- proposal: result.proposal,
353
- errors: result.proposalRun.agent.errors,
354
- steps: result.proposalRun.agent.steps,
355
- },
356
- verification: result.verification,
357
- promotion: result.promotion,
358
- }, null, 2));
431
+ if (argv.includes('--json')) {
432
+ console.log(JSON.stringify({
433
+ provenance: getRuntimeProvenance(process.cwd()),
434
+ status: result.status,
435
+ reason: result.reason,
436
+ agent: {
437
+ state: result.proposalRun.agent.state,
438
+ modelInvoked: result.proposalRun.agent.modelInvoked,
439
+ classification: result.proposalRun.agent.classification,
440
+ proposal: result.proposal,
441
+ errors: result.proposalRun.agent.errors,
442
+ steps: result.proposalRun.agent.steps,
443
+ },
444
+ verification: result.verification,
445
+ promotion: result.promotion,
446
+ }, null, 2));
447
+ } else {
448
+ const divider = '─'.repeat(72);
449
+ console.log('');
450
+ console.log('╔══════════════════════════════════════════════════════════════════════╗');
451
+ console.log('║ PLAYWRIGHT INTELLIGENCE ENGINE: AUTONOMOUS REPAIR ║');
452
+ console.log('╚══════════════════════════════════════════════════════════════════════╝');
453
+ console.log('');
454
+ console.log(`Target Trace : ${path.relative(process.cwd(), tracePath)}`);
455
+ console.log(`Repair Status : ${result.status}`);
456
+ if (result.reason) {
457
+ console.log(`Status Reason : ${result.reason}`);
458
+ }
459
+ console.log(divider);
460
+
461
+ console.log('Agent Diagnostic & Proposal:');
462
+ const classificationStr = typeof result.proposalRun.agent.classification === 'object' && result.proposalRun.agent.classification !== null
463
+ ? (result.proposalRun.agent.classification as any).category ?? (result.proposalRun.agent.classification as any).name ?? 'N/A'
464
+ : result.proposalRun.agent.classification ?? 'N/A';
465
+ console.log(` • Classification: ${classificationStr}`);
466
+ console.log(` • Model Invoked : ${result.proposalRun.agent.modelInvoked}`);
467
+ console.log(` • Steps / Turns : ${result.proposalRun.agent.steps?.length ?? 0}`);
468
+ if (result.proposal) {
469
+ const primaryOp = result.proposal.operations[0];
470
+ console.log(` • Decision : ${result.proposal.decision}`);
471
+ console.log(` • Confidence : ${(result.proposal.confidence * 100).toFixed(1)}%`);
472
+ console.log(` • Reasoning : ${result.proposal.reasoningSummary}`);
473
+ if (primaryOp) {
474
+ console.log(` • Operation : ${primaryOp.kind}`);
475
+ if (primaryOp.kind === 'replace_locator') {
476
+ console.log(` • Failed Target : ${primaryOp.target}`);
477
+ console.log(` • Healed Locator: ${primaryOp.locator}`);
478
+ }
479
+ }
480
+ } else {
481
+ console.log(' • Repair Proposal: None (Abstained or No Proposal)');
482
+ }
483
+ console.log(divider);
484
+
485
+ if (result.verification) {
486
+ console.log('Isolated Worktree Verification:');
487
+ if (result.verification.worktree) {
488
+ console.log(` • Worktree ID : ${result.verification.worktree.id}`);
489
+ }
490
+ if (result.verification.verification) {
491
+ const passed = result.verification.verification.executionResult.exitCode === 0;
492
+ console.log(` • Test Outcome : ${passed ? '✅ PASSED' : '❌ FAILED'}`);
493
+ console.log(` • Duration : ${result.verification.verification.executionResult.durationMs}ms`);
494
+ } else {
495
+ console.log(` • Status : ${result.verification.status}`);
496
+ }
497
+ console.log(divider);
498
+ }
499
+
500
+ if (result.promotion) {
501
+ console.log('Workspace Promotion:');
502
+ console.log(` • Status : ${result.promotion.success ? '✅ PROMOTED TO REPOSITORY' : 'FAILED'}`);
503
+ console.log(` • Target File : ${result.promotion.targetFilePath}`);
504
+ console.log(` • Bytes Written : ${result.promotion.bytesWritten}`);
505
+ console.log(` • Content Hash : ${result.promotion.finalHash.slice(0, 16)}...`);
506
+ console.log(divider);
507
+ } else if (result.verification?.verification?.executionResult.exitCode === 0 && !argv.includes('--promote')) {
508
+ console.log('Workspace Promotion:');
509
+ console.log(' • Status : ⏸ VERIFIED IN WORKTREE (pass --promote to apply to main workspace)');
510
+ console.log(divider);
511
+ }
512
+ }
359
513
  if (result.status === 'PROPOSAL_REJECTED' || result.status === 'VERIFICATION_FAILED') process.exitCode = 1;
360
514
  } catch (err: any) {
361
515
  console.error(`Autonomous repair failed: ${err?.message ?? String(err)}`);
@@ -678,7 +832,41 @@ export async function runCli(argv: string[]): Promise<void> {
678
832
  write: argv.includes('--write'),
679
833
  verify: argv.includes('--verify'),
680
834
  });
681
- console.log(JSON.stringify({ generatedAt: new Date().toISOString(), requirementsPath: path.resolve(requirementsPath), ...result }, null, 2));
835
+ const reportPayload = { generatedAt: new Date().toISOString(), requirementsPath: path.resolve(requirementsPath), ...result };
836
+ const reportsDir = path.resolve(process.cwd(), '.pie', 'reports');
837
+ await fs.promises.mkdir(reportsDir, { recursive: true });
838
+ const reportJsonPath = path.resolve(reportsDir, 'generation-report.json');
839
+ await fs.promises.writeFile(reportJsonPath, `${JSON.stringify(reportPayload, null, 2)}\n`, 'utf8');
840
+
841
+ if (argv.includes('--json')) {
842
+ console.log(JSON.stringify(reportPayload, null, 2));
843
+ } else {
844
+ const divider = '─'.repeat(72);
845
+ console.log('');
846
+ console.log('╔══════════════════════════════════════════════════════════════════════╗');
847
+ console.log('║ PLAYWRIGHT INTELLIGENCE ENGINE: GENERATION AGENT ║');
848
+ console.log('╚══════════════════════════════════════════════════════════════════════╝');
849
+ console.log('');
850
+ console.log(`Requirements File : ${path.relative(process.cwd(), requirementsPath)}`);
851
+ console.log(`Mode : ${mode} (${author})`);
852
+ console.log(`Generation Status : ${result.status}`);
853
+ if ((result as any).reason) {
854
+ console.log(`Status Reason : ${(result as any).reason}`);
855
+ }
856
+ console.log(divider);
857
+ const generatedList = (result as any).generatedFiles ?? [];
858
+ console.log(`Generated Files (${generatedList.length}):`);
859
+ if (generatedList.length > 0) {
860
+ for (const file of generatedList) {
861
+ console.log(` • ${file}`);
862
+ }
863
+ } else {
864
+ console.log(' • None (No files written)');
865
+ }
866
+ console.log(divider);
867
+ console.log(`Report JSON : ${path.relative(process.cwd(), reportJsonPath)}`);
868
+ console.log('(Pass --json to view full machine-readable payload)');
869
+ }
682
870
  if (result.status === 'ABSTAINED' || result.status === 'MODEL_NOT_CONFIGURED' || result.status === 'NEEDS_INPUT' || result.status === 'VERIFICATION_FAILED' || result.status === 'AGENT_NO_PROGRESS') process.exitCode = 1;
683
871
  } catch (err: any) {
684
872
  console.error(`Generation agent failed: ${err?.message ?? String(err)}`);
@@ -953,12 +1141,60 @@ export async function runCli(argv: string[]): Promise<void> {
953
1141
  runMutations,
954
1142
  });
955
1143
 
1144
+ const reportsDir = path.resolve(process.cwd(), '.pie', 'reports');
1145
+ await fs.promises.mkdir(reportsDir, { recursive: true });
1146
+ const defaultReportPath = path.resolve(reportsDir, 'qa-report.json');
956
1147
  const outFlag = readFlag('--out');
957
- if (outFlag) {
958
- await fs.promises.mkdir(path.dirname(path.resolve(outFlag)), { recursive: true });
959
- await fs.promises.writeFile(path.resolve(outFlag), `${JSON.stringify(result.qaReport, null, 2)}\n`, 'utf8');
1148
+ const targetReportJsonPath = outFlag ? path.resolve(outFlag) : defaultReportPath;
1149
+ await fs.promises.mkdir(path.dirname(targetReportJsonPath), { recursive: true });
1150
+ await fs.promises.writeFile(targetReportJsonPath, `${JSON.stringify(result.qaReport, null, 2)}\n`, 'utf8');
1151
+
1152
+ if (argv.includes('--json')) {
1153
+ console.log(JSON.stringify(result.qaReport, null, 2));
1154
+ } else {
1155
+ const divider = '─'.repeat(72);
1156
+ console.log('');
1157
+ console.log('╔══════════════════════════════════════════════════════════════════════╗');
1158
+ console.log('║ PLAYWRIGHT INTELLIGENCE ENGINE: QA REPORT ║');
1159
+ console.log('╚══════════════════════════════════════════════════════════════════════╝');
1160
+ console.log('');
1161
+ console.log(`Feature : ${result.qaReport.featureName}`);
1162
+ console.log(`Topology : ${result.qaReport.topology}`);
1163
+ console.log(`Status : ${result.qaReport.status}`);
1164
+ console.log(`Runtime Verified : ${result.qaReport.runtimeVerified ? '✅ YES' : '❌ NO'}`);
1165
+ console.log(`Static Validation : ${result.qaReport.staticValidation.passed ? '✅ PASSED' : '❌ FAILED'}`);
1166
+ console.log(divider);
1167
+
1168
+ console.log('Findings & Diagnostics:');
1169
+ if (result.qaReport.findings && result.qaReport.findings.length > 0) {
1170
+ for (const finding of result.qaReport.findings) {
1171
+ const sev = finding.severity ? finding.severity.toUpperCase() : 'INFO';
1172
+ console.log(` • [${sev}] ${finding.actualBehavior}`);
1173
+ }
1174
+ } else {
1175
+ console.log(' • No defects or runtime errors discovered.');
1176
+ }
1177
+
1178
+ if (result.qaReport.staticValidation.violations.length > 0) {
1179
+ console.log('\nValidation Violations:');
1180
+ for (const viol of result.qaReport.staticValidation.violations) {
1181
+ console.log(` • ${viol}`);
1182
+ }
1183
+ }
1184
+ console.log(divider);
1185
+
1186
+ console.log('Artifacts Generated:');
1187
+ console.log(` • Generated Files : ${result.qaReport.generatedFiles.length > 0 ? result.qaReport.generatedFiles.join(', ') : 'None'}`);
1188
+ if (result.qaReport.artifacts?.featureFilePath) {
1189
+ console.log(` • Feature File : ${path.relative(process.cwd(), result.qaReport.artifacts.featureFilePath)}`);
1190
+ }
1191
+ if (result.qaReport.artifacts?.explorationBundlePath) {
1192
+ console.log(` • Exploration Log : ${path.relative(process.cwd(), result.qaReport.artifacts.explorationBundlePath)}`);
1193
+ }
1194
+ console.log(` • Report JSON : ${path.relative(process.cwd(), targetReportJsonPath)}`);
1195
+ console.log(divider);
1196
+ console.log('(Pass --json to view full machine-readable report)');
960
1197
  }
961
- console.log(JSON.stringify(result.qaReport, null, 2));
962
1198
  } catch (err: any) {
963
1199
  console.error(`QA pipeline failed: ${err?.message ?? String(err)}`);
964
1200
  process.exit(1);
@@ -4,8 +4,8 @@ import { execFileSync } from 'node:child_process';
4
4
  * Product identity is kept in one place so the CLI, MCP server, and execution
5
5
  * proofs cannot silently advertise different versions.
6
6
  */
7
- export const PACKAGE_VERSION = '2.0.4';
8
- export const ENGINE_MILESTONE = '2.0.4';
7
+ export const PACKAGE_VERSION = '2.1.0';
8
+ export const ENGINE_MILESTONE = '2.1.0';
9
9
  export const PROOF_VERSION = ENGINE_MILESTONE;
10
10
 
11
11
  export interface RuntimeProvenance {
package/src/index.ts CHANGED
@@ -79,6 +79,7 @@ export * from './intelligence/repair-agent.js';
79
79
  export * from './intelligence/trace-proposal-workflow.js';
80
80
  export * from './intelligence/verified-llm-repair-workflow.js';
81
81
  export * from './intelligence/autonomous-repair-workflow.js';
82
+ export * from './intelligence/batch-repair-workflow.js';
82
83
  export * from './intelligence/generation-agent.js';
83
84
  export * from './intelligence/generation-verifier.js';
84
85
  export * from './intelligence/repository-profile.js';