oneie 1.3.3 → 1.4.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.
Files changed (180) hide show
  1. package/.claude/agents/engineering-architect.md +39 -56
  2. package/.claude/agents/engineering-developer.md +37 -57
  3. package/.claude/agents/engineering-director.md +37 -144
  4. package/.claude/agents/engineering-ingestor.md +229 -0
  5. package/.claude/agents/engineering-quality-assurance.md +40 -206
  6. package/.claude/agents/engineering-user-experience.md +36 -207
  7. package/.claude/agents/improver.md +454 -0
  8. package/.claude/agents/marketing-brand-identity.md +37 -48
  9. package/.claude/agents/marketing-director.md +9 -0
  10. package/.claude/agents/one-orchestrator.md +50 -136
  11. package/.claude/agents/story-teller.md +10 -0
  12. package/.claude/agents/task-master.md +10 -0
  13. package/.claude/agents/turbo-repo-builder.md +51 -0
  14. package/.claude/claude-code-hooks.json +20 -233
  15. package/.claude/commands/agent-balance +111 -0
  16. package/.claude/commands/agent.md +24 -7
  17. package/.claude/commands/cascade-status.md +128 -0
  18. package/.claude/commands/ingest.md +290 -0
  19. package/.claude/commands/ingestor.md +136 -0
  20. package/.claude/commands/mission.md +26 -8
  21. package/.claude/commands/one.md +351 -14
  22. package/.claude/commands/quality-check.md +204 -0
  23. package/.claude/commands/smart-route.md +220 -0
  24. package/.claude/commands/start.md +9 -8
  25. package/.claude/commands/story.md +18 -3
  26. package/.claude/commands/task.md +22 -1
  27. package/.claude/settings.local.json +18 -3
  28. package/.obsidian/core-plugins.json +3 -1
  29. package/.one/checklists/agent-quality-checklist.md +24 -15
  30. package/.one/checklists/story-quality-checklist.md +24 -15
  31. package/.one/checklists/task-quality-checklist.md +24 -15
  32. package/.one/templates/bun-workspace-guide-template.md +188 -0
  33. package/.one/templates/bunfig-template.toml +95 -0
  34. package/.one/templates/root-package-template.json +37 -21
  35. package/.one/templates/turbo-config-template.json +18 -3
  36. package/.one/tools/bump-core-version.js +0 -0
  37. package/.one/tools/bump-expansion-version.js +0 -0
  38. package/.one/tools/code-generators.js +0 -0
  39. package/.one/tools/compression-engine.js +638 -0
  40. package/.one/tools/content-deduplicator.js +336 -0
  41. package/.one/tools/convert-wav-to-mp3.js +0 -0
  42. package/.one/tools/foundation-wizard.js +0 -0
  43. package/.one/tools/generate-toc.js +0 -0
  44. package/.one/tools/ingestor/cascade-integration.js +523 -0
  45. package/.one/tools/ingestor/cli.ts +234 -0
  46. package/.one/tools/ingestor/context-mapper.ts +604 -0
  47. package/.one/tools/ingestor/error-handling-monitor.js +742 -0
  48. package/.one/tools/ingestor/file-discovery.ts +484 -0
  49. package/.one/tools/ingestor/file-transformer.ts +524 -0
  50. package/.one/tools/ingestor/ingestor-orchestrator.ts +416 -0
  51. package/.one/tools/ingestor/package.json +47 -0
  52. package/.one/tools/ingestor/usage-examples.md +458 -0
  53. package/.one/tools/lazy-loader.js +489 -0
  54. package/.one/tools/minimal-generators.js +0 -0
  55. package/.one/tools/performance-benchmark.js +300 -0
  56. package/.one/tools/premium-manager.js +0 -0
  57. package/.one/tools/semantic-release-sync-installer.js +0 -0
  58. package/.one/tools/size-memory-optimizer.js +475 -0
  59. package/.one/tools/sync-installer-version.js +0 -0
  60. package/.one/tools/text-to-speech.js +0 -0
  61. package/.one/tools/transformative-ai-engine.js +0 -0
  62. package/.one/workflows/safe-improvement-deployment.yaml +420 -0
  63. package/CLAUDE.md +30 -0
  64. package/README.md +41 -10
  65. package/bin/oneie/index.js +733 -64
  66. package/one/cache/benchmark-results.json +43 -0
  67. package/one/cache/file-index.json +12480 -0
  68. package/one/config/agent-routing.yaml +124 -0
  69. package/one/config/agent-skills.yaml +451 -0
  70. package/one/config/cache-config.yaml +304 -0
  71. package/one/config/feedback-templates.yaml +152 -0
  72. package/one/config/performance-config.yaml +281 -0
  73. package/one/config/quality-automation.yaml +405 -0
  74. package/one/config/routing-logic.yaml +292 -0
  75. package/one/data/task-registry.yaml +224 -0
  76. package/one/stories/story-1.10-parallel-task-execution-orchestration.md +119 -0
  77. package/one/stories/story-3.1-external-repository-foundation.md +374 -0
  78. package/one/stories/story-3.2-3-levels-architecture-integration.md +449 -0
  79. package/one/stories/story-3.3-multi-platform-application-development.md +677 -0
  80. package/one/stories/story-3.4-shared-package-system-ui-components.md +854 -0
  81. package/one/stories/story-3.5-backend-integration-production-deployment.md +1034 -0
  82. package/one/tasks/task-1.10.1-design-parallel-execution-architecture.md +108 -0
  83. package/one/tasks/task-1.10.2-create-task-dependency-mapping-system.md +82 -0
  84. package/one/tasks/task-1.10.3-build-agent-spawning-orchestration-engine.md +120 -0
  85. package/one/tasks/task-1.10.4-implement-task-queue-dependency-resolution.md +125 -0
  86. package/one/tasks/task-1.10.5-create-task-numbering-convention-system.md +542 -0
  87. package/one/tasks/task-3.1.1-external-repository-creation.md +303 -0
  88. package/one/tasks/task-3.1.2-turborepo-configuration-optimization.md +402 -0
  89. package/one/tasks/task-3.1.3-shared-configuration-packages.md +571 -0
  90. package/one/tasks/task-3.1.4-bun-package-management-optimization.md +627 -0
  91. package/one/tools/task-numbering-validator.js +429 -0
  92. package/package.json +1 -1
  93. package/quality-gate-optimization-analysis.md +260 -0
  94. package/turbo-benchmark.js +268 -0
  95. package/turbo-optimization-guide.md +163 -0
  96. package/turbo-workspace-template.json +83 -0
  97. package/turbo.json +178 -0
  98. package/.claude/commands/analyst.md +0 -70
  99. package/.claude/commands/architect.md +0 -67
  100. package/.claude/commands/commander.md +0 -78
  101. package/.claude/commands/deploy.md +0 -68
  102. package/.claude/commands/dev.md +0 -60
  103. package/.claude/commands/playbook.md +0 -81
  104. package/.claude/commands/pm.md +0 -64
  105. package/.claude/commands/po.md +0 -68
  106. package/.claude/commands/qa.md +0 -59
  107. package/.claude/commands/taskmaster.md +0 -85
  108. package/.claude/commands/ux-expert.md +0 -58
  109. package/.one/stories/bullstamp-attract-module-complete.md +0 -255
  110. package/.one/stories/bullstamp-deployment-master-plan.md +0 -518
  111. package/.one/stories/bullstamp-executive-implementation-summary.md +0 -254
  112. package/.one/stories/bullstamp-project-status-complete.md +0 -257
  113. package/.one/stories/obsidian-pandoc-config.md +0 -159
  114. package/.one/stories/story-1.1-perfect-filesystem-organization.md +0 -270
  115. package/.one/stories/story-1.1.1.md +0 -136
  116. package/.one/stories/story-1.1.md +0 -131
  117. package/.one/stories/story-1.2.md +0 -420
  118. package/.one/stories/story-1.3.md +0 -177
  119. package/.one/stories/story-1.4.md +0 -356
  120. package/.one/stories/story-1.5.md +0 -572
  121. package/.one/stories/story-1.6.md +0 -481
  122. package/.one/stories/story-1.7.md +0 -923
  123. package/.one/stories/story-1.8.md +0 -404
  124. package/.one/stories/story-2.0.md +0 -132
  125. package/.one/stories/story-2.1.md +0 -110
  126. package/.one/stories/story-2.2.md +0 -110
  127. package/.one/stories/story-2.3.md +0 -112
  128. package/.one/stories/story-2.4.md +0 -116
  129. package/.one/stories/story-2.5.md +0 -114
  130. package/.one/stories/story-3.1.md +0 -298
  131. package/.one/stories/story-3.10.md +0 -302
  132. package/.one/stories/story-3.11.md +0 -167
  133. package/.one/stories/story-3.12.md +0 -235
  134. package/.one/stories/story-3.13.md +0 -235
  135. package/.one/stories/story-3.14.md +0 -225
  136. package/.one/stories/story-3.15.md +0 -238
  137. package/.one/stories/story-3.16.md +0 -244
  138. package/.one/stories/story-3.17.md +0 -245
  139. package/.one/stories/story-3.18.md +0 -248
  140. package/.one/stories/story-3.2.md +0 -226
  141. package/.one/stories/story-3.3.md +0 -226
  142. package/.one/stories/story-3.4.md +0 -226
  143. package/.one/stories/story-3.5.md +0 -167
  144. package/.one/stories/story-3.6.md +0 -167
  145. package/.one/stories/story-3.7.md +0 -181
  146. package/.one/stories/story-3.8.md +0 -198
  147. package/.one/stories/story-3.9.md +0 -169
  148. package/.one/stories/story-4.1.md +0 -245
  149. package/.one/stories/story-4.2.md +0 -314
  150. package/.one/stories/story-4.3.md +0 -610
  151. package/.one/stories/story-4.4.md +0 -931
  152. package/.one/stories/story-4.5.md +0 -727
  153. package/.one/stories/story-4.6-consistency.md +0 -175
  154. package/.one/stories/story-5.1.md +0 -508
  155. package/.one/stories/story-5.2.md +0 -451
  156. package/.one/stories/story-5.3.md +0 -405
  157. package/.one/stories/story-5.4.md +0 -447
  158. package/.one/stories/story-5.5.md +0 -349
  159. package/.one/stories/story-5.6.md +0 -445
  160. package/.one/stories/story-6.1-text-content-engine.md +0 -144
  161. package/.one/stories/story-6.2-audio-content-engine.md +0 -145
  162. package/.one/stories/story-6.3-video-content-engine.md +0 -145
  163. package/.one/stories/story-6.4-visual-content-engine.md +0 -177
  164. package/.one/stories/story-6.5-cross-platform-distribution.md +0 -188
  165. package/.one/stories/story-6.6.ai-content-generation-pipeline.md +0 -196
  166. package/.one/stories/story-6.7-character-consistency-quality-control.md +0 -216
  167. package/.one/stories/story-6.8-claude-code-content-integration.md +0 -181
  168. package/.one/stories/story-6.8-content-production-workflows.md +0 -247
  169. package/.one/stories/story-7.1-implementation.md +0 -128
  170. package/.one/stories/story-7.1.md +0 -203
  171. package/.one/stories/story-7.2-implementation.md +0 -147
  172. package/.one/stories/story-7.2.md +0 -415
  173. package/.one/stories/story-7.3-implementation.md +0 -159
  174. package/.one/stories/story-7.3.md +0 -463
  175. package/.one/stories/story-7.4-implementation.md +0 -154
  176. package/.one/stories/story-7.4.md +0 -500
  177. package/.one/stories/story-validation-report.md +0 -169
  178. package/one/archive-index.json +0 -91
  179. /package/one/stories/{story-3.1-npx-oneie-turbo-enhancement.md → story-2.1.1-npx-oneie-turbo-enhancement.md} +0 -0
  180. /package/one/stories/{story-3.2-npx-connection-implementation.md → story-2.21-npx-connection-implementation.md} +0 -0
