Repository Analysis

napi-rs/napi-rs

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

5.0 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of napi-rs/napi-rs, a Rust project with 7,917 GitHub stars. SynthScan v2.0 examined 111,722 lines of code across 490 source files, recording 557 pattern matches distributed across 6 syntactic categories. The overall adjusted score of 5.0 places this repository in the Low AI signal 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).

5.0
Adjusted Score
5.0
Raw Score
100%
Time Factor
2026-08-28
Last Push
7.9K
Stars
Rust
Language
111.7K
Lines of Code
490
Files
557
Pattern Hits
2026-08-29
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 5HIGH 0MEDIUM 1LOW 551

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 557 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 Identifiers377 hits · 311 pts
SeverityFileLineSnippetContext
LOWasync-runtime/index.d.ts127export declare function installCurrentThreadHosts(CODE
LOWasync-runtime/index.d.ts136export declare function registerWorkerdCurrentThreadTaskHost(CODE
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.ts143export function applyDefaultPrePublishOptions(options: PrePublishOptions) {CODE
LOWcli/src/utils/metadata.ts80export function getNapiDeriveDependentCrates(CODE
LOWcli/src/utils/metadata.ts112export function createCargoMetadataInvocation(CODE
LOWcli/src/utils/version.ts167function stabilizePrereleaseComparator(comparator: Comparator) {CODE
LOWcli/src/utils/typegen.ts30function asyncGeneratorDeclaration(name: string): string {CODE
LOWcli/src/utils/typegen.ts472function makeTypeImportMarkersUnique(CODE
LOWcli/src/utils/typegen.ts529function reallocateTypeImportMarkers(CODE
LOWcli/src/utils/typegen.ts602function preserveTypeImportMarkers(defs: TypeDefLine[]): TypeDefLine[] {CODE
LOWcli/src/utils/typegen.ts629export function rewriteTypeImportReferences(CODE
LOWcli/src/utils/typegen.ts721export function rebaseDeclarationSpecifiers(CODE
LOWcli/src/utils/typegen.ts774export function collectRelativeDeclarationSpecifiers(source: string): string[] {CODE
LOWcli/src/utils/typegen.ts784function collectRelativeDeclarationSpecifierReferences(CODE
LOWcli/src/utils/typegen.ts866function createCollisionSafeIdentifier(CODE
LOWcli/src/utils/typegen.ts914function typeImportReferenceMeaning(CODE
LOWcli/src/utils/typegen.ts997function throwDeclarationDiagnostics(CODE
LOWcli/src/utils/typegen.ts1132export function removeNodeStreamWebTypeImports(source: string): string {CODE
LOWcli/src/utils/typegen.ts1178export function rewriteUnboundNodeGlobalTypeQueries(source: string): string {CODE
LOWcli/src/utils/typegen.ts1263function leadingDeclarationPreambleEnd(CODE
LOWcli/src/utils/misc.ts419function fileSystemReconciliationCapabilityRoot(path: string) {CODE
LOWcli/src/utils/misc.ts426export function getPackageReconciliationRoot(CODE
LOWcli/src/utils/misc.ts433export function resolvePackageReconciliationPaths(CODE
LOWcli/src/utils/misc.ts1765function reconciliationCandidateName(path: string, token: string) {CODE
LOWcli/src/utils/misc.ts1771function reconciliationCandidatePath(path: string, token: string) {CODE
LOWcli/src/utils/misc.ts1775function reconciliationRetiredPath(path: string) {CODE
LOWcli/src/utils/misc.ts1784async function acquireReconciliationLock(CODE
LOWcli/src/utils/misc.ts3083function reconciliationCandidateCollisionError(path: string) {CODE
LOWcli/src/utils/misc.ts3093function isReconciliationCandidateCollisionError(error: unknown) {CODE
LOWcli/src/utils/misc.ts3100function reconciliationMetadataExistsError(path: string) {CODE
LOWcli/src/utils/misc.ts3110function isUnsupportedReconciliationHardLinkError(error: unknown) {CODE
LOWcli/src/utils/misc.ts3120function reconciliationHardLinkRequiredError(path: string, cause: unknown) {CODE
LOWcli/src/utils/misc.ts3148function reconciliationPathCollisionError(path: string, message: string) {CODE
LOWcli/src/utils/misc.ts3158function isReconciliationPathCollisionError(error: unknown) {CODE
LOWcli/src/utils/misc.ts3165function isReconciliationLockToken(token: unknown): token is string {CODE
LOWcli/src/utils/misc.ts3174function isValidProcessIncarnation(CODE
LOWcli/src/utils/misc.ts524export function getPackageReconciliationRoots({CODE
LOWcli/src/utils/misc.ts578function managedPackagePathIsWithin(root: string, path: string) {CODE
LOWcli/src/utils/misc.ts588function canonicalizeManagedPackagePath(path: string) {CODE
LOWcli/src/utils/misc.ts608function hasPackageWorkspaceBoundaryMarker(directory: string) {CODE
LOWcli/src/utils/misc.ts631function managedPackageBoundaryError(CODE
LOWcli/src/utils/misc.ts644export async function commitFileSystemTransaction(CODE
LOWcli/src/utils/misc.ts692async function commitFileSystemTransactionUnlocked(CODE
LOWcli/src/utils/misc.ts1400async function pathsReferToSameDirectoryEntry(CODE
LOWcli/src/utils/misc.ts1479async function readReconciliationMetadata(path: string, label: string) {CODE
LOWcli/src/utils/misc.ts1532async function canonicalizeReconciliationPath(path: string) {CODE
LOWcli/src/utils/misc.ts1553async function resolveReconciliationLockIdentities(CODE
LOWcli/src/utils/misc.ts1657async function assertReconciliationRequestedPathUnchanged(CODE
LOWcli/src/utils/misc.ts1683async function assertReconciliationAnchorUnchanged(CODE
LOWcli/src/utils/misc.ts1711async function assertReconciliationLockRootUnchanged(CODE
LOWcli/src/utils/misc.ts1732function reconciliationAnchorError(CODE
LOWcli/src/utils/misc.ts1754function reconciliationReclaimPath(identity: ReconciliationLockIdentity) {CODE
LOWcli/src/utils/misc.ts1892async function createExclusiveReconciliationMetadata(CODE
317 more matches not shown…
Over-Commented Block172 hits · 164 pts
SeverityFileLineSnippetContext
LOWcrates/async-runtime/src/adapter.rs261#[napi]COMMENT
LOWcrates/async-runtime/src/adapter.rs921 release_host_registration_id(id);COMMENT
LOWcrates/async-runtime/src/adapter.rs941///COMMENT
LOWcrates/async-runtime/src/adapter.rs1041/// must not poison a live driver -- on aCOMMENT
LOWcrates/async-runtime/src/adapter.rs1061/// - `Status::Closing` is LIFETIME: it originates only from the TSFN layerCOMMENT
LOWcrates/async-runtime/src/adapter.rs1761 // The schedule callback was never invoked (the cancellation wasCOMMENT
LOWcrates/async-runtime/src/adapter.rs1961 release_host_registration_id(id);COMMENT
LOWcrates/async-runtime/src/js_callback.rs41 let value_type = napi::type_of!(env, napi_val)?;COMMENT
LOWcrates/async-runtime/src/lib.rs1//! A shared, tokio-free async runtime for napi-rs addons.COMMENT
LOWcrates/backend/src/typegen.rs81COMMENT
LOWcrates/backend/src/codegen/struct.rs41 js_name: &str,COMMENT
LOWcrates/backend/src/codegen/struct.rs61 Some(salt) => {COMMENT
LOWcrates/backend/src/codegen/fn.rs141 env,COMMENT
LOWcrates/backend/src/codegen/fn.rs301 } else {COMMENT
LOWcrates/macro/src/parser/mod.rs81}COMMENT
LOWcrates/napi/src/error.rs21COMMENT
LOWcrates/napi/src/error.rs41 pub(crate) maybe_ref: Option<std::sync::Arc<ErrorRef>>,COMMENT
LOWcrates/napi/src/error.rs61 // implementation can resolve `env`. Every access to `raw` is gated on it, so aCOMMENT
LOWcrates/napi/src/error.rs81// `ErrorRef::drop` releases on the owning thread directly, routes the releaseCOMMENT
LOWcrates/napi/src/error.rs341}COMMENT
LOWcrates/napi/src/error.rs361 /// so converting the `Error` back with [`ToNapiValue`] reproduces the originalCOMMENT
LOWcrates/napi/src/error.rs381 ///COMMENT
LOWcrates/napi/src/error.rs401 /// addon — degrades to an empty reason and absent cause; the retained valueCOMMENT
LOWcrates/napi/src/error.rs421 /// Identity is reproduced only when the `Error` is converted back on the envCOMMENT
LOWcrates/napi/src/error.rs441 /// [`Env::create_error`]: crate::Env::create_errorCOMMENT
LOWcrates/napi/src/error.rs461}COMMENT
LOWcrates/napi/src/error.rs601struct ReflectIntrinsics {COMMENT
LOWcrates/napi/src/error.rs621 const { std::cell::RefCell::new(None) };COMMENT
LOWcrates/napi/src/error.rs661/// detection, and no pristine reference to `napi_strict_equals` against —COMMENT
LOWcrates/napi/src/error.rs841/// on this env degrades to an empty reason/cause.COMMENT
LOWcrates/napi/src/error.rs961 //COMMENT
LOWcrates/napi/src/error.rs981 // reclaimed the superseded reference — reachable only on builds withoutCOMMENT
LOWcrates/napi/src/error.rs1041COMMENT
LOWcrates/napi/src/error.rs1121/// for an own descriptor via `Reflect.getOwnPropertyDescriptor`:COMMENT
LOWcrates/napi/src/error.rs1341 /// (preserving its subclass, stack, and own properties); converted on anyCOMMENT
LOWcrates/napi/src/error.rs1381 /// off the owning thread (a shared clone being converted on a foreign env) itCOMMENT
LOWcrates/napi/src/error.rs1421 Some(result)COMMENT
LOWcrates/napi/src/error.rs1521/// — `JsError::into_value`, which feeds `napi_throw`, and [`Env::create_error`] —COMMENT
LOWcrates/napi/src/env.rs361 #[cfg(feature = "compat-mode")]COMMENT
LOWcrates/napi/src/env.rs561 ///COMMENT
LOWcrates/napi/src/env.rs1021 Status::InvalidArg,COMMENT
LOWcrates/napi/src/env.rs1161 }COMMENT
LOWcrates/napi/src/env.rs1461COMMENT
LOWcrates/napi/src/env.rs1481 whereCOMMENT
LOWcrates/napi/src/tokio_runtime.rs41#[cfg(all(feature = "async-runtime", not(feature = "noop")))]COMMENT
LOWcrates/napi/src/tokio_runtime.rs61/// [`LifecyclePhase::Idle`] the teardown left behind and starts the backend again — after itsCOMMENT
LOWcrates/napi/src/tokio_runtime.rs81/// memory, which is where this static lives. Rust statics are per-instance; a secondCOMMENT
LOWcrates/napi/src/tokio_runtime.rs101/// [`WASM_ENV_DISPOSING`] for why registration is the only safe release point.COMMENT
LOWcrates/napi/src/tokio_runtime.rs161///COMMENT
LOWcrates/napi/src/tokio_runtime.rs181/// Behavioral contract for backends:COMMENT
LOWcrates/napi/src/tokio_runtime.rs301/// synchronous APIs; runtime-backed operations reject with a missing-backend error.COMMENT
LOWcrates/napi/src/tokio_runtime.rs321/// the `Send + Sync + 'static` bound. The backend's [`Drop`] implementation is not guaranteed toCOMMENT
LOWcrates/napi/src/tokio_runtime.rs341/// backend that cannot prove those references inert must keep the native image loaded itself orCOMMENT
LOWcrates/napi/src/tokio_runtime.rs361 /// [`AsyncRuntimeRejection`] or accept it and defer execution.COMMENT
LOWcrates/napi/src/tokio_runtime.rs381COMMENT
LOWcrates/napi/src/tokio_runtime.rs401 /// lifetime. Implement it idempotently. Return success only after the backend can accept tasks. Do notCOMMENT
LOWcrates/napi/src/tokio_runtime.rs421 /// Those cancellation-driven promise rejections are best-effort: when the promise machineryCOMMENT
LOWcrates/napi/src/tokio_runtime.rs461 backend: OnceLock<Box<dyn AsyncRuntime>>,COMMENT
LOWcrates/napi/src/tokio_runtime.rs481 /// A duplicate/late registration error recorded by the infallible [`register_async_runtime`];COMMENT
LOWcrates/napi/src/tokio_runtime.rs561 // `OnceLock` that is never cleared, and its trait object's vtable — plus everyCOMMENT
112 more matches not shown…
Hallucination Indicators5 hits · 75 pts
SeverityFileLineSnippetContext
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
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.ts1168 t.deepEqual(listObjKeys({ name: 'John Doe', age: 20 }), ['name', 'age'])CODE