Contribution Guide
This section contains documentation for developers and contributors working on n8n-as-code.
๐ Available Documentationโ
Architecture & Designโ
- Architecture Overview: Understand the n8n-as-code monorepo architecture, component interactions, and design decisions.
Internal Packagesโ
- Core Package: Internal documentation for the Core package that provides shared business logic for all n8n-as-code components.
- Agent CLI: Internal documentation for the Agent CLI package used by AI assistants to generate context and snippets.
- Claude Skill: Internal documentation for the Claude Agent Skill package.
๐ Development Setupโ
Prerequisitesโ
- Node.js 18+
- npm 9+
- Git
Getting Startedโ
- Clone the repository
- Run
npm installin the root directory - Build all packages with
npm run build - Run tests with
npm test
๐ฆ Package Structureโ
n8n-as-code is organized as a monorepo with the following packages:
| Package | Purpose | Primary Users |
|---|---|---|
Core (@n8n-as-code/core) | Shared logic, API client, synchronization | All packages |
CLI (@n8n-as-code/cli) | Command-line interface for workflow management | Terminal users, automation |
| VS Code Extension | Integrated development environment | VS Code users |
Agent CLI (@n8n-as-code/agent-cli) | AI context generation and node schemas | AI assistants, developers |
๐งช Testingโ
Test Structureโ
- Unit Tests: Individual component testing with Jest
- Integration Tests: End-to-end workflow tests
- Snapshot Tests: Ensure generated files match expected format
Running Testsโ
# Run all tests
npm test
# Run tests for specific package
cd packages/core && npm test
cd packages/agent-cli && npm test
๐ง Buildingโ
Development Buildโ
npm run build
Watch Mode (Development)โ
npm run dev
๐ฆ Version Managementโ
n8n-as-code uses Changeset with independent package versioning. Each package evolves independently while Changeset automatically manages internal dependencies.
Current Package Versionsโ
Packages evolve independently with their own version numbers:
- @n8n-as-code/core:
0.3.0 - @n8n-as-code/cli:
0.3.0 - @n8n-as-code/agent-cli:
0.2.0 - VS Code Extension:
0.2.0
Note: Each package has its own version number. Changeset ensures that when a package depends on another internal package, it always references the current version of that dependency.
Package Publication Strategyโ
The project includes different types of packages:
| Package | Published To | Managed By Changeset |
|---|---|---|
@n8n-as-code/core | NPM Registry | โ Yes |
@n8n-as-code/cli | NPM Registry | โ Yes |
@n8n-as-code/agent-cli | NPM Registry | โ Yes |
n8n-as-code (VS Code Extension) | VS Code Marketplace | โ Yes (versioning only) |
n8n-as-code-monorepo (root) | Not published | โ No (ignored) |
docs | Not published | โ No (private) |
Important: The VS Code extension is marked as "private": true to prevent accidental NPM publication, but it is still managed by Changeset for version numbering and dependency synchronization. Changeset automatically skips private packages during changeset publish.
Release Workflowโ
Step 1: Create Changeset (Developer)โ
After modifying code, document your changes:
npm run changeset
This command:
- Creates a file
.changeset/random-name-123.md - Prompts you to select affected packages (including VS Code extension if modified)
- Asks for version bump type:
patch(0.3.0โ0.3.1),minor(0.3.0โ0.4.0),major(0.3.0โ1.0.0) - Requests a changelog message
Important: Commit this changeset file with your code changes.
Step 2: Version Packages PR (Automated)โ
When changesets are pushed to main, the CI creates a "Version Packages" Pull Request automatically:
- Reads all
.changeset/*.mdfiles - Updates
package.jsonversions for ALL packages (including private ones) - Automatically updates internal dependencies across all packages
- Generates/updates
CHANGELOG.mdfiles - Deletes processed changeset files
- Creates a single PR with all these changes
Step 3: Merge & Publish (Automated)โ
When the "Version Packages" PR is merged:
-
NPM Publication:
- Builds all packages
- Publishes public packages to NPM registry (
@n8n-as-code/core,@n8n-as-code/cli,@n8n-as-code/agent-cli) - Skips private packages automatically (monorepo root, VS Code extension, docs)
- Creates Git tags for each published package (e.g.,
@n8n-as-code/core@0.3.1)
-
VS Code Extension:
- Separately publishes to VS Code Marketplace using the version from package.json
- No Git tag created for the extension (private package)
-
GitHub Releases:
- ENABLED - One GitHub Release is created per published package
- Each package has its own release timeline (e.g.,
@n8n-as-code/core@0.3.1,@n8n-as-code/cli@0.3.2) - Release notes are automatically extracted from each package's CHANGELOG.md
- Private packages (VS Code extension) do not get GitHub Releases automatically
Example: How Internal Dependencies Stay Synchronizedโ
Let's say you fix a bug in @n8n-as-code/core:
# 1. Create a changeset for the core fix
npm run changeset
# Select: @n8n-as-code/core
# Type: patch (0.3.0 โ 0.3.1)
# 2. Apply versions
npm run version-packages
Result:
@n8n-as-code/core:0.3.0โ0.3.1โ@n8n-as-code/cli:0.3.0โ0.3.1(auto-bumped because it depends on core) โ@n8n-as-code/agent-cli:0.2.0(unchanged, no dependency on core) โVS Code Extension:0.2.0โ0.2.1(auto-bumped because it depends on core) โ
All packages that depend on core will have their package.json updated to reference "@n8n-as-code/core": "0.3.1".
Workflow Summary Diagramโ
Developer makes changes
โ
npm run changeset (creates .changeset/xyz.md)
โ
git commit + git push
โ
CI detects changeset files โ Creates "Version Packages" PR
โ
Maintainer reviews & merges PR
โ
CI automatically:
โโโ Publishes to NPM (@n8n-as-code/*)
โโโ Creates Git tags (one per package)
โโโ Publishes VS Code extension to Marketplace
Key Rulesโ
- Never manually edit versions in package.json
- Always use Changeset even for small fixes
- Include VS Code extension in changesets when you modify it - this ensures dependencies stay synchronized
- Internal dependencies are automatically updated thanks to
"updateInternalDependencies": "patch"in Changeset config - Private packages are safe - Changeset will manage their versions but never publish them to NPM
- Use
npm run check-versionsto verify all internal dependencies are up-to-date - Git tags are created automatically for each published NPM package
- GitHub Releases are created automatically - One release per package with its own timeline
- Each package has independent releases - No global monorepo release
GitHub Releases per Packageโ
When a "Version Packages" PR is merged, Changeset automatically creates:
For each published NPM package:
- โ
GitHub Release (e.g.,
@n8n-as-code/core@0.3.1) - โ Git Tag with the same name
- โ Release notes extracted from the package's CHANGELOG.md
For private packages (VS Code extension):
- โ No GitHub Release (private packages are skipped)
- โน๏ธ You can create manual releases if needed
Example timeline on GitHub:
Releases
โโ @n8n-as-code/core@0.3.2 (Jan 20, 2024)
โโ @n8n-as-code/cli@0.4.1 (Jan 20, 2024)
โโ @n8n-as-code/agent-cli@0.3.0 (Jan 18, 2024)
โโ @n8n-as-code/core@0.3.1 (Jan 15, 2024)
โโ @n8n-as-code/cli@0.4.0 (Jan 15, 2024)
Each package maintains its own release history!
๐ Contribution Guidelinesโ
Code Styleโ
- Use TypeScript with strict type checking
- Follow ESLint configuration
- Write comprehensive tests for new features
Pull Request Processโ
- Create a feature branch from
main - Make your changes with tests
- Ensure all tests pass
- Submit a pull request with clear description
Documentationโ
- Update relevant documentation when adding features
- Include JSDoc comments for public APIs
- Keep the contributors documentation up to date
๐ Related Resourcesโ
โ Need Help?โ
- Check the existing documentation in this section
- Look at the source code for examples
- Open an issue on GitHub for specific questions
- Join discussions in the GitHub forum
This documentation is maintained by the n8n-as-code development team.