Skip to main content
Mirage runs the ast-grep 0.51.3 Rust engine on JavaScript, JSX, TypeScript, TSX and Python. It loads project configuration, rules and source files through the session’s VFS. Rewrites use the same write permissions as other shell commands. Python installations need the mirage-ai[ast-grep] extra.
The CLI’s config.max_memory sets the Rust engine’s WebAssembly memory ceiling for run, scan, and outline. It defaults to 16 MiB. Set it in bytes or with a size such as 32MB. The engine starts at 6 MiB and grows in 64 KiB pages up to the smaller of the configured ceiling and the available workspace budget. The host runtime, compiled modules, and concurrent requests also use isolate memory. The setting belongs to each installation. The workspace API accepts the same clis block in the config object of POST /v1/workspaces. To register the CLI in an existing workspace:
Each recursive operand shares the workspace’s walk policy with other commands. The walk charges directory entries on the mount that listed them.
The first rewrite previews a diff. The second writes the replacements. Use scan --inline-rules for a YAML rule on the command line. A plain scan discovers sgconfig.yml in the working directory or its ancestors and loads YAML files from its ruleDirs. Repeat --globs to select paths during a recursive search. The command tree and available flags appear in ast-grep --help and each subcommand’s help.

License

See compatibility and licenses.