Skip to content

Diagnostics census

sloptor build runs four sequential gates. The gates are the program-option diagnostics, the per-file precheck, the global checker diagnostics, and the transform drain. Each gate returns at the first problem. The precheck gate returns before sloptor queues the transform stage, so one type error anywhere hides every transformer diagnostic in the project.

sloptor check is complete but typecheck-only. It never runs the transformer, so it can't show a noAny-class diagnostic.

sloptor diagnostics runs every file and reports each one's outcome:

Outcome Meaning
ok The file transformed with no diagnostics. This doesn't prove the Luau is correct. Sloptor uses types for truthiness, coercion, and loop lowering, so output for a type-broken file can be wrong without a warning
typeError TypeScript rejected the file. Sloptor transforms it anyway
transformerDiagnostic Sloptor's transformer rejected the file, or the file uses comment directives
internalCompilerError A ported upstream assert fired. The output includes the panic value and stack
Terminal window
sloptor diagnostics --project tsconfig.json --json
'{"overlays":{"C:/proj/src/main.ts":"export const x = 1;\n"}}' | sloptor diagnostics --json
  • --project <path> selects the config. --checkers <n> sets the checker count.
  • -b/--build [path] censuses a whole solution of project references, with --builders <n>. These are the same flags, values, and --builders requires --build rule that sloptor build uses.
  • --json extends the sloptor build --json result with a transformed count, an overlayMatches count, and a fileDiagnostics array. Diagnostic positions resolve against the text that sloptor compiled, which keeps them correct under overlays.
  • Each diagnostic has a code. TypeScript diagnostics use TS####. Transformer diagnostics use the upstream factory name, such as noAny or rotorLabeledStatementFlowControl. Classify on code and not on the file's outcome. A file can have both families at once, and outcome reports only the most severe. Sloptor omits the key when no code ever existed, such as when a whole run broke and not one diagnostic.
  • files means something different here than for build. For build it counts files written. For diagnostics it counts files censused, and the command leaves disk untouched.
  • The command never writes outDir, include/, or rotor.d.ts.

The tsconfig rbxts key still sets the project's shape: type, rojo, and includePath. But sloptor forces allowCommentDirectives off.

That doesn't stop @ts-ignore from hiding type errors. A directive suppresses them inside the checker, and no compiler flag that sloptor sets undoes that. Forcing the option off adds sloptor's own "comment directives are not supported" diagnostic. A file that uses directives then shows as transformerDiagnostic and can't pass as ok.

The cost is a divergence. A project that sets allowCommentDirectives: true on purpose gets a diagnostic here that sloptor build omits.

Unlike build and check, diagnostics exits 0 whenever it produced a census, even a census full of diagnostics. It exits 1 only when it could not produce one, and 2 for a usage error such as an unknown flag. The command reports and doesn't gate. Read ok and the per-file outcomes to judge the contents.

Optional overlays arrive as JSON on stdin, in the form {"overlays":{"<absolute path>":"<source>"}}. They replace the text of those files for the run only. Overlays use stdin because argv can't hold a project's worth of source.

  • Close stdin, or the reader blocks. The command detects an interactive terminal and treats it as no overlays. It can't detect a pipe left open.
  • Overlays replace files and can't add them. The overlay filesystem overrides FileExists and ReadFile only, and not directory enumeration. A key for a path that the tsconfig include never walks to has no effect.
  • A key that matches no file in the program is an error and not a quiet no-op. Compare overlayMatches against the number you sent. A green census of the unmodified tree is exactly what this check prevents. Keys may use either path separator and match case-insensitively where the filesystem does. Under --build, the check runs against the union of every project, because a solution divides its files between projects. overlayMatches counts distinct overlays and not per-project matches.
  • Unknown top-level fields in the request are an error. A typo in the wrapper key stops the run and doesn't parse to an empty overlay set.
  • Overlays work on projects with transformer plugins. You can census your real build tsconfig and don't need a plugin-free copy. For external plugins, sloptor sends the text to the Node sidecar as a changed file and runs the worker's plugins against it. Sloptor then rebuilds the program from the worker's output. That program keeps your overlay on every file the worker didn't transform. Native [flamework] projects use the native pipeline instead. Declaration emit through baseUrl and paths resolves module names against the same view.

sloptor diagnostics --build [path] censuses every project that the entry tsconfig references, transitively, in dependency order.

  • If one project can't undergo a census, the others still run. A solution build blocks the dependents of a broken project, because they consume its missing output. Census runs never read project output, since TypeScript redirects project references to source. Blocking would only leave projects unreported. The command reports the error against its own project, and the run exits 1.
  • --json adds a projects array. Each entry has projectDir, configPath, ok, files, transformed, overlayMatches, and the diagnostics that belong to the project and not to one of its files. Each fileDiagnostics entry gains a project key with the same configPath value. The files stay in one flat array and aren't repeated per project.
  • Every top-level number is a solution-wide aggregate. files, transformed, overlayMatches, and diagnostics are totals, and fileDiagnostics holds every project's files. A project's diagnostics are the attributed subset of the top-level array and not an addition to it. Solution-level errors belong to no project and appear only at the top.
  • Without --build, the output is byte-identical to a solution-unaware sloptor. projects and the per-file project are the only new keys, and the command omits both.
  • allowCommentDirectives is forced off for every project of the solution and not only the entry. One referenced project's rbxts key can't change how sloptor classifies its files.