Skip to content

Commit 37ce8a3

Browse files
squne121claude
andcommitted
chore: track check_input_command_schema.py (ci integration pending #507)
Script was created during #461 contract review and excluded from PR #506. Added to version control ahead of CI integration in #507. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent ffab243 commit 37ce8a3

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Verify that docs/product/game-logic.md's InputCommand TypeScript code block
3+
matches the actual schema in src/input/InputMapper.ts.
4+
5+
Exit 0 on success, non-zero on failure.
6+
"""
7+
from pathlib import Path
8+
import re
9+
import sys
10+
11+
s = Path("docs/product/game-logic.md").read_text()
12+
m = re.search(r"## 入力 / Input.*?```typescript\n(.*?)```", s, re.S)
13+
if not m:
14+
raise SystemExit("InputCommand TypeScript block not found in ## 入力 / Input section")
15+
16+
block = m.group(1)
17+
normalized = re.sub(r"\s+", " ", block)
18+
19+
required = [
20+
"{ type: 'move'; axisX: number; axisY: number",
21+
"{ type: 'aim'; x: number; y: number",
22+
"{ type: 'fire'",
23+
]
24+
for token in required:
25+
if token not in normalized:
26+
raise SystemExit(f"missing required token: {token}")
27+
28+
for forbidden in [
29+
"MoveIntent", "AimIntent", "FireIntent",
30+
"IssueAllyCommandIntent", "PauseIntent",
31+
"direction: Vec2", "angle:",
32+
]:
33+
if forbidden in block:
34+
raise SystemExit(f"forbidden token remains in code block: {forbidden}")

0 commit comments

Comments
 (0)