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,394 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Ontology Compliance Hook
|
|
5
|
-
* Ensures all files follow ONE framework ontology and structure principles
|
|
6
|
-
* Part of Mission-1: Elegant File Harmonization
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { readFileSync, existsSync, writeFileSync } from 'fs';
|
|
10
|
-
import { join, basename, dirname, extname } from 'path';
|
|
11
|
-
import { execSync } from 'child_process';
|
|
12
|
-
|
|
13
|
-
const ONTOLOGY_RULES = {
|
|
14
|
-
// Mission-Story-Task-Agent cascade validation
|
|
15
|
-
cascade: {
|
|
16
|
-
mission: {
|
|
17
|
-
required_sections: ['🎯 Mission Objective', '📊 Mission Context', '📋 Mission Stories'],
|
|
18
|
-
quality_gate: '4.0+ stars required',
|
|
19
|
-
pattern: /^mission-\d+.*\.md$/
|
|
20
|
-
},
|
|
21
|
-
story: {
|
|
22
|
-
required_sections: ['**Objective:**', '**Acceptance Criteria:**'],
|
|
23
|
-
quality_gate: '14+/16 points required',
|
|
24
|
-
pattern: /^story-\d+\.\d+.*\.md$/
|
|
25
|
-
},
|
|
26
|
-
task: {
|
|
27
|
-
required_sections: ['## Task Description', '## Implementation Steps'],
|
|
28
|
-
quality_gate: '4.0+ stars required',
|
|
29
|
-
pattern: /^task-.*\.md$/
|
|
30
|
-
},
|
|
31
|
-
agent: {
|
|
32
|
-
required_fields: ['name', 'role', 'expertise', 'tools'],
|
|
33
|
-
quality_gate: '4.0+ stars required',
|
|
34
|
-
pattern: /^[a-z-]+\.md$/
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// Directory organization rules
|
|
39
|
-
directories: {
|
|
40
|
-
'.claude': {
|
|
41
|
-
purpose: 'Claude Code Integration & Execution',
|
|
42
|
-
allowed_subdirs: ['agents', 'commands', 'hooks'],
|
|
43
|
-
file_patterns: ['*.js', '*.json', '*.md']
|
|
44
|
-
},
|
|
45
|
-
'.one': {
|
|
46
|
-
purpose: 'Immutable Platform Foundation',
|
|
47
|
-
allowed_subdirs: ['agents', 'workflows', 'templates', 'tasks', 'checklists', 'tools', 'data', 'playbooks', 'stories', 'teams', 'missions', 'ontology', 'infrastructure', 'hooks'],
|
|
48
|
-
file_patterns: ['*.md', '*.yaml', '*.yml', '*.json']
|
|
49
|
-
},
|
|
50
|
-
'one': {
|
|
51
|
-
purpose: 'Active User Workspace',
|
|
52
|
-
allowed_subdirs: ['missions', 'stories', 'playbooks', 'guides', 'prompts', 'research', 'tests', 'docs', 'architecture', 'brand', 'assets', 'data', 'archive'],
|
|
53
|
-
file_patterns: ['*.md', '*.yaml', '*.yml', '*.json', '*.js', '*.css', '*.html']
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
// File naming conventions
|
|
58
|
-
naming: {
|
|
59
|
-
kebab_case: /^[a-z0-9]+(-[a-z0-9]+)*$/,
|
|
60
|
-
version_pattern: /^[a-z0-9-]+-v?\d+(\.\d+)*$/,
|
|
61
|
-
extension_whitelist: ['.md', '.yaml', '.yml', '.json', '.js', '.css', '.html', '.png', '.jpg', '.jpeg', '.gif', '.svg'],
|
|
62
|
-
forbidden_chars: /[A-Z\s_]/,
|
|
63
|
-
max_length: 100
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
// Content quality validation
|
|
67
|
-
quality: {
|
|
68
|
-
markdown: {
|
|
69
|
-
required_frontmatter: ['title', 'status'],
|
|
70
|
-
structure_markers: ['#', '##', '###'],
|
|
71
|
-
min_word_count: 50
|
|
72
|
-
},
|
|
73
|
-
yaml: {
|
|
74
|
-
required_root_keys: ['name', 'description'],
|
|
75
|
-
valid_status_values: ['draft', 'active', 'completed', 'archived']
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Validates file against ontology rules
|
|
82
|
-
*/
|
|
83
|
-
class OntologyValidator {
|
|
84
|
-
constructor() {
|
|
85
|
-
this.errors = [];
|
|
86
|
-
this.warnings = [];
|
|
87
|
-
this.fixes = [];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Main validation entry point
|
|
92
|
-
*/
|
|
93
|
-
validateFile(filePath) {
|
|
94
|
-
console.log(`🔍 Validating ontology compliance: ${filePath}`);
|
|
95
|
-
|
|
96
|
-
this.errors = [];
|
|
97
|
-
this.warnings = [];
|
|
98
|
-
this.fixes = [];
|
|
99
|
-
|
|
100
|
-
if (!existsSync(filePath)) {
|
|
101
|
-
this.errors.push(`File does not exist: ${filePath}`);
|
|
102
|
-
return this.getValidationResult();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Basic file structure validation
|
|
106
|
-
this.validateFileStructure(filePath);
|
|
107
|
-
|
|
108
|
-
// Content-specific validation
|
|
109
|
-
this.validateFileContent(filePath);
|
|
110
|
-
|
|
111
|
-
// Cascade validation (if applicable)
|
|
112
|
-
this.validateCascadeCompliance(filePath);
|
|
113
|
-
|
|
114
|
-
return this.getValidationResult();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Validates basic file structure and naming
|
|
119
|
-
*/
|
|
120
|
-
validateFileStructure(filePath) {
|
|
121
|
-
const filename = basename(filePath);
|
|
122
|
-
const directory = dirname(filePath);
|
|
123
|
-
const ext = extname(filename);
|
|
124
|
-
const nameWithoutExt = basename(filename, ext);
|
|
125
|
-
|
|
126
|
-
// Validate directory placement
|
|
127
|
-
const trinity = this.determineTrinity(filePath);
|
|
128
|
-
if (!trinity) {
|
|
129
|
-
this.errors.push(`File not in valid trinity structure: ${filePath}`);
|
|
130
|
-
this.fixes.push(`Move to .claude/, .one/, or one/ directory`);
|
|
131
|
-
} else {
|
|
132
|
-
this.validateDirectoryPlacement(filePath, trinity);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Validate naming conventions
|
|
136
|
-
if (ONTOLOGY_RULES.naming.forbidden_chars.test(nameWithoutExt)) {
|
|
137
|
-
this.errors.push(`Invalid characters in filename: ${filename}`);
|
|
138
|
-
this.fixes.push(`Use kebab-case: ${nameWithoutExt.toLowerCase().replace(/[_\s]/g, '-')}`);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!ONTOLOGY_RULES.naming.kebab_case.test(nameWithoutExt)) {
|
|
142
|
-
this.warnings.push(`Filename not in kebab-case: ${filename}`);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (filename.length > ONTOLOGY_RULES.naming.max_length) {
|
|
146
|
-
this.errors.push(`Filename too long (${filename.length} > ${ONTOLOGY_RULES.naming.max_length}): ${filename}`);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!ONTOLOGY_RULES.naming.extension_whitelist.includes(ext)) {
|
|
150
|
-
this.warnings.push(`Uncommon file extension: ${ext}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Validates file content against ontology rules
|
|
156
|
-
*/
|
|
157
|
-
validateFileContent(filePath) {
|
|
158
|
-
try {
|
|
159
|
-
const content = readFileSync(filePath, 'utf8');
|
|
160
|
-
const ext = extname(filePath);
|
|
161
|
-
|
|
162
|
-
if (ext === '.md') {
|
|
163
|
-
this.validateMarkdownContent(content, filePath);
|
|
164
|
-
} else if (ext === '.yaml' || ext === '.yml') {
|
|
165
|
-
this.validateYamlContent(content, filePath);
|
|
166
|
-
} else if (ext === '.json') {
|
|
167
|
-
this.validateJsonContent(content, filePath);
|
|
168
|
-
}
|
|
169
|
-
} catch (error) {
|
|
170
|
-
this.errors.push(`Cannot read file content: ${error.message}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Validates markdown content structure
|
|
176
|
-
*/
|
|
177
|
-
validateMarkdownContent(content, filePath) {
|
|
178
|
-
const lines = content.split('\n');
|
|
179
|
-
const filename = basename(filePath);
|
|
180
|
-
|
|
181
|
-
// Check for title
|
|
182
|
-
if (!content.includes('# ')) {
|
|
183
|
-
this.warnings.push(`Missing main heading in: ${filename}`);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Check minimum word count
|
|
187
|
-
const wordCount = content.split(/\s+/).length;
|
|
188
|
-
if (wordCount < ONTOLOGY_RULES.quality.markdown.min_word_count) {
|
|
189
|
-
this.warnings.push(`Content too short (${wordCount} words) in: ${filename}`);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Check for proper heading hierarchy
|
|
193
|
-
const headings = lines.filter(line => line.startsWith('#'));
|
|
194
|
-
if (headings.length === 0) {
|
|
195
|
-
this.warnings.push(`No headings found in: ${filename}`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Validates YAML content structure
|
|
201
|
-
*/
|
|
202
|
-
validateYamlContent(content, filePath) {
|
|
203
|
-
try {
|
|
204
|
-
// Basic YAML parsing validation
|
|
205
|
-
const lines = content.split('\n').filter(line => line.trim() && !line.trim().startsWith('#'));
|
|
206
|
-
|
|
207
|
-
if (lines.length === 0) {
|
|
208
|
-
this.warnings.push(`Empty YAML file: ${basename(filePath)}`);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Check for required root keys
|
|
212
|
-
ONTOLOGY_RULES.quality.yaml.required_root_keys.forEach(key => {
|
|
213
|
-
if (!content.includes(`${key}:`)) {
|
|
214
|
-
this.warnings.push(`Missing required key '${key}' in: ${basename(filePath)}`);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
} catch (error) {
|
|
219
|
-
this.errors.push(`Invalid YAML syntax: ${error.message}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Validates JSON content structure
|
|
225
|
-
*/
|
|
226
|
-
validateJsonContent(content, filePath) {
|
|
227
|
-
try {
|
|
228
|
-
JSON.parse(content);
|
|
229
|
-
} catch (error) {
|
|
230
|
-
this.errors.push(`Invalid JSON syntax in ${basename(filePath)}: ${error.message}`);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Validates cascade compliance (Mission-Story-Task-Agent)
|
|
236
|
-
*/
|
|
237
|
-
validateCascadeCompliance(filePath) {
|
|
238
|
-
const filename = basename(filePath);
|
|
239
|
-
const content = existsSync(filePath) ? readFileSync(filePath, 'utf8') : '';
|
|
240
|
-
|
|
241
|
-
// Mission validation
|
|
242
|
-
if (ONTOLOGY_RULES.cascade.mission.pattern.test(filename)) {
|
|
243
|
-
ONTOLOGY_RULES.cascade.mission.required_sections.forEach(section => {
|
|
244
|
-
if (!content.includes(section)) {
|
|
245
|
-
this.warnings.push(`Mission missing required section: ${section}`);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
if (!content.includes('Status:') && !content.includes('status:')) {
|
|
250
|
-
this.warnings.push(`Mission missing status indicator`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// Story validation
|
|
255
|
-
if (ONTOLOGY_RULES.cascade.story.pattern.test(filename)) {
|
|
256
|
-
ONTOLOGY_RULES.cascade.story.required_sections.forEach(section => {
|
|
257
|
-
if (!content.includes(section)) {
|
|
258
|
-
this.warnings.push(`Story missing required section: ${section}`);
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// Task validation
|
|
264
|
-
if (ONTOLOGY_RULES.cascade.task.pattern.test(filename)) {
|
|
265
|
-
ONTOLOGY_RULES.cascade.task.required_sections.forEach(section => {
|
|
266
|
-
if (!content.includes(section)) {
|
|
267
|
-
this.warnings.push(`Task missing required section: ${section}`);
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Determines which trinity a file belongs to
|
|
275
|
-
*/
|
|
276
|
-
determineTrinity(filePath) {
|
|
277
|
-
if (filePath.startsWith('.claude/')) return 'claude';
|
|
278
|
-
if (filePath.startsWith('.one/')) return 'platform';
|
|
279
|
-
if (filePath.startsWith('one/')) return 'user';
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Validates directory placement within trinity
|
|
285
|
-
*/
|
|
286
|
-
validateDirectoryPlacement(filePath, trinity) {
|
|
287
|
-
const trinityRules = ONTOLOGY_RULES.directories[trinity === 'platform' ? '.one' : trinity === 'claude' ? '.claude' : 'one'];
|
|
288
|
-
const pathSegments = filePath.split('/');
|
|
289
|
-
|
|
290
|
-
if (pathSegments.length > 2) {
|
|
291
|
-
const subdir = pathSegments[1];
|
|
292
|
-
if (!trinityRules.allowed_subdirs.includes(subdir)) {
|
|
293
|
-
this.warnings.push(`Unusual subdirectory '${subdir}' in ${trinity} trinity`);
|
|
294
|
-
this.fixes.push(`Consider using: ${trinityRules.allowed_subdirs.join(', ')}`);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Returns validation result summary
|
|
301
|
-
*/
|
|
302
|
-
getValidationResult() {
|
|
303
|
-
return {
|
|
304
|
-
valid: this.errors.length === 0,
|
|
305
|
-
errors: this.errors,
|
|
306
|
-
warnings: this.warnings,
|
|
307
|
-
fixes: this.fixes,
|
|
308
|
-
score: this.calculateComplianceScore()
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Calculates compliance score out of 5.0 stars
|
|
314
|
-
*/
|
|
315
|
-
calculateComplianceScore() {
|
|
316
|
-
const totalIssues = this.errors.length + this.warnings.length;
|
|
317
|
-
if (totalIssues === 0) return 5.0;
|
|
318
|
-
if (totalIssues <= 2) return 4.5;
|
|
319
|
-
if (totalIssues <= 4) return 4.0;
|
|
320
|
-
if (totalIssues <= 6) return 3.5;
|
|
321
|
-
if (totalIssues <= 8) return 3.0;
|
|
322
|
-
return 2.5;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Main hook execution
|
|
328
|
-
*/
|
|
329
|
-
function main() {
|
|
330
|
-
const filesToValidate = process.env.CHANGED_FILES?.split('\n').filter(Boolean) || [];
|
|
331
|
-
|
|
332
|
-
if (filesToValidate.length === 0) {
|
|
333
|
-
console.log('ℹ️ No files to validate for ontology compliance');
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
console.log('🎯 Ontology Compliance Hook Activated');
|
|
338
|
-
console.log(`📊 Validating ${filesToValidate.length} files`);
|
|
339
|
-
|
|
340
|
-
const validator = new OntologyValidator();
|
|
341
|
-
let totalErrors = 0;
|
|
342
|
-
let totalWarnings = 0;
|
|
343
|
-
let totalScore = 0;
|
|
344
|
-
|
|
345
|
-
filesToValidate.forEach(filePath => {
|
|
346
|
-
const result = validator.validateFile(filePath);
|
|
347
|
-
|
|
348
|
-
totalErrors += result.errors.length;
|
|
349
|
-
totalWarnings += result.warnings.length;
|
|
350
|
-
totalScore += result.score;
|
|
351
|
-
|
|
352
|
-
if (result.errors.length > 0) {
|
|
353
|
-
console.log(`❌ ${filePath}: ${result.errors.length} errors`);
|
|
354
|
-
result.errors.forEach(error => console.log(` ${error}`));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (result.warnings.length > 0) {
|
|
358
|
-
console.log(`⚠️ ${filePath}: ${result.warnings.length} warnings`);
|
|
359
|
-
result.warnings.forEach(warning => console.log(` ${warning}`));
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
if (result.valid) {
|
|
363
|
-
console.log(`✅ ${filePath}: ⭐${result.score.toFixed(1)} Ontology compliant`);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (result.fixes.length > 0) {
|
|
367
|
-
console.log(`💡 Suggested fixes for ${filePath}:`);
|
|
368
|
-
result.fixes.forEach(fix => console.log(` ${fix}`));
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
// Summary report
|
|
373
|
-
const averageScore = totalScore / filesToValidate.length;
|
|
374
|
-
console.log(`\n📊 Ontology Compliance Summary:`);
|
|
375
|
-
console.log(`⭐ Average Score: ${averageScore.toFixed(1)}/5.0 stars`);
|
|
376
|
-
console.log(`❌ Total Errors: ${totalErrors}`);
|
|
377
|
-
console.log(`⚠️ Total Warnings: ${totalWarnings}`);
|
|
378
|
-
|
|
379
|
-
if (totalErrors > 0) {
|
|
380
|
-
console.log('\n🚨 Ontology compliance issues detected');
|
|
381
|
-
console.log('📖 See one/docs/harmonized-structure-design.md for guidance');
|
|
382
|
-
process.exit(1);
|
|
383
|
-
} else {
|
|
384
|
-
console.log('\n🎉 All files meet ontology compliance standards!');
|
|
385
|
-
console.log(`🏆 Mission-1 quality maintained at ${averageScore.toFixed(1)} stars`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// Execute if called directly
|
|
390
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
391
|
-
main();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export { OntologyValidator };
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
|
|
10
|
-
class OntologyHookManager {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.hookConfigPath = path.join(__dirname, '../claude-code-hooks.json');
|
|
13
|
-
this.feedbackLogPath = path.join(__dirname, '../ontology-feedback.log');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getHookStatus() {
|
|
17
|
-
try {
|
|
18
|
-
const config = JSON.parse(fs.readFileSync(this.hookConfigPath, 'utf8'));
|
|
19
|
-
const ontologyCategory = config.config.categories['ontology-organization'];
|
|
20
|
-
|
|
21
|
-
const fileOrgOnOpen = config.hooks.PreToolUse?.find(hook =>
|
|
22
|
-
hook.hooks?.some(h => h.name === 'file-organization-on-open')
|
|
23
|
-
)?.hooks?.[0];
|
|
24
|
-
|
|
25
|
-
const fileOrgOnClose = config.hooks.PostToolUse?.find(hook =>
|
|
26
|
-
hook.hooks?.some(h => h.name === 'file-organization-on-close')
|
|
27
|
-
)?.hooks?.[0];
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
category_enabled: ontologyCategory?.enabled || false,
|
|
31
|
-
open_hook: {
|
|
32
|
-
enabled: fileOrgOnOpen?.enabled || false,
|
|
33
|
-
command: fileOrgOnOpen?.command || 'not configured'
|
|
34
|
-
},
|
|
35
|
-
close_hook: {
|
|
36
|
-
enabled: fileOrgOnClose?.enabled || false,
|
|
37
|
-
command: fileOrgOnClose?.command || 'not configured'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return {
|
|
42
|
-
error: `Failed to read hook configuration: ${error.message}`
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
enableHooks() {
|
|
48
|
-
try {
|
|
49
|
-
const config = JSON.parse(fs.readFileSync(this.hookConfigPath, 'utf8'));
|
|
50
|
-
|
|
51
|
-
// Enable category
|
|
52
|
-
if (config.config.categories['ontology-organization']) {
|
|
53
|
-
config.config.categories['ontology-organization'].enabled = true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Enable individual hooks
|
|
57
|
-
config.hooks.PreToolUse?.forEach(hookGroup => {
|
|
58
|
-
hookGroup.hooks?.forEach(hook => {
|
|
59
|
-
if (hook.name === 'file-organization-on-open') {
|
|
60
|
-
hook.enabled = true;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
config.hooks.PostToolUse?.forEach(hookGroup => {
|
|
66
|
-
hookGroup.hooks?.forEach(hook => {
|
|
67
|
-
if (hook.name === 'file-organization-on-close') {
|
|
68
|
-
hook.enabled = true;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
fs.writeFileSync(this.hookConfigPath, JSON.stringify(config, null, 2));
|
|
74
|
-
return { success: true, message: 'Ontology hooks enabled successfully' };
|
|
75
|
-
} catch (error) {
|
|
76
|
-
return { success: false, message: error.message };
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
disableHooks() {
|
|
81
|
-
try {
|
|
82
|
-
const config = JSON.parse(fs.readFileSync(this.hookConfigPath, 'utf8'));
|
|
83
|
-
|
|
84
|
-
// Disable category
|
|
85
|
-
if (config.config.categories['ontology-organization']) {
|
|
86
|
-
config.config.categories['ontology-organization'].enabled = false;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Disable individual hooks
|
|
90
|
-
config.hooks.PreToolUse?.forEach(hookGroup => {
|
|
91
|
-
hookGroup.hooks?.forEach(hook => {
|
|
92
|
-
if (hook.name === 'file-organization-on-open') {
|
|
93
|
-
hook.enabled = false;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
config.hooks.PostToolUse?.forEach(hookGroup => {
|
|
99
|
-
hookGroup.hooks?.forEach(hook => {
|
|
100
|
-
if (hook.name === 'file-organization-on-close') {
|
|
101
|
-
hook.enabled = false;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
fs.writeFileSync(this.hookConfigPath, JSON.stringify(config, null, 2));
|
|
107
|
-
return { success: true, message: 'Ontology hooks disabled successfully' };
|
|
108
|
-
} catch (error) {
|
|
109
|
-
return { success: false, message: error.message };
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getOntologyFeedback(lines = 20) {
|
|
114
|
-
try {
|
|
115
|
-
if (!fs.existsSync(this.feedbackLogPath)) {
|
|
116
|
-
return { feedback: [], message: 'No ontology feedback log found' };
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const content = fs.readFileSync(this.feedbackLogPath, 'utf8');
|
|
120
|
-
const allLines = content.trim().split('\n');
|
|
121
|
-
const recentLines = allLines.slice(-lines);
|
|
122
|
-
|
|
123
|
-
const feedback = recentLines.map(line => {
|
|
124
|
-
try {
|
|
125
|
-
const [timestamp, ...dataParts] = line.split('] ');
|
|
126
|
-
const data = dataParts.join('] ');
|
|
127
|
-
|
|
128
|
-
if (data.startsWith('ONTOLOGY_REPORT:')) {
|
|
129
|
-
const reportData = JSON.parse(data.replace('ONTOLOGY_REPORT: ', ''));
|
|
130
|
-
return {
|
|
131
|
-
timestamp: timestamp.replace('[', ''),
|
|
132
|
-
type: 'report',
|
|
133
|
-
data: reportData
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
timestamp: timestamp?.replace('[', '') || 'unknown',
|
|
139
|
-
type: 'message',
|
|
140
|
-
data: data || line
|
|
141
|
-
};
|
|
142
|
-
} catch (error) {
|
|
143
|
-
return {
|
|
144
|
-
timestamp: 'unknown',
|
|
145
|
-
type: 'raw',
|
|
146
|
-
data: line
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
return { feedback, message: `Retrieved ${feedback.length} recent feedback entries` };
|
|
152
|
-
} catch (error) {
|
|
153
|
-
return { feedback: [], message: error.message };
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
generateOntologyHealthReport() {
|
|
158
|
-
const feedbackResult = this.getOntologyFeedback(100);
|
|
159
|
-
|
|
160
|
-
if (feedbackResult.feedback.length === 0) {
|
|
161
|
-
return {
|
|
162
|
-
health: 'unknown',
|
|
163
|
-
summary: {
|
|
164
|
-
files_analyzed: 0,
|
|
165
|
-
avg_confidence: 0,
|
|
166
|
-
gaps_identified: 0,
|
|
167
|
-
improvements_suggested: 0
|
|
168
|
-
},
|
|
169
|
-
recommendations: ['No data available - start using the system to generate reports']
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const reports = feedbackResult.feedback.filter(f => f.type === 'report');
|
|
174
|
-
|
|
175
|
-
if (reports.length === 0) {
|
|
176
|
-
return {
|
|
177
|
-
health: 'unknown',
|
|
178
|
-
summary: {
|
|
179
|
-
files_analyzed: 0,
|
|
180
|
-
avg_confidence: 0,
|
|
181
|
-
gaps_identified: 0,
|
|
182
|
-
improvements_suggested: 0
|
|
183
|
-
},
|
|
184
|
-
recommendations: ['No ontology reports found']
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const totalConfidence = reports.reduce((sum, r) =>
|
|
189
|
-
sum + (r.data.ontology_health?.coverage || 0), 0
|
|
190
|
-
);
|
|
191
|
-
const avgConfidence = totalConfidence / reports.length;
|
|
192
|
-
|
|
193
|
-
const totalGaps = reports.reduce((sum, r) =>
|
|
194
|
-
sum + (r.data.gaps?.length || 0), 0
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
const totalImprovements = reports.reduce((sum, r) =>
|
|
198
|
-
sum + (r.data.improvements?.length || 0), 0
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
const statusCounts = {};
|
|
202
|
-
reports.forEach(r => {
|
|
203
|
-
const status = r.data.ontology_status || 'unknown';
|
|
204
|
-
statusCounts[status] = (statusCounts[status] || 0) + 1;
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
const dominantStatus = Object.entries(statusCounts)
|
|
208
|
-
.sort(([,a], [,b]) => b - a)[0]?.[0] || 'unknown';
|
|
209
|
-
|
|
210
|
-
// Generate recommendations
|
|
211
|
-
const recommendations = [];
|
|
212
|
-
if (avgConfidence < 70) {
|
|
213
|
-
recommendations.push('Consider updating ontology patterns to improve file classification');
|
|
214
|
-
}
|
|
215
|
-
if (totalGaps > reports.length * 0.5) {
|
|
216
|
-
recommendations.push('High number of ontology gaps detected - review and expand ontology');
|
|
217
|
-
}
|
|
218
|
-
if (totalImprovements > reports.length * 0.3) {
|
|
219
|
-
recommendations.push('Multiple improvement opportunities identified - prioritize ontology updates');
|
|
220
|
-
}
|
|
221
|
-
if (recommendations.length === 0) {
|
|
222
|
-
recommendations.push('Ontology is performing well - continue monitoring');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return {
|
|
226
|
-
health: dominantStatus,
|
|
227
|
-
summary: {
|
|
228
|
-
files_analyzed: reports.length,
|
|
229
|
-
avg_confidence: Math.round(avgConfidence * 100) / 100,
|
|
230
|
-
gaps_identified: totalGaps,
|
|
231
|
-
improvements_suggested: totalImprovements,
|
|
232
|
-
status_distribution: statusCounts
|
|
233
|
-
},
|
|
234
|
-
recommendations
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// CLI Interface
|
|
240
|
-
function main() {
|
|
241
|
-
const manager = new OntologyHookManager();
|
|
242
|
-
const command = process.argv[2];
|
|
243
|
-
|
|
244
|
-
switch (command) {
|
|
245
|
-
case 'status':
|
|
246
|
-
console.log('🔍 Ontology Hook Status:');
|
|
247
|
-
console.log(JSON.stringify(manager.getHookStatus(), null, 2));
|
|
248
|
-
break;
|
|
249
|
-
|
|
250
|
-
case 'enable':
|
|
251
|
-
const enableResult = manager.enableHooks();
|
|
252
|
-
console.log(enableResult.success ? '✅' : '❌', enableResult.message);
|
|
253
|
-
break;
|
|
254
|
-
|
|
255
|
-
case 'disable':
|
|
256
|
-
const disableResult = manager.disableHooks();
|
|
257
|
-
console.log(disableResult.success ? '✅' : '❌', disableResult.message);
|
|
258
|
-
break;
|
|
259
|
-
|
|
260
|
-
case 'feedback':
|
|
261
|
-
const lines = parseInt(process.argv[3]) || 10;
|
|
262
|
-
const feedbackResult = manager.getOntologyFeedback(lines);
|
|
263
|
-
console.log(`📋 Recent Ontology Feedback (${lines} entries):`);
|
|
264
|
-
feedbackResult.feedback.forEach(entry => {
|
|
265
|
-
if (entry.type === 'report') {
|
|
266
|
-
console.log(`[${entry.timestamp}] ${entry.data.file} - ${entry.data.ontology_status} (${entry.data.ontology_health.coverage}%)`);
|
|
267
|
-
if (entry.data.gaps.length > 0) {
|
|
268
|
-
console.log(` Gaps: ${entry.data.gaps.length}`);
|
|
269
|
-
}
|
|
270
|
-
if (entry.data.improvements.length > 0) {
|
|
271
|
-
console.log(` Improvements: ${entry.data.improvements.length}`);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
break;
|
|
276
|
-
|
|
277
|
-
case 'health':
|
|
278
|
-
const health = manager.generateOntologyHealthReport();
|
|
279
|
-
console.log('🏥 Ontology Health Report:');
|
|
280
|
-
console.log(`Overall Health: ${health.health.toUpperCase()}`);
|
|
281
|
-
console.log(`Files Analyzed: ${health.summary.files_analyzed}`);
|
|
282
|
-
console.log(`Average Confidence: ${health.summary.avg_confidence}%`);
|
|
283
|
-
console.log(`Gaps Identified: ${health.summary.gaps_identified}`);
|
|
284
|
-
console.log(`Improvements Suggested: ${health.summary.improvements_suggested}`);
|
|
285
|
-
console.log('');
|
|
286
|
-
console.log('📊 Status Distribution:');
|
|
287
|
-
Object.entries(health.summary.status_distribution || {}).forEach(([status, count]) => {
|
|
288
|
-
console.log(` ${status}: ${count}`);
|
|
289
|
-
});
|
|
290
|
-
console.log('');
|
|
291
|
-
console.log('💡 Recommendations:');
|
|
292
|
-
health.recommendations.forEach(rec => console.log(` • ${rec}`));
|
|
293
|
-
break;
|
|
294
|
-
|
|
295
|
-
default:
|
|
296
|
-
console.log('🛠️ Ontology Hook Manager');
|
|
297
|
-
console.log('');
|
|
298
|
-
console.log('Usage: node ontology-hook-manager.js <command>');
|
|
299
|
-
console.log('');
|
|
300
|
-
console.log('Commands:');
|
|
301
|
-
console.log(' status - Show current hook status');
|
|
302
|
-
console.log(' enable - Enable ontology hooks');
|
|
303
|
-
console.log(' disable - Disable ontology hooks');
|
|
304
|
-
console.log(' feedback [lines] - Show recent ontology feedback');
|
|
305
|
-
console.log(' health - Generate ontology health report');
|
|
306
|
-
console.log('');
|
|
307
|
-
console.log('🧠 Ontology hooks help maintain beautiful file organization');
|
|
308
|
-
console.log(' and evolve the ONE framework ontology intelligently.');
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
313
|
-
main();
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export { OntologyHookManager };
|