Files
EJClaw/src/platform-prompts.ts
Eyejoker 1031cd44dd refactor: SSOT for paired room prompts, remove 4 duplicate files
All reviewers (claude, codex-review, codex-review-failover) now use
claude-paired-room.md. All owners use owner-common-paired-room.md.

Removed: codex-paired-room.md, codex-review-paired-room.md,
codex-review-failover-paired-room.md, codex-review-platform.md

10 prompt files → 6.
2026-03-30 02:39:04 +09:00

63 lines
1.7 KiB
TypeScript

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',
};
// SSOT: both agent types use the same paired room prompts.
// Role-specific rules (owner vs reviewer) are selected by the caller.
const PAIRED_ROOM_PROMPT_FILES: Record<AgentType, string> = {
'claude-code': 'claude-paired-room.md',
codex: 'claude-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;
}