oneie 3.6.24 → 3.6.26
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-backend.md +2 -2
- package/.claude/agents/agent-builder.md +226 -198
- package/.claude/agents/agent-designer.md +167 -11
- package/.claude/agents/agent-director.md +180 -112
- package/.claude/agents/agent-frontend.md +154 -8
- package/.claude/agents/agent-onboard.md +1 -1
- package/.claude/agents/agent-ontology.md +2 -2
- package/.claude/agents/agent-ops.md +58 -38
- package/.claude/agents/agent-quality.md +377 -0
- package/.claude/agents/agent-sales.md +3 -3
- package/.claude/commands/cascade.md +21 -21
- package/.claude/commands/create.md +19 -19
- package/.claude/commands/deploy.md +82 -104
- package/.claude/commands/mcp-on.md +191 -0
- package/.claude/commands/one.md +267 -92
- package/.claude/commands/plan.md +17 -17
- package/.claude/commands/release.md +65 -14
- package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +473 -0
- package/.claude/hooks/README-knowledge-hooks.md +451 -0
- package/.claude/hooks/README-root-cleanup.md +200 -0
- package/.claude/hooks/README.md +284 -0
- package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/check-filenames.py +177 -0
- package/.claude/hooks/clean-post.py +468 -0
- package/.claude/hooks/clean-pre.py +393 -0
- package/.claude/hooks/clean-root-markdown.sh +73 -0
- package/.claude/hooks/commit-push.sh +95 -0
- package/.claude/hooks/done.py +236 -0
- package/.claude/hooks/format-hook.sh +163 -0
- package/.claude/hooks/hook-logger.sh +173 -0
- package/.claude/hooks/knowledge-post.py +355 -0
- package/.claude/hooks/knowledge-pre.py +245 -0
- package/.claude/hooks/mcp-on.sh +134 -0
- package/.claude/hooks/notification-hook.sh +279 -0
- package/.claude/hooks/push.sh +101 -0
- package/.claude/hooks/release-cli.sh +16 -8
- package/.claude/hooks/root-cleanup.py +217 -0
- package/.claude/hooks/security-hook.sh +397 -0
- package/.claude/hooks/tag-all-docs.py +464 -0
- package/.claude/hooks/test-validate-ontology.sh +170 -0
- package/.claude/hooks/todo.py +368 -0
- package/.claude/hooks/track-changes.sh +101 -0
- package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
- package/.claude/hooks/validate-ontology-structure.py +518 -0
- package/.claude/skills/INDEX.md +1 -1
- package/.claude/skills/ontology/README.md +1 -1
- package/CLAUDE.md +105 -0
- package/dist/commands/agent.d.ts +18 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +271 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-detection.d.ts +19 -0
- package/dist/lib/agent-detection.d.ts.map +1 -0
- package/dist/lib/agent-detection.js +87 -0
- package/dist/lib/agent-detection.js.map +1 -0
- package/dist/lib/detect.d.ts +45 -0
- package/dist/lib/detect.d.ts.map +1 -0
- package/dist/lib/detect.js +221 -0
- package/dist/lib/detect.js.map +1 -0
- package/llms.txt +257 -0
- package/one/knowledge/games-english.md +691 -0
- package/one/knowledge/games.md +1082 -0
- package/one/things/plans/npx-agent-safety.md +785 -0
- package/one/things/plans/npx-agent.md +1089 -0
- package/one/things/plans/remove-backend-development-from-agents.md +1331 -0
- package/package.json +3 -2
- package/.claude/commands/mcp-toggle.md +0 -93
- package/.claude/commands/npx.md +0 -84
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Ontology Structure Validator for ONE Platform
|
|
4
|
+
Ensures all files in /one follow the 6-dimension ontology structure
|
|
5
|
+
|
|
6
|
+
The 6-Dimension Ontology:
|
|
7
|
+
1. groups - Hierarchical containers (friend circles → governments)
|
|
8
|
+
2. people - Authorization & governance (who can do what)
|
|
9
|
+
3. things - All entities (66 types: user, agent, content, etc.)
|
|
10
|
+
4. connections - All relationships (25 types: owns, purchased, etc.)
|
|
11
|
+
5. events - All actions (67 types: created, updated, logged, etc.)
|
|
12
|
+
6. knowledge - AI understanding (embeddings, search, RAG)
|
|
13
|
+
|
|
14
|
+
Database Implementation (5 tables):
|
|
15
|
+
- groups table → groups dimension
|
|
16
|
+
- things table → things dimension (includes people as type: 'creator')
|
|
17
|
+
- connections table → connections dimension
|
|
18
|
+
- events table → events dimension
|
|
19
|
+
- knowledge table → knowledge dimension
|
|
20
|
+
|
|
21
|
+
Directory Structure:
|
|
22
|
+
/one/
|
|
23
|
+
groups/ - Group definitions and hierarchies
|
|
24
|
+
people/ - Roles, governance, organization (people are things with role metadata)
|
|
25
|
+
things/ - Entity specifications, plans, agent definitions
|
|
26
|
+
connections/ - Protocols, workflows, integrations
|
|
27
|
+
events/ - Deployment plans, release notes, test results
|
|
28
|
+
knowledge/ - Architecture, patterns, rules, guides
|
|
29
|
+
"""
|
|
30
|
+
import json
|
|
31
|
+
import sys
|
|
32
|
+
import os
|
|
33
|
+
import re
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
|
|
36
|
+
# ONE Platform 6-Dimension Ontology
|
|
37
|
+
VALID_DIMENSIONS = {
|
|
38
|
+
"groups": {
|
|
39
|
+
"aliases": ["groups", "group"],
|
|
40
|
+
"description": "Hierarchical containers - friend circles → DAOs → governments",
|
|
41
|
+
"example_files": ["groups.md", "revenue.md", "vision.md", "strategy.md", "features.md"]
|
|
42
|
+
},
|
|
43
|
+
"people": {
|
|
44
|
+
"aliases": ["people", "person"],
|
|
45
|
+
"description": "Authorization & governance - roles, permissions, organization",
|
|
46
|
+
"example_files": ["people.md", "roles.md", "governance.md", "team.md"],
|
|
47
|
+
"note": "People are stored as things (type: 'creator') with role metadata"
|
|
48
|
+
},
|
|
49
|
+
"things": {
|
|
50
|
+
"aliases": ["things", "thing"],
|
|
51
|
+
"description": "All entities - users, agents, content, tokens, courses (66 types)",
|
|
52
|
+
"example_files": ["agents/", "plans/", "specifications/", "components.md"],
|
|
53
|
+
"types": [
|
|
54
|
+
# Core (People as Things)
|
|
55
|
+
"creator", "ai_clone", "audience_member", "organization",
|
|
56
|
+
# Business Agents
|
|
57
|
+
"strategy_agent", "research_agent", "marketing_agent", "sales_agent",
|
|
58
|
+
"service_agent", "design_agent", "engineering_agent", "finance_agent",
|
|
59
|
+
"legal_agent", "intelligence_agent",
|
|
60
|
+
# Content
|
|
61
|
+
"blog_post", "video", "podcast", "social_post", "email", "course", "lesson",
|
|
62
|
+
# Products
|
|
63
|
+
"digital_product", "membership", "consultation", "nft",
|
|
64
|
+
# Community
|
|
65
|
+
"community", "conversation", "message",
|
|
66
|
+
# Token
|
|
67
|
+
"token", "token_contract",
|
|
68
|
+
# Knowledge
|
|
69
|
+
"knowledge_item", "embedding",
|
|
70
|
+
# Platform
|
|
71
|
+
"website", "landing_page", "template", "livestream", "recording", "media_asset",
|
|
72
|
+
# Business
|
|
73
|
+
"payment", "subscription", "invoice", "metric", "insight", "prediction", "report",
|
|
74
|
+
# Auth Session
|
|
75
|
+
"session", "oauth_account", "verification_token", "password_reset_token",
|
|
76
|
+
# UI Preferences
|
|
77
|
+
"ui_preferences",
|
|
78
|
+
# Marketing
|
|
79
|
+
"notification", "email_campaign", "announcement", "referral", "campaign", "lead",
|
|
80
|
+
# External
|
|
81
|
+
"external_agent", "external_workflow", "external_connection",
|
|
82
|
+
# Protocol
|
|
83
|
+
"mandate", "product",
|
|
84
|
+
# Workflow
|
|
85
|
+
"idea", "plan", "feature", "test", "design", "task", "lesson"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"connections": {
|
|
89
|
+
"aliases": ["connections", "connection"],
|
|
90
|
+
"description": "All relationships - owns, purchased, enrolled_in (25 types)",
|
|
91
|
+
"example_files": ["protocols.md", "workflow.md", "integrations/", "patterns.md"],
|
|
92
|
+
"types": [
|
|
93
|
+
# Ownership
|
|
94
|
+
"owns", "created_by",
|
|
95
|
+
# AI Relationships
|
|
96
|
+
"clone_of", "trained_on", "powers",
|
|
97
|
+
# Content Relationships
|
|
98
|
+
"authored", "generated_by", "published_to", "part_of", "references",
|
|
99
|
+
# Community Relationships
|
|
100
|
+
"member_of", "following", "moderates", "participated_in",
|
|
101
|
+
# Business Relationships
|
|
102
|
+
"manages", "reports_to", "collaborates_with",
|
|
103
|
+
# Token Relationships
|
|
104
|
+
"holds_tokens", "staked_in", "earned_from",
|
|
105
|
+
# Product Relationships
|
|
106
|
+
"purchased", "enrolled_in", "completed", "teaching",
|
|
107
|
+
# Consolidated (7 connection families)
|
|
108
|
+
"transacted", "notified", "referred", "communicated", "delegated", "approved", "fulfilled"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"events": {
|
|
112
|
+
"aliases": ["events", "event"],
|
|
113
|
+
"description": "All actions - created, updated, purchased, completed (67 types)",
|
|
114
|
+
"example_files": ["deployment/", "releases/", "test-results/", "agent-summaries/"],
|
|
115
|
+
"types": [
|
|
116
|
+
# Entity Lifecycle
|
|
117
|
+
"entity_created", "entity_updated", "entity_deleted", "entity_archived",
|
|
118
|
+
# User Events
|
|
119
|
+
"user_registered", "user_verified", "user_login", "user_logout", "profile_updated",
|
|
120
|
+
# Authentication Events
|
|
121
|
+
"password_reset_requested", "password_reset_completed",
|
|
122
|
+
"email_verification_sent", "email_verified",
|
|
123
|
+
"two_factor_enabled", "two_factor_disabled",
|
|
124
|
+
# Organization Events
|
|
125
|
+
"organization_created", "organization_updated",
|
|
126
|
+
"user_invited_to_org", "user_joined_org", "user_removed_from_org",
|
|
127
|
+
# Dashboard UI Events
|
|
128
|
+
"dashboard_viewed", "settings_updated", "theme_changed", "preferences_updated",
|
|
129
|
+
# AI Clone Events
|
|
130
|
+
"clone_created", "clone_updated", "voice_cloned", "appearance_cloned",
|
|
131
|
+
# Agent Events
|
|
132
|
+
"agent_created", "agent_executed", "agent_completed", "agent_failed",
|
|
133
|
+
# Token Events
|
|
134
|
+
"token_created", "token_minted", "token_burned",
|
|
135
|
+
"tokens_purchased", "tokens_staked", "tokens_unstaked", "tokens_transferred",
|
|
136
|
+
# Course Events
|
|
137
|
+
"course_created", "course_enrolled", "lesson_completed", "course_completed", "certificate_earned",
|
|
138
|
+
# Analytics Events
|
|
139
|
+
"metric_calculated", "insight_generated", "prediction_made", "optimization_applied", "report_generated",
|
|
140
|
+
# Cycle Events
|
|
141
|
+
"cycle_request", "cycle_completed", "cycle_failed",
|
|
142
|
+
"cycle_quota_exceeded", "cycle_revenue_collected",
|
|
143
|
+
"org_revenue_generated", "revenue_share_distributed",
|
|
144
|
+
# Blockchain Events
|
|
145
|
+
"nft_minted", "nft_transferred", "tokens_bridged", "contract_deployed", "treasury_withdrawal",
|
|
146
|
+
# Consolidated Events (protocol-specific via metadata.protocol)
|
|
147
|
+
"content_event", "payment_event", "subscription_event", "commerce_event",
|
|
148
|
+
"livestream_event", "notification_event", "referral_event",
|
|
149
|
+
"communication_event", "task_event", "mandate_event", "price_event",
|
|
150
|
+
# Workflow Events
|
|
151
|
+
"plan_started", "feature_assigned", "tasks_created",
|
|
152
|
+
"feature_started", "implementation_complete", "task_started", "task_completed",
|
|
153
|
+
"quality_check_started", "quality_check_complete", "test_started", "test_passed", "test_failed",
|
|
154
|
+
"problem_analysis_started", "solution_proposed", "fix_started", "fix_complete",
|
|
155
|
+
"documentation_started", "documentation_complete", "lesson_learned_added",
|
|
156
|
+
"feature_complete", "plan_complete"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"knowledge": {
|
|
160
|
+
"aliases": ["knowledge"],
|
|
161
|
+
"description": "AI understanding - embeddings, search, RAG (labels, chunks, vectors)",
|
|
162
|
+
"example_files": ["ontology.md", "architecture.md", "patterns/", "rules.md", "guides/"],
|
|
163
|
+
"types": ["label", "document", "chunk", "vector_only"]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
# Expected directory structure for /one
|
|
168
|
+
EXPECTED_STRUCTURE = {
|
|
169
|
+
"groups": "Group definitions, hierarchies, vision, strategy, revenue",
|
|
170
|
+
"people": "Roles, governance, team structure, organization (people are things with type: 'creator')",
|
|
171
|
+
"things": "Entity specifications, agent definitions, plans, components",
|
|
172
|
+
"connections": "Protocols, workflows, integrations, relationships, patterns",
|
|
173
|
+
"events": "Deployment plans, release notes, test results, agent execution summaries",
|
|
174
|
+
"knowledge": "Architecture docs, implementation guides, patterns, rules, tutorials"
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
# Protocol identifiers that should be in metadata
|
|
178
|
+
PROTOCOLS = ["a2a", "acp", "ap2", "x402", "ag-ui"]
|
|
179
|
+
|
|
180
|
+
def get_dimension_from_path(file_path):
|
|
181
|
+
"""Extract dimension from file path"""
|
|
182
|
+
parts = Path(file_path).parts
|
|
183
|
+
|
|
184
|
+
# Find 'one' in path and get next part
|
|
185
|
+
try:
|
|
186
|
+
one_index = parts.index('one')
|
|
187
|
+
if one_index + 1 < len(parts):
|
|
188
|
+
return parts[one_index + 1]
|
|
189
|
+
except ValueError:
|
|
190
|
+
return None
|
|
191
|
+
|
|
192
|
+
return None
|
|
193
|
+
|
|
194
|
+
def normalize_dimension(dimension):
|
|
195
|
+
"""Normalize dimension name to canonical form"""
|
|
196
|
+
if not dimension:
|
|
197
|
+
return None
|
|
198
|
+
|
|
199
|
+
dimension_lower = dimension.lower()
|
|
200
|
+
|
|
201
|
+
for canonical, config in VALID_DIMENSIONS.items():
|
|
202
|
+
if dimension_lower in [alias.lower() for alias in config["aliases"]]:
|
|
203
|
+
return canonical
|
|
204
|
+
|
|
205
|
+
return None
|
|
206
|
+
|
|
207
|
+
def to_kebab_case(filename):
|
|
208
|
+
"""Convert filename to kebab-case"""
|
|
209
|
+
# Split filename and extension
|
|
210
|
+
name, ext = os.path.splitext(filename)
|
|
211
|
+
|
|
212
|
+
# Convert to lowercase
|
|
213
|
+
name = name.lower()
|
|
214
|
+
|
|
215
|
+
# Replace spaces, underscores, and multiple hyphens with single hyphen
|
|
216
|
+
name = re.sub(r'[_\s]+', '-', name)
|
|
217
|
+
name = re.sub(r'-+', '-', name)
|
|
218
|
+
|
|
219
|
+
# Remove leading/trailing hyphens
|
|
220
|
+
name = name.strip('-')
|
|
221
|
+
|
|
222
|
+
# Keep extension lowercase
|
|
223
|
+
ext = ext.lower()
|
|
224
|
+
|
|
225
|
+
return name + ext
|
|
226
|
+
|
|
227
|
+
def validate_file_path(file_path):
|
|
228
|
+
"""Validate that file path follows ontology structure"""
|
|
229
|
+
issues = []
|
|
230
|
+
|
|
231
|
+
# Check if file is in /one directory
|
|
232
|
+
if '/one/' not in file_path:
|
|
233
|
+
return issues # Not in /one, skip validation
|
|
234
|
+
|
|
235
|
+
# Allow certain root-level files in /one
|
|
236
|
+
parts = Path(file_path).parts
|
|
237
|
+
try:
|
|
238
|
+
one_index = parts.index('one')
|
|
239
|
+
# If this is a direct child of /one (not in a subdirectory)
|
|
240
|
+
if one_index + 2 == len(parts):
|
|
241
|
+
# Allow specific root-level files
|
|
242
|
+
allowed_root_files = ['LICENSE.md', 'README.md', 'CONTRIBUTING.md', 'CHANGELOG.md', '.gitignore']
|
|
243
|
+
filename = Path(file_path).name
|
|
244
|
+
if filename in allowed_root_files:
|
|
245
|
+
return issues # Valid root-level file
|
|
246
|
+
except ValueError:
|
|
247
|
+
pass
|
|
248
|
+
|
|
249
|
+
# Extract dimension from path
|
|
250
|
+
dimension = get_dimension_from_path(file_path)
|
|
251
|
+
|
|
252
|
+
if not dimension:
|
|
253
|
+
issues.append("File is in /one but not in a dimension directory")
|
|
254
|
+
return issues
|
|
255
|
+
|
|
256
|
+
# Normalize and validate dimension
|
|
257
|
+
canonical_dimension = normalize_dimension(dimension)
|
|
258
|
+
|
|
259
|
+
if not canonical_dimension:
|
|
260
|
+
valid_dims = []
|
|
261
|
+
for dim_config in VALID_DIMENSIONS.values():
|
|
262
|
+
valid_dims.extend(dim_config["aliases"])
|
|
263
|
+
issues.append(
|
|
264
|
+
f"Invalid dimension '{dimension}'. Must be one of: {', '.join(valid_dims)}"
|
|
265
|
+
)
|
|
266
|
+
return issues
|
|
267
|
+
|
|
268
|
+
# Check file extension
|
|
269
|
+
valid_extensions = ['.md', '.yaml', '.yml', '.json']
|
|
270
|
+
if not any(file_path.endswith(ext) for ext in valid_extensions):
|
|
271
|
+
issues.append(
|
|
272
|
+
f"Invalid file extension. Files in /one must be: {', '.join(valid_extensions)}"
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
# Check for valid naming conventions
|
|
276
|
+
filename = Path(file_path).name
|
|
277
|
+
|
|
278
|
+
# Files should use kebab-case
|
|
279
|
+
if not re.match(r'^[a-z0-9]+(-[a-z0-9]+)*\.(md|yaml|yml|json)$', filename):
|
|
280
|
+
correct_name = to_kebab_case(filename)
|
|
281
|
+
issues.append(
|
|
282
|
+
f"Filename '{filename}' should use kebab-case (lowercase with hyphens). Suggested: '{correct_name}'"
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
return issues
|
|
286
|
+
|
|
287
|
+
def validate_file_content(file_path, content=None):
|
|
288
|
+
"""Validate file content follows ontology patterns"""
|
|
289
|
+
issues = []
|
|
290
|
+
|
|
291
|
+
# Only validate markdown files
|
|
292
|
+
if not file_path.endswith('.md'):
|
|
293
|
+
return issues
|
|
294
|
+
|
|
295
|
+
# Read content if not provided
|
|
296
|
+
if content is None:
|
|
297
|
+
try:
|
|
298
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
299
|
+
content = f.read()
|
|
300
|
+
except Exception as e:
|
|
301
|
+
issues.append(f"Could not read file: {e}")
|
|
302
|
+
return issues
|
|
303
|
+
|
|
304
|
+
dimension = normalize_dimension(get_dimension_from_path(file_path))
|
|
305
|
+
|
|
306
|
+
if not dimension:
|
|
307
|
+
return issues
|
|
308
|
+
|
|
309
|
+
# Check for dimension-specific patterns
|
|
310
|
+
if dimension == "things":
|
|
311
|
+
# Things should reference type
|
|
312
|
+
config = VALID_DIMENSIONS["things"]
|
|
313
|
+
if "type:" in content.lower() or "## type" in content.lower():
|
|
314
|
+
# Extract type mentions
|
|
315
|
+
type_pattern = r'\btype:\s*(\w+)'
|
|
316
|
+
types_found = re.findall(type_pattern, content, re.IGNORECASE)
|
|
317
|
+
|
|
318
|
+
for found_type in types_found:
|
|
319
|
+
if found_type not in config.get("types", []):
|
|
320
|
+
issues.append(
|
|
321
|
+
f"Unknown thing type '{found_type}'. "
|
|
322
|
+
f"Must be one of the 66 defined thing types"
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
elif dimension == "connections":
|
|
326
|
+
# Connections should reference relationship types
|
|
327
|
+
config = VALID_DIMENSIONS["connections"]
|
|
328
|
+
if "relationship" in content.lower() or "type:" in content.lower():
|
|
329
|
+
# Look for relationship type mentions
|
|
330
|
+
for rel_type in config.get("types", []):
|
|
331
|
+
if rel_type in content.lower():
|
|
332
|
+
break
|
|
333
|
+
else:
|
|
334
|
+
# No valid relationship type found, might be okay
|
|
335
|
+
pass
|
|
336
|
+
|
|
337
|
+
elif dimension == "events":
|
|
338
|
+
# Events should reference event types
|
|
339
|
+
config = VALID_DIMENSIONS["events"]
|
|
340
|
+
if "type:" in content.lower() or "event:" in content.lower():
|
|
341
|
+
# Look for event type mentions
|
|
342
|
+
for event_type in config.get("types", []):
|
|
343
|
+
if event_type in content.lower():
|
|
344
|
+
break
|
|
345
|
+
else:
|
|
346
|
+
# No valid event type found, might be okay
|
|
347
|
+
pass
|
|
348
|
+
|
|
349
|
+
# Check for protocol references
|
|
350
|
+
protocol_mentions = []
|
|
351
|
+
for protocol in PROTOCOLS:
|
|
352
|
+
if protocol.lower() in content.lower():
|
|
353
|
+
protocol_mentions.append(protocol)
|
|
354
|
+
|
|
355
|
+
if protocol_mentions and "metadata.protocol" not in content.lower():
|
|
356
|
+
issues.append(
|
|
357
|
+
f"Protocol references found ({', '.join(protocol_mentions)}) "
|
|
358
|
+
f"but no 'metadata.protocol' field mentioned. "
|
|
359
|
+
f"Protocols should be stored in metadata.protocol field"
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
return issues
|
|
363
|
+
|
|
364
|
+
def auto_fix_filename(file_path):
|
|
365
|
+
"""Automatically fix filename to kebab-case if needed"""
|
|
366
|
+
filename = Path(file_path).name
|
|
367
|
+
|
|
368
|
+
# Check if filename needs fixing
|
|
369
|
+
if re.match(r'^[a-z0-9]+(-[a-z0-9]+)*\.(md|yaml|yml|json)$', filename):
|
|
370
|
+
return None # Already valid
|
|
371
|
+
|
|
372
|
+
# Generate correct filename
|
|
373
|
+
correct_name = to_kebab_case(filename)
|
|
374
|
+
|
|
375
|
+
if correct_name == filename:
|
|
376
|
+
return None # No change needed
|
|
377
|
+
|
|
378
|
+
# Build new path
|
|
379
|
+
directory = os.path.dirname(file_path)
|
|
380
|
+
new_path = os.path.join(directory, correct_name)
|
|
381
|
+
|
|
382
|
+
# Rename the file
|
|
383
|
+
try:
|
|
384
|
+
if os.path.exists(file_path):
|
|
385
|
+
os.rename(file_path, new_path)
|
|
386
|
+
return {
|
|
387
|
+
'old_name': filename,
|
|
388
|
+
'new_name': correct_name,
|
|
389
|
+
'old_path': file_path,
|
|
390
|
+
'new_path': new_path
|
|
391
|
+
}
|
|
392
|
+
except Exception as e:
|
|
393
|
+
return {'error': str(e)}
|
|
394
|
+
|
|
395
|
+
return None
|
|
396
|
+
|
|
397
|
+
def main():
|
|
398
|
+
"""Main hook execution"""
|
|
399
|
+
try:
|
|
400
|
+
# Read hook input from stdin
|
|
401
|
+
hook_input = json.load(sys.stdin)
|
|
402
|
+
|
|
403
|
+
hook_event = hook_input.get("hook_event_name")
|
|
404
|
+
tool_name = hook_input.get("tool_name")
|
|
405
|
+
tool_input = hook_input.get("tool_input", {})
|
|
406
|
+
|
|
407
|
+
# Only validate Edit and Write operations
|
|
408
|
+
if tool_name not in ["Edit", "Write", "MultiEdit"]:
|
|
409
|
+
sys.exit(0)
|
|
410
|
+
|
|
411
|
+
file_path = tool_input.get("file_path")
|
|
412
|
+
if not file_path:
|
|
413
|
+
sys.exit(0)
|
|
414
|
+
|
|
415
|
+
# Skip validation for non-/one files
|
|
416
|
+
if '/one/' not in file_path:
|
|
417
|
+
sys.exit(0)
|
|
418
|
+
|
|
419
|
+
# For PostToolUse, try to auto-fix filename first
|
|
420
|
+
if hook_event == "PostToolUse":
|
|
421
|
+
fix_result = auto_fix_filename(file_path)
|
|
422
|
+
if fix_result:
|
|
423
|
+
if 'error' in fix_result:
|
|
424
|
+
print(f"⚠️ Could not auto-fix filename: {fix_result['error']}", file=sys.stderr)
|
|
425
|
+
else:
|
|
426
|
+
print(f"🔧 Auto-fixed filename: '{fix_result['old_name']}' → '{fix_result['new_name']}'")
|
|
427
|
+
# Update file_path for subsequent validation
|
|
428
|
+
file_path = fix_result['new_path']
|
|
429
|
+
|
|
430
|
+
issues = []
|
|
431
|
+
|
|
432
|
+
# Validate file path structure
|
|
433
|
+
path_issues = validate_file_path(file_path)
|
|
434
|
+
issues.extend(path_issues)
|
|
435
|
+
|
|
436
|
+
# For PostToolUse, also validate content
|
|
437
|
+
if hook_event == "PostToolUse":
|
|
438
|
+
content = tool_input.get("content") or tool_input.get("new_string")
|
|
439
|
+
content_issues = validate_file_content(file_path, content)
|
|
440
|
+
issues.extend(content_issues)
|
|
441
|
+
|
|
442
|
+
if issues:
|
|
443
|
+
# Build error message
|
|
444
|
+
dimension = get_dimension_from_path(file_path)
|
|
445
|
+
canonical = normalize_dimension(dimension)
|
|
446
|
+
|
|
447
|
+
error_msg = f"⚠️ Ontology Validation Failed for {file_path}\n\n"
|
|
448
|
+
error_msg += "Issues found:\n"
|
|
449
|
+
for i, issue in enumerate(issues, 1):
|
|
450
|
+
error_msg += f"{i}. {issue}\n"
|
|
451
|
+
|
|
452
|
+
error_msg += f"\n{'='*70}\n"
|
|
453
|
+
error_msg += "ONE Platform - 6-Dimension Ontology Structure\n"
|
|
454
|
+
error_msg += f"{'='*70}\n\n"
|
|
455
|
+
error_msg += "Files in /one MUST be organized by these 6 dimensions:\n\n"
|
|
456
|
+
|
|
457
|
+
for dim_name, dim_config in VALID_DIMENSIONS.items():
|
|
458
|
+
error_msg += f"📁 /one/{dim_name}/\n"
|
|
459
|
+
error_msg += f" {dim_config['description']}\n"
|
|
460
|
+
|
|
461
|
+
if dim_config.get('example_files'):
|
|
462
|
+
error_msg += f" Examples: {', '.join(dim_config['example_files'][:3])}\n"
|
|
463
|
+
|
|
464
|
+
if dim_config.get('types'):
|
|
465
|
+
count = len(dim_config['types'])
|
|
466
|
+
error_msg += f" ({count} defined types in schema)\n"
|
|
467
|
+
|
|
468
|
+
if dim_config.get('note'):
|
|
469
|
+
error_msg += f" Note: {dim_config['note']}\n"
|
|
470
|
+
|
|
471
|
+
error_msg += "\n"
|
|
472
|
+
|
|
473
|
+
error_msg += f"Current file location: {file_path}\n"
|
|
474
|
+
if dimension:
|
|
475
|
+
error_msg += f"Detected dimension: {dimension}"
|
|
476
|
+
if canonical and canonical != dimension:
|
|
477
|
+
error_msg += f" (normalized to: {canonical})"
|
|
478
|
+
error_msg += "\n"
|
|
479
|
+
|
|
480
|
+
error_msg += f"\n{'='*70}\n"
|
|
481
|
+
error_msg += "Database Implementation (5 tables):\n"
|
|
482
|
+
error_msg += "• groups table → groups dimension\n"
|
|
483
|
+
error_msg += "• things table → things + people dimensions (people have type: 'creator')\n"
|
|
484
|
+
error_msg += "• connections table → connections dimension\n"
|
|
485
|
+
error_msg += "• events table → events dimension\n"
|
|
486
|
+
error_msg += "• knowledge table → knowledge dimension\n"
|
|
487
|
+
error_msg += f"{'='*70}\n"
|
|
488
|
+
|
|
489
|
+
# For PreToolUse, block with exit code 2
|
|
490
|
+
if hook_event == "PreToolUse":
|
|
491
|
+
print(error_msg, file=sys.stderr)
|
|
492
|
+
sys.exit(2) # Block the operation
|
|
493
|
+
else:
|
|
494
|
+
# For PostToolUse, just warn
|
|
495
|
+
print(error_msg, file=sys.stdout)
|
|
496
|
+
sys.exit(0)
|
|
497
|
+
|
|
498
|
+
# Success - show dimension info
|
|
499
|
+
dimension = get_dimension_from_path(file_path)
|
|
500
|
+
canonical = normalize_dimension(dimension)
|
|
501
|
+
|
|
502
|
+
if canonical:
|
|
503
|
+
success_msg = f"✅ Ontology structure validated: {canonical}/"
|
|
504
|
+
dim_config = VALID_DIMENSIONS[canonical]
|
|
505
|
+
success_msg += f" - {dim_config['description']}"
|
|
506
|
+
print(success_msg)
|
|
507
|
+
|
|
508
|
+
sys.exit(0)
|
|
509
|
+
|
|
510
|
+
except json.JSONDecodeError as e:
|
|
511
|
+
print(f"Error: Invalid JSON input: {e}", file=sys.stderr)
|
|
512
|
+
sys.exit(1)
|
|
513
|
+
except Exception as e:
|
|
514
|
+
print(f"Error validating ontology structure: {e}", file=sys.stderr)
|
|
515
|
+
sys.exit(1)
|
|
516
|
+
|
|
517
|
+
if __name__ == "__main__":
|
|
518
|
+
main()
|
package/.claude/skills/INDEX.md
CHANGED
|
@@ -244,7 +244,7 @@ Generate design tokens from brand guidelines:
|
|
|
244
244
|
### Director Agent Skills (Planned)
|
|
245
245
|
- `agent-director:plan-feature` - Feature planning and sequencing
|
|
246
246
|
- `agent-director:coordinate-agents` - Agent orchestration
|
|
247
|
-
- `agent-director:manage-
|
|
247
|
+
- `agent-director:manage-cycle` - Cycle workflow management
|
|
248
248
|
|
|
249
249
|
### Operations Agent Skills (Planned)
|
|
250
250
|
- `agent-ops:deploy-web` - Cloudflare Pages deployment
|
|
@@ -228,7 +228,7 @@ If creating custom entity or connection types, document in ontology.
|
|
|
228
228
|
|
|
229
229
|
### v1.2.0 (Planned)
|
|
230
230
|
- ML-based entity type suggestions
|
|
231
|
-
- Relationship
|
|
231
|
+
- Relationship cycle from descriptions
|
|
232
232
|
- Schema optimization recommendations
|
|
233
233
|
|
|
234
234
|
## Contributing
|
package/CLAUDE.md
CHANGED
|
@@ -384,6 +384,111 @@ bun run lint
|
|
|
384
384
|
bun run format
|
|
385
385
|
```
|
|
386
386
|
|
|
387
|
+
## Frontend-First Development (Default Mode)
|
|
388
|
+
|
|
389
|
+
**CRITICAL:** All agents default to frontend-only development unless explicitly requested otherwise.
|
|
390
|
+
|
|
391
|
+
### Default Behavior
|
|
392
|
+
|
|
393
|
+
**Frontend-only is the DEFAULT for ALL agents across the platform.**
|
|
394
|
+
|
|
395
|
+
When building features, agents MUST:
|
|
396
|
+
1. Build ONLY frontend code by default
|
|
397
|
+
2. Use client-side state management (nanostores)
|
|
398
|
+
3. Integrate third-party services via direct API calls (Stripe.js, OpenAI client SDK, etc.)
|
|
399
|
+
4. Store data in browser (localStorage, IndexedDB) or third-party services
|
|
400
|
+
5. NEVER create backend code unless explicitly requested
|
|
401
|
+
|
|
402
|
+
### When Backend is NOT Needed
|
|
403
|
+
|
|
404
|
+
Frontend-only works perfectly for:
|
|
405
|
+
|
|
406
|
+
- **Ecommerce stores**: Stripe.js handles payments, no backend needed
|
|
407
|
+
- **LMS platforms**: Content in Astro pages, progress in localStorage
|
|
408
|
+
- **SaaS tools**: Third-party APIs (OpenAI, Anthropic, Stripe) via client SDKs
|
|
409
|
+
- **Marketing sites**: Static pages with forms, analytics, chat widgets
|
|
410
|
+
- **Documentation sites**: Content collections with search
|
|
411
|
+
- **Landing pages**: Interactive demos, forms, newsletters
|
|
412
|
+
- **Portfolio sites**: Projects, case studies, contact forms
|
|
413
|
+
- **Blogs**: Content collections with comments (Giscus, Utterances)
|
|
414
|
+
|
|
415
|
+
### Frontend Stack (Default Tools)
|
|
416
|
+
|
|
417
|
+
Use these tools for frontend-only development:
|
|
418
|
+
|
|
419
|
+
- **State Management**: nanostores (persistent atoms, maps, computed)
|
|
420
|
+
- **UI Components**: React 19 + shadcn/ui (50+ accessible components)
|
|
421
|
+
- **Styling**: Tailwind CSS v4 (CSS-based configuration)
|
|
422
|
+
- **Pages**: Astro 5 (file-based routing, SSR, islands)
|
|
423
|
+
- **Forms**: React Hook Form + Zod validation
|
|
424
|
+
- **Data Fetching**: fetch API, SWR, React Query
|
|
425
|
+
- **Storage**: localStorage, sessionStorage, IndexedDB
|
|
426
|
+
- **Payments**: Stripe.js (client-side only)
|
|
427
|
+
- **Auth**: Better Auth (client-side hooks)
|
|
428
|
+
- **Analytics**: Plausible, Fathom (script tags)
|
|
429
|
+
|
|
430
|
+
### When to Use Backend
|
|
431
|
+
|
|
432
|
+
Backend is ONLY needed when user explicitly says:
|
|
433
|
+
|
|
434
|
+
1. **"Use backend"** - Direct request for backend integration
|
|
435
|
+
2. **"Add groups"** - Multi-tenant data isolation requires backend
|
|
436
|
+
3. **"Add multi-user"** - User collaboration requires backend
|
|
437
|
+
4. **"Track events"** - Immutable audit trail requires backend
|
|
438
|
+
5. **"Build RAG"** - Vector embeddings require backend
|
|
439
|
+
6. **"Real-time updates"** - WebSocket sync requires backend
|
|
440
|
+
|
|
441
|
+
### Backend Integration (Only When Requested)
|
|
442
|
+
|
|
443
|
+
If user explicitly requests backend, integrate via:
|
|
444
|
+
|
|
445
|
+
- **Services Layer**: `/web/src/services/` - Business logic and API wrappers
|
|
446
|
+
- **Providers Layer**: `/web/src/providers/` - React context for state management
|
|
447
|
+
- **Convex Client**: `useQuery` and `useMutation` hooks for backend calls
|
|
448
|
+
- **API Routes**: `/web/src/pages/api/` for serverless functions
|
|
449
|
+
|
|
450
|
+
Example structure when backend is explicitly requested:
|
|
451
|
+
|
|
452
|
+
```typescript
|
|
453
|
+
// /web/src/services/products.ts
|
|
454
|
+
import { ConvexHttpClient } from "convex/browser";
|
|
455
|
+
import { api } from "@/convex/_generated/api";
|
|
456
|
+
|
|
457
|
+
const client = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
|
|
458
|
+
|
|
459
|
+
export const productService = {
|
|
460
|
+
list: () => client.query(api.queries.products.list),
|
|
461
|
+
create: (data) => client.mutation(api.mutations.products.create, data),
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
// /web/src/providers/ProductProvider.tsx
|
|
465
|
+
import { createContext, useContext } from "react";
|
|
466
|
+
import { useQuery } from "convex/react";
|
|
467
|
+
import { api } from "@/convex/_generated/api";
|
|
468
|
+
|
|
469
|
+
const ProductContext = createContext(null);
|
|
470
|
+
|
|
471
|
+
export const ProductProvider = ({ children }) => {
|
|
472
|
+
const products = useQuery(api.queries.products.list);
|
|
473
|
+
return <ProductContext.Provider value={{ products }}>{children}</ProductContext.Provider>;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
export const useProducts = () => useContext(ProductContext);
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### Golden Rule
|
|
480
|
+
|
|
481
|
+
**Default to frontend-only. Only add backend when explicitly requested.**
|
|
482
|
+
|
|
483
|
+
- ✅ User says "build ecommerce store" → Frontend-only with Stripe.js
|
|
484
|
+
- ✅ User says "build ecommerce store with groups" → Add backend for multi-tenancy
|
|
485
|
+
- ✅ User says "build LMS" → Frontend-only with content collections
|
|
486
|
+
- ✅ User says "build LMS with real-time progress" → Add backend for events
|
|
487
|
+
- ✅ User says "add payments" → Frontend-only with Stripe.js
|
|
488
|
+
- ✅ User says "add payments and track events" → Add backend for event logging
|
|
489
|
+
|
|
490
|
+
**When in doubt, ask:** "Do you need multi-user groups, or can this work as a single-user frontend-only app?"
|
|
491
|
+
|
|
387
492
|
### Backend Development
|
|
388
493
|
|
|
389
494
|
```bash
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Command - Non-interactive ONE Platform setup
|
|
3
|
+
*
|
|
4
|
+
* Designed for AI agents (Claude Code, Cursor, etc.) and CI/CD environments.
|
|
5
|
+
* Zero interaction required - auto-detects context and completes setup in 5-10 seconds.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentOptions {
|
|
8
|
+
quiet?: boolean;
|
|
9
|
+
verbose?: boolean;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
skipWeb?: boolean;
|
|
12
|
+
basePath?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Runs the agent command (non-interactive setup)
|
|
16
|
+
*/
|
|
17
|
+
export declare function runAgent(options?: AgentOptions): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwRxE"}
|