Skip to content

feat(dashboard): Issue #71 — Step 9 Dashboard に state.json KPI/フェーズ統合 - #82

Merged
Kensan196948G merged 2 commits into
mainfrom
feature/issue71-dashboard-ui
Apr 14, 2026
Merged

Kensan196948G merged 2 commits into
mainfrom
feature/issue71-dashboard-ui

Conversation

@Kensan196948G

@Kensan196948G Kensan196948G commented Apr 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Start-ClaudeOS.ps1 Step 9 (Dashboard) に state.json 統合を実装 (Option A: PowerShell TUI 強化)
  • Get-StateJsonDashboard ヘルパー関数で state.json を安全に読み込み
  • Write-BootDashboard に -Root パラメータを追加し、以下を表示:
    • Goal & KPI: Goal タイトル・成功率目標・CI パス率・P1 Issue 数
    • Execution Status: 現在フェーズ・経過時間・残り時間
    • Token Budget: 使用量・残量・総量
    • Current Work: 対応中 Issue・PR 番号・ブランチ
    • Last Loop: 最終ループ番号・フェーズ・成果
  • state.json 不在時は従来の Boot Summary のみ表示(後方互換を維持)

設計判断

Option A (PowerShell TUI 強化) を採用:

  • 追加依存ライブラリ不要
  • 既存 Write-BootDashboard の自然な拡張
  • state.json はすでに CI テストでモック可能

Test plan

  • state.json なしで LASTEXITCODE 0 — PASS
  • state.json の Goal title がダッシュボードに表示される — PASS
  • Boot Summary の OK/SKIP/FAIL カウントが正しく表示される — PASS
  • CI (Linux Pester) 全テスト PASS

影響範囲

  • scripts/main/Start-ClaudeOS.ps1 — Step 9 Dashboard 拡張
  • tests/StartScripts.Tests.ps1 — Dashboard テスト 2 件追加

残課題

  • state.json の current_work.description 表示は次フェーズ検討
  • Phase 4: Web UI (Option C) へのアップグレードパスは保持

Closes #71

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • 新機能

    • ダッシュボードが状態情報の表示に対応しました。目標、KPI、実行ステータス、トークン予算、現在の作業、最後のループなど、利用可能な情報に応じて複数セクションを表示します。状態情報がないか解析に失敗した場合は従来のブートサマリーにフォールバックし、解析エラー時は警告を出します。
  • テスト

    • 状態情報がない場合と、goal を含む状態情報がある場合の表示動作を検証するテストを追加しました(実行結果と出力の検証、テスト後のクリーンアップを含む)。

…ープ履歴を統合

- Start-ClaudeOS.ps1:
  - Get-StateJsonDashboard ヘルパー関数を追加 (state.json → PSObject 変換)
  - Write-BootDashboard に -Root パラメータを追加
  - state.json 存在時: Goal & KPI / Execution Status / Token Budget /
    Current Work / Last Loop を色分け表示
  - state.json 不在時: 従来の Boot Summary のみ (後方互換を維持)
- tests/StartScripts.Tests.ps1:
  - Step 9 Dashboard が state.json なしでも正常終了するテストを追加
  - state.json の Goal title がダッシュボードに表示されるテストを追加

Closes #71

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 03:03
@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

scripts/main/Start-ClaudeOS.ps1 に Get-StateJsonDashboard を追加し、Write-BootDashboard のシグネチャを -Root パラメータ付きに変更。state.json の読み込み・解析に基づき、Goal/KPI・Execution Status・Token Budget・Current Work・Last Loop を条件付きで表示するよう出力を拡張。関連の Pester テストが追加された。

Changes

Cohort / File(s) Summary
ダッシュボード機能拡張
scripts/main/Start-ClaudeOS.ps1
Get-StateJsonDashboard([string]$Root) を追加して state.json の存在確認と JSON 解析を行う。Write-BootDashboard([array]$Results, [string]$Root) を導入し、既存の Boot Summary 出力後に state.json のプロパティに応じて Goal & KPI、Execution Status、Token Budget、Current Work、Last Loop の各セクションを条件付きレンダリング。state.json が無いか解析失敗時は既存のサマリのみ出力。例外発生時は警告出力のうえサマリを返す。
テストケース追加
tests/StartScripts.Tests.ps1
Step 9 ダッシュボードに対する 2 件の Pester テストを追加:state.json 不在時にスクリプトが exit code 0 と Boot Summary を出力すること、state.json に goal を書き込んだ場合に Goal 情報を含むダッシュボードが出力されることを検証。実行後に state.json を復元/削除する後処理を含む。

