@claudetree/cli 0.3.0 → 0.4.0

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.ja.md CHANGED
@@ -23,7 +23,7 @@ pnpm add -g @claudetree/cli
23
23
  # プロジェクトで初期化
24
24
  ct init
25
25
 
26
- # GitHub課題の作業開始
26
+ # GitHub課題の作業開始(TDDモードがデフォルト)
27
27
  ct start https://github.com/you/repo/issues/42
28
28
 
29
29
  # 進捗監視
@@ -33,6 +33,28 @@ ct status
33
33
  ct web
34
34
  ```
35
35
 
36
+ ## TDDモード(デフォルト)
37
+
38
+ すべてのセッションはデフォルトでTDDモードで実行されます:
39
+
40
+ ```bash
41
+ # TDDモード(2時間タイムアウト、デフォルト)
42
+ ct start 42
43
+
44
+ # カスタムタイムアウトとゲート
45
+ ct start 42 --timeout 60 --gates test,type,lint
46
+
47
+ # TDDモードを無効化
48
+ ct start 42 --no-tdd
49
+ ```
50
+
51
+ **TDDオプション:**
52
+ - `--timeout <分>` - セッションタイムアウト(デフォルト:120)
53
+ - `--idle-timeout <分>` - アイドルタイムアウト(デフォルト:10)
54
+ - `--gates <gates>` - 検証ゲート:test,type,lint,build(デフォルト:test,type)
55
+ - `--max-retries <n>` - ゲートリトライ回数(デフォルト:3)
56
+ - `--no-tdd` - TDDモード無効化
57
+
36
58
  ## コマンド
37
59
 
38
60
  | コマンド | 説明 |
@@ -45,6 +67,7 @@ ct web
45
67
  | `ct demo` | インタラクティブデモ(トークン不使用) |
46
68
  | `ct batch` | 複数の課題を並列処理 |
47
69
  | `ct bustercall` | すべてのopen課題を自動取得して並列セッション実行 |
70
+ | `ct clean` | すべてのworktreeを削除(main以外) |
48
71
  | `ct web` | Webダッシュボード開始 |
49
72
 
50
73
  ## 主な機能
package/README.ko.md CHANGED
@@ -23,7 +23,7 @@ pnpm add -g @claudetree/cli
23
23
  # 프로젝트에서 초기화
24
24
  ct init
25
25
 
26
- # GitHub 이슈 작업 시작
26
+ # GitHub 이슈 작업 시작 (TDD 모드 기본)
27
27
  ct start https://github.com/you/repo/issues/42
28
28
 
29
29
  # 진행상황 모니터링
@@ -33,6 +33,28 @@ ct status
33
33
  ct web
34
34
  ```
35
35
 
36
+ ## TDD 모드 (기본)
37
+
38
+ 모든 세션은 기본적으로 TDD 모드로 실행됩니다:
39
+
40
+ ```bash
41
+ # TDD 모드 (2시간 타임아웃, 기본값)
42
+ ct start 42
43
+
44
+ # 커스텀 타임아웃 및 게이트
45
+ ct start 42 --timeout 60 --gates test,type,lint
46
+
47
+ # TDD 모드 끄기
48
+ ct start 42 --no-tdd
49
+ ```
50
+
51
+ **TDD 옵션:**
52
+ - `--timeout <분>` - 세션 타임아웃 (기본: 120)
53
+ - `--idle-timeout <분>` - 유휴 타임아웃 (기본: 10)
54
+ - `--gates <gates>` - 검증 게이트: test,type,lint,build (기본: test,type)
55
+ - `--max-retries <n>` - 게이트 재시도 횟수 (기본: 3)
56
+ - `--no-tdd` - TDD 모드 비활성화
57
+
36
58
  ## 명령어
37
59
 
38
60
  | 명령어 | 설명 |
@@ -45,6 +67,7 @@ ct web
45
67
  | `ct demo` | 인터랙티브 데모 (토큰 미사용) |
46
68
  | `ct batch` | 여러 이슈를 병렬로 처리 |
47
69
  | `ct bustercall` | 모든 open 이슈를 자동으로 가져와 병렬 세션 실행 |
70
+ | `ct clean` | 모든 worktree 제거 (main 제외) |
48
71
  | `ct web` | 웹 대시보드 시작 |
49
72
 
50
73
  ## 주요 기능
