oneie 3.6.5 → 3.6.6

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 (94) hide show
  1. package/.claude/commands/one copy.md +565 -0
  2. package/.claude/hooks/README-knowledge-hooks.md +265 -0
  3. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  4. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  5. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  6. package/.claude/hooks/check-filenames.py +40 -0
  7. package/.claude/hooks/clean-post.py +301 -0
  8. package/.claude/hooks/clean-pre.py +308 -0
  9. package/.claude/hooks/done.py +175 -0
  10. package/.claude/hooks/format-hook.sh +75 -0
  11. package/.claude/hooks/hook-logger.sh +59 -0
  12. package/.claude/hooks/knowledge-post.py +251 -0
  13. package/.claude/hooks/knowledge-pre.py +150 -0
  14. package/.claude/hooks/notification-hook.sh +112 -0
  15. package/.claude/hooks/security-hook.sh +157 -0
  16. package/.claude/hooks/tag-all-docs.py +338 -0
  17. package/.claude/hooks/todo.py +298 -0
  18. package/.claude/hooks/validate-ontology-structure.py +455 -0
  19. package/.claude/skills/astro/add-content-collection.md +30 -0
  20. package/.claude/skills/astro/check-build.md +29 -0
  21. package/.claude/skills/astro/create-component.md +29 -0
  22. package/.claude/skills/astro/create-page.md +30 -0
  23. package/.claude/skills/astro/optimize-performance.md +21 -0
  24. package/.claude/skills/convex/check-deployment.md +46 -0
  25. package/.claude/skills/convex/create-mutation.md +405 -0
  26. package/.claude/skills/convex/create-query.md +52 -0
  27. package/.claude/skills/convex/read-schema.md +373 -0
  28. package/.claude/skills/convex/test-function.md +50 -0
  29. package/.claude/skills/deployment/check-deployment-health.md +20 -0
  30. package/.claude/skills/deployment/create-release.md +21 -0
  31. package/.claude/skills/deployment/deploy-cloudflare.md +31 -0
  32. package/.claude/skills/deployment/deploy-convex.md +30 -0
  33. package/.claude/skills/deployment/sync-repositories.md +19 -0
  34. package/.claude/skills/design/check-accessibility.md +21 -0
  35. package/.claude/skills/design/create-component-spec.md +27 -0
  36. package/.claude/skills/design/generate-design-tokens.md +24 -0
  37. package/.claude/skills/design/generate-wireframe.md +30 -0
  38. package/.claude/skills/documentation/create-migration-guide.md +20 -0
  39. package/.claude/skills/documentation/generate-api-docs.md +27 -0
  40. package/.claude/skills/documentation/generate-readme.md +22 -0
  41. package/.claude/skills/documentation/update-knowledge.md +20 -0
  42. package/.claude/skills/integration/connect-external-system.md +21 -0
  43. package/.claude/skills/integration/implement-a2a.md +20 -0
  44. package/.claude/skills/integration/implement-acp.md +20 -0
  45. package/.claude/skills/integration/verify-integration.md +20 -0
  46. package/.claude/skills/ontology/README.md +255 -0
  47. package/.claude/skills/ontology/check-dimension.md +307 -0
  48. package/.claude/skills/ontology/generate-entity-type.md +339 -0
  49. package/.claude/skills/ontology/validate-schema.md +229 -0
  50. package/.claude/skills/ontology/verify-relationships.md +310 -0
  51. package/.claude/skills/problem-solving/analyze-test-failure.md +21 -0
  52. package/.claude/skills/problem-solving/identify-root-cause.md +20 -0
  53. package/.claude/skills/problem-solving/propose-solution.md +29 -0
  54. package/.claude/skills/problem-solving/verify-fix.md +21 -0
  55. package/.claude/skills/sales/generate-demo-script.md +21 -0
  56. package/.claude/skills/sales/qualify-lead.md +30 -0
  57. package/.claude/skills/sales/track-trial.md +20 -0
  58. package/.claude/skills/sales/verify-kyc.md +20 -0
  59. package/.claude/skills/testing/analyze-coverage.md +24 -0
  60. package/.claude/skills/testing/generate-tests.md +24 -0
  61. package/.claude/skills/testing/run-tests.md +27 -0
  62. package/.claude/skills/testing/validate-e2e.md +25 -0
  63. package/.mcp.json +30 -3
  64. package/dist/commands/init.d.ts.map +1 -1
  65. package/dist/commands/init.js +13 -6
  66. package/dist/commands/init.js.map +1 -1
  67. package/dist/utils/launch-claude.d.ts +3 -2
  68. package/dist/utils/launch-claude.d.ts.map +1 -1
  69. package/dist/utils/launch-claude.js +64 -29
  70. package/dist/utils/launch-claude.js.map +1 -1
  71. package/one/.obsidian/workspace.json +22 -22
  72. package/one/events/CREATE-WEBSITE.md +442 -0
  73. package/one/events/CUSTOM-DOMAIN.md +357 -0
  74. package/one/events/DEPLOYMENT copy.md +426 -0
  75. package/one/events/ECOMMERCE-BEFORE-AFTER.md +251 -0
  76. package/one/events/ECOMMERCE-ENHANCEMENTS.md +576 -0
  77. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +421 -0
  78. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +196 -0
  79. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +396 -0
  80. package/one/events/INSTALLATION_FOLDERS.md +516 -0
  81. package/one/events/INSTALLATION_FOLDERS_FILES.md +205 -0
  82. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +419 -0
  83. package/one/events/LICENSE.md +89 -0
  84. package/one/events/MCP-CONFIGURATION.md +336 -0
  85. package/one/events/MCP-SETUP-COMPLETE.md +205 -0
  86. package/one/events/NODE-UPGRADE.md +111 -0
  87. package/one/events/PACKAGE-STRUCTURE.md +310 -0
  88. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +331 -0
  89. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +567 -0
  90. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +262 -0
  91. package/one/events/STRIPE-INTEGRATION.md +414 -0
  92. package/one/events/STRIPE-SETUP-GUIDE.md +462 -0
  93. package/one/events/TRANSPARENCY-FIXES.md +275 -0
  94. package/package.json +4 -2
