incremental_probe.py¶
scripts/incremental_probe.py
Feasibility measurements for incremental doxygen regeneration (task #483).
main
int incremental_probe.main()
Entry point.
scripts/incremental_probe.py:913
Source · 58 lines
def main() -> int:
"""@brief Entry point.
@return Exit status.
@version 1
"""
parser = argparse.ArgumentParser(description=__doc__)
## DERIVED, NEVER BAKED IN. This shipped with one machine's target slug
## (`docs-db-57bf14`) hardcoded, which is both a footgun — `autorefresh` builds against
## whatever that path names, i.e. the operator's LIVE index — and a violation of this
## repo's own no-hardcoding rule. The slug is a function of the repo path, so ask for it.
from clew.mcp_server.state import TargetRegistry, target_for
_target = target_for(REPO, TargetRegistry().home)
default_db = Path(_target.db_path)
default_doxyfile = default_db.parent / "clew.doxygen" / "Doxyfile.synth"
parser.add_argument("--db", default=str(default_db))
parser.add_argument("--doxyfile", default=str(default_doxyfile))
parser.add_argument("--repo", default=str(REPO))
parser.add_argument("--file", default="clew/mcp_server/tools_query.py")
sub = parser.add_subparsers(dest="cmd", required=True)
sub.add_parser("subset", help="doxygen cost versus input size")
sub.add_parser("closure", help="one-hop xref closure per file")
sub.add_parser("outbound", help="outbound xref loss under a subset run")
sub.add_parser("refids", help="refid stability across input sets")
sub.add_parser("autorefresh", help="drive the MCP auto-refresh hook in-process")
sub.add_parser("control", help="two full builds of one unmodified tree (noise floor)")
cmp_p = sub.add_parser(
"compare", help="incremental refresh versus a full rebuild of the same tree"
)
cmp_p.add_argument("--edit-file", required=True, help="repo-relative file to append to")
cmp_p.add_argument(
"--append-text", required=True, help="text to append, introducing a cross-file call"
)
cmp_p.add_argument(
"--include-line",
default="",
help="an #include to insert after the file's last one, making the new call legal C/C++",
)
fc_p = sub.add_parser("fastcompare", help="fast tier (an added function) versus full builds")
fc_p.add_argument(
"--edit-file", required=True, help="repo-relative file to append a function to"
)
fc_p.add_argument(
"--append-text", required=True, help="the function's source (\\n escapes allowed)"
)
args = parser.parse_args()
return {
"subset": cmd_subset,
"closure": cmd_closure,
"outbound": cmd_outbound,
"refids": cmd_refids,
"autorefresh": cmd_autorefresh,
"compare": cmd_compare,
"control": cmd_control,
"fastcompare": cmd_fastcompare,
}[args.cmd](args)