@alint-js/core 0.5.0 → 0.7.0

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.
package/README.md CHANGED
@@ -182,3 +182,10 @@ source files retained by plugin code after `ctx.src.readFile()` returns.
182
182
 
183
183
  A valid cache written by the same `alint` version is still read from one monolithic JSON document.
184
184
  An extremely large cache may therefore exhaust available memory.
185
+
186
+ After each cacheable rule job completes, `alint` writes a cache checkpoint before releasing its
187
+ scheduler slot. Each checkpoint atomically replaces the monolithic cache file. An interrupted run
188
+ can therefore reuse every result that had already become durable, but large caches can cause
189
+ substantial disk writes during runs with many cache misses. Cache hits, skipped jobs, failed jobs,
190
+ and rules that opt out of caching do not add checkpoint writes. A checkpoint or final cache write
191
+ error is fatal and causes the run to fail.
package/dist/agent.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { F as AgentTool, I as AgentUsage, M as AgentAdapter, N as AgentRequest, P as AgentResult, b as RuleContext } from "./types-BK5CADYK.mjs";
1
+ import { F as AgentAdapter, I as AgentRequest, L as AgentResult, R as AgentTool, x as RuleContext, z as AgentUsage } from "./types-Cm5Z7Fll.mjs";
2
2
  //#region src/agent/retry.d.ts
