Inspect checked source#
Use ms map --view inspect when you want a script or agent to work with declarations, types, and call sites from checked code. For reading the same program visually, use an interactive code map
.
Save a snapshot#
With hello.ms from Understanding effects
, run:
ms map --view inspect hello.ms -o inspection.jsonThe command succeeds silently and writes a format-2 JSON document. It checks source without running the program or linking an executable. The entities array contains this declaration (selected fields shown):
{
"id": "hello.ms#fn#main",
"kind": "fn",
"name": "main",
"type": "fn() Void",
"exported": false,
"effects": ["std.console.write"],
"reach": ["std.console.write"]
}Use the entity ID to follow calls: the call owned by hello.ms#fn#main targets @std/core.ms#fn#print. The JSON includes user-module entities only; standard-library targets appear as call targets so project snapshots stay focused.
Read positions and identities#
sourceslists source paths and SHA-256 hashes;build_ididentifies the checked source set. Keep the source snapshot with an inspection if you plan to revisit its positions later.- Entities have deterministic IDs, checked types, visibility, direct
effects, and transitivereach. Local bindings also carry checker identities and types. callsincludes explicit calls and implicit cleanup.statementsgives statement-header spans for navigation.- Spans use half-open
start/endbyte offsets in the original source, with one-based line and UTF-8 byte column. Statement-header ranges exclude line terminators. These are source positions, not machine-code addresses; CRLF files retain their original byte offsets.
Treat effect summaries as conservative descriptions of reachable behavior. Inspection does not execute branches, tests, or external operations.
Follow a running program instead#
Build with --build-type Debug when you want unoptimized code for stepping. Native builds keep frame pointers and DWARF metadata that map machine addresses back to .ms lines. See profiling and native debugging
to capture a profile or stop at a source line.