Compare commits
5 Commits
feature/te
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5072970c91 | |||
| ec6bc71eff | |||
| 4f961e4732 | |||
| 9cc0cfef69 | |||
| 2812709d86 |
2
src/index.ts
Normal file
2
src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// Instruction Sanity Lab entry point
|
||||
export const VERSION = "0.1.0";
|
||||
11
src/linter.ts
Normal file
11
src/linter.ts
Normal 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
9
src/parser.ts
Normal 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;
|
||||
}
|
||||
5
src/types.ts
Normal file
5
src/types.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface Directive {
|
||||
text: string;
|
||||
timestamp?: Date;
|
||||
source: string;
|
||||
}
|
||||
3
src/utils.ts
Normal file
3
src/utils.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function sanitize(input: string): string {
|
||||
return input.trim().toLowerCase();
|
||||
}
|
||||
5
src/validate.ts
Normal file
5
src/validate.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { Directive } from "./types";
|
||||
|
||||
export function validate(d: Directive): boolean {
|
||||
return d.text.length > 0 && d.source.length > 0;
|
||||
}
|
||||
Reference in New Issue
Block a user