From 6d7f2a4ed4ef598580875c158857cb873d298a7b Mon Sep 17 00:00:00 2001 From: posimai Date: Tue, 21 Apr 2026 17:52:58 +0900 Subject: [PATCH] =?UTF-8?q?feat(pc-audit):=20AI=20=E7=9B=B8=E8=AB=87?= =?UTF-8?q?=E7=94=A8=E3=83=97=E3=83=AD=E3=83=B3=E3=83=97=E3=83=88=E3=82=B3?= =?UTF-8?q?=E3=83=94=E3=83=BC=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit チェック項目カラムに「AI 相談用にコピー」ボタンを追加。 PC情報(名前・管理者権限・UAC)+注意/情報チェック項目を Claude に貼り付けるだけで対処手順を聞けるプロンプトを生成する。 Co-Authored-By: Claude Sonnet 4.6 --- tools/pc-audit/report-viewer.html | 97 ++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/tools/pc-audit/report-viewer.html b/tools/pc-audit/report-viewer.html index 1e4c6772..cf2c43c5 100644 --- a/tools/pc-audit/report-viewer.html +++ b/tools/pc-audit/report-viewer.html @@ -148,8 +148,24 @@ .filter-row { flex-shrink: 0; display: flex; gap: 0.4rem; margin-bottom: 0.6rem; flex-wrap: wrap; + align-items: center; } + /* ── AI prompt copy button ── */ + .copy-prompt-btn { + margin-left: auto; + font-size: 0.68rem; font-weight: 600; + padding: 0.2rem 0.65rem; + border-radius: 99px; + border: 1px solid var(--border); + background: transparent; color: var(--text3); + cursor: pointer; + transition: border-color 0.12s, color 0.12s, background 0.12s; + white-space: nowrap; + } + .copy-prompt-btn:hover { border-color: var(--accent); color: var(--accent); } + .copy-prompt-btn.copied { border-color: var(--ok-color); color: var(--ok-color); } + /* ── Scrollable area inside each column ── */ .scroll-pane { flex: 1; @@ -323,7 +339,9 @@
チェック項目
-
+
+ +
@@ -638,6 +656,7 @@ /* Load data */ /* ------------------------------------------------------------------ */ function loadData(data) { + currentData = data; document.getElementById("upload-wrap").style.display = "none"; document.getElementById("alt-file-btn").style.display = ""; document.getElementById("output").style.display = "flex"; @@ -648,6 +667,82 @@ document.getElementById("raw").textContent = JSON.stringify(data, null, 2); } + /* ------------------------------------------------------------------ */ + /* AI prompt generation */ + /* ------------------------------------------------------------------ */ + var currentData = null; + + function buildAiPrompt(data) { + var uc = data.userContext || {}; + var m = data.machine || {}; + var uac = data.uac || {}; + var shareSafe = data.meta && data.meta.shareSafe; + var items = allGuidanceItems.filter(function(i) { + return (i.Level||'').toLowerCase() !== 'ok'; + }); + + var lines = []; + lines.push("以下は PC 監査ツール(Posimai PC Audit)の実行結果です。"); + lines.push("各チェック項目について、Windows での具体的な対処手順をコマンドや設定画面の操作手順を含めて教えてください。"); + lines.push(""); + lines.push("## PC 情報"); + lines.push("- PC 名: " + (m.Name || "不明")); + lines.push("- ユーザー: " + (uc.UserName || "不明")); + lines.push("- 管理者権限: " + (uc.IsAdmin === true ? "あり" : "なし")); + lines.push("- UAC (EnableLUA): " + (uac.EnableLUA != null ? String(uac.EnableLUA) : "不明")); + if (shareSafe) lines.push("- モード: ShareSafe(機微情報は省略済み)"); + lines.push(""); + + if (items.length === 0) { + lines.push("## チェック結果"); + lines.push("注意・情報レベルの指摘はありませんでした。"); + } else { + lines.push("## チェック結果(" + items.length + " 件)"); + items.forEach(function(item, idx) { + var level = (item.Level||'info').toLowerCase(); + var tag = level === 'warn' ? '[注意]' : '[情報]'; + lines.push(""); + lines.push("### " + (idx + 1) + ". " + tag + " " + (item.Title || "")); + if (item.Body) lines.push((item.Body || "").replace(/\n/g, " ")); + if (item.ActionJa) lines.push("推奨対処: " + item.ActionJa); + }); + } + + lines.push(""); + lines.push("---"); + lines.push("それぞれについて Windows での具体的な対処手順(PowerShell コマンドや設定画面の操作など)を教えてください。"); + return lines.join("\n"); + } + + document.addEventListener("DOMContentLoaded", function () { + var btn = document.getElementById("copy-prompt-btn"); + btn.addEventListener("click", function () { + if (!currentData) return; + var text = buildAiPrompt(currentData); + navigator.clipboard.writeText(text).then(function () { + btn.textContent = "コピーしました"; + btn.classList.add("copied"); + setTimeout(function () { + btn.textContent = "AI 相談用にコピー"; + btn.classList.remove("copied"); + }, 2000); + }).catch(function () { + var ta = document.createElement("textarea"); + ta.value = text; + ta.style.position = "fixed"; ta.style.opacity = "0"; + document.body.appendChild(ta); + ta.select(); document.execCommand("copy"); + document.body.removeChild(ta); + btn.textContent = "コピーしました"; + btn.classList.add("copied"); + setTimeout(function () { + btn.textContent = "AI 相談用にコピー"; + btn.classList.remove("copied"); + }, 2000); + }); + }); + }); + /* ------------------------------------------------------------------ */ /* Auto-load */ /* ------------------------------------------------------------------ */