Sequence Diagram(s)

sequenceDiagram
    participant StartScript as Start-ClaudeOS.ps1
    participant FS as FileSystem
    participant Console as Console/Host

    StartScript->>FS: Read `<Root>/state.json` via Get-StateJsonDashboard
    alt file exists & valid JSON
        FS-->>StartScript: Return parsed state object
        StartScript->>Console: Print Boot Summary counts
        StartScript->>Console: Conditionally render Goal & KPI
        StartScript->>Console: Conditionally render Execution Status
        StartScript->>Console: Conditionally render Token Budget, Current Work, Last Loop
    else missing or invalid
        FS-->>StartScript: Return $null or throw parse error
        StartScript->>Console: Print Boot Summary counts only
        StartScript->>Console: If parse error -> Write-Warning, still return summary
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 ダッシュボードを覗けば
ファイルの声がほほえむよ
KPI がきらりと光り
ループは歌い、予算はそっと示す
新しい朝、コマンドで始まる ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルはstate.jsonのKPI/フェーズ統合機能を明確に説明しており、変更内容の主要な部分と合致している。
Linked Issues check ✅ Passed このPRはIssue #71の受入れ条件をすべて満たしている。PowerShell TUI強化(Option A)を採用し、state.json読み込みが実装され、テストで検証されている。
Out of Scope Changes check ✅ Passed すべての変更がIssue #71の範囲内である。ダッシュボード機能の実装とテスト追加のみで、スコープ外の変更は見当たらない。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue71-dashboard-ui

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Start-ClaudeOS.ps1 の Step 9 Dashboard に state.json を統合し、Goal/KPI・実行状況・トークン予算などのセッション状態を TUI で表示できるようにする PR です。state.json が無い場合は従来の Boot Summary 表示を維持します。

Changes:

  • Start-ClaudeOS.ps1 に state.json 読み込みヘルパーを追加し、Dashboard 表示を拡張
  • Write-BootDashboard に -Root パラメータを追加して state.json を参照
  • Dashboard の state.json 有無に関する Pester テストを追加

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
scripts/main/Start-ClaudeOS.ps1 Step 9 Dashboard で state.json を読み込み、Goal/KPI・Execution/Token 等を追加表示
tests/StartScripts.Tests.ps1 state.json なし/ありの Dashboard 出力を検証するテストを追加

Comment thread scripts/main/Start-ClaudeOS.ps1 Outdated
Comment on lines +263 to +266
$successTarget = if ($null -ne $kpi.success_rate_target) { '{0:P0}' -f $kpi.success_rate_target } else { 'n/a' }
$ciTarget = if ($null -ne $kpi.ci_pass_rate) { '{0:P0}' -f $kpi.ci_pass_rate } else { 'n/a' }
$openP1 = if ($null -ne $kpi.open_p1_issues) { $kpi.open_p1_issues } else { 'n/a' }
Write-Host (" KPI : success≥{0} CI≥{1} P1-issues={2}" -f $successTarget, $ciTarget, $openP1) -ForegroundColor Cyan
Comment thread scripts/main/Start-ClaudeOS.ps1 Outdated
Comment on lines +290 to +307
if ($state.current_work) {
$work = $state.current_work
Write-Host ''
Write-Host ' ── Current Work ────────────────────────────' -ForegroundColor Magenta
if ($work.issue) {
Write-Host (" Issue #{0}: {1}" -f $work.issue, $work.title) -ForegroundColor White
}
if ($work.pr) {
Write-Host (" PR #{0} [{1}]" -f $work.pr, $work.branch) -ForegroundColor Cyan
}
}

