@alint-js/config 0.1.4 → 0.1.5

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 (2) hide show
  1. package/dist/index.mjs +41 -4
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -227,8 +227,26 @@ const maxSupplementalFiles = 12;
227
227
  function createBasicStructuredRule(rule) {
228
228
  return {
229
229
  cache: rule.includeFiles === void 0 || rule.includeFiles.length === 0,
230
- create: (ctx) => ({ async onTargetFile(target) {
230
+ create: (ctx) => ({
231
+ /**
232
+ * Runs one structured declarative review for a planned file.
233
+ *
234
+ * Triggering workflow:
235
+ *
236
+ * {@link createBasicStructuredRule}
237
+ * -> `RuleHandlers.onTargetFile`
238
+ * -> {@link generateStructured}
239
+ *
240
+ * Upstream:
241
+ * - {@link createBasicStructuredRule}
242
+ *
243
+ * Downstream:
244
+ * - {@link generateStructured}
245
+ * - {@link reportDeclarativeFindings}
246
+ */
247
+ async onTargetFile(target) {
231
248
  const model = await ctx.model();
249
+ const file = await ctx.src.readFile(target.file);
232
250
  const supplementalFiles = await collectSupplementalFiles({
233
251
  cwd: ctx.cwd,
234
252
  includeFiles: rule.includeFiles,
@@ -243,7 +261,7 @@ function createBasicStructuredRule(rule) {
243
261
  outputLanguage: ctx.outputLanguage,
244
262
  retryFeedback,
245
263
  ruleFilePath: rule.filePath,
246
- sourceText: target.file.text,
264
+ sourceText: file.text,
247
265
  supplementalFiles,
248
266
  targetFilePath: target.file.path
249
267
  }),
@@ -375,13 +393,31 @@ const reportFindingsToolName = "report_findings";
375
393
  function createBasicCodingAgentRule(rule) {
376
394
  return {
377
395
  cache: false,
378
- create: (ctx) => ({ async onTargetFile(target) {
396
+ create: (ctx) => ({
397
+ /**
398
+ * Runs one tool-using declarative review for a planned file.
399
+ *
400
+ * Triggering workflow:
401
+ *
402
+ * {@link createBasicCodingAgentRule}
403
+ * -> `RuleHandlers.onTargetFile`
404
+ * -> {@link createCodingAgent}
405
+ *
406
+ * Upstream:
407
+ * - {@link createBasicCodingAgentRule}
408
+ *
409
+ * Downstream:
410
+ * - {@link createCodingAgent}
411
+ * - {@link reportDeclarativeFindings}
412
+ */
413
+ async onTargetFile(target) {
379
414
  const model = await ctx.model();
415
+ const file = await ctx.src.readFile(target.file);
380
416
  const result = await createCodingAgent(model).run({
381
417
  cwd: ctx.cwd,
382
418
  instruction: rule.instruction,
383
419
  outputLanguage: ctx.outputLanguage,
384
- sourceText: target.file.text,
420
+ sourceText: file.text,
385
421
  targetFilePath: target.file.path,
386
422
  tools: createTools(ctx.cwd)
387
423
  });
@@ -1023,6 +1059,7 @@ const staticConfigItemSchema = looseObject({
1023
1059
  languageOptions: optional(record(string(), unknown())),
1024
1060
  linterOptions: optional(looseObject({
1025
1061
  noInlineConfig: optional(boolean()),
1062
+ reportUnregisteredLanguages: optional(ruleSeveritySchema),
1026
1063
  reportUnusedDisableDirectives: optional(ruleSeveritySchema)
1027
1064
  })),
1028
1065
  name: optional(string()),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/config",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -28,8 +28,8 @@
28
28
  "tar-stream": "^3.2.0",
29
29
  "valibot": "^1.4.2",
30
30
  "xdg-basedir": "^5.1.0",
31
- "@alint-js/core": "0.1.4",
32
- "@alint-js/tools-fs": "0.1.4"
31
+ "@alint-js/core": "0.1.5",
32
+ "@alint-js/tools-fs": "0.1.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/tar-stream": "^3.1.4",