mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-14 02:42:04 +08:00
- Removed agent references in context-gather and test-context-gather commands for clarity. - Updated test-task-generate to streamline agent configuration references. - Enhanced action-planning-agent documentation by removing redundant examples. - Adjusted execute command to eliminate direct agent path references. - Improved context-gather documentation to clarify agent autonomy and project.json integration. - Revised test-context-gather to focus on agent delegation and coverage analysis. - Cleaned up test-task-generate to focus on task generation rules without direct agent references. - Implemented automatic agent assignment based on exploration file names in deep analysis phase. - Expanded project exploration phase to include intelligent angle selection based on software type. - Enhanced output schemas and success criteria for exploration tasks to ensure clarity and completeness.
151 lines
4.2 KiB
Markdown
151 lines
4.2 KiB
Markdown
# Phase 1.5: Project Exploration
|
|
|
|
基于元数据,启动并行探索 Agent 收集代码信息。
|
|
|
|
## Execution
|
|
|
|
### Step 1: Intelligent Angle Selection
|
|
|
|
```javascript
|
|
// 根据软件类型选择探索角度
|
|
const ANGLE_PRESETS = {
|
|
'CLI': ['architecture', 'commands', 'algorithms', 'exceptions'],
|
|
'API': ['architecture', 'endpoints', 'data-structures', 'interfaces'],
|
|
'SDK': ['architecture', 'interfaces', 'data-structures', 'algorithms'],
|
|
'DataProcessing': ['architecture', 'algorithms', 'data-structures', 'dataflow'],
|
|
'Automation': ['architecture', 'algorithms', 'exceptions', 'dataflow']
|
|
};
|
|
|
|
// 从 metadata.category 映射到预设
|
|
function getCategoryKey(category) {
|
|
if (category.includes('CLI') || category.includes('命令行')) return 'CLI';
|
|
if (category.includes('API') || category.includes('后端')) return 'API';
|
|
if (category.includes('SDK') || category.includes('库')) return 'SDK';
|
|
if (category.includes('数据处理')) return 'DataProcessing';
|
|
if (category.includes('自动化')) return 'Automation';
|
|
return 'API'; // default
|
|
}
|
|
|
|
const categoryKey = getCategoryKey(metadata.category);
|
|
const selectedAngles = ANGLE_PRESETS[categoryKey];
|
|
|
|
console.log(`
|
|
## Exploration Plan
|
|
|
|
Software: ${metadata.software_name}
|
|
Category: ${metadata.category} → ${categoryKey}
|
|
Selected Angles: ${selectedAngles.join(', ')}
|
|
|
|
Launching ${selectedAngles.length} parallel explorations...
|
|
`);
|
|
```
|
|
|
|
### Step 2: Launch Parallel Agents (Direct Output)
|
|
|
|
**⚠️ CRITICAL**: Agents write output files directly.
|
|
|
|
```javascript
|
|
const explorationTasks = selectedAngles.map((angle, index) =>
|
|
Task({
|
|
subagent_type: "cli-explore-agent",
|
|
run_in_background: false,
|
|
description: `Explore: ${angle}`,
|
|
prompt: `
|
|
## Exploration Objective
|
|
为 CPCC 软著申请文档执行 **${angle}** 探索。
|
|
|
|
## Assigned Context
|
|
- **Exploration Angle**: ${angle}
|
|
- **Software Name**: ${metadata.software_name}
|
|
- **Scope Path**: ${metadata.scope_path}
|
|
- **Category**: ${metadata.category}
|
|
- **Exploration Index**: ${index + 1} of ${selectedAngles.length}
|
|
- **Output File**: ${sessionFolder}/exploration-${angle}.json
|
|
|
|
## MANDATORY FIRST STEPS
|
|
1. Run: ccw tool exec get_modules_by_depth '{}' (project structure)
|
|
2. Run: rg -l "{relevant_keyword}" --type ts (locate relevant files)
|
|
3. Analyze from ${angle} perspective
|
|
|
|
## Exploration Strategy (${angle} focus)
|
|
|
|
**Step 1: Structural Scan**
|
|
- 识别与 ${angle} 相关的模块和文件
|
|
- 分析导入/导出关系
|
|
|
|
**Step 2: Pattern Recognition**
|
|
- ${angle} 相关的设计模式
|
|
- 代码组织方式
|
|
|
|
**Step 3: Write Output**
|
|
- 输出 JSON 到指定路径
|
|
|
|
## Expected Output Schema
|
|
|
|
**File**: ${sessionFolder}/exploration-${angle}.json
|
|
|
|
\`\`\`json
|
|
{
|
|
"angle": "${angle}",
|
|
"findings": {
|
|
"structure": [
|
|
{ "component": "...", "type": "module|layer|service", "path": "...", "description": "..." }
|
|
],
|
|
"patterns": [
|
|
{ "name": "...", "usage": "...", "files": ["path1", "path2"] }
|
|
],
|
|
"key_files": [
|
|
{ "path": "src/file.ts", "relevance": 0.85, "rationale": "Core ${angle} logic" }
|
|
]
|
|
},
|
|
"insights": [
|
|
{ "observation": "...", "cpcc_section": "2|3|4|5|6|7", "recommendation": "..." }
|
|
],
|
|
"_metadata": {
|
|
"exploration_angle": "${angle}",
|
|
"exploration_index": ${index + 1},
|
|
"software_name": "${metadata.software_name}",
|
|
"timestamp": "ISO8601"
|
|
}
|
|
}
|
|
\`\`\`
|
|
|
|
## Success Criteria
|
|
- [ ] get_modules_by_depth 执行完成
|
|
- [ ] 至少识别 3 个相关文件
|
|
- [ ] patterns 包含具体代码示例
|
|
- [ ] insights 关联到 CPCC 章节 (2-7)
|
|
- [ ] JSON 输出到指定路径
|
|
- [ ] Return: 2-3 句话总结 ${angle} 发现
|
|
`
|
|
})
|
|
);
|
|
|
|
// Execute all exploration tasks in parallel
|
|
```
|
|
|
|
## Output
|
|
|
|
Session folder structure after exploration:
|
|
|
|
```
|
|
${sessionFolder}/
|
|
├── exploration-architecture.json
|
|
├── exploration-{angle2}.json
|
|
├── exploration-{angle3}.json
|
|
└── exploration-{angle4}.json
|
|
```
|
|
|
|
## Downstream Usage (Phase 2 Analysis Input)
|
|
|
|
Phase 2 agents read exploration files as context:
|
|
|
|
```javascript
|
|
// Discover exploration files by known angle pattern
|
|
const explorationData = {};
|
|
selectedAngles.forEach(angle => {
|
|
const filePath = `${sessionFolder}/exploration-${angle}.json`;
|
|
explorationData[angle] = JSON.parse(Read(filePath));
|
|
});
|
|
```
|