@alint-js/core 0.0.22 → 0.0.23

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
@@ -26,7 +26,7 @@ import { defineRule } from '@alint-js/core'
26
26
 
27
27
  export const rule = defineRule({
28
28
  create: ctx => ({
29
- async onTarget(target) {
29
+ async onTargetFile(target) {
30
30
  const model = await ctx.model({ size: 'small' })
31
31
 
32
32
  ctx.report({
package/dist/agent.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as AgentTool, L as AgentAdapter, R as AgentRequest, V as AgentUsage, g as RuleContext, z as AgentResult } from "./types-DQfoxG8J.mjs";
1
+ import { J as AgentResult, K as AgentAdapter, X as AgentUsage, Y as AgentTool, q as AgentRequest, v as RuleContext } from "./types-CIqhJ96f.mjs";
2
2
 
3
3
  //#region src/agent/index.d.ts
4
4
  declare function defineTool(tool: AgentTool): AgentTool;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as SourcePosition, C as LineRange, D as ProcessorPostprocessContext, E as ProcessorContext, F as SourceTargetOrigin, G as ResolvedProvider, H as ModelRequirement, I as SourceText, J as ProviderType, K as ModelSize, M as SourceRuntime, N as SourceTarget, O as SourceFile, P as SourceTargetKind, Q as SetupModelDefinition, S as LanguageContext, T as ProcessedSourceOrigin, U as ResolveModelOptions, W as ResolvedModel, X as RunnerStatsConfig, Y as RunnerConfig, Z as SetupConfig, _ as RuleDefinition, a as AlintLinterOptions, b as RuleRegistry, c as DiagnosticLocation, d as LanguageDefinition, f as PluginDefinition, g as RuleContext, h as RuleConfigEntry, i as AlintConfigItem, j as SourceRange, k as SourceLocation, l as EnabledRule, m as RuleCacheConfig, n as AlintConfigExtends, o as Awaitable, p as ProcessorDefinition, q as ProviderDefinition, r as AlintConfigInput, s as DiagnosticDescriptor, t as AlintConfig, u as IgnoreConfig, v as RuleHandlers, w as ProcessedSource, x as RuleSeverity, y as RuleInferenceUsageRecord } from "./types-DQfoxG8J.mjs";
1
+ import { $ as ResolvedModel, A as LanguageContext, B as SourceRuntime, C as RuleSeverity, D as ClassTarget, E as Target, F as ProcessorPostprocessContext, G as SourceText, H as SourceTargetKind, I as SourceFile, L as SourceLocation, M as ProcessedSource, N as ProcessedSourceOrigin, O as FileTarget, P as ProcessorContext, Q as ResolveModelOptions, R as SourcePosition, S as RuleRegistry, T as RuleWithHandler, U as SourceTargetOfKind, V as SourceTarget, W as SourceTargetOrigin, Z as ModelRequirement, _ as RuleConfigEntry, a as AlintLinterOptions, at as RunnerStatsConfig, b as RuleHandlers, c as DiagnosticLocation, d as IgnoreConfig, et as ResolvedProvider, f as LanguageDefinition, g as RuleCacheConfig, h as ProjectTarget, i as AlintConfigItem, it as RunnerConfig, j as LineRange, k as FunctionTarget, l as DirectoryTarget, m as ProcessorDefinition, n as AlintConfigExtends, nt as ProviderDefinition, o as Awaitable, ot as SetupConfig, p as PluginDefinition, r as AlintConfigInput, rt as ProviderType, s as DiagnosticDescriptor, st as SetupModelDefinition, t as AlintConfig, tt as ModelSize, u as EnabledRule, v as RuleContext, w as RuleSpecializedHandlers, x as RuleInferenceUsageRecord, y as RuleDefinition, z as SourceRange } from "./types-CIqhJ96f.mjs";
2
2
 
3
3
  //#region src/config/config-array.d.ts
4
4
  interface EffectiveAlintConfig {
@@ -27,7 +27,9 @@ interface ResolveConfigResult {
27
27
  declare function hasDiscoveryFilePatterns(input: AlintConfig): boolean;
28
28
  declare function matchesDiscoveryFile(filePath: string, input: AlintConfig, options: ResolveConfigOptions): boolean;
29
29
  declare function normalizeConfig(input: readonly AlintConfigInput[]): AlintConfigItem[];
30
+ declare function resolveConfigForDirectory(directoryPath: string, input: AlintConfig, options: ResolveConfigOptions): ResolveConfigResult;
30
31
  declare function resolveConfigForFile(filePath: string, input: AlintConfig, options: ResolveConfigOptions): ResolveConfigResult;
32
+ declare function resolveConfigForProject(projectPath: string, input: AlintConfig, options: ResolveConfigOptions): ResolveConfigResult;
31
33
  //#endregion
32
34
  //#region src/core/languages/registry.d.ts
33
35
  interface LanguageRegistry {
@@ -50,7 +52,17 @@ declare function createBuiltInLanguageRegistry(): LanguageRegistry;
50
52
  declare function extractJsSourceTargets(file: SourceFile): SourceTarget[];
51
53
  //#endregion
52
54
  //#region src/core/types.d.ts
55
+ interface AlintRunFailure {
56
+ filePath?: string;
57
+ message: string;
58
+ ruleId?: string;
59
+ target?: {
60
+ kind: ProgressTargetKind;
61
+ name?: string;
62
+ };
63
+ }
53
64
  interface Diagnostic {
65
+ cached?: boolean;
54
66
  evidence?: unknown;
55
67
  filePath: string;
56
68
  loc?: DiagnosticLocation;
@@ -130,12 +142,17 @@ interface RunEndPayload {
130
142
  startedAt?: number;
131
143
  usage: RunUsage;
132
144
  }
133
- interface RunnerOptions extends RunnerConfig {
134
- clock?: () => number;
145
+ interface RunExecution {
146
+ cached: number;
147
+ completed: number;
148
+ errored: number;
149
+ planned: number;
135
150
  }
151
+ type RunnerOptions = RunnerConfig;
136
152
  interface RunOptions {
137
153
  config?: AlintConfig;
138
154
  cwd?: string;
155
+ directories?: string[];
139
156
  files?: string[];
140
157
  modelOverride?: string;
141
158
  outputLanguage?: string;
@@ -145,6 +162,7 @@ interface RunOptions {
145
162
  }
146
163
  interface RunResult {
147
164
  diagnostics: Diagnostic[];
165
+ execution?: RunExecution;
148
166
  usage: RunUsage;
149
167
  }
150
168
  interface RunStartPayload {
@@ -155,6 +173,13 @@ interface RunStartPayload {
155
173
  startedAt?: number;
156
174
  }
157
175
  interface RunUsage {
176
+ cached?: RunUsageTotals;
177
+ inputTokens: number;
178
+ outputTokens: number;
179
+ records: InferenceUsageRecord[];
180
+ totalTokens: number;
181
+ }
182
+ interface RunUsageTotals {
158
183
  inputTokens: number;
159
184
  outputTokens: number;
160
185
  records: InferenceUsageRecord[];
@@ -172,15 +197,6 @@ interface UsageProgressPayload {
172
197
  }
173
198
  //#endregion
174
199
  //#region src/core/run.d.ts
175
- interface AlintRunFailure {
176
- filePath?: string;
177
- message: string;
178
- ruleId?: string;
179
- target?: {
180
- kind: ProgressTargetKind;
181
- name?: string;
182
- };
183
- }
184
200
  declare class AlintRunError extends Error {
185
201
  readonly failure?: AlintRunFailure;
186
202
  readonly result: RunResult;
@@ -208,4 +224,4 @@ declare function buildRuleRegistry(config: Pick<EffectiveAlintConfig, 'plugins'
208
224
  //#region src/models/resolve.d.ts
209
225
  declare function resolveModel(registry: SetupConfig, options?: ResolveModelOptions): ResolvedModel;
210
226
  //#endregion
211
- export { type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintLinterOptions, AlintRunError, type Awaitable, type Diagnostic, type DiagnosticDescriptor, type DiagnosticLocation, type DiagnosticProgressPayload, type EffectiveAlintConfig, type EnabledRule, type FileProgressPayload, type IgnoreConfig, type InferenceUsageRecord, type LanguageContext, type LanguageDefinition, type LanguageRegistry, type LineRange, type ModelRequirement, type ModelSize, type PluginDefinition, type ProcessedSource, type ProcessedSourceOrigin, type ProcessorContext, type ProcessorDefinition, type ProcessorPostprocessContext, type ProgressFilePath, type ProgressPath, type ProgressReporter, type ProgressTargetKind, type ProviderDefinition, type ProviderType, type ResolveConfigResult, type ResolveLanguageOptions, type ResolveModelOptions, type ResolvedModel, type ResolvedProvider, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleEndPayload, type RuleHandlers, type RuleInferenceUsageRecord, type RuleRegistry, type RuleSeverity, type RuleStartPayload, type RunEndPayload, type RunOptions, type RunResult, type RunStartPayload, type RunUsage, type RunnerConfig, type RunnerStatsConfig, type SetupConfig, type SetupModelDefinition, type SourceFile, type SourceLocation, type SourcePosition, type SourceRange, type SourceRuntime, type SourceTarget, type SourceTargetKind, type SourceTargetOrigin, type SourceText, type TargetProgressPayload, type UsageProgressPayload, buildRuleRegistry, createBuiltInLanguageRegistry, createSourceFile, createSourceRuntime, defineConfig, definePlugin, defineRule, extractJsSourceTargets, hasDiscoveryFilePatterns, matchesDiscoveryFile, normalizeConfig, registerLanguage, resolveConfigForFile, resolveLanguage, resolveModel, runAlint, sliceLines, sliceRange };
227
+ export { type AlintConfig, type AlintConfigExtends, type AlintConfigInput, type AlintConfigItem, type AlintLinterOptions, AlintRunError, type AlintRunFailure, type Awaitable, type ClassTarget, type Diagnostic, type DiagnosticDescriptor, type DiagnosticLocation, type DiagnosticProgressPayload, type DirectoryTarget, type EffectiveAlintConfig, type EnabledRule, type FileProgressPayload, type FileTarget, type FunctionTarget, type IgnoreConfig, type InferenceUsageRecord, type LanguageContext, type LanguageDefinition, type LanguageRegistry, type LineRange, type ModelRequirement, type ModelSize, type PluginDefinition, type ProcessedSource, type ProcessedSourceOrigin, type ProcessorContext, type ProcessorDefinition, type ProcessorPostprocessContext, type ProgressFilePath, type ProgressPath, type ProgressReporter, type ProgressTargetKind, type ProjectTarget, type ProviderDefinition, type ProviderType, type ResolveConfigResult, type ResolveLanguageOptions, type ResolveModelOptions, type ResolvedModel, type ResolvedProvider, type RuleCacheConfig, type RuleConfigEntry, type RuleContext, type RuleDefinition, type RuleEndPayload, type RuleHandlers, type RuleInferenceUsageRecord, type RuleRegistry, type RuleSeverity, type RuleSpecializedHandlers, type RuleStartPayload, type RuleWithHandler, type RunEndPayload, type RunExecution, type RunOptions, type RunResult, type RunStartPayload, type RunUsage, type RunUsageTotals, type RunnerConfig, type RunnerStatsConfig, type SetupConfig, type SetupModelDefinition, type SourceFile, type SourceLocation, type SourcePosition, type SourceRange, type SourceRuntime, type SourceTarget, type SourceTargetKind, type SourceTargetOfKind, type SourceTargetOrigin, type SourceText, type Target, type TargetProgressPayload, type UsageProgressPayload, buildRuleRegistry, createBuiltInLanguageRegistry, createSourceFile, createSourceRuntime, defineConfig, definePlugin, defineRule, extractJsSourceTargets, hasDiscoveryFilePatterns, matchesDiscoveryFile, normalizeConfig, registerLanguage, resolveConfigForDirectory, resolveConfigForFile, resolveConfigForProject, resolveLanguage, resolveModel, runAlint, sliceLines, sliceRange };