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
84 changes: 83 additions & 1 deletion docs/playtest/manual-playtest-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,90 @@ This regenerates `pnpm-lock.yaml`. If the issue persists, check if you are in th

---

## GitHub Pages / PR Preview での証跡採取手順 (Evidence Panel)

### Evidence Panel の有効化

GitHub Pages または PR Preview の URL に `?playtest_evidence=1` クエリパラメータを付けてアクセスします。

```
# main URL の例
https://squne121.github.io/loop-protocol/?playtest_evidence=1

# PR Preview の例(PR #123)
https://squne121.github.io/loop-protocol/pr-123/?playtest_evidence=1
```

クエリパラメータなしでアクセスした場合、Evidence Panel は表示されません(opt-in 設計)。

### Evidence Panel の操作手順

1. 上記 URL をブラウザで開きます。
2. 画面右上に **Playtest Evidence Panel** が表示されます。
3. YAML データがテキストエリアに自動生成されます。

#### Copy YAML to Clipboard

- **Copy YAML to Clipboard** ボタンをクリックすると YAML がクリップボードにコピーされます。
- ボタンが「Copied!」に変わったらコピー成功です。
- Clipboard API が利用できない場合は「Use textarea to copy manually」と表示されます。その場合はテキストエリアを手動で選択してコピーしてください。

#### Download YAML

- **Download YAML** ボタンをクリックすると `loop-protocol-playtest-evidence-<ISO8601>.yaml` という名前のファイルがダウンロードされます。
- ダウンロードしたファイルをローカルで確認・保管できます。

### PR コメントへの証跡添付 workflow

1. Evidence Panel の YAML を Copy または Download で取得します。
2. 対象 PR の「Conversation」タブを開きます。
3. コメントボックスに以下の形式で貼り付けます。

````markdown
## Playtest Evidence

```yaml
# ここに YAML を貼り付ける
playtest_evidence_schema_version: v1
generated_at: "2026-06-03T..."
...
```
````

4. 必要に応じてスクリーンショットや動画ファイルを添付します。

### ローカル環境メタデータ採取(CLI)

GitHub Pages を使わずローカルでビルドした場合は、CLI スクリプトで環境メタデータを採取できます。

```bash
# YAML 出力(デフォルト)
node scripts/collect-playtest-env.mjs

# JSON 出力
node scripts/collect-playtest-env.mjs --json
```

出力例(YAML):

```yaml
# Loop Protocol — Playtest Environment Metadata (AC1)

executed_at: 2026-06-03T10:00:00.000Z
tested_commit: aef9a0a...
node_version: v22.3.0
pnpm_version: 10.x.x
platform: linux
os_type: Linux
os_release: 6.6.x
arch: x64
```

---

## Reference

- Playtest log: `docs/playtest/m2-combat-mvp.md`
- Preflight script: `scripts/check-manual-playtest-env.mjs`
- Issue: #561 (this runbook), #543 (human manual playtest requirement)
- CLI 証跡採取: `scripts/collect-playtest-env.mjs`
- Issue: #561 (this runbook), #543 (human manual playtest requirement), #571 (evidence panel)
105 changes: 105 additions & 0 deletions scripts/collect-playtest-env.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env node
/**
* collect-playtest-env.mjs
*
* ローカル CLI 用のプレイテスト環境メタデータ採取スクリプト (AC1)
*
* Usage:
* node scripts/collect-playtest-env.mjs # YAML 出力 (デフォルト)
* node scripts/collect-playtest-env.mjs --json # JSON 出力
*
* 出力項目:
* - executed_at (ISO 8601)
* - tested_commit (git rev-parse HEAD)
* - node_version
* - pnpm_version
* - platform / os
*/

import { execSync } from 'node:child_process'
import os from 'node:os'
import process from 'node:process'

// ---------------------------------------------------------------------------
// Collect
// ---------------------------------------------------------------------------

function tryExec(cmd) {
try {
return execSync(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim()
} catch {
return null
}
}

function collectEnv() {
const executed_at = new Date().toISOString()

const tested_commit =
tryExec('git rev-parse HEAD') ??
tryExec('git rev-parse --short HEAD') ??
'unknown'

const commit_unknown_reason =
tested_commit === 'unknown' ? 'git rev-parse HEAD が失敗しました(git リポジトリ外または git 未インストール)' : undefined

const node_version = process.version

const pnpm_version = tryExec('pnpm --version') ?? 'unknown'

const platform = os.platform()
const os_release = os.release()
const os_type = os.type()
const arch = os.arch()

return {
executed_at,
tested_commit,
...(commit_unknown_reason ? { commit_unknown_reason } : {}),
node_version,
pnpm_version,
platform,
os_type,
os_release,
arch,
}
}

// ---------------------------------------------------------------------------
// Output
// ---------------------------------------------------------------------------

function toYamlLine(key, val, indent = 0) {
const pad = ' '.repeat(indent)
if (val === null || val === undefined) return `${pad}${key}: null`
if (typeof val === 'string') {
if (val.includes(':') || val.includes('#') || val.includes('\n')) {
return `${pad}${key}: "${val.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n')}"`
}
return `${pad}${key}: ${val}`
}
return `${pad}${key}: ${val}`
}

function toYaml(data) {
const lines = ['# Loop Protocol — Playtest Environment Metadata (AC1)', '']
for (const [k, v] of Object.entries(data)) {
lines.push(toYamlLine(k, v))
}
return lines.join('\n') + '\n'
}

// ---------------------------------------------------------------------------
// Main
// ---------------------------------------------------------------------------

const args = process.argv.slice(2)
const useJson = args.includes('--json')

const data = collectEnv()

if (useJson) {
process.stdout.write(JSON.stringify(data, null, 2) + '\n')
} else {
process.stdout.write(toYaml(data))
}
4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './style.css'

import { initPlaytestEvidencePanel } from './ui/playtestEvidence'
import { bindInput, createInputState, mapInputToCommands } from './input'
import { createCanvasRenderer } from './render'
import {
Expand Down Expand Up @@ -38,6 +39,9 @@ app.innerHTML = `
</div>
`

// AC2: opt-in evidence panel — visible only when ?playtest_evidence=1
initPlaytestEvidencePanel(document.body, window.location.search)

const canvas = app.querySelector<HTMLCanvasElement>('.battle-stage__canvas')
const commandRail = app.querySelector<HTMLElement>('.command-rail')

Expand Down
Loading
Loading