Skip to content

chore: add AGENT.md and tune CodeRabbit review config#2065

Open
Adi-204 wants to merge 6 commits intoasyncapi:masterfrom
Adi-204:feat/introduce-code-guidelines
Open

chore: add AGENT.md and tune CodeRabbit review config#2065
Adi-204 wants to merge 6 commits intoasyncapi:masterfrom
Adi-204:feat/introduce-code-guidelines

Conversation

@Adi-204
Copy link
Copy Markdown
Member

@Adi-204 Adi-204 commented Apr 18, 2026

Description
Introduces AGENT.md as the source of truth for code review standards across the asyncapi/generator monorepo, consumed by both human reviewers and AI agents (CodeRabbit). Also tightens CodeRabbit review configuration and refreshes the WebSocket integration-test README to reflect the per-client isolation model landed in #2042.

Related issue(s)
Fixes #2064

Summary by CodeRabbit

  • Documentation

    • Added a consolidated monorepo code review and contribution guidelines document.
    • Updated integration-testing docs with per-client isolation, explicit test/snapshot commands, and a streamlined workflow for adding clients.
  • Chores

    • Enabled additional automated review tooling, stricter lint/format checks, and slop-detection across the repo.
    • Expanded knowledge-base patterns to include the new guidelines document.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 18, 2026

⚠️ No Changeset found

Latest commit: 7ab63cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@asyncapi-bot
Copy link
Copy Markdown
Contributor

What reviewer looks at during PR review

The following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.

  1. PR Title: Use a concise title that follows our Conventional Commits guidelines and clearly summarizes the change using imperative mood (it means spoken or written as if giving a command or instruction, like "add new helper for listing operations")

    Note - In Generator, prepend feat: or fix: in PR title only when PATCH/MINOR release must be triggered.

  2. PR Description: Clearly explain the issue being solved, summarize the changes made, and mention the related issue.

    Note - In Generator, we use Maintainers Work board to track progress. Ensure the PR Description includes Resolves #<issue-number> or Fixes #<issue-number> this will automatically close the linked issue when the PR is merged and helps automate the maintainers workflow.

  3. Documentation: Update the relevant Generator documentation to accurately reflect the changes introduced in the PR, ensuring users and contributors have up-to-date guidance.

  4. Comments and JSDoc: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions, so others can easily understand and use the code.

  5. DRY Code: Ensure the code follows the Don't Repeat Yourself principle. Look out for duplicate logic that can be reused.

  6. Test Coverage: Ensure the new code is well-tested with meaningful test cases that pass consistently and cover all relevant edge cases.

  7. Commit History: Contributors should avoid force-pushing as much as possible. It makes it harder to track incremental changes and review the latest updates.

  8. Template Design Principles Alignment: While reviewing template-related changes in the packages/ directory, ensure they align with the Assumptions and Principles. If any principle feels outdated or no longer applicable, start a discussion these principles are meant to evolve with the project.

  9. Reduce Scope When Needed: If an issue or PR feels too large or complex, consider splitting it and creating follow-up issues. Smaller, focused PRs are easier to review and merge.

  10. Bot Comments: As reviewers, check that contributors have appropriately addressed comments or suggestions made by automated bots. If there are bot comments the reviewer disagrees with, react to them or mark them as resolved, so the review history remains clear and accurate.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds repository-wide AGENT.md with consolidated code-review and contribution conventions, updates .coderabbit.yaml to enable additional automated review tooling and checks, and revises the websocket clients integration-test README to a per-client TEST_CLIENT isolation model and related workflows.

Changes

