forked from Keelrleek/Harbor
Add shared reverse-engineering lookups (re_disassemble, re_xrefs, re_bytes, re_lookup)
Read the project's flat image, facts.jsonl and annotations with the team's current names; exposed as MCP tools and as 'harbor re'. Configured by a [reverse] table in the project file.
This commit is contained in:
1 parent
dbc0c45ef2
commit
3f6df88f95
5 files changed
+410
-2
No files matched your search
@@ -254,6 +254,12 @@ def build_parser():
|
||||
p.add_argument("--file")
|
||||
p = sub.add_parser("who", help="who has worked on a scope (notes, reviews, claims, messages)")
|
||||
p.add_argument("scope")
|
||||
p = sub.add_parser("re", help="reverse-engineering lookups from the project's image and annotations")
|
||||
p.add_argument("action", choices=["disasm", "xrefs", "bytes", "lookup"])
|
||||
p.add_argument("target", help="an address (0x4AD850) or a name")
|
||||
p.add_argument("--max-bytes", type=int, dest="max_bytes")
|
||||
p.add_argument("--count", type=int, default=16)
|
||||
p.add_argument("--as", dest="as_type", default="hex", choices=["hex", "int32", "uint32", "float", "double", "string"])
|
||||
p = sub.add_parser("feed", help="the latest tool calls of the team (or one agent), from the hooks")
|
||||
p.add_argument("--agent", dest="filter_agent")
|
||||
p.add_argument("--limit", type=int, default=30)
|
||||
@@ -666,6 +672,21 @@ def main(argv=None):
|
||||
text = Path(args.file).read_text(encoding="utf-8") if args.file else " ".join(args.text)
|
||||
r = harbor.summarize(who(), args.thread, text)
|
||||
out(r, f"summary #{r['id']} pinned to {r['thread']}")
|
||||
elif cmd == "re":
|
||||
from .reverse import Reverse
|
||||
r = Reverse(harbor.project.reverse)
|
||||
if args.action == "disasm":
|
||||
text = r.disassemble(args.target, args.max_bytes)
|
||||
out({"disassembly": text}, text)
|
||||
elif args.action == "xrefs":
|
||||
res = r.xrefs(args.target)
|
||||
out(res, json.dumps(res, indent=1))
|
||||
elif args.action == "bytes":
|
||||
res = r.bytes_at(args.target, args.count, args.as_type)
|
||||
out(res, json.dumps(res, indent=1))
|
||||
else:
|
||||
res = r.lookup(args.target)
|
||||
out(res, json.dumps(res, indent=1))
|
||||
elif cmd == "who":
|
||||
rows = harbor.experts(args.scope)
|
||||
out(rows, "\n".join(f"{e['agent']:<9} " + ", ".join(f"{v} {k}" for k, v in e["detail"].items()) for e in rows)
|
||||
|
||||
Reference in new issue
Block a user