@@ -10,7 +10,7 @@ import { appendEvent, readState, resolveResumeDirectory, writeState } from './st
1010import type { EvidenceEnvelope } from './types' ;
1111import { aggregateRepairOutcomes , formatRepairMetrics , readRepairOutcomes , writeRepairMetrics } from './metrics' ;
1212import { loadHostedConfig } from './hosted/config' ;
13- import { runHostedProbe } from './hosted/run' ;
13+ import { runHostedBrowser , runHostedMutationCommand , runHostedProbe } from './hosted/run' ;
1414import { runE2ETiming } from './e2eTimingRun' ;
1515
1616const repositoryRoot = path . resolve ( new URL ( '../..' , import . meta. url ) . pathname ) ;
@@ -47,6 +47,38 @@ if (args[0] === 'e2e-timing') {
4747 console . error ( error instanceof Error ? error . message : String ( error ) ) ;
4848 process . exitCode = 1 ;
4949 }
50+ } else if ( args [ 0 ] === 'hosted-browser' ) {
51+ try {
52+ const configPath = value ( '--config' ) ;
53+ if ( ! configPath ) throw new Error ( 'Expected --config <path> for hosted-browser.' ) ;
54+ const result = await runHostedBrowser ( { repo : value ( '--repo' ) ?? repositoryRoot , config : loadHostedConfig ( path . resolve ( configPath ) ) , runId : value ( '--run-id' ) } ) ;
55+ console . log ( `Hosted browser ${ result . status } in ${ result . runDirectory } ` ) ;
56+ if ( result . status !== 'passed' ) process . exitCode = 1 ;
57+ } catch ( error ) {
58+ console . error ( error instanceof Error ? error . message : String ( error ) ) ;
59+ process . exitCode = 1 ;
60+ }
61+ } else if ( args [ 0 ] === 'hosted-mutate' ) {
62+ try {
63+ const configPath = value ( '--config' ) ;
64+ const email = value ( '--email' ) ;
65+ const password = value ( '--password' ) ;
66+ if ( ! configPath ) throw new Error ( 'Expected --config <path> for hosted-mutate.' ) ;
67+ if ( ! email || ! password ) throw new Error ( 'Hosted mutation requires --email and --password; credentials are used in memory only.' ) ;
68+ const result = await runHostedMutationCommand ( {
69+ repo : value ( '--repo' ) ?? repositoryRoot ,
70+ config : loadHostedConfig ( path . resolve ( configPath ) ) ,
71+ runId : value ( '--run-id' ) ,
72+ account : { email, password, inviteToken : value ( '--invite-token' ) } ,
73+ signup : has ( '--signup' ) ,
74+ explicitFlag : has ( '--allow-hosted-mutations' ) ,
75+ } ) ;
76+ console . log ( `Hosted mutation ${ result . result . status } in ${ result . runDirectory } ` ) ;
77+ if ( result . result . status !== 'passed' ) process . exitCode = 1 ;
78+ } catch ( error ) {
79+ console . error ( error instanceof Error ? error . message : String ( error ) ) ;
80+ process . exitCode = 1 ;
81+ }
5082} else if ( args [ 0 ] === 'metrics' ) {
5183 try {
5284 const repo = value ( '--repo' ) ?? repositoryRoot ;
0 commit comments