Deepgrain Foundry: move from a claude.ai artifact to a local repository
The game as of artifact version 24, ready for local development with coding agents. - Source split from three large files into 52 small ones under src/sim, src/render and src/ui, joined in the order in src/manifest.json by build.py. The joined code is unchanged apart from comments; every headless suite gives the same output, and screenshots in both looks are pixel-identical to before. - Light tidying with no change in behaviour: one movement scan loop, shared hazard-stripe and belt shader helpers, unused code removed, a shared check helper for the test suites. - World files can be exported as an ordinary download outside claude.ai. - Tests: broken old scripts removed, experiments moved to tools/, test/run_all.py added. Tools: shot.py (repeatable screenshots), where.py, map.py. - Docs: AGENTS.md, CLAUDE.md, NOTES.md (the owner's to-do inbox), docs/PROJECT_MAP.md, DESIGN.md, TESTING.md, systems notes, the owner's requests and an agent log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K9kLmYADKSEjuwUN3rFxDA
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Turn a line number in dist/index.html into the source file and line it came from.
|
||||
|
||||
python3 tools/where.py 4211 -> src/sim/pipes.js:57
|
||||
python3 tools/where.py < error.txt -> the text with every index.html:LINE rewritten
|
||||
|
||||
Browser errors point into the built page. build.py writes dist/bundle-lines.json, which says where
|
||||
each source file starts in it. Rebuild first if the sources changed since the error.
|
||||
"""
|
||||
import json, pathlib, re, sys
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def load():
|
||||
return json.loads((ROOT / 'dist' / 'bundle-lines.json').read_text())['files']
|
||||
|
||||
|
||||
def where(line, files=None):
|
||||
files = files or load()
|
||||
best = None
|
||||
for start, f in files:
|
||||
if start <= line: best = (start, f)
|
||||
else: break
|
||||
return f'src/{best[1]}:{line - best[0] + 1}' if best else f'index.html:{line} (before the script)'
|
||||
|
||||
|
||||
def translate(text, files=None):
|
||||
files = files or load()
|
||||
return re.sub(r'(?:file://)?[^\s()]*index\.html:(\d+)(:\d+)?', lambda m: where(int(m.group(1)), files) + (m.group(2) or ''), text)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1:
|
||||
for a in sys.argv[1:]: print(where(int(a)))
|
||||
else:
|
||||
print(translate(sys.stdin.read()), end='')
|
||||
Reference in New Issue
Block a user