Skip to content

Commit 0fbef13

Browse files
authored
Feat/sdk subgraph required (#66)
* make subgraph required * Adding changesets * bumping versions * Fixing SDK typechecks * fix workflow validation * fix workflow validation * fixing SDK typechecks * updating to node20 * moving from npm lifecycle scripts * exclude mcp tests * ignoring CLI tests
1 parent b8dc54d commit 0fbef13

22 files changed

Lines changed: 8659 additions & 16346 deletions

.changeset/README.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Changesets
2+
3+
This monorepo uses [changesets](https://github.com/changesets/changesets) for version management and publishing.
4+
5+
## Quick Start
6+
7+
```bash
8+
# Create a changeset
9+
pnpm changeset
10+
11+
# Check changeset status
12+
pnpm changeset:status
13+
14+
# Version packages (usually done by CI)
15+
pnpm changeset:version
16+
17+
# Publish packages (usually done by CI)
18+
pnpm changeset:publish
19+
```
20+
21+
## Creating Changesets
22+
23+
When you make changes that should be released, create a changeset:
24+
25+
```bash
26+
pnpm changeset
27+
```
28+
29+
This will:
30+
1. Ask which packages have changed
31+
2. Ask what type of change (major/minor/patch) for each
32+
3. Prompt you to write a summary
33+
34+
## Change Types
35+
36+
- **patch** (0.0.x): Bug fixes, small improvements, documentation updates
37+
- **minor** (0.x.0): New features, new API methods (backwards compatible)
38+
- **major** (x.0.0): Breaking changes, API changes that break existing code
39+
40+
## Changeset Categories
41+
42+
Use these prefixes in your changeset summaries:
43+
44+
- `feat:` New features
45+
- `fix:` Bug fixes
46+
- `docs:` Documentation changes
47+
- `refactor:` Code refactoring
48+
- `perf:` Performance improvements
49+
- `test:` Test additions/changes
50+
- `chore:` Maintenance tasks
51+
- `breaking:` Breaking changes (auto-triggers major version)
52+
53+
## Example Changeset
54+
55+
```markdown
56+
---
57+
"@ensemble-ai/sdk": minor
58+
"@ensemble-ai/cli": patch
59+
---
60+
61+
feat: Add subgraphUrl as required parameter to SDK configuration
62+
63+
- SDK: subgraphUrl is now required in EnsembleConfig
64+
- CLI: Updated to always provide subgraphUrl from config
65+
- This ensures agent query methods always work correctly
66+
```
67+
68+
## Package Versioning
69+
70+
Each package versions independently:
71+
72+
- **@ensemble-ai/sdk**: Core SDK, follows semver strictly
73+
- **@ensemble-ai/cli**: CLI tool, minor bumps for new commands
74+
- **@ensemble-ai/contracts**: Smart contracts, major bumps for contract changes
75+
- **@ensemble-ai/subgraph**: Subgraph indexer, syncs with contract versions
76+
- **@ensemble-ai/mcp-server**: MCP server, independent versioning
77+
78+
## Release Process
79+
80+
### Automated (Recommended)
81+
1. Create changeset with your PR
82+
2. Merge PR to main
83+
3. CI creates "Release packages" PR
84+
4. Review and merge release PR
85+
5. CI publishes to npm
86+
87+
### Manual
88+
```bash
89+
pnpm changeset:version # Update versions and changelogs
90+
pnpm changeset:publish # Publish to npm
91+
```
92+
93+
### Prerelease
94+
```bash
95+
# Enter prerelease mode
96+
pnpm changeset pre enter alpha
97+
98+
# Create changesets normally
99+
pnpm changeset
100+
101+
# Version and publish with tag
102+
pnpm changeset:version
103+
pnpm changeset:publish --tag alpha
104+
105+
# Exit prerelease mode
106+
pnpm changeset pre exit
107+
```
108+
109+
## Troubleshooting
110+
111+
### "No changesets present"
112+
You forgot to create a changeset! Run `pnpm changeset`.
113+
114+
### Package not updating
115+
Make sure the package is listed in your changeset markdown.
116+
117+
### Wrong version bump
118+
Delete the changeset file and recreate it with the correct type.
119+
120+
### Internal dependency conflicts
121+
Changesets will automatically update internal dependencies based on the `updateInternalDependencies` setting.

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": [],
11+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
12+
"onlyUpdatePeerDependentsWhenOutOfRange": true
13+
}
14+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR Validation
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
validate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v2
18+
with:
19+
version: 8
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: 'pnpm'
26+
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Type check
31+
run: pnpm typecheck
32+
33+
- name: Build packages
34+
run: pnpm build
35+
36+
- name: Run tests
37+
run: pnpm test
38+
39+
- name: Check for changeset (skip for dependabot)
40+
if: github.actor != 'dependabot[bot]'
41+
run: |
42+
if [ "$(pnpm changeset status --verbose | grep 'No changesets present')" ]; then
43+
echo "::error::Please add a changeset by running 'pnpm changeset'"
44+
echo "::error::This helps us track changes and generate release notes"
45+
exit 1
46+
else
47+
echo "✅ Changeset found"
48+
fi

.github/workflows/prerelease.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Prerelease
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Prerelease tag'
8+
required: true
9+
type: choice
10+
options:
11+
- alpha
12+
- beta
13+
- rc
14+
15+
jobs:
16+
prerelease:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v2
30+
with:
31+
version: 8
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: 'pnpm'
38+
registry-url: 'https://registry.npmjs.org'
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Build packages
44+
run: pnpm build
45+
46+
- name: Run tests
47+
run: pnpm test
48+
49+
- name: Enter prerelease mode
50+
run: pnpm changeset pre enter ${{ github.event.inputs.tag }}
51+
52+
- name: Version packages
53+
run: pnpm changeset:version
54+
55+
- name: Commit prerelease changes
56+
run: |
57+
git config --local user.email "action@github.com"
58+
git config --local user.name "GitHub Action"
59+
git add .
60+
git commit -m "chore: enter ${{ github.event.inputs.tag }} prerelease mode" || exit 0
61+
62+
- name: Publish prerelease
63+
run: pnpm changeset:publish --tag ${{ github.event.inputs.tag }}
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
67+
- name: Push changes
68+
run: git push --follow-tags

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
id-token: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v2
25+
with:
26+
version: 8
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: 'pnpm'
33+
registry-url: 'https://registry.npmjs.org'
34+
35+
- name: Install dependencies
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Build packages
39+
run: pnpm build
40+
41+
- name: Run tests
42+
run: pnpm test
43+
44+
- name: Create Release Pull Request or Publish
45+
id: changesets
46+
uses: changesets/action@v1
47+
with:
48+
publish: pnpm changeset:publish
49+
title: "chore: release packages"
50+
commit: "chore: release packages"
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)