@rigour-labs/core 3.0.2 → 3.0.3

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.
@@ -6,17 +6,18 @@
6
6
  * statements for packages, files, or modules that were never installed
7
7
  * or created.
8
8
  *
9
- * Detection strategy:
10
- * 1. Parse all import/require statements
11
- * 2. For relative imports: verify the target file exists
12
- * 3. For package imports: verify the package exists in node_modules or package.json
13
- * 4. For Python imports: verify the module exists in the project or site-packages
14
- * 5. For Go imports: verify relative package paths exist in the project
15
- * 6. For Ruby/C#: verify relative require/using paths exist
16
- *
17
- * Supported languages: JS/TS, Python, Go, Ruby, C#
9
+ * Supported languages (v3.0.1):
10
+ * JS/TS — package.json deps, node_modules fallback, Node.js builtins (22.x)
11
+ * Python — stdlib whitelist (3.12+), relative imports, local module resolution
12
+ * Go — stdlib whitelist (1.22+), go.mod module path, aliased imports
13
+ * Ruby — stdlib whitelist (3.3+), Gemfile parsing, require + require_relative
14
+ * C# — .NET 8 framework namespaces, .csproj NuGet parsing, using directives
15
+ * Rust — std/core/alloc crates, Cargo.toml deps, use/extern crate statements
16
+ * Java — java/javax/jakarta stdlib, build.gradle + pom.xml deps, import statements
17
+ * Kotlin kotlin/kotlinx stdlib, Gradle deps, import statements
18
18
  *
19
19
  * @since v2.16.0
20
+ * @since v3.0.1 — Go stdlib fix, Ruby/C# strengthened, Rust/Java/Kotlin added
20
21
  */
21
22
  import { Gate, GateContext } from './base.js';
22
23
  import { Failure, Provenance } from '../types/index.js';
@@ -24,7 +25,7 @@ export interface HallucinatedImport {
24
25
  file: string;
25
26
  line: number;
26
27
  importPath: string;
27
- type: 'relative' | 'package' | 'python' | 'go' | 'ruby' | 'csharp';
28
+ type: 'relative' | 'package' | 'python' | 'go' | 'ruby' | 'csharp' | 'rust' | 'java' | 'kotlin';
28
29
  reason: string;
29
30
  }
30
31
  export interface HallucinatedImportsConfig {
@@ -43,6 +44,10 @@ export declare class HallucinatedImportsGate extends Gate {
43
44
  private resolveRelativeImport;
44
45
  private extractPackageName;
45
46
  private shouldIgnore;
47
+ /**
48
+ * Node.js built-in modules — covers Node.js 18/20/22 LTS
49
+ * No third-party packages in this list (removed fs-extra hack).
50
+ */
46
51
  private isNodeBuiltin;
47
52
  private isPythonStdlib;
48
53
  /**
@@ -67,13 +72,74 @@ export declare class HallucinatedImportsGate extends Gate {
67
72
  */
68
73
  private isGoStdlib;
69
74
  /**
70
- * Check Ruby imports — verify require_relative paths exist
75
+ * Check Ruby imports — require, require_relative, Gemfile verification
76
+ *
77
+ * Strategy:
78
+ * 1. require_relative: verify target .rb file exists in project
79
+ * 2. require: skip stdlib, skip gems from Gemfile/gemspec, flag unknown local requires
80
+ *
81
+ * @since v3.0.1 — strengthened with stdlib whitelist and Gemfile parsing
71
82
  */
72
83
  private checkRubyImports;
84
+ /** Load gem names from Gemfile */
85
+ private loadRubyGems;
73
86
  /**
74
- * Check C# importsverify relative using paths match project namespaces
75
- * (C# uses namespaces, not file paths we check for obviously wrong namespaces)
87
+ * Ruby standard librarycovers Ruby 3.3+ (MRI)
88
+ * Includes both the default gems and bundled gems that ship with Ruby.
89
+ */
90
+ private isRubyStdlib;
91
+ /**
92
+ * Check C# imports — using directives against .NET framework, NuGet, and project
93
+ *
94
+ * Strategy:
95
+ * 1. Skip .NET framework namespaces (System.*, Microsoft.*, etc.)
96
+ * 2. Skip NuGet packages from .csproj PackageReference
97
+ * 3. Flag project-relative namespaces that don't resolve
98
+ *
99
+ * @since v3.0.1 — .csproj NuGet parsing, comprehensive framework namespace list
76
100
  */
77
101
  private checkCSharpImports;
102
+ /** Check if any .csproj file exists in the project root */
103
+ private hasCsprojFile;
104
+ /** Parse .csproj files for PackageReference names */
105
+ private loadNuGetPackages;
106
+ /**
107
+ * .NET 8 framework and common ecosystem namespaces
108
+ * Covers BCL, ASP.NET, EF Core, and major ecosystem packages
109
+ */
110
+ private isDotNetFramework;
111
+ /**
112
+ * Check Rust imports — use/extern crate against std/core/alloc and Cargo.toml
113
+ *
114
+ * Strategy:
115
+ * 1. Skip Rust std, core, alloc crates
116
+ * 2. Skip crates listed in Cargo.toml [dependencies]
117
+ * 3. Flag unknown extern crate and use statements for project modules that don't exist
118
+ *
119
+ * @since v3.0.1
120
+ */
121
+ private checkRustImports;
122
+ /** Load dependency names from Cargo.toml */
123
+ private loadCargoDeps;
124
+ /** Rust standard crates — std, core, alloc, proc_macro, and common test crates */
125
+ private isRustStdCrate;
126
+ /**
127
+ * Check Java/Kotlin imports — against stdlib and build dependencies
128
+ *
129
+ * Strategy:
130
+ * 1. Skip java.*, javax.*, jakarta.* (Java stdlib/EE)
131
+ * 2. Skip kotlin.*, kotlinx.* (Kotlin stdlib)
132
+ * 3. Skip deps from build.gradle or pom.xml
133
+ * 4. Flag project-relative imports that don't resolve
134
+ *
135
+ * @since v3.0.1
136
+ */
137
+ private checkJavaKotlinImports;
138
+ /** Load dependency group IDs from build.gradle or pom.xml */
139
+ private loadJavaDeps;
140
+ /** Java standard library and Jakarta EE namespaces */
141
+ private isJavaStdlib;
142
+ /** Kotlin standard library namespaces */
143
+ private isKotlinStdlib;
78
144
  private loadPackageJson;
79
145
  }