@@ -0,0 +1,604 @@
1
+ import { readFile, readdir } from 'fs/promises';
2
+ import { join, extname } from 'path';
3
+ import { existsSync } from 'fs';
4
+ import yaml from 'yaml';
5
+
6
+ export interface ProjectContext {
7
+ missions: string[];
8
+ stories: string[];
9
+ tasks: string[];
10
+ keywords: string[];
11
+ priorities: ContextPriority[];
12
+ }
13
+
14
+ export interface ContextPriority {
15
+ type: 'mission' | 'story' | 'task';
16
+ name: string;
17
+ priority: number; // 1-10
18
+ keywords: string[];
19
+ filePatterns: string[];
20
+ }
21
+
22
+ export interface MissionMetadata {
23
+ id: string;
24
+ title: string;
25
+ description: string;
26
+ status: string;
27
+ priority: number;
28
+ keywords: string[];
29
+ requiredComponents: string[];
30
+ requiredUtilities: string[];
31
+ }
32
+
33
+ export interface StoryMetadata {
34
+ id: string;
35
+ title: string;
36
+ mission: string;
37
+ description: string;
38
+ acceptanceCriteria: string[];
39
+ technicalRequirements: string[];
40
+ keywords: string[];
41
+ componentNeeds: string[];
42
+ }
43
+
44
+ export interface TaskMetadata {
45
+ id: string;
46
+ title: string;
47
+ story: string;
48
+ description: string;
49
+ type: 'frontend' | 'backend' | 'design' | 'testing' | 'deployment';
50
+ requirements: string[];
51
+ keywords: string[];
52
+ }
53
+
54
+ export class ContextMapper {
55
+ private aiKeywordExtractor: KeywordExtractor;
56
+
57
+ constructor() {
58
+ this.aiKeywordExtractor = new KeywordExtractor();
59
+ }
60
+
61
+ async loadCurrentContext(projectPath: string): Promise<ProjectContext> {
62
+ const context: ProjectContext = {
63
+ missions: [],
64
+ stories: [],
65
+ tasks: [],
66
+ keywords: [],
67
+ priorities: []
68
+ };
69
+
70
+ try {
71
+ // Load missions from one/missions/
72
+ const missionsPath = join(projectPath, 'one/missions');
73
+ if (existsSync(missionsPath)) {
74
+ const missions = await this.loadMissions(missionsPath);
75
+ context.missions = missions.map(m => m.title);
76
+ context.keywords.push(...missions.flatMap(m => m.keywords));
77
+
78
+ // Add mission priorities
79
+ missions.forEach(mission => {
80
+ context.priorities.push({
81
+ type: 'mission',
82
+ name: mission.title,
83
+ priority: mission.priority,
84
+ keywords: mission.keywords,
85
+ filePatterns: this.generateFilePatterns(mission.keywords, mission.requiredComponents)
86
+ });
87
+ });
88
+ }
89
+
90
+ // Load stories from one/stories/
91
+ const storiesPath = join(projectPath, 'one/stories');
92
+ if (existsSync(storiesPath)) {
93
+ const stories = await this.loadStories(storiesPath);
94
+ context.stories = stories.map(s => s.title);
95
+ context.keywords.push(...stories.flatMap(s => s.keywords));
96
+
97
+ // Add story priorities
98
+ stories.forEach(story => {
99
+ context.priorities.push({
100
+ type: 'story',
101
+ name: story.title,
102
+ priority: 7, // Default story priority
103
+ keywords: story.keywords,
104
+ filePatterns: this.generateFilePatterns(story.keywords, story.componentNeeds)
105
+ });
106
+ });
107
+ }
108
+
109
+ // Load tasks from one/tasks/ or embedded in stories
110
+ const tasks = await this.loadTasks(projectPath);
111
+ context.tasks = tasks.map(t => t.title);
112
+ context.keywords.push(...tasks.flatMap(t => t.keywords));
113
+
114
+ // Add task priorities
115
+ tasks.forEach(task => {
116
+ context.priorities.push({
117
+ type: 'task',
118
+ name: task.title,
119
+ priority: this.calculateTaskPriority(task),
120
+ keywords: task.keywords,
121
+ filePatterns: this.generateTaskFilePatterns(task)
122
+ });
123
+ });
124
+
125
+ // Deduplicate keywords
126
+ context.keywords = [...new Set(context.keywords)];
127
+
128
+ // Sort priorities by priority score
129
+ context.priorities.sort((a, b) => b.priority - a.priority);
130
+
131
+ return context;
132
+ } catch (error) {
133
+ console.error('Error loading project context:', error);
134
+ return context;
135
+ }
136
+ }
137
+
138
+ private async loadMissions(missionsPath: string): Promise<MissionMetadata[]> {
139
+ const missions: MissionMetadata[] = [];
140
+
141
+ try {
142
+ const files = await readdir(missionsPath);
143
+
144
+ for (const file of files) {
145
+ if (['.md', '.yaml', '.yml'].includes(extname(file))) {
146
+ const filePath = join(missionsPath, file);
147
+ const mission = await this.parseMissionFile(filePath);
148
+ if (mission) {
149
+ missions.push(mission);
150
+ }
151
+ }
152
+ }
153
+ } catch (error) {
154
+ console.error('Error loading missions:', error);
155
+ }
156
+
157
+ return missions;
158
+ }
159
+
160
+ private async loadStories(storiesPath: string): Promise<StoryMetadata[]> {
161
+ const stories: StoryMetadata[] = [];
162
+
163
+ try {
164
+ const files = await readdir(storiesPath);
165
+
166
+ for (const file of files) {
167
+ if (['.md', '.yaml', '.yml'].includes(extname(file))) {
168
+ const filePath = join(storiesPath, file);
169
+ const story = await this.parseStoryFile(filePath);
170
+ if (story) {
171
+ stories.push(story);
172
+ }
173
+ }
174
+ }
175
+ } catch (error) {
176
+ console.error('Error loading stories:', error);
177
+ }
178
+
179
+ return stories;
180
+ }
181
+
182
+ private async loadTasks(projectPath: string): Promise<TaskMetadata[]> {
183
+ const tasks: TaskMetadata[] = [];
184
+
185
+ // Look for tasks in multiple locations
186
+ const taskPaths = [
187
+ join(projectPath, 'one/tasks'),
188
+ join(projectPath, 'one/stories') // Tasks might be embedded in story files
189
+ ];
190
+
191
+ for (const taskPath of taskPaths) {
192
+ if (existsSync(taskPath)) {
193
+ const pathTasks = await this.loadTasksFromPath(taskPath);
194
+ tasks.push(...pathTasks);
195
+ }
196
+ }
197
+
198
+ return tasks;
199
+ }
200
+
201
+ private async loadTasksFromPath(tasksPath: string): Promise<TaskMetadata[]> {
202
+ const tasks: TaskMetadata[] = [];
203
+
204
+ try {
205
+ const files = await readdir(tasksPath);
206
+
207
+ for (const file of files) {
208
+ if (['.md', '.yaml', '.yml'].includes(extName(file))) {
209
+ const filePath = join(tasksPath, file);
210
+ const fileTasks = await this.parseTaskFile(filePath);
211
+ tasks.push(...fileTasks);
212
+ }
213
+ }
214
+ } catch (error) {
215
+ console.error('Error loading tasks from path:', error);
216
+ }
217
+
218
+ return tasks;
219
+ }
220
+
221
+ private async parseMissionFile(filePath: string): Promise<MissionMetadata | null> {
222
+ try {
223
+ const content = await readFile(filePath, 'utf-8');
224
+ const ext = extname(filePath);
225
+
226
+ if (ext === '.md') {
227
+ return this.parseMissionMarkdown(content, filePath);
228
+ } else if (['.yaml', '.yml'].includes(ext)) {
229
+ return this.parseMissionYaml(content, filePath);
230
+ }
231
+ } catch (error) {
232
+ console.error(`Error parsing mission file ${filePath}:`, error);
233
+ }
234
+
235
+ return null;
236
+ }
237
+
238
+ private parseMissionMarkdown(content: string, filePath: string): MissionMetadata {
239
+ // Extract YAML frontmatter if present
240
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
241
+ let frontmatter: any = {};
242
+
243
+ if (frontmatterMatch) {
244
+ try {
245
+ frontmatter = yaml.parse(frontmatterMatch[1]);
246
+ } catch (error) {
247
+ console.error('Error parsing frontmatter:', error);
248
+ }
249
+ }
250
+
251
+ // Extract title from first heading or frontmatter
252
+ const titleMatch = content.match(/^#\s+(.+)$/m);
253
+ const title = frontmatter.title || (titleMatch ? titleMatch[1] : 'Untitled Mission');
254
+
255
+ // Extract description from content
256
+ const description = this.extractDescription(content);
257
+
258
+ // Generate keywords using AI
259
+ const keywords = this.aiKeywordExtractor.extractFromContent(title + ' ' + description);
260
+
261
+ return {
262
+ id: frontmatter.id || this.generateId(title),
263
+ title,
264
+ description,
265
+ status: frontmatter.status || 'active',
266
+ priority: frontmatter.priority || 5,
267
+ keywords: [...(frontmatter.keywords || []), ...keywords],
268
+ requiredComponents: frontmatter.requiredComponents || [],
269
+ requiredUtilities: frontmatter.requiredUtilities || []
270
+ };
271
+ }
272
+
273
+ private parseMissionYaml(content: string, filePath: string): MissionMetadata {
274
+ const data = yaml.parse(content);
275
+
276
+ // Generate keywords if not provided
277
+ const generatedKeywords = this.aiKeywordExtractor.extractFromContent(
278
+ (data.title || '') + ' ' + (data.description || '')
279
+ );
280
+
281
+ return {
282
+ id: data.id || this.generateId(data.title || 'untitled'),
283
+ title: data.title || 'Untitled Mission',
284
+ description: data.description || '',
285
+ status: data.status || 'active',
286
+ priority: data.priority || 5,
287
+ keywords: [...(data.keywords || []), ...generatedKeywords],
288
+ requiredComponents: data.requiredComponents || [],
289
+ requiredUtilities: data.requiredUtilities || []
290
+ };
291
+ }
292
+
293
+ private async parseStoryFile(filePath: string): Promise<StoryMetadata | null> {
294
+ try {
295
+ const content = await readFile(filePath, 'utf-8');
296
+ const ext = extname(filePath);
297
+
298
+ if (ext === '.md') {
299
+ return this.parseStoryMarkdown(content, filePath);
300
+ } else if (['.yaml', '.yml'].includes(ext)) {
301
+ return this.parseStoryYaml(content, filePath);
302
+ }
303
+ } catch (error) {
304
+ console.error(`Error parsing story file ${filePath}:`, error);
305
+ }
306
+
307
+ return null;
308
+ }
309
+
310
+ private parseStoryMarkdown(content: string, filePath: string): StoryMetadata {
311
+ // Similar to mission parsing but for story structure
312
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
313
+ let frontmatter: any = {};
314
+
315
+ if (frontmatterMatch) {
316
+ try {
317
+ frontmatter = yaml.parse(frontmatterMatch[1]);
318
+ } catch (error) {
319
+ console.error('Error parsing story frontmatter:', error);
320
+ }
321
+ }
322
+
323
+ const titleMatch = content.match(/^#\s+(.+)$/m);
324
+ const title = frontmatter.title || (titleMatch ? titleMatch[1] : 'Untitled Story');
325
+ const description = this.extractDescription(content);
326
+
327
+ const keywords = this.aiKeywordExtractor.extractFromContent(title + ' ' + description);
328
+
329
+ return {
330
+ id: frontmatter.id || this.generateId(title),
331
+ title,
332
+ mission: frontmatter.mission || '',
333
+ description,
334
+ acceptanceCriteria: frontmatter.acceptanceCriteria || this.extractAcceptanceCriteria(content),
335
+ technicalRequirements: frontmatter.technicalRequirements || this.extractTechnicalRequirements(content),
336
+ keywords: [...(frontmatter.keywords || []), ...keywords],
337
+ componentNeeds: frontmatter.componentNeeds || this.extractComponentNeeds(content)
338
+ };
339
+ }
340
+
341
+ private parseStoryYaml(content: string, filePath: string): StoryMetadata {
342
+ const data = yaml.parse(content);
343
+
344
+ const generatedKeywords = this.aiKeywordExtractor.extractFromContent(
345
+ (data.title || '') + ' ' + (data.description || '')
346
+ );
347
+
348
+ return {
349
+ id: data.id || this.generateId(data.title || 'untitled'),
350
+ title: data.title || 'Untitled Story',
351
+ mission: data.mission || '',
352
+ description: data.description || '',
353
+ acceptanceCriteria: data.acceptanceCriteria || [],
354
+ technicalRequirements: data.technicalRequirements || [],
355
+ keywords: [...(data.keywords || []), ...generatedKeywords],
356
+ componentNeeds: data.componentNeeds || []
357
+ };
358
+ }
359
+
360
+ private async parseTaskFile(filePath: string): Promise<TaskMetadata[]> {
361
+ const tasks: TaskMetadata[] = [];
362
+
363
+ try {
364
+ const content = await readFile(filePath, 'utf-8');
365
+ const ext = extname(filePath);
366
+
367
+ if (ext === '.md') {
368
+ tasks.push(...this.parseTaskMarkdown(content, filePath));
369
+ } else if (['.yaml', '.yml'].includes(ext)) {
370
+ const data = yaml.parse(content);
371
+ if (Array.isArray(data)) {
372
+ tasks.push(...data.map(taskData => this.parseTaskYaml(taskData)));
373
+ } else {
374
+ tasks.push(this.parseTaskYaml(data));
375
+ }
376
+ }
377
+ } catch (error) {
378
+ console.error(`Error parsing task file ${filePath}:`, error);
379
+ }
380
+
381
+ return tasks;
382
+ }
383
+
384
+ private parseTaskMarkdown(content: string, filePath: string): TaskMetadata[] {
385
+ const tasks: TaskMetadata[] = [];
386
+
387
+ // Look for task lists in markdown (- [ ] Task name)
388
+ const taskMatches = content.match(/^-\s+\[\s*\]\s+(.+)$/gm);
389
+
390
+ if (taskMatches) {
391
+ taskMatches.forEach(match => {
392
+ const title = match.replace(/^-\s+\[\s*\]\s+/, '');
393
+ const keywords = this.aiKeywordExtractor.extractFromContent(title);
394
+
395
+ tasks.push({
396
+ id: this.generateId(title),
397
+ title,
398
+ story: '', // Would need to be extracted from context
399
+ description: title,
400
+ type: this.inferTaskType(title),
401
+ requirements: [],
402
+ keywords
403
+ });
404
+ });
405
+ }
406
+
407
+ return tasks;
408
+ }
409
+
410
+ private parseTaskYaml(data: any): TaskMetadata {
411
+ const generatedKeywords = this.aiKeywordExtractor.extractFromContent(
412
+ (data.title || '') + ' ' + (data.description || '')
413
+ );
414
+
415
+ return {
416
+ id: data.id || this.generateId(data.title || 'untitled'),
417
+ title: data.title || 'Untitled Task',
418
+ story: data.story || '',
419
+ description: data.description || '',
420
+ type: data.type || this.inferTaskType(data.title || ''),
421
+ requirements: data.requirements || [],
422
+ keywords: [...(data.keywords || []), ...generatedKeywords]
423
+ };
424
+ }
425
+
426
+ private generateFilePatterns(keywords: string[], components: string[] = []): string[] {
427
+ const patterns: string[] = [];
428
+
429
+ // Generate patterns from keywords
430
+ keywords.forEach(keyword => {
431
+ const normalized = keyword.toLowerCase().replace(/\s+/g, '-');
432
+ patterns.push(normalized);
433
+ patterns.push(keyword.toLowerCase());
434
+ });
435
+
436
+ // Add component patterns
437
+ components.forEach(component => {
438
+ patterns.push(component);
439
+ patterns.push(component.toLowerCase());
440
+ });
441
+
442
+ return patterns;
443
+ }
444
+
445
+ private generateTaskFilePatterns(task: TaskMetadata): string[] {
446
+ const patterns = this.generateFilePatterns(task.keywords);
447
+
448
+ // Add type-specific patterns
449
+ switch (task.type) {
450
+ case 'frontend':
451
+ patterns.push('component', 'ui', 'page', 'layout');
452
+ break;
453
+ case 'backend':
454
+ patterns.push('api', 'service', 'model', 'controller');
455
+ break;
456
+ case 'design':
457
+ patterns.push('style', 'theme', 'css', 'icon');
458
+ break;
459
+ case 'testing':
460
+ patterns.push('test', 'spec', 'mock');
461
+ break;
462
+ }
463
+
464
+ return patterns;
465
+ }
466
+
467
+ private calculateTaskPriority(task: TaskMetadata): number {
468
+ // Calculate priority based on task type and keywords
469
+ let priority = 5; // Base priority
470
+
471
+ // Frontend tasks get higher priority for UI ingestion
472
+ if (task.type === 'frontend') priority += 2;
473
+ if (task.type === 'design') priority += 1;
474
+
475
+ // Urgent keywords boost priority
476
+ const urgentKeywords = ['critical', 'urgent', 'blocker', 'bug', 'fix'];
477
+ if (task.keywords.some(k => urgentKeywords.some(uk => k.toLowerCase().includes(uk)))) {
478
+ priority += 3;
479
+ }
480
+
481
+ return Math.min(priority, 10);
482
+ }
483
+
484
+ private extractDescription(content: string): string {
485
+ // Extract first paragraph after title
486
+ const lines = content.split('\n');
487
+ let descriptionStart = -1;
488
+
489
+ for (let i = 0; i < lines.length; i++) {
490
+ if (lines[i].startsWith('#') && descriptionStart === -1) {
491
+ descriptionStart = i + 1;
492
+ } else if (descriptionStart !== -1 && lines[i].trim() !== '') {
493
+ // Found first non-empty line after title
494
+ const description = [];
495
+ for (let j = i; j < lines.length && !lines[j].startsWith('#'); j++) {
496
+ if (lines[j].trim() !== '') {
497
+ description.push(lines[j]);
498
+ }
499
+ }
500
+ return description.join(' ').substring(0, 500); // Limit length
501
+ }
502
+ }
503
+
504
+ return '';
505
+ }
506
+
507
+ private extractAcceptanceCriteria(content: string): string[] {
508
+ const criteria: string[] = [];
509
+
510
+ // Look for "Acceptance Criteria" section
511
+ const match = content.match(/##?\s*Acceptance\s+Criteria[\s\S]*?(?=##|$)/i);
512
+ if (match) {
513
+ const section = match[0];
514
+ const listItems = section.match(/^[-*]\s+(.+)$/gm);
515
+ if (listItems) {
516
+ criteria.push(...listItems.map(item => item.replace(/^[-*]\s+/, '')));
517
+ }
518
+ }
519
+
520
+ return criteria;
521
+ }
522
+
523
+ private extractTechnicalRequirements(content: string): string[] {
524
+ const requirements: string[] = [];
525
+
526
+ // Look for technical requirements section
527
+ const match = content.match(/##?\s*Technical\s+Requirements[\s\S]*?(?=##|$)/i);
528
+ if (match) {
529
+ const section = match[0];
530
+ const listItems = section.match(/^[-*]\s+(.+)$/gm);
531
+ if (listItems) {
532
+ requirements.push(...listItems.map(item => item.replace(/^[-*]\s+/, '')));
533
+ }
534
+ }
535
+
536
+ return requirements;
537
+ }
538
+
539
+ private extractComponentNeeds(content: string): string[] {
540
+ const components: string[] = [];
541
+
542
+ // Look for component names in content (PascalCase words)
543
+ const componentMatches = content.match(/\b[A-Z][a-zA-Z]*Component\b/g);
544
+ if (componentMatches) {
545
+ components.push(...componentMatches);
546
+ }
547
+
548
+ // Look for common UI component names
549
+ const uiComponents = ['Button', 'Input', 'Modal', 'Card', 'Table', 'Form', 'Header', 'Footer', 'Sidebar'];
550
+ uiComponents.forEach(comp => {
551
+ if (content.includes(comp)) {
552
+ components.push(comp);
553
+ }
554
+ });
555
+
556
+ return [...new Set(components)];
557
+ }
558
+
559
+ private inferTaskType(title: string): 'frontend' | 'backend' | 'design' | 'testing' | 'deployment' {
560
+ const lower = title.toLowerCase();
561
+
562
+ if (lower.includes('test') || lower.includes('spec')) return 'testing';
563
+ if (lower.includes('deploy') || lower.includes('build') || lower.includes('ci')) return 'deployment';
564
+ if (lower.includes('style') || lower.includes('design') || lower.includes('ui')) return 'design';
565
+ if (lower.includes('api') || lower.includes('server') || lower.includes('database')) return 'backend';
566
+
567
+ return 'frontend'; // Default
568
+ }
569
+
570
+ private generateId(title: string): string {
571
+ return title.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
572
+ }
573
+ }
574
+
575
+ // Simple keyword extractor (would be replaced with actual AI in production)
576
+ class KeywordExtractor {
577
+ extractFromContent(content: string): string[] {
578
+ const keywords: string[] = [];
579
+
580
+ // Common tech keywords
581
+ const techTerms = [
582
+ 'react', 'nextjs', 'typescript', 'component', 'hook', 'api', 'database',
583
+ 'auth', 'authentication', 'dashboard', 'form', 'table', 'chart', 'modal',
584
+ 'button', 'input', 'validation', 'error', 'loading', 'state', 'context',
585
+ 'router', 'navigation', 'layout', 'theme', 'style', 'responsive', 'mobile'
586
+ ];
587
+
588
+ const words = content.toLowerCase().split(/\s+/);
589
+
590
+ techTerms.forEach(term => {
591
+ if (words.some(word => word.includes(term))) {
592
+ keywords.push(term);
593
+ }
594
+ });
595
+
596
+ // Extract PascalCase words (likely component names)
597
+ const pascalCase = content.match(/\b[A-Z][a-z]+(?:[A-Z][a-z]+)*\b/g);
598
+ if (pascalCase) {
599
+ keywords.push(...pascalCase.map(word => word.toLowerCase()));
600
+ }
601
+
602
+ return [...new Set(keywords)];
603
+ }
604
+ }