@eddacraft/anvil-aps 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.
- package/AGENTS.md +155 -0
- package/LICENSE +14 -0
- package/README.md +57 -0
- package/TODO.md +40 -0
- package/dist/filter/context-bundle.d.ts +81 -0
- package/dist/filter/context-bundle.d.ts.map +1 -0
- package/dist/filter/context-bundle.js +230 -0
- package/dist/filter/index.d.ts +85 -0
- package/dist/filter/index.d.ts.map +1 -0
- package/dist/filter/index.js +169 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/loader/index.d.ts +80 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +253 -0
- package/dist/parser/index.d.ts +24 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +22 -0
- package/dist/parser/parse-document.d.ts +17 -0
- package/dist/parser/parse-document.d.ts.map +1 -0
- package/dist/parser/parse-document.js +219 -0
- package/dist/parser/parse-index.d.ts +31 -0
- package/dist/parser/parse-index.d.ts.map +1 -0
- package/dist/parser/parse-index.js +251 -0
- package/dist/parser/parse-task.d.ts +30 -0
- package/dist/parser/parse-task.d.ts.map +1 -0
- package/dist/parser/parse-task.js +261 -0
- package/dist/state/index.d.ts +307 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +689 -0
- package/dist/templates/generator.d.ts +71 -0
- package/dist/templates/generator.d.ts.map +1 -0
- package/dist/templates/generator.js +723 -0
- package/dist/templates/index.d.ts +5 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +4 -0
- package/dist/types/index.d.ts +131 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +107 -0
- package/dist/validator/index.d.ts +83 -0
- package/dist/validator/index.d.ts.map +1 -0
- package/dist/validator/index.js +611 -0
- package/docs/APS-Anvil-Integration.md +750 -0
- package/docs/APS-Conventions.md +635 -0
- package/docs/APS-NonGoals.md +455 -0
- package/docs/APS-Planning-Spec-v0.1.md +362 -0
- package/examples/README.md +170 -0
- package/examples/feature-auth.aps.md +87 -0
- package/examples/refactor-error-handling.aps.md +119 -0
- package/examples/system-ecommerce/APS.md +57 -0
- package/examples/system-ecommerce/modules/auth.aps.md +38 -0
- package/examples/system-ecommerce/modules/cart.aps.md +53 -0
- package/examples/system-ecommerce/modules/payments.aps.md +68 -0
- package/examples/system-ecommerce/modules/products.aps.md +53 -0
- package/package.json +34 -0
- package/project.json +37 -0
- package/scripts/generate-templates.js +33 -0
- package/src/filter/context-bundle.ts +312 -0
- package/src/filter/filter.test.ts +317 -0
- package/src/filter/index.ts +249 -0
- package/src/index.ts +16 -0
- package/src/loader/index.ts +364 -0
- package/src/loader/loader.test.ts +224 -0
- package/src/parser/__fixtures__/invalid-task-id-not-padded.aps.md +7 -0
- package/src/parser/__fixtures__/invalid-task-id.aps.md +8 -0
- package/src/parser/__fixtures__/minimal-task.aps.md +7 -0
- package/src/parser/__fixtures__/non-scope-hyphenated.aps.md +10 -0
- package/src/parser/__fixtures__/simple-index.aps.md +35 -0
- package/src/parser/__fixtures__/simple-plan.aps.md +19 -0
- package/src/parser/index.ts +30 -0
- package/src/parser/parse-document.test.ts +603 -0
- package/src/parser/parse-document.ts +262 -0
- package/src/parser/parse-index.test.ts +316 -0
- package/src/parser/parse-index.ts +298 -0
- package/src/parser/parse-task.test.ts +476 -0
- package/src/parser/parse-task.ts +325 -0
- package/src/state/__fixtures__/invalid-plan.aps.md +9 -0
- package/src/state/__fixtures__/test-plan.aps.md +20 -0
- package/src/state/index.ts +879 -0
- package/src/state/state.test.ts +645 -0
- package/src/templates/generator.test.ts +378 -0
- package/src/templates/generator.ts +776 -0
- package/src/templates/index.ts +5 -0
- package/src/types/index.ts +168 -0
- package/src/validator/__fixtures__/broken-links.aps.md +10 -0
- package/src/validator/__fixtures__/circular-deps-index.aps.md +26 -0
- package/src/validator/__fixtures__/circular-modules/module-a.aps.md +9 -0
- package/src/validator/__fixtures__/circular-modules/module-b.aps.md +9 -0
- package/src/validator/__fixtures__/circular-modules/module-c.aps.md +9 -0
- package/src/validator/__fixtures__/dup-modules/module-a.aps.md +9 -0
- package/src/validator/__fixtures__/dup-modules/module-b.aps.md +9 -0
- package/src/validator/__fixtures__/duplicate-ids-index.aps.md +15 -0
- package/src/validator/__fixtures__/invalid-task-id.aps.md +17 -0
- package/src/validator/__fixtures__/missing-confidence.aps.md +9 -0
- package/src/validator/__fixtures__/missing-h1.aps.md +5 -0
- package/src/validator/__fixtures__/missing-intent.aps.md +9 -0
- package/src/validator/__fixtures__/missing-modules-section.aps.md +7 -0
- package/src/validator/__fixtures__/missing-tasks-section.aps.md +7 -0
- package/src/validator/__fixtures__/modules/auth.aps.md +17 -0
- package/src/validator/__fixtures__/modules/payments.aps.md +13 -0
- package/src/validator/__fixtures__/scope-mismatch.aps.md +14 -0
- package/src/validator/__fixtures__/valid-index.aps.md +24 -0
- package/src/validator/__fixtures__/valid-leaf.aps.md +22 -0
- package/src/validator/index.ts +776 -0
- package/src/validator/validator.test.ts +269 -0
- package/templates/index-full.md +94 -0
- package/templates/index-minimal.md +16 -0
- package/templates/index-template.md +63 -0
- package/templates/leaf-full.md +76 -0
- package/templates/leaf-minimal.md +14 -0
- package/templates/leaf-template.md +55 -0
- package/templates/simple-full.md +56 -0
- package/templates/simple-minimal.md +14 -0
- package/templates/simple-template.md +30 -0
- package/tsconfig.json +19 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.tsbuildinfo +1 -0
- package/tsconfig.spec.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* APS type definitions and schemas
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Task confidence levels
|
|
7
|
+
*/
|
|
8
|
+
export declare const ConfidenceSchema: z.ZodEnum<{
|
|
9
|
+
low: "low";
|
|
10
|
+
medium: "medium";
|
|
11
|
+
high: "high";
|
|
12
|
+
}>;
|
|
13
|
+
export type Confidence = z.infer<typeof ConfidenceSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* Task status values
|
|
16
|
+
* Note: Status is managed externally in .anvil/state.json
|
|
17
|
+
*/
|
|
18
|
+
export declare const TaskStatusSchema: z.ZodEnum<{
|
|
19
|
+
open: "open";
|
|
20
|
+
locked: "locked";
|
|
21
|
+
completed: "completed";
|
|
22
|
+
cancelled: "cancelled";
|
|
23
|
+
}>;
|
|
24
|
+
export type TaskStatus = z.infer<typeof TaskStatusSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Priority levels
|
|
27
|
+
*/
|
|
28
|
+
export declare const PrioritySchema: z.ZodEnum<{
|
|
29
|
+
low: "low";
|
|
30
|
+
medium: "medium";
|
|
31
|
+
high: "high";
|
|
32
|
+
}>;
|
|
33
|
+
export type Priority = z.infer<typeof PrioritySchema>;
|
|
34
|
+
/**
|
|
35
|
+
* Parsed task from APS document
|
|
36
|
+
*/
|
|
37
|
+
/** Task ID regex: 1-10 uppercase alphanumeric scope, hyphen, 3-digit zero-padded number */
|
|
38
|
+
export declare const TASK_ID_REGEX: RegExp;
|
|
39
|
+
export declare const TaskSchema: z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
title: z.ZodString;
|
|
42
|
+
intent: z.ZodString;
|
|
43
|
+
expectedOutcome: z.ZodOptional<z.ZodString>;
|
|
44
|
+
validation: z.ZodOptional<z.ZodString>;
|
|
45
|
+
confidence: z.ZodDefault<z.ZodEnum<{
|
|
46
|
+
low: "low";
|
|
47
|
+
medium: "medium";
|
|
48
|
+
high: "high";
|
|
49
|
+
}>>;
|
|
50
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
nonScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
|
+
dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
55
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
risks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
link: z.ZodOptional<z.ZodString>;
|
|
59
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
open: "open";
|
|
61
|
+
locked: "locked";
|
|
62
|
+
completed: "completed";
|
|
63
|
+
cancelled: "cancelled";
|
|
64
|
+
}>>;
|
|
65
|
+
sourcePath: z.ZodOptional<z.ZodString>;
|
|
66
|
+
sourceLineNumber: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
export type Task = z.infer<typeof TaskSchema>;
|
|
69
|
+
/**
|
|
70
|
+
* Module status values
|
|
71
|
+
* Legacy values (Draft, Complete) are accepted during parsing but normalised
|
|
72
|
+
* to their canonical equivalents (Proposed, Done).
|
|
73
|
+
*/
|
|
74
|
+
export declare const ModuleStatusSchema: z.ZodEnum<{
|
|
75
|
+
Proposed: "Proposed";
|
|
76
|
+
Ready: "Ready";
|
|
77
|
+
"In Progress": "In Progress";
|
|
78
|
+
Done: "Done";
|
|
79
|
+
Blocked: "Blocked";
|
|
80
|
+
}>;
|
|
81
|
+
export type ModuleStatus = z.infer<typeof ModuleStatusSchema>;
|
|
82
|
+
/**
|
|
83
|
+
* Module metadata from index files or leaf spec headers
|
|
84
|
+
*/
|
|
85
|
+
export declare const ModuleMetadataSchema: z.ZodObject<{
|
|
86
|
+
id: z.ZodOptional<z.ZodString>;
|
|
87
|
+
title: z.ZodOptional<z.ZodString>;
|
|
88
|
+
path: z.ZodOptional<z.ZodString>;
|
|
89
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
90
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
91
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
Proposed: "Proposed";
|
|
93
|
+
Ready: "Ready";
|
|
94
|
+
"In Progress": "In Progress";
|
|
95
|
+
Done: "Done";
|
|
96
|
+
Blocked: "Blocked";
|
|
97
|
+
}>>;
|
|
98
|
+
priority: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
low: "low";
|
|
100
|
+
medium: "medium";
|
|
101
|
+
high: "high";
|
|
102
|
+
}>>;
|
|
103
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
+
dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type ModuleMetadata = z.infer<typeof ModuleMetadataSchema>;
|
|
108
|
+
/**
|
|
109
|
+
* Parsed leaf spec document result
|
|
110
|
+
* For index files, use ParsedIndex from the parser module
|
|
111
|
+
*/
|
|
112
|
+
export interface ParsedDocument {
|
|
113
|
+
/** Document title from H1 */
|
|
114
|
+
title: string;
|
|
115
|
+
/** Module metadata from header line */
|
|
116
|
+
metadata?: ModuleMetadata;
|
|
117
|
+
/** List of tasks */
|
|
118
|
+
tasks: Task[];
|
|
119
|
+
/** Source file path */
|
|
120
|
+
sourcePath?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Parser error with context
|
|
124
|
+
*/
|
|
125
|
+
export declare class ParseError extends Error {
|
|
126
|
+
readonly sourcePath?: string | undefined;
|
|
127
|
+
readonly lineNumber?: number | undefined;
|
|
128
|
+
readonly context?: string | undefined;
|
|
129
|
+
constructor(message: string, sourcePath?: string | undefined, lineNumber?: number | undefined, context?: string | undefined);
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src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C,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;aAGjB,UAAU,CAAC,EAAE,MAAM;aACnB,UAAU,CAAC,EAAE,MAAM;aACnB,OAAO,CAAC,EAAE,MAAM;gBAHhC,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,OAAO,CAAC,EAAE,MAAM,YAAA;CAKnC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* APS type definitions and schemas
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Task confidence levels
|
|
7
|
+
*/
|
|
8
|
+
export const ConfidenceSchema = z.enum(['low', 'medium', 'high']);
|
|
9
|
+
/**
|
|
10
|
+
* Task status values
|
|
11
|
+
* Note: Status is managed externally in .anvil/state.json
|
|
12
|
+
*/
|
|
13
|
+
export const TaskStatusSchema = z.enum(['open', 'locked', 'completed', 'cancelled']);
|
|
14
|
+
/**
|
|
15
|
+
* Priority levels
|
|
16
|
+
*/
|
|
17
|
+
export const PrioritySchema = z.enum(['low', 'medium', 'high']);
|
|
18
|
+
/**
|
|
19
|
+
* Parsed task from APS document
|
|
20
|
+
*/
|
|
21
|
+
/** Task ID regex: 1-10 uppercase alphanumeric scope, hyphen, 3-digit zero-padded number */
|
|
22
|
+
export const TASK_ID_REGEX = /^[A-Z0-9]{1,10}-\d{3}$/;
|
|
23
|
+
export const TaskSchema = z.object({
|
|
24
|
+
/** Task ID in format SCOPE-NUMBER (e.g., AUTH-001, LLM2-007) */
|
|
25
|
+
id: z.string().regex(TASK_ID_REGEX),
|
|
26
|
+
/** Task title (after the ID and colon in H3 heading) */
|
|
27
|
+
title: z.string(),
|
|
28
|
+
/** What the task aims to achieve (required) */
|
|
29
|
+
intent: z.string(),
|
|
30
|
+
/** Success criteria (optional) */
|
|
31
|
+
expectedOutcome: z.string().optional(),
|
|
32
|
+
/** Command or method to verify task completion (optional) */
|
|
33
|
+
validation: z.string().optional(),
|
|
34
|
+
/** Certainty about approach (optional, defaults to 'medium') */
|
|
35
|
+
confidence: ConfidenceSchema.default('medium'),
|
|
36
|
+
/** What can be changed - LLM file access constraints (optional) */
|
|
37
|
+
scopes: z.array(z.string()).optional(),
|
|
38
|
+
/** What will NOT be changed (optional) */
|
|
39
|
+
nonScope: z.array(z.string()).optional(),
|
|
40
|
+
/** Best-effort list of files that may be affected (optional) */
|
|
41
|
+
files: z.array(z.string()).optional(),
|
|
42
|
+
/** Labels for filtering and search (optional) */
|
|
43
|
+
tags: z.array(z.string()).optional(),
|
|
44
|
+
/** Tasks that must complete first (optional) */
|
|
45
|
+
dependencies: z.array(z.string()).optional(),
|
|
46
|
+
/** Required inputs or context (optional) */
|
|
47
|
+
inputs: z.array(z.string()).optional(),
|
|
48
|
+
/** Potential risks associated with this task (optional) */
|
|
49
|
+
risks: z.array(z.string()).optional(),
|
|
50
|
+
/** Packages affected by this task (monorepo support) */
|
|
51
|
+
packages: z.array(z.string()).optional(),
|
|
52
|
+
/** External link (e.g., Jira ticket) (optional) */
|
|
53
|
+
link: z.string().optional(),
|
|
54
|
+
/** Current execution state (optional, managed externally) */
|
|
55
|
+
status: TaskStatusSchema.optional(),
|
|
56
|
+
/** Source file path where this task was parsed from */
|
|
57
|
+
sourcePath: z.string().optional(),
|
|
58
|
+
/** Line number in source file where this task starts */
|
|
59
|
+
sourceLineNumber: z.number().optional(),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Module status values
|
|
63
|
+
* Legacy values (Draft, Complete) are accepted during parsing but normalised
|
|
64
|
+
* to their canonical equivalents (Proposed, Done).
|
|
65
|
+
*/
|
|
66
|
+
export const ModuleStatusSchema = z.enum(['Proposed', 'Ready', 'In Progress', 'Done', 'Blocked']);
|
|
67
|
+
/**
|
|
68
|
+
* Module metadata from index files or leaf spec headers
|
|
69
|
+
*/
|
|
70
|
+
export const ModuleMetadataSchema = z.object({
|
|
71
|
+
/** Module identifier (e.g., 'auth', 'payments') */
|
|
72
|
+
id: z.string().optional(),
|
|
73
|
+
/** Module title from H1 heading */
|
|
74
|
+
title: z.string().optional(),
|
|
75
|
+
/** Path to leaf spec file (for index files) */
|
|
76
|
+
path: z.string().optional(),
|
|
77
|
+
/** Scope prefix for task IDs (e.g., AUTH, PAY) */
|
|
78
|
+
scope: z.string().optional(),
|
|
79
|
+
/** Person/team responsible */
|
|
80
|
+
owner: z.string().optional(),
|
|
81
|
+
/** Current module status */
|
|
82
|
+
status: ModuleStatusSchema.optional(),
|
|
83
|
+
/** Priority level */
|
|
84
|
+
priority: PrioritySchema.optional(),
|
|
85
|
+
/** Tags for filtering */
|
|
86
|
+
tags: z.array(z.string()).optional(),
|
|
87
|
+
/** Modules this depends on */
|
|
88
|
+
dependencies: z.array(z.string()).optional(),
|
|
89
|
+
/** Packages affected by this module (monorepo support) */
|
|
90
|
+
packages: z.array(z.string()).optional(),
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Parser error with context
|
|
94
|
+
*/
|
|
95
|
+
export class ParseError extends Error {
|
|
96
|
+
sourcePath;
|
|
97
|
+
lineNumber;
|
|
98
|
+
context;
|
|
99
|
+
constructor(message, sourcePath, lineNumber, context) {
|
|
100
|
+
super(message);
|
|
101
|
+
this.sourcePath = sourcePath;
|
|
102
|
+
this.lineNumber = lineNumber;
|
|
103
|
+
this.context = context;
|
|
104
|
+
this.name = 'ParseError';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// ValidationResult is exported from validator/index.ts
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator module - Validation rules for APS planning documents
|
|
3
|
+
*
|
|
4
|
+
* Provides validation for:
|
|
5
|
+
* - Required sections (Index: ## Modules, Leaf: ## Tasks)
|
|
6
|
+
* - Task format (ID, Intent required)
|
|
7
|
+
* - Duplicate task IDs across plan graph
|
|
8
|
+
* - Broken module links
|
|
9
|
+
* - Scope mismatches (warning)
|
|
10
|
+
* - Missing Confidence (warning)
|
|
11
|
+
* - Missing Expected Outcome (warning)
|
|
12
|
+
* - Missing Validation/Test (warning)
|
|
13
|
+
* - Orphan leaf specs (warning)
|
|
14
|
+
* - Circular module dependencies
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Validation issue severity
|
|
18
|
+
*/
|
|
19
|
+
export type ValidationSeverity = 'error' | 'warning';
|
|
20
|
+
/**
|
|
21
|
+
* A single validation issue
|
|
22
|
+
*/
|
|
23
|
+
export interface ValidationIssue {
|
|
24
|
+
/** Severity level */
|
|
25
|
+
severity: ValidationSeverity;
|
|
26
|
+
/** Human-readable message */
|
|
27
|
+
message: string;
|
|
28
|
+
/** Rule that triggered this issue */
|
|
29
|
+
rule: string;
|
|
30
|
+
/** File path where the issue was found */
|
|
31
|
+
path?: string;
|
|
32
|
+
/** Line number in the file (1-based) */
|
|
33
|
+
lineNumber?: number;
|
|
34
|
+
/** Additional context */
|
|
35
|
+
context?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Result of validating a planning document
|
|
39
|
+
*/
|
|
40
|
+
export interface ValidationResult {
|
|
41
|
+
/** Whether the document is valid (no errors, warnings allowed) */
|
|
42
|
+
valid: boolean;
|
|
43
|
+
/** List of all issues found */
|
|
44
|
+
issues: ValidationIssue[];
|
|
45
|
+
/** Just the errors */
|
|
46
|
+
errors: ValidationIssue[];
|
|
47
|
+
/** Just the warnings */
|
|
48
|
+
warnings: ValidationIssue[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Options for validation
|
|
52
|
+
*/
|
|
53
|
+
export interface ValidateOptions {
|
|
54
|
+
/** Base directory for resolving relative paths */
|
|
55
|
+
baseDir?: string;
|
|
56
|
+
/** Whether to recursively validate linked modules (default: true) */
|
|
57
|
+
recursive?: boolean;
|
|
58
|
+
/** Rules to skip (by rule name) */
|
|
59
|
+
skipRules?: string[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validate an APS planning document
|
|
63
|
+
*
|
|
64
|
+
* @param filePath - Path to the planning document (index or leaf spec)
|
|
65
|
+
* @param options - Validation options
|
|
66
|
+
* @returns Validation result with errors and warnings
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const result = await validatePlanningDoc('docs/planning/APS.md');
|
|
71
|
+
* if (!result.valid) {
|
|
72
|
+
* for (const error of result.errors) {
|
|
73
|
+
* console.error(`${error.path}:${error.lineNumber}: ${error.message}`);
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function validatePlanningDoc(filePath: string, options?: ValidateOptions): Promise<ValidationResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Format validation issues for display
|
|
81
|
+
*/
|
|
82
|
+
export declare function formatValidationIssues(result: ValidationResult): string;
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,QAAQ,EAAE,kBAAkB,CAAC;IAE7B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IAEb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IA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