Files
Claude-Code-Workflow/.claude/skills/software-manual/phases/02-project-exploration.md
catlog22 7aa1cda367 feat: add issue discovery view for managing discovery sessions and findings
- Implemented main render function for the issue discovery view.
- Added data loading functions to fetch discoveries, details, findings, and progress.
- Created rendering functions for discovery list and detail sections.
- Introduced filtering and searching capabilities for findings.
- Implemented actions for exporting and dismissing findings.
- Added polling mechanism to track discovery progress.
- Included utility functions for HTML escaping and cleanup.
2025-12-28 17:21:07 +08:00

2.6 KiB

Phase 2: Project Exploration

使用 cli-explore-agent 探索项目结构,生成文档所需的结构化数据。

探索角度

const EXPLORATION_ANGLES = {
  web: ['architecture', 'ui-routes', 'api-endpoints', 'config'],
  cli: ['architecture', 'commands', 'config'],
  sdk: ['architecture', 'public-api', 'types', 'config'],
  desktop: ['architecture', 'ui-screens', 'config']
};

执行流程

const config = JSON.parse(Read(`${workDir}/manual-config.json`));
const angles = EXPLORATION_ANGLES[config.software.type];

// 并行探索
const tasks = angles.map(angle => Task({
  subagent_type: 'cli-explore-agent',
  run_in_background: false,
  prompt: buildExplorationPrompt(angle, config, workDir)
}));

const results = await Promise.all(tasks);

探索配置

const EXPLORATION_CONFIGS = {
  architecture: {
    task: '分析项目模块结构、入口点、依赖关系',
    patterns: ['src/*/', 'package.json', 'tsconfig.json'],
    output: 'exploration-architecture.json'
  },
  'ui-routes': {
    task: '提取 UI 路由、页面组件、导航结构',
    patterns: ['src/pages/**', 'src/views/**', 'app/**/page.*', 'src/router/**'],
    output: 'exploration-ui-routes.json'
  },
  'api-endpoints': {
    task: '提取 REST API 端点、请求/响应类型',
    patterns: ['src/**/*.controller.*', 'src/routes/**', 'openapi.*', 'swagger.*'],
    output: 'exploration-api-endpoints.json'
  },
  config: {
    task: '提取环境变量、配置文件选项',
    patterns: ['.env.example', 'config/**', 'docker-compose.yml'],
    output: 'exploration-config.json'
  },
  commands: {
    task: '提取 CLI 命令、选项、示例',
    patterns: ['src/cli*', 'bin/*', 'src/commands/**'],
    output: 'exploration-commands.json'
  }
};

Prompt 构建

function buildExplorationPrompt(angle, config, workDir) {
  const cfg = EXPLORATION_CONFIGS[angle];
  return `
[TASK]
${cfg.task}

[SCOPE]
项目类型: ${config.software.type}
扫描模式: deep-scan
文件模式: ${cfg.patterns.join(', ')}

[OUTPUT]
文件: ${workDir}/exploration/${cfg.output}
格式: JSON (schema-compliant)

[RETURN]
简要说明发现的内容数量和关键发现
`;
}

输出结构

exploration/
├── exploration-architecture.json   # 模块结构
├── exploration-ui-routes.json      # UI 路由
├── exploration-api-endpoints.json  # API 端点
├── exploration-config.json         # 配置选项
└── exploration-commands.json       # CLI 命令 (if CLI)

下一阶段

Phase 3: Parallel Analysis