Files
PiEgg 70e66f30f4 ci: remove the obsolete v3 dispatch entries from main (#11580)
v3-develop was renamed to v3, which is the default branch, so v3 workflows are dispatched from it directly. The thin v3-*.yml entries on main still dispatched ref "v3-develop", which no longer exists, and are removed along with docs/v3-workflows.md, which only described them.

V2 workflow entries now reads the entries from the event's default branch instead of naming v3-develop, and AGENTS.md describes the current layout.
2026-11-17 01:54:04 -05:00

5.6 KiB

AGENTS

This file holds the team-shared rules for AI coding agents working in this repository. It is the single source of truth — CLAUDE.md is a one-line bridge (@AGENTS.md) so Claude Code reads the same content.

Personal Local Rules

If a file AGENTS.local.md exists in this repository root, read it once at the start of the session and treat its contents as additional personal rules that extend (but never override) the team rules in this file.

Project Structure

  • New plugins live under packages/plugins/@nocobase/plugin-<name>/. Reuse the existing plugin scaffold; do not invent a new layout.
  • This repo has two client runtimes: legacy v1 (src/client/, @nocobase/client, SchemaComponent) and v2 (src/client-v2/, @nocobase/client-v2, FlowEngine / FlowModel). Confirm which runtime the file under edit belongs to before writing code. Import direction is one-way: v1 client may import from v2 (@nocobase/client-v2), but v2 client must never import from v1 (@nocobase/client).
  • Pro (not open source) plugins live in individual repositories under packages/plugins or packages/pro-plugins (for example, @nocobase/plugin-workflow-approval), but used not as submodules. When working on a pro plugin, clone its repo separately under packages/plugins/ or packages/pro-plugins/ and treat it as a standalone project with git.

Code Style Rules

  • Do not use void someAsyncCall() style fire-and-forget invocation. Prefer direct invocation such as someAsyncCall() and structure surrounding code accordingly.
  • Avoid any in TypeScript. Reach for a specific type, a generic, or unknown with a narrowing guard instead. Replace as any with a named type or a type guard. When touching existing code that uses any, narrow it to a concrete type whenever feasible.
  • For frontend components and pages, prefer Ant Design v5 components and follow its conventions. Reference https://ant.design/llms.txt for antd's LLM-friendly documentation when needed.
  • For frontend components and pages, follow accessibility (a11y) best practices — add appropriate ARIA attributes, use semantic HTML, and ensure keyboard navigation works.
  • Do not use async IIFE patterns in event handlers (for example: runAsyncTask((async () => { ... })())). Extract the async logic into a named async function or call it directly.
  • Do not introduce new abstractions, error-handling layers, or feature flags beyond what the task requires. Three similar lines is better than a premature abstraction.
  • Do not hard-wrap // comments at a narrow width. Let each comment line run to the project's printWidth (120) before wrapping, so prose fills the line instead of breaking into many short, truncated-looking lines. Verbatim content stays as-is: ASCII diagrams, bullet/numbered lists, blank-line paragraph breaks, and directive lines (eslint-disable*, @ts-*, prettier-ignore) keep their own line breaks.

Database & Migrations

  • Any change to database tables, columns, or indexes must ship with a migration under the plugin's src/server/migrations/. Import column types from DataTypes; do not reuse type names from neighboring migrations without verifying they still apply.
  • New collections (tables), columns, indexes will be automatically synced to database when running the command yarn nocobase upgrade (will also run in docker container when start). So no need to create migration files in these cases.

Testing Rules

  • Run single test file: yarn test <path-to-test-file>
    • Client example: yarn test packages/core/flow-engine/src/__tests__/flow-engine.test.ts --run --reporter=verbose
    • Server example: yarn test packages/core/server/src/__tests__/Application.test.ts
  • Always run related test files after modifying source code to ensure no regressions.
  • Co-locate unit and integration tests in __tests__ directories, naming files *.test.ts or *.spec.ts.
  • Do NOT run server tests parallelly; they may interfere with each other. Use yarn test to run them sequentially.

Internationalization (i18n)

  • User-facing strings (UI labels, messages, errors shown to end users) must go through the project's i18n layer (t() / useTranslation()); do not hardcode them. Add keys for both en-US and zh-CN when introducing new strings.

V3 Workflows and V2 Workflow Entries

NocoBase 3 lives on v3, the repository's default branch, and on v3-main; this branch (main) maintains v1/v2. All v3 workflows (v3-*.yml) live on the v3 branches and are run from there, so main keeps no v3 workflow files or dispatch entries. Do not add v3 workflows to main.

GitHub only offers a manual run for a workflow_dispatch workflow whose file exists on the default branch, so the default branch carries one thin entry per v1/v2 manual workflow on main (same filename, name and inputs) that dispatches the workflow on main; workflows that have never run are listed in EXCLUDED in scripts/check-v2-workflow-entries.mjs there instead. When a pull request on main adds, removes or renames a manual workflow, or changes its name or inputs, update its entry on the default branch first, then main; .github/workflows/v2-workflow-entries.yml fails the pull request until they match. See .agents/rules/workflows-and-release.md on the default branch ("V2 workflow entries on v3"). Preserve all existing v1/v2 workflow behavior.

Pre-Commit Workflow

  • Run yarn eslint --fix on touched files before reporting work as done. Resolve type errors and lint warnings rather than disabling them.

Commit Conventions

  • Commit messages follow Conventional Commits, prefixed with the affected scope: fix(plugin-workflow): ..., feat(client): ..., chore: ..., docs: ....