Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7f01688
feat: Add craft init, validate commands and improve onboarding
BYK Jan 23, 2026
e1b3bad
refactor: Address PR review comments
BYK Jan 23, 2026
de49b85
fix: Use os.tmpdir() instead of hardcoded /tmp in tests
BYK Jan 31, 2026
647e787
fix: Use semantic version comparison for minVersion check
BYK Jan 31, 2026
227dfe7
chore: Update smart defaults minVersion from 2.20.0 to 2.21.0
BYK Jan 31, 2026
4e16924
refactor: Move target detection logic to target classes
BYK Feb 6, 2026
8dd7c7a
fix: Address BugBot issues from PR review
BYK Feb 6, 2026
09b3039
fix: Default to Docker Hub when GitHub info unavailable in Docker tar…
BYK Feb 6, 2026
944477c
fix: Fix generated workflow issues identified by BugBot
BYK Feb 6, 2026
a09f746
fix(validate): skip warnings for reusable workflow files
BYK Feb 6, 2026
a2b52bc
refactor(init): extract GitHub detection to shared utility and fix du…
BYK Feb 6, 2026
7ef7f5e
Merge remote-tracking branch 'origin/master' into feat/improve-onboar…
BYK Feb 9, 2026
d0476dc
fix(utils): let getGitHubInfoFromRemote propagate errors to callers
BYK Feb 12, 2026
4e80644
refactor(pypi): deduplicate return objects in PypiTarget.detect
BYK Feb 12, 2026
866ecfa
refactor: use single SMART_DEFAULTS_MIN_VERSION constant across codebase
BYK Feb 12, 2026
2853c45
chore: Merge master and resolve onboarding conflicts
MathurAditya724 Oct 16, 2026
c7a4729
fix(init): Generate runtime versions and Docker credentials
MathurAditya724 Oct 16, 2026
f4067c6
fix(ci): Download the pinned symbol collector asset directly
MathurAditya724 Oct 16, 2026
0e5c728
fix(init): Pin pnpm setup to an immutable action commit
MathurAditya724 Oct 16, 2026
4ab6712
fix(init): Restrict changelog preview workflow access
MathurAditya724 Oct 16, 2026
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
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ RUN : \
# Pin CocoaPods version to avoid bugs like https://github.com/CocoaPods/CocoaPods/issues/12081
&& gem install cocoapods -v 1.16.2 --no-document \
# Install https://github.com/getsentry/symbol-collector
&& symbol_collector_url=$(curl -s https://api.github.com/repos/getsentry/symbol-collector/releases/tags/1.17.0 | \
jq -r '.assets[].browser_download_url | select(endswith("symbolcollector-console-linux-x64.zip"))') \
&& curl -sL $symbol_collector_url -o "/tmp/sym-collector.zip" \
&& curl -fsSL --retry 3 https://github.com/getsentry/symbol-collector/releases/download/1.17.0/symbolcollector-console-linux-x64.zip -o /tmp/sym-collector.zip \
&& unzip /tmp/sym-collector.zip -d /usr/local/bin/ \
&& rm /tmp/sym-collector.zip \
&& chmod +x /usr/local/bin/SymbolCollector.Console
Expand Down
33 changes: 33 additions & 0 deletions docs/src/content/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,39 @@ Require a minimum Craft version:
minVersion: '0.5.0'
```

### Smart Defaults

Setting `minVersion` to `2.21.0` or higher enables smart defaults that simplify configuration:

```yaml
minVersion: '2.21.0'
```

| Feature | Default with `minVersion >= 2.21.0` | Default without |
| ------------------- | ----------------------------------- | --------------- |
| `changelog.policy` | `auto` | `none` |
| `versioning.policy` | `auto` (with `>= 2.14.0`) | `manual` |

This means a minimal configuration like this:

```yaml
minVersion: '2.21.0'
targets:
- name: npm
- name: github
```

Will automatically:

- Generate changelogs from conventional commits
- Determine version bumps from commit analysis
- Create `CHANGELOG.md` if it doesn't exist

:::tip[Recommended for New Projects]
Use `minVersion: '2.21.0'` for new projects to take advantage of smart defaults.
Run `craft init` to automatically generate this configuration.
:::

## Required Files

Ensure specific artifacts exist before publishing:
Expand Down
167 changes: 159 additions & 8 deletions docs/src/content/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,59 @@ pnpm add -g @sentry/craft
npm install -g @sentry/craft
```

## Quick Start with `craft init`

The fastest way to get started is using `craft init`, which auto-detects your project type and generates configuration:

```shell
cd your-project
craft init
```

This will:

1. Detect your project type (npm, PyPI, Cargo, etc.)
2. Generate a `.craft.yml` configuration file
3. Create GitHub Actions workflows for release automation

Example output:

```
[info] Detecting project type...
[info] ✓ Found GitHub repository: your-org/your-repo
[info] ✓ Detected 2 target(s):
- npm
- github
[info] ✓ Detected Node.js project (pnpm)

Proposed .craft.yml:
────────────────────────────────────────
minVersion: "2.21.0"
targets:
- name: npm
- name: github
────────────────────────────────────────
? Create .craft.yml? (Y/n)
```

After initialization, validate your configuration:

```shell
craft validate
```

## Usage

```shell
$ craft -h
craft <command>

Commands:
craft prepare NEW-VERSION 🚢 Prepare a new release branch
craft init Initialize Craft configuration for a new project
craft prepare [NEW-VERSION] 🚢 Prepare a new release branch
[aliases: p, prerelease, prepublish, prepare, release]
craft publish NEW-VERSION 🛫 Publish artifacts [aliases: pp, publish]
craft validate Validate Craft configuration and workflows
craft targets List defined targets as JSON array
craft config Print the parsed, processed, and validated Craft
config for the current project in pretty-JSON.
Expand All @@ -182,17 +225,74 @@ Options:

## Workflow

### `craft init`: Initialize a New Project

Auto-detect your project type and generate configuration:

```shell
craft init

Initialize Craft configuration for a new project

Options:
--skip-workflows Skip generating GitHub Actions workflow files
--force Overwrite existing files
-h, --help Show help
```

The `init` command detects:

- **Package managers**: npm, pnpm, yarn, pip, cargo, etc.
- **Project files**: package.json, pyproject.toml, Cargo.toml, Dockerfile, etc.
- **GitHub info**: owner and repo from git remote

Generated files:

- `.craft.yml` - Main configuration
- `.github/workflows/release.yml` - Release preparation workflow
- `.github/workflows/changelog-preview.yml` - PR changelog preview

:::note
Publishing is typically handled via a separate repository that stores secrets securely. See [Publishing Configuration](/configuration#publishing) for details.
:::

### `craft validate`: Validate Configuration

Check your configuration for errors and best practices:

```shell
craft validate

Options:
--skip-workflows Skip validating GitHub Actions workflow files
-h, --help Show help
```

Validates:

- YAML syntax and schema
- Target names exist
- No duplicate target IDs
- Regex patterns are valid
- Workflow files use recommended patterns

### `craft prepare`: Preparing a New Release

This command creates a new release branch, checks the changelog entries, runs a version-bumping script, and pushes this branch to GitHub. CI triggered by pushing this branch will build release artifacts and upload them to your artifact provider.

**Version Specification**

The `NEW-VERSION` argument can be specified in three ways (or omitted to use `auto`):
The `NEW-VERSION` argument can be specified in several ways (or omitted to use `auto`):

1. **Omitted**: Uses `auto` by default (or `versioning.policy` from `.craft.yml` if configured)
2. **Explicit version** (e.g., `1.2.3`): Release with the specified version
3. **Bump type** (`major`, `minor`, or `patch`): Automatically increment the latest tag
4. **Auto** (`auto`): Analyze commits since the last tag and determine bump type from conventional commit patterns
5. **CalVer** (`calver`): Use calendar-based versioning

1. **Explicit version** (e.g., `1.2.3`): Release with the specified version
2. **Bump type** (`major`, `minor`, or `patch`): Automatically increment the latest tag
3. **Auto** (`auto` or omit the argument): Analyze commits since the last tag and determine bump type from conventional commit patterns
**First Release**

When no git tags exist (first release), Craft defaults to a `minor` bump from `0.0.0` (resulting in `0.1.0`) when using auto-versioning. This ensures a sensible starting point for new projects.

```shell
craft prepare [NEW-VERSION]
Expand All @@ -201,9 +301,10 @@ craft prepare [NEW-VERSION]

Positionals:
NEW-VERSION The new version to release. Can be: a semver string (e.g.,
"1.2.3"), a bump type ("major", "minor", or "patch"), or "auto"
to determine automatically from conventional commits. When
omitted, defaults to "auto". [string]
"1.2.3"), a bump type ("major", "minor", or "patch"), "auto"
to determine automatically from conventional commits, or "calver"
for calendar versioning. When omitted, defaults to "auto".
[string]