if ($state.loop_history -and @($state.loop_history).Count -gt 0) {
$lastLoop = @($state.loop_history)[-1]
Write-Host ''
Write-Host ' ── Last Loop ───────────────────────────────' -ForegroundColor Magenta
Write-Host (" Loop {0} [{1}]: {2}" -f $lastLoop.loop, $lastLoop.phase, $lastLoop.outcome) -ForegroundColor DarkGray
}
Comment thread scripts/main/Start-ClaudeOS.ps1 Outdated
$total = if ($null -ne $tok.total_budget) { $tok.total_budget } else { '?' }
Write-Host ''
Write-Host ' ── Token Budget ────────────────────────────' -ForegroundColor Magenta
Write-Host (" Used/Total: {0}/{1} Remaining: {2}%" -f $used, $total, $remaining) -ForegroundColor White
Comment on lines +224 to +235
function Get-StateJsonDashboard {
param([string]$Root)
$statePath = Join-Path $Root 'state.json'
if (-not (Test-Path $statePath)) {
return $null
}
try {
return Get-Content $statePath -Raw -Encoding UTF8 | ConvertFrom-Json
}
catch {
return $null
}
Comment on lines +229 to +246
$statePath = Join-Path $script:RepoRoot 'state.json'
$stateBackup = if (Test-Path $statePath) { Get-Content $statePath -Raw -Encoding UTF8 } else { $null }
try {
@{
goal = @{ title = 'Dashboard UI Test Goal' }
kpi = @{ success_rate_target = 0.9; ci_pass_rate = 1.0; open_p1_issues = 0 }
execution = @{ phase = 'Verify'; elapsed_minutes = 10; remaining_minutes = 290 }
token = @{ used = 5; total_budget = 100; remaining = 95 }
} | ConvertTo-Json -Depth 5 | Set-Content -Path $statePath -Encoding UTF8
$output = & $script:PowerShellExe -NoProfile -File $scriptPath -NonInteractive 2>&1 | Out-String
$LASTEXITCODE | Should -Be 0
$output | Should -Match 'Dashboard UI Test Goal'
$output | Should -Match 'Goal.*&.*KPI|Goal & KPI|Goal.*KPI'
}
finally {
if ($null -ne $stateBackup) {
Set-Content -Path $statePath -Value $stateBackup -Encoding UTF8
}
Comment on lines +219 to +225
It 'Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue #71)' {
$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 9\].*Dashboard'
$output | Should -Match 'Boot Summary'
}
- Write-BootDashboard で各プロパティを .PSObject.Properties.Name で検査してから
  アクセスするよう変更 (Set-StrictMode -Version Latest 対策)
- 全体を try/catch でラップしてダッシュボード描画エラーが boot 終了コードに
  影響しないよう保護
- テストの regex を簡潔化: 'Goal.*KPI' → 'Goal'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/main/Start-ClaudeOS.ps1`:
- Around line 280-288: The output incorrectly appends a "%" to the remaining
token value; update the Write-Host call that prints Used/Total/Remaining so it
does not add a percent sign to $remaining (or alternatively compute an explicit
percentage from $used and $total before appending '%'). Locate the block that
checks $state.token and references $tok, $used, $remaining, $total and change
the format string ("Used/Total: {0}/{1}  Remaining: {2}") to remove the literal
'%' after {2} (or replace {2} with a calculated percentage like
([math]::Round(($total - $used)/$total*100,0)) when you intend to show percent).

In `@tests/StartScripts.Tests.ps1`:
- Around line 219-225: The test block "Start-ClaudeOS.ps1 の Step 9 Dashboard が
state.json なしでも正常終了すること (Issue `#71`)" does not ensure state.json is absent;
update this It test to explicitly back up and remove any existing state.json
before invoking Start-ClaudeOS.ps1 and restore the original file after the test
(use a temp backup filename), so the fallback path is exercised; reference the
test's local variables ($scriptPath, $output) and ensure cleanup runs even on
failure (use Finally/try/finally pattern or AfterEach-equivalent) to guarantee
restoration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2461d54c-46d3-494f-b205-c0e21895e29a

📥 Commits

Reviewing files that changed from the base of the PR and between f8e8885 and 2f8ec17.

📒 Files selected for processing (2)
  • scripts/main/Start-ClaudeOS.ps1
  • tests/StartScripts.Tests.ps1
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Agent
  • GitHub Check: test-and-validate
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:37.774Z
Learning: Applies to Claude/templates/claude/**/state.json : Maintain state.json with goal, kpi, execution, and automation configuration as the single source of truth for autonomous development targets
📚 Learning: 2026-04-14T02:12:37.774Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:37.774Z
Learning: Applies to Claude/templates/claude/**/state.json : Maintain state.json with goal, kpi, execution, and automation configuration as the single source of truth for autonomous development targets

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
🪛 PSScriptAnalyzer (1.25.0)
tests/StartScripts.Tests.ps1

[warning] Missing BOM encoding for non-ASCII encoded file 'StartScripts.Tests.ps1'

(PSUseBOMForUnicodeEncodedFile)

scripts/main/Start-ClaudeOS.ps1

[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)


[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)


[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)

🔇 Additional comments (2)
scripts/main/Start-ClaudeOS.ps1 (1)

224-236: state.json 読み込みのフェイルセーフは適切です

Line 227-235 で「未存在/JSON不正時は $null」に寄せており、既存 Dashboard の後方互換を崩さない実装になっています。

tests/StartScripts.Tests.ps1 (1)

230-250: try/finally での state.json 復元処理は良いです

Line 230-250 のバックアップ/復元でテスト間の汚染を抑えられており、テストの独立性が保たれています。

Comment thread scripts/main/Start-ClaudeOS.ps1 Outdated
Comment on lines +280 to +288
if ($state.token) {
$tok = $state.token
$used = if ($null -ne $tok.used) { $tok.used } else { '?' }
$remaining = if ($null -ne $tok.remaining) { $tok.remaining } else { '?' }
$total = if ($null -ne $tok.total_budget) { $tok.total_budget } else { '?' }
Write-Host ''
Write-Host ' ── Token Budget ────────────────────────────' -ForegroundColor Magenta
Write-Host (" Used/Total: {0}/{1} Remaining: {2}%" -f $used, $total, $remaining) -ForegroundColor White
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Token 残量の単位表示が誤解を招きます

Line 287 は remaining(残量の実数値)に % を付与しており、値の意味が変わって見えます。state.schema 上も token.remaining は整数なので、ここは単位なし(または別途割合を計算)にすべきです。

💡 修正案
-            Write-Host ("    Used/Total: {0}/{1}  Remaining: {2}%" -f $used, $total, $remaining) -ForegroundColor White
+            Write-Host ("    Used/Total: {0}/{1}  Remaining: {2}" -f $used, $total, $remaining) -ForegroundColor White
🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)

[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/main/Start-ClaudeOS.ps1` around lines 280 - 288, The output
incorrectly appends a "%" to the remaining token value; update the Write-Host
call that prints Used/Total/Remaining so it does not add a percent sign to
$remaining (or alternatively compute an explicit percentage from $used and
$total before appending '%'). Locate the block that checks $state.token and
references $tok, $used, $remaining, $total and change the format string
("Used/Total: {0}/{1}  Remaining: {2}") to remove the literal '%' after {2} (or
replace {2} with a calculated percentage like ([math]::Round(($total -
$used)/$total*100,0)) when you intend to show percent).

Comment on lines +219 to +225
It 'Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue #71)' {
$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 9\].*Dashboard'
$output | Should -Match 'Boot Summary'
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

state.json 不在テストが不在条件を保証できていません

Line 219-225 は state.json を明示的に退避/削除していないため、既存ファイルがある環境ではフォールバック経路を検証できません。テスト名と実検証内容がズレます。

💡 修正案
     It 'Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue `#71`)' {
         $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 9\].*Dashboard'
-        $output | Should -Match 'Boot Summary'
+        $statePath = Join-Path $script:RepoRoot 'state.json'
+        $stateBackup = if (Test-Path $statePath) { Get-Content $statePath -Raw -Encoding UTF8 } else { $null }
+        try {
+            Remove-Item $statePath -Force -ErrorAction SilentlyContinue
+            $output = & $script:PowerShellExe -NoProfile -File $scriptPath -NonInteractive 2>&1 | Out-String
+            $LASTEXITCODE | Should -Be 0
+            $output | Should -Match '\[Step 9\].*Dashboard'
+            $output | Should -Match 'Boot Summary'
+            $output | Should -Not -Match 'Goal & KPI'
+        }
+        finally {
+            if ($null -ne $stateBackup) {
+                Set-Content -Path $statePath -Value $stateBackup -Encoding UTF8
+            }
+        }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
It 'Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue #71)' {
$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 9\].*Dashboard'
$output | Should -Match 'Boot Summary'
}
It 'Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue `#71`)' {
$scriptPath = Join-Path $script:RepoRoot 'scripts\main\Start-ClaudeOS.ps1'
$statePath = Join-Path $script:RepoRoot 'state.json'
$stateBackup = if (Test-Path $statePath) { Get-Content $statePath -Raw -Encoding UTF8 } else { $null }
try {
Remove-Item $statePath -Force -ErrorAction SilentlyContinue
$output = & $script:PowerShellExe -NoProfile -File $scriptPath -NonInteractive 2>&1 | Out-String
$LASTEXITCODE | Should -Be 0
$output | Should -Match '\[Step 9\].*Dashboard'
$output | Should -Match 'Boot Summary'
$output | Should -Not -Match 'Goal & KPI'
}
finally {
if ($null -ne $stateBackup) {
Set-Content -Path $statePath -Value $stateBackup -Encoding UTF8
}
}
}
🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)

