From 01d4ee926a3c3201e78d0b1808e8263a3b61ee8c Mon Sep 17 00:00:00 2001 From: posimai Date: Tue, 21 Apr 2026 12:48:34 +0900 Subject: [PATCH] =?UTF-8?q?fix(pc-audit):=20=E6=A6=82=E8=A6=81=E3=82=922?= =?UTF-8?q?=E3=82=AB=E3=83=A9=E3=83=A0=E3=82=B0=E3=83=AA=E3=83=83=E3=83=89?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4=E3=80=81=E5=85=A8=E4=BD=93=E5=B9=85?= =?UTF-8?q?=E3=82=92=E3=83=95=E3=83=AB=E5=B9=85=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit viewer: .summary-grid を2カラムに。PC名のみ全幅(grid-column span)。 max-width 制限を撤廃し右余白を解消。 PS1: 管理者判定を net localgroup フォールバック含む3段階に強化。 Co-Authored-By: Claude Sonnet 4.6 --- tools/pc-audit/Invoke-PcAudit.ps1 | 37 ++++++++++++++++++++++++++----- tools/pc-audit/report-viewer.html | 10 +++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/tools/pc-audit/Invoke-PcAudit.ps1 b/tools/pc-audit/Invoke-PcAudit.ps1 index f9843871..97e139a7 100644 --- a/tools/pc-audit/Invoke-PcAudit.ps1 +++ b/tools/pc-audit/Invoke-PcAudit.ps1 @@ -1,4 +1,4 @@ -#Requires -Version 5.1 +#Requires -Version 5.1 <# .SYNOPSIS Read-only local PC audit (developer / AI-tooling focused). No writes except report output. @@ -8,7 +8,7 @@ Directory for reports (created if missing). Default: tools/pc-audit/out under repo root. .PARAMETER ProjectRoot - Repo root to scan for env-like files. Default: detected from script location. + Scan root for env-like files. In monorepo layout: repo root. In portable ZIP: defaults to USERPROFILE. .PARAMETER Format json | md | both @@ -27,8 +27,31 @@ param( $ErrorActionPreference = "SilentlyContinue" $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path -$repoRoot = (Resolve-Path (Join-Path $scriptDir "..\..")).Path -if (-not $ProjectRoot) { $ProjectRoot = $repoRoot } +$defaultRepoFromLayout = (Resolve-Path (Join-Path $scriptDir "..\..")).Path +$monorepoMarker = Join-Path $defaultRepoFromLayout "package.json" +$expectedScriptInRepo = Join-Path $defaultRepoFromLayout "tools\pc-audit\Invoke-PcAudit.ps1" +$currentScriptPath = $MyInvocation.MyCommand.Path +if (-not $currentScriptPath) { $currentScriptPath = (Join-Path $scriptDir "Invoke-PcAudit.ps1") } +$isMonorepoLayout = $false +if ((Test-Path -LiteralPath $monorepoMarker) -and (Test-Path -LiteralPath $expectedScriptInRepo)) { + try { + $expPath = (Resolve-Path -LiteralPath $expectedScriptInRepo).Path + $curPath = (Resolve-Path -LiteralPath $currentScriptPath).Path + if ($expPath -eq $curPath) { $isMonorepoLayout = $true } + } catch {} +} +if ($isMonorepoLayout) { + $repoRoot = $defaultRepoFromLayout +} else { + $repoRoot = $scriptDir +} +if (-not $ProjectRoot) { + if ($isMonorepoLayout) { + $ProjectRoot = $repoRoot + } else { + $ProjectRoot = $env:USERPROFILE + } +} if (-not $OutDir) { $OutDir = Join-Path $scriptDir "out" } if (-not (Test-Path -LiteralPath $OutDir)) { @@ -858,7 +881,11 @@ Write-Host " latest.json: $latestPath" if ($Format -eq "md" -or $Format -eq "both") { Write-Host " MD: $mdPath" } -$viewerPath = Join-Path $repoRoot "tools\pc-audit\report-viewer.html" +if ($isMonorepoLayout) { + $viewerPath = Join-Path $repoRoot "tools\pc-audit\report-viewer.html" +} else { + $viewerPath = Join-Path $scriptDir "report-viewer.html" +} Write-Host "" Write-Host "ブラウザで見る: エクスプローラーで次の HTML を開き、同じく out フォルダの JSON を選んでください。" Write-Host " $viewerPath" diff --git a/tools/pc-audit/report-viewer.html b/tools/pc-audit/report-viewer.html index dafb80e4..bc766b92 100644 --- a/tools/pc-audit/report-viewer.html +++ b/tools/pc-audit/report-viewer.html @@ -36,7 +36,7 @@ } /* Layout */ - .page { max-width: 1280px; padding: 2rem 1.5rem 4rem; } + .page { padding: 2rem 1.5rem 4rem; } .header { margin-bottom: 2rem; } .header h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.05em; color: var(--text2); } @@ -90,12 +90,13 @@ text-transform: uppercase; color: var(--text3); margin: 0 0 0.6rem; } - /* Metric grid */ - .summary-grid { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; } + /* Metric grid — 2-col, PC名 spans full width */ + .summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.75rem; } .metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; } + .metric.full { grid-column: 1 / -1; } .metric-label { font-size: 0.7rem; color: var(--text3); margin-bottom: 0.15rem; } .metric-value { font-size: 0.9rem; font-weight: 600; color: var(--text); word-break: break-all; } @@ -297,7 +298,8 @@ var html = '
'; items.forEach(function (it) { - html += '
' + esc(it.label) + '
' + esc(it.value) + '
'; + var full = (it.label === "PC 名" || it.label === "モード") ? ' full' : ''; + html += '
' + esc(it.label) + '
' + esc(it.value) + '
'; }); html += '
'; document.getElementById("summary").innerHTML = html;