3
3
  /**
4
4
  * Declares that the complete adapter invocation can be safely replayed.
@@ -1,4 +1,4 @@
1
- import { E as RuleOptionsSchema, i as AlintConfigItem, p as PluginDefinition, t as AlintConfig, w as RuleOptionsInput, x as RuleDefinition, y as RuleConfigEntry } from "./types-BK5CADYK.mjs";
1
+ import { D as RuleOptionsSchema, S as RuleDefinition, T as RuleOptionsInput, b as RuleConfigEntry, i as AlintConfigItem, m as PluginDefinition, t as AlintConfig } from "./types-Cm5Z7Fll.mjs";
2
2
  //#region src/dsl/define.d.ts
3
3
  type AnyRuleDefinition = RuleDefinition<any>;
4
4
  type ConfigItemWithPluginRules<Plugins, Rules> = Omit<AlintConfigItem, 'plugins' | 'rules'> & {
package/dist/dsl.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as RuleWithHandler, C as RuleInferenceUsageRecord, D as RuleRegistry, E as RuleOptionsSchema, O as RuleSeverity, S as RuleHandlers, T as RuleOptionsOutput, _ as ProjectTargetEntry, a as AlintLinterOptions, b as RuleContext, c as DiagnosticLocation, d as IgnoreConfig, f as LanguageDefinition, g as ProjectTarget, h as ProjectFileEntry, i as AlintConfigItem, j as Target, k as RuleSpecializedHandlers, l as DirectoryTarget, m as ProcessorDefinition, n as AlintConfigExtends, o as Awaitable, p as PluginDefinition, r as AlintConfigInput, s as DiagnosticDescriptor, t as AlintConfig, u as EnabledRule, v as RuleCacheConfig, w as RuleOptionsInput, x as RuleDefinition, y as RuleConfigEntry } from "./types-BK5CADYK.mjs";
2
- import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-CNfm3wZW.mjs";
3
- export { type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintLinterOptions, type Awaitable, type DiagnosticDescriptor, type DiagnosticLocation, type DirectoryTarget, type EnabledRule, type IgnoreConfig, type LanguageDefinition, type PluginDefinition, type ProcessorDefinition, type ProjectFileEntry, type ProjectTarget, type ProjectTargetEntry, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleHandlers, type RuleInferenceUsageRecord, type RuleOptionsInput, type RuleOptionsOutput, type RuleOptionsSchema, type RuleRegistry, type RuleSeverity, type RuleSpecializedHandlers, type RuleWithHandler, type Target, defineConfig, definePlugin, defineRule };
1
+ import { A as RuleSpecializedHandlers, C as RuleHandlers, D as RuleOptionsSchema, E as RuleOptionsOutput, M as StopGateConfig, N as StopGateTarget, O as RuleRegistry, P as Target, S as RuleDefinition, T as RuleOptionsInput, _ as ProjectTarget, a as AlintLinterOptions, b as RuleConfigEntry, c as DiagnosticLocation, d as IgnoreConfig, f as IntegrationsConfig, g as ProjectFileEntry, h as ProcessorDefinition, i as AlintConfigItem, j as RuleWithHandler, k as RuleSeverity, l as DirectoryTarget, m as PluginDefinition, n as AlintConfigExtends, o as Awaitable, p as LanguageDefinition, r as AlintConfigInput, s as DiagnosticDescriptor, t as AlintConfig, u as EnabledRule, v as ProjectTargetEntry, w as RuleInferenceUsageRecord, x as RuleContext, y as RuleCacheConfig } from "./types-Cm5Z7Fll.mjs";
2
+ import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-DO36VJ4W.mjs";
3
+ export { type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintLinterOptions, type Awaitable, type DiagnosticDescriptor, type DiagnosticLocation, type DirectoryTarget, type EnabledRule, type IgnoreConfig, type IntegrationsConfig, type LanguageDefinition, type PluginDefinition, type ProcessorDefinition, type ProjectFileEntry, type ProjectTarget, type ProjectTargetEntry, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleHandlers, type RuleInferenceUsageRecord, type RuleOptionsInput, type RuleOptionsOutput, type RuleOptionsSchema, type RuleRegistry, type RuleSeverity, type RuleSpecializedHandlers, type RuleWithHandler, type StopGateConfig, type StopGateTarget, type Target, defineConfig, definePlugin, defineRule };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,8 @@
1
- import { A as RuleWithHandler, B as ResolvedProvider, C as RuleInferenceUsageRecord, D as RuleRegistry, G as RunnerStatsConfig, H as ProviderDefinition, K as SetupConfig, L as ModelRequirement, O as RuleSeverity, R as ResolveModelOptions, S as RuleHandlers, U as ProviderType, V as ModelSize, W as RunnerConfig, _ as ProjectTargetEntry, a as AlintLinterOptions, b as RuleContext, c as DiagnosticLocation, d as IgnoreConfig, f as LanguageDefinition, g as ProjectTarget, h as ProjectFileEntry, i as AlintConfigItem, j as Target, k as RuleSpecializedHandlers, l as DirectoryTarget, m as ProcessorDefinition, n as AlintConfigExtends, o as Awaitable, p as PluginDefinition, q as SetupModelDefinition, r as AlintConfigInput, s as DiagnosticDescriptor, t as AlintConfig, u as EnabledRule, v as RuleCacheConfig, x as RuleDefinition, y as RuleConfigEntry, z as ResolvedModel } from "./types-BK5CADYK.mjs";
1
+ import { A as RuleSpecializedHandlers, B as ModelRequirement, C as RuleHandlers, G as ProviderDefinition, H as ResolvedModel, J as RunnerStatsConfig, K as ProviderType, M as StopGateConfig, N as StopGateTarget, O as RuleRegistry, P as Target, S as RuleDefinition, U as ResolvedProvider, V as ResolveModelOptions, W as ModelSize, X as SetupModelDefinition, Y as SetupConfig, _ as ProjectTarget, a as AlintLinterOptions, b as RuleConfigEntry, c as DiagnosticLocation, d as IgnoreConfig, f as IntegrationsConfig, g as ProjectFileEntry, h as ProcessorDefinition, i as AlintConfigItem, j as RuleWithHandler, k as RuleSeverity, l as DirectoryTarget, m as PluginDefinition, n as AlintConfigExtends, o as Awaitable, p as LanguageDefinition, q as RunnerConfig, r as AlintConfigInput, s as DiagnosticDescriptor, t as AlintConfig, u as EnabledRule, v as ProjectTargetEntry, w as RuleInferenceUsageRecord, x as RuleContext, y as RuleCacheConfig } from "./types-Cm5Z7Fll.mjs";
2
2
  import { C as SourceTarget, D as SourceTargetOrigin, E as SourceTargetOfKind, O as SourceText, S as SourceRuntime, T as SourceTargetMetadata, _ as SourceLocation, a as FunctionInfo, b as SourcePosition, c as LineRange, d as ProcessedSource, f as ProcessedSourceOrigin, g as SourceFile, h as SourceExtractOptions, i as FileTarget, l as PlannedSourceTarget, m as ProcessorPostprocessContext, n as CallSite, o as FunctionTarget, p as ProcessorContext, r as ClassTarget, s as LanguageContext, t as BaseSourceFile, u as PlannedSourceTargetOfKind, v as SourceMetadataObject, w as SourceTargetKind, x as SourceRange, y as SourceMetadataValue } from "./types-DM4idR4w.mjs";
3
- import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-CNfm3wZW.mjs";
3
+ import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-DO36VJ4W.mjs";
4
+ import { appendFile, writeFile } from "node:fs/promises";
5
+ import "proper-lockfile";
4
6
  //#region src/config/config-array.d.ts
5
7
  interface EffectiveAlintConfig {
6
8
  agent?: AlintConfigItem['agent'];
@@ -32,22 +34,15 @@ declare function resolveConfigForDirectory(directoryPath: string, input: AlintCo
32
34
  declare function resolveConfigForFile(filePath: string, input: AlintConfig, options: ResolveConfigOptions): ResolveConfigResult;
33
35
  declare function resolveConfigForProject(projectPath: string, input: AlintConfig, options: ResolveConfigOptions): ResolveConfigResult;
34
36
  //#endregion
35
- //#region src/core/languages/registry.d.ts
36
- interface LanguageRegistry {
37
- byExtension: Map<string, string>;
38
- languages: Map<string, LanguageDefinition>;
39
- }
40
- declare function registerLanguage(registry: LanguageRegistry, language: LanguageDefinition): void;
41
- //#endregion
42
- //#region src/core/languages/resolve.d.ts
43
- interface ResolveLanguageOptions {
44
- language?: string;
45
- processedLanguage?: string;
46
- }
47
- declare function resolveLanguage(file: SourceFile, registry: LanguageRegistry, options: ResolveLanguageOptions): LanguageDefinition;
48
- //#endregion
49
- //#region src/core/languages/index.d.ts
50
- declare function createBuiltInLanguageRegistry(): LanguageRegistry;
37
+ //#region src/config/stop-gate.d.ts
38
+ interface ResolvedStopGateConfig {
39
+ enabled: boolean;
40
+ target: StopGateTarget;
41
+ timeoutMs: number;
42
+ }
43
+ declare const maximumStopGateTimeoutMs: number;
44
+ declare const defaultStopGateConfig: Readonly<ResolvedStopGateConfig>;
45
+ declare function resolveStopGateConfig(config: AlintConfig, cwd: string): ResolvedStopGateConfig;
51
46
  //#endregion
52
47
  //#region src/core/types.d.ts
53
48
  interface AlintFailureCause {
@@ -244,6 +239,33 @@ interface UsageProgressPayload {
244
239
  record: InferenceUsageRecord;
245
240
  }
246
241
  //#endregion
242
+ //#region src/core/cache/store.d.ts
243
+ interface NormalizedRunnerCacheConfig {
244
+ enabled: boolean;
245
+ location: string;
246
+ }
247
+ declare function normalizeRunnerCacheConfig(cache: RunnerConfig['cache'], cwd: string): NormalizedRunnerCacheConfig;
248
+ //#endregion
249
+ //#region src/core/hash.d.ts
250
+ declare function stableHash(value: unknown): string;
251
+ //#endregion
252
+ //#region src/core/languages/registry.d.ts
253
+ interface LanguageRegistry {
254
+ byExtension: Map<string, string>;
255
+ languages: Map<string, LanguageDefinition>;
256
+ }
257
+ declare function registerLanguage(registry: LanguageRegistry, language: LanguageDefinition): void;
258
+ //#endregion
259
+ //#region src/core/languages/resolve.d.ts
260
+ interface ResolveLanguageOptions {
261
+ language?: string;
262
+ processedLanguage?: string;
263
+ }
264
+ declare function resolveLanguage(file: SourceFile, registry: LanguageRegistry, options: ResolveLanguageOptions): LanguageDefinition;
265
+ //#endregion
266
+ //#region src/core/languages/index.d.ts
267
+ declare function createBuiltInLanguageRegistry(): LanguageRegistry;
268
+ //#endregion
247
269
  //#region src/core/preparation.d.ts
248
270
  /**
249
271
  * The `ctx.src.extract` a run hands to rules, for parsing files it was never asked to lint, which
@@ -270,6 +292,10 @@ declare class AlintAbortError extends AlintRunCancelledError {
270
292
  cause?: unknown;
271
293
  });
272
294
  }
295
+ declare class AlintCachePersistenceError extends Error {
296
+ readonly result: RunResult;
297
+ constructor(result: RunResult, cause: unknown);
298
+ }
273
299
  declare class AlintRunError extends Error {
274
300
  readonly failures: AlintRunFailure[];
275
301
  readonly result: RunResult;
@@ -380,4 +406,4 @@ declare function benchmarkModels(config: SetupConfig, options?: BenchmarkModelsO
380
406
  //#region src/models/resolve.d.ts
381
407
  declare function resolveModel(registry: SetupConfig, options?: ResolveModelOptions): ResolvedModel;
382
408
  //#endregion
383
- export { AlintAbortError, type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintFailureCause, type AlintFileFailure, type AlintLinterOptions, type AlintRuleFailure, AlintRunCancelledError, AlintRunError, type AlintRunFailure, type Awaitable, type BaseSourceFile, type BenchmarkModelsOptions, type CallSite, type ClassTarget, type Diagnostic, type DiagnosticDescriptor, type DiagnosticLocation, type DiagnosticProgressPayload, type DirectoryTarget, type EffectiveAlintConfig, type EnabledRule, type ExecutionCounts, type ExecutionProgressPayload, type FileReadyPayload, type FileTarget, type FunctionInfo, type FunctionTarget, type IgnoreConfig, type InferenceUsageRecord, type JobEndPayload, type JobQueuedPayload, type JobRetryPayload, type JobStartPayload, type LanguageContext, type LanguageDefinition, type LanguageRegistry, type LineRange, type ModelBenchmarkActive, type ModelBenchmarkMeasurement, type ModelBenchmarkProgress, type ModelBenchmarkRequest, type ModelBenchmarkResult, type ModelRequirement, type ModelSize, type PlannedSourceTarget, type PlannedSourceTargetOfKind, type PluginDefinition, type PrepareEndPayload, type PrepareStartPayload, type ProcessedSource, type ProcessedSourceOrigin, type ProcessorContext, type ProcessorDefinition, type ProcessorPostprocessContext, type ProgressJobRef, type ProgressReporter, type ProgressSnapshot, type ProgressTargetKind, type ProjectFileEntry, type ProjectTarget, type ProjectTargetEntry, type ProviderDefinition, type ProviderType, type ResolveConfigResult, type ResolveLanguageOptions, type ResolveModelOptions, type ResolvedModel, type ResolvedProvider, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleHandlers, type RuleInferenceUsageRecord, type RuleRegistry, type RuleSeverity, type RuleSpecializedHandlers, type RuleWithHandler, type RunEndPayload, type RunExecution, type RunOptions, type RunResult, type RunUsage, type RunUsageTotals, type RunnerConfig, type RunnerStatsConfig, type SetupConfig, type SetupModelDefinition, type SourceExtractOptions, type SourceFile, type SourceLocation, type SourceMetadataObject, type SourceMetadataValue, type SourcePosition, type SourceRange, type SourceRuntime, type SourceRuntimeOptions, type SourceTarget, type SourceTargetKind, type SourceTargetMetadata, type SourceTargetOfKind, type SourceTargetOrigin, type SourceText, type Target, type UsageProgressPayload, benchmarkModels, buildRuleRegistry, createBuiltInLanguageRegistry, createSourceExtractor, createSourceFile, createSourceRuntime, defineConfig, definePlugin, defineRule, hasDiscoveryFilePatterns, matchesDiscoveryFile, normalizeConfig, registerLanguage, resolveConfigForDirectory, resolveConfigForFile, resolveConfigForProject, resolveLanguage, resolveModel, runAlint, sliceLines, sliceRange, targetIdentity, withLanguage, withStableIdentities };
409
+ export { AlintAbortError, AlintCachePersistenceError, type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintFailureCause, type AlintFileFailure, type AlintLinterOptions, type AlintRuleFailure, AlintRunCancelledError, AlintRunError, type AlintRunFailure, type Awaitable, type BaseSourceFile, type BenchmarkModelsOptions, type CallSite, type ClassTarget, type Diagnostic, type DiagnosticDescriptor, type DiagnosticLocation, type DiagnosticProgressPayload, type DirectoryTarget, type EffectiveAlintConfig, type EnabledRule, type ExecutionCounts, type ExecutionProgressPayload, type FileReadyPayload, type FileTarget, type FunctionInfo, type FunctionTarget, type IgnoreConfig, type InferenceUsageRecord, type IntegrationsConfig, type JobEndPayload, type JobQueuedPayload, type JobRetryPayload, type JobStartPayload, type LanguageContext, type LanguageDefinition, type LanguageRegistry, type LineRange, type ModelBenchmarkActive, type ModelBenchmarkMeasurement, type ModelBenchmarkProgress, type ModelBenchmarkRequest, type ModelBenchmarkResult, type ModelRequirement, type ModelSize, type NormalizedRunnerCacheConfig, type PlannedSourceTarget, type PlannedSourceTargetOfKind, type PluginDefinition, type PrepareEndPayload, type PrepareStartPayload, type ProcessedSource, type ProcessedSourceOrigin, type ProcessorContext, type ProcessorDefinition, type ProcessorPostprocessContext, type ProgressJobRef, type ProgressReporter, type ProgressSnapshot, type ProgressTargetKind, type ProjectFileEntry, type ProjectTarget, type ProjectTargetEntry, type ProviderDefinition, type ProviderType, type ResolveConfigResult, type ResolveLanguageOptions, type ResolveModelOptions, type ResolvedModel, type ResolvedProvider, type ResolvedStopGateConfig, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleHandlers, type RuleInferenceUsageRecord, type RuleRegistry, type RuleSeverity, type RuleSpecializedHandlers, type RuleWithHandler, type RunEndPayload, type RunExecution, type RunOptions, type RunResult, type RunUsage, type RunUsageTotals, type RunnerConfig, type RunnerStatsConfig, type SetupConfig, type SetupModelDefinition, type SourceExtractOptions, type SourceFile, type SourceLocation, type SourceMetadataObject, type SourceMetadataValue, type SourcePosition, type SourceRange, type SourceRuntime, type SourceRuntimeOptions, type SourceTarget, type SourceTargetKind, type SourceTargetMetadata, type SourceTargetOfKind, type SourceTargetOrigin, type SourceText, type StopGateConfig, type StopGateTarget, type Target, type UsageProgressPayload, benchmarkModels, buildRuleRegistry, createBuiltInLanguageRegistry, createSourceExtractor, createSourceFile, createSourceRuntime, defaultStopGateConfig, defineConfig, definePlugin, defineRule, hasDiscoveryFilePatterns, matchesDiscoveryFile, maximumStopGateTimeoutMs, normalizeConfig, normalizeRunnerCacheConfig, registerLanguage, resolveConfigForDirectory, resolveConfigForFile, resolveConfigForProject, resolveLanguage, resolveModel, resolveStopGateConfig, runAlint, sliceLines, sliceRange, stableHash, targetIdentity, withLanguage, withStableIdentities };