package/README.md CHANGED
@@ -23,7 +23,7 @@ pnpm add -g @claudetree/cli
23
23
  # Initialize in your project
24
24
  ct init
25
25
 
26
- # Start working on a GitHub issue
26
+ # Start working on a GitHub issue (TDD mode by default)
27
27
  ct start https://github.com/you/repo/issues/42
28
28
 
29
29
  # Monitor progress
@@ -33,6 +33,28 @@ ct status
33
33
  ct web
34
34
  ```
35
35
 
36
+ ## TDD Mode (Default)
37
+
38
+ All sessions run in TDD mode by default:
39
+
40
+ ```bash
41
+ # TDD mode with 2h timeout (default)
42
+ ct start 42
43
+
44
+ # Custom timeout and gates
45
+ ct start 42 --timeout 60 --gates test,type,lint
46
+
47
+ # Disable TDD mode
48
+ ct start 42 --no-tdd
49
+ ```
50
+
51
+ **TDD Options:**
52
+ - `--timeout <min>` - Session timeout (default: 120)
53
+ - `--idle-timeout <min>` - Idle timeout (default: 10)
54
+ - `--gates <gates>` - Validation gates: test,type,lint,build (default: test,type)
55
+ - `--max-retries <n>` - Gate retry count (default: 3)
56
+ - `--no-tdd` - Disable TDD mode
57
+
36
58
  ## Commands
37
59
 
38
60
  | Command | Description |
@@ -45,6 +67,7 @@ ct web
45
67
  | `ct demo` | Interactive demo (no tokens used) |
46
68
  | `ct batch` | Process multiple issues in parallel |
47
69
  | `ct bustercall` | Auto-fetch all open issues and run parallel sessions |
70
+ | `ct clean` | Remove all worktrees (except main) |
48
71
  | `ct web` | Start web dashboard |
49
72
 
50
73
  ## Key Features
package/README.zh.md CHANGED
@@ -23,7 +23,7 @@ pnpm add -g @claudetree/cli
23
23
  # 在项目中初始化
24
24
  ct init
25
25
 
26
- # 开始处理GitHub问题
26
+ # 开始处理GitHub问题(默认TDD模式)
27
27
  ct start https://github.com/you/repo/issues/42
28
28
 
29
29
  # 监控进度
@@ -33,6 +33,28 @@ ct status
33
33
  ct web
34
34
  ```
35
35
 
36
+ ## TDD模式(默认)
37
+
38
+ 所有会话默认以TDD模式运行:
39
+
40
+ ```bash
41
+ # TDD模式(2小时超时,默认)
42
+ ct start 42
43
+
44
+ # 自定义超时和验证门
45
+ ct start 42 --timeout 60 --gates test,type,lint
46
+
47
+ # 禁用TDD模式
48
+ ct start 42 --no-tdd
49
+ ```
50
+
51
+ **TDD选项:**
52
+ - `--timeout <分钟>` - 会话超时(默认:120)
53
+ - `--idle-timeout <分钟>` - 空闲超时(默认:10)
54
+ - `--gates <gates>` - 验证门:test,type,lint,build(默认:test,type)
55
+ - `--max-retries <n>` - 门重试次数(默认:3)
56
+ - `--no-tdd` - 禁用TDD模式
57
+
36
58
  ## 命令
37
59
 
38
60
  | 命令 | 描述 |
@@ -45,6 +67,7 @@ ct web
45
67
  | `ct demo` | 交互式演示(不消耗token) |
46
68
  | `ct batch` | 并行处理多个问题 |
47
69
  | `ct bustercall` | 自动获取所有open问题并运行并行会话 |
70
+ | `ct clean` | 删除所有worktree(main除外) |
48
71
  | `ct web` | 启动Web仪表板 |
49
72
 
