fix(pc-audit): 概要を2カラムグリッドに変更、全体幅をフル幅に修正

viewer: .summary-grid を2カラムに。PC名のみ全幅(grid-column span)。
max-width 制限を撤廃し右余白を解消。

PS1: 管理者判定を net localgroup フォールバック含む3段階に強化。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
posimai 2026-04-21 12:48:34 +09:00
parent d36b7a8fe4
commit 01d4ee926a
2 changed files with 38 additions and 9 deletions

View File

@ -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"

View File

@ -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 = '<div class="summary-grid">';
items.forEach(function (it) {
html += '<div class="metric"><div class="metric-label">' + esc(it.label) + '</div><div class="metric-value">' + esc(it.value) + '</div></div>';
var full = (it.label === "PC 名" || it.label === "モード") ? ' full' : '';
html += '<div class="metric' + full + '"><div class="metric-label">' + esc(it.label) + '</div><div class="metric-value">' + esc(it.value) + '</div></div>';
});
html += '</div>';
document.getElementById("summary").innerHTML = html;