@soybeanjs/cli 1.8.4 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en-US.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @soybeanjs/cli
2
2
 
3
3
  <p align="center">
4
- <img src="https://r2.soybeanjs.tech/soybeanjs/logo-soybeanjs.svg" alt="SoybeanJS" width="96" />
4
+ <img src="https://img.soybeanjs.dev/logo-soybeanjs.svg" alt="SoybeanJS" width="96" />
5
5
  </p>
6
6
 
7
7
  [简体中文](./README.md) | English
@@ -63,7 +63,14 @@ pnpm soy changelog --total
63
63
  pnpm soy release
64
64
  ```
65
65
 
66
- The release flow interactively bumps the version, runs `pnpm soy changelog`, creates a `chore(projects): release v<version>` commit and Git tag, then pushes them to the remote. Ensure the working tree is clean and all release changes have already been committed.
66
+ For AI agents and non-interactive runs, pass a version or release type to skip the version prompt and confirmation:
67
+
68
+ ```bash
69
+ pnpm soy release --release 1.2.3
70
+ pnpm soy release --release patch
71
+ ```
72
+
73
+ The release flow bumps the version, runs `pnpm soy changelog`, creates a `chore(projects): release v<version>` commit and Git tag, then pushes them to the remote. Ensure the working tree is clean and all release changes have already been committed.
67
74
 
68
75
  > [!WARNING]
69
76
  > The current `release` command pushes the commit and tag by default. Confirm the branch, remote, and release contents before running it.
@@ -91,7 +98,7 @@ pnpm soy cleanup --cleanupDir "**/dist,**/coverage"
91
98
  | `git-commit` | Interactively creates a Conventional Commit. |
92
99
  | `git-commit-verify` | Validates `.git/COMMIT_EDITMSG`; suitable for a `commit-msg` hook. |
93
100
  | `changelog` | Generates `CHANGELOG.md` from Git tags and commit history. |
94
- | `release` | Interactively bumps the version, generates the changelog, creates a commit and tag, then pushes. |
101
+ | `release` | Bumps the version, generates the changelog, creates a commit and tag, then pushes; supports `--release` to skip prompts. |
95
102
  | `config <set\|get\|path>` | Sets, reads, or locates global configuration. |
96
103
  | `update-pkg` | Deprecated. Use `ncu` instead. |
97
104
 
@@ -100,6 +107,7 @@ pnpm soy cleanup --cleanupDir "**/dist,**/coverage"
100
107
  | Option | Applies to | Description |
101
108
  | ------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------ |
102
109
  | `-e, --execute [command]` | `release` | Runs a command after the version bump and before the release commit. Defaults to `pnpm soy changelog`. |
110
+ | `--release <release>` | `release` | Sets the version or release type and skips the version and confirmation prompts. |
103
111
  | `-t, --total` | `changelog` | Generates the changelog from all Git tags. |
104
112
  | `-c, --cleanupDir <dir>` | `cleanup` | Overrides cleanup globs for this run. Separate multiple values with commas. |
105
113
  | `-l, --lang <lang>` | `git-commit`, `git-commit-verify` | Sets output language for this invocation to `zh-cn` or `en-us`. |
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @soybeanjs/cli
2
2
 
3
3
  <p align="center">
4
- <img src="https://r2.soybeanjs.tech/soybeanjs/logo-soybeanjs.svg" alt="SoybeanJS" width="96" />
4
+ <img src="https://img.soybeanjs.dev/logo-soybeanjs.svg" alt="SoybeanJS" width="96" />
5
5
  </p>
6
6
 
7
7
  简体中文 | [English](./README.en-US.md)
@@ -63,7 +63,14 @@ pnpm soy changelog --total
63
63
  pnpm soy release
64
64
  ```
65
65
 
66
- 发布流程会交互式更新版本号、执行 `pnpm soy changelog`、创建 `chore(projects): release v<version>` 提交和 Git tag,并推送到远端。执行前确保工作区干净且待发布的改动均已提交。
66
+ AI agent 或非交互环境可传入版本号或 release type,跳过版本输入和确认提示:
67
+
68
+ ```bash
69
+ pnpm soy release --release 1.2.3
70
+ pnpm soy release --release patch
71
+ ```
72
+
73
+ 发布流程会更新版本号、执行 `pnpm soy changelog`、创建 `chore(projects): release v<version>` 提交和 Git tag,并推送到远端。执行前确保工作区干净且待发布的改动均已提交。
67
74
 
68
75
  > [!WARNING]
69
76
  > 当前 `release` 命令默认推送提交和 tag。请在执行前确认分支、远端和发布内容均正确。
@@ -91,7 +98,7 @@ pnpm soy cleanup --cleanupDir "**/dist,**/coverage"
91
98
  | `git-commit` | 交互式创建符合 Conventional Commits 的 Git 提交。 |
92
99
  | `git-commit-verify` | 校验 `.git/COMMIT_EDITMSG`,适合配置在 `commit-msg` hook 中。 |
93
100
  | `changelog` | 从 Git tag 和提交历史生成 `CHANGELOG.md`。 |
