@cmflow/cli

中文文档
3.21.0发布于 2026/11/05MITTypeScriptESM + CJS近 30 天下载 1.1万

An awesome Git Flow

原始使用文档
文档目录9 节
  1. Installation
  2. Git Flow commands
  3. Jira releases
  4. Monorepo package artifacts
  5. flow configuration
  6. Semantic Release
  7. Atlas
  8. Development
  9. License
Club Med

@cmflow/cli


npm version semantic-release code style: oxfmt

Club Med Flow command-line tooling for Git Flow, Semantic Release and publishing Yarn workspace packages.

Installation

Install globally for the Git Flow commands:

npm install --global @cmflow/cli
cm --help

Install it as a development dependency when a project uses its release plugins or package-artifact commands:

npm install --save-dev @cmflow/cli

Git Flow commands

cm provides commands for starting, finishing, pushing, pulling, merging, rebasing and deploying branches, plus release and Jira helpers.

cm --help
cm start --help
cm finish --help
cm deploy --help

Jira releases

jira-releases lists release versions for a Jira project and component, generates delivery notes, and can mark versions as released.

cm jira-releases --project-id <PROJECT_KEY> --component <COMPONENT> --tag <VERSION> [--update] [--verbose]

It requires JIRA_API, JIRA_EMAIL and JIRA_TOKEN. Directus workflow support is optional and uses DIRECTUS_URL, DIRECTUS_FLOW_ID and DIRECTUS_ACCESS_TOKEN. Run without --update first to review the selected versions.

Monorepo package artifacts

cm packages build creates the npm-ready artifacts of a Yarn-workspace monorepo. It performs the following steps:

  1. Cleans the configured output directory.
  2. Runs the configured build script.
  3. Copies non-private workspace packages into dist/<package-name>.
  4. Writes package manifests with the release version and rewritten internal dependencies.
cm packages build
cm packages build --version 3.4.0-alpha.3

The default output is dist. Private workspaces are never included in the artifacts or published. If --version is omitted, the current root package.json version is retained.

cm packages build is invoked by the Semantic Release prepare step for the cmflow bump method. Do not add it to the release command: Semantic Release owns the artifact lifecycle.

Use a dedicated script only to verify artifact generation locally or in a pre-release CI check:

{
  "scripts": {
    "artifacts:prepare": "yarn build && cm packages build"
  }
}

flow configuration

Configure package build and publication defaults in the root package.json:

{
  "workspaces": ["packages/*"],
  "publishConfig": {
    "registry": "https://registry.npmjs.org/"
  },
  "flow": {
    "outputDir": "dist",
    "buildCmd": "build",
    "npmAccess": "public",
    "npmDistTag": "next",
    "npmFallbackDistTag": "latest",
    "registries": [],
    "skipNpmPublish": false,
    "trustedPublishing": true
  }
}
OptionDefaultPurpose
outputDirdistDestination directory for generated package artifacts.
buildCmdbuildRoot package script run by cm packages build.
npmAccesspublicnpm access passed to npm publish.
npmDistTagpublishConfig.tagDist-tag written in generated package manifests.
npmFallbackDistTaglatestTag used when npm rejects an implicit latest tag.
registries[]Additional registries to publish to.
skipNpmPublishfalseBuilds release artifacts but skips npm publication.
trustedPublishingfalseEnables npm trusted publishing; no npmjs token is written to .npmrc.

A workspace package may set its own flow.registries array to replace the root registries for that package.

Semantic Release

Use cmrelease to run Semantic Release:

{
  "scripts": {
    "release": "cmrelease",
    "release:dry_run": "cmrelease --dry-run"
  }
}

For a workspace release, the publish sequence must push the release branch and tag before npm publication:

import { defineConfig } from "@cmflow/cli";

export default defineConfig({
  prepare: ["@cmflow/cli/semantic/core/prepare/bump-version", "@cmflow/cli/semantic/core/prepare/commit"],
  publish: [
    "@cmflow/cli/semantic/core/push-release",
    "@cmflow/cli/semantic/core/publish-packages",
    "@cmflow/cli/semantic/core/sync-repository"
  ],
  npmPublish: false
});

push-release pushes the branch and release tag first. publish-packages publishes only non-private generated artifacts. It supports npmjs, GitHub Packages and additional registries; trustedPublishing uses npm’s OIDC-based trusted publishing flow. During a dry run, packages are packed but never published.

For CircleCI, export the OIDC token in each job that runs a real release:

- run:
    name: Cm Release
    command: |
      export NPM_ID_TOKEN=$(circleci run oidc get --claims '{"aud":"npm:registry.npmjs.org"}')
      yarn release

Each npm package must also be configured with a CircleCI trusted publisher and allow the npm publish action. The Organization ID, Project ID, Pipeline definition ID and VCS origin configured on npm must match the CircleCI project exactly. npm’s CircleCI trusted publishing guide details the required values.

Atlas

API-to-backend catalogue tooling is published separately as @cmflow/atlas. Its project configuration is atlas.config.ts; it does not belong in this repository or in this CLI package.

Development

From the monorepo root:

yarn workspace @cmflow/cli build
yarn workspace @cmflow/cli test
yarn check

License

The MIT License (MIT) Copyright (c) 2016 - Today ClubMed

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

版本与发布记录

@cmflow/cli 共发布 172 个版本,首次发布于 2022/03/23;过去 12 个月发布了 80 个版本。

版本发布日期距今
3.21.0latest2026/11/054 天前
3.20.02026/11/037 天前
3.19.02026/11/027 天前
3.18.02026/10/3110 天前
3.17.22026/10/2911 天前
3.17.12026/10/2713 天前

其他发布通道:rc → 2.0.0-rc.3,alpha → 3.4.0-alpha.5,beta → 3.4.0-beta.36。

关于 @cmflow/cli 的常见问题

@cmflow/cli 是什么?

An awesome Git Flow

如何安装 @cmflow/cli?

在项目目录运行 npm install @cmflow/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cm、cmrelease,可以用 npx cm 直接运行。

@cmflow/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cmflow/cli 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cmflow/cli 可以商用吗?

@cmflow/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cmflow/cli 的下载量有多少?

根据 npm 官方下载统计,@cmflow/cli 在 2026/10/10 – 2026/11/08 这 30 天内被下载 10,798 次,日均约 360 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cmflow/cli 还在维护吗?

最新版本 3.21.0 发布于 2026/11/05(4 天前);至今共发布 172 个版本,其中过去 12 个月发布了 80 个;首次发布于 2022/03/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。