Skip to content

Latest commit

 

History

History
111 lines (89 loc) · 5.09 KB

CONTRIBUTING.md

File metadata and controls

111 lines (89 loc) · 5.09 KB

Contributing to AgentSwarms

Thanks for taking the time to contribute!

Getting set up

Follow the installation guide to get a local dev environment running (Node/Bun, your own Supabase project, environment variables).

Workflow

  1. Fork the repo and create a branch off main: git checkout -b your-name/short-description

  2. Make your changes. Keep pull requests focused — one logical change per PR is easier to review than a bundle of unrelated fixes.

  3. Run the checks CI runs, before opening a PR:

    npm run lint
    npm run check     # what CI runs: typecheck, lint, docs and infra checks, tests, build
    npm run format
    npm run typecheck
    npm run test

    npm run typecheck generates src/routeTree.gen.ts first, and that is not incidental. The route tree is built by the TanStack Router plugin during vite dev / vite build and is gitignored — tracking it put a meaningless 3,000-line diff on nearly every branch. But src/router.tsx imports it, so a clone that has never run the dev server cannot typecheck: you get Cannot find module './routeTree.gen' followed by around forty cascading errors naming route files that are perfectly fine. Run npm run generate:routes (or the dev server, or a build) and they all go away.

  4. If your change touches the database schema, add a new migration under supabase/migrations/ rather than editing an existing one — migrations are append-only and already applied to running instances.

    Take the next number after the highest file already there — do not use today's date. The version prefixes in this directory are a synthetic counter that has run ahead of the calendar (you will see a "day" of 32 or 71), and supabase db push keys on that prefix: a version that duplicates an existing one, or sorts before it, is treated as already applied and silently skipped. The failure surfaces much later as "table not found in schema cache" against a migration that looks present in the repo. tests/unit/migrations.test.ts fails on a duplicate, but only after you have created it.

    Expand, don't contract. The previous release must still run on your schema, so an operator can roll the app back without touching the database (Rolling back one release). Add tables, columns (nullable, or with a default), functions and enum values freely. Don't drop or rename anything, or narrow a type, or change a function's arguments, in the release that stops using it: do that one release later, with a -- contract: public.<table>[.<column>] line in the migration. The unit suite requires that line next to any DROP TABLE, DROP COLUMN or RENAME. The upgrade CI job measures the rest on a real database.

    A column added to user_secrets, catalog_sources or kb_sources has no rights for browser roles until you call public.keep_sealed_column_on_server for that table again, after the ADD COLUMN: their sealed column is closed column by column (R560). tests/unit/sealedColumns.test.ts fails on a migration that forgets.

    A column that points at another row (an id of a model, server, workspace…) in a table users write themselves needs its policy's WITH CHECK to require that they may use that row, not only that the row is theirs: anyone can write their own rows through the database API, and the server follows pointers with full access (R561, 20261215000000_pointers_name_your_own_rows.sql). On the server, read what a pointer names with its owner's filter as well.

  5. Open a pull request describing what changed and why. Link any related issue.

Reporting bugs

Open a GitHub issue with:

  • Steps to reproduce
  • What you expected vs. what happened
  • Browser/OS and Node version, if relevant

Reporting security issues

Please don't open a public issue for security vulnerabilities — see SECURITY.md instead.

Code style

  • TypeScript, formatted with Prettier (npm run format) and linted with ESLint (npm run lint) — both are configured in the repo, just run them.
  • Match the conventions of the surrounding code (naming, file organization) rather than introducing a new pattern for a single change.
  • A new Supabase client takes its options through withNulSafeFetch(...) (src/integrations/supabase/nulSafeFetch.ts). That client's writes then never carry a NUL character, which Postgres refuses. A test fails until it does. The two clients under src/integrations/supabase/ were generated, and have been edited to use it; keep that if they are ever regenerated.
  • An editor whose save lands only on the version it read sends that version with every update, and overwrite: true for "Overwrite with mine". The server refuses an update that carries neither, through unversionedSave (src/lib/saveVersion.ts), since a page opened before the guard was deployed sends neither.

Code of Conduct

This project follows the Code of Conduct. By participating, you're expected to uphold it.