agent-context-lint 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/checkers.ts","../src/config.ts","../src/types.ts","../src/discovery.ts","../src/parser.ts","../src/scorer.ts","../src/reporter.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport {\n checkContradictions,\n checkPaths,\n checkRequiredSections,\n checkScripts,\n checkStaleDates,\n checkTokenBudget,\n checkVague,\n} from './checkers.js';\nimport { loadConfig } from './config.js';\nimport { discoverContextFiles } from './discovery.js';\nimport { parseFile } from './parser.js';\nimport { computeScore } from './scorer.js';\nimport type { FileResult, LintFinding, LintResult } from './types.js';\n\nexport type { CLIOptions, Config, FileResult, LintFinding, LintResult } from './types.js';\nexport { discoverContextFiles } from './discovery.js';\nexport { parseFile } from './parser.js';\nexport { computeScore } from './scorer.js';\nexport { loadConfig } from './config.js';\nexport { formatJson, formatText } from './reporter.js';\n\nexport function lintFile(filePath: string, cwd: string): FileResult {\n const config = loadConfig(cwd);\n const parsed = parseFile(filePath);\n\n const findings: LintFinding[] = [\n ...checkPaths(parsed, filePath),\n ...checkScripts(parsed, filePath),\n ...checkTokenBudget(parsed, filePath, config),\n ...checkVague(parsed, filePath, config),\n ...checkRequiredSections(parsed, filePath, config),\n ...checkStaleDates(parsed, filePath, config),\n ...checkContradictions(parsed, filePath),\n ];\n\n return {\n file: filePath,\n findings,\n score: computeScore(findings),\n };\n}\n\nexport function lint(cwd: string, files?: string[]): LintResult {\n const targetFiles =\n files && files.length > 0\n ? files.map((f) => resolve(cwd, f))\n : discoverContextFiles(cwd);\n\n if (targetFiles.length === 0) {\n return { files: [], totalFindings: 0, errors: 0, warnings: 0 };\n }\n\n const results = targetFiles.map((f) => lintFile(f, cwd));\n\n const totalFindings = results.reduce(\n (sum, r) => sum + r.findings.length,\n 0,\n );\n const errors = results.reduce(\n (sum, r) => sum + r.findings.filter((f) => f.severity === 'error').length,\n 0,\n );\n const warnings = results.reduce(\n (sum, r) =>\n sum + r.findings.filter((f) => f.severity === 'warning').length,\n 0,\n );\n\n return { files: results, totalFindings, errors, warnings };\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { ParsedFile } from './parser.js';\nimport type { Config, LintFinding } from './types.js';\n\nexport function checkPaths(\n parsed: ParsedFile,\n filePath: string,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n const baseDir = dirname(filePath);\n\n for (const ref of parsed.paths) {\n const resolved = resolve(baseDir, ref.value);\n if (!existsSync(resolved)) {\n findings.push({\n file: filePath,\n rule: 'check:paths',\n line: ref.line,\n column: ref.column,\n severity: 'error',\n message: `Path does not exist: ${ref.value}`,\n });\n }\n }\n\n return findings;\n}\n\nexport function checkScripts(\n parsed: ParsedFile,\n filePath: string,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n const baseDir = dirname(filePath);\n const pkgPath = resolve(baseDir, 'package.json');\n\n let scripts: Record<string, string> = {};\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));\n scripts = pkg.scripts || {};\n } catch {\n // Invalid package.json — skip script checks\n return findings;\n }\n } else {\n // No package.json — skip script checks\n return findings;\n }\n\n for (const cmd of parsed.commands) {\n // Extract the script name from commands like \"npm run test\", \"pnpm build\"\n const match = /(?:npm|pnpm|yarn|bun)\\s+run\\s+([\\w:@./-]+)/.exec(cmd.value);\n const directMatch = /(?:npm|pnpm|yarn|bun)\\s+(test|start|build|lint)\\b/.exec(\n cmd.value,\n );\n\n const scriptName = match?.[1] || directMatch?.[1];\n if (scriptName && !(scriptName in scripts)) {\n findings.push({\n file: filePath,\n rule: 'check:scripts',\n line: cmd.line,\n column: cmd.column,\n severity: 'error',\n message: `Script not found in package.json: \"${scriptName}\"`,\n });\n }\n }\n\n return findings;\n}\n\nexport function checkTokenBudget(\n parsed: ParsedFile,\n filePath: string,\n config: Config,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n\n // Rough token estimate: ~4 chars per token for English text\n const estimatedTokens = Math.ceil(parsed.content.length / 4);\n\n if (estimatedTokens > config.tokenBudget.error) {\n findings.push({\n file: filePath,\n rule: 'check:token-budget',\n line: 1,\n column: 1,\n severity: 'error',\n message: `File is ~${estimatedTokens} tokens (limit: ${config.tokenBudget.error}). Consider splitting or condensing.`,\n });\n } else if (estimatedTokens > config.tokenBudget.warn) {\n findings.push({\n file: filePath,\n rule: 'check:token-budget',\n line: 1,\n column: 1,\n severity: 'warning',\n message: `File is ~${estimatedTokens} tokens (warn threshold: ${config.tokenBudget.warn}). Consider condensing.`,\n });\n }\n\n return findings;\n}\n\nexport function checkVague(\n parsed: ParsedFile,\n filePath: string,\n config: Config,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n\n for (let i = 0; i < parsed.lines.length; i++) {\n const line = parsed.lines[i].toLowerCase();\n for (const pattern of config.vaguePatterns) {\n if (line.includes(pattern.toLowerCase())) {\n findings.push({\n file: filePath,\n rule: 'check:vague',\n line: i + 1,\n column: line.indexOf(pattern.toLowerCase()) + 1,\n severity: 'warning',\n message: `Vague instruction: \"${pattern}\". Replace with specific, actionable guidance.`,\n });\n }\n }\n }\n\n return findings;\n}\n\nexport function checkRequiredSections(\n parsed: ParsedFile,\n filePath: string,\n config: Config,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n const normalizedSections = parsed.sections.map((s) => s.toLowerCase());\n\n for (const required of config.requiredSections) {\n const found = normalizedSections.some(\n (s) => s.includes(required.toLowerCase()),\n );\n if (!found) {\n findings.push({\n file: filePath,\n rule: 'check:required-sections',\n line: 1,\n column: 1,\n severity: 'warning',\n message: `Missing recommended section: \"${required}\"`,\n });\n }\n }\n\n return findings;\n}\n\nexport function checkStaleDates(\n parsed: ParsedFile,\n filePath: string,\n config: Config,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n const currentYear = new Date().getFullYear();\n const threshold = currentYear - config.staleDateYears;\n\n const yearPattern = /\\b(20[0-9]{2})\\b/g;\n\n for (let i = 0; i < parsed.lines.length; i++) {\n let match: RegExpExecArray | null;\n yearPattern.lastIndex = 0;\n while ((match = yearPattern.exec(parsed.lines[i])) !== null) {\n const year = parseInt(match[1], 10);\n if (year < threshold) {\n findings.push({\n file: filePath,\n rule: 'check:stale-dates',\n line: i + 1,\n column: match.index + 1,\n severity: 'warning',\n message: `Possibly stale year reference: ${year} (older than ${config.staleDateYears} years)`,\n });\n }\n }\n }\n\n return findings;\n}\n\nexport function checkContradictions(\n parsed: ParsedFile,\n filePath: string,\n): LintFinding[] {\n const findings: LintFinding[] = [];\n\n // Contradiction pairs: if both patterns appear, flag them\n const contradictionPairs: [RegExp, RegExp, string][] = [\n [\n /\\balways use (\\w+)/i,\n /\\bnever use (\\w+)/i,\n 'Contradictory \"always use\" and \"never use\" directives',\n ],\n [\n /\\bdo not (?:use|add|include) (comments|docstrings|type annotations)/i,\n /\\b(?:always|must) (?:add|include|write) \\1/i,\n 'Contradictory directives about adding/not adding',\n ],\n [\n /\\bprefer (\\w+) over (\\w+)/i,\n /\\bprefer \\2 over \\1/i,\n 'Contradictory preference directives',\n ],\n ];\n\n const lineTexts = parsed.lines;\n\n for (const [patternA, patternB, message] of contradictionPairs) {\n const matchesA: { line: number; match: RegExpExecArray }[] = [];\n const matchesB: { line: number; match: RegExpExecArray }[] = [];\n\n for (let i = 0; i < lineTexts.length; i++) {\n const lineText = lineTexts[i];\n const a = patternA.exec(lineText);\n if (a) matchesA.push({ line: i + 1, match: a });\n const b = patternB.exec(lineText);\n if (b) matchesB.push({ line: i + 1, match: b });\n }\n\n if (matchesA.length > 0 && matchesB.length > 0) {\n // Check if contradictions reference the same term\n for (const a of matchesA) {\n for (const b of matchesB) {\n if (\n a.match[1] &&\n b.match[1] &&\n a.match[1].toLowerCase() === b.match[1].toLowerCase()\n ) {\n findings.push({\n file: filePath,\n rule: 'check:contradictions',\n line: b.line,\n column: 1,\n severity: 'warning',\n message: `${message} (conflicts with line ${a.line})`,\n });\n }\n }\n }\n }\n }\n\n return findings;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { DEFAULT_CONFIG, type Config } from './types.js';\n\nexport function loadConfig(cwd: string): Config {\n // Try .agent-context-lint.json\n const configPath = resolve(cwd, '.agent-context-lint.json');\n if (existsSync(configPath)) {\n try {\n const raw = JSON.parse(readFileSync(configPath, 'utf-8'));\n return mergeConfig(raw);\n } catch {\n // Invalid config file — use defaults\n }\n }\n\n // Try package.json agentContextLint key\n const pkgPath = resolve(cwd, 'package.json');\n if (existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));\n if (pkg.agentContextLint) {\n return mergeConfig(pkg.agentContextLint);\n }\n } catch {\n // Invalid package.json — use defaults\n }\n }\n\n return { ...DEFAULT_CONFIG };\n}\n\nfunction mergeConfig(overrides: Partial<Config>): Config {\n return {\n tokenBudget: {\n ...DEFAULT_CONFIG.tokenBudget,\n ...overrides.tokenBudget,\n },\n requiredSections:\n overrides.requiredSections ?? DEFAULT_CONFIG.requiredSections,\n staleDateYears: overrides.staleDateYears ?? DEFAULT_CONFIG.staleDateYears,\n vaguePatterns: overrides.vaguePatterns ?? DEFAULT_CONFIG.vaguePatterns,\n ignore: overrides.ignore ?? DEFAULT_CONFIG.ignore,\n };\n}\n","export interface LintFinding {\n file: string;\n rule: string;\n line: number;\n column: number;\n severity: 'error' | 'warning';\n message: string;\n}\n\nexport interface FileResult {\n file: string;\n findings: LintFinding[];\n score: number;\n}\n\nexport interface LintResult {\n files: FileResult[];\n totalFindings: number;\n errors: number;\n warnings: number;\n}\n\nexport interface CLIOptions {\n files: string[];\n format: 'text' | 'json';\n fix: boolean;\n cwd: string;\n}\n\nexport interface Config {\n tokenBudget: { warn: number; error: number };\n requiredSections: string[];\n staleDateYears: number;\n vaguePatterns: string[];\n ignore: string[];\n}\n\nexport const DEFAULT_CONFIG: Config = {\n tokenBudget: { warn: 2000, error: 5000 },\n requiredSections: ['Setup', 'Testing', 'Build'],\n staleDateYears: 2,\n vaguePatterns: [\n 'follow best practices',\n 'be careful',\n 'use good judgment',\n 'use common sense',\n 'as appropriate',\n 'when necessary',\n 'if needed',\n 'as needed',\n 'handle edge cases',\n 'write clean code',\n 'keep it simple',\n 'use proper',\n 'ensure quality',\n ],\n ignore: [],\n};\n\nexport const CONTEXT_FILE_NAMES = [\n 'CLAUDE.md',\n 'AGENTS.md',\n '.cursorrules',\n 'copilot-instructions.md',\n '.github/copilot-instructions.md',\n];\n","import { existsSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONTEXT_FILE_NAMES } from './types.js';\n\nexport function discoverContextFiles(cwd: string): string[] {\n const found: string[] = [];\n for (const name of CONTEXT_FILE_NAMES) {\n const fullPath = resolve(cwd, name);\n if (existsSync(fullPath)) {\n found.push(fullPath);\n }\n }\n return found;\n}\n","import { readFileSync } from 'node:fs';\n\nexport interface ParsedFile {\n content: string;\n lines: string[];\n paths: PathReference[];\n commands: CommandReference[];\n sections: string[];\n codeBlocks: CodeBlock[];\n inlineCode: InlineCode[];\n}\n\nexport interface PathReference {\n value: string;\n line: number;\n column: number;\n}\n\nexport interface CommandReference {\n value: string;\n line: number;\n column: number;\n}\n\nexport interface CodeBlock {\n content: string;\n lang: string;\n line: number;\n}\n\nexport interface InlineCode {\n content: string;\n line: number;\n column: number;\n}\n\nconst PATH_PATTERN = /(?:^|\\s|`)(\\.?\\.?\\/[\\w./@-]+[\\w/@-])/g;\nconst COMMAND_PATTERN = /(?:npm|npx|pnpm|yarn|bun|bunx)\\s+(?:run\\s+)?[\\w:@./-]+/g;\nconst HEADING_PATTERN = /^#{1,6}\\s+(.+)$/;\nconst FENCED_BLOCK_START = /^```(\\w*)/;\nconst FENCED_BLOCK_END = /^```\\s*$/;\nconst INLINE_CODE_PATTERN = /`([^`]+)`/g;\n\nexport function parseFile(filePath: string): ParsedFile {\n const content = readFileSync(filePath, 'utf-8');\n const lines = content.split('\\n');\n\n const paths: PathReference[] = [];\n const commands: CommandReference[] = [];\n const sections: string[] = [];\n const codeBlocks: CodeBlock[] = [];\n const inlineCode: InlineCode[] = [];\n\n let inCodeBlock = false;\n let codeBlockLang = '';\n let codeBlockContent = '';\n let codeBlockStart = 0;\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n const lineNum = i + 1;\n\n // Track fenced code blocks\n if (!inCodeBlock) {\n const blockStart = FENCED_BLOCK_START.exec(line);\n if (blockStart && line.trimStart().startsWith('```')) {\n inCodeBlock = true;\n codeBlockLang = blockStart[1] || '';\n codeBlockContent = '';\n codeBlockStart = lineNum;\n continue;\n }\n } else {\n if (FENCED_BLOCK_END.test(line) && line.trimStart() === '```') {\n codeBlocks.push({\n content: codeBlockContent,\n lang: codeBlockLang,\n line: codeBlockStart,\n });\n inCodeBlock = false;\n continue;\n }\n codeBlockContent += (codeBlockContent ? '\\n' : '') + line;\n }\n\n // Extract headings as sections\n const headingMatch = HEADING_PATTERN.exec(line);\n if (headingMatch) {\n sections.push(headingMatch[1].trim());\n }\n\n // Extract paths from both inline code and plain text\n let pathMatch: RegExpExecArray | null;\n PATH_PATTERN.lastIndex = 0;\n while ((pathMatch = PATH_PATTERN.exec(line)) !== null) {\n const value = pathMatch[1];\n // Skip URLs\n if (value.includes('://')) continue;\n paths.push({\n value,\n line: lineNum,\n column: pathMatch.index + (pathMatch[0].length - value.length) + 1,\n });\n }\n\n // Extract npm/pnpm/yarn/bun commands\n let cmdMatch: RegExpExecArray | null;\n COMMAND_PATTERN.lastIndex = 0;\n while ((cmdMatch = COMMAND_PATTERN.exec(line)) !== null) {\n commands.push({\n value: cmdMatch[0],\n line: lineNum,\n column: cmdMatch.index + 1,\n });\n }\n\n // Extract inline code spans\n if (!inCodeBlock) {\n let inlineMatch: RegExpExecArray | null;\n INLINE_CODE_PATTERN.lastIndex = 0;\n while ((inlineMatch = INLINE_CODE_PATTERN.exec(line)) !== null) {\n inlineCode.push({\n content: inlineMatch[1],\n line: lineNum,\n column: inlineMatch.index + 2,\n });\n }\n }\n }\n\n return { content, lines, paths, commands, sections, codeBlocks, inlineCode };\n}\n","import type { LintFinding } from './types.js';\n\n/**\n * Computes a 0–100 quality score for a file based on its findings.\n *\n * Starts at 100 and deducts:\n * - 15 points per error\n * - 5 points per warning\n *\n * Minimum score is 0.\n */\nexport function computeScore(findings: LintFinding[]): number {\n let score = 100;\n for (const finding of findings) {\n if (finding.severity === 'error') {\n score -= 15;\n } else {\n score -= 5;\n }\n }\n return Math.max(0, score);\n}\n","import { relative } from 'node:path';\nimport type { LintResult } from './types.js';\n\nexport function formatText(result: LintResult, cwd: string): string {\n const lines: string[] = [];\n\n for (const file of result.files) {\n const relPath = relative(cwd, file.file);\n lines.push(`\\n ${relPath} (score: ${file.score}/100)`);\n\n if (file.findings.length === 0) {\n lines.push(' No issues found.');\n continue;\n }\n\n for (const f of file.findings) {\n const icon = f.severity === 'error' ? 'x' : '!';\n lines.push(\n ` ${f.line}:${f.column} ${icon} ${f.message} [${f.rule}]`,\n );\n }\n }\n\n lines.push('');\n lines.push(\n ` ${result.totalFindings} problems (${result.errors} errors, ${result.warnings} warnings)`,\n );\n lines.push('');\n\n return lines.join('\\n');\n}\n\nexport function formatJson(result: LintResult, cwd: string): string {\n const output = {\n ...result,\n files: result.files.map((f) => ({\n ...f,\n file: relative(cwd, f.file),\n })),\n };\n return JSON.stringify(output, null, 2);\n}\n"],"mappings":";AAAA,SAAS,WAAAA,gBAAe;;;ACAxB,SAAS,YAAY,oBAAoB;AACzC,SAAS,SAAS,eAAe;AAI1B,SAAS,WACd,QACA,UACe;AACf,QAAM,WAA0B,CAAC;AACjC,QAAM,UAAU,QAAQ,QAAQ;AAEhC,aAAW,OAAO,OAAO,OAAO;AAC9B,UAAM,WAAW,QAAQ,SAAS,IAAI,KAAK;AAC3C,QAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,eAAS,KAAK;AAAA,QACZ,MAAM;AAAA,Q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BAAgB,QAAQ;AAAA,IAC5B,CAAC,KAAK,MAAM,MAAM,EAAE,SAAS;AAAA,IAC7B;AAAA,EACF;AACA,QAAM,SAAS,QAAQ;AAAA,IACrB,CAAC,KAAK,MAAM,MAAM,EAAE,SAAS,OAAO,CAAC,MAAM,EAAE,aAAa,OAAO,EAAE;AAAA,IACnE;AAAA,EACF;AACA,QAAM,WAAW,QAAQ;AAAA,IACvB,CAAC,KAAK,MACJ,MAAM,EAAE,SAAS,OAAO,CAAC,MAAM,EAAE,aAAa,SAAS,EAAE;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,SAAS,eAAe,QAAQ,SAAS;AAC3D;","names":["resolve","existsSync","readFileSync","resolve","resolve","existsSync","readFileSync","existsSync","resolve","resolve","existsSync","readFileSync","resolve"]}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "agent-context-lint",
3
+ "version": "0.1.0",
4
+ "description": "Lint AI coding agent context files (AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md) for staleness, broken paths, and semantic quality issues.",
5
+ "keywords": [
6
+ "agents-md",
7
+ "claude-md",
8
+ "cursorrules",
9
+ "copilot-instructions",
10
+ "ai-agent",
11
+ "lint",
12
+ "context-file",
13
+ "cli",
14
+ "developer-tools",
15
+ "code-quality"
16
+ ],
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/mattschaller/agent-context-lint"
21
+ },
22
+ "author": "Matthew Schaller <matt@mattschaller.com>",
23
+ "type": "module",
24
+ "bin": {
25
+ "agent-context-lint": "./dist/cli.js"
26
+ },
27
+ "exports": {
28
+ ".": {
29
+ "import": "./dist/index.js",
30
+ "require": "./dist/index.cjs"
31
+ }
32
+ },
33
+ "main": "./dist/index.cjs",
34
+ "module": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "scripts": {
40
+ "build": "tsup",
41
+ "test": "vitest run",
42
+ "test:watch": "vitest",
43
+ "prepublishOnly": "npm run build && npm run test"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^22.0.0",
47
+ "tsup": "^8.0.0",
48
+ "typescript": "^5.5.0",
49
+ "vitest": "^4.0.0"
50
+ },
51
+ "engines": {
52
+ "node": ">=20.0.0"
53
+ }
54
+ }