oneie 1.3.2 → 1.3.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 (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 +19 -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 +43 -12
  65. package/bin/oneie/index.js +4 -4
  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,484 @@
1
+ import { readdir, stat, readFile } from 'fs/promises';
2
+ import { join, extname, basename, dirname, relative } from 'path';
3
+ import { existsSync } from 'fs';
4
+
5
+ export interface ProjectMetadata {
6
+ path: string;
7
+ name: string;
8
+ framework: FrameworkType;
9
+ packageJson: any;
10
+ dependencies: string[];
11
+ devDependencies: string[];
12
+ files: DiscoveredFile[];
13
+ config: Record<string, any>;
14
+ }
15
+
16
+ export interface DiscoveredFile {
17
+ path: string;
18
+ relativePath: string;
19
+ type: FileType;
20
+ framework: FrameworkType | null;
21
+ size: number;
22
+ lastModified: Date;
23
+ dependencies: string[];
24
+ exports: string[];
25
+ classification: FileClassification;
26
+ missionRelevance: number; // 0-1 score
27
+ storyRelevance: number; // 0-1 score
28
+ taskRelevance: number; // 0-1 score
29
+ }
30
+
31
+ export type FrameworkType = 'nextjs' | 'astro' | 'vite' | 'tanstack-start' | 'unknown';
32
+
33
+ export type FileType =
34
+ | 'component'
35
+ | 'page'
36
+ | 'layout'
37
+ | 'hook'
38
+ | 'utility'
39
+ | 'style'
40
+ | 'config'
41
+ | 'asset'
42
+ | 'test'
43
+ | 'story'
44
+ | 'type'
45
+ | 'api'
46
+ | 'middleware';
47
+
48
+ export type FileClassification =
49
+ | 'direct-copy' // Can be copied as-is
50
+ | 'smart-modify' // Needs import/path modifications
51
+ | 'config-adapt' // Configuration that needs framework adaptation
52
+ | 'manual-review'; // Complex file requiring manual review
53
+
54
+ export class ProjectDiscovery {
55
+ private frameworkDetectors: Map<FrameworkType, (projectPath: string) => Promise<boolean>>;
56
+ private fileClassifiers: Map<string, FileType>;
57
+ private missionContext: string[] = [];
58
+ private storyContext: string[] = [];
59
+ private taskContext: string[] = [];
60
+
61
+ constructor() {
62
+ this.frameworkDetectors = new Map([
63
+ ['nextjs', this.detectNextJS],
64
+ ['astro', this.detectAstro],
65
+ ['vite', this.detectVite],
66
+ ['tanstack-start', this.detectTanStackStart]
67
+ ]);
68
+
69
+ this.fileClassifiers = new Map([
70
+ ['.tsx', 'component'],
71
+ ['.jsx', 'component'],
72
+ ['.ts', 'utility'],
73
+ ['.js', 'utility'],
74
+ ['.astro', 'component'],
75
+ ['.css', 'style'],
76
+ ['.scss', 'style'],
77
+ ['.module.css', 'style'],
78
+ ['.test.ts', 'test'],
79
+ ['.test.tsx', 'test'],
80
+ ['.spec.ts', 'test'],
81
+ ['.stories.tsx', 'story'],
82
+ ['.d.ts', 'type'],
83
+ ['.json', 'config'],
84
+ ['.md', 'asset'],
85
+ ['.png', 'asset'],
86
+ ['.jpg', 'asset'],
87
+ ['.svg', 'asset']
88
+ ]);
89
+ }
90
+
91
+ async scanDirectory(sourcePath: string): Promise<ProjectMetadata[]> {
92
+ const projects: ProjectMetadata[] = [];
93
+
94
+ try {
95
+ const entries = await readdir(sourcePath, { withFileTypes: true });
96
+
97
+ for (const entry of entries) {
98
+ if (entry.isDirectory()) {
99
+ const projectPath = join(sourcePath, entry.name);
100
+
101
+ // Check if this is a project directory
102
+ if (await this.isProjectDirectory(projectPath)) {
103
+ const metadata = await this.analyzeProject(projectPath);
104
+ projects.push(metadata);
105
+ }
106
+
107
+ // Recursively scan subdirectories
108
+ const subProjects = await this.scanDirectory(projectPath);
109
+ projects.push(...subProjects);
110
+ }
111
+ }
112
+ } catch (error) {
113
+ console.error(`Error scanning directory ${sourcePath}:`, error);
114
+ }
115
+
116
+ return projects;
117
+ }
118
+
119
+ private async isProjectDirectory(projectPath: string): Promise<boolean> {
120
+ // Check for package.json
121
+ const packageJsonPath = join(projectPath, 'package.json');
122
+ if (!existsSync(packageJsonPath)) {
123
+ return false;
124
+ }
125
+
126
+ try {
127
+ const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
128
+
129
+ // Must have React or TypeScript dependencies
130
+ const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
131
+ return deps.react || deps.typescript || deps['@types/react'];
132
+ } catch {
133
+ return false;
134
+ }
135
+ }
136
+
137
+ private async analyzeProject(projectPath: string): Promise<ProjectMetadata> {
138
+ const packageJsonPath = join(projectPath, 'package.json');
139
+ const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
140
+
141
+ const framework = await this.detectFramework(projectPath);
142
+ const files = await this.discoverFiles(projectPath, framework);
143
+ const config = await this.loadProjectConfig(projectPath, framework);
144
+
145
+ return {
146
+ path: projectPath,
147
+ name: packageJson.name || basename(projectPath),
148
+ framework,
149
+ packageJson,
150
+ dependencies: Object.keys(packageJson.dependencies || {}),
151
+ devDependencies: Object.keys(packageJson.devDependencies || {}),
152
+ files,
153
+ config
154
+ };
155
+ }
156
+
157
+ private async detectFramework(projectPath: string): Promise<FrameworkType> {
158
+ for (const [framework, detector] of this.frameworkDetectors) {
159
+ if (await detector.call(this, projectPath)) {
160
+ return framework;
161
+ }
162
+ }
163
+ return 'unknown';
164
+ }
165
+
166
+ private async detectNextJS(projectPath: string): Promise<boolean> {
167
+ const configs = ['next.config.js', 'next.config.ts', 'next.config.mjs'];
168
+ return configs.some(config => existsSync(join(projectPath, config))) ||
169
+ existsSync(join(projectPath, 'app')) ||
170
+ existsSync(join(projectPath, 'pages'));
171
+ }
172
+
173
+ private async detectAstro(projectPath: string): Promise<boolean> {
174
+ const configs = ['astro.config.mjs', 'astro.config.ts'];
175
+ return configs.some(config => existsSync(join(projectPath, config)));
176
+ }
177
+
178
+ private async detectVite(projectPath: string): Promise<boolean> {
179
+ const configs = ['vite.config.js', 'vite.config.ts'];
180
+ return configs.some(config => existsSync(join(projectPath, config)));
181
+ }
182
+
183
+ private async detectTanStackStart(projectPath: string): Promise<boolean> {
184
+ const configs = ['app.config.ts', 'vite.config.ts'];
185
+ const hasConfigs = configs.some(config => existsSync(join(projectPath, config)));
186
+
187
+ if (!hasConfigs) return false;
188
+
189
+ try {
190
+ const packageJson = JSON.parse(await readFile(join(projectPath, 'package.json'), 'utf-8'));
191
+ return packageJson.dependencies?.['@tanstack/start'] ||
192
+ packageJson.devDependencies?.['@tanstack/start'];
193
+ } catch {
194
+ return false;
195
+ }
196
+ }
197
+
198
+ private async discoverFiles(projectPath: string, framework: FrameworkType): Promise<DiscoveredFile[]> {
199
+ const files: DiscoveredFile[] = [];
200
+ const ignoredDirs = ['node_modules', '.git', '.next', 'dist', 'build', '.astro'];
201
+
202
+ const scanDir = async (dirPath: string): Promise<void> => {
203
+ try {
204
+ const entries = await readdir(dirPath, { withFileTypes: true });
205
+
206
+ for (const entry of entries) {
207
+ if (ignoredDirs.includes(entry.name)) continue;
208
+
209
+ const fullPath = join(dirPath, entry.name);
210
+
211
+ if (entry.isDirectory()) {
212
+ await scanDir(fullPath);
213
+ } else if (entry.isFile()) {
214
+ const file = await this.analyzeFile(fullPath, projectPath, framework);
215
+ if (file) {
216
+ files.push(file);
217
+ }
218
+ }
219
+ }
220
+ } catch (error) {
221
+ console.error(`Error scanning ${dirPath}:`, error);
222
+ }
223
+ };
224
+
225
+ await scanDir(projectPath);
226
+ return files;
227
+ }
228
+
229
+ private async analyzeFile(filePath: string, projectPath: string, framework: FrameworkType): Promise<DiscoveredFile | null> {
230
+ try {
231
+ const stats = await stat(filePath);
232
+ const ext = extname(filePath);
233
+ const relativePath = relative(projectPath, filePath);
234
+
235
+ // Skip very large files (>1MB)
236
+ if (stats.size > 1024 * 1024) return null;
237
+
238
+ const fileType = this.classifyFileType(filePath, relativePath, framework);
239
+ const classification = this.classifyForProcessing(filePath, fileType, framework);
240
+
241
+ let content = '';
242
+ let dependencies: string[] = [];
243
+ let exports: string[] = [];
244
+
245
+ // Analyze code files for dependencies and exports
246
+ if (['.ts', '.tsx', '.js', '.jsx', '.astro'].includes(ext)) {
247
+ try {
248
+ content = await readFile(filePath, 'utf-8');
249
+ dependencies = this.extractDependencies(content);
250
+ exports = this.extractExports(content);
251
+ } catch (error) {
252
+ console.error(`Error reading file ${filePath}:`, error);
253
+ }
254
+ }
255
+
256
+ return {
257
+ path: filePath,
258
+ relativePath,
259
+ type: fileType,
260
+ framework: this.detectFileFramework(content, filePath, framework),
261
+ size: stats.size,
262
+ lastModified: stats.mtime,
263
+ dependencies,
264
+ exports,
265
+ classification,
266
+ missionRelevance: await this.calculateMissionRelevance(filePath, content, exports),
267
+ storyRelevance: await this.calculateStoryRelevance(filePath, content, exports),
268
+ taskRelevance: await this.calculateTaskRelevance(filePath, content, exports)
269
+ };
270
+ } catch (error) {
271
+ console.error(`Error analyzing file ${filePath}:`, error);
272
+ return null;
273
+ }
274
+ }
275
+
276
+ private classifyFileType(filePath: string, relativePath: string, framework: FrameworkType): FileType {
277
+ const ext = extname(filePath);
278
+ const fileName = basename(filePath);
279
+ const dirPath = dirname(relativePath);
280
+
281
+ // Framework-specific classifications
282
+ if (framework === 'nextjs') {
283
+ if (relativePath.startsWith('app/') && fileName === 'page.tsx') return 'page';
284
+ if (relativePath.startsWith('app/') && fileName === 'layout.tsx') return 'layout';
285
+ if (relativePath.startsWith('pages/')) return 'page';
286
+ if (relativePath.startsWith('pages/api/')) return 'api';
287
+ if (fileName === 'middleware.ts') return 'middleware';
288
+ }
289
+
290
+ if (framework === 'astro') {
291
+ if (ext === '.astro') return 'page';
292
+ if (relativePath.startsWith('src/pages/')) return 'page';
293
+ if (relativePath.startsWith('src/layouts/')) return 'layout';
294
+ }
295
+
296
+ // Component detection
297
+ if (['.tsx', '.jsx'].includes(ext)) {
298
+ if (fileName.startsWith('use') && fileName.endsWith('.ts')) return 'hook';
299
+ if (dirPath.includes('component') || fileName.match(/^[A-Z]/)) return 'component';
300
+ }
301
+
302
+ // File extension based classification
303
+ return this.fileClassifiers.get(ext) || 'utility';
304
+ }
305
+
306
+ private classifyForProcessing(filePath: string, fileType: FileType, framework: FrameworkType): FileClassification {
307
+ const ext = extname(filePath);
308
+
309
+ // Direct copy files (no modification needed)
310
+ const directCopyExts = ['.png', '.jpg', '.jpeg', '.svg', '.ico', '.woff', '.woff2', '.ttf'];
311
+ const directCopyFiles = ['.env.example', 'README.md', 'LICENSE'];
312
+
313
+ if (directCopyExts.includes(ext) || directCopyFiles.includes(basename(filePath))) {
314
+ return 'direct-copy';
315
+ }
316
+
317
+ // Configuration files need framework adaptation
318
+ const configFiles = ['package.json', 'tsconfig.json', 'tailwind.config.', 'eslint.config.', 'next.config.', 'astro.config.', 'vite.config.'];
319
+ if (configFiles.some(config => basename(filePath).startsWith(config))) {
320
+ return 'config-adapt';
321
+ }
322
+
323
+ // Code files need smart modification
324
+ const codeExts = ['.ts', '.tsx', '.js', '.jsx', '.astro', '.vue', '.svelte'];
325
+ if (codeExts.includes(ext)) {
326
+ return 'smart-modify';
327
+ }
328
+
329
+ // CSS and other style files
330
+ if (['.css', '.scss', '.sass'].includes(ext)) {
331
+ // CSS modules and component styles might need path updates
332
+ if (filePath.includes('.module.') || filePath.includes('component')) {
333
+ return 'smart-modify';
334
+ }
335
+ return 'direct-copy';
336
+ }
337
+
338
+ return 'manual-review';
339
+ }
340
+
341
+ private detectFileFramework(content: string, filePath: string, projectFramework: FrameworkType): FrameworkType | null {
342
+ if (content.includes('next/')) return 'nextjs';
343
+ if (content.includes('astro:') || extname(filePath) === '.astro') return 'astro';
344
+ if (content.includes('@tanstack/start')) return 'tanstack-start';
345
+ if (content.includes('import.meta.hot') || content.includes('vite')) return 'vite';
346
+
347
+ return projectFramework !== 'unknown' ? projectFramework : null;
348
+ }
349
+
350
+ private extractDependencies(content: string): string[] {
351
+ const imports: string[] = [];
352
+
353
+ // Extract ES6 imports
354
+ const importRegex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
355
+ let match;
356
+ while ((match = importRegex.exec(content)) !== null) {
357
+ imports.push(match[1]);
358
+ }
359
+
360
+ // Extract dynamic imports
361
+ const dynamicImportRegex = /import\(['"]([^'"]+)['"]\)/g;
362
+ while ((match = dynamicImportRegex.exec(content)) !== null) {
363
+ imports.push(match[1]);
364
+ }
365
+
366
+ // Extract require statements
367
+ const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
368
+ while ((match = requireRegex.exec(content)) !== null) {
369
+ imports.push(match[1]);
370
+ }
371
+
372
+ return imports;
373
+ }
374
+
375
+ private extractExports(content: string): string[] {
376
+ const exports: string[] = [];
377
+
378
+ // Extract named exports
379
+ const namedExportRegex = /export\s+(?:const|let|var|function|class|interface|type)\s+(\w+)/g;
380
+ let match;
381
+ while ((match = namedExportRegex.exec(content)) !== null) {
382
+ exports.push(match[1]);
383
+ }
384
+
385
+ // Extract default exports
386
+ const defaultExportRegex = /export\s+default\s+(?:function\s+)?(\w+)|export\s*\{\s*(\w+)\s+as\s+default\s*\}/g;
387
+ while ((match = defaultExportRegex.exec(content)) !== null) {
388
+ exports.push(match[1] || match[2]);
389
+ }
390
+
391
+ return exports;
392
+ }
393
+
394
+ private async calculateMissionRelevance(filePath: string, content: string, exports: string[]): Promise<number> {
395
+ // Implement AI-based relevance scoring based on current missions
396
+ // For now, use simple keyword matching
397
+ let score = 0;
398
+
399
+ for (const keyword of this.missionContext) {
400
+ if (content.toLowerCase().includes(keyword.toLowerCase())) {
401
+ score += 0.2;
402
+ }
403
+ if (exports.some(exp => exp.toLowerCase().includes(keyword.toLowerCase()))) {
404
+ score += 0.3;
405
+ }
406
+ }
407
+
408
+ return Math.min(score, 1.0);
409
+ }
410
+
411
+ private async calculateStoryRelevance(filePath: string, content: string, exports: string[]): Promise<number> {
412
+ // Implement story context matching
413
+ let score = 0;
414
+
415
+ for (const keyword of this.storyContext) {
416
+ if (content.toLowerCase().includes(keyword.toLowerCase())) {
417
+ score += 0.2;
418
+ }
419
+ }
420
+
421
+ return Math.min(score, 1.0);
422
+ }
423
+
424
+ private async calculateTaskRelevance(filePath: string, content: string, exports: string[]): Promise<number> {
425
+ // Implement task context matching
426
+ let score = 0;
427
+
428
+ for (const keyword of this.taskContext) {
429
+ if (content.toLowerCase().includes(keyword.toLowerCase())) {
430
+ score += 0.2;
431
+ }
432
+ }
433
+
434
+ return Math.min(score, 1.0);
435
+ }
436
+
437
+ private async loadProjectConfig(projectPath: string, framework: FrameworkType): Promise<Record<string, any>> {
438
+ const config: Record<string, any> = {};
439
+
440
+ const configFiles = {
441
+ 'package.json': 'package.json',
442
+ 'tsconfig.json': 'tsconfig.json',
443
+ 'tailwind.config.js': 'tailwind.config.js',
444
+ 'tailwind.config.ts': 'tailwind.config.ts',
445
+ 'next.config.js': 'next.config.js',
446
+ 'next.config.ts': 'next.config.ts',
447
+ 'astro.config.mjs': 'astro.config.mjs',
448
+ 'astro.config.ts': 'astro.config.ts',
449
+ 'vite.config.js': 'vite.config.js',
450
+ 'vite.config.ts': 'vite.config.ts'
451
+ };
452
+
453
+ for (const [key, fileName] of Object.entries(configFiles)) {
454
+ const filePath = join(projectPath, fileName);
455
+ if (existsSync(filePath)) {
456
+ try {
457
+ if (fileName.endsWith('.json')) {
458
+ config[key] = JSON.parse(await readFile(filePath, 'utf-8'));
459
+ } else {
460
+ // For JS/TS config files, we'll store the raw content
461
+ config[key] = await readFile(filePath, 'utf-8');
462
+ }
463
+ } catch (error) {
464
+ console.error(`Error loading config ${fileName}:`, error);
465
+ }
466
+ }
467
+ }
468
+
469
+ return config;
470
+ }
471
+
472
+ // Public methods to set context for relevance scoring
473
+ setMissionContext(missions: string[]): void {
474
+ this.missionContext = missions;
475
+ }
476
+
477
+ setStoryContext(stories: string[]): void {
478
+ this.storyContext = stories;
479
+ }
480
+
481
+ setTaskContext(tasks: string[]): void {
482
+ this.taskContext = tasks;
483
+ }
484
+ }