94
- | `release` | 交互式更新版本、生成 Changelog、创建提交和 tag,并推送到远端。 |
101
+ | `release` | 更新版本、生成 Changelog、创建提交和 tag,并推送到远端;支持 `--release` 跳过交互。 |
95
102
  | `config <set\|get\|path>` | 设置、查看或定位全局配置。 |
96
103
  | `update-pkg` | 已废弃,请使用 `ncu`。 |
97
104
 
@@ -100,6 +107,7 @@ pnpm soy cleanup --cleanupDir "**/dist,**/coverage"
100
107
  | 选项 | 适用命令 | 说明 |
101
108
  | ------------------------- | --------------------------------- | ------------------------------------------------------------------- |
102
109
  | `-e, --execute [command]` | `release` | 指定版本更新后、创建提交前执行的命令;默认是 `pnpm soy changelog`。 |
110
+ | `--release <release>` | `release` | 指定版本号或 release type,跳过版本输入和确认提示。 |
103
111
  | `-t, --total` | `changelog` | 使用全部 Git tag 生成 Changelog。 |
104
112
  | `-c, --cleanupDir <dir>` | `cleanup` | 覆盖本次执行的清理 glob;多个值用逗号分隔。 |
105
113
  | `-l, --lang <lang>` | `git-commit`、`git-commit-verify` | 将本次 CLI 输出设为 `zh-cn` 或 `en-us`。 |
package/dist/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import { ChangelogOption } from "@soybeanjs/changelog";
2
- //#region src/locales/index.d.ts
3
2
  type Lang = 'zh-cn' | 'en-us';
4
- //#endregion
5
- //#region src/types/index.d.ts
6
3
  type CommitItem = [string, string];
7
4
  interface GitCommitConfig {
8
5
  /**
@@ -93,8 +90,5 @@ interface CliOption {
93
90
  */
94
91
  lang?: Lang;
95
92
  }
96
- //#endregion
97
- //#region src/index.d.ts
98
93
  export declare function defineConfig(config?: Partial<CliOption>): Partial<CliOption> | undefined;
99
- //#endregion
100
94
  export type { CliOption };
package/dist/index.js CHANGED
@@ -12,10 +12,9 @@ import { join as join$1 } from "path";
12
12
  import { generateChangelog, generateTotalChangelog } from "@soybeanjs/changelog";
13
13
  import { versionBump } from "bumpp";
14
14
  import { consola } from "consola";
