@@ -17,10 +17,13 @@ import fs from 'fs';
1717import net from 'net' ;
1818import { startTUI } from '@ui/tui/start-tui' ;
1919import { VERSION } from '@lib/version' ;
20- import { Program } from '@lib/programs/program-registry' ;
20+ import {
21+ Program ,
22+ getProgramConfig ,
23+ type ProgramId ,
24+ } from '@lib/programs/program-registry' ;
2125import type { Harness , Sequence } from '@lib/constants' ;
2226import { buildSession } from '@lib/wizard-session' ;
23- import { posthogIntegrationConfig } from '@lib/programs/posthog-integration' ;
2427import { runAgent } from '@lib/agent/agent-runner' ;
2528import { getOrAskForProjectData } from '@utils/setup-utils' ;
2629import { logToFile } from '@utils/debug' ;
@@ -43,13 +46,22 @@ async function main() {
4346 ) . trim ( ) ;
4447 const projectId = process . env . PROJECT_ID ! ;
4548
46- const { store } = startTUI ( VERSION , Program . PostHogIntegration ) ;
49+ // Which program to drive — PROGRAM env from the workbench e2e runner;
50+ // defaults to the integration flow. getProgramConfig throws on unknown ids.
51+ const programId = ( process . env . PROGRAM ||
52+ Program . PostHogIntegration ) as ProgramId ;
53+ const programConfig = getProgramConfig ( programId ) ;
54+
55+ const { store } = startTUI ( VERSION , programId ) ;
4756 store . session = buildSession ( {
4857 installDir : process . env . APP_DIR ! ,
4958 ci : true ,
5059 apiKey,
5160 projectId,
5261 region : 'us' ,
62+ // Local skills + MCP (context-mill dev server on :8765, MCP on :8787) —
63+ // same env-backed flag the bin's --local-mcp reads.
64+ localMcp : process . env . POSTHOG_WIZARD_LOCAL_MCP === 'true' ,
5365 // Switchboard variation overrides (see e2e.json `variations`), threaded by
5466 // the snapshot driver as one run per variation. Empty ⇒ resolved default.
5567 harness : ( process . env . SNAP_HARNESS || undefined ) as Harness | undefined ,
@@ -66,7 +78,7 @@ async function main() {
6678 ci : true ,
6779 apiKey,
6880 projectId : Number ( projectId ) ,
69- programId : Program . PostHogIntegration ,
81+ programId,
7082 } ) ;
7183 store . setCredentials ( {
7284 accessToken : d . accessToken ,
@@ -76,12 +88,12 @@ async function main() {
7688 } ) ;
7789 } ;
7890
79- // Pass the intro and health-check gates and run the real integration agent.
91+ // Pass the intro and health-check gates and run the program's real agent.
8092 // The auth and run screens never advance on their own; this is what moves them.
8193 const runIntegration = async ( ) => {
8294 await store . getGate ( 'intro' ) ;
8395 await store . getGate ( 'health-check' ) ;
84- await runAgent ( posthogIntegrationConfig , store . session ) ;
96+ await runAgent ( programConfig , store . session ) ;
8597 } ;
8698
8799 if ( process . env . MODE === 'serve' ) return serve ( ) ;
@@ -166,7 +178,7 @@ async function main() {
166178 // ---- CI route: self-drive the fixed profile, snapshot each screen ----
167179 async function fixed ( ) {
168180 const CTRL = process . env . SNAP_CTRL ! ;
169- const profile : WizardE2eProfile = profileFor ( Program . PostHogIntegration ) ;
181+ const profile : WizardE2eProfile = profileFor ( programId ) ;
170182 const screenPath : string [ ] = [ ] ;
171183 // Snapshot on key moments — a screen change, a task-list update, or a
172184 // runPhase change — so the run screen's progression (the agent working) is
0 commit comments