MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / contextFor

Function contextFor

e2e/src/scenario.ts:87–118  ·  view source on GitHub ↗
(target: TargetShape, dir: string)

Source from the content-addressed store, hash-verified

85 * into the skip.
86 */
87const contextFor = (target: TargetShape, dir: string): Context.Context<AllServices> => {
88 let context = Context.empty().pipe(
89 Context.add(Target, target),
90 Context.add(RunDir, dir),
91 Context.add(Cli, makeCliSurface()),
92 ) as Context.Context<AllServices>;
93 const has = target.capabilities.has.bind(target.capabilities);
94 if (has("api")) context = Context.add(context, Api, makeApiSurface(target));
95 if (has("browser")) context = Context.add(context, Browser, makeBrowserSurface(dir, target));
96 if (has("mcp-oauth")) context = Context.add(context, Mcp, makeMcpSurface(target, dir));
97 if (has("billing")) context = Context.add(context, Billing, true);
98 if (hasOpenCode()) {
99 context = Context.add(context, OpenCode, {
100 makeHome: makeOpenCodeHome,
101 warmUp,
102 completeOAuthConsent,
103 });
104 }
105 if (target.setAccessTokenTtl) {
106 context = Context.add(context, TtlControl, target.setAccessTokenTtl);
107 }
108 if (target.restart) {
109 context = Context.add(context, Restart, target.restart);
110 }
111 if (process.env.E2E_MOTEL_URL) {
112 context = Context.add(context, Telemetry, makeTelemetrySurface(process.env.E2E_MOTEL_URL));
113 }
114 if (process.env.E2E_AUTUMN_URL) {
115 context = Context.add(context, Autumn, makeAutumnSurface(process.env.E2E_AUTUMN_URL));
116 }
117 return context;
118};
119
120export const scenario = (
121 name: string,

Callers 1

scenarioFunction · 0.85

Calls 8

makeCliSurfaceFunction · 0.90
makeApiSurfaceFunction · 0.90
makeBrowserSurfaceFunction · 0.90
makeMcpSurfaceFunction · 0.90
hasOpenCodeFunction · 0.90
makeTelemetrySurfaceFunction · 0.90
makeAutumnSurfaceFunction · 0.90
hasFunction · 0.85

Tested by

no test coverage detected