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

Function contextFor

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

Source from the content-addressed store, hash-verified

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