docs: AGENTS.md 문서에 섹션 추가 및 내용 정리

This commit is contained in:
2026-01-05 15:45:22 +00:00
parent e0dfe567db
commit cb312f02b3
+22 -4
View File
@@ -1,18 +1,21 @@
# Repository Guidelines # Repository Guidelines
## Project Goal (Rewrite) ## Project Goal (Rewrite)
- This repository is transitioning from the legacy PHP codebase to a TypeScript-based monorepo using pnpm workspaces. - This repository is transitioning from the legacy PHP codebase to a TypeScript-based monorepo using pnpm workspaces.
- The legacy game remains the current active source under `legacy/` while the rewrite is prepared alongside it. - The legacy game remains the current active source under `legacy/` while the rewrite is prepared alongside it.
- Legacy data under `legacy/` is for migration only; once DB migration is complete, - Legacy data under `legacy/` is for migration only; once DB migration is complete,
the runtime will no longer depend on legacy data. the runtime will no longer depend on legacy data.
## Project Naming ## Project Naming
- Official name: 삼국지 모의전투 HiDCHe - Official name: 삼국지 모의전투 HiDCHe
- Common nicknames: 삼모, 삼모전, 힏체섭 - Common nicknames: 삼모, 삼모전, 힏체섭
- Short forms in code/docs: sammo, hidche - Short forms in code/docs: sammo, hidche
- TypeScript rewrite working name: sammo-ts - TypeScript rewrite working name: sammo-ts
## Project Structure & Module Organization ## Project Structure & Module Organization
- `legacy/` contains the application source. This is the active codebase. - `legacy/` contains the application source. This is the active codebase.
- PHP entry points live under `legacy/` and `legacy/hwe/` (for example `legacy/index.php`, `legacy/hwe/index.php`). - PHP entry points live under `legacy/` and `legacy/hwe/` (for example `legacy/index.php`, `legacy/hwe/index.php`).
- `legacy/` is mostly a shell; `legacy/src/` is largely unused. - `legacy/` is mostly a shell; `legacy/src/` is largely unused.
@@ -23,12 +26,14 @@
- Static data/assets: scenarios in `legacy/hwe/scenario/`, templates in `legacy/hwe/templates/`. - Static data/assets: scenarios in `legacy/hwe/scenario/`, templates in `legacy/hwe/templates/`.
## Legacy Endpoint Patterns ## Legacy Endpoint Patterns
- JSON API handlers: `legacy/hwe/j_*.php`. - JSON API handlers: `legacy/hwe/j_*.php`.
- Vue multi-entry pages: `legacy/hwe/v_*.php`. - Vue multi-entry pages: `legacy/hwe/v_*.php`.
- Legacy PHP + jQuery pages: `legacy/hwe/b_*.php` with POST handlers in `legacy/hwe/c_*.php`. - Legacy PHP + jQuery pages: `legacy/hwe/b_*.php` with POST handlers in `legacy/hwe/c_*.php`.
- Modern API router: `legacy/hwe/api.php` accepts a path argument and dispatches to `legacy/hwe/API/` modules. - Modern API router: `legacy/hwe/api.php` accepts a path argument and dispatches to `legacy/hwe/API/` modules.
## Planned Monorepo Layout (TypeScript Rewrite) ## Planned Monorepo Layout (TypeScript Rewrite)
- `/packages/common`: shared utilities and type definitions. - `/packages/common`: shared utilities and type definitions.
- `/packages/infra`: Prisma/Redis connectors and other runtime infra. - `/packages/infra`: Prisma/Redis connectors and other runtime infra.
- `/packages/logic`: pure game logic with DI/interfaces for external dependencies. - `/packages/logic`: pure game logic with DI/interfaces for external dependencies.
@@ -40,6 +45,7 @@
- `/tools/build-scripts`: build and deployment scripts. - `/tools/build-scripts`: build and deployment scripts.
## Planned Runtime & Tooling ## Planned Runtime & Tooling
- Backend: Node.js + Fastify, with Prisma ORM. - Backend: Node.js + Fastify, with Prisma ORM.
- Turn daemon: turn scheduler/resolver service for game ticks. - Turn daemon: turn scheduler/resolver service for game ticks.
- Turn daemon and API server communicate via Redis Stream or Redis pub/sub. - Turn daemon and API server communicate via Redis Stream or Redis pub/sub.
@@ -52,21 +58,26 @@
- Build output: server builds emitted to `/dist/{profileName}` per profile. - Build output: server builds emitted to `/dist/{profileName}` per profile.
## Suggested Monorepo Scripts (Proposal) ## Suggested Monorepo Scripts (Proposal)
These are placeholders to align teams; adjust once packages exist. These are placeholders to align teams; adjust once packages exist.
- `pnpm install`: install all workspace dependencies. - `pnpm install`: install all workspace dependencies.
- `pnpm -r lint`: lint all packages. - `pnpm typecheck`: run TypeScript type checks in all packages.
- `pnpm -r test`: run all unit tests (Vitest where configured). - `pnpm lint`: lint all packages.
- `pnpm -r build`: build all packages/apps. - `pnpm test`: run all unit tests (Vitest where configured).
- `pnpm -r dev`: run dev servers where applicable. - `pnpm build`: build all packages/apps.
- `pnpm dev`: run dev servers where applicable.
- `pnpm --filter ./app/game-frontend dev`: run a single app by filter. - `pnpm --filter ./app/game-frontend dev`: run a single app by filter.
- `pnpm --filter ./app/game-api dev`: run a single service by filter. - `pnpm --filter ./app/game-api dev`: run a single service by filter.
- `pnpm --filter ./app/game-engine dev`: run a single service by filter. - `pnpm --filter ./app/game-engine dev`: run a single service by filter.
## Development Checklist (AI) ## Development Checklist (AI)
- After code changes, verify TypeScript type checks (prefer `pnpm -r build` or the package `tsc`). - After code changes, verify TypeScript type checks (prefer `pnpm -r build` or the package `tsc`).
- When changes require unit tests, run the relevant tests. - When changes require unit tests, run the relevant tests.
## Build Profiles (Proposal) ## Build Profiles (Proposal)
- A build profile is a server+scenario pair; scenario selection is required even if a default exists. - A build profile is a server+scenario pair; scenario selection is required even if a default exists.
- Server builds should accept a profile (server variant) plus an explicit scenario file input. - Server builds should accept a profile (server variant) plus an explicit scenario file input.
- Recommended pattern: a `tools/build-scripts` runner invoked by pnpm, e.g. `pnpm build:server --profile che --scenario default`. - Recommended pattern: a `tools/build-scripts` runner invoked by pnpm, e.g. `pnpm build:server --profile che --scenario default`.
@@ -76,10 +87,12 @@ These are placeholders to align teams; adjust once packages exist.
- The scenario file determines unit sets and DB settings that must be prepared before build output is emitted. - The scenario file determines unit sets and DB settings that must be prepared before build output is emitted.
## Server Profiles (Planned) ## Server Profiles (Planned)
- Server IDs: `che`, `kwe`, `pwe`, `twe`, `nya`, `pya` - Server IDs: `che`, `kwe`, `pwe`, `twe`, `nya`, `pya`
- Each build/run profile combines a server ID with a scenario selection. - Each build/run profile combines a server ID with a scenario selection.
## Game Domain Notes (Behavioral Context) ## Game Domain Notes (Behavioral Context)
- Turn-based multiplayer loop with configurable tick length (historically 120/60/30/20/10/5/2/1 min; experimental day/night schedules). - Turn-based multiplayer loop with configurable tick length (historically 120/60/30/20/10/5/2/1 min; experimental day/night schedules).
- Core stats: leadership, strength, intelligence with effects on internal affairs and combat. - Core stats: leadership, strength, intelligence with effects on internal affairs and combat.
- Traits and modifiers apply via the Trigger system, evaluated by priority; "attempt" then "execute". - Traits and modifiers apply via the Trigger system, evaluated by priority; "attempt" then "execute".
@@ -87,12 +100,14 @@ These are placeholders to align teams; adjust once packages exist.
- "Unit packs" bundle unit graphics, audio, and special effects per scenario. - "Unit packs" bundle unit graphics, audio, and special effects per scenario.
## Randomness Policy (Verifiable RNG) ## Randomness Policy (Verifiable RNG)
- All game-impacting randomness must be verifiable and reproducible from a deterministic seed. - All game-impacting randomness must be verifiable and reproducible from a deterministic seed.
- Prefer reusing the existing TypeScript implementations: `legacy/hwe/ts/util/LiteHashDRBG.ts` and `legacy/hwe/ts/util/RNG.ts` with minimal or no changes. - Prefer reusing the existing TypeScript implementations: `legacy/hwe/ts/util/LiteHashDRBG.ts` and `legacy/hwe/ts/util/RNG.ts` with minimal or no changes.
- Seed composition should include a hidden base seed plus action context (action type, time, actor, target) so results can be re-validated later. - Seed composition should include a hidden base seed plus action context (action type, time, actor, target) so results can be re-validated later.
- Do not introduce ad-hoc randomness in game logic; allow non-deterministic randomness only for non-gameplay, cosmetic, or UI-only cases. - Do not introduce ad-hoc randomness in game logic; allow non-deterministic randomness only for non-gameplay, cosmetic, or UI-only cases.
## Coding Style & Naming Conventions ## Coding Style & Naming Conventions
- Follow repo lint/format configuration once it exists; keep diffs consistent within a file. - Follow repo lint/format configuration once it exists; keep diffs consistent within a file.
- Indentation: 4 spaces for TypeScript, JSON, and Vue SFCs. - Indentation: 4 spaces for TypeScript, JSON, and Vue SFCs.
- Prefer explicit types for public APIs; avoid `any` and narrow `unknown`. - Prefer explicit types for public APIs; avoid `any` and narrow `unknown`.
@@ -103,15 +118,18 @@ These are placeholders to align teams; adjust once packages exist.
- For classes, commands, and domain logic, add clear Korean comments to support Korean readers and future maintainers. - For classes, commands, and domain logic, add clear Korean comments to support Korean readers and future maintainers.
## Commit & Pull Request Guidelines ## Commit & Pull Request Guidelines
- Git history is minimal and does not define a strict convention; use short, imperative messages (e.g., "Fix map cache loading"). - Git history is minimal and does not define a strict convention; use short, imperative messages (e.g., "Fix map cache loading").
- PRs should include a concise description, testing notes/commands, and screenshots for UI changes. - PRs should include a concise description, testing notes/commands, and screenshots for UI changes.
## Architecture References ## Architecture References
- Overview: `docs/architecture/overview.md`. - Overview: `docs/architecture/overview.md`.
- Legacy engine map: `docs/architecture/legacy-engine.md`. - Legacy engine map: `docs/architecture/legacy-engine.md`.
- TypeScript rewrite plan: `docs/architecture/rewrite-plan.md`. - TypeScript rewrite plan: `docs/architecture/rewrite-plan.md`.
- Runtime and build profiles: `docs/architecture/runtime.md`. - Runtime and build profiles: `docs/architecture/runtime.md`.
## Documentation Workflow ## Documentation Workflow
- When AI proposes future improvements or expansions, record them in - When AI proposes future improvements or expansions, record them in
`docs/architecture/todo.md` with an "AI suggestion" label. `docs/architecture/todo.md` with an "AI suggestion" label.