Skip to content

Latest commit

 

History

History
118 lines (94 loc) · 5.14 KB

AGENTS.md

File metadata and controls

118 lines (94 loc) · 5.14 KB

AGENTS.md

This file provides repository-wide guidance for AI coding assistants. Read CONTRIBUTING.md first; it defines the contribution process and AI-assisted contribution requirements.

For work in web-app/, follow web-app/AGENTS.md, which contains the frontend-specific architecture and verification guidance.

Project map

  • hertzbeat-startup/ launches the Spring Boot application; hertzbeat-manager/ contains core APIs and monitoring configuration.
  • hertzbeat-collector/ contains collector modules; hertzbeat-common-core/ and hertzbeat-common-spring/ provide shared code.
  • hertzbeat-warehouse/, hertzbeat-alerter/, hertzbeat-observability/, hertzbeat-ai/, and hertzbeat-ai-gateway/ contain storage, alerting, observability, and AI capabilities.
  • hertzbeat-plugin/ defines the plugin SPI, including the PluginRunner interface; hertzbeat-base/ holds label and general configuration persistence. hertzbeat-push/ receives Prometheus metrics through the Push Gateway; hertzbeat-remoting/ is the Netty remoting layer; hertzbeat-grafana/ integrates Grafana dashboards.
  • hertzbeat-otel-runtime/ is a separate Go runtime supervised by the Java collector; it is not a Maven module.
  • web-app/ is the React frontend. home/ contains the Docusaurus documentation site.
  • e2e/ contains the Docker Compose API test environment; hertzbeat-e2e/ contains Maven E2E modules.
  • mcp-servers/ contains MCP servers; script/ contains build and CI support; hip/ contains HertzBeat Improvement Proposals.

Use the relevant workflow to find CI verification commands and their prerequisites. See backend CI for API and contract checks, and hybrid collector release CI for collector runtime and packaging checks.

Development and verification

Backend

Use JDK 25 or newer and run the Maven wrapper from the repository root (./mvnw in Bash or .\mvnw.cmd in PowerShell). The Maven Enforcer rule rejects older JDKs during validate.

# Build without running tests
./mvnw clean install -DskipTests

# Test a module and its required upstream modules
./mvnw -pl hertzbeat-common-core -am test

# Run one existing test class across the reactor
./mvnw -pl hertzbeat-manager -am test \
  -Dtest=UiSessionServiceTest \
  -Dsurefire.failIfNoSpecifiedTests=false

# Run Checkstyle
./mvnw checkstyle:check

When using -Dsurefire.failIfNoSpecifiedTests=false, confirm that the intended class actually ran in the target module's target/surefire-reports/. The flag allows zero matches in any module.

Checkstyle is bound to validate and includes test sources. Its configuration is in script/checkstyle/. The build also forbids raw JAXP factory usage through forbiddenapis; use Apache Commons Secure XML instead. See pom.xml for the scope of these checks and JaCoCo coverage reporting.

The backend CI builds the frontend first, then runs the Maven release package with hertzbeat-e2e excluded. It also runs separate schema and E2E checks. CI uses mvnd; these steps are not equivalent to one local Maven command.

For Java collector changes, use the root Maven wrapper so the build can include the collector's required modules with -am. See the collector CI script for the module selectors and targeted tests.

For the Go runtime, run make validate from hertzbeat-otel-runtime/ to build the runtime and validate its test configuration. See the runtime README for prerequisites.

Frontend

Use Node 22 and pnpm 10.9.0. Follow the frontend startup steps in CONTRIBUTING.md and the checks in web-app/AGENTS.md.

End-to-end and documentation

When adding or updating an API, add or update the corresponding E2E case. Follow e2e/README.md for the Docker Compose setup, image build, and test commands.

Documentation build and validation steps are defined in .github/workflows/doc-build-test.yml. Documentation translations live under home/i18n/; update the relevant translations when a documentation change requires them.

Contribution guidance

  • Follow the AI-assisted contribution requirements in CONTRIBUTING.md. Keep the change focused and have a human review and validate the final diff. For risky changes, write or update the smallest useful test or contract first.
  • Review AI-assisted changes against the affected code, tests, or rendered output. For each finding, cite the affected file, describe the trigger and impact, and mark unverified concerns as questions.
  • Report the checks actually run and their results. Follow .editorconfig and run git diff --check before submitting.
  • New source files need the Apache license header. Markdown files are excluded by .licenserc.yaml.
  • Follow the commit and PR conventions in CONTRIBUTING.md. If AI helped, include the requested AI assistance, Human validation, and Risk notes in the PR description.
  • HIP guidance in CONTRIBUTING.md applies to major new features; consult the process in hip/ when the change falls into that scope.