mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
- Added command architecture section to skill router template, detailing role organization and command delegation. - Updated role router input parsing to reflect new file structure for roles. - Introduced role isolation rules to enforce strict boundaries on role responsibilities and output tagging. - Enhanced team configuration section to include role-specific guidelines and message bus requirements. feat: Improve terminal dashboard with session status indicators - Integrated terminal status indicators in the session group tree, displaying active, idle, error, paused, and resuming states. - Updated session click handling to focus on existing panes or assign sessions to available panes. feat: Add session lifecycle controls in terminal pane - Implemented restart, pause, and resume functionalities for terminal sessions with loading states. - Enhanced UI buttons for session control with appropriate loading indicators and tooltips. i18n: Update terminal dashboard localization for session controls - Added translations for restart, pause, and resume session actions in English and Chinese. chore: Create role command template for command file generation - Established a comprehensive template for generating command files in roles, including sections for strategy, execution steps, and error handling. - Included pre-built command patterns for common tasks like exploration, analysis, implementation, validation, review, dispatch, and monitoring.
217 lines
6.3 KiB
Markdown
217 lines
6.3 KiB
Markdown
# Phase 4: Integration Verification
|
|
|
|
Verify the generated skill package is internally consistent.
|
|
|
|
## Objective
|
|
|
|
- Verify SKILL.md role router references match actual role files
|
|
- Verify task prefixes are unique across all roles
|
|
- Verify message types are consistent
|
|
- Verify coordinator spawn template uses correct skill invocation
|
|
- Generate integration-report.json
|
|
|
|
## Input
|
|
|
|
- Dependency: `{workDir}/preview/` directory (Phase 3)
|
|
- Reference: `team-config.json` (Phase 1)
|
|
|
|
## Execution Steps
|
|
|
|
### Step 1: Load Generated Files
|
|
|
|
```javascript
|
|
const config = JSON.parse(Read(`${workDir}/team-config.json`))
|
|
const previewDir = `${workDir}/preview`
|
|
const skillMd = Read(`${previewDir}/SKILL.md`)
|
|
|
|
const roleFiles = {}
|
|
for (const role of config.roles) {
|
|
try {
|
|
roleFiles[role.name] = Read(`${previewDir}/roles/${role.name}/role.md`)
|
|
} catch {
|
|
roleFiles[role.name] = null
|
|
}
|
|
}
|
|
```
|
|
|
|
### Step 2: Role Router Consistency
|
|
|
|
```javascript
|
|
const routerChecks = config.roles.map(role => {
|
|
const hasRouterEntry = skillMd.includes(`"${role.name}"`)
|
|
const hasRoleFile = roleFiles[role.name] !== null
|
|
const hasRoleLink = skillMd.includes(`roles/${role.name}/role.md`)
|
|
|
|
return {
|
|
role: role.name,
|
|
router_entry: hasRouterEntry,
|
|
file_exists: hasRoleFile,
|
|
link_valid: hasRoleLink,
|
|
status: (hasRouterEntry && hasRoleFile && hasRoleLink) ? 'PASS' : 'FAIL'
|
|
}
|
|
})
|
|
```
|
|
|
|
### Step 3: Task Prefix Uniqueness
|
|
|
|
```javascript
|
|
const prefixes = config.worker_roles.map(r => r.task_prefix)
|
|
const uniquePrefixes = [...new Set(prefixes)]
|
|
const prefixCheck = {
|
|
prefixes: prefixes,
|
|
unique: uniquePrefixes,
|
|
duplicates: prefixes.filter((p, i) => prefixes.indexOf(p) !== i),
|
|
status: prefixes.length === uniquePrefixes.length ? 'PASS' : 'FAIL'
|
|
}
|
|
```
|
|
|
|
### Step 4: Message Type Consistency
|
|
|
|
```javascript
|
|
const msgChecks = config.worker_roles.map(role => {
|
|
const roleFile = roleFiles[role.name] || ''
|
|
const typesInConfig = role.message_types.map(mt => mt.type)
|
|
const typesInFile = typesInConfig.filter(t => roleFile.includes(t))
|
|
|
|
return {
|
|
role: role.name,
|
|
configured: typesInConfig,
|
|
present_in_file: typesInFile,
|
|
missing: typesInConfig.filter(t => !typesInFile.includes(t)),
|
|
status: typesInFile.length === typesInConfig.length ? 'PASS' : 'WARN'
|
|
}
|
|
})
|
|
```
|
|
|
|
### Step 5: Spawn Template Verification
|
|
|
|
```javascript
|
|
const spawnChecks = config.worker_roles.map(role => {
|
|
const hasSpawn = skillMd.includes(`name: "${role.name}"`)
|
|
const hasSkillCall = skillMd.includes(`Skill(skill="${config.skill_name}", args="--role=${role.name}")`)
|
|
const hasTaskPrefix = skillMd.includes(`${role.task_prefix}-*`)
|
|
|
|
return {
|
|
role: role.name,
|
|
spawn_present: hasSpawn,
|
|
skill_call_correct: hasSkillCall,
|
|
prefix_in_prompt: hasTaskPrefix,
|
|
status: (hasSpawn && hasSkillCall && hasTaskPrefix) ? 'PASS' : 'FAIL'
|
|
}
|
|
})
|
|
```
|
|
|
|
### Step 6: Role File Pattern Compliance
|
|
|
|
```javascript
|
|
const patternChecks = Object.entries(roleFiles).map(([name, content]) => {
|
|
if (!content) return { role: name, status: 'MISSING' }
|
|
|
|
const checks = {
|
|
has_role_identity: /## Role Identity/.test(content),
|
|
has_5_phases: /Phase 1/.test(content) && /Phase 5/.test(content),
|
|
has_task_lifecycle: /TaskList/.test(content) && /TaskGet/.test(content) && /TaskUpdate/.test(content),
|
|
has_message_bus: /team_msg/.test(content),
|
|
has_send_message: /SendMessage/.test(content),
|
|
has_error_handling: /## Error Handling/.test(content)
|
|
}
|
|
|
|
const passCount = Object.values(checks).filter(Boolean).length
|
|
return {
|
|
role: name,
|
|
checks: checks,
|
|
pass_count: passCount,
|
|
total: Object.keys(checks).length,
|
|
status: passCount === Object.keys(checks).length ? 'PASS' : 'PARTIAL'
|
|
}
|
|
})
|
|
```
|
|
|
|
### Step 6b: Command File Verification
|
|
|
|
```javascript
|
|
const commandChecks = config.worker_roles.map(role => {
|
|
const commands = role.commands || []
|
|
if (commands.length === 0) return { role: role.name, status: 'SKIP', reason: 'No commands' }
|
|
|
|
const checks = commands.map(cmd => {
|
|
const cmdPath = `${previewDir}/roles/${role.name}/commands/${cmd}.md`
|
|
let content = null
|
|
try { content = Read(cmdPath) } catch {}
|
|
|
|
if (!content) return { command: cmd, status: 'MISSING' }
|
|
|
|
const requiredSections = {
|
|
has_strategy: /## Strategy/.test(content),
|
|
has_execution_steps: /## Execution Steps/.test(content),
|
|
has_error_handling: /## Error Handling/.test(content),
|
|
has_when_to_use: /## When to Use/.test(content),
|
|
is_self_contained: !/Read\("\.\.\//.test(content) // No cross-command references
|
|
}
|
|
|
|
const passCount = Object.values(requiredSections).filter(Boolean).length
|
|
return {
|
|
command: cmd,
|
|
checks: requiredSections,
|
|
pass_count: passCount,
|
|
total: Object.keys(requiredSections).length,
|
|
status: passCount === Object.keys(requiredSections).length ? 'PASS' : 'PARTIAL'
|
|
}
|
|
})
|
|
|
|
return { role: role.name, commands: checks, status: checks.every(c => c.status === 'PASS') ? 'PASS' : 'NEEDS_ATTENTION' }
|
|
})
|
|
```
|
|
|
|
### Step 7: Generate Report
|
|
|
|
```javascript
|
|
const overallStatus = [
|
|
...routerChecks.map(c => c.status),
|
|
prefixCheck.status,
|
|
...spawnChecks.map(c => c.status),
|
|
...patternChecks.map(c => c.status),
|
|
...commandChecks.filter(c => c.status !== 'SKIP').map(c => c.status)
|
|
].every(s => s === 'PASS') ? 'PASS' : 'NEEDS_ATTENTION'
|
|
|
|
const report = {
|
|
team_name: config.team_name,
|
|
skill_name: config.skill_name,
|
|
checks: {
|
|
router_consistency: routerChecks,
|
|
prefix_uniqueness: prefixCheck,
|
|
message_types: msgChecks,
|
|
spawn_template: spawnChecks,
|
|
pattern_compliance: patternChecks,
|
|
command_files: commandChecks
|
|
},
|
|
overall: overallStatus,
|
|
file_count: {
|
|
skill_md: 1,
|
|
role_files: Object.keys(roleFiles).length,
|
|
total: 1 + Object.keys(roleFiles).length + 1 // SKILL.md + roles + config
|
|
}
|
|
}
|
|
|
|
Write(`${workDir}/integration-report.json`, JSON.stringify(report, null, 2))
|
|
```
|
|
|
|
## Output
|
|
|
|
- **File**: `integration-report.json`
|
|
- **Format**: JSON
|
|
- **Location**: `{workDir}/integration-report.json`
|
|
|
|
## Quality Checklist
|
|
|
|
- [ ] Every role in config has a router entry in SKILL.md
|
|
- [ ] Every role has a file in roles/
|
|
- [ ] Task prefixes are unique
|
|
- [ ] Spawn template uses correct `Skill(skill="...", args="--role=...")`
|
|
- [ ] All role files have 5-phase structure
|
|
- [ ] All role files have message bus integration
|
|
|
|
## Next Phase
|
|
|
|
-> [Phase 5: Validation](05-validation.md)
|