refactor(prompt-builder): locale-dispatch every section for zh/en parity

Split each prompt section into parallel .en.md/.zh.md bundles (sops, api-docs,
ceo-modes, department-guidelines) and mirrored messages/{operating,system}-{en,zh}.ts
modules for the inline identity/culture/rules text that had stayed as hard-coded
English template literals. Every loader now resolves a locale via a single
shared helper so CEO and IC prompts come out fully Chinese when locale=zh and
fully English otherwise, removing the need for the trailing "请记住:全程使用中文"
language reminder.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-17 00:01:34 -04:00
1 parent e1f70c7f9c
commit cf92e0c646
91 files changed
+2425 -562

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
import type { AppLocale } from "@shared/locale";
import { resolveLocale } from "./locale";
import * as operatingEn from "./operating-en";
import * as operatingZh from "./operating-zh";
import * as systemEn from "./system-en";
import * as systemZh from "./system-zh";
export type OperatingMessages = typeof operatingEn;
export type SystemMessages = typeof systemEn;
// zh bundles are constructed from different string literals than en, so
// their inferred types are technically distinct. Symbol sets are mirrored
// one-for-one, so the `as unknown` coercion is safe by construction.
const OPERATING: Record<AppLocale, OperatingMessages> = {
en: operatingEn,
zh: operatingZh as unknown as OperatingMessages,
};
const SYSTEM: Record<AppLocale, SystemMessages> = {
en: systemEn,
zh: systemZh as unknown as SystemMessages,
};
export function getOperatingMessages(locale: AppLocale | undefined): OperatingMessages {
return OPERATING[resolveLocale(locale)];
}
export function getSystemMessages(locale: AppLocale | undefined): SystemMessages {
return SYSTEM[resolveLocale(locale)];
}
export { resolveLocale };