MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / runInitCommand

Function runInitCommand

src/index.ts:143–153  ·  view source on GitHub ↗
(args: string[])

Source from the content-addressed store, hash-verified

141}
142
143async function runInitCommand(args: string[]) {
144 const nonFlags = args.filter((arg) => !arg.startsWith("--"));
145 const target = parseAgentTarget(nonFlags[0]);
146 const runner = parseRunner(args);
147 const outputPath = resolve(process.cwd(), AGENT_CONFIG_PATH[target]);
148 const content = target === "opencode" ? buildOpenCodeConfig(runner) : buildMcpConfig(runner);
149 await mkdir(dirname(outputPath), { recursive: true });
150 await writeFile(outputPath, `${content}\n`, "utf8");
151 console.error(`Context+ initialized for ${target} using ${runner}.`);
152 console.error(`Wrote MCP config: ${outputPath}`);
153}
154
155const server = new McpServer({
156 name: "contextplus",

Callers 1

mainFunction · 0.85

Calls 4

parseAgentTargetFunction · 0.85
parseRunnerFunction · 0.85
buildOpenCodeConfigFunction · 0.85
buildMcpConfigFunction · 0.85

Tested by

no test coverage detected