oneie 3.5.0 → 3.6.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 (132) hide show
  1. package/.claude/agents/agent-director.md +902 -22
  2. package/.claude/agents/agent-onboard-example-output.md +600 -0
  3. package/.claude/agents/agent-onboard.md +576 -0
  4. package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
  5. package/.claude/commands/one.md +375 -5
  6. package/.claude/commands/release.md +64 -3
  7. package/CLAUDE.md +55 -69
  8. package/dist/commands/init.d.ts +5 -6
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +101 -101
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/index.js +6 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/utils/installation-setup.d.ts +24 -1
  15. package/dist/utils/installation-setup.d.ts.map +1 -1
  16. package/dist/utils/installation-setup.js +85 -1
  17. package/dist/utils/installation-setup.js.map +1 -1
  18. package/dist/utils/launch-claude.d.ts +6 -0
  19. package/dist/utils/launch-claude.d.ts.map +1 -0
  20. package/dist/utils/launch-claude.js +51 -0
  21. package/dist/utils/launch-claude.js.map +1 -0
  22. package/dist/utils/validation.d.ts +48 -0
  23. package/dist/utils/validation.d.ts.map +1 -0
  24. package/dist/utils/validation.js +73 -0
  25. package/dist/utils/validation.js.map +1 -0
  26. package/folders.yaml +1 -1
  27. package/one/.obsidian/core-plugins.json +33 -0
  28. package/one/.obsidian/workspace.json +20 -20
  29. package/one/connections/workflow-onboarding.md +683 -0
  30. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
  31. package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
  32. package/one/events/DEPLOYMENT.md +178 -0
  33. package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
  34. package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
  35. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
  36. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
  37. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
  38. package/one/events/HANDOFF.md +313 -0
  39. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
  40. package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
  41. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
  42. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
  43. package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
  44. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
  45. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
  46. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
  47. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
  48. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
  49. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
  50. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
  51. package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
  52. package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
  53. package/one/events/SHOP-BUILD-STATUS.md +114 -0
  54. package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
  55. package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
  56. package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
  57. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
  58. package/one/events/agent-director-enhancement-summary.md +386 -0
  59. package/one/events/agent-onboard-implementation-summary.md +457 -0
  60. package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
  61. package/one/events/landing-page-generator.md +458 -0
  62. package/one/events/onboarding-implementation-complete.md +505 -0
  63. package/one/events/release.md +254 -0
  64. package/one/events/separate-implementation-status.md +537 -0
  65. package/one/knowledge/100-inference-quick-reference.md +431 -0
  66. package/one/knowledge/agent-onboard-usage.md +612 -0
  67. package/one/knowledge/cli-claude-handoff.md +718 -0
  68. package/one/knowledge/ontology-blog.yaml +31 -0
  69. package/one/knowledge/ontology-cheatsheet.md +591 -0
  70. package/one/knowledge/ontology-community.yaml +42 -0
  71. package/one/knowledge/ontology-core-universal.md +722 -0
  72. package/one/knowledge/ontology-core.yaml +50 -0
  73. package/one/knowledge/ontology-courses.yaml +53 -0
  74. package/one/knowledge/ontology-creator.md +376 -0
  75. package/one/knowledge/ontology-developer-guide.md +789 -0
  76. package/one/knowledge/ontology-education.md +920 -0
  77. package/one/knowledge/ontology-index.md +354 -0
  78. package/one/knowledge/ontology-migration-guide.md +811 -0
  79. package/one/knowledge/ontology-minimal.yaml +1 -1
  80. package/one/knowledge/ontology-portfolio.yaml +31 -0
  81. package/one/knowledge/ontology-quickstart.md +576 -0
  82. package/one/knowledge/ontology-shop.yaml +121 -0
  83. package/one/knowledge/ontology-tokens.yaml +32 -0
  84. package/one/knowledge/ontology-tutorial.md +434 -0
  85. package/one/knowledge/ontology-video-script.md +890 -0
  86. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
  87. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
  88. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
  89. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
  90. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
  91. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
  92. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
  93. package/one/things/docs/ecommerce/QUICK-START.md +368 -0
  94. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
  95. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
  96. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
  97. package/one/things/docs/ecommerce/demo.astro +309 -0
  98. package/one/things/plans/agent-director-100-inference-plans.md +410 -0
  99. package/one/things/plans/dual-website-strategy.md +612 -0
  100. package/one/things/plans/feature-based-sites.md +821 -0
  101. package/one/things/plans/multi-ontology-architecture.md +836 -0
  102. package/one/things/plans/onboarding.md +32 -0
  103. package/one/things/plans/separate.md +15 -17
  104. package/one/things/plans/start-new.md +738 -0
  105. package/package.json +2 -2
  106. package/one/things/claude/hooks/agent-hook-manager.js +0 -525
  107. package/one/things/claude/hooks/agent-load-balancer.js +0 -271
  108. package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
  109. package/one/things/claude/hooks/cascade-feedback.js +0 -297
  110. package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
  111. package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
  112. package/one/things/claude/hooks/file-organization-engine.js +0 -427
  113. package/one/things/claude/hooks/file-organization-monitor.js +0 -269
  114. package/one/things/claude/hooks/hook-config-manager.js +0 -202
  115. package/one/things/claude/hooks/hook-orchestrator.js +0 -662
  116. package/one/things/claude/hooks/hook-performance-report.js +0 -120
  117. package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
  118. package/one/things/claude/hooks/memory-optimizer.js +0 -510
  119. package/one/things/claude/hooks/ontology-compliance.js +0 -394
  120. package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
  121. package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
  122. package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
  123. package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
  124. package/one/things/claude/hooks/simple-load-balancer.js +0 -238
  125. package/one/things/claude/hooks/startup-optimizer.js +0 -625
  126. package/one/things/claude/hooks/story-scoring-system.js +0 -445
  127. package/one/things/claude/hooks/story-validation-engine.js +0 -473
  128. package/one/things/claude/hooks/structure-synchronizer.js +0 -194
  129. package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
  130. package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
  131. package/one/things/claude/hooks/trinity-validation-system.js +0 -392
  132. package/one/things/plans/organizations-to-groups.md +0 -705
