init
Set up Relizy in a few questions - the config, the commit-msg hook, the release script, the AI agents and the release workflow of GitHub Actions or GitLab CI. Everything else is detected.
Usage
npx relizy init [options]What It Does
init reads your repository, asks only what it cannot guess, shows the changes it will make, and applies them once confirmed.
Detected for you
- Packages: the package globs of your workspace (
pnpm-workspace.yaml, theworkspacesof thepackage.jsonfor npm, yarn and bun,lerna.json,rush.json,deno.json), and thepackage.jsonof each folder they match: name, version andprivateflag. Without a workspace config, the project is a single package. - Apps without version: added to
monorepo.ignored, Relizy only releases versioned packages. - Package manager: the
packageManagerfield, then the lockfile. - Git provider: GitHub, GitLab or other, from the
originremote. For the others, the provider releases and the PR comments are turned off, and no workflow is offered. - Build command: a
buildscript becomespublish.buildCmd. - Publish settings:
publishConfig.accessandpublishConfig.registryof the packages, the defaults of the advanced options. - Existing config: a
relizy.config.*file or arelizykey in thepackage.json.
Asked to you
Every question has a default deduced from the repository. When a config already exists, init first offers to keep it and set up the rest (the default), to replace it, or to cancel: a kept config skips the questions 1 to 4, and the workflow takes its secrets from it.
- What a release does: publish to npm, or only version the project (bump, changelog, tag, provider release). Private packages are suggested for versioning only.
- Folders to release (monorepo with several workspace globs): the globs with publishable packages are checked.
- Version mode (monorepo):
independentwhen the packages are already on different versions,selectiveotherwise. See version modes. - Advanced options (optional): dependency bumps,
0.xbreaking changes, root changelog, listed commit types, changelog format command, npm access, registry, build command, Twitter and Slack posts, PR comment mode and AI rewrites. - Commit linting: install the
commit-msghook runningrelizy commitlint(in.husky/when husky is set up). Written in.git/hooks, which is not versioned, it is also added to thepreparescript (relizy commitlint --install), so every clone gets it at install. - AI agents (only when the project already uses one:
CLAUDE.md,AGENTS.md,.cursor/...): give them the relizy rules and the relizy MCP server, asrelizy mcp initdoes. A second question then offers apreparescript (relizy mcp update, appended to an existing one) in the rootpackage.json, so the rules are kept up to date at each install (a rule you deleted is not recreated). - Release script: add
"release": "relizy release"to thepackage.json, when it has noreleasescript. - Release workflow (GitHub or GitLab): generate the workflow releasing from the CI, run on demand or at each push on the default branch. See Release workflow.
Then init shows the config and the list of changes (files created or replaced, package.json updates, hook, workflow, AI agents), and asks for a single confirmation.
When the root package.json has no name or version, they are part of these changes: Relizy reads both. In unified and selective modes, the version is the highest version of the packages, the shared version bumped at each release. In independent mode, it is 0.0.0 and never bumped.
The config only contains the values that differ from the defaults:
import { defineConfig } from 'relizy'
// All the options: https://relizy.dev/config/overview
export default defineConfig({
monorepo: {
versionMode: 'selective',
packages: ['packages/*'],
ignored: ['packages/docs'],
},
publish: {
buildCmd: 'pnpm run build',
},
})At the end, init prints the next steps: install Relizy when it is not a dependency yet, preview the release, the include: to add on GitLab, and the secrets (GitHub) or CI/CD variables (GitLab) to create.
Release workflow
On GitHub, init writes .github/workflows/release.yml:
- run on demand from the Actions tab with a release type (
autofollows the commits, orpatch,minor,major), or at each push on the default branch; - one release at a time (
concurrency: release), and the permissions it needs:contents: writefor the release commit, the tags and the GitHub release,pull-requests: writeandissues: writefor the PR comment; - the relizy action
relizy/action@v2, which sets up your package manager and Node version (.nvmrcor.node-version), installs from the lockfile and runsrelizy release --yes, with only the secrets your config needs; or, when you choose the relizy CLI, these steps written out in the workflow; - a step reading the outputs of the release.
On GitLab, init writes the release job in .gitlab-ci.yml, or in .gitlab/ci/relizy.yml when the project already has one (your file is not changed, init prints the include: to add):
- on gitlab.com, the relizy component
gitlab.com/relizy/relizy/release@2of the CI/CD catalog, or the same job written out when you choose the relizy CLI; on a self-managed instance, always the job written out; - a manual job on the default branch with a
RELEASE_TYPEvariable, or a job at each push, never run on the release commit it pushes; - corepack (pnpm, Yarn) or Bun, the install of the dependencies, the
claudeCLI for the AI rewrites,relizy release --yes --report-dotenv relizy.env; - the outputs of the release as a
dotenvartifact (RELIZY_RELEASED,RELIZY_VERSION,RELIZY_TAGS...), for the next jobs.
init also offers the merge preview of the pull requests, on its own (yes by default, and with --yes), even when the release workflow is not generated or already exists: .github/workflows/merge-preview.yml on GitHub, which runs the action with merge-preview: true (relizy merge-preview) on the pull requests into the default branch; on GitLab, the merge-preview component (or its job written out) in the file of the release job when init generates it, else in .gitlab/ci/relizy-merge-preview.yml (or .gitlab-ci.yml when the project has none), with the include: to add. It comments what the merge releases and sets the commit status relizy/merge-preview.
init asks how the CI runs relizy (on GitHub and gitlab.com): with the relizy action or component (the default, and with --yes), or with the relizy CLI, whose steps are written out in the workflow. The choice applies to the release and to the merge preview.
The generated files are explained in GitHub Actions and GitLab CI. An existing workflow file is only replaced once confirmed.
init does not ask again what is already set up, and lists it as kept in the changes: a commit-msg hook running relizy commitlint (husky, lefthook, simple-git-hooks, the hooks of git), the AI agents set up for relizy, a CI file already running relizy release or relizy merge-preview (the action, the component or the CLI). A workflow written by init and edited since, or by an older relizy, is replaced once confirmed; another commit-msg hook too. When nothing is left to do, init changes nothing.
Options
--yes
Accept the detected values without asking, for scripts and AI agents:
npx relizy init --yesThe advanced options are skipped, the commit-msg hook is installed (an existing hook is kept), the release script is added, the AI agents detected in the project are set up, and the release workflow is written, run on demand (an existing one is kept). An existing config is kept, and the other steps follow it. init also runs without questions when there is no terminal, or in CI.
--force
Replace an existing config file. Without it, init asks whether to keep it, or keeps it when it runs without questions (--yes, no terminal, CI), and sets up the rest:
npx relizy init --yes --forceA config file in another format (relizy.config.js...) is removed, so it does not take precedence over the new relizy.config.ts.
--no-workflow
Do not offer the workflows of the CI, the release and the merge preview:
npx relizy init --yes --no-workflow--only
Only run these steps, comma-separated: config, commitlint (the commit-msg hook), scripts (the release script), agents (the AI agents), workflow (the release workflow) and merge-preview (the merge preview workflow). Without config, the existing config is kept without asking, and init fails when the project has none. To add the merge preview to a project already set up:
npx relizy init --only merge-preview
# The same
npx relizy merge-preview init--dry-run
Print the config and the release workflow without writing anything:
npx relizy init --dry-run--config
Name of the config file, without .config.ts:
npx relizy init --config relizy.standalone
# Writes relizy.standalone.config.tsSee --config.
Next Steps
- Preview your next release:
npx relizy release --dry-run - Fine-tune the config: configuration overview
- Release from your CI: CI/CD