50
73
  ## 主要功能
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const cleanCommand: Command;
3
+ //# sourceMappingURL=clean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BpC,eAAO,MAAM,YAAY,SAyGrB,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { Command } from 'commander';
2
+ import { join } from 'node:path';
3
+ import { createInterface } from 'node:readline';
4
+ import { GitWorktreeAdapter, FileSessionRepository } from '@claudetree/core';
5
+ const CONFIG_DIR = '.claudetree';
6
+ async function confirm(message) {
7
+ const rl = createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout,
10
+ });
11
+ return new Promise((resolve) => {
12
+ rl.question(`${message} [y/N] `, (answer) => {
13
+ rl.close();
14
+ resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
15
+ });
16
+ });
17
+ }
18
+ export const cleanCommand = new Command('clean')
19
+ .description('Remove all worktrees (except main)')
20
+ .option('-f, --force', 'Force removal without confirmation', false)
21
+ .option('--keep-sessions', 'Keep session records after removal', false)
22
+ .option('--dry-run', 'Show what would be removed without removing', false)
23
+ .action(async (options) => {
24
+ const cwd = process.cwd();
25
+ const adapter = new GitWorktreeAdapter(cwd);
26
+ try {
27
+ const worktrees = await adapter.list();
28
+ const toRemove = worktrees.filter((wt) => !wt.isMainWorktree);
29
+ if (toRemove.length === 0) {
30
+ console.log('No worktrees to remove.');
31
+ return;
32
+ }
33
+ console.log('\n=== Clean Worktrees ===\n');
34
+ console.log(`Found ${toRemove.length} worktree(s) to remove:\n`);
35
+ for (const wt of toRemove) {
36
+ const branch = wt.branch || '(detached)';
37
+ console.log(` \u2022 ${wt.path} (${branch})`);
38
+ }
39
+ if (options.dryRun) {
40
+ console.log('\n[Dry run] No changes made.');
41
+ return;
42
+ }
43
+ if (!options.force) {
44
+ console.log('');
45
+ const confirmed = await confirm('Are you sure you want to remove these worktrees?');
46
+ if (!confirmed) {
47
+ console.log('Cancelled.');
48
+ return;
49
+ }
50
+ }
51
+ console.log('');
52
+ let successCount = 0;
53
+ let failCount = 0;
54
+ for (const wt of toRemove) {
55
+ process.stdout.write(`Removing ${wt.path}... `);
56
+ try {
57
+ await adapter.remove(wt.path, options.force);
58
+ console.log('\u2713');
59
+ successCount++;
60
+ }
61
+ catch (error) {
62
+ console.log('\u2717');
63
+ if (error instanceof Error) {
64
+ console.log(` Error: ${error.message}`);
65
+ }
66
+ failCount++;
67
+ }
68
+ }
69
+ // Clean up sessions if not keeping them
70
+ if (!options.keepSessions) {
71
+ const configDir = join(cwd, CONFIG_DIR);
72
+ try {
73
+ const sessionRepo = new FileSessionRepository(configDir);
74
+ const sessions = await sessionRepo.findAll();
75
+ // Find sessions that reference removed worktrees
76
+ const removedPaths = new Set(toRemove.map((wt) => wt.path));
77
+ const sessionsToDelete = sessions.filter((s) => s.worktreePath && removedPaths.has(s.worktreePath));
78
+ for (const session of sessionsToDelete) {
79
+ await sessionRepo.delete(session.id);
80
+ }
81
+ if (sessionsToDelete.length > 0) {
82
+ console.log(`\nRemoved ${sessionsToDelete.length} associated session(s).`);
83
+ }
84
+ }
85
+ catch {
86
+ // Config dir might not exist, which is fine
87
+ }
88
+ }
89
+ // Prune stale worktree entries
90
+ process.stdout.write('\nPruning stale entries... ');
91
+ try {
92
+ await adapter.prune();
93
+ console.log('\u2713');
94
+ }
95
+ catch {
96
+ console.log('\u2717');
97
+ }
98
+ console.log(`\nRemoved ${successCount} worktree(s) successfully.`);
99
+ if (failCount > 0) {
100
+ console.log(`Failed to remove ${failCount} worktree(s).`);
101
+ process.exit(1);
102
+ }
103
+ }
104
+ catch (error) {
105
+ if (error instanceof Error) {
106
+ console.error(`Error: ${error.message}`);
107
+ }
108
+ process.exit(1);
109
+ }
110
+ });
111
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,UAAU,GAAG,aAAa,CAAC;AAQjC,KAAK,UAAU,OAAO,CAAC,OAAe;IACpC,MAAM,EAAE,GAAG,eAAe,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,GAAG,OAAO,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;YAC1C,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,oCAAoC,CAAC;KACjD,MAAM,CAAC,aAAa,EAAE,oCAAoC,EAAE,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AC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwDpC,eAAO,MAAM,YAAY,SA8crB,CAAC"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwGpC,eAAO,MAAM,YAAY,SA0kBrB,CAAC"}