@@ -1,427 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import fs from 'fs';
4
- import path from 'path';
5
- import { fileURLToPath } from 'url';
6
- import { OntologyValidator } from './ontology-validation-engine.js';
7
-
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
10
-
11
- class FileOrganizer {
12
- constructor(ontologyPath) {
13
- this.ontologyPath = ontologyPath;
14
- this.validator = new OntologyValidator(ontologyPath);
15
- this.organizationRules = this.extractOrganizationRules();
16
- this.ontologyFeedbackLog = path.join(__dirname, '../../.claude/ontology-feedback.log');
17
- }
18
-
19
- extractOrganizationRules() {
20
- return {
21
- // File type to directory mapping
22
- agents: 'one/agents/',
23
- teams: 'one/agent-teams/',
24
- workflows: 'one/workflows/',
25
- templates: 'one/templates/',
26
- stories: 'one/stories/',
27
- tasks: 'one/tasks/',
28
- checklists: 'one/checklists/',
29
- data: 'one/data/',
30
- missions: 'one/missions/',
31
- guides: 'one/guides/',
32
- tools: 'one/tools/',
33
- tests: 'one/tests/',
34
- playbooks: 'one/playbooks/',
35
- archive: 'one/archive/',
36
- assets: 'one/assets/',
37
-
38
- // File patterns to type mapping
39
- patterns: {
40
- '**/*-agent.md': 'agents',
41
- '**/team-*.yaml': 'teams',
42
- '**/*-workflow.yaml': 'workflows',
43
- '**/*-tmpl.yaml': 'templates',
44
- '**/story-*.md': 'stories',
45
- '**/task-*.md': 'tasks',
46
- '**/*-checklist.md': 'checklists',
47
- '**/mission-*.md': 'missions',
48
- '**/*.py': 'tools',
49
- '**/*.js': 'tools',
50
- '**/*.sh': 'tools',
51
- '**/README-*.md': 'guides',
52
- '**/*-guide.md': 'guides',
53
- '**/*.test.js': 'tests',
54
- '**/test-*.js': 'tests',
55
- '**/*-playbook.md': 'playbooks',
56
- '**/*-playbook.html': 'playbooks',
57
- '**/bull-character-*.md': 'playbooks',
58
- '**/bull-character-*.pdf': 'playbooks',
59
- '**/bullstamp-*.html': 'playbooks',
60
- '**/Updates.md': 'archive',
61
- '**/Updates.pdf': 'archive',
62
- '**/*.png': 'assets',
63
- '**/*.jpg': 'assets',
64
- '**/*.jpeg': 'assets',
65
- '**/*.gif': 'assets',
66
- '**/*.svg': 'assets'
67
- }
68
- };
69
- }
70
-
71
- analyzeFile(filePath) {
72
- const fileName = path.basename(filePath);
73
- const fileExt = path.extname(filePath);
74
- const content = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';
75
-
76
- // Determine file type based on patterns and content
77
- let suggestedType = 'unknown';
78
-
79
- // Check filename patterns
80
- for (const [pattern, type] of Object.entries(this.organizationRules.patterns)) {
81
- if (this.matchesPattern(fileName, pattern)) {
82
- suggestedType = type;
83
- break;
84
- }
85
- }
86
-
87
- // Content-based analysis for better accuracy
88
- if (suggestedType === 'unknown' && fileExt === '.md') {
89
- if (content.includes('persona:') && content.includes('role:')) {
90
- suggestedType = 'agents';
91
- } else if (content.includes('## Story') && content.includes('## Acceptance Criteria')) {
92
- suggestedType = 'stories';
93
- } else if (content.includes('## Mission') || content.includes('# Mission')) {
94
- suggestedType = 'missions';
95
- } else if (content.includes('checklist') || content.includes('validation')) {
96
- suggestedType = 'checklists';
97
- } else if (content.includes('# Task') || content.includes('## Task')) {
98
- suggestedType = 'tasks';
99
- } else if (content.includes('guide') || content.includes('documentation')) {
100
- suggestedType = 'guides';
101
- }
102
- }
103
-
104
- if (suggestedType === 'unknown' && fileExt === '.yaml') {
105
- if (content.includes('agents:') && content.includes('team')) {
106
- suggestedType = 'teams';
107
- } else if (content.includes('workflow') || content.includes('phases:')) {
108
- suggestedType = 'workflows';
109
- } else if (fileName.includes('tmpl') || content.includes('template')) {
110
- suggestedType = 'templates';
111
- }
112
- }
113
-
114
- return {
115
- type: suggestedType,
116
- currentLocation: filePath,
117
- suggestedLocation: suggestedType !== 'unknown' ?
118
- path.join(this.organizationRules[suggestedType], fileName) : null,
119
- confidence: this.calculateConfidence(fileName, content, suggestedType)
120
- };
121
- }
122
-
123
- matchesPattern(fileName, pattern) {
124
- // Simple pattern matching - convert glob-like patterns to regex
125
- const regexPattern = pattern
126
- .replace(/\*\*/g, '.*')
127
- .replace(/\*/g, '[^/]*')
128
- .replace(/\?/g, '[^/]');
129
-
130
- const regex = new RegExp(`^${regexPattern}$`);
131
- return regex.test(fileName);
132
- }
133
-
134
- calculateConfidence(fileName, content, suggestedType) {
135
- let confidence = 0;
136
-
137
- // Filename pattern match
138
- if (suggestedType !== 'unknown') confidence += 40;
139
-
140
- // Content analysis
141
- if (content.length > 100) confidence += 20;
142
-
143
- // Specific content markers
144
- const typeMarkers = {
145
- agents: ['persona:', 'role:', 'whenToUse:'],
146
- stories: ['## Story', '## Acceptance Criteria', '## Tasks'],
147
- missions: ['## Mission', 'objective:', 'goal:'],
148
- workflows: ['phases:', 'steps:', 'workflow'],
149
- templates: ['template', 'placeholder', '{{'],
150
- checklists: ['checklist', '- [ ]', 'validation']
151
- };
152
-
153
- const markers = typeMarkers[suggestedType] || [];
154
- const markerMatches = markers.filter(marker => content.includes(marker)).length;
155
- confidence += (markerMatches / markers.length) * 40;
156
-
157
- return Math.min(100, confidence);
158
- }
159
-
160
- logOntologyFeedback(feedback) {
161
- const timestamp = new Date().toISOString();
162
- const logEntry = `[${timestamp}] ${feedback}\n`;
163
- fs.appendFileSync(this.ontologyFeedbackLog, logEntry);
164
- }
165
-
166
- analyzeOntologyGaps(filePath, analysis) {
167
- const gaps = [];
168
-
169
- // Check if this represents a new pattern not covered by ontology
170
- if (analysis.confidence < 60 && analysis.type === 'unknown') {
171
- gaps.push({
172
- type: 'missing_pattern',
173
- file: filePath,
174
- suggestion: `Consider adding pattern for files like ${path.basename(filePath)} to ontology`,
175
- priority: 'medium'
176
- });
177
- }
178
-
179
- // Check for new file types
180
- const fileExt = path.extname(filePath);
181
- const supportedExts = ['.md', '.yaml', '.js', '.py', '.sh', '.html', '.pdf', '.png', '.jpg'];
182
- if (!supportedExts.includes(fileExt) && fileExt) {
183
- gaps.push({
184
- type: 'new_file_type',
185
- file: filePath,
186
- extension: fileExt,
187
- suggestion: `Consider adding support for ${fileExt} files to ontology`,
188
- priority: 'low'
189
- });
190
- }
191
-
192
- // Check for naming convention evolution
193
- const fileName = path.basename(filePath);
194
- if (analysis.type !== 'unknown' && analysis.confidence < 80) {
195
- gaps.push({
196
- type: 'naming_evolution',
197
- file: filePath,
198
- suggestion: `Naming pattern for ${fileName} might need refinement in ontology`,
199
- priority: 'low'
200
- });
201
- }
202
-
203
- return gaps;
204
- }
205
-
206
- suggestOntologyImprovements(analysis, gaps) {
207
- const improvements = [];
208
-
209
- // Suggest new directory structures
210
- if (gaps.some(g => g.type === 'missing_pattern')) {
211
- improvements.push({
212
- category: 'directory_structure',
213
- suggestion: 'Consider adding new directory categories to accommodate emerging file patterns',
214
- example: `one/${analysis.type || 'new-category'}/`,
215
- impact: 'medium'
216
- });
217
- }
218
-
219
- // Suggest naming convention updates
220
- if (gaps.some(g => g.type === 'naming_evolution')) {
221
- improvements.push({
222
- category: 'naming_conventions',
223
- suggestion: 'Naming patterns may need updates to handle new file variations',
224
- example: 'Update regex patterns in ontology.md',
225
- impact: 'low'
226
- });
227
- }
228
-
229
- // Suggest new file type support
230
- const newTypes = gaps.filter(g => g.type === 'new_file_type');
231
- if (newTypes.length > 0) {
232
- improvements.push({
233
- category: 'file_type_support',
234
- suggestion: `Add support for new file types: ${newTypes.map(t => t.extension).join(', ')}`,
235
- example: 'Update file pattern mappings in ontology',
236
- impact: 'low'
237
- });
238
- }
239
-
240
- return improvements;
241
- }
242
-
243
- generateOntologyReport(filePath, analysis, gaps, improvements) {
244
- const report = {
245
- timestamp: new Date().toISOString(),
246
- file: filePath,
247
- analysis,
248
- ontology_health: {
249
- coverage: analysis.confidence,
250
- gaps: gaps.length,
251
- improvements_suggested: improvements.length
252
- },
253
- gaps,
254
- improvements,
255
- ontology_status: this.assessOntologyStatus(analysis.confidence, gaps.length)
256
- };
257
-
258
- // Log feedback for ontology development
259
- this.logOntologyFeedback(`ONTOLOGY_REPORT: ${JSON.stringify(report, null, 2)}`);
260
-
261
- return report;
262
- }
263
-
264
- assessOntologyStatus(confidence, gapCount) {
265
- if (confidence >= 90 && gapCount === 0) return 'excellent';
266
- if (confidence >= 80 && gapCount <= 1) return 'good';
267
- if (confidence >= 60 && gapCount <= 3) return 'adequate';
268
- return 'needs_attention';
269
- }
270
-
271
- async organizeFile(filePath, operation = 'close', autoMove = true) {
272
- if (!fs.existsSync(filePath)) {
273
- return {
274
- success: false,
275
- reason: 'file_not_found',
276
- message: `File does not exist: ${filePath}`
277
- };
278
- }
279
-
280
- const analysis = this.analyzeFile(filePath);
281
-
282
- // Generate ontology development feedback
283
- const gaps = this.analyzeOntologyGaps(filePath, analysis);
284
- const improvements = this.suggestOntologyImprovements(analysis, gaps);
285
- const ontologyReport = this.generateOntologyReport(filePath, analysis, gaps, improvements);
286
-
287
- // Skip if already in correct location
288
- if (analysis.currentLocation.startsWith('one/') || analysis.currentLocation.startsWith('.one/')) {
289
- return {
290
- success: true,
291
- reason: 'already_organized',
292
- message: `File already in correct location: ${filePath}`,
293
- analysis,
294
- ontologyReport
295
- };
296
- }
297
-
298
- // Skip if confidence is too low
299
- if (analysis.confidence < 60) {
300
- return {
301
- success: true,
302
- reason: 'low_confidence',
303
- message: `Confidence too low (${analysis.confidence}%) to auto-organize: ${filePath}`,
304
- analysis,
305
- ontologyReport,
306
- suggestion: `Consider manually moving to: ${analysis.suggestedLocation || 'appropriate directory'}`
307
- };
308
- }
309
-
310
- // Auto-move if enabled and high confidence
311
- if (autoMove && analysis.suggestedLocation && analysis.confidence >= 80) {
312
- try {
313
- const targetPath = analysis.suggestedLocation;
314
- const targetDir = path.dirname(targetPath);
315
-
316
- // Ensure target directory exists
317
- if (!fs.existsSync(targetDir)) {
318
- fs.mkdirSync(targetDir, { recursive: true });
319
- }
320
-
321
- // Move the file
322
- fs.renameSync(filePath, targetPath);
323
-
324
- return {
325
- success: true,
326
- reason: 'auto_organized',
327
- message: `File automatically moved: ${filePath} → ${targetPath}`,
328
- analysis,
329
- ontologyReport,
330
- oldPath: filePath,
331
- newPath: targetPath
332
- };
333
- } catch (error) {
334
- return {
335
- success: false,
336
- reason: 'move_failed',
337
- message: `Failed to move file: ${error.message}`,
338
- analysis,
339
- ontologyReport
340
- };
341
- }
342
- }
343
-
344
- // High confidence but not auto-moving (operation is 'open')
345
- if (analysis.suggestedLocation && analysis.confidence >= 70) {
346
- return {
347
- success: true,
348
- reason: 'suggestion_only',
349
- message: `File should be organized. Suggested location: ${analysis.suggestedLocation}`,
350
- analysis,
351
- ontologyReport,
352
- suggestion: `Move ${filePath} to ${analysis.suggestedLocation}`
353
- };
354
- }
355
-
356
- return {
357
- success: true,
358
- reason: 'no_action',
359
- message: `No organization action needed for: ${filePath}`,
360
- analysis,
361
- ontologyReport
362
- };
363
- }
364
- }
365
-
366
- // Main execution
367
- async function main() {
368
- const filePath = process.argv[2];
369
- const operation = process.argv.find(arg => arg.startsWith('--operation='))?.split('=')[1] || 'close';
370
- const autoMove = operation === 'close'; // Only auto-move on file close
371
-
372
- if (!filePath) {
373
- console.error('Usage: node file-organization-engine.js <file-path> [--operation=open|close]');
374
- process.exit(1);
375
- }
376
-
377
- try {
378
- const ontologyPath = path.join(__dirname, '../../one/ontology.md');
379
- const organizer = new FileOrganizer(ontologyPath);
380
- const result = await organizer.organizeFile(filePath, operation, autoMove);
381
-
382
- if (result.success) {
383
- console.log(result.message);
384
- if (result.suggestion) {
385
- console.log(`šŸ’” Suggestion: ${result.suggestion}`);
386
- }
387
-
388
- // Display ontology feedback
389
- if (result.ontologyReport) {
390
- const report = result.ontologyReport;
391
- console.log(`🧠 Ontology Status: ${report.ontology_status} (Coverage: ${report.ontology_health.coverage}%)`);
392
-
393
- if (report.gaps.length > 0) {
394
- console.log(`šŸ“‹ Ontology Gaps Found (${report.gaps.length}):`);
395
- report.gaps.forEach(gap => {
396
- console.log(` • ${gap.suggestion} [${gap.priority}]`);
397
- });
398
- }
399
-
400
- if (report.improvements.length > 0) {
401
- console.log(`šŸš€ Ontology Improvements Suggested (${report.improvements.length}):`);
402
- report.improvements.forEach(imp => {
403
- console.log(` • ${imp.suggestion} [${imp.impact} impact]`);
404
- });
405
- }
406
- }
407
-
408
- // Exit code 2 indicates file was moved
409
- process.exit(result.reason === 'auto_organized' ? 2 : 0);
410
- } else {
411
- console.error(result.message);
412
- if (result.ontologyReport) {
413
- console.log(`🧠 Ontology feedback logged for analysis`);
414
- }
415
- process.exit(1);
416
- }
417
- } catch (error) {
418
- console.error(`Error organizing ${filePath}:`, error.message);
419
- process.exit(1);
420
- }
421
- }
422
-
423
- if (import.meta.url === `file://${process.argv[1]}`) {
424
- main();
425
- }
426
-
427
- export { FileOrganizer };
@@ -1,269 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * File Organization Monitor Hook
5
- * Real-time monitoring and automated organization for the trinity structure
6
- * Part of Mission-1: Elegant File Harmonization
7
- */
8
-
9
- import { watchFile, readFileSync, existsSync, statSync, readdirSync } from 'fs';
10
- import { join, dirname, basename, extname } from 'path';
11
- import { execSync } from 'child_process';
12
-
13
- const TRINITY_CONFIG = {
14
- claude: {
15
- path: '.claude',
16
- purpose: 'Claude Code Integration & Execution',
17
- autoCreate: ['agents', 'commands', 'hooks'],
18
- rules: {
19
- agents: 'Executable agent definitions for Claude Code',
20
- commands: 'Custom Claude Code commands (/one, /story, etc.)',
21
- hooks: 'Real-time automation and validation scripts'
22
- }
23
- },
24
- platform: {
25
- path: '.one',
26
- purpose: 'Immutable Platform Foundation',
27
- autoCreate: ['agents', 'workflows', 'templates', 'tasks', 'checklists', 'tools', 'data'],
28
- rules: {
29
- agents: 'Platform agent definitions and configurations',
30
- workflows: 'Cascade orchestration patterns and frameworks',
31
- templates: 'Document generation and content templates',
32
- tasks: 'Implementation task library and definitions',
33
- checklists: 'Quality validation and compliance frameworks'
34
- }
35
- },
36
- user: {
37
- path: 'one',
38
- purpose: 'Active User Workspace',
39
- autoCreate: ['missions', 'stories', 'playbooks', 'guides', 'docs'],
40
- rules: {
41
- missions: 'Active user missions and strategic objectives',
42
- stories: 'User narrative development and implementations',
43
- playbooks: 'Generated user content and custom playbooks',
44
- guides: 'User documentation and reference materials'
45
- }
46
- }
47
- };
48
-
49
- /**
50
- * Monitors file changes and maintains organization
51
- */
52
- class FileOrganizationMonitor {
53
- constructor() {
54
- this.lastCheck = Date.now();
55
- this.organizationRules = this.loadOrganizationRules();
56
- }
57
-
58
- loadOrganizationRules() {
59
- try {
60
- const rulesPath = join(process.cwd(), 'one/docs/harmonized-structure-design.md');
61
- if (existsSync(rulesPath)) {
62
- console.log('šŸ“‹ Loaded harmonized structure rules');
63
- return true;
64
- }
65
- } catch (error) {
66
- console.log('āš ļø Using default organization rules');
67
- }
68
- return false;
69
- }
70
-
71
- /**
72
- * Determines the correct trinity location for a file
73
- */
74
- determineCorrectLocation(filePath, fileContent = '') {
75
- const filename = basename(filePath);
76
- const dir = dirname(filePath);
77
- const ext = extname(filename);
78
-
79
- // Agent files
80
- if (filename.includes('agent') || dir.includes('agents')) {
81
- if (fileContent.includes('claude.ai') || fileContent.includes('Claude Code')) {
82
- return { trinity: 'claude', directory: 'agents', reason: 'Claude Code execution agent' };
83
- }
84
- if (fileContent.includes('platform') || fileContent.includes('immutable')) {
85
- return { trinity: 'platform', directory: 'agents', reason: 'Platform agent definition' };
86
- }
87
- return { trinity: 'user', directory: 'agents', reason: 'User custom agent' };
88
- }
89
-
90
- // Mission files
91
- if (filename.includes('mission') || dir.includes('missions')) {
92
- if (fileContent.includes('template') || fileContent.includes('framework')) {
93
- return { trinity: 'platform', directory: 'missions', reason: 'Mission template' };
94
- }
95
- return { trinity: 'user', directory: 'missions', reason: 'Active user mission' };
96
- }
97
-
98
- // Story files
99
- if (filename.includes('story') || dir.includes('stories')) {
100
- if (fileContent.includes('template') || fileContent.includes('platform')) {
101
- return { trinity: 'platform', directory: 'stories', reason: 'Story template' };
102
- }
103
- return { trinity: 'user', directory: 'stories', reason: 'User story implementation' };
104
- }
105
-
106
- // Hook files
107
- if (filename.includes('hook') || dir.includes('hooks') || ext === '.js' && fileContent.includes('hook')) {
108
- return { trinity: 'claude', directory: 'hooks', reason: 'Claude Code automation hook' };
109
- }
110
-
111
- // Command files
112
- if (filename.includes('command') || dir.includes('commands') || fileContent.includes('/one')) {
113
- return { trinity: 'claude', directory: 'commands', reason: 'Claude Code command' };
114
- }
115
-
116
- // Workflow files
117
- if (filename.includes('workflow') || dir.includes('workflows')) {
118
- return { trinity: 'platform', directory: 'workflows', reason: 'Platform workflow definition' };
119
- }
120
-
121
- // Template files
122
- if (filename.includes('template') || filename.includes('tmpl') || dir.includes('templates')) {
123
- return { trinity: 'platform', directory: 'templates', reason: 'Platform template' };
124
- }
125
-
126
- // Documentation files
127
- if (dir.includes('docs') || filename.includes('guide')) {
128
- return { trinity: 'user', directory: 'docs', reason: 'User documentation' };
129
- }
130
-
131
- // Default to user workspace
132
- return { trinity: 'user', directory: 'docs', reason: 'User workspace file' };
133
- }
134
-
135
- /**
136
- * Validates trinity structure integrity
137
- */
138
- validateTrinityStructure() {
139
- const issues = [];
140
-
141
- Object.entries(TRINITY_CONFIG).forEach(([key, config]) => {
142
- const trinityPath = join(process.cwd(), config.path);
143
-
144
- if (!existsSync(trinityPath)) {
145
- issues.push(`āŒ Missing trinity directory: ${config.path}`);
146
- return;
147
- }
148
-
149
- config.autoCreate.forEach(dir => {
150
- const dirPath = join(trinityPath, dir);
151
- if (!existsSync(dirPath)) {
152
- issues.push(`šŸ“ Missing directory: ${config.path}/${dir}`);
153
- }
154
- });
155
- });
156
-
157
- return issues;
158
- }
159
-
160
- /**
161
- * Reports organization status
162
- */
163
- generateOrganizationReport() {
164
- const report = {
165
- timestamp: new Date().toISOString(),
166
- trinity_status: {},
167
- total_files: 0,
168
- organized_files: 0,
169
- issues: []
170
- };
171
-
172
- Object.entries(TRINITY_CONFIG).forEach(([key, config]) => {
173
- const trinityPath = join(process.cwd(), config.path);
174
-
175
- if (existsSync(trinityPath)) {
176
- const stats = this.countFilesInDirectory(trinityPath);
177
- report.trinity_status[key] = {
178
- path: config.path,
179
- purpose: config.purpose,
180
- file_count: stats.files,
181
- directory_count: stats.directories,
182
- organized: true
183
- };
184
- report.total_files += stats.files;
185
- report.organized_files += stats.files;
186
- } else {
187
- report.trinity_status[key] = {
188
- path: config.path,
189
- purpose: config.purpose,
190
- organized: false
191
- };
192
- report.issues.push(`Missing trinity: ${config.path}`);
193
- }
194
- });
195
-
196
- return report;
197
- }
198
-
199
- countFilesInDirectory(dirPath) {
200
- let files = 0;
201
- let directories = 0;
202
-
203
- try {
204
- const items = readdirSync(dirPath);
205
- items.forEach(item => {
206
- const itemPath = join(dirPath, item);
207
- const stat = statSync(itemPath);
208
-
209
- if (stat.isDirectory()) {
210
- directories++;
211
- const subStats = this.countFilesInDirectory(itemPath);
212
- files += subStats.files;
213
- directories += subStats.directories;
214
- } else {
215
- files++;
216
- }
217
- });
218
- } catch (error) {
219
- // Directory not accessible
220
- }
221
-
222
- return { files, directories };
223
- }
224
-
225
- /**
226
- * Main monitoring execution
227
- */
228
- monitor() {
229
- console.log('šŸ‘ļø File Organization Monitor Activated');
230
- console.log('šŸ”„ Monitoring trinity structure integrity...');
231
-
232
- // Validate current structure
233
- const issues = this.validateTrinityStructure();
234
- if (issues.length > 0) {
235
- console.log('\n🚨 Structure Issues Detected:');
236
- issues.forEach(issue => console.log(issue));
237
- } else {
238
- console.log('āœ… Trinity structure integrity confirmed');
239
- }
240
-
241
- // Generate organization report
242
- const report = this.generateOrganizationReport();
243
- console.log(`\nšŸ“Š Organization Status:`);
244
- console.log(`šŸ“ Total Files: ${report.total_files}`);
245
- console.log(`āœ… Organized Files: ${report.organized_files}`);
246
- console.log(`šŸ“ˆ Organization Rate: ${((report.organized_files / report.total_files) * 100).toFixed(1)}%`);
247
-
248
- Object.entries(report.trinity_status).forEach(([key, status]) => {
249
- if (status.organized) {
250
- console.log(`šŸŽÆ ${status.path}/: ${status.file_count} files, ${status.directory_count} directories`);
251
- } else {
252
- console.log(`āš ļø ${status.path}/: Not organized`);
253
- }
254
- });
255
-
256
- if (report.issues.length === 0) {
257
- console.log('\nšŸŽ‰ Perfect trinity harmony achieved!');
258
- console.log('šŸ“ All files elegantly organized across .claude/.one/one structure');
259
- }
260
- }
261
- }
262
-
263
- // Execute if called directly
264
- if (import.meta.url === `file://${process.argv[1]}`) {
265
- const monitor = new FileOrganizationMonitor();
266
- monitor.monitor();
267
- }
268
-
269
- export { FileOrganizationMonitor };