diff --git a/.continue/checks/anti-slop.md b/.continue/checks/anti-slop.md new file mode 100644 index 000000000..d5de385d5 --- /dev/null +++ b/.continue/checks/anti-slop.md @@ -0,0 +1,108 @@ +--- +name: Anti-Slop +description: Catch AI-generated code patterns that harm readability and maintainability. +--- + +## Context + +This project has a strict anti-slop policy. AI-generated code is common in this codebase, and when it isn't cleaned up, it creates bloat that compounds over time. This check enforces the standards in `.continue/rules/anti-slop.md`. + +## What to Check + +Review the PR diff for these patterns: + +### Overly verbose comments + +Comments that restate what the code already says. + +```typescript +// Bad - comment restates the code +// Increment the counter by one +counter++; + +// Set the user's name to the provided value +user.name = name; + +// Good - comment explains WHY, not WHAT +// Reset after overflow to prevent stale cache entries +counter = 0; +``` + +### Filler documentation + +JSDoc or docstrings that add no information beyond the function signature. + +```typescript +// Bad +/** + * Gets the user by ID. + * @param id - The user ID. + * @returns The user. + */ +function getUserById(id: string): User { ... } + +// Good - no docs needed, the signature is self-documenting +function getUserById(id: string): User { ... } +``` + +### Over-abstraction + +Interfaces with single implementations, factories that create one thing, strategy patterns for two options, unnecessary wrapper functions. + +```typescript +// Bad - abstraction for one implementation +interface IUserService { getUser(id: string): User } +class UserService implements IUserService { ... } + +// Good - just use the class directly +class UserService { getUser(id: string): User { ... } } +``` + +### Unnecessary intermediate variables + +Variables used exactly once on the next line purely to "name" a step. + +```typescript +// Bad +const trimmedInput = input.trim(); +const result = processInput(trimmedInput); +return result; + +// Good +return processInput(input.trim()); +``` + +### Boilerplate explosion + +Creating separate classes, functions, or files for trivial operations that could be a simple expression. + +### Excessive defensive programming + +Unnecessary null checks, try-catches, or validations that clutter the logic without real safety value. Trust internal code and framework guarantees. + +### Redundant type annotations + +Type declarations that TypeScript already infers. + +```typescript +// Bad +const count: number = 0; +const name: string = "hello"; +const items: string[] = ["a", "b"]; + +// Good +const count = 0; +const name = "hello"; +const items = ["a", "b"]; +``` + +## Pass/Fail Criteria + +- **Pass** if the diff is free of the patterns above, or only has minor instances that don't impact readability. +- **Fail** if the diff introduces multiple instances of slop patterns, especially verbose comments, filler docs, or unnecessary abstractions. Call out specific lines. + +## Exclusions + +- Test files (_.test.ts, _.vitest.ts) where some verbosity aids clarity. +- Generated files or vendored code. +- Comments that explain complex business logic, workarounds, or non-obvious decisions (these are valuable, not slop). diff --git a/.continue/checks/documentation-freshness.md b/.continue/checks/documentation-freshness.md new file mode 100644 index 000000000..4a5a37ba5 --- /dev/null +++ b/.continue/checks/documentation-freshness.md @@ -0,0 +1,55 @@ +--- +name: Documentation Freshness +description: Flag user-facing changes that lack corresponding documentation updates. +--- + +## Context + +Continue has a public documentation site built from the `docs/` directory. When user-facing behavior changes, the docs must stay in sync. Stale docs erode trust and generate support requests. This check enforces the standards in `.continue/rules/documentation-standards.md`. + +## What to Check + +If the PR changes any of the following areas, verify that the corresponding docs are updated (or that the change is purely internal and doesn't affect user-facing behavior): + +### Configuration and schemas + +- `packages/config-yaml/` - YAML config schema changes should update `docs/customize/` or relevant config reference pages. + +### Model providers + +- `core/llm/llms/` - New or modified LLM provider integrations should update `docs/customize/model-providers/`. +- `core/llm/autodetect.ts` - Changes to model autodetection should be reflected in provider docs. + +### Context providers + +- `core/context/providers/` - New or changed context providers should update `docs/customize/context-providers.mdx`. + +### Tools + +- `core/tools/` - New or changed tools should update relevant docs pages. + +### CLI commands + +- `extensions/cli/src/commands/` - New or modified CLI commands should update `docs/cli/`. + +### IDE extension features + +- `extensions/vscode/src/commands.ts` - New VS Code commands should be documented. +- `extensions/vscode/package.json` - New settings or commands should be documented. + +### Slash commands and agents + +- `.continue/agents/` - Changes to agent capabilities should update `docs/agents/`. + +## Pass/Fail Criteria + +- **Pass** if no user-facing behavior is changed, or if the PR includes corresponding doc updates. +- **Pass** if the PR description explicitly notes that doc updates will follow in a separate PR. +- **Fail** if user-facing behavior is added or changed (new config options, new commands, changed defaults, new providers) without any documentation updates. Call out the specific feature and the doc page that likely needs updating. + +## Exclusions + +- Bug fixes that restore documented behavior (the docs are already correct). +- Internal refactors that don't change any public API or user-facing behavior. +- Test-only changes. +- Dependency updates that don't change behavior. diff --git a/.continue/checks/protocol-layer-consistency.md b/.continue/checks/protocol-layer-consistency.md new file mode 100644 index 000000000..385819c7b --- /dev/null +++ b/.continue/checks/protocol-layer-consistency.md @@ -0,0 +1,53 @@ +--- +name: Protocol Layer Consistency +description: Ensure protocol message changes are synchronized across all platform layers. +--- + +## Context + +Continue is a multi-platform application (VS Code, JetBrains, web GUI) that communicates through a typed protocol layer. When protocol messages are added or changed in one layer, the other layers must be updated to match. Missing updates cause silent failures or runtime crashes that are hard to debug. This check enforces the process in `.continue/rules/new-protocol-message.md`. + +## What to Check + +If the PR modifies any of the following protocol-related files, verify that all required layers are updated: + +### Protocol type definitions + +- `core/protocol/` - Core type definitions for messages between IDE, core, and GUI + +### Message passthrough + +- `core/protocol/passThrough.ts` - Routes messages between webview and core. New webview-to-core messages must be registered here. + +### IDE-specific handlers + +- `extensions/vscode/src/VsCodeMessenger.ts` - VS Code message handler +- `extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt` - JetBrains message type registry + +### Core handler + +- `core/core.ts` - Core-side message handler + +### GUI handler + +- `gui/` files using `useWebviewListener` - GUI-side message listeners + +## Specific Checks + +1. **New message type added to protocol**: Verify the handler exists in the appropriate location (core.ts for messages to core, useWebviewListener for messages to GUI, VsCodeMessenger.ts for messages to VS Code IDE). + +2. **Webview-to-core message added**: Verify it's registered in `passThrough.ts` AND in `MessageTypes.kt` for JetBrains support. + +3. **Message type signature changed**: Verify all consumers of that message type are updated to match the new signature. + +4. **Message removed**: Verify it's removed from all layers, not just one. + +## Pass/Fail Criteria + +- **Pass** if the PR doesn't touch protocol-related files, or if all required layers are updated consistently. +- **Fail** if a protocol message is added, changed, or removed in one layer but the corresponding updates are missing in other layers. Specifically call out which files need updating. + +## Exclusions + +- Changes to message handler _implementation_ (business logic) that don't alter the message type or signature. +- Test-only changes to protocol mocks. diff --git a/.continue/checks/react-performance.md b/.continue/checks/react-performance.md new file mode 100644 index 000000000..1e1b044e5 --- /dev/null +++ b/.continue/checks/react-performance.md @@ -0,0 +1,122 @@ +--- +name: React Performance +description: Catch React anti-patterns that cause unnecessary re-renders or bundle bloat in the GUI. +--- + +## Context + +Continue's GUI is a React application embedded in IDE webviews where performance directly impacts the user experience. The project is actively migrating from styled-components to Tailwind CSS and follows specific React performance best practices documented in `.continue/agents/react-best-practices.md` and `.continue/rules/colors.md`. + +## What to Check + +Review GUI changes (`gui/` directory) in the PR diff for these patterns: + +### Async waterfalls + +Sequential awaits that could run in parallel. + +```typescript +// Bad - 3 sequential round trips +const user = await fetchUser(); +const posts = await fetchPosts(); +const comments = await fetchComments(); + +// Good - 1 round trip +const [user, posts, comments] = await Promise.all([ + fetchUser(), + fetchPosts(), + fetchComments(), +]); +``` + +### Object dependencies in useEffect + +Using full objects as dependencies when only a primitive field is needed. + +```typescript +// Bad - re-runs on any user field change +useEffect(() => { + console.log(user.id); +}, [user]); + +// Good - re-runs only when id changes +useEffect(() => { + console.log(user.id); +}, [user.id]); +``` + +### Stale closure patterns + +Using spread with state in callbacks instead of functional updates. + +```typescript +// Bad - stale closure risk +const addItem = useCallback( + (item) => { + setItems([...items, item]); + }, + [items], +); + +// Good - always uses latest state +const addItem = useCallback((item) => { + setItems((curr) => [...curr, item]); +}, []); +``` + +### Explicit color values instead of theme colors + +Using hardcoded Tailwind colors instead of the project's theme system. + +```tsx +// Bad - hardcoded color +
+ +// Good - theme color +
+``` + +Available theme colors: `foreground`, `description`, `description-muted`, `background`, `border`, `border-focus`, `primary`, `secondary`, `success`, `warning`, `error`, `accent`, `link`, `input`, `editor`, `badge`, `list-hover`, `list-active`. + +### New styled-components usage + +The project is migrating from styled-components to Tailwind. New styled-components should not be introduced. + +```typescript +// Bad - new styled-component +const Wrapper = styled.div` + padding: 8px; +`; + +// Good - Tailwind +
+``` + +### Array mutation + +Using `.sort()` instead of `.toSorted()`, which mutates arrays and breaks React's immutability model. + +```typescript +// Bad - mutates original +const sorted = users.sort((a, b) => a.name.localeCompare(b.name)); + +// Good - creates new array +const sorted = users.toSorted((a, b) => a.name.localeCompare(b.name)); +``` + +## Pass/Fail Criteria + +- **Pass** if the GUI changes follow React performance best practices and use the project's theme colors. +- **Fail** if the diff introduces async waterfalls, stale closures, object dependencies in effects, hardcoded colors, new styled-components, or array mutations. Call out specific lines and suggest the fix. + +## Key Files to Check + +- `gui/src/components/**/*.tsx` +- `gui/src/pages/**/*.tsx` +- `gui/src/hooks/**/*.ts` + +## Exclusions + +- Changes outside the `gui/` directory. +- Modifications to existing styled-components that are being incrementally migrated (only flag _new_ styled-components). +- Test files in `gui/`. diff --git a/docs/agents/overview.mdx b/docs/agents/overview.mdx index 72c938a95..649bde665 100644 --- a/docs/agents/overview.mdx +++ b/docs/agents/overview.mdx @@ -1,268 +1,116 @@ --- -title: "Cloud Agents & Continuous AI" -description: "Standardized Cloud Agent workflows that combine prompts, rules, and tools to complete specific, repeatable tasks" -sidebarTitle: "Agents" +title: "Agents" --- -## What are Cloud Agents? -Cloud Agents are AI workflows that execute on remote infrastructure (Continue Mission Control) rather than your local machine. Because they live in the cloud, they maintain persistent, secure connections to your development tools and can be triggered in two ways: +Agents use the same markdown file format as checks. The difference: agents support an `on:` field in frontmatter for triggering on events beyond PR open β€” cron schedules, GitHub issues, Sentry alerts, Slack messages, webhooks. -- On-Demand: Manually triggered via Chat, Tasks, or the CLI for complex, human-guided work. +## Local agents vs. cloud agents -- Automated: Automatically triggered by schedules (Cron) or events (Webhooks) for background maintenance. +There are two ways to define agents: -Unlike local assistants, Cloud Agents provide a centralized "Mission Control" where teams can collaborate on tasks, review shared logs, and standardize automation across repositories. +- **Local**: Place agent files in `.continue/agents/` in your repository. Version-controlled and shared with your team. +- **Cloud**: Created and managed on [continue.dev/agents](https://continue.dev/agents). Web UI for configuration, no file to commit. +Both run on Continue's cloud infrastructure. - - Agents are custom AI workflows that combine a prompt, rules, and tools (MCPs and more) to complete specific, repeatable tasks. - They live in the Continue Mission Control and can be executed from Mission Control (web interface), TUI mode, or headless automation. - +## The `on:` field +The `on:` field in agent frontmatter defines what triggers the agent: +| Trigger | Description | +|---|---| +| `pr_opened` | When a pull request is opened (this is what checks do implicitly) | +| `issue_opened` | When a new issue is created | +| `label_added` | When a label is applied to an issue or PR | +| `pr_merged` | When a pull request is merged | +| `check_failed` | When a CI check fails | +| `cron` | On a schedule | +| `webhook` | When an external webhook fires | -## Ways to Run Cloud Agents +Example agent with a cron trigger: -These execution modes allow Continue agents to function as cloud agents, running continuously, headlessly, or on schedules without requiring a developer in the loop: +```markdown +--- +name: weekly-dependency-update +on: + cron: "0 9 * * 1" +tools: + - github +--- + +Check for outdated dependencies and open a PR with updates. +``` + +## Running agents - - **Interactive web interface** - - Trigger from the Continue Mission Control and review results in real-time. - - ```bash - # Navigate to continue.dev/agents - # Click "Run Agent" on any agent - # Monitor progress and review outputs - ``` - - Perfect for: Interactive debugging, reviewing agent outputs, team collaboration + + Trigger agents from the web interface at [continue.dev](https://continue.dev) and review results in real-time. - - **Interactive terminal mode** - - Launch from terminal for live interaction and testing. - + ```bash - cn --agent my-org/github-pr-agent - # Interactive chat interface opens - # Type your specific request - # Review and approve actions + cn --agent my-org/my-agent ``` - Perfect for: Local development, testing prompts, quick one-off tasks + Opens an interactive chat session with the agent. - - **Automated execution** - - Run one-off or scheduled tasks automatically without interaction. - + ```bash - cn -p --agent my-org/snyk-agent "Run weekly security scan" + cn -p --agent my-org/my-agent "Run weekly security scan" ``` - Perfect for: CI/CD pipelines, scheduled tasks, webhook integrations - - - - **Version-controlled agents in your repository** - - Define agents in `.continue/agents/` and run them with the CLI or GitHub Actions. - - ```bash - # Run a local agent file - cn --agent .continue/agents/my-agent.md - ``` - - Perfect for: Team-shared workflows, CI/CD automation, version-controlled agent definitions - - [Learn more about local agents β†’](/guides/run-agents-locally) + Runs the agent non-interactively. Useful for CI/CD pipelines and scheduled automation. -## Local vs. Cloud Agents +## Checks vs. agents -| Feature | Local Agents (IDE / TUI) | Cloud Agents (Mission Control) | -|---------|--------------------------|--------------------------------| -| Compute Location | Your Local Machine | Remote Cloud Infrastructure | -| Primary Use Case | fast, private iteration and "single-player" coding | Collaborative tasks, heavy processing, and reliable automation | -| Context Access | Limited to open files and local git state | Full repository access + integrated tools (Sentry, Snyk, etc.) | -| Triggers | Manual Tasks / CLI | Hybrid: Manual Chat, Cron Schedules, or Event Webhooks | -| Availability | Stops when you close your laptop | Always On: Runs asynchronously in the background | +| | Checks | Agents | +|---|---|---| +| File location | `.continue/checks/` | `.continue/agents/` or continue.dev | +| Trigger | Always on PR open | Configurable via `on:` field | +| Purpose | Pass/fail review of PRs | Any automated task | -## Pre-configured Cloud Agents +## Cloud agent gallery -Skip the setup and use battle-tested agents from our cookbook collection: +Pre-configured agents you can use immediately: - - + `continuedev/snyk-continuous-ai-agent` - -A cloud agent that monitors vulnerabilities and automatically opens PRs with fixes. + + Monitors vulnerabilities and automatically opens PRs with fixes. - - - + + `continuedev/github-project-manager-agent` - - A cloud agent that triages issues and manages project workflows - + + Triages issues and manages project workflows. - - - + + `continuedev/posthog-continuous-ai-agent` - - A cloud agent that analyzes user data and creates actionable tasks - + + Analyzes user data and creates actionable tasks. - - - + + `continuedev/netlify-continuous-ai-agent` - - A cloud agent that monitors Core Web Vitals and optimizes deployments - + + Monitors Core Web Vitals and optimizes deployments. - - - + + `continuedev/supabase-agent` - - A cloud agent that audits RLS security and generates migrations - + + Audits RLS security and generates migrations. - - - + + `continuedev/dlt-agent` - - A cloud agent that inspects pipelines and debugs load errors - + + Inspects pipelines and debugs load errors. - - - **Explore More Cloud Agents**: Browse the complete collection of pre-configured agents and MCP integration cookbooks in our [Guides Overview](/guides/overview#mcp-integration-cookbooks). - - -{/* ## Webhook Integrations - -Trigger Agents automatically through secure webhooks for CI/CD integration: - -```bash -POST /webhooks/ingest/:webhookId -{ - "payload": { "trigger": "nightly-security-scan" } -} -``` - -Perfect for connecting with: -- GitHub Actions workflows -- Monitoring alerts (Sentry, DataDog) -- Deployment pipelines -- Scheduled maintenance tasks */} - -## Collaboration - -Agents are organizational assets β€” once created, everyone in your org can use them: - -| Role | Permissions | -|------|-------------| -| **Public** | Use, create, remix, and delete Agents | -| **Organization** | Share agents with your team | -| **Private** | Create, edit, and delete Agents for your personal use | - -## Getting Started - - - - Start with a cookbook agent like `continuedev/github-project-manager-agent`: - - ```bash - cn --agent continuedev/github-project-manager-agent "List open issues labeled bug" - ``` - - - - Test agents locally before automation: - - ```bash - cn --agent continuedev/snyk-continuous-ai-agent - # Interactive mode - perfect for learning how to use the agent for your use case - ``` - - - - Ready to build custom workflows? Learn how in our [Create and Edit guide](/agents/create-and-edit). - - - - Integrate with CI/CD using headless mode and webhooks for continuous workflows. - - - -## Monitoring - -You can monitor all activity for your Agents directly in **Mission Control**. - - - - - The **Inbox** shows every Task or Workflow run, and you can filter by Agent. - - - - Click any session in the Inbox to open the Detail page. - - Each session includes: - - **Summary** β€” what the agent did and why - - **Diff** β€” generated code changes - - **Logs** β€” full execution trace, tool calls, and reasoning - - This is the best way to review output, debug issues, or confirm correctness. - - - - - -All monitoring is scoped to your current workspace. - - -## Best Practices - -The practice of using cloud agents, which we call Continuous AI, requires forethought to set up the right guardrails: - -- **Start Small**: Begin with tasks you're confident Continue can accomplish -- **Use Thorough Prompts**: Agents can run for extended periods, so invest in detailed instructions -- **Test Locally First**: Practice with TUI mode before deploying to production -- **Team Alignment**: Discuss agent usage and adjust code review habits for higher PR volume -- **Iterate and Improve**: Be willing to refine prompts based on results - -## Next Steps - - - - Build your first custom agent with prompts, rules, and tools - - - - Set up version-controlled agents in your repository - - - - Browse pre-built agents for security, analytics, and more - - - - Learn to run agents from the command line - - - - Access the web interface to manage agents - - \ No newline at end of file diff --git a/docs/checks/examples.mdx b/docs/checks/examples.mdx new file mode 100644 index 000000000..e7cddab35 --- /dev/null +++ b/docs/checks/examples.mdx @@ -0,0 +1,224 @@ +--- +title: "Example Checks" +--- + +The fastest way to create checks is to ask your coding agent to write them. The prompts below are organized by category β€” paste any of them into Claude Code or your preferred coding agent. Because the agent can read your codebase, the result is tailored to your actual code. + +## Discovery prompts + +### Security + +``` +Look at our codebase and write checks for the most likely security issues β€” think auth bypasses, injection vectors, secrets in source, and missing input validation. Tailor the checks to the frameworks and patterns we actually use. +``` + +``` +Write a check that verifies new API endpoints follow our existing auth middleware pattern +``` + +### Code review patterns + +``` +Look through our recent PR review comments and identify things reviewers say repeatedly. Write checks that automate those recurring review comments. +``` + +``` +Read our CONTRIBUTING.md and any style guides in the repo, then write checks that enforce the conventions we've documented but reviewers still have to catch manually +``` + +### QA and browser testing + +``` +Write a check that uses a browser to verify any new or changed pages render without errors and match our design system +``` + +``` +Write a check that visits any URLs added or changed in this PR, takes screenshots, and flags layout issues or broken links +``` + +### Best practices + +``` +Analyze our codebase and write checks for the patterns that matter most β€” error handling conventions, logging standards, naming conventions, or whatever you see us being inconsistent about +``` + +``` +Write a check that makes sure database migrations are safe to run on a production table with 100M+ rows +``` + +### Test coverage + +``` +Write a check that verifies new code has corresponding tests, following the test file naming and structure conventions already in our project +``` + +### Documentation + +``` +Write a check that flags PRs where public API or configuration changes aren't reflected in documentation +``` + +--- + +## Static examples + +Complete check files you can copy into `.continue/checks/` directly. These are generic starting points β€” checks generated by your coding agent from the prompts above will be more specific to your project. + +### Security review + +````markdown security-review.md +--- +name: Security Review +description: Flag hardcoded secrets, injection vectors, and missing input validation +--- + +Review the pull request diff for security issues. + +Flag as **failing** if any of these are true: + +- Hardcoded API keys, tokens, passwords, or connection strings in source files +- New API endpoints or request handlers without input validation or sanitization +- SQL queries built with string concatenation or template literals instead of parameterized queries +- Sensitive data (passwords, tokens, PII) written to logs or stdout +- New cryptographic code using weak algorithms (MD5, SHA1 for security purposes, ECB mode) +- Secrets added to files that are not in `.gitignore` + +If none of these issues are found, pass the check. +```` + +### Test coverage + +````markdown test-coverage.md +--- +name: Test Coverage +description: Verify new code has corresponding tests +--- + +Review the pull request diff and check that new code is tested. + +Flag as **failing** if any of these are true: + +- A new source file was added without a corresponding test file (e.g., `utils.ts` added but no `utils.test.ts`) +- New exported functions or public methods have no test exercising them +- An existing test file was deleted without the corresponding source file also being deleted + +Pass the check if: + +- All new source files have corresponding test files +- New functions/methods are covered by at least one test +- Only test files, docs, or config files were changed +- The PR modifies existing code and existing tests still cover the changed paths +```` + +### Documentation freshness + +````markdown docs-freshness.md +--- +name: Documentation Freshness +description: Ensure docs are updated when public APIs or configuration changes +--- + +Review the pull request diff for changes to public-facing APIs or configuration, and verify documentation was updated. + +Flag as **failing** if any of these are true: + +- A public function, class, or type signature was added or changed, but no documentation file (README, docs/, or inline JSDoc/docstrings) was updated +- Configuration options were added or renamed (config files, environment variables, CLI flags) without updating the corresponding docs +- API route paths or request/response shapes changed without updating API documentation + +Pass the check if: + +- No public API or configuration changes were made +- Documentation files were updated in the same PR as the API/config change +- Changes are purely internal (private functions, refactors with no public interface change) +```` + +### Conventional commits + +````markdown conventional-commits.md +--- +name: Conventional Commits +description: Verify the PR title follows conventional commit format +--- + +Check that the pull request title follows the Conventional Commits specification. + +The title must match this format: `type(optional scope): description` + +Valid types: + +- `feat` β€” new feature +- `fix` β€” bug fix +- `docs` β€” documentation only +- `style` β€” formatting, no code change +- `refactor` β€” code change that neither fixes a bug nor adds a feature +- `perf` β€” performance improvement +- `test` β€” adding or updating tests +- `build` β€” changes to build system or dependencies +- `ci` β€” changes to CI configuration +- `chore` β€” maintenance tasks +- `revert` β€” reverts a previous commit + +Flag as **failing** if: + +- The PR title does not start with a valid type from the list above +- The type is not followed by a colon and a space +- The description after the colon is empty +- The type is capitalized (must be lowercase) + +Pass the check if the PR title matches the format with a valid type prefix. +```` + +### Dependency audit + +````markdown dependency-audit.md +--- +name: Dependency Audit +description: Review new or updated dependencies for risk +--- + +Review the pull request diff for changes to dependency manifests (`package.json`, `requirements.txt`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `Gemfile`, or similar). + +If no dependency files were changed, pass the check. + +When dependencies were added or updated, flag as **failing** if any of these are true: + +- A new dependency has fewer than 100 GitHub stars or appears unmaintained (no commits in the last 12 months) +- A dependency was bumped by more than one major version (e.g., v2.x to v4.x) without a note in the PR description explaining the jump +- A known deprecated or security-flagged package was added +- A dependency was added that duplicates functionality already available from an existing dependency +- Dev dependencies were added to production dependency sections (e.g., a test framework in `dependencies` instead of `devDependencies`) + +Pass the check if: + +- All new dependencies are well-maintained and widely used +- Version bumps are single major versions or minor/patch updates +- Dependency changes are documented in the PR description if non-trivial +```` + +### Migration safety + +````markdown migration-safety.md +--- +name: Migration Safety +description: Check database migrations for destructive operations +--- + +Review the pull request diff for database migration files (SQL migrations, ORM migration files like Alembic, Knex, ActiveRecord, Prisma, or similar). + +If no migration files were added or changed, pass the check. + +When migrations are present, flag as **failing** if any of these are true: + +- `DROP TABLE` or `DROP COLUMN` without a preceding migration that backs up or migrates the data +- Column type narrowing (e.g., `TEXT` to `VARCHAR(50)`, `BIGINT` to `INT`) without a backfill step +- `NOT NULL` constraint added to an existing column without a `DEFAULT` value or a data backfill +- Renaming a column or table that is referenced by application code without updating that code in the same PR +- A destructive and a constructive change in the same migration file (split these into separate migrations for safe rollback) + +Pass the check if: + +- The migration only adds new tables, columns, or indexes +- Destructive operations include a clear backfill or data migration step +- The migration is idempotent (uses `IF EXISTS` / `IF NOT EXISTS` guards) +```` diff --git a/docs/checks/quickstart.mdx b/docs/checks/quickstart.mdx new file mode 100644 index 000000000..46c08bfeb --- /dev/null +++ b/docs/checks/quickstart.mdx @@ -0,0 +1,62 @@ +--- +title: "Write Your First Check" +--- + +## The walkthrough + +Paste this into Claude Code or any coding agent: + +``` +Help me write checks for this codebase: https://continue.dev/walkthrough +``` + +The walkthrough reads your codebase, helps you write your first checks, connects you to Continue, and gets them running on your next PR. It takes a few minutes. + +If you'd rather set things up manually, keep reading. + +## Manual setup + +### Create a check file + +```bash +mkdir -p .continue/checks +``` + +Create `.continue/checks/security-review.md`: + +```markdown .continue/checks/security-review.md +--- +name: Security Review +description: Flag hardcoded secrets and missing input validation +--- + +Review this pull request for security issues. + +Flag as failing if any of these are true: + +- Hardcoded API keys, tokens, or passwords in source files +- New API endpoints without input validation +- SQL queries built with string concatenation +- Sensitive data logged to stdout + +If none of these issues are found, pass the check. +``` + +A check file has two parts. + +**Frontmatter** (YAML between `---` delimiters): `name` and `description` are required. See the [reference](/checks/reference) for all available fields. + +**Body** (markdown after the frontmatter): the prompt the AI follows when reviewing a pull request. Write concrete pass/fail criteria so the check produces consistent results. + +The path `.agents/checks/` is also supported as an open-standard alternative to `.continue/checks/`. + +## Next steps + + + + Verify your checks before pushing by running `/checks` in your coding agent. + + + Set up GitHub integration so checks run on every pull request. + + diff --git a/docs/checks/reference.mdx b/docs/checks/reference.mdx new file mode 100644 index 000000000..37883e81e --- /dev/null +++ b/docs/checks/reference.mdx @@ -0,0 +1,74 @@ +--- +title: "Check File Reference" +--- + +A check is a markdown file with YAML frontmatter and a markdown body. The frontmatter configures metadata and tooling. The body is the prompt the agent follows when reviewing a pull request. + +## File format + +```markdown +--- +name: Migration Safety +description: Flag destructive database migrations +--- + +Your prompt here. This is the system prompt the agent uses +when evaluating the pull request. +``` + +Check files live in `.continue/checks/` or `.agents/checks/` at the repository root. + +## Frontmatter fields + +| Field | Required | Type | Description | +|-------|----------|------|-------------| +| `name` | Yes | string | Display name shown in GitHub status checks and on continue.dev | +| `description` | Yes | string | Short description of what the check verifies | +| `model` | No | string | Model to use. Defaults to Claude Sonnet. Example: `anthropic/claude-sonnet-4-5-20250514` | +| `tools` | No | list | MCP servers to make available. Hub slugs or inline config. | + +## Body + +The markdown body after the frontmatter is the agent's system prompt. It runs in the context of the PR being reviewed. The agent reads the prompt, examines the pull request diff, and produces a pass or fail verdict with reasoning. + +Write concrete pass/fail criteria. See [Writing Effective Checks](/checks/writing-good-checks) for guidance on prompt structure. + +## Complete example + +A fully-specced check file using all available fields: + +```markdown .continue/checks/migration-safety.md +--- +name: Migration Safety +description: Flag destructive database migrations +model: anthropic/claude-sonnet-4-5-20250514 +tools: + - continuedev/github-mcp +--- + +Review database migration files in this pull request. + +Flag as failing if any migration contains: +- DROP TABLE or DROP COLUMN without a corresponding backfill migration +- Data type changes that narrow the column (e.g., VARCHAR(255) β†’ VARCHAR(100)) +- Removing NOT NULL constraints without a default value + +Pass if the migration is additive only (new tables, new columns, new indexes). +``` + +## File discovery + +Continue locates checks by scanning specific directories at the repository root: + +- Reads all `.md` files in `.continue/checks/` +- Reads all `.md` files in `.agents/checks/` +- Subdirectories are not scanned +- Files without valid `name` and `description` frontmatter are skipped + +Checks do not have an `on:` field β€” they always run when a PR is opened. For event-triggered automation, use [agents](/agents/overview). + +## Supported directory paths + +`.continue/checks/` and `.agents/checks/` are equivalent. Both are scanned and merged into a single list of checks. + +`.agents/` is an emerging cross-tool standard for AI agent configuration. `.continue/` is Continue-specific. Use whichever fits your project. If both directories contain a check with the same `name`, the `.continue/checks/` version takes precedence. diff --git a/docs/checks/running-locally.mdx b/docs/checks/running-locally.mdx new file mode 100644 index 000000000..5de256521 --- /dev/null +++ b/docs/checks/running-locally.mdx @@ -0,0 +1,58 @@ +--- +title: "Run Checks Locally" +--- + +Run your checks locally before pushing to CI using the `/checks` command in your coding agent (Claude Code, Cursor, or any agent that supports skills). + +## Run all checks + +Type `/checks` in your coding agent. It discovers every check file in `.continue/checks/` (and `.agents/checks/`), runs each one as a subagent against your current branch, and reports the results. + +``` +/checks +``` + +Output looks like: + +``` +βœ“ Security Review β€” PASS + No hardcoded secrets or SQL injection vectors found in the diff. + +βœ— Migration Safety β€” FAIL + migrations/024_drop_legacy_users.sql drops the legacy_users table + without a preceding data migration. Add a backfill step or split + into two migrations. + +βœ“ Test Coverage β€” PASS + All new source files have corresponding test files. +``` + +## Run a single check + +To run one specific check, pass the file path: + +``` +/checks .continue/checks/security-review.md +``` + +## Iterate on a check + +The local feedback loop is: edit the check file, run `/checks`, read the output, refine. Because checks run inside your coding agent, you can ask it to fix issues in the same session: + +``` +The migration safety check is flagging additive-only migrations as failures. Update the check to only flag destructive operations. +``` + +## Automate with AGENTS.md + +You can add `/checks` to your `AGENTS.md` so your coding agent runs checks automatically as part of its workflow β€” for example, after creating a PR: + +```markdown AGENTS.md +After creating or updating a pull request, run /checks and fix any failures before requesting review. +``` + +## Why local? + +Running checks locally uses your existing coding agent and credits (Claude Max, API key, etc.). There's nothing extra to install or configure β€” if your agent can read your repo, it can run your checks. + +For running checks automatically on every PR in CI, see [Run Checks in CI](/checks/setup-on-continue). diff --git a/docs/checks/setup-on-continue.mdx b/docs/checks/setup-on-continue.mdx new file mode 100644 index 000000000..031515ccf --- /dev/null +++ b/docs/checks/setup-on-continue.mdx @@ -0,0 +1,64 @@ +--- +title: "Run Checks in CI" +--- + +Continue watches your repository for pull requests, runs each check defined in `.continue/checks/`, and reports results as GitHub status checks. A green check means the code passed; a red check means the code failed, with a suggested fix. + +## Prerequisites + +- A [Continue](https://continue.dev) account +- A GitHub repository with at least one check file in `.continue/checks/` (see [Write Your First Check](/checks/quickstart)) + +## Connect GitHub + +1. Go to [continue.dev](https://continue.dev/) and sign in (or create an account). +2. Navigate to the [GitHub integration page](https://continue.dev/integrations/github). +3. Click **Connect GitHub** and authorize Continue. +4. Select the repositories you want Continue to monitor. + +Once connected, Continue will start running checks on new pull requests in the selected repositories. + +## How checks are discovered + +Continue reads the `.continue/checks/` directory (or `.agents/checks/`) from your repository's default branch. Every `.md` file in that directory becomes a check that runs on every PR. No additional configuration is needed β€” commit a check file and it is active. + +## The PR workflow + +When a pull request is opened, reopened, or updated: + +1. Each check file runs independently against the PR diff. +2. Results appear as GitHub status checks on the PR. +3. If a check passes, it shows a green checkmark. +4. If a check fails, it shows a red X with a suggested diff. +5. Click the check details link in GitHub to see the full reasoning on continue.dev. + +## Accept or reject suggestions + +When a check fails and suggests changes: + +1. Click the check's **Details** link on the PR in GitHub. This opens the result on continue.dev. +2. Review the suggested diff. +3. **Accept** to apply the changes as a commit to the PR branch. +4. **Reject** to dismiss the suggestion. The check will re-run on the next push. + +## Self-hosted alternative: GitHub Actions + +If you prefer to run checks on your own infrastructure, use the reusable workflow instead of Continue's cloud: + +```yaml .github/workflows/checks.yml +name: Run Checks + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + checks: + uses: continuedev/continue/.github/workflows/continue-agents.yml@main + secrets: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} +``` + +This requires an `ANTHROPIC_API_KEY` secret in your repository settings (**Settings > Secrets and variables > Actions**). The Continue cloud path described above does not require this β€” it uses your Continue account credentials. + +For advanced GitHub integration options, see the [GitHub integration](/mission-control/integrations/github) page. diff --git a/docs/checks/writing-good-checks.mdx b/docs/checks/writing-good-checks.mdx new file mode 100644 index 000000000..0aa7987f3 --- /dev/null +++ b/docs/checks/writing-good-checks.mdx @@ -0,0 +1,137 @@ +--- +title: "Writing Effective Checks" +--- + +## Let your coding agent write them + +The best checks come from a coding agent that can read your codebase. Describe what you want to enforce and the agent writes the check file for you, tailored to your actual frameworks, file structure, and conventions: + +``` +Look at our codebase and write a check that catches the security issues most relevant to our stack +``` + +For even better results, install the checks skill to teach your agent the check file format and best practices: + +```bash +npx skills add continuedev/writing-checks +``` + +When a check isn't producing the results you want, ask your agent to improve it: + +``` +This check is flagging too many false positives on test files. Update it to skip files in __tests__/ and *.test.ts +``` + +See [Example Checks](/checks/examples) for more prompts organized by category. + +The rest of this page covers what makes a check effective, whether you're writing it yourself or reviewing what your agent generated. + +## Scope narrowly + +Write one check per concern. A single check that tries to verify security, test coverage, and documentation quality will produce muddled results. Split it into three checks instead. + +Narrow scope produces clear pass/fail signals: + +```markdown .continue/checks/input-validation.md +--- +name: Input Validation +description: Verify new API endpoints validate their inputs +--- + +Flag as failing if any new API endpoint in the diff accepts user input +without validation (missing type checks, no schema validation, no length limits). + +Pass if all new endpoints validate their inputs, or if the PR does not +add any API endpoints. +``` + +A "review everything" check will hedge its output and frequently produce ambiguous verdicts. A focused check gives you a definitive yes or no. + +## Write explicit pass/fail criteria + +The prompt must state exactly what constitutes a failure. Vague instructions produce vague results. + +**Good:** + +``` +Flag as failing if any new API endpoint lacks input validation. +``` + +**Bad:** + +``` +Check that the code is secure. +``` + +Structure criteria as a list of concrete conditions: + +```markdown +Flag as failing if any of these are true: + +- New REST endpoints missing request body validation +- Database queries using string interpolation instead of parameterized queries +- Error responses that expose stack traces or internal paths + +Pass if none of these issues are present in the changed files. +``` + +Always include both failure conditions and the pass condition. This eliminates ambiguity about what a passing check looks like. + +## Reference the diff, not the whole repo + +Checks run in the context of a pull request diff. Write prompts that focus on what changed: + +```markdown +Review the **changed files** in this pull request for error handling issues. +``` + +Not: + +```markdown +Review the entire codebase for error handling issues. +``` + +The diff is the primary input. Prompts that ask the agent to evaluate the entire repository will be slow and produce unfocused results. + +## What checks can do + +Checks are not limited to reading the diff. The agent running a check can: + +- **Read files** in the repository beyond the diff, to understand surrounding context +- **Run bash commands** like `grep`, `find`, or custom scripts +- **Use a browser** to visit URLs, take screenshots, and verify rendered output +- **Access the PR diff** including file names, additions, and deletions +- **Use the GitHub CLI** (`gh`) to read PR metadata, comments, or linked issues + +This means a check can do things like verify a new page renders correctly in a browser, or cross-reference the diff against your database schema. + +## Checks vs. tests vs. linting + +**Linting** handles formatting, style, and static patterns. Use ESLint, Prettier, Ruff, or equivalent. If a rule can be expressed as a pattern match on syntax, it belongs in a linter. + +**Tests** verify correctness, behavior, and regressions. Use your test framework. If the question is "does this function return the right output for these inputs," write a test. + +**Checks** handle judgment calls that require understanding context: + +- "Is this database migration safe to run on a 500M-row table?" +- "Does this PR update the API docs to reflect the endpoint changes it makes?" +- "Are there security issues in this auth flow that a linter wouldn't catch?" +- "Does this error handling follow the patterns established elsewhere in the codebase?" + +Checks fill the gap between mechanical linting and human review. They are most valuable for questions that require reading multiple files, understanding intent, or applying project-specific conventions that aren't codified in a linter rule. + +## Iterate locally + +Write the check (or have your agent write it), run it against a real PR branch, read the output, refine. Run `/checks` in your coding agent to test: + +``` +/checks .continue/checks/migration-safety.md +``` + +Ask your agent to compare results across iterations: + +``` +Run the migration safety check, then update it to ignore additive-only migrations, and run it again. Show me the diff in output. +``` + +See [Run Checks Locally](/checks/running-locally) for the full local testing workflow. diff --git a/docs/custom.css b/docs/custom.css index b403e827c..c943364db 100644 --- a/docs/custom.css +++ b/docs/custom.css @@ -1,5 +1,11 @@ /* Custom CSS for Continue documentation */ +/* Wrap long lines in code blocks instead of horizontal scrolling */ +pre code { + white-space: pre-wrap; + word-wrap: break-word; +} + /* Enable smooth scrolling for anchor links */ html { scroll-behavior: smooth; diff --git a/docs/docs.json b/docs/docs.json index 3b6fceb54..3d4c51535 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -11,13 +11,33 @@ "navigation": { "tabs": [ { - "tab": "Mission Control", + "tab": "Checks", "groups": [ + { + "group": "Getting Started", + "icon": "rocket-launch", + "pages": [ + "index", + "checks/quickstart", + "checks/running-locally", + "checks/setup-on-continue" + ] + }, + { + "group": "Writing Checks", + "icon": "pencil", + "pages": [ + "checks/examples", + "checks/writing-good-checks", + "checks/reference" + ] + }, { "group": "Mission Control", "icon": "globe", + "expanded": false, "pages": [ - "index", + "mission-control/beyond-checks", "agents/overview", "mission-control/tasks", { @@ -1463,6 +1483,14 @@ { "source": "/agents/create-and-edit", "destination": "/agents/overview" + }, + { + "source": "/guides/run-agents-locally", + "destination": "/checks/running-locally" + }, + { + "source": "/overview", + "destination": "/" } ] } diff --git a/docs/index.mdx b/docs/index.mdx index 781539aef..1a8ae7218 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -1,49 +1,43 @@ --- title: "What is Continue?" -description: "Source-controlled AI checks, enforceable in CI" --- +Continue runs AI checks on every pull request. Each check is a markdown file in your repo that shows up as a GitHub status check β€” green if the code looks good, red with a suggested fix if not. +