Skip to content

Commit d5c6f65

Browse files
author
catlog22
committed
feat(tests): enhance test coverage with integration and utility tests
- Updated QueueCard tests to use getAllByText for better resilience against multiple occurrences. - Modified useCodexLens tests to check for error existence instead of specific message. - Added mock for ResizeObserver in test setup to support components using it. - Introduced integration tests for appStore and hooks interactions, covering locale and theme flows. - Created layout-utils tests to validate pane manipulation functions. - Added queryKeys tests to ensure correct key generation for workspace queries. - Implemented utils tests for class name merging and memory metadata parsing.
1 parent 8665ea7 commit d5c6f65

25 files changed

Lines changed: 1439 additions & 2340 deletions

File tree

.claude/commands/ccw.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,36 @@ User Input → Analyze Intent → Select Workflow → [Confirm] → Execute Chai
6161

6262
**vs ccw-coordinator**: External CLI execution with background tasks and hook callbacks.
6363

64+
## Auto Mode (`-y` / `--yes`)
65+
66+
当用户传入 `-y``--yes` 时,整个 CCW 链路进入自动模式:
67+
68+
```javascript
69+
// Phase 0: 检测 -y 标志(在 Phase 1 之前执行)
70+
const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS)
71+
```
72+
73+
**自动模式行为**:
74+
- **Phase 1.5**: 跳过需求澄清(clarity_score < 2 也不询问,用已有信息推断)
75+
- **Phase 3**: 跳过用户确认,直接执行命令链
76+
- **Phase 5**: 错误处理自动选择 "Skip"(继续下一个命令)
77+
- **Skill 传播**: `-y` 自动附加到链中每个 Skill 的 args
78+
79+
**传播机制**: 通过 `assembleCommand` 注入 `-y`
80+
```javascript
81+
function assembleCommand(step, previousResult) {
82+
let args = step.args || '';
83+
if (!args && previousResult?.session_id) {
84+
args = `--session="${previousResult.session_id}"`;
85+
}
86+
// ★ 传播 -y 到下游 Skill
87+
if (autoYes && !args.includes('-y') && !args.includes('--yes')) {
88+
args = args ? `${args} -y` : '-y';
89+
}
90+
return { skill: step.cmd, args };
91+
}
92+
```
93+
6494
## 5-Phase Workflow
6595
6696
### Phase 1: Analyze Intent
@@ -114,6 +144,7 @@ function detectTaskType(text) {
114144
```javascript
115145
async function clarifyRequirements(analysis) {
116146
if (analysis.clarity_score >= 2) return analysis;
147+
if (autoYes) return analysis; // ★ 自动模式:跳过澄清,用已有信息推断
117148

118149
const questions = generateClarificationQuestions(analysis); // Goal, Scope, Constraints
119150
const answers = await AskUserQuestion({ questions });
@@ -282,6 +313,8 @@ function buildCommandChain(workflow, analysis) {
282313
283314
```javascript
284315
async function getUserConfirmation(chain) {
316+
if (autoYes) return chain; // ★ 自动模式:跳过确认,直接执行
317+
285318
const response = await AskUserQuestion({
286319
questions: [{
287320
question: "Execute this command chain?",
@@ -411,6 +444,10 @@ function assembleCommand(step, previousResult) {
411444
if (!args && previousResult?.session_id) {
412445
args = `--session="${previousResult.session_id}"`;
413446
}
447+
// ★ 传播 -y 到下游 Skill
448+
if (autoYes && !args.includes('-y') && !args.includes('--yes')) {
449+
args = args ? `${args} -y` : '-y';
450+
}
414451
return { skill: step.cmd, args };
415452
}
416453

@@ -430,6 +467,8 @@ function updateTodoStatus(index, total, workflow, status) {
430467

431468
// Error handling: Retry/Skip/Abort
432469
async function handleError(step, error, index) {
470+
if (autoYes) return 'skip'; // ★ 自动模式:跳过失败命令,继续下一个
471+
433472
const response = await AskUserQuestion({
434473
questions: [{
435474
question: `${step.cmd} failed: ${error.message}`,
@@ -610,6 +649,10 @@ todos = [
610649
# Auto-select workflow
611650
/ccw "Add user authentication"
612651

652+
# Auto mode - skip all confirmations, propagate -y to all skills
653+
/ccw -y "Add user authentication"
654+
/ccw --yes "Fix memory leak in WebSocket handler"
655+
613656
# Complex requirement (triggers clarification)
614657
/ccw "Optimize system performance"
615658

.claude/skills/team-planex/SKILL.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ Final: planner 发送 all_planned → executor 完成剩余 EXEC-* → 结束
193193
### 选择逻辑
194194

195195
```javascript
196-
const autoYes = args.includes('--auto') || args.includes('-y')
196+
// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播
197+
const autoYes = /\b(-y|--yes)\b/.test(args)
197198
const explicitExec = args.match(/--exec[=\s]+(agent|codex|gemini|auto)/i)?.[1]
198199

199200
let executionConfig
@@ -253,7 +254,7 @@ function resolveExecutor(taskCount) {
253254
Skill(skill="team-planex", args="--exec=codex ISS-xxx")
254255
Skill(skill="team-planex", args="--exec=agent --text '简单功能'")
255256

256-
# Auto 模式(跳过交互)
257+
# Auto 模式(跳过交互-y 或 --yes
257258
Skill(skill="team-planex", args="-y --text '添加日志'")
258259
```
259260

0 commit comments

Comments
 (0)