oneie 3.4.2 ā 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.
- package/.claude/agents/agent-director.md +902 -22
- package/.claude/agents/agent-onboard-example-output.md +600 -0
- package/.claude/agents/agent-onboard.md +576 -0
- package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
- package/.claude/commands/one.md +411 -10
- package/.claude/commands/release.md +64 -3
- package/CLAUDE.md +55 -69
- package/dist/commands/init.d.ts +5 -6
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +101 -101
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/installation-setup.d.ts +24 -1
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +85 -1
- package/dist/utils/installation-setup.js.map +1 -1
- package/dist/utils/launch-claude.d.ts +6 -0
- package/dist/utils/launch-claude.d.ts.map +1 -0
- package/dist/utils/launch-claude.js +51 -0
- package/dist/utils/launch-claude.js.map +1 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +73 -0
- package/dist/utils/validation.js.map +1 -0
- package/folders.yaml +1 -1
- package/one/.obsidian/app.json +8 -0
- package/one/.obsidian/appearance.json +1 -0
- package/one/.obsidian/community-plugins.json +3 -0
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/plugins/easy-bake/main.js +361 -0
- package/one/.obsidian/plugins/easy-bake/manifest.json +11 -0
- package/one/.obsidian/plugins/easy-bake/styles.css +10 -0
- package/one/.obsidian/workspace.json +240 -0
- package/one/connections/workflow-onboarding.md +683 -0
- package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
- package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
- package/one/events/DEPLOYMENT.md +178 -0
- package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
- package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
- package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
- package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
- package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
- package/one/events/HANDOFF.md +313 -0
- package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
- package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
- package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
- package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
- package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
- package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
- package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
- package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
- package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
- package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
- package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
- package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
- package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
- package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
- package/one/events/SHOP-BUILD-STATUS.md +114 -0
- package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
- package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
- package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
- package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
- package/one/events/agent-director-enhancement-summary.md +386 -0
- package/one/events/agent-onboard-implementation-summary.md +457 -0
- package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
- package/one/events/landing-page-generator.md +458 -0
- package/one/events/onboarding-implementation-complete.md +505 -0
- package/one/events/release.md +254 -0
- package/one/events/separate-implementation-status.md +537 -0
- package/one/groups/nine-padle-contents.baked.md +1252 -0
- package/one/groups/nine-padle-contents.md +6 -0
- package/one/knowledge/100-inference-quick-reference.md +431 -0
- package/one/knowledge/agent-onboard-usage.md +612 -0
- package/one/knowledge/cli-claude-handoff.md +718 -0
- package/one/knowledge/installation-folders.md +45 -1
- package/one/knowledge/ontology-blog.yaml +31 -0
- package/one/knowledge/ontology-cheatsheet.md +591 -0
- package/one/knowledge/ontology-community.yaml +42 -0
- package/one/knowledge/ontology-core-universal.md +722 -0
- package/one/knowledge/ontology-core.yaml +50 -0
- package/one/knowledge/ontology-courses.yaml +53 -0
- package/one/knowledge/ontology-creator.md +376 -0
- package/one/knowledge/ontology-developer-guide.md +789 -0
- package/one/knowledge/ontology-education.md +920 -0
- package/one/knowledge/ontology-index.md +354 -0
- package/one/knowledge/ontology-migration-guide.md +811 -0
- package/one/knowledge/ontology-minimal.yaml +1 -1
- package/one/knowledge/ontology-portfolio.yaml +31 -0
- package/one/knowledge/ontology-quickstart.md +576 -0
- package/one/knowledge/ontology-shop.yaml +121 -0
- package/one/knowledge/ontology-tokens.yaml +32 -0
- package/one/knowledge/ontology-tutorial.md +434 -0
- package/one/knowledge/ontology-video-script.md +890 -0
- package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
- package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
- package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
- package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
- package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
- package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
- package/one/things/docs/ecommerce/QUICK-START.md +368 -0
- package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
- package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
- package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
- package/one/things/docs/ecommerce/demo.astro +309 -0
- package/one/things/plans/agent-director-100-inference-plans.md +410 -0
- package/one/things/plans/dual-website-strategy.md +612 -0
- package/one/things/plans/feature-based-sites.md +821 -0
- package/one/things/plans/multi-ontology-architecture.md +836 -0
- package/one/things/plans/onboarding.md +32 -0
- package/one/things/plans/separate.md +15 -17
- package/one/things/plans/start-new.md +738 -0
- package/one/things/templates.md +254 -0
- package/one/things/todo.md +23 -5
- package/package.json +2 -2
- package/one/things/claude/hooks/agent-hook-manager.js +0 -525
- package/one/things/claude/hooks/agent-load-balancer.js +0 -271
- package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
- package/one/things/claude/hooks/cascade-feedback.js +0 -297
- package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
- package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
- package/one/things/claude/hooks/file-organization-engine.js +0 -427
- package/one/things/claude/hooks/file-organization-monitor.js +0 -269
- package/one/things/claude/hooks/hook-config-manager.js +0 -202
- package/one/things/claude/hooks/hook-orchestrator.js +0 -662
- package/one/things/claude/hooks/hook-performance-report.js +0 -120
- package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
- package/one/things/claude/hooks/memory-optimizer.js +0 -510
- package/one/things/claude/hooks/ontology-compliance.js +0 -394
- package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
- package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
- package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
- package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
- package/one/things/claude/hooks/simple-load-balancer.js +0 -238
- package/one/things/claude/hooks/startup-optimizer.js +0 -625
- package/one/things/claude/hooks/story-scoring-system.js +0 -445
- package/one/things/claude/hooks/story-validation-engine.js +0 -473
- package/one/things/claude/hooks/structure-synchronizer.js +0 -194
- package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
- package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
- package/one/things/claude/hooks/trinity-validation-system.js +0 -392
- 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 };
|