feat: add Pi as first-class Mosaic runtime (#339)
This commit was merged in pull request #339.
This commit is contained in:
@@ -33,6 +33,12 @@ const RUNTIME_DEFS: Record<
|
|||||||
versionFlag: 'version',
|
versionFlag: 'version',
|
||||||
installHint: 'See https://opencode.ai for install instructions',
|
installHint: 'See https://opencode.ai for install instructions',
|
||||||
},
|
},
|
||||||
|
pi: {
|
||||||
|
label: 'Pi',
|
||||||
|
command: 'pi',
|
||||||
|
versionFlag: '--version',
|
||||||
|
installHint: 'npm install -g @mariozechner/pi-coding-agent',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export function detectRuntime(name: RuntimeName): RuntimeInfo {
|
export function detectRuntime(name: RuntimeName): RuntimeInfo {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export function formatInstallInstructions(name: RuntimeName): string {
|
|||||||
claude: 'Claude Code',
|
claude: 'Claude Code',
|
||||||
codex: 'Codex',
|
codex: 'Codex',
|
||||||
opencode: 'OpenCode',
|
opencode: 'OpenCode',
|
||||||
|
pi: 'Pi',
|
||||||
};
|
};
|
||||||
return `To install ${labels[name]}:\n ${hint}`;
|
return `To install ${labels[name]}:\n ${hint}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ export function configureMcpForRuntime(runtime: RuntimeName): void {
|
|||||||
return configureCodexMcp();
|
return configureCodexMcp();
|
||||||
case 'opencode':
|
case 'opencode':
|
||||||
return configureOpenCodeMcp();
|
return configureOpenCodeMcp();
|
||||||
|
case 'pi':
|
||||||
|
return configurePiMcp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +71,31 @@ function configureCodexMcp(): void {
|
|||||||
writeFileSync(configPath, content, 'utf-8');
|
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 {
|
function configureOpenCodeMcp(): void {
|
||||||
const configPath = join(homedir(), '.config', 'opencode', 'config.json');
|
const configPath = join(homedir(), '.config', 'opencode', 'config.json');
|
||||||
ensureDir(configPath);
|
ensureDir(configPath);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { detectRuntime, type RuntimeInfo } from '../runtime/detector.js';
|
|||||||
import { formatInstallInstructions } from '../runtime/installer.js';
|
import { formatInstallInstructions } from '../runtime/installer.js';
|
||||||
import { configureMcpForRuntime } from '../runtime/mcp-config.js';
|
import { configureMcpForRuntime } from '../runtime/mcp-config.js';
|
||||||
|
|
||||||
const RUNTIME_NAMES: RuntimeName[] = ['claude', 'codex', 'opencode'];
|
const RUNTIME_NAMES: RuntimeName[] = ['claude', 'codex', 'opencode', 'pi'];
|
||||||
|
|
||||||
export async function runtimeSetupStage(p: WizardPrompter, state: WizardState): Promise<void> {
|
export async function runtimeSetupStage(p: WizardPrompter, state: WizardState): Promise<void> {
|
||||||
p.separator();
|
p.separator();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export type WizardMode = 'quick' | 'advanced';
|
export type WizardMode = 'quick' | 'advanced';
|
||||||
export type InstallAction = 'fresh' | 'keep' | 'reconfigure' | 'reset';
|
export type InstallAction = 'fresh' | 'keep' | 'reconfigure' | 'reset';
|
||||||
export type CommunicationStyle = 'direct' | 'friendly' | 'formal';
|
export type CommunicationStyle = 'direct' | 'friendly' | 'formal';
|
||||||
export type RuntimeName = 'claude' | 'codex' | 'opencode';
|
export type RuntimeName = 'claude' | 'codex' | 'opencode' | 'pi';
|
||||||
|
|
||||||
export interface SoulConfig {
|
export interface SoulConfig {
|
||||||
agentName?: string;
|
agentName?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user