clawt 2.3.5 → 2.3.6

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/dist/index.js CHANGED
@@ -28,6 +28,8 @@ var MESSAGES = {
28
28
  CLAUDE_NOT_INSTALLED: "Claude Code CLI \u672A\u5B89\u88C5\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm install -g @anthropic-ai/claude-code",
29
29
  /** 分支已存在 */
30
30
  BRANCH_EXISTS: (name) => `\u5206\u652F ${name} \u5DF2\u5B58\u5728\uFF0C\u65E0\u6CD5\u521B\u5EFA`,
31
+ /** 分支名清理后为空 */
32
+ BRANCH_NAME_EMPTY: (original) => `\u5206\u652F\u540D "${original}" \u4E2D\u4E0D\u5305\u542B\u5408\u6CD5\u5B57\u7B26\uFF0C\u65E0\u6CD5\u521B\u5EFA\u5206\u652F`,
31
33
  /** 分支名被转换 */
32
34
  BRANCH_SANITIZED: (original, sanitized) => `\u5206\u652F\u540D\u5DF2\u8F6C\u6362: ${original} \u2192 ${sanitized}`,
33
35
  /** worktree 创建成功 */
@@ -438,6 +440,9 @@ function formatWorktreeStatus(status) {
438
440
  // src/utils/branch.ts
439
441
  function sanitizeBranchName(branchName) {
440
442
  const sanitized = branchName.replace(INVALID_BRANCH_CHARS, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "");
443
+ if (!sanitized) {
444
+ throw new ClawtError(MESSAGES.BRANCH_NAME_EMPTY(branchName));
445
+ }
441
446
  if (sanitized !== branchName) {
442
447
  logger.warn(MESSAGES.BRANCH_SANITIZED(branchName, sanitized));
443
448
  printWarning(MESSAGES.BRANCH_SANITIZED(branchName, sanitized));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawt",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "本地并行执行多个Claude Code Agent任务,融合 Git Worktree 与 Claude Code CLI 的命令行工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,6 +8,9 @@ export const MESSAGES = {
8
8
  CLAUDE_NOT_INSTALLED: 'Claude Code CLI 未安装,请先安装:npm install -g @anthropic-ai/claude-code',
9
9
  /** 分支已存在 */
10
10
  BRANCH_EXISTS: (name: string) => `分支 ${name} 已存在,无法创建`,
11
+ /** 分支名清理后为空 */
12
+ BRANCH_NAME_EMPTY: (original: string) =>
13
+ `分支名 "${original}" 中不包含合法字符,无法创建分支`,
11
14
  /** 分支名被转换 */
12
15
  BRANCH_SANITIZED: (original: string, sanitized: string) =>
13
16
  `分支名已转换: ${original} → ${sanitized}`,
@@ -15,6 +15,10 @@ export function sanitizeBranchName(branchName: string): string {
15
15
  .replace(/-{2,}/g, '-')
16
16
  .replace(/^-|-$/g, '');
17
17
 
18
+ if (!sanitized) {
19
+ throw new ClawtError(MESSAGES.BRANCH_NAME_EMPTY(branchName));
20
+ }
21
+
18
22
  if (sanitized !== branchName) {
19
23
  logger.warn(MESSAGES.BRANCH_SANITIZED(branchName, sanitized));
20
24
  printWarning(MESSAGES.BRANCH_SANITIZED(branchName, sanitized));