@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 +11 -7
- package/dist/agent.d.mts +1 -1
- package/dist/{define-8BzWDcPs.d.mts → define-CJ2QJPZ8.d.mts} +1 -1
- package/dist/dsl.d.mts +2 -2
- package/dist/extract-BVbjWXMC.mjs +676 -0
- package/dist/index.d.mts +109 -7
- package/dist/index.mjs +867 -384
- package/dist/languages-js.d.mts +1 -1
- package/dist/languages-js.mjs +1 -1
- package/dist/structured-output.d.mts +1 -1
- package/dist/types-DM4idR4w.d.mts +179 -0
- package/dist/{types-DKylUrAn.d.mts → types-deBCDA4_.d.mts} +49 -6
- package/package.json +2 -1
- package/dist/extract-CIWssxNK.mjs +0 -358
- package/dist/types-DSvXUVZ7.d.mts +0 -86
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
|
-
|
|
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
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
123
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
2
|
-
import { n as definePlugin, r as defineRule, t as defineConfig } from "./define-
|
|
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 };
|