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,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).
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 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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | async-runtime/index.d.ts | 127 | export declare function installCurrentThreadHosts( | CODE |
| LOW | async-runtime/index.d.ts | 136 | export declare function registerWorkerdCurrentThreadTaskHost( | CODE |
| 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 | 143 | export function applyDefaultPrePublishOptions(options: PrePublishOptions) { | CODE |
| LOW | cli/src/utils/metadata.ts | 80 | export function getNapiDeriveDependentCrates( | CODE |
| LOW | cli/src/utils/metadata.ts | 112 | export function createCargoMetadataInvocation( | CODE |
| LOW | cli/src/utils/version.ts | 167 | function stabilizePrereleaseComparator(comparator: Comparator) { | CODE |
| LOW | cli/src/utils/typegen.ts | 30 | function asyncGeneratorDeclaration(name: string): string { | CODE |
| LOW | cli/src/utils/typegen.ts | 472 | function makeTypeImportMarkersUnique( | CODE |
| LOW | cli/src/utils/typegen.ts | 529 | function reallocateTypeImportMarkers( | CODE |
| LOW | cli/src/utils/typegen.ts | 602 | function preserveTypeImportMarkers(defs: TypeDefLine[]): TypeDefLine[] { | CODE |
| LOW | cli/src/utils/typegen.ts | 629 | export function rewriteTypeImportReferences( | CODE |
| LOW | cli/src/utils/typegen.ts | 721 | export function rebaseDeclarationSpecifiers( | CODE |
| LOW | cli/src/utils/typegen.ts | 774 | export function collectRelativeDeclarationSpecifiers(source: string): string[] { | CODE |
| LOW | cli/src/utils/typegen.ts | 784 | function collectRelativeDeclarationSpecifierReferences( | CODE |
| LOW | cli/src/utils/typegen.ts | 866 | function createCollisionSafeIdentifier( | CODE |
| LOW | cli/src/utils/typegen.ts | 914 | function typeImportReferenceMeaning( | CODE |
| LOW | cli/src/utils/typegen.ts | 997 | function throwDeclarationDiagnostics( | CODE |
| LOW | cli/src/utils/typegen.ts | 1132 | export function removeNodeStreamWebTypeImports(source: string): string { | CODE |
| LOW | cli/src/utils/typegen.ts | 1178 | export function rewriteUnboundNodeGlobalTypeQueries(source: string): string { | CODE |
| LOW | cli/src/utils/typegen.ts | 1263 | function leadingDeclarationPreambleEnd( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 419 | function fileSystemReconciliationCapabilityRoot(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 426 | export function getPackageReconciliationRoot( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 433 | export function resolvePackageReconciliationPaths( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1765 | function reconciliationCandidateName(path: string, token: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1771 | function reconciliationCandidatePath(path: string, token: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1775 | function reconciliationRetiredPath(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 1784 | async function acquireReconciliationLock( | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3083 | function reconciliationCandidateCollisionError(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3093 | function isReconciliationCandidateCollisionError(error: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3100 | function reconciliationMetadataExistsError(path: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3110 | function isUnsupportedReconciliationHardLinkError(error: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3120 | function reconciliationHardLinkRequiredError(path: string, cause: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3148 | function reconciliationPathCollisionError(path: string, message: string) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3158 | function isReconciliationPathCollisionError(error: unknown) { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3165 | function isReconciliationLockToken(token: unknown): token is string { | CODE |
| LOW⚡ | cli/src/utils/misc.ts | 3174 | function isValidProcessIncarnation( | CODE |
| LOW | cli/src/utils/misc.ts | 524 | export function getPackageReconciliationRoots({ | CODE |
| LOW | cli/src/utils/misc.ts | 578 | function managedPackagePathIsWithin(root: string, path: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 588 | function canonicalizeManagedPackagePath(path: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 608 | function hasPackageWorkspaceBoundaryMarker(directory: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 631 | function managedPackageBoundaryError( | CODE |
| LOW | cli/src/utils/misc.ts | 644 | export async function commitFileSystemTransaction( | CODE |
| LOW | cli/src/utils/misc.ts | 692 | async function commitFileSystemTransactionUnlocked( | CODE |
| LOW | cli/src/utils/misc.ts | 1400 | async function pathsReferToSameDirectoryEntry( | CODE |
| LOW | cli/src/utils/misc.ts | 1479 | async function readReconciliationMetadata(path: string, label: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 1532 | async function canonicalizeReconciliationPath(path: string) { | CODE |
| LOW | cli/src/utils/misc.ts | 1553 | async function resolveReconciliationLockIdentities( | CODE |
| LOW | cli/src/utils/misc.ts | 1657 | async function assertReconciliationRequestedPathUnchanged( | CODE |
| LOW | cli/src/utils/misc.ts | 1683 | async function assertReconciliationAnchorUnchanged( | CODE |
| LOW | cli/src/utils/misc.ts | 1711 | async function assertReconciliationLockRootUnchanged( | CODE |
| LOW | cli/src/utils/misc.ts | 1732 | function reconciliationAnchorError( | CODE |
| LOW | cli/src/utils/misc.ts | 1754 | function reconciliationReclaimPath(identity: ReconciliationLockIdentity) { | CODE |
| LOW | cli/src/utils/misc.ts | 1892 | async function createExclusiveReconciliationMetadata( | CODE |
| 317 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | crates/async-runtime/src/adapter.rs | 261 | #[napi] | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 921 | release_host_registration_id(id); | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 941 | /// | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1041 | /// must not poison a live driver -- on a | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1061 | /// - `Status::Closing` is LIFETIME: it originates only from the TSFN layer | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1761 | // The schedule callback was never invoked (the cancellation was | COMMENT |
| LOW | crates/async-runtime/src/adapter.rs | 1961 | release_host_registration_id(id); | COMMENT |
| LOW | crates/async-runtime/src/js_callback.rs | 41 | let value_type = napi::type_of!(env, napi_val)?; | COMMENT |
| LOW | crates/async-runtime/src/lib.rs | 1 | //! A shared, tokio-free async runtime for napi-rs addons. | COMMENT |
| LOW | crates/backend/src/typegen.rs | 81 | COMMENT | |
| LOW | crates/backend/src/codegen/struct.rs | 41 | js_name: &str, | COMMENT |
| LOW | crates/backend/src/codegen/struct.rs | 61 | Some(salt) => { | COMMENT |
| LOW | crates/backend/src/codegen/fn.rs | 141 | env, | COMMENT |
| LOW | crates/backend/src/codegen/fn.rs | 301 | } else { | COMMENT |
| LOW | crates/macro/src/parser/mod.rs | 81 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 21 | COMMENT | |
| LOW | crates/napi/src/error.rs | 41 | pub(crate) maybe_ref: Option<std::sync::Arc<ErrorRef>>, | COMMENT |
| LOW | crates/napi/src/error.rs | 61 | // implementation can resolve `env`. Every access to `raw` is gated on it, so a | COMMENT |
| LOW | crates/napi/src/error.rs | 81 | // `ErrorRef::drop` releases on the owning thread directly, routes the release | COMMENT |
| LOW | crates/napi/src/error.rs | 341 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 361 | /// so converting the `Error` back with [`ToNapiValue`] reproduces the original | COMMENT |
| LOW | crates/napi/src/error.rs | 381 | /// | COMMENT |
| LOW | crates/napi/src/error.rs | 401 | /// addon — degrades to an empty reason and absent cause; the retained value | COMMENT |
| LOW | crates/napi/src/error.rs | 421 | /// Identity is reproduced only when the `Error` is converted back on the env | COMMENT |
| LOW | crates/napi/src/error.rs | 441 | /// [`Env::create_error`]: crate::Env::create_error | COMMENT |
| LOW | crates/napi/src/error.rs | 461 | } | COMMENT |
| LOW | crates/napi/src/error.rs | 601 | struct ReflectIntrinsics { | COMMENT |
| LOW | crates/napi/src/error.rs | 621 | const { std::cell::RefCell::new(None) }; | COMMENT |
| LOW | crates/napi/src/error.rs | 661 | /// detection, and no pristine reference to `napi_strict_equals` against — | COMMENT |
| LOW | crates/napi/src/error.rs | 841 | /// on this env degrades to an empty reason/cause. | COMMENT |
| LOW | crates/napi/src/error.rs | 961 | // | COMMENT |
| LOW | crates/napi/src/error.rs | 981 | // reclaimed the superseded reference — reachable only on builds without | COMMENT |
| LOW | crates/napi/src/error.rs | 1041 | COMMENT | |
| LOW | crates/napi/src/error.rs | 1121 | /// for an own descriptor via `Reflect.getOwnPropertyDescriptor`: | COMMENT |
| LOW | crates/napi/src/error.rs | 1341 | /// (preserving its subclass, stack, and own properties); converted on any | COMMENT |
| LOW | crates/napi/src/error.rs | 1381 | /// off the owning thread (a shared clone being converted on a foreign env) it | COMMENT |
| LOW | crates/napi/src/error.rs | 1421 | Some(result) | COMMENT |
| LOW | crates/napi/src/error.rs | 1521 | /// — `JsError::into_value`, which feeds `napi_throw`, and [`Env::create_error`] — | COMMENT |
| LOW | crates/napi/src/env.rs | 361 | #[cfg(feature = "compat-mode")] | COMMENT |
| LOW | crates/napi/src/env.rs | 561 | /// | COMMENT |
| LOW | crates/napi/src/env.rs | 1021 | Status::InvalidArg, | COMMENT |
| LOW | crates/napi/src/env.rs | 1161 | } | COMMENT |
| LOW | crates/napi/src/env.rs | 1461 | COMMENT | |
| LOW | crates/napi/src/env.rs | 1481 | where | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 41 | #[cfg(all(feature = "async-runtime", not(feature = "noop")))] | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 61 | /// [`LifecyclePhase::Idle`] the teardown left behind and starts the backend again — after its | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 81 | /// memory, which is where this static lives. Rust statics are per-instance; a second | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 101 | /// [`WASM_ENV_DISPOSING`] for why registration is the only safe release point. | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 161 | /// | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 181 | /// Behavioral contract for backends: | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 301 | /// synchronous APIs; runtime-backed operations reject with a missing-backend error. | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 321 | /// the `Send + Sync + 'static` bound. The backend's [`Drop`] implementation is not guaranteed to | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 341 | /// backend that cannot prove those references inert must keep the native image loaded itself or | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 361 | /// [`AsyncRuntimeRejection`] or accept it and defer execution. | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 381 | COMMENT | |
| LOW | crates/napi/src/tokio_runtime.rs | 401 | /// lifetime. Implement it idempotently. Return success only after the backend can accept tasks. Do not | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 421 | /// Those cancellation-driven promise rejections are best-effort: when the promise machinery | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 461 | backend: OnceLock<Box<dyn AsyncRuntime>>, | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 481 | /// A duplicate/late registration error recorded by the infallible [`register_async_runtime`]; | COMMENT |
| LOW | crates/napi/src/tokio_runtime.rs | 561 | // `OnceLock` that is never cleared, and its trait object's vtable — plus every | COMMENT |
| 112 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| 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 |
|---|---|---|---|---|
| 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 | 1168 | t.deepEqual(listObjKeys({ name: 'John Doe', age: 20 }), ['name', 'age']) | CODE |