Files
isaac-port/notes/_tools/fbtools/doc_add.py
T
shweetandClaude Opus 5.5 ad8f933086 Salvage Repentance+ 1.9.7.17 decompilation toolkit, notes and name database
Ghidra 12.2 project and full dump of isaac-ng.exe v1.9.7.17, query scripts, notes
indexed by entity, anm2/rooms reimplementations, and db/ (names + fields) that
build.sh re-applies. Fixes awk numeric address comparison in find.sh/decompile.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:08:19 -04:00

17 lines
793 B
Python

"""doc_add.py AFTER_SUFFIX NEW_SUFFIX TEXT: after every docs/fields line whose key ends with AFTER_SUFFIX, a line for the
sibling key ending NEW_SUFFIX (run from the repository root)."""
import glob, json, sys
after, new, text = sys.argv[1:4]
for p in glob.glob('docs/fields/*.json'):
lines = open(p).read().split('\n'); out = []; n = 0
for l in lines:
out.append(l)
k = l.strip().split('"')[1] if l.strip().startswith('"') else ''
if k.endswith(after):
key = k[:-len(after)] + new
if f'"{key}"' not in ''.join(lines):
out.append(l[:len(l) - len(l.lstrip())] + json.dumps(key) + ': ' + json.dumps(text) + ',')
n += 1
if n:
s = '\n'.join(out); json.loads(s); open(p, 'w').write(s); print(p, n)