A framework for building compiled Node.js add-ons in Rust via Node-API
This report presents the forensic synthetic code analysis of napi-rs/napi-rs, a Rust project with 7,831 GitHub stars. SynthScan v2.0 examined 72,379 lines of code across 440 source files, recording 181 pattern matches distributed across 6 syntactic categories. The overall adjusted score of 3.7 places this repository in the Likely human-written band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 181 distinct pattern matches across 6 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | cli/src/index.ts | 70 | export function createCreateNpmDirsCommand( | CODE |
| LOW | cli/src/index.ts | 84 | export function createUniversalizeCommand(args: string[]): UniversalizeCommand { | CODE |
| LOW | cli/src/def/artifacts.ts | 90 | export function applyDefaultArtifactsOptions(options: ArtifactsOptions) { | CODE |
| LOW | cli/src/def/universalize.ts | 68 | export function applyDefaultUniversalizeOptions(options: UniversalizeOptions) { | CODE |
| LOW | cli/src/def/rename.ts | 123 | export function applyDefaultRenameOptions(options: RenameOptions) { | CODE |
| LOW | cli/src/def/create-npm-dirs.ts | 78 | export function applyDefaultCreateNpmDirsOptions( | CODE |
| LOW | cli/src/def/version.ts | 67 | export function applyDefaultVersionOptions(options: VersionOptions) { | CODE |
| LOW | cli/src/def/pre-publish.ts | 130 | export function applyDefaultPrePublishOptions(options: PrePublishOptions) { | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 535 | export declare function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 537 | export declare function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 539 | export declare function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 541 | export declare function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1086 | export declare function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1088 | export declare function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1090 | export declare function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊ | CODE |
| LOW⚡ | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1092 | export declare function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 252 | export declare function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 254 | export declare function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 333 | export declare function createObjectWithClassField(): ObjectFieldClassInstance␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 457 | export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: numb | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 459 | export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 493 | export declare function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 511 | export declare function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 805 | export declare function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 807 | export declare function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 886 | export declare function createObjectWithClassField(): ObjectFieldClassInstance␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1010 | export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: numb | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1012 | export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1046 | export declare function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊ | CODE |
| LOW | …i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md | 1064 | export declare function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊ | CODE |
| LOW | cli/src/api/new.ts | 144 | async function filterTargetsInPackageJson( | CODE |
| LOW | cli/src/api/new.ts | 216 | export async function updateCargoTomlNodeApiVersion( | CODE |
| LOW | cli/src/api/new.ts | 262 | async function filterTargetsInGithubActions( | CODE |
| LOW | cli/src/api/universalize.ts | 15 | function createDarwinUniversalBinary(inputs: string[], output: string) { | CODE |
| LOW | cli/src/api/create-npm-dirs.ts | 31 | async function getLatestWasmRuntimeVersion() { | CODE |
| LOW | cli/src/api/build.ts | 140 | export function validateCrossCompileFlags( | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 358 | export declare function callbackReturnPromiseAndSpawn(jsFunc: (arg0: string) => Promise<string>): Promise<string>␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 368 | export declare function callFunctionWithArgAndCtx(ctx: Animal, cb: (arg: string) => void, name: string): void␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 370 | export declare function callLongThreadsafeFunction(tsfn: ((err: Error | null, arg: number) => unknown)): void␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 386 | export declare function chronoDateWithTimezoneReturn(): Date | null␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 388 | export declare function chronoDateWithTimezoneToMillis(input: Date): number␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 396 | export declare function chronoNativeDateTimeReturn(): Date | null␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 418 | export declare function createBufferSliceFromCopiedData(): Buffer␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 422 | export declare function createExternalBufferSlice(): Buffer␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 430 | export declare function createObjectWithClassField(): ObjectFieldClassInstance␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 438 | export declare function createReadableStreamFromClass(readableStreamClass: typeof ReadableStream): ReadableStream<Bu | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 440 | export declare function createReferenceOnFunction(cb: () => void): Promise<void>␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 672 | export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: numb | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 674 | export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 676 | export declare function overrideWholeFunctionType(operation: 'add' | 'subtract' | 'multiply', a: number, b: number): | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 810 | export declare function testSerdeBigNumberPrecision(number: string): any␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 816 | export declare function threadsafeFunctionClosureCapture(func: (arg: string) => void): void␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 818 | export declare function threadsafeFunctionFatalMode(cb: ((arg: boolean) => unknown)): void␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 820 | export declare function threadsafeFunctionFatalModeError(cb: ((arg: boolean) => string)): void␊ | CODE |
| LOW⚡ | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 822 | export declare function threadsafeFunctionThrowError(cb: ((err: Error | null, arg: boolean) => unknown)): void␊ | CODE |
| LOW | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 275 | export declare function acceptThreadsafeFunctionFatal(func: ((arg: number) => void)): void␊ | CODE |
| LOW | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 277 | export declare function acceptThreadsafeFunctionTupleArgs(func: ((err: Error | null, arg0: number, arg1: boolean, ar | CODE |
| LOW | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 342 | export declare function buildThreadsafeFunctionFromFunction(callback: (arg0: number, arg1: number) => number): void␊ | CODE |
| LOW | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 344 | export declare function buildThreadsafeFunctionFromFunctionCalleeHandle(callback: () => void): void␊ | CODE |
| LOW | …amples/napi/__tests__/__snapshots__/typegen.spec.ts.md | 512 | export declare function errorMessageContainsNullByte(msg: string): void␊ | CODE |
| 64 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | cli/src/api/new.ts | 296 | yaml.jobs.build.strategy.matrix.settings.filter((setting: any) => { | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 183 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 188 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 193 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 198 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| CRITICAL⚡ | cli/src/api/__tests__/new.spec.ts | 203 | yamlObject.jobs.build.strategy.matrix.settings.some( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | crates/macro/src/parser/mod.rs | 81 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 21 | COMMENT | |
| LOW | crates/napi/src/error.rs | 41 | /// One `ErrorRef` backs an `Error` derived from a JS exception and every | COMMENT |
| LOW | crates/napi/src/error.rs | 61 | // on the owning JS thread — `Error::referenced_value` gates reads on | COMMENT |
| LOW | crates/napi/src/error.rs | 361 | /// other thread it degrades to a fresh `Error` rebuilt from `status`/`reason`/ | COMMENT |
| LOW | crates/napi/src/error.rs | 401 | /// returns `None`, so the caller rebuilds a fresh error from `reason` instead | COMMENT |
| LOW | crates/napi/src/error.rs | 421 | let mut result = ptr::null_mut(); | COMMENT |
| LOW | crates/napi/src/env.rs | 361 | /// | COMMENT |
| LOW | crates/napi/src/env.rs | 541 | value: raw_value, | COMMENT |
| LOW | crates/napi/src/env.rs | 1401 | COMMENT | |
| LOW | crates/napi/src/tokio_runtime.rs | 61 | /// use napi::create_custom_tokio_runtime; | COMMENT |
| LOW | crates/napi/src/lib.rs | 1 | #![deny(clippy::all)] | COMMENT |
| LOW | crates/napi/src/lib.rs | 21 | //! ``` | COMMENT |
| LOW | crates/napi/src/lib.rs | 41 | //! | COMMENT |
| LOW | crates/napi/src/threadsafe_function.rs | 141 | /// ```rust | COMMENT |
| LOW | crates/napi/src/threadsafe_function.rs | 701 | COMMENT | |
| LOW | crates/napi/src/bindgen_runtime/js_values.rs | 101 | pub trait FromNapiValue: Sized { | COMMENT |
| LOW | crates/napi/src/bindgen_runtime/js_values.rs | 121 | /// | COMMENT |
| LOW | crates/napi/src/bindgen_runtime/module_register.rs | 161 | COMMENT | |
| LOW | crates/napi/src/bindgen_runtime/module_register.rs | 301 | COMMENT | |
| LOW | crates/napi/src/bindgen_runtime/js_values/bigint.rs | 1 | /// We don't implement `FromNapiValue` for `i64` `u64` `i128` `u128` `isize` `usize` here | COMMENT |
| LOW | …ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs | 221 | /// ## Safety | COMMENT |
| LOW | …ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs | 1081 | #[doc = "- The data pointer is valid for the lifetime of the buffer and points to a memory region of at least `len | COMMENT |
| LOW | …ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs | 1261 | COMMENT | |
| LOW | …ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs | 1801 | /// - The data pointer is valid for the lifetime of the buffer and points to a memory region of at least `len` bytes | COMMENT |
| LOW | crates/napi/src/bindgen_runtime/js_values/promise.rs | 21 | /// example: | COMMENT |
| LOW | crates/napi/src/bindgen_runtime/js_values/scope.rs | 21 | /// This function is unsafe because it will invalidate the JsValue created within the HandleScope. | COMMENT |
| LOW | crates/napi/src/bindgen_runtime/js_values/external.rs | 81 | /// | COMMENT |
| LOW | crates/napi/src/bindgen_runtime/js_values/buffer.rs | 101 | /// ## Safety | COMMENT |
| LOW | crates/napi/src/js_values/function.rs | 21 | fn type_name() -> &'static str { | COMMENT |
| LOW | crates/napi/src/js_values/string/latin1.rs | 1 | #[cfg(all(feature = "napi10", not(target_family = "wasm")))] | COMMENT |
| LOW | crates/napi/src/js_values/string/latin1.rs | 21 | /// `buf` is `&[]`. Recover the bytes via [`JsString::into_latin1`] on | COMMENT |
| LOW | crates/napi/src/js_values/string/latin1.rs | 41 | /// | COMMENT |
| LOW | crates/napi/src/js_values/string/latin1.rs | 181 | /// ## `finalize_callback` invocation contract | COMMENT |
| LOW | crates/napi/src/js_values/string/latin1.rs | 201 | /// | COMMENT |
| LOW | crates/napi/src/js_values/string/latin1.rs | 221 | /// runs the finalizer synchronously, so this function makes its own copy | COMMENT |
| LOW | crates/napi/src/js_values/string/utf16.rs | 21 | /// (`copied = true` — short strings or sandbox mode), the finalizer | COMMENT |
| LOW | crates/napi/src/js_values/string/utf16.rs | 41 | /// - Finalizer is called synchronously to release the source buffer | COMMENT |
| LOW | crates/napi/src/js_values/string/utf16.rs | 181 | /// ## `finalize_callback` invocation contract | COMMENT |
| LOW | crates/napi/src/js_values/string/utf16.rs | 201 | /// | COMMENT |
| LOW | crates/napi/src/js_values/string/utf16.rs | 221 | /// runs the finalizer synchronously, so this function makes its own copy | COMMENT |
| LOW | examples/napi/src/stream.rs | 81 | } | COMMENT |
| LOW | examples/napi/src/error.rs | 161 | static STASHED_ERRORS: std::cell::RefCell<Vec<Error>> = const { std::cell::RefCell::new(Vec::new()) }; | COMMENT |
| LOW | examples/napi/src/lib.rs | 1 | #![allow(dead_code)] | COMMENT |
| LOW | examples/napi/src/object.rs | 241 | /// Input: | COMMENT |
| LOW | examples/napi/src/object.rs | 261 | /// ```js | COMMENT |
| LOW | .github/workflows/test-release.yaml | 41 | # events/strace to the host-backed overlay — no fixed scratch disk to | COMMENT |
| LOW | .github/workflows/test-release.yaml | 301 | shell: msys2 {0} | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | .github/workflows/release-crates.yml | 38 | # Create a PR with the new versions and changelog, preparing the next release. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | crates/napi/src/js_values/ser.rs | 148 | // To avoid this, we need to check if the value fits into a smaller number type. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | examples/napi/__tests__/values.spec.ts | 1012 | t.deepEqual(listObjKeys({ name: 'John Doe', age: 20 }), ['name', 'age']) | CODE |