@vibe-agent-toolkit/resources 0.1.3 → 0.1.4

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 (87) hide show
  1. package/README.md +0 -17
  2. package/dist/collection-matcher.d.ts +63 -0
  3. package/dist/collection-matcher.d.ts.map +1 -0
  4. package/dist/collection-matcher.js +127 -0
  5. package/dist/collection-matcher.js.map +1 -0
  6. package/dist/config-parser.d.ts +63 -0
  7. package/dist/config-parser.d.ts.map +1 -0
  8. package/dist/config-parser.js +113 -0
  9. package/dist/config-parser.js.map +1 -0
  10. package/dist/frontmatter-validator.d.ts +12 -2
  11. package/dist/frontmatter-validator.d.ts.map +1 -1
  12. package/dist/frontmatter-validator.js +174 -18
  13. package/dist/frontmatter-validator.js.map +1 -1
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/link-validator.d.ts +25 -3
  19. package/dist/link-validator.d.ts.map +1 -1
  20. package/dist/link-validator.js +52 -40
  21. package/dist/link-validator.js.map +1 -1
  22. package/dist/multi-schema-validator.d.ts +42 -0
  23. package/dist/multi-schema-validator.d.ts.map +1 -0
  24. package/dist/multi-schema-validator.js +107 -0
  25. package/dist/multi-schema-validator.js.map +1 -0
  26. package/dist/pattern-expander.d.ts +63 -0
  27. package/dist/pattern-expander.d.ts.map +1 -0
  28. package/dist/pattern-expander.js +93 -0
  29. package/dist/pattern-expander.js.map +1 -0
  30. package/dist/resource-registry.d.ts +87 -6
  31. package/dist/resource-registry.d.ts.map +1 -1
  32. package/dist/resource-registry.js +215 -46
  33. package/dist/resource-registry.js.map +1 -1
  34. package/dist/schema-assignment.d.ts +49 -0
  35. package/dist/schema-assignment.d.ts.map +1 -0
  36. package/dist/schema-assignment.js +95 -0
  37. package/dist/schema-assignment.js.map +1 -0
  38. package/dist/schemas/project-config.d.ts +254 -0
  39. package/dist/schemas/project-config.d.ts.map +1 -0
  40. package/dist/schemas/project-config.js +57 -0
  41. package/dist/schemas/project-config.js.map +1 -0
  42. package/dist/schemas/resource-metadata.d.ts +3 -0
  43. package/dist/schemas/resource-metadata.d.ts.map +1 -1
  44. package/dist/schemas/resource-metadata.js +2 -0
  45. package/dist/schemas/resource-metadata.js.map +1 -1
  46. package/dist/schemas/validation-result.d.ts +2 -26
  47. package/dist/schemas/validation-result.d.ts.map +1 -1
  48. package/dist/schemas/validation-result.js +4 -20
  49. package/dist/schemas/validation-result.js.map +1 -1
  50. package/dist/types/resource-parser.d.ts +53 -0
  51. package/dist/types/resource-parser.d.ts.map +1 -0
  52. package/dist/types/resource-parser.js +233 -0
  53. package/dist/types/resource-parser.js.map +1 -0
  54. package/dist/types/resource-path-utils.d.ts +43 -0
  55. package/dist/types/resource-path-utils.d.ts.map +1 -0
  56. package/dist/types/resource-path-utils.js +89 -0
  57. package/dist/types/resource-path-utils.js.map +1 -0
  58. package/dist/types/resources.d.ts +140 -0
  59. package/dist/types/resources.d.ts.map +1 -0
  60. package/dist/types/resources.js +58 -0
  61. package/dist/types/resources.js.map +1 -0
  62. package/dist/types.d.ts +14 -2
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/types.js +17 -0
  65. package/dist/types.js.map +1 -1
  66. package/dist/utils.d.ts +18 -0
  67. package/dist/utils.d.ts.map +1 -1
  68. package/dist/utils.js +39 -0
  69. package/dist/utils.js.map +1 -1
  70. package/package.json +2 -2
  71. package/src/collection-matcher.ts +148 -0
  72. package/src/config-parser.ts +125 -0
  73. package/src/frontmatter-validator.ts +202 -18
  74. package/src/index.ts +7 -2
  75. package/src/link-validator.ts +70 -43
  76. package/src/multi-schema-validator.ts +128 -0
  77. package/src/pattern-expander.ts +100 -0
  78. package/src/resource-registry.ts +322 -54
  79. package/src/schema-assignment.ts +119 -0
  80. package/src/schemas/project-config.ts +71 -0
  81. package/src/schemas/resource-metadata.ts +2 -0
  82. package/src/schemas/validation-result.ts +4 -23
  83. package/src/types/resource-parser.ts +302 -0
  84. package/src/types/resource-path-utils.ts +102 -0
  85. package/src/types/resources.ts +211 -0
  86. package/src/types.ts +81 -1
  87. package/src/utils.ts +43 -0
