oneie 3.6.17 → 3.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.claude/agents/agent-ops.md +63 -2
  2. package/.claude/commands/commit.md +95 -0
  3. package/.claude/commands/npx.md +2 -2
  4. package/.claude/commands/one.md +7 -1
  5. package/.claude/commands/push.md +113 -21
  6. package/.claude/commands/release.md +2 -2
  7. package/.claude/hooks/release-cli.sh +195 -0
  8. package/CLAUDE.md +119 -0
  9. package/README.md +778 -497
  10. package/package.json +1 -1
  11. package/.claude/agents/NEWS-QUICKSTART.md +0 -321
  12. package/.claude/agents/NEWS-README.md +0 -353
  13. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  14. package/.claude/hooks/README-root-cleanup.md +0 -200
  15. package/.claude/hooks/README.md +0 -284
  16. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  17. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  18. package/.claude/hooks/check-filenames.py +0 -177
  19. package/.claude/hooks/clean-post.py +0 -468
  20. package/.claude/hooks/clean-pre.py +0 -393
  21. package/.claude/hooks/clean-root-markdown.sh +0 -73
  22. package/.claude/hooks/done.py +0 -236
  23. package/.claude/hooks/format-hook.sh +0 -163
  24. package/.claude/hooks/hook-logger.sh +0 -173
  25. package/.claude/hooks/knowledge-post.py +0 -355
  26. package/.claude/hooks/knowledge-pre.py +0 -245
  27. package/.claude/hooks/notification-hook.sh +0 -279
  28. package/.claude/hooks/root-cleanup.py +0 -217
  29. package/.claude/hooks/security-hook.sh +0 -397
  30. package/.claude/hooks/tag-all-docs.py +0 -464
  31. package/.claude/hooks/test-validate-ontology.sh +0 -170
  32. package/.claude/hooks/todo.py +0 -368
  33. package/.claude/hooks/track-changes.sh +0 -101
  34. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  35. package/.claude/hooks/validate-ontology-structure.py +0 -518
  36. package/TESTING-ONBOARDING.md +0 -185
