Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ import { errorTrackingCommand } from './src/commands/error-tracking';
import { skillCommand } from './src/commands/skill';
import { cliCommand } from './src/commands/cli';
import { recoverOrphanedSettingsBackups } from './src/lib/claude-settings';
import { setUI } from './src/ui';
import { LoggingUI } from './src/ui/tui/console/logging-ui';

// The entry point owns the default renderer; @ui ships with none.
setUI(new LoggingUI());

// Heal any .claude/settings backup a previous interrupted run left orphaned,
// before anything else reads Claude settings — conflict detection, OAuth, and
Expand Down
5 changes: 3 additions & 2 deletions e2e-harness/__tests__/e2e-flow-snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { SELF_DRIVING_INTEGRATE_PATH_KEY } from '@lib/programs/self-driving/dete
import { WizardCiDriver } from '../wizard-ci-driver';
import { decideE2eAction, type WizardE2eProfile } from '../e2e-profile';
import { profileFor } from '../profiles';
import { flowFor } from '@lib/programs/flow-for';

/**
* Walk a program flow offline using an e2e profile, injecting the external
Expand All @@ -47,7 +48,7 @@ function traceFlow(
action: string;
params?: Record<string, unknown>;
}> {
const store = new WizardStore(program);
const store = new WizardStore(flowFor(program).flow);
setUI(new InkUI(store));
const session = buildSession({ installDir: '/tmp/e2e-snap', ci: true });
if (integration) {
Expand Down Expand Up @@ -117,7 +118,7 @@ function traceFlow(
// `run` thunk, e.g. self-driving's integrate-run) and the program's own
// run. Complete the active run step the way the runner would: a composed
// step via completeRunStep, the main run via runPhase.
const steps = getProgramConfig(store.router.activeProgram).steps;
const steps = getProgramConfig(store.activeProgram).steps;
const runStep = steps.find(
(s) =>
s.screenId === 'run' &&
Expand Down
9 changes: 6 additions & 3 deletions e2e-harness/__tests__/wizard-ci-driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import { WizardCiDriver, UnknownActionError } from '../wizard-ci-driver';
import { ACTION_REGISTRY, NO_ACTION_SCREENS } from '../action-registry';
import { SOURCE_MAPS_CONTEXT_KEYS } from '@lib/programs/error-tracking-upload-source-maps/index';
import { OutroKind } from '@lib/wizard-session';
import { flowFor } from '@lib/programs/flow-for';

function freshStore(): WizardStore {
const store = new WizardStore(Program.PostHogIntegration);
const store = new WizardStore(flowFor(Program.PostHogIntegration).flow);
// Headless: a real store + InkUI (which only forwards to the store), no Ink
// render. setUI so any getUI() path the store touches resolves.
setUI(new InkUI(store));
Expand Down Expand Up @@ -199,7 +200,7 @@ describe('WizardCiDriver — wizard_ask overlay', () => {

describe('WizardCiDriver — self-driving integration check', () => {
function selfDrivingStore(): WizardStore {
const store = new WizardStore(Program.SelfDriving);
const store = new WizardStore(flowFor(Program.SelfDriving).flow);
setUI(new InkUI(store));
store.session = buildSession({ installDir: '/tmp/ci-driver-sd', ci: true });
return store;
Expand Down Expand Up @@ -239,7 +240,9 @@ describe('WizardCiDriver — self-driving integration check', () => {

describe('WizardCiDriver — source-maps project pick', () => {
function sourceMapsStore(): WizardStore {
const store = new WizardStore(Program.ErrorTrackingUploadSourceMaps);
const store = new WizardStore(
flowFor(Program.ErrorTrackingUploadSourceMaps).flow,
);
setUI(new InkUI(store));
store.session = buildSession({ installDir: '/tmp/ci-driver-sm', ci: true });
return store;
Expand Down
18 changes: 10 additions & 8 deletions e2e-harness/wizard-ci-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ export class WizardCiDriver {
/** Snapshot the committed state plus the derived screen. */
readState(): CiState {
const s = this.store.session;
const screen = this.store.currentScreen;
const screen = this.store.currentScreen as ScreenName;
return {
currentScreen: screen,
hasOverlay: this.store.router.hasOverlay,
hasOverlay: this.store.hasInterrupt,
runPhase: s.runPhase,
session: {
installDir: s.installDir,
Expand Down Expand Up @@ -148,11 +148,13 @@ export class WizardCiDriver {

/** Exposed through read_state.actions; there is no list_actions MCP tool. */
listActions(): ActionView[] {
return actionsForScreen(this.store.currentScreen).map((a) => ({
id: a.id,
description: a.description,
...(a.params ? { params: a.params } : {}),
}));
return actionsForScreen(this.store.currentScreen as ScreenName).map(
(a) => ({
id: a.id,
description: a.description,
...(a.params ? { params: a.params } : {}),
}),
);
}

/**
Expand All @@ -164,7 +166,7 @@ export class WizardCiDriver {
actionId: string,
params: Record<string, unknown> = {},
): CiState {
const screen = this.store.currentScreen;
const screen = this.store.currentScreen as ScreenName;
const action = actionsForScreen(screen).find((a) => a.id === actionId);
if (!action) throw new UnknownActionError(actionId, screen);
action.apply(this.store, params); // may throw MissingParamError
Expand Down
Loading
Loading