slopbrick 0.18.7 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -217,10 +217,96 @@ interface ScanFactsV2 {
217
217
  * comments (and block equivalents). Issues matching these are filtered
218
218
  * out before scoring. */
219
219
  disabledRules: DisabledLintRuleFact[];
220
+ /**
221
+ * v0.18.9 — Rust AST structure for `.rs` files. Populated by the
222
+ * tree-sitter-backed visitor in `visitors/rust.ts`. Absent for
223
+ * non-Rust files. Powers the four `rust/*` rules (unused-pub-fn,
224
+ * unwrap-in-production, todo-macro, stringly-typed). */
225
+ rustFile?: RustFileRecord;
220
226
  /** Optional source text (cached for `unified-diff`, `formatAdvice`,
221
227
  * and `--suggest` output). Not all rules need this. */
222
228
  _source?: string;
223
229
  }
230
+ /**
231
+ * Per-language (Rust) variant of an import. Mirrors `ImportRecord`
232
+ * for the AST-walker path; absent for non-Rust files.
233
+ */
234
+ interface RustImportRecord {
235
+ /** Source path as written (`'std::collections::HashMap'`). */
236
+ path: string;
237
+ /** Local bindings introduced by the import. Empty for `use foo::*;`. */
238
+ names: Array<{
239
+ name: string;
240
+ alias?: string;
241
+ }>;
242
+ /** True for `use foo::*;` — the import has no local name. */
243
+ isGlob: boolean;
244
+ /** Source location. */
245
+ line: number;
246
+ column: number;
247
+ }
248
+ /**
249
+ * Per-function declaration captured from the Rust AST. Covers free
250
+ * functions and impl-block methods uniformly.
251
+ */
252
+ interface RustFunctionRecord {
253
+ /** Function name as written (`add`, `from_str`). */
254
+ name: string;
255
+ /** Source location. */
256
+ line: number;
257
+ column: number;
258
+ /** True for `pub fn` / `pub(crate) fn` / `pub(super) fn`. */
259
+ isPublic: boolean;
260
+ /** True for methods inside `impl` blocks. */
261
+ isMethod: boolean;
262
+ /** Receiver text when `isMethod` (`'self'`, `'&self'`, `'&mut self'`). */
263
+ receiver?: string;
264
+ /** Body length in source lines. */
265
+ bodyLines: number;
266
+ /** True if the function is decorated with `#[cfg(test)]` or `#[test]`,
267
+ * or is enclosed in a `#[cfg(test)] mod tests { ... }`. */
268
+ inTestConfig: boolean;
269
+ }
270
+ /** Per-struct declaration. Mirrors `RustFunctionRecord` for the
271
+ * struct-item node. */
272
+ interface RustStructRecord {
273
+ name: string;
274
+ line: number;
275
+ column: number;
276
+ isPublic: boolean;
277
+ /** True if any `#[derive(...)]` attribute preceded the struct. */
278
+ isDerive: boolean;
279
+ /** Names of the derive macros. */
280
+ derives: string[];
281
+ }
282
+ /** Per-trait declaration. */
283
+ interface RustTraitRecord {
284
+ name: string;
285
+ line: number;
286
+ column: number;
287
+ isPublic: boolean;
288
+ }
289
+ /** Per-impl block. */
290
+ interface RustImplRecord {
291
+ /** Trait name when `impl Trait for Type` (otherwise absent). */
292
+ trait?: string;
293
+ /** The type the impl targets (`Type` in `impl Type` or `impl Trait for Type`). */
294
+ type: string;
295
+ /** Names of methods defined inside this impl. */
296
+ methods: string[];
297
+ line: number;
298
+ column: number;
299
+ }
300
+ /** Captured AST-level structure of a `.rs` file, populated by
301
+ * `parseRustFile` in `engine/visitors/rust.ts`. Absent for files
302
+ * whose extension isn't `.rs`, or when tree-sitter failed to load. */
303
+ interface RustFileRecord {
304
+ imports: RustImportRecord[];
305
+ functions: RustFunctionRecord[];
306
+ structs: RustStructRecord[];
307
+ traits: RustTraitRecord[];
308
+ impls: RustImplRecord[];
309
+ }
224
310
  /** What kind of declaration produced a binding. */
225
311
  type BindingKind = 'import-specifier' | 'import-default' | 'import-namespace' | 'var' | 'let' | 'const' | 'function' | 'class' | 'type' | 'interface' | 'enum' | 'parameter' | 'catch-clause';