[warning] Missing BOM encoding for non-ASCII encoded file 'StartScripts.Tests.ps1'

(PSUseBOMForUnicodeEncodedFile)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/StartScripts.Tests.ps1` around lines 219 - 225, The test block
"Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue `#71`)"
does not ensure state.json is absent; update this It test to explicitly back up
and remove any existing state.json before invoking Start-ClaudeOS.ps1 and
restore the original file after the test (use a temp backup filename), so the
fallback path is exercised; reference the test's local variables ($scriptPath,
$output) and ensure cleanup runs even on failure (use Finally/try/finally
pattern or AfterEach-equivalent) to guarantee restoration.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
scripts/main/Start-ClaudeOS.ps1 (1)

285-294: ⚠️ Potential issue | 🟠 Major

Token Budget の Remaining に % を付けると値の意味が変わります

remaining は残量の実数として扱っているため、% サフィックスは誤解を招きます。表示を実数のままにするか、割合を別計算して別項目で出してください。

修正例
-                Write-Host ("    Used/Total: {0}/{1}  Remaining: {2}%" -f $used, $total, $remaining) -ForegroundColor White
+                Write-Host ("    Used/Total: {0}/{1}  Remaining: {2}" -f $used, $total, $remaining) -ForegroundColor White
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/main/Start-ClaudeOS.ps1` around lines 285 - 294, The Remaining value
is shown with a '%' suffix but $tok.remaining is a raw quantity, so update the
display in Start-ClaudeOS.ps1 (the block referencing $state.token, $tok,
$remaining) to remove the percent sign and show the raw remaining value, or
alternatively compute a proper percentage (e.g., remaining/total) and display
that as a separate "Remaining (%)" field; modify the Write-Host call that
formats "Used/Total: {0}/{1}  Remaining: {2}%" to either drop the "%" from the
Remaining placeholder or add an extra formatted field for the computed
percentage using $tok.remaining and $tok.total_budget.
tests/StartScripts.Tests.ps1 (1)

219-225: ⚠️ Potential issue | 🟠 Major

state.json 不在テストが不在条件を保証できていません

このままだとリポジトリ直下に既存 state.json がある環境で、フォールバック経路を検証できません。テスト内で明示的に退避・削除し、finally で復元してください。

修正例
 It 'Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue `#71`)' {
     $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 9\].*Dashboard'