15
- //#region package.json
16
- var version = "1.8.4";
17
- //#endregion
18
- //#region src/locales/index.ts
15
+ // package.json
16
+ var version = "1.8.5";
17
+ // src/locales/index.ts
19
18
  const locales = {
20
19
  "zh-cn": {
21
20
  gitCommitMessages: {
@@ -86,8 +85,7 @@ const locales = {
86
85
  gitCommitVerify: `${bgRed(" ERROR ")} ${red("git commit message must match the Conventional Commits standard!")}\n\n${green("Recommended to use the command `pnpm commit` to generate Conventional Commits compliant commit information.\nGet more info about Conventional Commits, follow this link: https://conventionalcommits.org")}`
87
86
  }
88
87
  };
89
- //#endregion
90
- //#region src/config/index.ts
88
+ // src/config/index.ts
91
89
  const defaultGitCommitVerifyIgnores = [
92
90
  /^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m,
93
91
  /^(Merge tag (.*?))(?:\r?\n)*$/m,
@@ -183,14 +181,12 @@ async function loadCliOptions(overrides, cwd = process$1.cwd()) {
183
181
  function getGlobalConfigPath() {
184
182
  return `${process$1.env.HOME || process$1.env.USERPROFILE || "."}/.soybeanrc`;
185
183
  }
186
- //#endregion
187
- //#region src/shared/index.ts
184
+ // src/shared/index.ts
188
185
  async function execCommand(cmd, args, options) {
189
186
  const { execa } = await import("execa");
190
187
  return ((await execa(cmd, args, options))?.stdout)?.trim() || "";
191
188
  }
192
- //#endregion
193
- //#region src/command/git-commit.ts
189
+ // src/command/git-commit.ts
194
190
  /**
195
191
  * Git commit with Conventional Commits standard
196
192
  *
@@ -249,13 +245,11 @@ async function gitCommitVerify(lang = "en-us", ignores = []) {
249
245
  throw new Error(errorMsg);
250
246
  }
251
247
  }
252
- //#endregion
253
- //#region src/command/cleanup.ts
248
+ // src/command/cleanup.ts
254
249
  async function cleanup(paths) {
255
250
  await rimraf(paths, { glob: true });
256
251
  }
257
- //#endregion
258
- //#region src/command/ncu.ts
252
+ // src/command/ncu.ts
259
253
  async function ncu(args) {
260
254
  await execCommand("pnpm", ["npm-check-updates", ...args && args.length > 0 ? args : hasWorkspaces() ? ["-u", "-w"] : ["-u"]], { stdio: "inherit" });
261
255
  }
@@ -282,8 +276,7 @@ function hasWorkspaces(cwd = process$1.cwd()) {
282
276
  } catch {}
283
277
  return false;
284
278
  }
285
- //#endregion
286
- //#region src/command/changelog.ts
279
+ // src/command/changelog.ts
287
280
  async function genChangelog(options, total = false) {
288
281
  const changelogPath = join$1(process.cwd(), "CHANGELOG.md");
289
282
  const hasChangelog = existsSync$1(changelogPath);
@@ -291,20 +284,20 @@ async function genChangelog(options, total = false) {
291
284
  else await generateChangelog(options);
292
285
  if (!hasChangelog) await execCommand("git", ["add", "CHANGELOG.md"]);
293
286
  }
294
- //#endregion
295
- //#region src/command/release.ts
296
- async function release(execute = "pnpm soy changelog", push = true) {
297
- await versionBump({
287
+ // src/command/release.ts
288
+ async function release(execute = "pnpm soy changelog", push = true, releaseVersion) {
289
+ return versionBump({
298
290
  files: ["**/package.json", "!**/node_modules"],
299
291
  execute,
300
292
  all: true,
301
293
  tag: true,
302
294
  commit: "chore(projects): release v%s",
303
- push
295
+ push,
296
+ release: releaseVersion,
297
+ confirm: releaseVersion === void 0 ? void 0 : false
304
298
  });
305
299
  }
306
- //#endregion
307
- //#region src/command/config.ts
300
+ // src/command/config.ts
308
301
  function readGlobalConfig() {
309
302
  const filePath = getGlobalConfigPath();
310
303
  if (!existsSync(filePath)) return {};
@@ -343,12 +336,11 @@ async function configGet() {
343
336
  async function configPath() {
344
337
  consola.log(getGlobalConfigPath());
345
338
  }
346
- //#endregion
347
- //#region src/index.ts
339
+ // src/index.ts
348
340
  async function setupCli() {
349
341
  const cliOptions = await loadCliOptions();
350
342
  const cli = cac("soybean");
351
- cli.version(version).option("-e, --execute [command]", "Execute additional command after bumping and before git commit. Defaults to 'pnpm soy changelog'").option("-p, --push", "Indicates whether to push the git commit and tag").option("-t, --total", "Generate changelog by total tags").option("-c, --cleanupDir <dir>", "The glob pattern of dirs to cleanup, If not set, it will use the default value, Multiple values use \",\" to separate them").option("-l, --lang <lang>", `display lang of cli (default: ${cliOptions.lang})`, {
343
+ cli.version(version).option("-e, --execute [command]", "Execute additional command after bumping and before git commit. Defaults to 'pnpm soy changelog'").option("--release <release>", "Release version or type (e.g. 1.2.3, patch). Skips interactive prompts").option("-p, --push", "Indicates whether to push the git commit and tag").option("-t, --total", "Generate changelog by total tags").option("-c, --cleanupDir <dir>", "The glob pattern of dirs to cleanup, If not set, it will use the default value, Multiple values use \",\" to separate them").option("-l, --lang <lang>", `display lang of cli (default: ${cliOptions.lang})`, {
352
344
  default: cliOptions.lang,
353
345
  type: [String]
354
346
  }).help();
@@ -398,7 +390,7 @@ async function setupCli() {
398
390
  release: {
399
391
  desc: "release: update version, generate changelog, commit code",
400
392
  action: async (args) => {
401
- await release(args?.execute, args?.push);
393
+ await release(args?.execute, args?.push, args?.release);
402
394
  }
403
395
  }
404
396
  };
@@ -426,5 +418,4 @@ setupCli();
426
418
  function defineConfig(config) {
427
419
  return config;
428
420
  }
429
- //#endregion
430
421
  export { defineConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/cli",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "SoybeanJS's command line tools",
5
5
  "homepage": "https://github.com/soybeanjs/cli",
6
6
  "bugs": {
@@ -37,22 +37,22 @@
37
37
  "registry": "https://registry.npmjs.org/"
38
38
  },
39
39
  "dependencies": {
40
- "@soybeanjs/changelog": "^0.5.3",
40
+ "@soybeanjs/changelog": "^0.5.4",
41
41
  "bumpp": "^12.3.0",
42
42
  "c12": "^3.3.4",
43
- "cac": "^7.0.0",
43
+ "cac": "^7.1.1",
44
44
  "consola": "^3.4.2",
45
45
  "enquirer": "^2.4.1",
46
- "execa": "^10.0.1",
46
+ "execa": "^10.2.1",
47
47
  "kolorist": "^1.8.0",
48
- "npm-check-updates": "^23.1.0",
49
- "rimraf": "^6.1.3",
48
+ "npm-check-updates": "^23.1.1",
49
+ "rimraf": "^6.1.4",
50
50
  "tinyglobby": "^0.2.17"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@soybeanjs/cli": "link:",
54
- "@soybeanjs/oxc-config": "^0.2.6",
55
- "@types/node": "^26.6.4",
54
+ "@soybeanjs/oxc-config": "^0.2.7",
55
+ "@types/node": "^26.6.11",
56
56
  "tsx": "^4.23.15",
57
57
  "typescript": "^7.0.2",
58
58
  "vite-plus": "latest"