Local development

This guide is the supported contributor setup for AgentGuard. It keeps the Rust workspace, TypeScript workspace, console, and documentation site on the same pinned toolchain used by CI.

Prerequisites

The server build uses protoc-bin-vendored, but the optional SPIFFE dependency uses protoc for its generated Workload API client. Set PROTOC to an executable path if the compiler is not on PATH.

Run the checked-in bootstrap script from a clean checkout:

./scripts/setup.sh

The script is intentionally additive: it installs missing toolchain components, but does not rewrite policy, audit, or user files.

Daily commands

pnpm install --frozen-lockfile
pnpm audit:dependencies
cargo test --workspace
pnpm check
pnpm build

Before opening a pull request, run the same focused checks as CI:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
pnpm --filter frontend test
pnpm --filter frontend exec node scripts/e2e.mjs

Use pnpm --dir site check && pnpm --dir site build when changing the documentation site. After building it, pnpm --filter frontend test:site serves the static output locally and browser-checks theme preference, persistence, reduced motion, docs navigation, and mobile overflow. The root pnpm check also verifies public names, repository links, and Kubernetes manifests.

Working safely

Keep local state under .agentguard/ or a temporary directory. Never commit real issuer credentials, session secrets, delegation keys, chain secrets, or audit data. Use the mock identity provider in frontend/scripts/e2e.mjs for console tests. Use cargo test --workspace --all-features when changing authentication or transport code because SPIFFE adds generated protobuf code.

Architecture boundaries

The Rust crates are the policy and enforcement core. The HTTP/gRPC server is a transport adapter, the CLI is an operator adapter, and the console is a separate presentation layer. Keep configuration parsing at the adapter boundary; library callers should receive explicit typed configuration rather than reading process environment implicitly. See architecture and the ADR index.