-    $output | Should -Match 'Boot Summary'
+    $statePath = Join-Path $script:RepoRoot 'state.json'
+    $stateBackup = if (Test-Path $statePath) { Get-Content $statePath -Raw -Encoding UTF8 } else { $null }
+    try {
+        Remove-Item $statePath -Force -ErrorAction SilentlyContinue
+        $output = & $script:PowerShellExe -NoProfile -File $scriptPath -NonInteractive 2>&1 | Out-String
+        $LASTEXITCODE | Should -Be 0
+        $output | Should -Match '\[Step 9\].*Dashboard'
+        $output | Should -Match 'Boot Summary'
+        $output | Should -Not -Match 'Goal & KPI'
+    }
+    finally {
+        if ($null -ne $stateBackup) {
+            Set-Content -Path $statePath -Value $stateBackup -Encoding UTF8
+        }
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/StartScripts.Tests.ps1` around lines 219 - 225, The test
"Start-ClaudeOS.ps1 の Step 9 Dashboard が state.json なしでも正常終了すること (Issue `#71`)"
does not ensure state.json is absent; update the test to explicitly detect and
move/rename any existing state.json under $script:RepoRoot (or $scriptPath's
expected directory) before invoking Start-ClaudeOS.ps1, then delete the moved
file so the script runs without state.json, and finally restore the original
file in a finally/clean-up block so the environment is returned to its prior
state; reference the test block name and the $script:RepoRoot/$scriptPath
variables to locate where to add the backup/remove/restore logic.
🧹 Nitpick comments (1)
scripts/main/Start-ClaudeOS.ps1 (1)

230-235: state.json パース失敗時は警告を出した方が運用しやすいです

現在は失敗理由が消えるため、state.json 破損時の切り分けが難しくなります。軽い WARN 出力を追加するのを推奨します。

Based on learnings: state.json must contain project goals, KPI targets, execution time limits, and serve as the single source of truth.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/main/Start-ClaudeOS.ps1` around lines 230 - 235, When parsing
state.json fails in the try/catch around Get-Content $statePath |
ConvertFrom-Json, add a warning log in the catch block that includes the
$statePath and the caught error details ($_ or $_.Exception.Message) so
operators can triage corrupted state files; keep returning $null after logging.
Target the catch adjacent to Get-Content/ConvertFrom-Json and use a lightweight
warning (e.g., Write-Warning or the script's existing logging helper) rather
than terminating execution.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@scripts/main/Start-ClaudeOS.ps1`:
- Around line 285-294: The Remaining value is shown with a '%' suffix but
$tok.remaining is a raw quantity, so update the display in Start-ClaudeOS.ps1
(the block referencing $state.token, $tok, $remaining) to remove the percent
sign and show the raw remaining value, or alternatively compute a proper
percentage (e.g., remaining/total) and display that as a separate "Remaining
(%)" field; modify the Write-Host call that formats "Used/Total: {0}/{1} 
Remaining: {2}%" to either drop the "%" from the Remaining placeholder or add an
extra formatted field for the computed percentage using $tok.remaining and
$tok.total_budget.

In `@tests/StartScripts.Tests.ps1`:
- Around line 219-225: The test "Start-ClaudeOS.ps1 の Step 9 Dashboard が
state.json なしでも正常終了すること (Issue `#71`)" does not ensure state.json is absent;
update the test to explicitly detect and move/rename any existing state.json
under $script:RepoRoot (or $scriptPath's expected directory) before invoking
Start-ClaudeOS.ps1, then delete the moved file so the script runs without
state.json, and finally restore the original file in a finally/clean-up block so
the environment is returned to its prior state; reference the test block name
and the $script:RepoRoot/$scriptPath variables to locate where to add the
backup/remove/restore logic.

---

Nitpick comments:
In `@scripts/main/Start-ClaudeOS.ps1`:
- Around line 230-235: When parsing state.json fails in the try/catch around
Get-Content $statePath | ConvertFrom-Json, add a warning log in the catch block
that includes the $statePath and the caught error details ($_ or
$_.Exception.Message) so operators can triage corrupted state files; keep
returning $null after logging. Target the catch adjacent to
Get-Content/ConvertFrom-Json and use a lightweight warning (e.g., Write-Warning
or the script's existing logging helper) rather than terminating execution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f66d9276-70d1-4bb8-bfca-1b4c8570ed3f

📥 Commits

Reviewing files that changed from the base of the PR and between 2f8ec17 and 8be433f.

📒 Files selected for processing (2)
  • scripts/main/Start-ClaudeOS.ps1
  • tests/StartScripts.Tests.ps1
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test-and-validate
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:37.774Z
Learning: Applies to Claude/templates/claude/**/state.json : Maintain state.json with goal, kpi, execution, and automation configuration as the single source of truth for autonomous development targets
📚 Learning: 2026-04-14T02:12:37.774Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:37.774Z
Learning: Applies to Claude/templates/claude/**/state.json : Maintain state.json with goal, kpi, execution, and automation configuration as the single source of truth for autonomous development targets

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
📚 Learning: 2026-04-14T02:45:17.067Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-14T02:45:17.067Z
Learning: Applies to state.json : state.json must contain project goals, KPI targets, execution time limits, and automation settings. This file serves as the single source of truth for Goal Driven System operations. Structure must include: goal.title, kpi.success_rate_target, execution.max_duration_minutes, and automation flags.

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
📚 Learning: 2026-04-14T02:45:17.067Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-14T02:45:17.067Z
Learning: Enforce Goal Driven System: state.json is the single source of truth for project goals. Issues are tools to achieve goals, not ends themselves. Auto-generate Issues when KPI targets are not met. Suppress P3 issues if P1 issues remain unsolved.

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
📚 Learning: 2026-04-14T02:12:37.774Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:37.774Z
Learning: Use Goal Driven System with state.json as the single objective reference - generate issues as means to achieve goals, auto-generate issues when KPI is unmet, and suppress large changes when goals are undefined

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
📚 Learning: 2026-04-14T02:12:54.820Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T02:12:54.820Z
Learning: Applies to state.json : Store remaining time management in state.json to track time budget across execution phases

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
📚 Learning: 2026-04-14T02:45:17.067Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-14T02:45:17.067Z
Learning: Apply strict token budgeting across phases: Monitor 10%, Development 35%, Verify 20%, Improvement 10%, Debug 15%, IssueFactory 5%, Release 5%. Respond to consumption rates: at 70% stop Improvement, at 85% prioritize Verify, at 95% enable safe shutdown.

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
📚 Learning: 2026-04-14T02:13:12.468Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: docs/codex/AGENTS.md:0-0
Timestamp: 2026-04-14T02:13:12.468Z
Learning: Skip Improve phase when token usage reaches 70%; run Verify only at 85%; halt immediately at 95%

Applied to files:

  • scripts/main/Start-ClaudeOS.ps1
🪛 PSScriptAnalyzer (1.25.0)
tests/StartScripts.Tests.ps1

[warning] Missing BOM encoding for non-ASCII encoded file 'StartScripts.Tests.ps1'

(PSUseBOMForUnicodeEncodedFile)

scripts/main/Start-ClaudeOS.ps1

[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)


[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)


[warning] Missing BOM encoding for non-ASCII encoded file 'Start-ClaudeOS.ps1'

(PSUseBOMForUnicodeEncodedFile)

🔇 Additional comments (2)
scripts/main/Start-ClaudeOS.ps1 (1)

224-236: state.json 読み込みのフェイルセーフ実装は適切です

ファイル不存在や JSON 例外時に $null へフォールバックする実装で、ブート全体を止めない設計になっている点は良いです。

tests/StartScripts.Tests.ps1 (1)

227-251: state.json ありケースのテスト隔離は適切です

try/finally で復元/削除しており、テスト間汚染を防げています。

@Kensan196948G
Kensan196948G merged commit e3f38ef into main Apr 14, 2026
3 checks passed
Kensan196948G added a commit that referenced this pull request Apr 14, 2026
v2.9.0 セクションを `[v2.9.0-dev] - 2026-04-08` から `[v2.9.0] - 2026-04-14 (STABLE)` に更新し、
ClaudeOS v7.5 の全成果 (Boot Sequence Step 3/7/9 完全実装、CodeRabbit 統合、
/team-onboarding、ループ時間最適化、Issue Sync 修正) を反映。

新規に `[v3.0.0] - Unreleased` セクションを追加し、Phase 4 残タスク
(セキュリティ監査 / E2E テスト / リリースタグ) と Go/No-Go 基準を明文化。

- テスト数: 304 → 311 件に更新
- 追加 PR: #77, #79, #80, #81, #82, #83, #84, #86, #87, #88, #89

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Kensan196948G added a commit that referenced this pull request Apr 14, 2026
v2.9.0 セクションを `[v2.9.0-dev] - 2026-04-08` から `[v2.9.0] - 2026-04-14 (STABLE)` に更新し、
ClaudeOS v7.5 の全成果 (Boot Sequence Step 3/7/9 完全実装、CodeRabbit 統合、
/team-onboarding、ループ時間最適化、Issue Sync 修正) を反映。

新規に `[v3.0.0] - Unreleased` セクションを追加し、Phase 4 残タスク
(セキュリティ監査 / E2E テスト / リリースタグ) と Go/No-Go 基準を明文化。

- テスト数: 304 → 311 件に更新
- 追加 PR: #77, #79, #80, #81, #82, #83, #84, #86, #87, #88, #89

Co-authored-by: 有藤 健太郎 <k-aritoh@mirai-const.co.jp>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 3: 開発ダッシュボード UI

2 participants