CLI inspect fallback
The CLI and the LSP server share the same tooling semantics. In CLI commands, positions start at 1.
Install the optional CLI in the project that runs these commands:
pnpm add --save-dev @sqlbraid/clipnpm exec sqlbraid inspect query --file src/query.ts --line 8 --column 20 --jsonpnpm exec sqlbraid inspect symbol UsersRow --jsonpnpm exec sqlbraid inspect diagnostics --file src/query.ts --jsonThe config is executable Node code, and inspect runs the config that it finds. Thus, discovery starts at the directory of --file and stops at the current directory. It never runs a config above the current directory. If --file is outside the current directory, the command fails with exit code 2. Run inspect commands only in a repository that you trust.
If the discovery of the repository is ambiguous, use --config ./sqlbraid.config.mjs. The JSON output is focused and bounded. Unresolved query evidence has the value resolved: false. This does not claim that the SQL is invalid.
A normal workflow is:
- Find the project config and the metadata evidence.
- If LSP requests are available, use them first.
- If not, use one of the JSON inspection commands above.
- If the metadata or the config changes, run
sqlbraid codegen. Then runsqlbraid codegen --check. - Treat generated files as derived files. Do not edit them manually.
sqlbraid check can add ordinary TypeScript diagnostics. The inspect operations give only SQLBraid evidence.