226
312
  /** A single binding declaration the visitor found in the file.
package/dist/index.d.ts CHANGED
@@ -217,10 +217,96 @@ interface ScanFactsV2 {
217
217
  * comments (and block equivalents). Issues matching these are filtered
218
218
  * out before scoring. */
219
219
  disabledRules: DisabledLintRuleFact[];
220
+ /**
221
+ * v0.18.9 — Rust AST structure for `.rs` files. Populated by the
222
+ * tree-sitter-backed visitor in `visitors/rust.ts`. Absent for
223
+ * non-Rust files. Powers the four `rust/*` rules (unused-pub-fn,
224
+ * unwrap-in-production, todo-macro, stringly-typed). */
225
+ rustFile?: RustFileRecord;
220
226
  /** Optional source text (cached for `unified-diff`, `formatAdvice`,
221
227
  * and `--suggest` output). Not all rules need this. */
222
228
  _source?: string;
223
229
  }
230
+ /**
231
+ * Per-language (Rust) variant of an import. Mirrors `ImportRecord`
232
+ * for the AST-walker path; absent for non-Rust files.
233
+ */
234
+ interface RustImportRecord {
235
+ /** Source path as written (`'std::collections::HashMap'`). */
236
+ path: string;
237
+ /** Local bindings introduced by the import. Empty for `use foo::*;`. */
238
+ names: Array<{
239
+ name: string;
240
+ alias?: string;
241
+ }>;
242
+ /** True for `use foo::*;` — the import has no local name. */
243
+ isGlob: boolean;
244
+ /** Source location. */
245
+ line: number;
246
+ column: number;
247
+ }
248
+ /**
249
+ * Per-function declaration captured from the Rust AST. Covers free
250
+ * functions and impl-block methods uniformly.
251
+ */
252
+ interface RustFunctionRecord {
253
+ /** Function name as written (`add`, `from_str`). */
254
+ name: string;
255
+ /** Source location. */
256
+ line: number;
257
+ column: number;
258
+ /** True for `pub fn` / `pub(crate) fn` / `pub(super) fn`. */
259
+ isPublic: boolean;
260
+ /** True for methods inside `impl` blocks. */
261
+ isMethod: boolean;
262
+ /** Receiver text when `isMethod` (`'self'`, `'&self'`, `'&mut self'`). */
263
+ receiver?: string;
264
+ /** Body length in source lines. */
265
+ bodyLines: number;
266
+ /** True if the function is decorated with `#[cfg(test)]` or `#[test]`,
267
+ * or is enclosed in a `#[cfg(test)] mod tests { ... }`. */
268
+ inTestConfig: boolean;
269
+ }
270
+ /** Per-struct declaration. Mirrors `RustFunctionRecord` for the
271
+ * struct-item node. */
272
+ interface RustStructRecord {
273
+ name: string;
274
+ line: number;
275
+ column: number;
276
+ isPublic: boolean;
277
+ /** True if any `#[derive(...)]` attribute preceded the struct. */
278
+ isDerive: boolean;
279
+ /** Names of the derive macros. */
280
+ derives: string[];
281
+ }
282
+ /** Per-trait declaration. */
283
+ interface RustTraitRecord {
284
+ name: string;
285
+ line: number;
286
+ column: number;
287
+ isPublic: boolean;
288
+ }
289
+ /** Per-impl block. */
290
+ interface RustImplRecord {
291
+ /** Trait name when `impl Trait for Type` (otherwise absent). */
292
+ trait?: string;
293
+ /** The type the impl targets (`Type` in `impl Type` or `impl Trait for Type`). */
294
+ type: string;
295
+ /** Names of methods defined inside this impl. */
296
+ methods: string[];
297
+ line: number;
298
+ column: number;
299
+ }
300
+ /** Captured AST-level structure of a `.rs` file, populated by
301
+ * `parseRustFile` in `engine/visitors/rust.ts`. Absent for files
302
+ * whose extension isn't `.rs`, or when tree-sitter failed to load. */
303
+ interface RustFileRecord {
304
+ imports: RustImportRecord[];
305
+ functions: RustFunctionRecord[];
306
+ structs: RustStructRecord[];
307
+ traits: RustTraitRecord[];
308
+ impls: RustImplRecord[];
309
+ }
224
310
  /** What kind of declaration produced a binding. */
225
311
  type BindingKind = 'import-specifier' | 'import-default' | 'import-namespace' | 'var' | 'let' | 'const' | 'function' | 'class' | 'type' | 'interface' | 'enum' | 'parameter' | 'catch-clause';
226
312
  /** A single binding declaration the visitor found in the file.