MCPcopy Create free account
hub / github.com/cortexkit/magic-context / writeConfigs

Function writeConfigs

packages/e2e-tests/src/pi-runner/spawn.ts:118–172  ·  view source on GitHub ↗
(env: PiIsolatedEnv, opts: PiRunnerOptions)

Source from the content-addressed store, hash-verified

116}
117
118export function writeConfigs(env: PiIsolatedEnv, opts: PiRunnerOptions): void {
119 ensurePluginAvailable(env);
120
121 const settings = {
122 packages: [env.pluginDir],
123 defaultProvider: "anthropic",
124 defaultModel: "claude-haiku-4-5",
125 enabledModels: ["anthropic/claude-haiku-4-5"],
126 compaction: { enabled: false },
127 retry: { enabled: false },
128 quietStartup: true,
129 enableInstallTelemetry: false,
130 ...(opts.piSettingsExtra ?? {}),
131 };
132 writeFileSync(join(env.agentDir, "settings.json"), JSON.stringify(settings, null, 2));
133
134 const models = {
135 providers: {
136 anthropic: {
137 baseUrl: opts.mockProviderURL,
138 apiKey: "test-key-not-real",
139 modelOverrides: {
140 "claude-haiku-4-5": {
141 contextWindow: opts.modelContextLimit ?? 200000,
142 maxTokens: 8192,
143 reasoning: false,
144 },
145 },
146 },
147 },
148 };
149 writeFileSync(join(env.agentDir, "models.json"), JSON.stringify(models, null, 2));
150
151 const magicContext = {
152 $schema:
153 "https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/assets/magic-context.schema.json",
154 enabled: true,
155 ctx_reduce_enabled: true,
156 protected_tags: 1,
157 execute_threshold_percentage: 40,
158 history_budget_percentage: 0.15,
159 memory: {
160 enabled: true,
161 auto_promote: false,
162 auto_search: { enabled: false },
163 git_commit_indexing: { enabled: false },
164 },
165 embedding: { provider: "off" },
166 historian: { model: "" },
167 dreamer: { disable: true },
168 sidekick: { disable: true },
169 ...(opts.magicContextConfig ?? {}),
170 };
171 writeFileSync(join(env.agentDir, "magic-context.jsonc"), JSON.stringify(magicContext, null, 2));
172}
173
174export function childEnv(env: PiIsolatedEnv): Record<string, string> {
175 const result: Record<string, string> = {};

Callers 1

startMethod · 0.90

Calls 1

ensurePluginAvailableFunction · 0.85

Tested by

no test coverage detected