refactor: remove legacy container and non-discord remnants
This commit is contained in:
60
src/platform-prompts.ts
Normal file
60
src/platform-prompts.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import type { AgentType } from './types.js';
|
||||
|
||||
const PLATFORM_PROMPT_FILES: Record<AgentType, string> = {
|
||||
'claude-code': 'claude-platform.md',
|
||||
codex: 'codex-platform.md',
|
||||
};
|
||||
|
||||
const PAIRED_ROOM_PROMPT_FILES: Record<AgentType, string> = {
|
||||
'claude-code': 'claude-paired-room.md',
|
||||
codex: 'codex-paired-room.md',
|
||||
};
|
||||
|
||||
export function getPlatformPromptsDir(projectRoot = process.cwd()): string {
|
||||
return path.join(projectRoot, 'prompts');
|
||||
}
|
||||
|
||||
export function getPlatformPromptPath(
|
||||
agentType: AgentType,
|
||||
projectRoot = process.cwd(),
|
||||
): string {
|
||||
return path.join(
|
||||
getPlatformPromptsDir(projectRoot),
|
||||
PLATFORM_PROMPT_FILES[agentType],
|
||||
);
|
||||
}
|
||||
|
||||
export function readPlatformPrompt(
|
||||
agentType: AgentType,
|
||||
projectRoot = process.cwd(),
|
||||
): string | undefined {
|
||||
const promptPath = getPlatformPromptPath(agentType, projectRoot);
|
||||
if (!fs.existsSync(promptPath)) return undefined;
|
||||
|
||||
const prompt = fs.readFileSync(promptPath, 'utf-8').trim();
|
||||
return prompt || undefined;
|
||||
}
|
||||
|
||||
export function getPairedRoomPromptPath(
|
||||
agentType: AgentType,
|
||||
projectRoot = process.cwd(),
|
||||
): string {
|
||||
return path.join(
|
||||
getPlatformPromptsDir(projectRoot),
|
||||
PAIRED_ROOM_PROMPT_FILES[agentType],
|
||||
);
|
||||
}
|
||||
|
||||
export function readPairedRoomPrompt(
|
||||
agentType: AgentType,
|
||||
projectRoot = process.cwd(),
|
||||
): string | undefined {
|
||||
const promptPath = getPairedRoomPromptPath(agentType, projectRoot);
|
||||
if (!fs.existsSync(promptPath)) return undefined;
|
||||
|
||||
const prompt = fs.readFileSync(promptPath, 'utf-8').trim();
|
||||
return prompt || undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user