Repository Analysis

napi-rs/napi-rs

A framework for building compiled Node.js add-ons in Rust via Node-API

3.7 Likely human-written View on GitHub

Analysis Overview

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).

3.7
Adjusted Score
3.7
Raw Score
100%
Time Factor
2026-07-14
Last Push
7.8K
Stars
Rust
Language
72.4K
Lines of Code
440
Files
181
Pattern Hits
2026-07-14
Scan Date
0.01
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

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.

Severity Breakdown

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.

CRITICAL 6HIGH 0MEDIUM 1LOW 174

Directory Score Breakdown

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.

Pattern Findings

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.

Hyper-Verbose Identifiers124 hits · 126 pts
SeverityFileLineSnippetContext
LOWcli/src/index.ts70export function createCreateNpmDirsCommand(CODE
LOWcli/src/index.ts84export function createUniversalizeCommand(args: string[]): UniversalizeCommand {CODE
LOWcli/src/def/artifacts.ts90export function applyDefaultArtifactsOptions(options: ArtifactsOptions) {CODE
LOWcli/src/def/universalize.ts68export function applyDefaultUniversalizeOptions(options: UniversalizeOptions) {CODE
LOWcli/src/def/rename.ts123export function applyDefaultRenameOptions(options: RenameOptions) {CODE
LOWcli/src/def/create-npm-dirs.ts78export function applyDefaultCreateNpmDirsOptions(CODE
LOWcli/src/def/version.ts67export function applyDefaultVersionOptions(options: VersionOptions) {CODE
LOWcli/src/def/pre-publish.ts130export function applyDefaultPrePublishOptions(options: PrePublishOptions) {CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md535 export declare function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md537 export declare function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md539 export declare function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md541 export declare function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1086 export declare function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1088 export declare function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1090 export declare function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1092 export declare function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md252 export declare function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md254 export declare function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, argCODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md333 export declare function createObjectWithClassField(): ObjectFieldClassInstance␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md457 export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: numbCODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md459 export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md493 export declare function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md511 export declare function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md805 export declare function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md807 export declare function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, argCODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md886 export declare function createObjectWithClassField(): ObjectFieldClassInstance␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1010 export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: numbCODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1012 export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1046 export declare function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊CODE
LOW…i/src/utils/__tests__/__snapshots__/typegen.spec.ts.md1064 export declare function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊CODE
LOWcli/src/api/new.ts144async function filterTargetsInPackageJson(CODE
LOWcli/src/api/new.ts216export async function updateCargoTomlNodeApiVersion(CODE
LOWcli/src/api/new.ts262async function filterTargetsInGithubActions(CODE
LOWcli/src/api/universalize.ts15function createDarwinUniversalBinary(inputs: string[], output: string) {CODE
LOWcli/src/api/create-npm-dirs.ts31async function getLatestWasmRuntimeVersion() {CODE
LOWcli/src/api/build.ts140export function validateCrossCompileFlags(CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md358 export declare function callbackReturnPromiseAndSpawn(jsFunc: (arg0: string) => Promise<string>): Promise<string>␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md368 export declare function callFunctionWithArgAndCtx(ctx: Animal, cb: (arg: string) => void, name: string): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md370 export declare function callLongThreadsafeFunction(tsfn: ((err: Error | null, arg: number) => unknown)): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md386 export declare function chronoDateWithTimezoneReturn(): Date | null␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md388 export declare function chronoDateWithTimezoneToMillis(input: Date): number␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md396 export declare function chronoNativeDateTimeReturn(): Date | null␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md418 export declare function createBufferSliceFromCopiedData(): Buffer␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md422 export declare function createExternalBufferSlice(): Buffer␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md430 export declare function createObjectWithClassField(): ObjectFieldClassInstance␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md438 export declare function createReadableStreamFromClass(readableStreamClass: typeof ReadableStream): ReadableStream<BuCODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md440 export declare function createReferenceOnFunction(cb: () => void): Promise<void>␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md672 export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: numbCODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md674 export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md676 export declare function overrideWholeFunctionType(operation: 'add' | 'subtract' | 'multiply', a: number, b: number):CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md810 export declare function testSerdeBigNumberPrecision(number: string): any␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md816 export declare function threadsafeFunctionClosureCapture(func: (arg: string) => void): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md818 export declare function threadsafeFunctionFatalMode(cb: ((arg: boolean) => unknown)): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md820 export declare function threadsafeFunctionFatalModeError(cb: ((arg: boolean) => string)): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md822 export declare function threadsafeFunctionThrowError(cb: ((err: Error | null, arg: boolean) => unknown)): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md275 export declare function acceptThreadsafeFunctionFatal(func: ((arg: number) => void)): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md277 export declare function acceptThreadsafeFunctionTupleArgs(func: ((err: Error | null, arg0: number, arg1: boolean, arCODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md342 export declare function buildThreadsafeFunctionFromFunction(callback: (arg0: number, arg1: number) => number): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md344 export declare function buildThreadsafeFunctionFromFunctionCalleeHandle(callback: () => void): void␊CODE
LOW…amples/napi/__tests__/__snapshots__/typegen.spec.ts.md512 export declare function errorMessageContainsNullByte(msg: string): void␊CODE
64 more matches not shown…
Hallucination Indicators6 hits · 85 pts
SeverityFileLineSnippetContext
CRITICALcli/src/api/new.ts296 yaml.jobs.build.strategy.matrix.settings.filter((setting: any) => {CODE
CRITICALcli/src/api/__tests__/new.spec.ts183 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICALcli/src/api/__tests__/new.spec.ts188 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICALcli/src/api/__tests__/new.spec.ts193 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICALcli/src/api/__tests__/new.spec.ts198 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
CRITICALcli/src/api/__tests__/new.spec.ts203 yamlObject.jobs.build.strategy.matrix.settings.some(CODE
Over-Commented Block48 hits · 48 pts
SeverityFileLineSnippetContext
LOWcrates/macro/src/parser/mod.rs81}COMMENT
LOWcrates/napi/src/error.rs21COMMENT
LOWcrates/napi/src/error.rs41/// One `ErrorRef` backs an `Error` derived from a JS exception and everyCOMMENT
LOWcrates/napi/src/error.rs61// on the owning JS thread — `Error::referenced_value` gates reads onCOMMENT
LOWcrates/napi/src/error.rs361 /// other thread it degrades to a fresh `Error` rebuilt from `status`/`reason`/COMMENT
LOWcrates/napi/src/error.rs401 /// returns `None`, so the caller rebuilds a fresh error from `reason` insteadCOMMENT
LOWcrates/napi/src/error.rs421 let mut result = ptr::null_mut();COMMENT
LOWcrates/napi/src/env.rs361 ///COMMENT
LOWcrates/napi/src/env.rs541 value: raw_value,COMMENT
LOWcrates/napi/src/env.rs1401COMMENT
LOWcrates/napi/src/tokio_runtime.rs61/// use napi::create_custom_tokio_runtime;COMMENT
LOWcrates/napi/src/lib.rs1#![deny(clippy::all)]COMMENT
LOWcrates/napi/src/lib.rs21//! ```COMMENT
LOWcrates/napi/src/lib.rs41//!COMMENT
LOWcrates/napi/src/threadsafe_function.rs141/// ```rustCOMMENT
LOWcrates/napi/src/threadsafe_function.rs701COMMENT
LOWcrates/napi/src/bindgen_runtime/js_values.rs101pub trait FromNapiValue: Sized {COMMENT
LOWcrates/napi/src/bindgen_runtime/js_values.rs121 ///COMMENT
LOWcrates/napi/src/bindgen_runtime/module_register.rs161COMMENT
LOWcrates/napi/src/bindgen_runtime/module_register.rs301COMMENT
LOWcrates/napi/src/bindgen_runtime/js_values/bigint.rs1/// We don't implement `FromNapiValue` for `i64` `u64` `i128` `u128` `isize` `usize` hereCOMMENT
LOW…ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs221 /// ## SafetyCOMMENT
LOW…ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs1081 #[doc = "- The data pointer is valid for the lifetime of the buffer and points to a memory region of at least `lenCOMMENT
LOW…ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs1261COMMENT
LOW…ates/napi/src/bindgen_runtime/js_values/arraybuffer.rs1801 /// - The data pointer is valid for the lifetime of the buffer and points to a memory region of at least `len` bytesCOMMENT
LOWcrates/napi/src/bindgen_runtime/js_values/promise.rs21/// example:COMMENT
LOWcrates/napi/src/bindgen_runtime/js_values/scope.rs21 /// This function is unsafe because it will invalidate the JsValue created within the HandleScope.COMMENT
LOWcrates/napi/src/bindgen_runtime/js_values/external.rs81 ///COMMENT
LOWcrates/napi/src/bindgen_runtime/js_values/buffer.rs101 /// ## SafetyCOMMENT
LOWcrates/napi/src/js_values/function.rs21 fn type_name() -> &'static str {COMMENT
LOWcrates/napi/src/js_values/string/latin1.rs1#[cfg(all(feature = "napi10", not(target_family = "wasm")))]COMMENT
LOWcrates/napi/src/js_values/string/latin1.rs21 /// `buf` is `&[]`. Recover the bytes via [`JsString::into_latin1`] onCOMMENT
LOWcrates/napi/src/js_values/string/latin1.rs41 ///COMMENT
LOWcrates/napi/src/js_values/string/latin1.rs181 /// ## `finalize_callback` invocation contractCOMMENT
LOWcrates/napi/src/js_values/string/latin1.rs201 ///COMMENT
LOWcrates/napi/src/js_values/string/latin1.rs221 /// runs the finalizer synchronously, so this function makes its own copyCOMMENT
LOWcrates/napi/src/js_values/string/utf16.rs21 /// (`copied = true` — short strings or sandbox mode), the finalizerCOMMENT
LOWcrates/napi/src/js_values/string/utf16.rs41 /// - Finalizer is called synchronously to release the source bufferCOMMENT
LOWcrates/napi/src/js_values/string/utf16.rs181 /// ## `finalize_callback` invocation contractCOMMENT
LOWcrates/napi/src/js_values/string/utf16.rs201 ///COMMENT
LOWcrates/napi/src/js_values/string/utf16.rs221 /// runs the finalizer synchronously, so this function makes its own copyCOMMENT
LOWexamples/napi/src/stream.rs81 }COMMENT
LOWexamples/napi/src/error.rs161 static STASHED_ERRORS: std::cell::RefCell<Vec<Error>> = const { std::cell::RefCell::new(Vec::new()) };COMMENT
LOWexamples/napi/src/lib.rs1#![allow(dead_code)]COMMENT
LOWexamples/napi/src/object.rs241 /// Input:COMMENT
LOWexamples/napi/src/object.rs261 /// ```jsCOMMENT
LOW.github/workflows/test-release.yaml41 # events/strace to the host-backed overlay — no fixed scratch disk toCOMMENT
LOW.github/workflows/test-release.yaml301 shell: msys2 {0}COMMENT
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUM.github/workflows/release-crates.yml38 # Create a PR with the new versions and changelog, preparing the next release.COMMENT
Verbosity Indicators1 hit · 2 pts
SeverityFileLineSnippetContext
LOWcrates/napi/src/js_values/ser.rs148 // To avoid this, we need to check if the value fits into a smaller number type.COMMENT
Fake / Example Data1 hit · 1 pts
SeverityFileLineSnippetContext
LOWexamples/napi/__tests__/values.spec.ts1012 t.deepEqual(listObjKeys({ name: 'John Doe', age: 20 }), ['name', 'age'])CODE