lmprobe guide

AST-aware sensor architecture, preview-first editing, GraphQL composition, 63-operation lmcode host catalog, and standard lmcode_std_v3 interfaces in lmprobe.

Overview

lmprobe is a structural code intelligence and refactoring tool built in Rust on top of a fork of ast-grep. It exposes its 63 repository sensors and mutators through three unified surfaces: direct CLI subcommands (--json), a composable GraphQL query engine (--infile), and a native lmcode bytecode host (--lmcode).

Structural code navigation and impact analysis

Unlike line-oriented grep, lmprobe parses source files into syntax trees to resolve symbol definitions (def), references (ref), symbol search (search), callers (callers), callees (callees), subtype/supertype hierarchies, method overrides, imports, exports, and decorators/annotations (decorations). The impact and context commands assemble transitive call-graph slices and token-budgeted context bundles around target symbols or diffs.

Git history, specialized scanners, and read-only AWS queries

Beyond live working-tree ASTs, lmprobe integrates three domain sensor layers:

Preview-first text and AST mutations

The edit (line, word, regex capture, prefix/suffix, and JSON script text edits), fix (ast-grep structural pattern rewrites), commands always run in dry-run preview mode unless --apply is supplied, and delete previews unless --force is supplied. When --apply is given, lmprobe verifies that target files reside in a clean Git working tree (unless --force is also passed) and records recovery backups prior to modifying files.

The 63-operation lmcode host and standard REST/CLI interfaces

Inside an _lmcode_ block, lmprobe registers 63 probe_<operation>(string) -> string functions alongside all 226 canonical lmcode_std_v3 signatures (RestGet..RestOptions, RestHandler, CliCommand, CliOption, :param and {param} route templates, rest_config, rest_route, rest_serve, rest_stop, and rest_cli). Handlers can compose multiple repository sensors and return consolidated JSON reports.

program = _lmcode_ cli="lmprobe";
@"--repo"
fn opt_repo(x: RestExchange) -> void implements CliOption {
  x.set("repo", x.query("repo"));
}

@"status"
fn cmd_status(x: RestExchange) -> void implements CliCommand {
  let raw = probe_git_status("{\"repo\":\"" + x.get("repo") + "\"}");
  x.json(raw);
}

@"/symbols/:name"
fn get_def(x: RestExchange) -> void implements RestGet {
  let raw = probe_def_symbol("{\"name\":\"" + x.param("name") + "\"}");
  x.json(raw);
}

rest_config("session", "global");
print(rest_cli(str_split("--repo=. status", " ")));
end _lmcode_