@@ -0,0 +1,308 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ ONE Platform - Clean Agent Pre-Inference Hook
4
+ Validates cleanliness before starting each inference.
5
+
6
+ This hook runs before UserPromptSubmit to ensure:
7
+ - File structure is intact
8
+ - No orphaned files exist
9
+ - Naming conventions are followed
10
+ - Documentation is up to date
11
+ - No uncommitted critical changes
12
+ - Metadata tags are present on all docs
13
+ """
14
+ import json
15
+ import sys
16
+ import os
17
+ from pathlib import Path
18
+ from typing import Dict, Any, List, Tuple
19
+ import subprocess
20
+ import re
21
+
22
+ # Critical directories that must exist
23
+ REQUIRED_DIRS = [
24
+ "one/connections",
25
+ "one/events",
26
+ "one/knowledge",
27
+ "one/things",
28
+ "one/people",
29
+ "one/groups",
30
+ ".claude/hooks",
31
+ ".claude/state",
32
+ ]
33
+
34
+ # File naming conventions
35
+ NAMING_PATTERNS = {
36
+ ".md": r"^[a-z0-9\-]+\.md$", # kebab-case for markdown
37
+ ".ts": r"^[a-z0-9\-]+\.ts$", # kebab-case for TypeScript
38
+ ".tsx": r"^[A-Z][a-zA-Z0-9]+\.tsx$", # PascalCase for React components
39
+ }
40
+
41
+ # Files that should have metadata frontmatter
42
+ METADATA_REQUIRED_PATTERNS = [
43
+ "one/**/*.md",
44
+ "CLAUDE.md",
45
+ "AGENTS.md",
46
+ "README.md",
47
+ ]
48
+
49
+
50
+ class CleanlinessValidator:
51
+ def __init__(self, project_dir: str):
52
+ self.project_dir = Path(project_dir)
53
+ self.issues: List[Tuple[str, str]] = [] # (severity, message)
54
+ self.warnings: List[str] = []
55
+ self.metrics: Dict[str, Any] = {}
56
+
57
+ def add_issue(self, severity: str, message: str):
58
+ """Add a cleanliness issue"""
59
+ self.issues.append((severity, message))
60
+
61
+ def add_warning(self, message: str):
62
+ """Add a warning"""
63
+ self.warnings.append(message)
64
+
65
+ def validate_directory_structure(self):
66
+ """Check that all required directories exist"""
67
+ for dir_path in REQUIRED_DIRS:
68
+ full_path = self.project_dir / dir_path
69
+ if not full_path.exists():
70
+ self.add_issue("error", f"Missing required directory: {dir_path}")
71
+ elif not full_path.is_dir():
72
+ self.add_issue("error", f"Path exists but is not a directory: {dir_path}")
73
+
74
+ def validate_file_naming(self):
75
+ """Check that files follow naming conventions"""
76
+ problematic_files = []
77
+
78
+ # Check markdown files in one/
79
+ for md_file in (self.project_dir / "one").rglob("*.md"):
80
+ if not re.match(NAMING_PATTERNS[".md"], md_file.name):
81
+ problematic_files.append(str(md_file.relative_to(self.project_dir)))
82
+
83
+ if problematic_files:
84
+ self.add_warning(f"Files not following kebab-case convention: {', '.join(problematic_files[:5])}")
85
+ if len(problematic_files) > 5:
86
+ self.add_warning(f"... and {len(problematic_files) - 5} more")
87
+
88
+ def find_orphaned_files(self):
89
+ """Find files that don't belong anywhere"""
90
+ orphans = []
91
+
92
+ # Check for common temporary/generated files
93
+ temp_patterns = ["*.tmp", "*.swp", "*.bak", "*.DS_Store", "*~"]
94
+ for pattern in temp_patterns:
95
+ for temp_file in self.project_dir.rglob(pattern):
96
+ # Skip node_modules and .git
97
+ if "node_modules" not in str(temp_file) and ".git" not in str(temp_file):
98
+ orphans.append(str(temp_file.relative_to(self.project_dir)))
99
+
100
+ if orphans:
101
+ self.add_warning(f"Found {len(orphans)} temporary/backup files that should be cleaned")
102
+ for orphan in orphans[:3]:
103
+ self.add_warning(f" - {orphan}")
104
+
105
+ def check_metadata_tags(self):
106
+ """Check that documentation files have metadata frontmatter"""
107
+ missing_metadata = []
108
+
109
+ # Check markdown files in one/
110
+ for md_file in (self.project_dir / "one").rglob("*.md"):
111
+ try:
112
+ content = md_file.read_text()
113
+ # Check for YAML frontmatter
114
+ if not content.startswith("---\n"):
115
+ missing_metadata.append(str(md_file.relative_to(self.project_dir)))
116
+ else:
117
+ # Validate frontmatter has required fields
118
+ frontmatter_end = content.find("\n---\n", 4)
119
+ if frontmatter_end == -1:
120
+ missing_metadata.append(str(md_file.relative_to(self.project_dir)))
121
+ except Exception:
122
+ pass # Skip files we can't read
123
+
124
+ self.metrics["files_without_metadata"] = len(missing_metadata)
125
+
126
+ if missing_metadata:
127
+ self.add_warning(f"{len(missing_metadata)} files missing metadata tags")
128
+
129
+ def check_git_status(self):
130
+ """Check for uncommitted changes in critical files"""
131
+ try:
132
+ # Only check if we're in a git repo
133
+ if not (self.project_dir / ".git").exists():
134
+ return
135
+
136
+ result = subprocess.run(
137
+ ["git", "status", "--porcelain"],
138
+ cwd=self.project_dir,
139
+ capture_output=True,
140
+ text=True,
141
+ timeout=5
142
+ )
143
+
144
+ if result.returncode == 0 and result.stdout:
145
+ lines = result.stdout.strip().split("\n")
146
+ critical_changes = [
147
+ line for line in lines
148
+ if any(pattern in line for pattern in ["CLAUDE.md", "AGENTS.md", "schema.ts"])
149
+ ]
150
+
151
+ if critical_changes:
152
+ self.add_warning(f"Uncommitted changes in {len(critical_changes)} critical files")
153
+
154
+ self.metrics["uncommitted_files"] = len(lines)
155
+ except Exception:
156
+ pass # Skip if git check fails
157
+
158
+ def calculate_cleanliness_score(self) -> int:
159
+ """Calculate overall cleanliness score (0-100)"""
160
+ score = 100
161
+
162
+ # Deduct points for issues
163
+ for severity, _ in self.issues:
164
+ if severity == "error":
165
+ score -= 10
166
+ elif severity == "warning":
167
+ score -= 5
168
+
169
+ # Deduct for warnings
170
+ score -= len(self.warnings) * 2
171
+
172
+ # Bonus for good metrics
173
+ if self.metrics.get("files_without_metadata", 0) == 0:
174
+ score += 5
175
+ if self.metrics.get("uncommitted_files", 0) == 0:
176
+ score += 5
177
+
178
+ return max(0, min(100, score))
179
+
180
+ def run_all_checks(self):
181
+ """Run all cleanliness validation checks"""
182
+ self.validate_directory_structure()
183
+ self.validate_file_naming()
184
+ self.find_orphaned_files()
185
+ self.check_metadata_tags()
186
+ self.check_git_status()
187
+
188
+
189
+ def generate_report(validator: CleanlinessValidator) -> str:
190
+ """Generate cleanliness report"""
191
+ score = validator.calculate_cleanliness_score()
192
+
193
+ # Determine status emoji
194
+ if score >= 90:
195
+ status = "✨ Excellent"
196
+ color = "🟢"
197
+ elif score >= 70:
198
+ status = "👍 Good"
199
+ color = "🟡"
200
+ elif score >= 50:
201
+ status = "⚠️ Needs Attention"
202
+ color = "🟠"
203
+ else:
204
+ status = "🔴 Critical Issues"
205
+ color = "🔴"
206
+
207
+ report = f"""
208
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
209
+ {color} CLEANLINESS VALIDATION - {status} ({score}/100)
210
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
211
+ """
212
+
213
+ # Show errors
214
+ errors = [issue for issue in validator.issues if issue[0] == "error"]
215
+ if errors:
216
+ report += "\n🔴 ERRORS:\n"
217
+ for _, message in errors:
218
+ report += f" • {message}\n"
219
+
220
+ # Show warnings
221
+ if validator.warnings:
222
+ report += "\n⚠️ WARNINGS:\n"
223
+ for warning in validator.warnings[:5]: # Limit to 5
224
+ report += f" • {warning}\n"
225
+ if len(validator.warnings) > 5:
226
+ report += f" ... and {len(validator.warnings) - 5} more warnings\n"
227
+
228
+ # Show metrics
229
+ if validator.metrics:
230
+ report += "\n📊 METRICS:\n"
231
+ for key, value in validator.metrics.items():
232
+ formatted_key = key.replace("_", " ").title()
233
+ report += f" • {formatted_key}: {value}\n"
234
+
235
+ # Show clean status
236
+ if not errors and not validator.warnings:
237
+ report += "\n✅ Everything is clean! Ready to proceed.\n"
238
+
239
+ report += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
240
+
241
+ # Add recommendations
242
+ if score < 90:
243
+ report += "\n💡 RECOMMENDATIONS:\n"
244
+ if validator.metrics.get("files_without_metadata", 0) > 0:
245
+ report += " • Run: Add metadata tags to documentation files\n"
246
+ if validator.metrics.get("uncommitted_files", 0) > 0:
247
+ report += " • Run: git add . && git commit -m 'chore: clean up'\n"
248
+ if any(issue[0] == "error" for issue in validator.issues):
249
+ report += " • Fix critical errors before proceeding with inference\n"
250
+ report += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
251
+
252
+ return report
253
+
254
+
255
+ def main():
256
+ try:
257
+ # Load hook input from stdin
258
+ input_data = json.load(sys.stdin)
259
+ prompt = input_data.get("prompt", "")
260
+
261
+ # Get project directory
262
+ project_dir = os.environ.get("CLAUDE_PROJECT_DIR", ".")
263
+
264
+ # Skip validation for workflow commands
265
+ if prompt.strip().startswith("/"):
266
+ sys.exit(0)
267
+
268
+ # Run validation
269
+ validator = CleanlinessValidator(project_dir)
270
+ validator.run_all_checks()
271
+
272
+ # Generate report
273
+ report = generate_report(validator)
274
+
275
+ # Determine if we should block
276
+ score = validator.calculate_cleanliness_score()
277
+ errors = [issue for issue in validator.issues if issue[0] == "error"]
278
+
279
+ # Only block if there are critical errors
280
+ if errors and score < 30:
281
+ output = {
282
+ "hookSpecificOutput": {
283
+ "hookEventName": "UserPromptSubmit",
284
+ "additionalContext": report,
285
+ "blocked": True,
286
+ "blockedMessage": "Critical cleanliness issues detected. Please fix errors before proceeding."
287
+ },
288
+ }
289
+ else:
290
+ # Just show report as context
291
+ output = {
292
+ "hookSpecificOutput": {
293
+ "hookEventName": "UserPromptSubmit",
294
+ "additionalContext": report,
295
+ },
296
+ }
297
+
298
+ print(json.dumps(output))
299
+ sys.exit(0)
300
+
301
+ except Exception as e:
302
+ # Don't block on hook errors
303
+ print(f"Error in clean-pre hook: {e}", file=sys.stderr)
304
+ sys.exit(0)
305
+
306
+
307
+ if __name__ == "__main__":
308
+ main()
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ ONE Platform - Done Hook
4
+ Marks current inference complete and advances to next inference.
5
+
6
+ This hook runs on Stop event to:
7
+ - Mark current inference as complete
8
+ - Capture lessons learned (if any)
9
+ - Advance to next inference
10
+ - Save updated state
11
+ """
12
+ import json
13
+ import sys
14
+ import os
15
+ from pathlib import Path
16
+ from typing import Dict, Any
17
+
18
+ # Import task descriptions from todo hook
19
+ from todo import INFERENCE_TASKS, get_dimensions_for_inference, get_specialist_for_inference
20
+
21
+
22
+ def load_state() -> Dict[str, Any]:
23
+ """Load current inference state from .claude/state/inference.json"""
24
+ state_file = Path(os.environ.get("CLAUDE_PROJECT_DIR", ".")) / ".claude" / "state" / "inference.json"
25
+
26
+ if not state_file.exists():
27
+ # Initialize default state
28
+ default_state = {
29
+ "current_inference": 1,
30
+ "completed_inferences": [],
31
+ "feature_name": "New Feature",
32
+ "organization": "Default Org",
33
+ "person_role": "platform_owner",
34
+ "lessons_learned": []
35
+ }
36
+ return default_state
37
+
38
+ return json.loads(state_file.read_text())
39
+
40
+
41
+ def save_state(state: Dict[str, Any]):
42
+ """Save inference state to .claude/state/inference.json"""
43
+ state_file = Path(os.environ.get("CLAUDE_PROJECT_DIR", ".")) / ".claude" / "state" / "inference.json"
44
+ state_file.parent.mkdir(parents=True, exist_ok=True)
45
+ state_file.write_text(json.dumps(state, indent=2))
46
+
47
+
48
+ def extract_lesson_from_transcript(transcript_path: str, inference: int) -> str:
49
+ """Extract lesson learned from conversation transcript"""
50
+ # TODO: Parse transcript JSONL to extract key learnings
51
+ # For now, return a placeholder
52
+ return f"Completed inference {inference} successfully"
53
+
54
+
55
+ def mark_complete_and_advance(state: Dict[str, Any], transcript_path: str) -> Dict[str, Any]:
56
+ """Mark current inference complete and advance to next"""
57
+ current = state["current_inference"]
58
+
59
+ # Mark current inference as complete
60
+ if current not in state["completed_inferences"]:
61
+ state["completed_inferences"].append(current)
62
+ state["completed_inferences"].sort()
63
+
64
+ # Extract lesson learned
65
+ lesson = extract_lesson_from_transcript(transcript_path, current)
66
+ state["lessons_learned"].append({
67
+ "inference": current,
68
+ "lesson": lesson,
69
+ "timestamp": os.times().elapsed
70
+ })
71
+
72
+ # Advance to next inference (unless we're at 100)
73
+ if current < 100:
74
+ state["current_inference"] = current + 1
75
+ else:
76
+ # Feature complete!
77
+ state["current_inference"] = 100
78
+ state["feature_complete"] = True
79
+
80
+ return state
81
+
82
+
83
+ def generate_completion_message(state: Dict[str, Any]) -> str:
84
+ """Generate message shown after marking complete"""
85
+ previous = state["current_inference"] - 1 if state["current_inference"] > 1 else 1
86
+ current = state["current_inference"]
87
+ completed_count = len(state["completed_inferences"])
88
+ progress_pct = (completed_count / 100) * 100
89
+
90
+ task = INFERENCE_TASKS.get(current, "Unknown task")
91
+ dimensions = get_dimensions_for_inference(current)
92
+ specialist = get_specialist_for_inference(current)
93
+
94
+ message = f"""
95
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+ ✅ INFERENCE COMPLETE: Infer {previous}/100
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
+
99
+ **Progress:** {completed_count}/100 inferences complete ({progress_pct:.0f}%)
100
+ **Feature:** {state["feature_name"]}
101
+
102
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
103
+ 🎯 NEXT INFERENCE: Infer {current}/100
104
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
105
+
106
+ **Task:** {task}
107
+ **Ontology Dimensions:** {", ".join(dimensions) if dimensions else "Foundation"}
108
+ **Assigned Specialist:** {specialist if specialist else "Engineering Director"}
109
+
110
+ Ready to continue? Type your next prompt or use:
111
+ /done - Mark this inference complete (when finished)
112
+ /next - Skip to next inference (if not applicable)
113
+ /plan - View complete 100-inference plan
114
+
115
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
116
+ """
117
+
118
+ if completed_count == 100:
119
+ message = f"""
120
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
121
+ 🎉 FEATURE COMPLETE: {state["feature_name"]}
122
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
123
+
124
+ **All 100 inferences completed successfully!**
125
+
126
+ **Final Stats:**
127
+ - Organization: {state["organization"]}
128
+ - Person Role: {state["person_role"]}
129
+ - Lessons Learned: {len(state.get("lessons_learned", []))}
130
+
131
+ **Next Steps:**
132
+ 1. Review lessons learned: /lessons
133
+ 2. Start new feature: /one
134
+ 3. Generate documentation: /document
135
+
136
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
137
+ Congratulations! 🎊 Your feature is production-ready.
138
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
139
+ """
140
+
141
+ return message
142
+
143
+
144
+ def main():
145
+ try:
146
+ # Load hook input from stdin
147
+ input_data = json.load(sys.stdin)
148
+ transcript_path = input_data.get("transcript_path", "")
149
+
150
+ # Load current state
151
+ state = load_state()
152
+
153
+ # Mark complete and advance
154
+ state = mark_complete_and_advance(state, transcript_path)
155
+
156
+ # Save updated state
157
+ save_state(state)
158
+
159
+ # Generate completion message
160
+ message = generate_completion_message(state)
161
+
162
+ # Output message (shown in transcript mode with Ctrl-R)
163
+ print(message)
164
+
165
+ # Exit with success
166
+ sys.exit(0)
167
+
168
+ except Exception as e:
169
+ # Log error but don't block
170
+ print(f"Error in done hook: {e}", file=sys.stderr)
171
+ sys.exit(0)
172
+
173
+
174
+ if __name__ == "__main__":
175
+ main()
@@ -0,0 +1,75 @@
1
+ #!/bin/bash
2
+
3
+ # Format Hook - ONE Platform
4
+ # Auto-formats markdown and YAML files in /one directory
5
+
6
+ set -e
7
+
8
+ # Source the logger
9
+ source "$CLAUDE_PROJECT_DIR/.claude/hooks/hook-logger.sh"
10
+
11
+ # Get file path from stdin or argument
12
+ FILE_PATH="${1:-}"
13
+
14
+ # Log start
15
+ log_message "INFO" "Starting format-hook for: ${FILE_PATH:-all files}"
16
+ START_TIME=$(get_time_ms)
17
+
18
+ # Function to format markdown files
19
+ format_markdown() {
20
+ local file="$1"
21
+
22
+ if command -v prettier &> /dev/null; then
23
+ prettier --write "$file" --parser markdown 2>/dev/null && echo "✅ Formatted: $file"
24
+ else
25
+ echo "⚠️ prettier not found, skipping markdown formatting"
26
+ fi
27
+ }
28
+
29
+ # Function to format YAML files
30
+ format_yaml() {
31
+ local file="$1"
32
+
33
+ if command -v prettier &> /dev/null; then
34
+ prettier --write "$file" --parser yaml 2>/dev/null && echo "✅ Formatted: $file"
35
+ else
36
+ echo "⚠️ prettier not found, skipping YAML formatting"
37
+ fi
38
+ }
39
+
40
+ EXIT_CODE=0
41
+
42
+ # Check if specific file provided
43
+ if [ -n "$FILE_PATH" ]; then
44
+ # Format specific file
45
+ if [[ "$FILE_PATH" =~ \.md$ ]]; then
46
+ format_markdown "$FILE_PATH"
47
+ elif [[ "$FILE_PATH" =~ \.(yaml|yml)$ ]]; then
48
+ format_yaml "$FILE_PATH"
49
+ else
50
+ log_message "INFO" "File type not supported for formatting: $FILE_PATH"
51
+ fi
52
+ else
53
+ # Format all files in /one directory
54
+ if [ -d "$CLAUDE_PROJECT_DIR/one" ]; then
55
+ echo "🔧 Formatting files in /one directory..."
56
+
57
+ # Format markdown files
58
+ if command -v prettier &> /dev/null; then
59
+ find "$CLAUDE_PROJECT_DIR/one" -type f -name "*.md" -exec prettier --write {} \; 2>/dev/null || true
60
+ find "$CLAUDE_PROJECT_DIR/one" -type f \( -name "*.yaml" -o -name "*.yml" \) -exec prettier --write {} \; 2>/dev/null || true
61
+ echo "✅ Formatting completed"
62
+ else
63
+ echo "⚠️ prettier not installed. Install with: npm install -g prettier"
64
+ EXIT_CODE=0 # Don't fail if prettier not installed
65
+ fi
66
+ else
67
+ log_message "WARN" "/one directory not found"
68
+ fi
69
+ fi
70
+
71
+ # Log completion
72
+ END_TIME=$(get_time_ms)
73
+ log_hook_execution "format-hook" "$0 $*" "$START_TIME" "$END_TIME" "$EXIT_CODE"
74
+
75
+ exit $EXIT_CODE
@@ -0,0 +1,59 @@
1
+ #!/bin/bash
2
+
3
+ # Claude Code Hook Logger - ONE Platform
4
+ # Handles logging for hook execution with debug mode and performance metrics
5
+
6
+ LOG_FILE="${LOG_FILE:-$CLAUDE_PROJECT_DIR/.claude/hooks.log}"
7
+ DEBUG_MODE="${DEBUG_MODE:-false}"
8
+
9
+ # Create log directory if it doesn't exist
10
+ mkdir -p "$(dirname "$LOG_FILE")"
11
+
12
+ # Function to log messages
13
+ log_message() {
14
+ local level="$1"
15
+ local message="$2"
16
+ local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
17
+
18
+ echo "[$timestamp] [$level] $message" >> "$LOG_FILE"
19
+
20
+ if [ "$DEBUG_MODE" = "true" ]; then
21
+ echo "[$timestamp] [$level] $message" >&2
22
+ fi
23
+ }
24
+
25
+ # Function to log hook execution
26
+ log_hook_execution() {
27
+ local hook_name="$1"
28
+ local command="$2"
29
+ local start_time="$3"
30
+ local end_time="$4"
31
+ local exit_code="$5"
32
+
33
+ local duration=$((end_time - start_time))
34
+
35
+ log_message "INFO" "Hook: $hook_name | Duration: ${duration}ms | Exit: $exit_code"
36
+
37
+ # Log performance warning if execution took too long
38
+ if [ "$duration" -gt 5000 ]; then
39
+ log_message "WARN" "Hook execution exceeded 5 seconds: $hook_name"
40
+ fi
41
+ }
42
+
43
+ # Function to get current time in milliseconds
44
+ get_time_ms() {
45
+ if [[ "$OSTYPE" == "darwin"* ]]; then
46
+ # macOS
47
+ python3 -c "import time; print(int(time.time() * 1000))" 2>/dev/null || echo $(($(date +%s) * 1000))
48
+ else
49
+ # Linux
50
+ echo $(($(date +%s%N) / 1000000))
51
+ fi
52
+ }
53
+
54
+ # Export functions for use in other scripts
55
+ export -f log_message
56
+ export -f log_hook_execution
57
+ export -f get_time_ms
58
+ export LOG_FILE
59
+ export DEBUG_MODE