Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Changesets

This monorepo uses [changesets](https://github.com/changesets/changesets) for version management and publishing.

## Quick Start

```bash
# Create a changeset
pnpm changeset

# Check changeset status
pnpm changeset:status

# Version packages (usually done by CI)
pnpm changeset:version

# Publish packages (usually done by CI)
pnpm changeset:publish
```

## Creating Changesets

When you make changes that should be released, create a changeset:

```bash
pnpm changeset
```

This will:
1. Ask which packages have changed
2. Ask what type of change (major/minor/patch) for each
3. Prompt you to write a summary

## Change Types

- **patch** (0.0.x): Bug fixes, small improvements, documentation updates
- **minor** (0.x.0): New features, new API methods (backwards compatible)
- **major** (x.0.0): Breaking changes, API changes that break existing code

## Changeset Categories

Use these prefixes in your changeset summaries:

- `feat:` New features
- `fix:` Bug fixes
- `docs:` Documentation changes
- `refactor:` Code refactoring
- `perf:` Performance improvements
- `test:` Test additions/changes
- `chore:` Maintenance tasks
- `breaking:` Breaking changes (auto-triggers major version)

## Example Changeset

```markdown
---
"@ensemble-ai/sdk": minor
"@ensemble-ai/cli": patch
---

feat: Add subgraphUrl as required parameter to SDK configuration

- SDK: subgraphUrl is now required in EnsembleConfig
- CLI: Updated to always provide subgraphUrl from config
- This ensures agent query methods always work correctly
```

## Package Versioning

Each package versions independently:

- **@ensemble-ai/sdk**: Core SDK, follows semver strictly
- **@ensemble-ai/cli**: CLI tool, minor bumps for new commands
- **@ensemble-ai/contracts**: Smart contracts, major bumps for contract changes
- **@ensemble-ai/subgraph**: Subgraph indexer, syncs with contract versions
- **@ensemble-ai/mcp-server**: MCP server, independent versioning

## Release Process

### Automated (Recommended)
1. Create changeset with your PR
2. Merge PR to main
3. CI creates "Release packages" PR
4. Review and merge release PR
5. CI publishes to npm

### Manual
```bash
pnpm changeset:version # Update versions and changelogs
pnpm changeset:publish # Publish to npm
```

### Prerelease
```bash
# Enter prerelease mode
pnpm changeset pre enter alpha

# Create changesets normally
pnpm changeset

# Version and publish with tag
pnpm changeset:version
pnpm changeset:publish --tag alpha

# Exit prerelease mode
pnpm changeset pre exit
```

## Troubleshooting

### "No changesets present"
You forgot to create a changeset! Run `pnpm changeset`.

### Package not updating
Make sure the package is listed in your changeset markdown.

### Wrong version bump
Delete the changeset file and recreate it with the correct type.

### Internal dependency conflicts
Changesets will automatically update internal dependencies based on the `updateInternalDependencies` setting.
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
48 changes: 48 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: PR Validation

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Type check
run: pnpm typecheck

- name: Build packages
run: pnpm build

- name: Run tests
run: pnpm test

- name: Check for changeset (skip for dependabot)
if: github.actor != 'dependabot[bot]'
run: |
if [ "$(pnpm changeset status --verbose | grep 'No changesets present')" ]; then
echo "::error::Please add a changeset by running 'pnpm changeset'"
echo "::error::This helps us track changes and generate release notes"
exit 1
else
echo "✅ Changeset found"
fi
68 changes: 68 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Prerelease

on:
workflow_dispatch:
inputs:
tag:
description: 'Prerelease tag'
required: true
type: choice
options:
- alpha
- beta
- rc

jobs:
prerelease:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm build

- name: Run tests
run: pnpm test

- name: Enter prerelease mode
run: pnpm changeset pre enter ${{ github.event.inputs.tag }}

- name: Version packages
run: pnpm changeset:version

- name: Commit prerelease changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "chore: enter ${{ github.event.inputs.tag }} prerelease mode" || exit 0

- name: Publish prerelease
run: pnpm changeset:publish --tag ${{ github.event.inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push changes
run: git push --follow-tags
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
branches: [main]

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm build

- name: Run tests
run: pnpm test

- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm changeset:publish
title: "chore: release packages"
commit: "chore: release packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading
Loading