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
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/svg-image-format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cosmicjs/cli": minor
---

Add `--format` (`png` | `svg`) and `--aspect-ratio` to `cosmic ai image` for vector logos, icons, and illustrations.
28 changes: 28 additions & 0 deletions .cursor/rules/changesets-versioning.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
description: How to version and release the CLI (Changesets)
globs:
- "**/package.json"
- ".changeset/**"
alwaysApply: true
---

# Versioning: never bump `version` by hand

This repo releases with [Changesets](https://github.com/changesets/changesets). The
version in `package.json` is owned by the automation, not by humans.

## Rules

- NEVER manually edit the `"version"` field in `package.json`.
- To ship a change, add a changeset: `bunx changeset` (or create a file under
`.changeset/`) describing the bump (`patch` | `minor` | `major`).
- The `changeset-release/main` bot opens a "Version Packages" PR that consumes the
changeset, computes the next version from the **last published** version, updates
`CHANGELOG.md`, and deletes the changeset. Merging that PR publishes to npm.
- Do not create `v*.*.*` tags by hand. Changesets publishes from `main`.

## Checklist before committing a feature

1. `package.json` `version` is unchanged from the published baseline.
2. There is exactly one changeset describing the change.
3. You did not hand-edit `CHANGELOG.md` (the bot writes it).
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Package Checks

on:
push:
branches:
- '**'

jobs:
checks:
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3'

- name: Install packages
run: bun install --frozen-lockfile

- name: Build
run: bun run build

- name: Test
run: bun run test
60 changes: 24 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,47 @@
name: Publish to npm
name: Publish Package

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish (e.g. v1.6.0). Tag must already exist on the branch you want published.'
required: true
workflow_run:
workflows: ['Package Checks']
types:
- completed
branches:
- main

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

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
contents: write
pull-requests: write

steps:
- name: Checkout source
- name: Checkout source code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: '1.3'

- name: Setup Node (for npm publish)
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: 22.x
registry-url: 'https://registry.npmjs.org'

- name: Verify tag matches package.json version
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
RAW_REF="${{ github.event.inputs.tag || github.ref_name }}"
TAG_VERSION="${RAW_REF#v}"
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "Tag/version mismatch: tag=$TAG_VERSION package.json=$PKG_VERSION"
exit 1
fi
echo "Publishing version $PKG_VERSION"

- name: Install dependencies
- name: Install packages
run: bun install --frozen-lockfile

- name: Build
run: bun run build

- name: Pack (dry run, prints tarball contents)
run: npm pack --dry-run

- name: Publish to npm
run: npm publish --provenance --access public
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: bun run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,16 @@ This runs all tests sequentially via [Vitest](https://vitest.dev/). Each test cr
| `workflows.test.ts` | Workflows (Dashboard API) | Create, list, get, update, delete |
| `agents.test.ts` | Agents (Dashboard API) | List, get (read-only) |

## Releasing

Releases use the same [Changesets](https://github.com/changesets/changesets) flow as `@cosmicjs/sdk`. Add a changeset with `bunx changeset` (`patch` | `minor` | `major`). Do not hand-edit the `version` field in `package.json`.

1. Merge the feature PR to `main`. [Package Checks](.github/workflows/main.yml) must pass.
2. CI opens or updates a **Version Packages** PR that bumps the version and writes `CHANGELOG.md`.
3. Merging that PR publishes `@cosmicjs/cli` to npm.

Do not push `v*.*.*` tags by hand.

## Support

- [Cosmic Documentation](https://www.cosmicjs.com/docs)
Expand Down
Loading
Loading