Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions scripts/main/Start-ClaudeOS.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $ErrorActionPreference = 'Stop'
$ScriptRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
Import-Module (Join-Path $ScriptRoot 'scripts\lib\LauncherCommon.psm1') -Force -DisableNameChecking
Import-Module (Join-Path $ScriptRoot 'scripts\lib\Config.psm1') -Force
Import-Module (Join-Path $ScriptRoot 'scripts\lib\AgentTeams.psm1') -Force

function Write-BootStep {
param(
Expand Down Expand Up @@ -139,6 +140,32 @@ function Invoke-StepPlaceholder {
return @{ Step = $Number; Name = $Name; Status = 'SKIP'; Detail = $Reason }
}

function Invoke-StepAgentInit {
param([string]$Root)
Write-BootStep 7 'Agent Init'
try {
$report = Get-AgentTeamReport -ProjectRoot $Root
if ($report.agentsDirExists) {
Write-Host (' [OK] Agent definitions: {0} agents loaded' -f $report.agentCount) -ForegroundColor Green
Write-Host (' Path: {0}' -f $report.agentsDir) -ForegroundColor DarkGray
}
else {
Write-Host (' [WARN] Agent definitions directory not found: {0}' -f $report.agentsDir) -ForegroundColor Yellow
}
$rulesLabel = if ($report.rulesExist) { '[OK] found' } else { '[WARN] not found' }
$rulesColor = if ($report.rulesExist) { 'Green' } else { 'Yellow' }
Write-Host (' Backlog rules : {0}' -f $rulesLabel) -ForegroundColor $rulesColor
Write-Host ''
$stepStatus = if ($report.agentsDirExists) { 'OK' } else { 'SKIP' }
return @{ Step = 7; Name = 'Agent Init'; Status = $stepStatus; Detail = $report }
}
catch {
Write-Host (' [FAIL] Agent Init failed: {0}' -f $_.Exception.Message) -ForegroundColor Red
Write-Host ''
return @{ Step = 7; Name = 'Agent Init'; Status = 'FAIL'; Detail = $_.Exception.Message }
}
}

function Write-BootDashboard {
param([array]$Results)
Write-BootStep 9 'Dashboard'
Expand Down Expand Up @@ -170,8 +197,7 @@ $results += Invoke-StepPlaceholder -Number 5 -Name 'Executive Init' `
-Reason 'Runtime CTO / Strategy Engine is a conceptual layer (Claude itself)'
$results += Invoke-StepPlaceholder -Number 6 -Name 'Management Init' `
-Reason 'Backlog / Scrum Master integration pending'
$results += Invoke-StepPlaceholder -Number 7 -Name 'Agent Init' `
-Reason 'AgentTeams runtime wiring pending (PR-B)'
$results += Invoke-StepAgentInit -Root $ScriptRoot
Comment on lines 199 to +200

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start-ClaudeOS.ps1 のヘッダー説明で「Steps 3, 5, 6, 7, 8 are placeholders」となっていますが、この変更で Step 7 はプレースホルダーではなく実装されています。スクリプト上部の DESCRIPTION を現状(Step 7 は AgentTeams.psm1 を参照して初期化を試行する)に合わせて更新してください。

Copilot uses AI. Check for mistakes.
$results += Invoke-StepPlaceholder -Number 8 -Name 'Loop Engine Start' `
-Reason 'Loop orchestration handled by Claude Code /loop harness'

Expand Down
11 changes: 9 additions & 2 deletions tests/StartScripts.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,23 @@ Describe 'Start-*.ps1 dry-run flows' {
$output | Should -Match '\[DRY RUN\] No side effects will be applied'
}

It 'Start-ClaudeOS.ps1 の Step 3/5/6/7/8 がプレースホルダー SKIP になること' {
It 'Start-ClaudeOS.ps1 の Step 3/5/6/8 がプレースホルダー SKIP になること' {
$scriptPath = Join-Path $script:RepoRoot 'scripts\main\Start-ClaudeOS.ps1'
$output = & $script:PowerShellExe -NoProfile -File $scriptPath -NonInteractive 2>&1 | Out-String
$LASTEXITCODE | Should -Be 0
$output | Should -Match '\[Step 3\].*Memory Restore.*SKIP'
$output | Should -Match '\[Step 5\].*Executive Init.*SKIP'
$output | Should -Match '\[Step 6\].*Management Init.*SKIP'
$output | Should -Match '\[Step 7\].*Agent Init.*SKIP'
$output | Should -Match '\[Step 8\].*Loop Engine Start.*SKIP'
}

It 'Start-ClaudeOS.ps1 の Step 7 が Agent Init として実行されること (PR-B)' {
$scriptPath = Join-Path $script:RepoRoot 'scripts\main\Start-ClaudeOS.ps1'
$output = & $script:PowerShellExe -NoProfile -File $scriptPath -NonInteractive 2>&1 | Out-String
$LASTEXITCODE | Should -Be 0
$output | Should -Match '\[Step 7\].*Agent Init'
$output | Should -Not -Match '\[Step 7\].*Agent Init.*SKIP'

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このテストは \[Step 7\].*Agent Init の存在と、同一行に SKIP が含まれないことしか検証していません。現実装の Step 7 は常に [RUN] で表示されるため、AgentTeams.psm1 の配線が壊れていても(例: Get-AgentTeamReport が例外になる/期待した情報を出力しない等)見逃しやすいです。Step 7 の実行結果をより確実に検証するため、[OK] Agent definitions: や Backlog rules : [OK] found のような Step 7 固有の出力、または Boot Summary の OK/SKIP カウントに Step 7 が反映されることをアサートしてください。

Suggested change
$output | Should -Not -Match '\[Step 7\].*Agent Init.*SKIP'
$output | Should -Not -Match '\[Step 7\].*Agent Init.*SKIP'
$output | Should -Match '(\[OK\] Agent definitions:|Backlog rules\s*:\s*\[OK\]\s*found)'
$output | Should -Match 'Boot Summary'
$output | Should -Match 'OK\s*:\s*\d+'
$output | Should -Match 'SKIP\s*:\s*\d+'

Copilot uses AI. Check for mistakes.
}
}

Describe 'Start-Menu helper flows' {
Expand Down
Loading