@@ -0,0 +1,233 @@
1
+ /**
2
+ * Resource parsing functions
3
+ *
4
+ * Parses files into typed Resource objects with proper metadata extraction.
5
+ * Handles markdown, JSON, JSON Schema, and YAML formats.
6
+ */
7
+ import { promises as fs } from 'node:fs';
8
+ import yaml from 'js-yaml';
9
+ import { calculateChecksum } from '../checksum.js';
10
+ import { parseMarkdown } from '../link-parser.js';
11
+ import { isJsonSchema, ResourceType } from './resources.js';
12
+ /**
13
+ * Parse markdown file into MarkdownResource
14
+ *
15
+ * @param absolutePath - Absolute path to markdown file
16
+ * @param projectPath - Relative path from project root
17
+ * @param collectionName - Collection this resource belongs to
18
+ * @returns Parsed MarkdownResource
19
+ */
20
+ export async function parseMarkdownResource(absolutePath, projectPath, collectionName) {
21
+ // Get file stats
22
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
23
+ const stats = await fs.stat(absolutePath);
24
+ // Parse markdown content
25
+ const parsed = await parseMarkdown(absolutePath);
26
+ // Calculate checksum
27
+ const checksum = await calculateChecksum(absolutePath);
28
+ // Extract link hrefs
29
+ const links = parsed.links.map((link) => link.href);
30
+ // Convert HeadingNode[] to Heading[]
31
+ const headings = convertHeadingsToSimple(parsed.headings);
32
+ // Estimate token count (chars / 4)
33
+ const estimatedTokenCount = Math.floor(parsed.content.length / 4);
34
+ // Extract self-asserted schema from frontmatter $schema field
35
+ const schemas = [];
36
+ if (parsed.frontmatter?.['$schema'] !== undefined) {
37
+ if (typeof parsed.frontmatter['$schema'] === 'string') {
38
+ schemas.push({
39
+ schema: parsed.frontmatter['$schema'],
40
+ source: 'self',
41
+ applied: false,
42
+ });
43
+ }
44
+ }
45
+ const resource = {
46
+ id: projectPath,
47
+ projectPath,
48
+ absolutePath,
49
+ type: ResourceType.MARKDOWN,
50
+ mimeType: 'text/markdown',
51
+ sizeBytes: stats.size,
52
+ modifiedAt: stats.mtime,
53
+ checksum,
54
+ collections: [collectionName],
55
+ schemas,
56
+ content: parsed.content,
57
+ links,
58
+ headings,
59
+ estimatedTokenCount,
60
+ };
61
+ // Only set frontmatter if it exists (exactOptionalPropertyTypes)
62
+ if (parsed.frontmatter !== undefined) {
63
+ resource.frontmatter = parsed.frontmatter;
64
+ }
65
+ return resource;
66
+ }
67
+ /**
68
+ * Parse JSON Schema file into JsonSchemaResource
69
+ *
70
+ * @param absolutePath - Absolute path to JSON Schema file
71
+ * @param projectPath - Relative path from project root
72
+ * @param collectionName - Collection this resource belongs to
73
+ * @returns Parsed JsonSchemaResource
74
+ */
75
+ export async function parseJsonSchemaResource(absolutePath, projectPath, collectionName) {
76
+ // Get file stats
77
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
78
+ const stats = await fs.stat(absolutePath);
79
+ // Read and parse JSON
80
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
81
+ const content = await fs.readFile(absolutePath, 'utf-8');
82
+ const schema = JSON.parse(content);
83
+ // Calculate checksum
84
+ const checksum = await calculateChecksum(absolutePath);
85
+ // Build resource with required fields
86
+ const resource = {
87
+ id: projectPath,
88
+ projectPath,
89
+ absolutePath,
90
+ type: ResourceType.JSON_SCHEMA,
91
+ mimeType: 'application/schema+json',
92
+ sizeBytes: stats.size,
93
+ modifiedAt: stats.mtime,
94
+ checksum,
95
+ collections: [collectionName],
96
+ schema,
97
+ referencedBy: [],
98
+ };
99
+ // Only set optional fields if they exist (exactOptionalPropertyTypes)
100
+ if (schema.$id !== undefined) {
101
+ resource.schemaId = schema.$id;
102
+ }
103
+ if (schema.$schema !== undefined) {
104
+ resource.schemaVersion = schema.$schema;
105
+ }
106
+ if (schema.title !== undefined) {
107
+ resource.title = schema.title;
108
+ }
109
+ if (schema.description !== undefined) {
110
+ resource.description = schema.description;
111
+ }
112
+ return resource;
113
+ }
114
+ /**
115
+ * Parse JSON file into JsonResource
116
+ *
117
+ * @param absolutePath - Absolute path to JSON file
118
+ * @param projectPath - Relative path from project root
119
+ * @param collectionName - Collection this resource belongs to
120
+ * @returns Parsed JsonResource
121
+ */
122
+ export async function parseJsonResource(absolutePath, projectPath, collectionName) {
123
+ // Get file stats
124
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
125
+ const stats = await fs.stat(absolutePath);
126
+ // Read and parse JSON
127
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
128
+ const content = await fs.readFile(absolutePath, 'utf-8');
129
+ const data = JSON.parse(content);
130
+ // Calculate checksum
131
+ const checksum = await calculateChecksum(absolutePath);
132
+ return {
133
+ id: projectPath,
134
+ projectPath,
135
+ absolutePath,
136
+ type: ResourceType.JSON,
137
+ mimeType: 'application/json',
138
+ sizeBytes: stats.size,
139
+ modifiedAt: stats.mtime,
140
+ checksum,
141
+ collections: [collectionName],
142
+ data,
143
+ };
144
+ }
145
+ /**
146
+ * Parse YAML file into YamlResource
147
+ *
148
+ * @param absolutePath - Absolute path to YAML file
149
+ * @param projectPath - Relative path from project root
150
+ * @param collectionName - Collection this resource belongs to
151
+ * @returns Parsed YamlResource
152
+ */
153
+ export async function parseYamlResource(absolutePath, projectPath, collectionName) {
154
+ // Get file stats
155
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
156
+ const stats = await fs.stat(absolutePath);
157
+ // Read and parse YAML
158
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
159
+ const content = await fs.readFile(absolutePath, 'utf-8');
160
+ const data = yaml.load(content);
161
+ // Calculate checksum
162
+ const checksum = await calculateChecksum(absolutePath);
163
+ return {
164
+ id: projectPath,
165
+ projectPath,
166
+ absolutePath,
167
+ type: ResourceType.YAML,
168
+ mimeType: 'application/yaml',
169
+ sizeBytes: stats.size,
170
+ modifiedAt: stats.mtime,
171
+ checksum,
172
+ collections: [collectionName],
173
+ data,
174
+ };
175
+ }
176
+ /**
177
+ * Detect resource type from file path and content
178
+ *
179
+ * @param filePath - Path to file
180
+ * @param data - Parsed data (for JSON/YAML detection)
181
+ * @returns Detected ResourceType
182
+ */
183
+ export function detectResourceType(filePath, data) {
184
+ const ext = filePath.toLowerCase().split('.').pop();
185
+ // Check extension first
186
+ if (ext === 'md' || ext === 'markdown') {
187
+ return ResourceType.MARKDOWN;
188
+ }
189
+ if (ext === 'yaml' || ext === 'yml') {
190
+ return ResourceType.YAML;
191
+ }
192
+ if (ext === 'json') {
193
+ // Use heuristics to detect JSON Schema
194
+ if (data && isJsonSchema(data)) {
195
+ return ResourceType.JSON_SCHEMA;
196
+ }
197
+ return ResourceType.JSON;
198
+ }
199
+ // Default fallback
200
+ if (data && typeof data === 'object' && isJsonSchema(data)) {
201
+ return ResourceType.JSON_SCHEMA;
202
+ }
203
+ return ResourceType.JSON; // Default
204
+ }
205
+ // ============================================================================
206
+ // Helper functions
207
+ // ============================================================================
208
+ /**
209
+ * Convert HeadingNode[] to simple Heading[] for Phase 1
210
+ *
211
+ * @param nodes - Parsed heading nodes
212
+ * @returns Simplified heading array
213
+ */
214
+ function convertHeadingsToSimple(nodes) {
215
+ const result = [];
216
+ function traverse(node) {
217
+ result.push({
218
+ level: node.level,
219
+ text: node.text,
220
+ id: node.slug,
221
+ });
222
+ if (node.children) {
223
+ for (const child of node.children) {
224
+ traverse(child);
225
+ }
226
+ }
227
+ }
228
+ for (const node of nodes) {
229
+ traverse(node);
230
+ }
231
+ return result;
232
+ }
233
+ //# sourceMappingURL=resource-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-parser.js","sourceRoot":"","sources":["../../src/types/resource-parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAWlD,OAAO,EAAE,YAAY,EAA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AI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,OAAO,YAAY,CAAC,WAAW,CAAC;QAClC,CAAC;QACD,OAAO,YAAY,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,mBAAmB;IACnB,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3D,OAAO,YAAY,CAAC,WAAW,CAAC;IAClC,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,UAAU;AACtC,CAAC;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,KAAoB;IACnD,MAAM,MAAM,GAAc,EAAE,CAAC;IAE7B,SAAS,QAAQ,CAAC,IAAiB;QACjC,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,EAAE,EAAE,IAAI,CAAC,IAAI;SACd,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Path utilities for resource management
3
+ *
4
+ * Handles path normalization, validation, and absolutePath computation.
5
+ * All projectPath values must be relative with forward slashes.
6
+ */
7
+ /**
8
+ * Normalize a path to projectPath format
9
+ *
10
+ * Converts to relative path with forward slashes:
11
+ * - Removes leading /, //, file://, file:///
12
+ * - Converts backslashes to forward slashes
13
+ * - Preserves relative path structure (including ../)
14
+ *
15
+ * @param path - Path to normalize
16
+ * @returns Normalized projectPath (relative, forward slashes)
17
+ */
18
+ export declare function normalizeProjectPath(path: string): string;
19
+ /**
20
+ * Validate that a projectPath is safe and relative
21
+ *
22
+ * Requirements:
23
+ * - Must be relative (no leading /, //, C:/, etc.)
24
+ * - Must use forward slashes only (no backslashes)
25
+ * - Must not escape project root with ../
26
+ * - Must not be a URL (http://, https://, file://)
27
+ * - Must not be empty
28
+ *
29
+ * @param projectPath - Path to validate
30
+ * @returns true if valid projectPath
31
+ */
32
+ export declare function isValidProjectPath(projectPath: string): boolean;
33
+ /**
34
+ * Compute absolute path from project root and projectPath
35
+ *
36
+ * This is a runtime utility - absolutePath should never be serialized.
37
+ *
38
+ * @param projectRoot - Absolute path to project root
39
+ * @param projectPath - Relative path from project root
40
+ * @returns Absolute path to resource
41
+ */
42
+ export declare function getResourceAbsolutePath(projectRoot: string, projectPath: string): string;
43
+ //# sourceMappingURL=resource-path-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-path-utils.d.ts","sourceRoot":"","sources":["../../src/types/resource-path-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAazD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAsC/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAExF"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Path utilities for resource management
3
+ *
4
+ * Handles path normalization, validation, and absolutePath computation.
5
+ * All projectPath values must be relative with forward slashes.
6
+ */
7
+ import { join, normalize, sep } from 'node:path';
8
+ import { toForwardSlash } from '@vibe-agent-toolkit/utils';
9
+ /**
10
+ * Normalize a path to projectPath format
11
+ *
12
+ * Converts to relative path with forward slashes:
13
+ * - Removes leading /, //, file://, file:///
14
+ * - Converts backslashes to forward slashes
15
+ * - Preserves relative path structure (including ../)
16
+ *
17
+ * @param path - Path to normalize
18
+ * @returns Normalized projectPath (relative, forward slashes)
19
+ */
20
+ export function normalizeProjectPath(path) {
21
+ let normalized = path;
22
+ // Remove file:// or file:/// protocol
23
+ normalized = normalized.replace(/^file:\/\/\/?/, '');
24
+ // Convert to forward slashes first (handles Windows backslashes)
25
+ normalized = toForwardSlash(normalized);
26
+ // Remove leading / or // (after converting backslashes)
27
+ normalized = normalized.replace(/^\/+/, '');
28
+ return normalized;
29
+ }
30
+ /**
31
+ * Validate that a projectPath is safe and relative
32
+ *
33
+ * Requirements:
34
+ * - Must be relative (no leading /, //, C:/, etc.)
35
+ * - Must use forward slashes only (no backslashes)
36
+ * - Must not escape project root with ../
37
+ * - Must not be a URL (http://, https://, file://)
38
+ * - Must not be empty
39
+ *
40
+ * @param projectPath - Path to validate
41
+ * @returns true if valid projectPath
42
+ */
43
+ export function isValidProjectPath(projectPath) {
44
+ if (!projectPath) {
45
+ return false;
46
+ }
47
+ // Reject absolute paths (leading slash or drive letter)
48
+ if (projectPath.startsWith('/') || /^[A-Za-z]:/.test(projectPath)) {
49
+ return false;
50
+ }
51
+ // Reject URLs
52
+ if (projectPath.startsWith('http://') || projectPath.startsWith('https://') || projectPath.startsWith('file://')) {
53
+ return false;
54
+ }
55
+ // Reject backslashes (must use forward slashes)
56
+ if (projectPath.includes('\\')) {
57
+ return false;
58
+ }
59
+ // Reject paths that escape project root
60
+ // Normalize the path and check if it starts with ../
61
+ const normalized = normalize(projectPath);
62
+ const parts = normalized.split(sep);
63
+ let depth = 0;
64
+ for (const part of parts) {
65
+ if (part === '..') {
66
+ depth--;
67
+ if (depth < 0) {
68
+ return false; // Escaped project root
69
+ }
70
+ }
71
+ else if (part !== '.' && part !== '') {
72
+ depth++;
73
+ }
74
+ }
75
+ return true;
76
+ }
77
+ /**
78
+ * Compute absolute path from project root and projectPath
79
+ *
80
+ * This is a runtime utility - absolutePath should never be serialized.
81
+ *
82
+ * @param projectRoot - Absolute path to project root
83
+ * @param projectPath - Relative path from project root
84
+ * @returns Absolute path to resource
85
+ */
86
+ export function getResourceAbsolutePath(projectRoot, projectPath) {
87
+ return join(projectRoot, projectPath);
88
+ }
89
+ //# sourceMappingURL=resource-path-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-path-utils.js","sourceRoot":"","sources":["../../src/types/resource-path-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,IAAI,UAAU,GAAG,IAAI,CAAC;IAEtB,sCAAsC;IACtC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAErD,iEAAiE;IACjE,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IAExC,wDAAwD;IACxD,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE5C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wDAAwD;IACxD,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAClE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,cAAc;IACd,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACjH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gDAAgD;IAChD,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wCAAwC;IACxC,qDAAqD;IACrD,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,KAAK,EAAE,CAAC;YACR,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,OAAO,KAAK,CAAC,CAAC,uBAAuB;YACvC,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YACvC,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB,EAAE,WAAmB;IAC9E,OAAO,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Core resource type system for vibe-agent-toolkit
3
+ *
4
+ * Defines discriminated unions for different resource types with unified interface.
5
+ * All resources use projectPath (relative, forward slashes) for serialization,
6
+ * with optional absolutePath for runtime operations.
7
+ */
8
+ import type { SHA256 } from '../schemas/checksum.js';
9
+ import type { ValidationIssue } from '../schemas/validation-result.js';
10
+ /**
11
+ * Resource type discriminator for type-safe handling
12
+ */
13
+ export declare enum ResourceType {
14
+ MARKDOWN = "markdown",
15
+ JSON_SCHEMA = "json-schema",
16
+ JSON = "json",
17
+ YAML = "yaml"
18
+ }
19
+ /**
20
+ * Reference to a JSON Schema with validation tracking
21
+ */
22
+ export interface SchemaReference {
23
+ /** Path or URL to schema */
24
+ schema: string;
25
+ /** Source of schema assignment: 'self' (from $schema field), 'cli' (from CLI flag), or collection name */
26
+ source: string;
27
+ /** Whether validation was attempted for this schema */
28
+ applied: boolean;
29
+ /** Validation result (undefined if not validated) */
30
+ valid?: boolean;
31
+ /** Validation errors specific to this schema */
32
+ errors?: ValidationIssue[];
33
+ }
34
+ /**
35
+ * Simple heading structure for Phase 1
36
+ * Expanded in future phases
37
+ */
38
+ export interface Heading {
39
+ level: number;
40
+ text: string;
41
+ id?: string;
42
+ }
43
+ /**
44
+ * Base resource properties shared by all resource types
45
+ */
46
+ export interface BaseResource {
47
+ /** Unique identifier for this resource */
48
+ id: string;
49
+ /** Relative path from project root (forward slashes, no leading /) */
50
+ projectPath: string;
51
+ /** Absolute path computed at runtime (never serialized) */
52
+ absolutePath?: string;
53
+ /** Resource type discriminator */
54
+ type: ResourceType;
55
+ /** MIME type for the resource */
56
+ mimeType: string;
57
+ /** File size in bytes */
58
+ sizeBytes: number;
59
+ /** Last modification timestamp */
60
+ modifiedAt: Date;
61
+ /** SHA-256 checksum of file content */
62
+ checksum: SHA256;
63
+ /** Collections this resource belongs to (empty for Phase 1) */
64
+ collections: string[];
65
+ }
66
+ /**
67
+ * Markdown resource with parsed content and metadata
68
+ */
69
+ export interface MarkdownResource extends BaseResource {
70
+ type: ResourceType.MARKDOWN;
71
+ mimeType: 'text/markdown';
72
+ /** Parsed YAML frontmatter (if present) */
73
+ frontmatter?: Record<string, unknown>;
74
+ /** JSON Schema references with validation tracking */
75
+ schemas: SchemaReference[];
76
+ /** Raw markdown content */
77
+ content: string;
78
+ /** Link hrefs found in content */
79
+ links: string[];
80
+ /** Document heading structure */
81
+ headings: Heading[];
82
+ /** Estimated token count (chars / 4) */
83
+ estimatedTokenCount: number;
84
+ }
85
+ /**
86
+ * JSON Schema resource
87
+ */
88
+ export interface JsonSchemaResource extends BaseResource {
89
+ type: ResourceType.JSON_SCHEMA;
90
+ mimeType: 'application/schema+json';
91
+ /** Parsed schema object */
92
+ schema: object;
93
+ /** Schema $id field (if present) */
94
+ schemaId?: string;
95
+ /** Schema version (from $schema field) */
96
+ schemaVersion?: string;
97
+ /** Schema title (if present) */
98
+ title?: string;
99
+ /** Schema description (if present) */
100
+ description?: string;
101
+ /** Resource IDs that reference this schema */
102
+ referencedBy: string[];
103
+ }
104
+ /**
105
+ * JSON resource (not a schema)
106
+ */
107
+ export interface JsonResource extends BaseResource {
108
+ type: ResourceType.JSON;
109
+ mimeType: 'application/json';
110
+ /** Parsed JSON data */
111
+ data: unknown;
112
+ /** JSON Schema references with validation tracking */
113
+ schemas?: SchemaReference[];
114
+ }
115
+ /**
116
+ * YAML resource
117
+ */
118
+ export interface YamlResource extends BaseResource {
119
+ type: ResourceType.YAML;
120
+ mimeType: 'application/yaml';
121
+ /** Parsed YAML data */
122
+ data: unknown;
123
+ /** JSON Schema references with validation tracking */
124
+ schemas?: SchemaReference[];
125
+ }
126
+ /**
127
+ * Union type for all resource types
128
+ */
129
+ export type Resource = MarkdownResource | JsonSchemaResource | JsonResource | YamlResource;
130
+ /**
131
+ * Detect if data is likely a JSON Schema using heuristics
132
+ *
133
+ * Returns true if data is an object with 2+ recognized schema keywords.
134
+ * This heuristic catches schemas without explicit $schema field.
135
+ *
136
+ * @param data - Data to check
137
+ * @returns true if data appears to be a JSON Schema
138
+ */
139
+ export declare function isJsonSchema(data: unknown): boolean;
140
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/types/resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;A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,CAAC;AA4B3F;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAOnD"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Core resource type system for vibe-agent-toolkit
3
+ *
4
+ * Defines discriminated unions for different resource types with unified interface.
5
+ * All resources use projectPath (relative, forward slashes) for serialization,
6
+ * with optional absolutePath for runtime operations.
7
+ */
8
+ /**
9
+ * Resource type discriminator for type-safe handling
10
+ */
11
+ export var ResourceType;
12
+ (function (ResourceType) {
13
+ ResourceType["MARKDOWN"] = "markdown";
14
+ ResourceType["JSON_SCHEMA"] = "json-schema";
15
+ ResourceType["JSON"] = "json";
16
+ ResourceType["YAML"] = "yaml";
17
+ })(ResourceType || (ResourceType = {}));
18
+ // ============================================================================
19
+ // JSON Schema Detection
20
+ // ============================================================================
21
+ /**
22
+ * JSON Schema keywords for heuristic detection
23
+ * See: https://json-schema.org/understanding-json-schema/reference/
24
+ */
25
+ const SCHEMA_KEYWORDS = [
26
+ '$schema',
27
+ '$id',
28
+ 'title',
29
+ 'description',
30
+ 'type',
31
+ 'properties',
32
+ 'required',
33
+ 'items',
34
+ 'enum',
35
+ 'definitions',
36
+ '$defs',
37
+ 'allOf',
38
+ 'anyOf',
39
+ 'oneOf',
40
+ 'not',
41
+ ];
42
+ /**
43
+ * Detect if data is likely a JSON Schema using heuristics
44
+ *
45
+ * Returns true if data is an object with 2+ recognized schema keywords.
46
+ * This heuristic catches schemas without explicit $schema field.
47
+ *
48
+ * @param data - Data to check
49
+ * @returns true if data appears to be a JSON Schema
50
+ */
51
+ export function isJsonSchema(data) {
52
+ if (typeof data !== 'object' || data === null || Array.isArray(data)) {
53
+ return false;
54
+ }
55
+ const matchCount = SCHEMA_KEYWORDS.filter((keyword) => keyword in data).length;
56
+ return matchCount >= 2;
57
+ }
58
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/types/resources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,2CAA2B,CAAA;IAC3B,6BAAa,CAAA;IACb,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAqJD,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,eAAe,GAAG;IACtB,SAAS;IACT,KAAK;IACL,OAAO;IACP,aAAa;IACb,MAAM;IACN,YAAY;IACZ,UAAU;IACV,OAAO;IACP,MAAM;IACN,aAAa;IACb,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,KAAK;CACG,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC;IAC/E,OAAO,UAAU,IAAI,CAAC,CAAC;AACzB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -13,6 +13,18 @@
13
13
  export type { SHA256 } from './schemas/checksum.js';