@@ -1,393 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- ONE Platform - Clean Agent Pre-Inference Hook
4
- Validates cleanliness and 6-dimension ontology compliance before starting each inference.
5
-
6
- This hook runs before UserPromptSubmit to ensure:
7
- - File structure is intact and ontology-aligned
8
- - Root directory only contains approved markdown files
9
- - All other docs are properly organized in /one/<dimension>/ directories
10
- - No orphaned files exist
11
- - Naming conventions are followed
12
- - Documentation is up to date
13
- - No uncommitted critical changes
14
- - Metadata tags are present on all docs
15
-
16
- 6-Dimension Ontology Structure:
17
- 1. groups - Hierarchical containers (multi-tenant isolation)
18
- 2. people - Authorization & governance (roles, permissions)
19
- 3. things - All entities (users, agents, content, tokens)
20
- 4. connections - Relationships between entities
21
- 5. events - Actions and state changes over time
22
- 6. knowledge - Labels, embeddings, semantic search
23
- """
24
- import json
25
- import sys
26
- import os
27
- from pathlib import Path
28
- from typing import Dict, Any, List, Tuple
29
- import subprocess
30
- import re
31
-
32
- # 6-dimension ontology directories (MUST exist)
33
- REQUIRED_DIRS = [
34
- "one/connections",
35
- "one/events",
36
- "one/knowledge",
37
- "one/things",
38
- "one/people",
39
- "one/groups",
40
- ".claude/hooks",
41
- ".claude/state",
42
- ]
43
-
44
- # Root directory: ONLY these markdown files are allowed
45
- ALLOWED_ROOT_MARKDOWN = {
46
- "README.md",
47
- "LICENSE.md",
48
- "SECURITY.md",
49
- "CLAUDE.md",
50
- "AGENTS.md",
51
- }
52
-
53
- # File naming conventions
54
- NAMING_PATTERNS = {
55
- ".md": r"^[a-z0-9\-]+\.md$", # kebab-case for markdown
56
- ".ts": r"^[a-z0-9\-]+\.ts$", # kebab-case for TypeScript
57
- ".tsx": r"^[A-Z][a-zA-Z0-9]+\.tsx$", # PascalCase for React components
58
- }
59
-
60
- # Files that should have metadata frontmatter
61
- METADATA_REQUIRED_PATTERNS = [
62
- "one/**/*.md",
63
- "CLAUDE.md",
64
- "AGENTS.md",
65
- "README.md",
66
- ]
67
-
68
-
69
- class CleanlinessValidator:
70
- def __init__(self, project_dir: str):
71
- self.project_dir = Path(project_dir)
72
- self.issues: List[Tuple[str, str]] = [] # (severity, message)
73
- self.warnings: List[str] = []
74
- self.metrics: Dict[str, Any] = {}
75
-
76
- def add_issue(self, severity: str, message: str):
77
- """Add a cleanliness issue"""
78
- self.issues.append((severity, message))
79
-
80
- def add_warning(self, message: str):
81
- """Add a warning"""
82
- self.warnings.append(message)
83
-
84
- def validate_directory_structure(self):
85
- """Check that all required 6-dimension ontology directories exist"""
86
- for dir_path in REQUIRED_DIRS:
87
- full_path = self.project_dir / dir_path
88
- if not full_path.exists():
89
- self.add_issue("error", f"Missing required ontology directory: {dir_path}")
90
- elif not full_path.is_dir():
91
- self.add_issue("error", f"Path exists but is not a directory: {dir_path}")
92
-
93
- def validate_root_directory_compliance(self):
94
- """Check that root directory only contains approved markdown files"""
95
- violations = []
96
-
97
- # Check all markdown files in root
98
- for md_file in self.project_dir.glob("*.md"):
99
- if md_file.name not in ALLOWED_ROOT_MARKDOWN:
100
- violations.append(md_file.name)
101
-
102
- if violations:
103
- self.add_issue(
104
- "error",
105
- f"Root directory contains {len(violations)} unauthorized markdown files. "
106
- f"Only {', '.join(sorted(ALLOWED_ROOT_MARKDOWN))} are allowed. "
107
- f"Move these to /one/<dimension>/: {', '.join(sorted(violations))}"
108
- )
109
- self.metrics["root_violations"] = len(violations)
110
- else:
111
- self.metrics["root_violations"] = 0
112
-
113
- def validate_ontology_dimensions(self):
114
- """Check that /one/ directory properly contains all 6 dimensions"""
115
- one_dir = self.project_dir / "one"
116
- if not one_dir.exists():
117
- self.add_issue("error", "Missing /one/ directory - ontology structure not found")
118
- return
119
-
120
- dimensions = ["groups", "people", "things", "connections", "events", "knowledge"]
121
- missing_dimensions = []
122
-
123
- for dimension in dimensions:
124
- dim_path = one_dir / dimension
125
- if not dim_path.exists():
126
- missing_dimensions.append(dimension)
127
-
128
- if missing_dimensions:
129
- self.add_issue(
130
- "error",
131
- f"Missing ontology dimensions in /one/: {', '.join(missing_dimensions)}. "
132
- f"The 6-dimension ontology requires all dimensions to be present."
133
- )
134
-
135
- # Check for unexpected top-level directories in /one/
136
- expected_dirs = set(dimensions)
137
- actual_dirs = {d.name for d in one_dir.iterdir() if d.is_dir() and not d.name.startswith(".")}
138
- unexpected = actual_dirs - expected_dirs
139
-
140
- if unexpected:
141
- self.add_warning(
142
- f"Unexpected directories in /one/: {', '.join(sorted(unexpected))}. "
143
- f"Only the 6 dimensions are expected: {', '.join(sorted(dimensions))}"
144
- )
145
-
146
- def validate_file_naming(self):
147
- """Check that files follow naming conventions"""
148
- problematic_files = []
149
-
150
- # Check markdown files in one/
151
- if (self.project_dir / "one").exists():
152
- for md_file in (self.project_dir / "one").rglob("*.md"):
153
- if not re.match(NAMING_PATTERNS[".md"], md_file.name):
154
- problematic_files.append(str(md_file.relative_to(self.project_dir)))
155
-
156
- if problematic_files:
157
- self.add_warning(f"Files not following kebab-case convention: {', '.join(problematic_files[:5])}")
158
- if len(problematic_files) > 5:
159
- self.add_warning(f"... and {len(problematic_files) - 5} more")
160
-
161
- def find_orphaned_files(self):
162
- """Find files that don't belong anywhere"""
163
- orphans = []
164
-
165
- # Check for common temporary/generated files
166
- temp_patterns = ["*.tmp", "*.swp", "*.bak", "*.DS_Store", "*~"]
167
- for pattern in temp_patterns:
168
- for temp_file in self.project_dir.rglob(pattern):
169
- # Skip node_modules and .git
170
- if "node_modules" not in str(temp_file) and ".git" not in str(temp_file):
171
- orphans.append(str(temp_file.relative_to(self.project_dir)))
172
-
173
- if orphans:
174
- self.add_warning(f"Found {len(orphans)} temporary/backup files that should be cleaned")
175
- for orphan in orphans[:3]:
176
- self.add_warning(f" - {orphan}")
177
-
178
- def check_metadata_tags(self):
179
- """Check that documentation files have metadata frontmatter"""
180
- missing_metadata = []
181
-
182
- # Check markdown files in one/
183
- for md_file in (self.project_dir / "one").rglob("*.md"):
184
- try:
185
- content = md_file.read_text()
186
- # Check for YAML frontmatter
187
- if not content.startswith("---\n"):
188
- missing_metadata.append(str(md_file.relative_to(self.project_dir)))
189
- else:
190
- # Validate frontmatter has required fields
191
- frontmatter_end = content.find("\n---\n", 4)
192
- if frontmatter_end == -1:
193
- missing_metadata.append(str(md_file.relative_to(self.project_dir)))
194
- except Exception:
195
- pass # Skip files we can't read
196
-
197
- self.metrics["files_without_metadata"] = len(missing_metadata)
198
-
199
- if missing_metadata:
200
- self.add_warning(f"{len(missing_metadata)} files missing metadata tags")
201
-
202
- def check_git_status(self):
203
- """Check for uncommitted changes in critical files"""
204
- try:
205
- # Only check if we're in a git repo
206
- if not (self.project_dir / ".git").exists():
207
- return
208
-
209
- result = subprocess.run(
210
- ["git", "status", "--porcelain"],
211
- cwd=self.project_dir,
212
- capture_output=True,
213
- text=True,
214
- timeout=5
215
- )
216
-
217
- if result.returncode == 0 and result.stdout:
218
- lines = result.stdout.strip().split("\n")
219
- critical_changes = [
220
- line for line in lines
221
- if any(pattern in line for pattern in ["CLAUDE.md", "AGENTS.md", "schema.ts"])
222
- ]
223
-
224
- if critical_changes:
225
- self.add_warning(f"Uncommitted changes in {len(critical_changes)} critical files")
226
-
227
- self.metrics["uncommitted_files"] = len(lines)
228
- except Exception:
229
- pass # Skip if git check fails
230
-
231
- def calculate_cleanliness_score(self) -> int:
232
- """Calculate overall cleanliness score (0-100)"""
233
- score = 100
234
-
235
- # Deduct points for issues
236
- for severity, _ in self.issues:
237
- if severity == "error":
238
- score -= 10
239
- elif severity == "warning":
240
- score -= 5
241
-
242
- # Deduct for warnings
243
- score -= len(self.warnings) * 2
244
-
245
- # Bonus for good metrics
246
- if self.metrics.get("files_without_metadata", 0) == 0:
247
- score += 5
248
- if self.metrics.get("uncommitted_files", 0) == 0:
249
- score += 5
250
-
251
- return max(0, min(100, score))
252
-
253
- def run_all_checks(self):
254
- """Run all cleanliness and ontology validation checks"""
255
- self.validate_directory_structure()
256
- self.validate_root_directory_compliance()
257
- self.validate_ontology_dimensions()
258
- self.validate_file_naming()
259
- self.find_orphaned_files()
260
- self.check_metadata_tags()
261
- self.check_git_status()
262
-
263
-
264
- def generate_report(validator: CleanlinessValidator) -> str:
265
- """Generate cleanliness report"""
266
- score = validator.calculate_cleanliness_score()
267
-
268
- # Determine status emoji
269
- if score >= 90:
270
- status = "✨ Excellent"
271
- color = "🟢"
272
- elif score >= 70:
273
- status = "👍 Good"
274
- color = "🟡"
275
- elif score >= 50:
276
- status = "⚠️ Needs Attention"
277
- color = "🟠"
278
- else:
279
- status = "🔴 Critical Issues"
280
- color = "🔴"
281
-
282
- report = f"""
283
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
284
- {color} ONTOLOGY COMPLIANCE & CLEANLINESS - {status} ({score}/100)
285
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
286
- """
287
-
288
- # Show errors
289
- errors = [issue for issue in validator.issues if issue[0] == "error"]
290
- if errors:
291
- report += "\n🔴 ERRORS:\n"
292
- for _, message in errors:
293
- report += f" • {message}\n"
294
-
295
- # Show warnings
296
- if validator.warnings:
297
- report += "\n⚠️ WARNINGS:\n"
298
- for warning in validator.warnings[:5]: # Limit to 5
299
- report += f" • {warning}\n"
300
- if len(validator.warnings) > 5:
301
- report += f" ... and {len(validator.warnings) - 5} more warnings\n"
302
-
303
- # Show metrics
304
- if validator.metrics:
305
- report += "\n📊 METRICS:\n"
306
- for key, value in validator.metrics.items():
307
- formatted_key = key.replace("_", " ").title()
308
- report += f" • {formatted_key}: {value}\n"
309
-
310
- # Show clean status
311
- if not errors and not validator.warnings:
312
- report += "\n✅ Everything is clean! Ready to proceed.\n"
313
-
314
- report += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
315
-
316
- # Add recommendations
317
- if score < 90:
318
- report += "\n💡 RECOMMENDATIONS:\n"
319
- if validator.metrics.get("root_violations", 0) > 0:
320
- report += " • CRITICAL: Move unauthorized files from root to /one/<dimension>/\n"
321
- report += " Root should ONLY contain: README.md, LICENSE.md, SECURITY.md, CLAUDE.md, AGENTS.md\n"
322
- if validator.metrics.get("files_without_metadata", 0) > 0:
323
- report += " • Run: Add metadata tags to documentation files\n"
324
- if validator.metrics.get("uncommitted_files", 0) > 0:
325
- report += " • Run: git add . && git commit -m 'chore: clean up'\n"
326
- if any(issue[0] == "error" for issue in validator.issues):
327
- report += " • Fix critical ontology violations before proceeding\n"
328
- report += "\n📚 6-DIMENSION ONTOLOGY:\n"
329
- report += " • groups - Hierarchical containers (multi-tenant isolation)\n"
330
- report += " • people - Authorization & governance (roles, permissions)\n"
331
- report += " • things - All entities (users, agents, content, tokens)\n"
332
- report += " • connections - Relationships between entities\n"
333
- report += " • events - Actions and state changes over time\n"
334
- report += " • knowledge - Labels, embeddings, semantic search\n"
335
- report += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
336
-
337
- return report
338
-
339
-
340
- def main():
341
- try:
342
- # Load hook input from stdin
343
- input_data = json.load(sys.stdin)
344
- prompt = input_data.get("prompt", "")
345
-
346
- # Get project directory
347
- project_dir = os.environ.get("CLAUDE_PROJECT_DIR", ".")
348
-
349
- # Skip validation for workflow commands
350
- if prompt.strip().startswith("/"):
351
- sys.exit(0)
352
-
353
- # Run validation
354
- validator = CleanlinessValidator(project_dir)
355
- validator.run_all_checks()
356
-
357
- # Generate report
358
- report = generate_report(validator)
359
-
360
- # Determine if we should block
361
- score = validator.calculate_cleanliness_score()
362
- errors = [issue for issue in validator.issues if issue[0] == "error"]
363
-
364
- # Only block if there are critical errors
365
- if errors and score < 30:
366
- output = {
367
- "hookSpecificOutput": {
368
- "hookEventName": "UserPromptSubmit",
369
- "additionalContext": report,
370
- "blocked": True,
371
- "blockedMessage": "Critical cleanliness issues detected. Please fix errors before proceeding."
372
- },
373
- }
374
- else:
375
- # Just show report as context
376
- output = {
377
- "hookSpecificOutput": {
378
- "hookEventName": "UserPromptSubmit",
379
- "additionalContext": report,
380
- },
381
- }
382
-
383
- print(json.dumps(output))
384
- sys.exit(0)
385
-
386
- except Exception as e:
387
- # Don't block on hook errors
388
- print(f"Error in clean-pre hook: {e}", file=sys.stderr)
389
- sys.exit(0)
390
-
391
-
392
- if __name__ == "__main__":
393
- main()
@@ -1,73 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Clean Markdown Hook - ONE Platform
4
- # Moves unwanted markdown files to one/events/
5
- # Root allowed: README.md, CLAUDE.md, AGENTS.md, LICENSE.md, SECURITY.md
6
- # /web allowed: README.md, CLAUDE.md, AGENTS.md, LICENSE.md, SECURITY.md
7
- # Everything else moves to one/events/ (6-dimension EVENTS dimension)
8
-
9
- PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}"
10
- EVENTS_DIR="$PROJECT_DIR/one/events"
11
-
12
- # Allowed files (same for both root and web)
13
- ALLOWED_FILES=(
14
- "README.md"
15
- "CLAUDE.md"
16
- "AGENTS.md"
17
- "LICENSE.md"
18
- "SECURITY.md"
19
- )
20
-
21
- # Create events directory if it doesn't exist
22
- mkdir -p "$EVENTS_DIR"
23
-
24
- # Function to clean markdown files in a directory
25
- clean_directory() {
26
- local dir="$1"
27
- local dir_name=$(basename "$dir")
28
-
29
- if [ ! -d "$dir" ]; then
30
- return
31
- fi
32
-
33
- # Find all markdown files in this directory (max depth 1)
34
- while IFS= read -r file; do
35
- filename=$(basename "$file")
36
-
37
- # Check if file is in allowed list
38
- is_allowed=0
39
- for allowed in "${ALLOWED_FILES[@]}"; do
40
- if [ "$filename" = "$allowed" ]; then
41
- is_allowed=1
42
- break
43
- fi
44
- done
45
-
46
- # If not allowed, move it to one/events/
47
- if [ $is_allowed -eq 0 ]; then
48
- # Add timestamp and source directory to avoid collisions
49
- timestamp=$(date +%Y%m%d-%H%M%S)
50
-
51
- # If root, just use filename; if /web, prefix with "web-"
52
- if [ "$dir_name" = "web" ]; then
53
- new_name="web-${filename%.md}-${timestamp}.md"
54
- else
55
- new_name="${filename%.md}-${timestamp}.md"
56
- fi
57
-
58
- echo "Moving $(basename "$file") → one/events/$new_name"
59
- mv "$file" "$EVENTS_DIR/$new_name"
60
-
61
- # Stage the changes for git
62
- git add -A "$file" "$EVENTS_DIR/$new_name" 2>/dev/null || true
63
- fi
64
- done < <(find "$dir" -maxdepth 1 -name "*.md" -type f)
65
- }
66
-
67
- # Clean root directory
68
- clean_directory "$PROJECT_DIR"
69
-
70
- # Clean /web directory
71
- clean_directory "$PROJECT_DIR/web"
72
-
73
- exit 0