Files
core2026/app/game-engine/src/turn/turnCommandProfile.ts
T
Hide_D c63a49bd07 fix: 커맨드 차등 생명주기와 로그 그래프를 보강
장수 55종과 수뇌 35종의 상태, 로그, 메시지, 예약 턴 비교를 닫습니다.

실제 시나리오 프로필과 대표 PostgreSQL 수명주기, 즉시 외교와 출병 회귀를 추가하고 발견된 Ref 로그 및 생성 장수 저장 차이를 교정합니다.
2026-08-23 21:48:29 +00:00

36 lines
1.3 KiB
TypeScript

import fs from 'node:fs/promises';
import path from 'node:path';
import {
parseTurnCommandProfile,
resolveScenarioTurnCommandProfile,
type ScenarioTurnCommandProfileResolution,
type TurnCommandProfile,
} from '@sammo-ts/logic';
import { resolveWorkspaceRoot } from '../paths.js';
const REPO_ROOT = resolveWorkspaceRoot();
const DEFAULT_PROFILE_PATH = path.resolve(REPO_ROOT, 'resources', 'turn-commands', 'default.json');
export interface TurnCommandProfileOptions {
filePath?: string;
scenarioConst?: unknown;
}
const readCommandProfile = async (filePath: string): Promise<TurnCommandProfile> => {
const raw = await fs.readFile(filePath, 'utf8');
return parseTurnCommandProfile(JSON.parse(raw) as unknown);
};
export const loadScenarioTurnCommandProfile = async (
options?: TurnCommandProfileOptions
): Promise<ScenarioTurnCommandProfileResolution> => {
const filePath = options?.filePath ?? process.env.TURN_COMMANDS_PATH ?? DEFAULT_PROFILE_PATH;
const fallback = await readCommandProfile(filePath);
return resolveScenarioTurnCommandProfile(options?.scenarioConst, fallback);
};
export const loadTurnCommandProfile = async (options?: TurnCommandProfileOptions): Promise<TurnCommandProfile> =>
(await loadScenarioTurnCommandProfile(options)).profile;