14
14
  export { SHA256Schema } from './schemas/checksum.js';
15
15
  export type { LinkType, HeadingNode, ResourceLink, ResourceMetadata, } from './schemas/resource-metadata.js';
16
- export type { ValidationSeverity, ValidationIssue, ValidationResult, } from './schemas/validation-result.js';
17
- export type { CrawlOptions, ResourceRegistryOptions, ValidateOptions, RegistryStats, } from './resource-registry.js';
16
+ export type { ValidationIssue, ValidationResult, } from './schemas/validation-result.js';
17
+ export type { CrawlOptions, ResourceRegistryOptions, ValidateOptions, RegistryStats, CollectionStat, CollectionStats, } from './resource-registry.js';
18
+ export { ResourceType, isJsonSchema, } from './types/resources.js';
19
+ export type { BaseResource, Heading, JsonResource, JsonSchemaResource, MarkdownResource, Resource, SchemaReference, YamlResource, } from './types/resources.js';
20
+ export { getResourceAbsolutePath, isValidProjectPath, normalizeProjectPath, } from './types/resource-path-utils.js';
21
+ export { detectResourceType, parseJsonResource, parseJsonSchemaResource, parseMarkdownResource, parseYamlResource, } from './types/resource-parser.js';
22
+ export type { ValidationMode, CollectionValidation, CollectionConfig, ResourcesConfig, ProjectConfig, } from './schemas/project-config.js';
23
+ export { findConfigFile, parseConfigFile, loadConfig, } from './config-parser.js';
24
+ export { isGlobPattern, expandPattern, expandPatterns, } from './pattern-expander.js';
25
+ export { matchesCollection, getCollectionsForFile, } from './collection-matcher.js';
26
+ export type { ValidateLinkOptions } from './link-validator.js';
27
+ export { validateLink } from './link-validator.js';
28
+ export { addCLISchema, addCollectionSchema, assignSchemas, } from './schema-assignment.js';
29
+ export { getAllSchemaErrors, hasSchemaErrors, validateFrontmatterMultiSchema, } from './multi-schema-validator.js';
18
30
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,YAAY,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,YAAY,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAGxC,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAGxC,YAAY,EACV,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,aAAa,GACd,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[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AAmB,EACnB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC"}
package/dist/types.js CHANGED
@@ -11,4 +11,21 @@
11
11
  * ```
12
12
  */
13
13
  export { SHA256Schema } from './schemas/checksum.js';
14
+ // Resource type system
15
+ export { ResourceType, isJsonSchema, } from './types/resources.js';
16
+ // Resource path utilities
17
+ export { getResourceAbsolutePath, isValidProjectPath, normalizeProjectPath, } from './types/resource-path-utils.js';
18
+ // Resource parsing
19
+ export { detectResourceType, parseJsonResource, parseJsonSchemaResource, parseMarkdownResource, parseYamlResource, } from './types/resource-parser.js';
20
+ // Config parsing
21
+ export { findConfigFile, parseConfigFile, loadConfig, } from './config-parser.js';
22
+ // Pattern expansion
23
+ export { isGlobPattern, expandPattern, expandPatterns, } from './pattern-expander.js';
24
+ // Collection matching
25
+ export { matchesCollection, getCollectionsForFile, } from './collection-matcher.js';
26
+ export { validateLink } from './link-validator.js';
27
+ // Schema assignment
28
+ export { addCLISchema, addCollectionSchema, assignSchemas, } from './schema-assignment.js';
29
+ // Multi-schema validation
30
+ export { getAllSchemaErrors, hasSchemaErrors, validateFrontmatterMultiSchema, } from './multi-schema-validator.js';
14
31
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA0BrD,uBAAuB;AACvB,OAAO,EACL,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAC;AAY9B,0BAA0B;AAC1B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAExC,mBAAmB;AACnB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAWpC,iBAAiB;AACjB,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,oBAAoB;AACpB,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAE/B,sBAAsB;AACtB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,oBAAoB;AACpB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,0BAA0B;AAC1B,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC"}