GitNexus / codegraph
Understand code structure, impact, and change scope
Keep development changes small, validation explicit, and impact understandable. The repository uses Turborepo as the unified task orchestrator: root tasks (//#py:*, //#md:*, //#js:* — scripts in root package.json) cover the Python toolchain, while workspace packages (apps/docs, apps/lingc-cli) own their lint / type / test / build tasks. Taskfile.yml is a thin delegation shell — task check / task test / task build / task format / task fix / task ci:* are single-line pnpm turbo run ... calls — and keeps release / version / db / hooks / smoke tasks that need secrets or CLI arg passthrough.
This section guides external developers from zero to a working development environment.
requires-python = ">=3.13, <3.14")Clone the repository:
git clone https://github.com/xinvxueyuan/lingchu-bot.gitcd lingchu-botInstall all dependencies (Python + Node.js):
task installThis runs uv sync and pnpm install. To install separately:
uv sync --frozen # Python dependenciespnpm install --frozen-lockfile # Node.js dependenciesCopy the environment template:
cp .env.example .envEdit .env to set LINGCHU_SUPERUSERS and adapter connection details for your environment.
Verify the setup:
task check # Static checks, format, Markdown lint, type checktask test # Root pytest + lingc-cli tests + docs testsIf both pass, the environment is ready for development.
The typical development cycle:
Create a branch: git checkout -b feature/your-feature
Make changes following existing patterns and style.
Run focused checks on changed files:
uv run -m ruff check path/to/file.pyuv run -m ruff format path/to/file.pyRun the full check suite before committing:
task checktask testCommit with gitmoji + Conventional Commits format (enforced by .husky/commit-msg).
Push and open a PR following the PR description guidelines.
| Test type | Command | Scope |
|---|---|---|
| Python unit tests | uv run -m pytest |
All Python tests |
| Python focused tests | uv run -m pytest tests/handle/commands/test_mute.py |
Single test file |
| Docs tests | pnpm --filter docs test |
Vitest component/unit tests |
| Docs build | pnpm turbo run build --filter=docs |
Static docs output and Starlight/Pagefind generation |
| E2E tests | pnpm --filter docs exec playwright test |
Playwright browser tests |
| Full CI sequence | task ci |
check + test + build |
task build # Build all workspaces (root wheel + lingc-cli + docs)pnpm turbo run build --filter=docs # Build docs site onlyuv build --clear # Build Python package onlyWhen changing translatable strings:
task i18n # Extract, update, and compile gettext catalogsThis runs pybabel extract, pybabel update, and pybabel compile. See Internationalization for details.
Clarify the goal, success criteria, and out-of-scope items before writing any code.
Run git status --short and confirm existing changes. Assume by default that existing changes came from another contributor or an earlier work session.
Read related code and tests, preferring existing structure. Use GitNexus or codegraph to understand code structure and relationships.
Run GitNexus or codegraph impact analysis before changing functions, classes, or methods.
Implement the smallest useful change and add tests.
Run the relevant checks through task check, task test, or focused uv / pnpm commands.
Run GitNexus detect changes before committing.
Prefer these Taskfile tasks:
task installtask checktask testtask buildtask citask i18nFor Python-only changes, use focused uv run ... checks when appropriate. For docs or frontend-package changes, use focused pnpm --filter docs ... or pnpm turbo run ... checks.
GitNexus / codegraph
Understand code structure, impact, and change scope
Context7
Query current documentation for libraries, frameworks, SDKs, CLI tools, or cloud services
Husky / prek
Local Git hooks and pre-commit checks
Turbo
Cross-workspace lint, type check, and build orchestration for docs and packages
Do not revert, format, or rewrite files unrelated to the current task. When existing changes are present, assume by default that they came from another contributor or an earlier work session.
Common branch prefixes:
| Prefix | Purpose |
|---|---|
feature/ |
New features |
fix/ |
Bug fixes |
hotfix/ |
Urgent production fixes |
docs/ |
Documentation changes |
refactor/ |
Code refactoring |
GitHub Actions also match branches such as feature/**, fix/**, hotfix/*, main, and dev. Formal releases are manual-trigger only — see Cut a release — so no releases/** branches are pushed. The actual target branch should follow maintainer or PR-page guidance.
Commit messages must follow gitmoji + Conventional Commits. See Commit Style.
🐛 fix: 修复成员禁言成功反馈📝 docs: 重写文档站✅ test: 增加群管理异常覆盖A PR should explain:
If the PR touches the documentation site or internationalization, note whether Markdown lint, docs lint/test/build, and task i18n were run.