@alint-js/core 0.1.4 → 0.2.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
@@ -28,18 +28,20 @@ export const rule = defineRule({
28
28
  create: ctx => ({
29
29
  async onTargetFile(target) {
30
30
  const model = await ctx.model({ size: 'small' })
31
+ const file = await ctx.src.readFile(target.file)
31
32
 
32
33
  ctx.report({
33
34
  filePath: target.file.path,
34
35
  loc: target.loc,
35
- message: `reviewed with ${model.id}`,
36
+ message: `reviewed ${file.lines.length} lines with ${model.id}`,
36
37
  })
37
38
  },
38
39
  }),
39
40
  })
40
41
  ```
41
42
 
42
- Project rules receive compact file and target entries. Read source only when the rule needs it:
43
+ Source and project rules receive compact descriptors. Source handlers should pass `target.file`
44
+ to `ctx.src.readFile()` so core can detect changes since planning. Read source only when needed:
43
45
 
44
46
  ```ts
45
47
  import { defineRule } from '@alint-js/core'
@@ -57,9 +59,10 @@ export const projectRule = defineRule({
57
59
  })
58
60
  ```
59
61
 
60
- `ProjectFileEntry` and `ProjectTargetEntry` intentionally omit source text and arbitrary
61
- extractor metadata. Calls to `ctx.src.readFile()` are explicit and plugin-owned, so a project
62
- rule controls which source files it loads and how long it retains them.
62
+ `PlannedSourceTarget`, `ProjectFileEntry`, and `ProjectTargetEntry` intentionally omit source text.
63
+ Calls to `ctx.src.readFile()` are explicit and plugin-owned, so a rule controls which source files
64
+ it loads and how long it retains them. Cache hits do not invoke the handler and therefore do not
65
+ perform its execution-time read.
63
66
 
64
67
  Use the agent contract for tool-using rules:
65
68
 
@@ -119,8 +122,9 @@ explore with tools before answering, because a forced tool call is a single shot
119
122
 
120
123
  ## Memory boundaries
121
124
 
122
- `alint` bounds its engine-owned source sessions. It cannot bound source files retained by plugin
123
- code after `ctx.src.readFile()` returns.
125
+ `alint` bounds concurrent source planning reads and parser work. Planning releases rich extractor
126
+ values as soon as compact jobs are admitted; queued jobs do not retain source text. It cannot bound
127
+ source files retained by plugin code after `ctx.src.readFile()` returns.
124
128
 
125
129
  A valid cache written by the same `alint` version is still read from one monolithic JSON document.
126
130
  An extremely large cache may therefore exhaust available memory.
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-DKylUrAn.mjs";
1
+ import { F as AgentTool, I as AgentUsage, M as AgentAdapter, N as AgentRequest, P as AgentResult, b as RuleContext } from "./types-deBCDA4_.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-DKylUrAn.mjs";
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-deBCDA4_.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-DKylUrAn.mjs";
2
- import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-8BzWDcPs.mjs";
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-deBCDA4_.mjs";
2
+ import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-CJ2QJPZ8.mjs";
3
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 };