feat: add Pi as first-class Mosaic runtime (#339)
This commit was merged in pull request #339.
This commit is contained in:
@@ -16,6 +16,8 @@ export function configureMcpForRuntime(runtime: RuntimeName): void {
|
||||
return configureCodexMcp();
|
||||
case 'opencode':
|
||||
return configureOpenCodeMcp();
|
||||
case 'pi':
|
||||
return configurePiMcp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +71,31 @@ function configureCodexMcp(): void {
|
||||
writeFileSync(configPath, content, 'utf-8');
|
||||
}
|
||||
|
||||
function configurePiMcp(): void {
|
||||
const settingsPath = join(homedir(), '.pi', 'agent', 'settings.json');
|
||||
ensureDir(settingsPath);
|
||||
|
||||
let data: Record<string, unknown> = {};
|
||||
if (existsSync(settingsPath)) {
|
||||
try {
|
||||
data = JSON.parse(readFileSync(settingsPath, 'utf-8')) as Record<string, unknown>;
|
||||
} catch {
|
||||
// Start fresh if corrupt
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!data['mcpServers'] ||
|
||||
typeof data['mcpServers'] !== 'object' ||
|
||||
Array.isArray(data['mcpServers'])
|
||||
) {
|
||||
data['mcpServers'] = {};
|
||||
}
|
||||
(data['mcpServers'] as Record<string, unknown>)['sequential-thinking'] = MCP_ENTRY;
|
||||
|
||||
writeFileSync(settingsPath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
||||
}
|
||||
|
||||
function configureOpenCodeMcp(): void {
|
||||
const configPath = join(homedir(), '.config', 'opencode', 'config.json');
|
||||
ensureDir(configPath);
|
||||
|
||||
Reference in New Issue
Block a user