Options:
--no-input Suppresses all user prompts [default: false]
Expand All @@ -214,6 +315,8 @@ Options:
--no-changelog Do not check for changelog entries [boolean] [default: false]
--publish Run "publish" right after "release"[boolean] [default: false]
--remote The git remote to use when pushing [string] [default: "origin"]
--config-from Load .craft.yml from specified remote branch
--calver-offset Days to go back for CalVer date calculation
-v, --version Show version number [boolean]
-h, --help Show help [boolean]
```
Expand Down Expand Up @@ -313,6 +416,7 @@ preview|pre|rc|dev|alpha|beta|unstable|a|b
```

Examples:

- `1.0.0-preview`
- `1.0.0-alpha.0`
- `1.0.0-beta.1`
Expand Down Expand Up @@ -361,10 +465,12 @@ diff --git a/CHANGELOG.md b/CHANGELOG.md
```

**What's blocked:**

- Git push (nothing leaves your machine)
- GitHub API mutations (no releases, uploads, or changes)

**What's allowed:**

- All local operations (in a temporary worktree)
- Reading from GitHub API (requires `GITHUB_TOKEN`)

Expand All @@ -386,6 +492,20 @@ Credentials and other configuration (`GITHUB_TOKEN`, `NPM_TOKEN`, etc.) must be

## Integrating Your Project

### Quick Setup (Recommended)

Use `craft init` to automatically generate configuration:

```shell
cd your-project
craft init
craft validate
```

Then set up required secrets in your GitHub repository and run your first release.

### Manual Setup

1. **Set up a workflow** that builds assets and runs tests. Allow building release branches:

```yaml
Expand Down Expand Up @@ -424,3 +544,34 @@ patched executable against the target release digest before checking its version
and installing it. Missing, oversized, corrupt, or incompatible patches fall back
to the normal HTTPS download. The first native release and explicit
prerelease installs use full downloads.

## First Release

For new projects with no existing releases, Craft provides a streamlined experience:

1. **Initialize**: Run `craft init` to generate configuration
2. **Validate**: Run `craft validate` to check your setup
3. **Release**: Run `craft prepare` (version defaults to `0.1.0`)

Example first release workflow:

```shell
# Initialize (one-time setup)
craft init
craft validate

# Set up secrets in GitHub (GH_RELEASE_PAT, NPM_TOKEN, etc.)

# Create your first release
craft prepare # Defaults to 0.1.0 for first release
# Or explicitly: craft prepare 0.1.0

# After CI completes, publish
craft publish 0.1.0
```

With smart defaults enabled (`minVersion: "2.21.0"`), Craft will:

- Auto-detect version bumps from commits
- Automatically generate changelogs
- Create `CHANGELOG.md` if it doesn't exist
22 changes: 15 additions & 7 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,36 @@ import { Card, CardGrid } from '@astrojs/starlight/components';
## Features

<CardGrid stagger>
<Card title="Automated Releases" icon="rocket">
Prepare and publish releases with a single command. Craft handles version bumping, changelog management, and artifact publishing.
<Card title="Quick Setup" icon="rocket">
Run `craft init` to auto-detect your project and generate configuration.
Works with npm, PyPI, Cargo, Docker, and more.
</Card>
<Card title="Auto Versioning" icon="star">
Automatically determine version bumps from conventional commits. Just run `craft prepare auto` and let Craft figure out the rest.
Automatically determine version bumps from conventional commits. Just run
`craft prepare` and let Craft figure out the rest.
</Card>
<Card title="Multiple Targets" icon="list-format">
Publish to GitHub, NPM, PyPI, Docker, NuGet, Crates.io, and many more registries from a single configuration.
Publish to GitHub, NPM, PyPI, Docker, NuGet, Crates.io, and many more
registries from a single configuration.
</Card>
<Card title="Changelog Management" icon="document">
Automatic changelog generation using conventional commits or manual changelog policies.
Automatic changelog generation using conventional commits or manual
changelog policies.
</Card>
<Card title="CI/CD Integration" icon="setting">
Works seamlessly with GitHub Actions and other CI systems. Fetch artifacts and publish them to your targets.
Works seamlessly with GitHub Actions and other CI systems. Fetch artifacts
and publish them to your targets.
</Card>
</CardGrid>

## Quick Example

```bash
# Initialize a new project (one-time setup)
craft init

# Auto-determine version from conventional commits
craft prepare auto
craft prepare

# Or specify a bump type
craft prepare minor
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,10 @@ describe('workspaces', () => {
process.chdir(directory);

setActiveWorkspace('packages/cli');
expect(getChangelogConfig().filePath).toBe('packages/cli/CHANGELOG.md');
expect(getChangelogConfig()).toMatchObject({
filePath: 'packages/cli/CHANGELOG.md',
policy: 'auto',
});
});

test('preserves an explicitly configured root changelog for a workspace', () => {
Expand Down
Loading
Loading