@archlinter/core 0.7.0 → 0.8.1-canary.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.
Files changed (3) hide show
  1. package/index.d.ts +67 -0
  2. package/index.js +3 -1
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export interface JsScanOptions {
18
18
  cache?: boolean
19
19
  /** Enable git integration (default: true) */
20
20
  git?: boolean
21
+ /** Git history analysis period (e.g. "90d", "1y", "all") */
22
+ gitHistoryPeriod?: string
21
23
  }
22
24
  export interface JsScanResult {
23
25
  smells: Array<JsSmellWithExplanation>
@@ -147,6 +149,71 @@ export interface JsStateStats {
147
149
  graphNodes: number
148
150
  graphEdges: number
149
151
  }
152
+ export interface JsDiffOptions {
153
+ baselinePath: string
154
+ projectPath: string
155
+ currentPath?: string
156
+ }
157
+ export interface JsDiffResult {
158
+ hasRegressions: boolean
159
+ regressions: Array<JsRegression>
160
+ improvements: Array<JsImprovement>
161
+ summary: JsDiffSummary
162
+ baselineCommit?: string
163
+ currentCommit?: string
164
+ }
165
+ export interface JsRegression {
166
+ id: string
167
+ regressionType: JsRegressionType
168
+ smell: JsSnapshotSmell
169
+ message: string
170
+ explain?: JsExplainBlock
171
+ }
172
+ export interface JsRegressionType {
173
+ type: string
174
+ from?: string
175
+ to?: string
176
+ metric?: string
177
+ fromVal?: number
178
+ toVal?: number
179
+ changePercent?: number
180
+ }
181
+ export interface JsImprovement {
182
+ id: string
183
+ improvementType: JsImprovementType
184
+ message: string
185
+ }
186
+ export interface JsImprovementType {
187
+ type: string
188
+ from?: string
189
+ to?: string
190
+ metric?: string
191
+ fromVal?: number
192
+ toVal?: number
193
+ }
194
+ export interface JsDiffSummary {
195
+ newSmells: number
196
+ fixedSmells: number
197
+ worsenedSmells: number
198
+ improvedSmells: number
199
+ totalRegressions: number
200
+ totalImprovements: number
201
+ }
202
+ export interface JsExplainBlock {
203
+ whyBad: string
204
+ consequences: string
205
+ howToFix: string
206
+ }
207
+ export interface JsSnapshotSmell {
208
+ id: string
209
+ smellType: string
210
+ severity: string
211
+ files: Array<string>
212
+ metrics: Record<string, unknown>
213
+ details?: unknown
214
+ }
215
+ export declare function runDiff(options: JsDiffOptions): JsDiffResult
216
+ export declare function runDiffAsync(options: JsDiffOptions): Promise<JsDiffResult>
150
217
  export declare function scan(path: string, options?: JsScanOptions | undefined | null): Promise<JsScanResult>
151
218
  export declare function scanSync(path: string, options?: JsScanOptions | undefined | null): JsScanResult
152
219
  export declare function loadConfig(path?: string | undefined | null): JsConfig
package/index.js CHANGED
@@ -310,8 +310,10 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { scan, scanSync, loadConfig, getDetectors, clearCache, ArchlintAnalyzer } = nativeBinding
313
+ const { runDiff, runDiffAsync, scan, scanSync, loadConfig, getDetectors, clearCache, ArchlintAnalyzer } = nativeBinding
314
314
 
315
+ module.exports.runDiff = runDiff
316
+ module.exports.runDiffAsync = runDiffAsync
315
317
  module.exports.scan = scan
316
318
  module.exports.scanSync = scanSync
317
319
  module.exports.loadConfig = loadConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archlinter/core",
3
- "version": "0.7.0",
3
+ "version": "0.8.1-canary.3",
4
4
  "description": "Core library for archlint - programmatic API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,12 +27,12 @@
27
27
  }
28
28
  },
29
29
  "optionalDependencies": {
30
- "@archlinter/core-win32-x64-msvc": "0.7.0",
31
- "@archlinter/core-darwin-x64": "0.7.0",
32
- "@archlinter/core-linux-x64-gnu": "0.7.0",
33
- "@archlinter/core-linux-x64-musl": "0.7.0",
34
- "@archlinter/core-linux-arm64-gnu": "0.7.0",
35
- "@archlinter/core-darwin-arm64": "0.7.0"
30
+ "@archlinter/core-win32-x64-msvc": "0.8.1-canary.3",
31
+ "@archlinter/core-darwin-x64": "0.8.1-canary.3",
32
+ "@archlinter/core-linux-x64-gnu": "0.8.1-canary.3",
33
+ "@archlinter/core-linux-x64-musl": "0.8.1-canary.3",
34
+ "@archlinter/core-linux-arm64-gnu": "0.8.1-canary.3",
35
+ "@archlinter/core-darwin-arm64": "0.8.1-canary.3"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=18"