Add directive parser and plan linter (#2)

This commit was merged in pull request #2.
This commit is contained in:
2026-02-08 09:30:08 +00:00
parent 4f961e4732
commit ec6bc71eff
2 changed files with 20 additions and 0 deletions

11
src/linter.ts Normal file
View File

@@ -0,0 +1,11 @@
// Plan linter
import { parse } from "./parser";
export function lint(plan: string) {
const lines = parse(plan);
const warnings: string[] = [];
for (const line of lines) {
if (line.includes("ASAP")) warnings.push("Ambiguous urgency: ASAP");
}
return warnings;
}

9
src/parser.ts Normal file
View File

@@ -0,0 +1,9 @@
// Directive parser v2
export function parse(raw: string): string[] {
return raw.split("\n").map(l => l.trim()).filter(Boolean);
}
export function parseTimestamp(line: string): Date | null {
const match = line.match(/\d{4}-\d{2}-\d{2}/);
return match ? new Date(match[0]) : null;
}