Cohort / File(s) Summary
Review configuration
./.coderabbit.yaml
Enabled reviews.auto_review.drafts: false, added reviews.slop_detection.enabled: true, enabled eslint, yamllint, and markdownlint under reviews.tools, and added "AGENT.md" to knowledge_base.code_guidelines.filePatterns.
Repository guidance
AGENT.md
Added new monorepo-wide code-review and contributor guidelines: monorepo topology (apps/*, packages/*), Turborepo script semantics, Node/npm minimums, ESLint-first formatting and strict lint requirements (--max-warnings 0), commit/PR conventions, release gating and changeset rules, JSDoc/API documentation expectations, // Why: comment convention, cross-cutting architecture principles, and per-package conventions (apps and packages specific rules, plus frozen-package note).
Test docs — websocket clients
packages/templates/clients/websocket/test/README.md
Refactored integration-test docs to a per-client isolation model driven by TEST_CLIENT: per-client npm scripts, runTestSuiteForClient wrapper to conditionally register suites, client-specific snapshot resolver and testResultPath, targeted cleanup of only the selected client's results, explicit run/update commands, and expanded workflow for adding a new client.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title uses the 'chore:' prefix and clearly describes the main changes (adding AGENT.md and tuning CodeRabbit config) in imperative mood, following Conventional Commits guidelines.
Linked Issues check ✅ Passed The PR implements all primary objectives from issue #2064: consolidating dispersed code review rules into AGENT.md, providing a unified source of truth, and reducing inconsistent review feedback.
Out of Scope Changes check ✅ Passed All changes are within scope: AGENT.md creation directly addresses #2064, CodeRabbit config tuning supports guidelines enforcement, and WebSocket README updates reflect related work landing in #2042.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENT.md`:
- Around line 13-24: Update the fenced code blocks in AGENT.md that show the
directory trees so they include a language identifier (e.g., change ``` to
```text); specifically modify the block containing the "apps/ ... packages/ ..."
tree and the block containing the "<client>/ ... template/ components/ test/
..." tree (also apply same change to the other instance around the "<client>/"
example mentioned in lines 180-189) so both opening fences read ```text to
satisfy markdownlint MD040.
- Around line 92-97: The taxonomy text uses "client" but the repo convention and
existing dirs use "clients"; update the sentence and the type set so they match
the established naming (e.g., change "type ∈ {client, sdk, docs, scripts}" to
"type ∈ {clients, sdk, docs, scripts}" or otherwise consistently refer to
"packages/templates/clients/..."), and update the explanatory bullets
(references to `client` and "client template") to the plural `clients` (or
choose the singular and rename directories across the repo with an accompanying
issue/discussion), ensuring consistency for the Template-type taxonomy block and
any mentions of `packages/templates/<type>/...`.

In `@packages/templates/clients/websocket/test/README.md`:
- Line 138: Replace the shell-specific example "TEST_CLIENT=python jest" with a
cross-platform instruction: either reference the npm script "npm run
test:python" (ensure package.json contains a "test:python" script that sets
TEST_CLIENT and runs jest) or recommend using cross-env (e.g., a "test:python"
script that uses cross-env to set TEST_CLIENT before invoking jest) so Windows
users can run the same command; update the README.md line to show the
cross-platform approach and mention adding "-u" for updating snapshots.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ffcecab0-5e30-4c79-91d0-b2dbc870968e

📥 Commits

Reviewing files that changed from the base of the PR and between f6c88c9 and dc35641.

📒 Files selected for processing (3)
  • .coderabbit.yaml
  • AGENT.md
  • packages/templates/clients/websocket/test/README.md

Comment thread AGENT.md Outdated
Comment thread AGENT.md Outdated
Comment thread packages/templates/clients/websocket/test/README.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENT.md`:
- Around line 53-55: Update the release-prefix guidance in AGENT.md so it
matches section 2.5: replace the current sentence that limits triggers to only
`feat:`/`fix:` with the full, unified set of release-triggering prefixes
(`feat:`, `feat!:`, `fix:`, `fix!:`, and `chore(release):`), and ensure the note
about requiring a `.changeset/*.md` for `feat:`/`fix:` diffs in publishable
packages remains intact; update any example or wording that conflicts (search
for the current line mentioning `feat:` / `fix:` and the later mention of
`feat!:/fix!:/chore(release):`) so both sections use identical wording.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bb7f5ef3-2a43-4ec7-9b9a-35c1e884ec55

📥 Commits

Reviewing files that changed from the base of the PR and between 885c8f9 and 4e8a8e8.

📒 Files selected for processing (1)
  • AGENT.md

Comment thread AGENT.md Outdated
@asyncapi asyncapi deleted a comment from coderabbitai Bot Apr 18, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENT.md`:
- Line 54: Update the rule sentence that currently reads "Any `feat:` or `fix:`
in the diff of a publishable package..." to also require the breaking-change
variants by including backtick-marked tokens `feat!:`, `fix!:` (i.e., change the
phrase to "Any `feat:`, `fix:`, `feat!:`, or `fix!:` in the diff of a
publishable package ... must be accompanied by a `.changeset/*.md` file");
ensure the wording clearly ties `!`-marked commits to major-bump changesets so
it matches the release/major-bump rules elsewhere in the document.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4765b5a8-e81f-42c2-9e85-22513396b72d

📥 Commits

Reviewing files that changed from the base of the PR and between 4e8a8e8 and 4e777f6.

📒 Files selected for processing (1)
  • AGENT.md

Comment thread AGENT.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENT.md`:
- Line 79: Update the sentence on Line 79 of AGENT.md to explicitly list all
five patterns the release workflow checks (startsWith(..., 'feat:'),
startsWith(..., 'feat!:'), startsWith(..., 'fix:'), startsWith(..., 'fix!:'),
and startsWith(..., 'chore(release):')) and note that the workflow uses separate
startsWith() calls for each, so scoped prefixes like 'feat(generator):' will not
trigger a release; keep the rest of the paragraph unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e5dc7f15-fd00-45a6-88a8-cbb78ecb1bb1

📥 Commits

Reviewing files that changed from the base of the PR and between 4e777f6 and 3de2b80.

📒 Files selected for processing (1)
  • AGENT.md

Comment thread AGENT.md Outdated
@sonarqubecloud
Copy link
Copy Markdown

@derberg derberg moved this to In Progress in Maintainers work Apr 22, 2026
Comment thread AGENT.md
Comment on lines +40 to +46
Hard requirements from the root config (non-exhaustive — see `.eslintrc` for the full list):
- **`--max-warnings 0`** in every lint script. A warning is a blocker.
- `eqeqeq: error`, `no-var: error`, `prefer-const: error`, `prefer-template: error`, `prefer-arrow-callback: error`, `object-shorthand: error`.
- `quotes: single`, `semi: always`, `indent: 2 spaces`, `brace-style: 1tbs`, `no-multiple-empty-lines: max 1`.
- `sonarjs/cognitive-complexity: warn` — treat as a signal to split a function, not to add an `// eslint-disable` line.
- `camelcase` is disabled (templates generate snake_case / kebab-case identifiers for foreign languages), but JS source should still use camelCase by convention.
- `no-unused-vars: error` except for function args — unused function args are allowed because they document signatures.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove, let's make sure agent follows .eslintrc and that is it

Comment thread AGENT.md
Comment on lines +51 to +54
Conventional Commits are enforced by the repo's `pre_merge_checks.title` rule.
- PR titles start **lowercase**, imperative mood: `add`, `fix`, `refactor`, `document` — not `added`, `fixed`.
- The prefixes that trigger a changeset release are exactly `feat:`, `feat!:`, `fix:`, `fix!:`, and `chore(release):` (see §2.5 for workflow details). Use `chore:`, `docs:`, `test:`, `refactor:`, `ci:` for non-releasing changes.
- Any `feat:`, `fix:`, `feat!:`, or `fix!:` in the diff of a publishable package (`apps/*`, `packages/components`, `packages/helpers`) **must be accompanied by a `.changeset/*.md` file** naming the affected packages and the bump level — `!`-marked commits must pair with a `major` changeset (see §2.5). Flag missing changesets on review.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better reference Contributing.md or development - I don't remember but there is a section about conventional commits

Comment thread AGENT.md
Comment on lines +76 to +81
- Changesets live in `.changeset/*.md` with frontmatter naming each affected `@asyncapi/*` package and the bump level (`patch`/`minor`/`major`).
- When a PR touches both an app and a consumed package (e.g. `packages/helpers` + `apps/generator`), both must appear in the changeset if either's public behaviour changes.
- Dependency bumps done by `dependabot`/`asyncapi-bot` are exempt from the changeset rule.
- **Release-triggering prefixes are narrower than Conventional Commits.** The release workflow (`.github/workflows/release-with-changesets.yml`) only fires on master-push commits whose message **exactly starts with** `feat:`, `feat!:`, `fix:`, `fix!:`, or `chore(release):`. The workflow's `if:` uses five separate calls — `startsWith(..., 'feat:')`, `startsWith(..., 'feat!:')`, `startsWith(..., 'fix:')`, `startsWith(..., 'fix!:')`, and `startsWith(..., 'chore(release):')` — each matching its literal prefix, so **scoped prefixes like `feat(generator):` do NOT trigger a release** — squash/rebase into an unscoped `feat:` / `fix:` at merge time if a release is intended. `refactor:`/`perf:`/`docs:`/`chore:` (without `(release)`) also do not trigger a release.
- **Major bumps use `!`.** `feat!:` or `fix!:` signals a breaking change and must be paired with a `major` changeset. Don't accept `major` changesets unless the PR title also carries the `!`.
- **The `chore(release): release and bump versions of packages` PR is bot-authored** by `asyncapi-bot` via `changesets/action`. Do not rewrite its title or squash it under a different prefix — the exact `chore(release):` prefix is what re-fires the workflow to publish to npm.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference release guide from dev guide

Comment thread AGENT.md
Comment on lines +89 to +99
1. **Parser-API, not shape-poking.** When extracting data from an AsyncAPI document, use the Parser API. Never do `binding.json()["query"]["properties"]` or equivalent shape-reaching. If the Parser lacks what you need, add a helper in `packages/helpers` instead of inlining.
2. **Tested helpers over components over inline logic.** Template code should depend on **well-tested** `@asyncapi/generator-helpers` first, then shared components in `@asyncapi/generator-components`, and only drop into template-local components as a last resort. Templates must not reach into the Parser API directly when an equivalent helper exists (or could exist).
3. **Reusability budget.** Every new template or template feature must be built with reusability in mind — custom helpers and template-local components are kept to the minimum. A new shared helper/component is justified when used in templates, or when the logic is too gnarly to test inline. Otherwise, keep it in the template.
4. **Template-type taxonomy (provisional, opinionated).** Templates live under `packages/templates/<type>/<protocol>/<language>` where `type ∈ {clients, sdk, docs, scripts}`. This split is intentionally opinionated and expected to evolve as the types are exercised in practice — treat it as a hard constraint today, but flag friction rather than forking the taxonomy silently. Semantics:
- `clients` — generates a client library consumable from a server, a standalone app, **or** a server under development (there is deliberately no `server` type — a client used during server development covers that case).
- `sdk` — richer project generation; an `sdk` template **should extend an existing `clients` template** rather than fork it. If extension isn't feasible, that's a discussion, not a drop-in.
- `docs` — wraps standard doc generators (HTML, Markdown) that often already exist outside this repo.
- `scripts` — generates operational scripts (e.g. broker topic setup).
Do not introduce a new top-level type without an issue + discussion.
5. **Microcks acceptance tests** are the gate for "production-ready" status. A new client template without a Microcks-backed acceptance test (mocks + runtime) is experimental and must be labelled as such in its README. See `packages/templates/clients/websocket/test` for the reference implementation.
6. **Spec-first feature work.** Every new template feature must be cross-referenced against the AsyncAPI 3.0 spec **and** the Parser API before implementation. Link the spec section (raw docs or visualizer) in the PR description, and confirm the data is reachable via Parser API capabilities rather than a workaround.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference by link

Comment thread AGENT.md
- Async I/O uses promisified `fs` wrappers in `lib/utils.js`. Do not use sync `fs` calls in new code.
- Error handling: validate inputs in constructors (see `GENERATOR_OPTIONS` whitelist in `lib/generator.js`); reject with contextual messages; log at `log.debug`/`log.warn` via `loglevel` — never `console.log`.
- User-facing strings live in `lib/logMessages.js` as functions returning strings. Do not inline user-facing strings at call sites — it breaks i18n/consistency.
- Template configuration is loaded from `.ageneratorrc` → `package.json` in `lib/templates/config/loader.js`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure it is giving any value to the agent

Comment thread AGENT.md

### 4.2 `apps/hooks` — `@asyncapi/generator-hooks`

**Role:** built-in generator lifecycle hooks (currently a `generate:after` hook that writes the source AsyncAPI doc alongside output).
Copy link
Copy Markdown
Member

@derberg derberg Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not mention what hooks we have

Comment thread AGENT.md

**Conventions:**
- Exports the hook map shape `{ 'generate:after': fn, ... }` — do not rename or restructure this object without coordinating with `apps/generator/lib/hooksRegistry.js`.
- YAML vs JSON detection is by try/catch on `JSON.parse`. Keep this simple; do not introduce a format-detection dependency.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation details of specific hook - remove please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Introduce AGENT.md as source of truth for code review guidelines

3 participants