These instructions are for AI assistants working in this project.
Always open @/openspec/AGENTS.md when the request:
- Mentions planning or proposals (words like proposal, spec, change, plan)
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
- Sounds ambiguous and you need the authoritative spec before coding
Use @/openspec/AGENTS.md to learn:
- How to create and apply change proposals
- Spec format and conventions
- Project structure and guidelines
Keep this managed block so 'openspec update' can refresh the instructions.
Always ask questions before create proposal files if unsure about anything in these instructions or the spec file.
- This repo uses
pnpm(haspnpm-lock.yaml). - If dependencies change, do not only edit
package.json; runpnpm installto ensure deps + lockfile are consistent. Only run this when the user explicitly asks/coordinates it. - In non-TTY environments,
pnpm installmay fail withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY; useCI=true pnpm install. Only run this when the user explicitly asks/coordinates it.
- Exports: do not use
export defaultfor new/modified modules. Prefer named exports (e.g.export { ServerManager }) and named imports (e.g.import { ServerManager } from '...'). - Keep TypeScript types explicit; avoid ad-hoc
anywhen possible. - Don't write
as anyin TypeScript code unless absolutely necessary. Always prefer explicit types. - i18n / user-facing text: do not hard-code user-facing strings (logs, errors, HTML result pages). Add i18n keys under
src/i18n/zh-CN.tsand provide corresponding entries insrc/i18n/en.tsandsrc/i18n/zh-TW.ts, then usectx.i18n.translate<ILocalesKey>(...)(supports${var}placeholders via args). CLI option descriptions are exempt unless explicitly requested. - Commander actions: prefer
.action(async (...) => { ... })and avoid wrapping an IIFE like.action(() => { (async () => { ... })().catch(...) }). - Commander prompts: avoid
prompt<any>/prompt<IStringKeyMap<any>>; declare a concrete answer type (e.g.prompt<{ operation: 'list' | 'rename' }>(...)). - Commander option descriptions: for CLI options, use plain strings without i18n keys unless explicitly requested.
- TypeScript enums: when representing a fixed set of values, prefer
enumover union string literal types unless explicitly requested otherwise. - Config persistence: use
ctx.saveConfig(...)for changes that must persist to disk; usectx.setConfig(...)only for in-memory/session updates.
- If a command fails due to insufficient permissions, rerun with elevated approval.
- For
pnpmcommands that hit network issues, retry first. - After completing a task, run
pnpm lintandpnpm testand ensure they pass before handing work back.
When starting work or if you hit issues, try checking MCP for Serena or Context7 tooling. If available, use those tools to navigate, edit, or fetch docs efficiently.