Skip to content
Open
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
92 changes: 92 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Changesets

This folder contains configuration and changeset files for managing package versioning and publishing in the Cherry Studio monorepo.

## What is Changesets?

Changesets is a tool to help manage versioning and publishing for multi-package repositories. It tracks changes to packages and automates:

- Version bumping based on semantic versioning
- Changelog generation
- Package publishing
- Dependency updates between packages

## Quick Start

### Adding a changeset

When you make changes that should be published, run:

```bash
pnpm changeset add
```

This will:
1. Ask which packages have changed
2. Ask for the type of change (patch/minor/major)
3. Ask for a description of the change
4. Create a changeset file in `.changeset/`

### Versioning packages

When ready to release:

```bash
pnpm changeset version
```

This will:
1. Bump package versions based on accumulated changesets
2. Update CHANGELOG.md files
3. Update internal dependencies
4. Delete consumed changeset files

### Publishing packages

```bash
pnpm release:packages
```

This will:
1. Build all packages
2. Publish to npm
3. Create GitHub releases

## Configuration

See `config.json` for the changeset configuration:

- **changelog**: Uses `@changesets/changelog-github` to generate GitHub-linked changelogs
- **access**: `public` - packages are published publicly
- **baseBranch**: `main` - PRs target this branch
- **updateInternalDependencies**: `patch` - internal deps are updated on any change
- **ignore**: Packages not for publishing (shared, mcp-trace, ui)

## Packages managed

| Package | Current Version | Description |
|---------|----------------|-------------|
| `@cherrystudio/ai-core` | 1.0.9 | Unified AI Provider Interface |
| `@cherrystudio/ai-sdk-provider` | 0.1.3 | AI SDK provider bundle with CherryIN routing |
| `@cherrystudio/extension-table-plus` | 3.0.11 | Table extension for Tiptap |

## Dependency relationships

```
ai-core (peer-depends on) → ai-sdk-provider
```

Changeset automatically handles updating peer dependency ranges when `ai-sdk-provider` is published.

## CI/CD Integration

The `.github/workflows/release-packages.yml` workflow automatically:

1. Creates a "Version Packages" PR when changesets are merged to main
2. Publishes packages when the Version Packages PR is merged
3. Creates GitHub releases with changelogs

## Learn more

- [Changesets documentation](https://github.com/changesets/changesets)
- [Common questions](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

"$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "CherryHQ/cherry-studio" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
10 changes: 10 additions & 0 deletions .changeset/initial-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@cherrystudio/ai-core': patch
'@cherrystudio/ai-sdk-provider': patch
'@cherrystudio/extension-table-plus': patch
---

Initial changeset setup - no functional changes

This changeset marks the initial setup of the changeset workflow for the Cherry Studio monorepo.
No functional changes are included in this release.
78 changes: 78 additions & 0 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release Packages

on:
push:
branches:
- main
paths:
- '.changeset/**'
- 'packages/**'
workflow_dispatch:

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

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
release:
name: Release Packages
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Cache pnpm dependencies
uses: actions/cache@v5
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install Dependencies
run: pnpm install

- name: Build Packages
run: pnpm build:packages

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

- name: Publish Summary
if: steps.changesets.outputs.published == 'true'
run: |
echo "## Published Packages" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The following packages were published:" >> $GITHUB_STEP_SUMMARY
echo "$PUBLISHED_PACKAGES" >> $GITHUB_STEP_SUMMARY
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
76 changes: 76 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Snapshot Release

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to create snapshot from'
required: true
default: 'main'

permissions:
contents: write
id-token: write

jobs:
snapshot:
name: Snapshot Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT

- name: Cache pnpm dependencies
uses: actions/cache@v5
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install Dependencies
run: pnpm install

- name: Build Packages
run: pnpm build:packages

- name: Version Snapshot
run: pnpm changeset version --snapshot snapshot

- name: Publish Snapshot
run: pnpm changeset publish --tag snapshot --no-git-tag
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Snapshot Summary
run: |
echo "## Snapshot Release" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Snapshot released from branch: $BRANCH" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Install with:" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo 'pnpm add @cherrystudio/ai-core@snapshot' >> $GITHUB_STEP_SUMMARY
echo 'pnpm add @cherrystudio/ai-sdk-provider@snapshot' >> $GITHUB_STEP_SUMMARY
echo 'pnpm add @cherrystudio/extension-table-plus@snapshot' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
env:
BRANCH: ${{ github.event.inputs.branch }}
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@
"release:aicore:alpha": "pnpm --filter @cherrystudio/ai-core version prerelease --preid alpha && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/ai-core publish --tag alpha --access public",
"release:aicore:beta": "pnpm --filter @cherrystudio/ai-core version prerelease --preid beta && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/ai-core publish --tag beta --access public",
"release:aicore": "pnpm --filter @cherrystudio/ai-core version patch && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/ai-core publish --access public",
"release:ai-sdk-provider": "pnpm --filter @cherrystudio/ai-sdk-provider version patch && pnpm --filter @cherrystudio/ai-sdk-provider build && pnpm --filter @cherrystudio/ai-sdk-provider publish --access public"
"release:ai-sdk-provider": "pnpm --filter @cherrystudio/ai-sdk-provider version patch && pnpm --filter @cherrystudio/ai-sdk-provider build && pnpm --filter @cherrystudio/ai-sdk-provider publish --access public",
"changeset": "changeset",
"changeset:status": "changeset status",
"changeset:version": "changeset version",
"changeset:publish": "changeset publish",
"build:packages": "pnpm --filter @cherrystudio/ai-sdk-provider build && pnpm --filter @cherrystudio/ai-core build && pnpm --filter @cherrystudio/extension-table-plus build",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里建议修改成为:packages:build, packages:release

"release:packages": "pnpm build:packages && changeset publish"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "0.1.76",
Expand Down Expand Up @@ -117,6 +123,8 @@
"@aws-sdk/client-bedrock-runtime": "^3.910.0",
"@aws-sdk/client-s3": "^3.910.0",
"@biomejs/biome": "2.2.4",
"@changesets/changelog-github": "^0.5.2",
"@changesets/cli": "^2.29.8",
"@cherrystudio/ai-core": "workspace:^1.0.9",
"@cherrystudio/embedjs": "0.1.31",
"@cherrystudio/embedjs-interfaces": "0.1.31",
Expand Down
3 changes: 2 additions & 1 deletion packages/ai-sdk-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"dev": "tsc -w",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"prepublishOnly": "pnpm build"
},
"peerDependencies": {
"@ai-sdk/anthropic": "^2.0.29",
Expand Down
3 changes: 2 additions & 1 deletion packages/aiCore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"dev": "tsc -w",
"clean": "rm -rf dist",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"prepublishOnly": "pnpm build"
},
"keywords": [
"ai",
Expand Down
Loading
Loading