oneie 3.6.23 → 3.6.25
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-designer.md +1 -0
- package/.claude/agents/agent-director.md +71 -71
- 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-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/package.json +1 -1
- package/.claude/commands/mcp-toggle.md +0 -93
- package/.claude/commands/npx.md +0 -84
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
ONE Platform - Todo Context Hook
|
|
4
|
+
Loads current cycle context and injects it into Claude's conversation.
|
|
5
|
+
|
|
6
|
+
This hook runs on UserPromptSubmit to provide context about:
|
|
7
|
+
- Current cycle number (Cycle 1-100)
|
|
8
|
+
- Task description
|
|
9
|
+
- Required ontology dimensions
|
|
10
|
+
- Dependencies from previous cycles
|
|
11
|
+
- Organization and person context
|
|
12
|
+
- Phase context and parallel execution opportunities
|
|
13
|
+
"""
|
|
14
|
+
import json
|
|
15
|
+
import sys
|
|
16
|
+
import os
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Dict, Any, Optional, List
|
|
19
|
+
|
|
20
|
+
# Phase definitions (10 phases of 10 cycles each)
|
|
21
|
+
PHASES = {
|
|
22
|
+
1: {"name": "Foundation & Setup", "range": (1, 10), "icon": "🏗️"},
|
|
23
|
+
2: {"name": "Backend Schema & Services", "range": (11, 20), "icon": "⚙️"},
|
|
24
|
+
3: {"name": "Frontend Pages & Components", "range": (21, 30), "icon": "🎨"},
|
|
25
|
+
4: {"name": "Integration & Connections", "range": (31, 40), "icon": "🔗"},
|
|
26
|
+
5: {"name": "Authentication & Authorization", "range": (41, 50), "icon": "🔐"},
|
|
27
|
+
6: {"name": "Knowledge & RAG", "range": (51, 60), "icon": "🧠"},
|
|
28
|
+
7: {"name": "Quality & Testing", "range": (61, 70), "icon": "✅"},
|
|
29
|
+
8: {"name": "Design & Wireframes", "range": (71, 80), "icon": "🎨"},
|
|
30
|
+
9: {"name": "Performance & Optimization", "range": (81, 90), "icon": "⚡"},
|
|
31
|
+
10: {"name": "Deployment & Documentation", "range": (91, 100), "icon": "🚀"},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# Cycle-to-dimension mapping
|
|
35
|
+
CYCLEENCE_DIMENSIONS = {
|
|
36
|
+
"groups": [6, 18, 43],
|
|
37
|
+
"people": [7, 42, 43, 44, 45, 46, 47, 48, 49, 50],
|
|
38
|
+
"things": [2, 11, 12, 21, 22, 23],
|
|
39
|
+
"connections": [3, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],
|
|
40
|
+
"events": [4, 17, 34, 39, 49],
|
|
41
|
+
"knowledge": [5, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 98, 99],
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Cycle-to-specialist mapping
|
|
45
|
+
CYCLEENCE_SPECIALISTS = {
|
|
46
|
+
"director": list(range(1, 11)),
|
|
47
|
+
"backend": list(range(11, 21)) + list(range(41, 51)),
|
|
48
|
+
"frontend": list(range(21, 31)),
|
|
49
|
+
"integration": list(range(31, 41)),
|
|
50
|
+
"quality": list(range(61, 71)),
|
|
51
|
+
"designer": list(range(71, 81)),
|
|
52
|
+
"ops": list(range(81, 100)),
|
|
53
|
+
"documenter": list(range(95, 101)),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Parallel execution opportunities (cycles that can run concurrently)
|
|
57
|
+
PARALLEL_GROUPS = [
|
|
58
|
+
{"cycles": list(range(11, 21)) + list(range(21, 31)), "note": "Backend + Frontend (after schema defined at Cycle 12)"},
|
|
59
|
+
{"cycles": list(range(61, 71)) + list(range(71, 81)), "note": "Tests + Design (interdependent validation)"},
|
|
60
|
+
{"cycles": list(range(95, 101)), "note": "Documentation (can start earlier)"},
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
# The 100 cycle tasks (abbreviated for context efficiency)
|
|
64
|
+
CYCLEENCE_TASKS = {
|
|
65
|
+
1: "Validate idea against 6-dimension ontology",
|
|
66
|
+
2: "Map idea to specific entity types (66+ thing types)",
|
|
67
|
+
3: "Identify connection types needed (25+ relationship types)",
|
|
68
|
+
4: "List event types that will be triggered (67+ event types)",
|
|
69
|
+
5: "Determine knowledge requirements (embeddings, vectors, RAG)",
|
|
70
|
+
6: "Identify organization scope (single-tenant vs multi-tenant)",
|
|
71
|
+
7: "Define people roles involved (4 roles)",
|
|
72
|
+
8: "Create high-level vision document",
|
|
73
|
+
9: "Generate initial plan with feature breakdown",
|
|
74
|
+
10: "Assign features to specialists",
|
|
75
|
+
11: "Design database schema changes",
|
|
76
|
+
12: "Update backend/convex/schema.ts",
|
|
77
|
+
13: "Create Effect.ts service for business logic",
|
|
78
|
+
14: "Define service errors with tagged unions",
|
|
79
|
+
15: "Write Convex queries for read operations",
|
|
80
|
+
16: "Write Convex mutations for write operations",
|
|
81
|
+
17: "Add event logging to all mutations",
|
|
82
|
+
18: "Implement organization scoping",
|
|
83
|
+
19: "Add rate limiting to mutations",
|
|
84
|
+
20: "Write unit tests for Effect.ts services",
|
|
85
|
+
21: "Create Astro page with SSR data fetching",
|
|
86
|
+
22: "Build React components for interactive UI",
|
|
87
|
+
23: "Use shadcn/ui components (50+ pre-installed)",
|
|
88
|
+
24: "Implement loading states with Suspense",
|
|
89
|
+
25: "Add error boundaries for graceful failures",
|
|
90
|
+
26: "Create forms with validation",
|
|
91
|
+
27: "Implement client-side state with Convex hooks",
|
|
92
|
+
28: "Style with Tailwind v4",
|
|
93
|
+
29: "Ensure responsive design (mobile-first)",
|
|
94
|
+
30: "Add dark mode support",
|
|
95
|
+
31: "Map external system to ontology dimensions",
|
|
96
|
+
32: "Create connection records for system relationships",
|
|
97
|
+
33: "Implement data synchronization logic",
|
|
98
|
+
34: "Add event tracking for cross-system actions",
|
|
99
|
+
35: "Create webhook handlers",
|
|
100
|
+
36: "Implement polling logic",
|
|
101
|
+
37: "Add error handling for integration failures",
|
|
102
|
+
38: "Create retry logic with exponential backoff",
|
|
103
|
+
39: "Log all integration events",
|
|
104
|
+
40: "Write integration tests for data flows",
|
|
105
|
+
41: "Configure Better Auth with 6 methods",
|
|
106
|
+
42: "Implement role-based access control (4 roles)",
|
|
107
|
+
43: "Add organization-scoped permissions",
|
|
108
|
+
44: "Create session management with JWT tokens",
|
|
109
|
+
45: "Implement password reset flow",
|
|
110
|
+
46: "Add email verification flow",
|
|
111
|
+
47: "Enable 2FA",
|
|
112
|
+
48: "Add brute force protection",
|
|
113
|
+
49: "Log all auth events",
|
|
114
|
+
50: "Write auth integration tests",
|
|
115
|
+
51: "Create knowledge records with labels",
|
|
116
|
+
52: "Generate embeddings for content",
|
|
117
|
+
53: "Store vectors in knowledge table",
|
|
118
|
+
54: "Implement vector search",
|
|
119
|
+
55: "Create RAG pipeline",
|
|
120
|
+
56: "Link knowledge to things via junction table",
|
|
121
|
+
57: "Add semantic search to UI",
|
|
122
|
+
58: "Implement knowledge graph traversal",
|
|
123
|
+
59: "Create AI-powered recommendations",
|
|
124
|
+
60: "Test RAG accuracy with sample queries",
|
|
125
|
+
61: "Define user flows",
|
|
126
|
+
62: "Create acceptance criteria",
|
|
127
|
+
63: "Write unit tests for services",
|
|
128
|
+
64: "Write integration tests for flows",
|
|
129
|
+
65: "Write e2e tests for critical paths",
|
|
130
|
+
66: "Run tests and capture results",
|
|
131
|
+
67: "Validate against ontology",
|
|
132
|
+
68: "Check type safety",
|
|
133
|
+
69: "Run linter",
|
|
134
|
+
70: "Fix all failing tests",
|
|
135
|
+
71: "Create wireframes that satisfy acceptance criteria",
|
|
136
|
+
72: "Design component architecture",
|
|
137
|
+
73: "Set design tokens",
|
|
138
|
+
74: "Ensure WCAG AA accessibility",
|
|
139
|
+
75: "Design loading states and skeletons",
|
|
140
|
+
76: "Create error state designs",
|
|
141
|
+
77: "Design empty states",
|
|
142
|
+
78: "Implement animations and transitions",
|
|
143
|
+
79: "Validate design enables tests to pass",
|
|
144
|
+
80: "Get design approval",
|
|
145
|
+
81: "Optimize database queries",
|
|
146
|
+
82: "Implement pagination for large lists",
|
|
147
|
+
83: "Add caching where appropriate",
|
|
148
|
+
84: "Optimize images",
|
|
149
|
+
85: "Minimize JavaScript bundle size",
|
|
150
|
+
86: "Use Astro Islands for selective hydration",
|
|
151
|
+
87: "Enable SSR for critical pages",
|
|
152
|
+
88: "Optimize Lighthouse scores",
|
|
153
|
+
89: "Test on slow connections",
|
|
154
|
+
90: "Monitor Core Web Vitals",
|
|
155
|
+
91: "Build production bundle",
|
|
156
|
+
92: "Deploy backend to Convex Cloud",
|
|
157
|
+
93: "Deploy frontend to Cloudflare Pages",
|
|
158
|
+
94: "Run smoke tests in production",
|
|
159
|
+
95: "Write feature documentation",
|
|
160
|
+
96: "Update API documentation",
|
|
161
|
+
97: "Create user guide",
|
|
162
|
+
98: "Capture lessons learned",
|
|
163
|
+
99: "Update knowledge base with patterns",
|
|
164
|
+
100: "Mark feature complete and notify stakeholders",
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def load_state() -> Dict[str, Any]:
|
|
169
|
+
"""Load current cycle state from .claude/state/cycle.json"""
|
|
170
|
+
state_file = Path(os.environ.get("CLAUDE_PROJECT_DIR", ".")) / ".claude" / "state" / "cycle.json"
|
|
171
|
+
|
|
172
|
+
# Create state directory if it doesn't exist
|
|
173
|
+
state_file.parent.mkdir(parents=True, exist_ok=True)
|
|
174
|
+
|
|
175
|
+
# Initialize default state if file doesn't exist
|
|
176
|
+
if not state_file.exists():
|
|
177
|
+
default_state = {
|
|
178
|
+
"current_cycle": 1,
|
|
179
|
+
"completed_cycles": [],
|
|
180
|
+
"feature_name": "New Feature",
|
|
181
|
+
"organization": "Default Org",
|
|
182
|
+
"person_role": "platform_owner",
|
|
183
|
+
"lessons_learned": []
|
|
184
|
+
}
|
|
185
|
+
state_file.write_text(json.dumps(default_state, indent=2))
|
|
186
|
+
return default_state
|
|
187
|
+
|
|
188
|
+
return json.loads(state_file.read_text())
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def get_phase_for_cycle(cycle: int) -> Dict[str, Any]:
|
|
192
|
+
"""Get phase information for this cycle"""
|
|
193
|
+
for phase_num, phase_info in PHASES.items():
|
|
194
|
+
start, end = phase_info["range"]
|
|
195
|
+
if start <= cycle <= end:
|
|
196
|
+
return {
|
|
197
|
+
"number": phase_num,
|
|
198
|
+
"name": phase_info["name"],
|
|
199
|
+
"icon": phase_info["icon"],
|
|
200
|
+
"progress": f"{cycle - start + 1}/{end - start + 1}"
|
|
201
|
+
}
|
|
202
|
+
return {"number": 0, "name": "Unknown", "icon": "❓", "progress": "0/0"}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def get_dimensions_for_cycle(cycle: int) -> List[str]:
|
|
206
|
+
"""Get ontology dimensions relevant to this cycle"""
|
|
207
|
+
dimensions = []
|
|
208
|
+
for dimension, cycles in CYCLEENCE_DIMENSIONS.items():
|
|
209
|
+
if cycle in cycles:
|
|
210
|
+
dimensions.append(dimension)
|
|
211
|
+
return dimensions
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def get_specialist_for_cycle(cycle: int) -> Optional[str]:
|
|
215
|
+
"""Get specialist agent responsible for this cycle"""
|
|
216
|
+
for specialist, cycles in CYCLEENCE_SPECIALISTS.items():
|
|
217
|
+
if cycle in cycles:
|
|
218
|
+
return specialist
|
|
219
|
+
return None
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def get_parallel_opportunities(cycle: int) -> List[str]:
|
|
223
|
+
"""Get parallel execution opportunities for current cycle"""
|
|
224
|
+
opportunities = []
|
|
225
|
+
for group in PARALLEL_GROUPS:
|
|
226
|
+
if cycle in group["cycles"]:
|
|
227
|
+
opportunities.append(group["note"])
|
|
228
|
+
return opportunities
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def get_dependencies(cycle: int) -> list:
|
|
232
|
+
"""Get cycle dependencies (what must be completed first)"""
|
|
233
|
+
# Simple linear dependencies for now
|
|
234
|
+
if cycle <= 10:
|
|
235
|
+
return list(range(1, cycle))
|
|
236
|
+
elif cycle <= 20:
|
|
237
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + list(range(11, cycle))
|
|
238
|
+
elif cycle <= 30:
|
|
239
|
+
return list(range(1, 11)) + [12, 13] + list(range(21, cycle)) # Need schema first
|
|
240
|
+
elif cycle <= 40:
|
|
241
|
+
return list(range(1, 11)) + list(range(31, cycle))
|
|
242
|
+
else:
|
|
243
|
+
return list(range(1, 11)) # Foundation always required
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def generate_context(state: Dict[str, Any]) -> str:
|
|
247
|
+
"""Generate context to inject into Claude's conversation"""
|
|
248
|
+
current = state["current_cycle"]
|
|
249
|
+
task = CYCLEENCE_TASKS.get(current, "Unknown task")
|
|
250
|
+
phase = get_phase_for_cycle(current)
|
|
251
|
+
dimensions = get_dimensions_for_cycle(current)
|
|
252
|
+
specialist = get_specialist_for_cycle(current)
|
|
253
|
+
parallel_ops = get_parallel_opportunities(current)
|
|
254
|
+
dependencies = [d for d in get_dependencies(current) if d in state["completed_cycles"]]
|
|
255
|
+
total_deps = len(get_dependencies(current))
|
|
256
|
+
progress_pct = (len(state["completed_cycles"]) / 100) * 100
|
|
257
|
+
|
|
258
|
+
context = f"""
|
|
259
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
260
|
+
{phase['icon']} CURRENT CYCLEENCE: Cycle {current}/100
|
|
261
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
262
|
+
|
|
263
|
+
**Feature:** {state["feature_name"]}
|
|
264
|
+
**Organization:** {state["organization"]}
|
|
265
|
+
**Person Role:** {state["person_role"]}
|
|
266
|
+
|
|
267
|
+
**Phase {phase['number']}/10:** {phase['name']} ({phase['progress']})
|
|
268
|
+
**Task:** {task}
|
|
269
|
+
|
|
270
|
+
**6-Dimension Ontology:** {", ".join(dimensions) if dimensions else "Foundation (all dimensions)"}
|
|
271
|
+
**Assigned Specialist:** {specialist if specialist else "director"}
|
|
272
|
+
|
|
273
|
+
**Dependencies Met:** {len(dependencies)}/{total_deps} completed
|
|
274
|
+
**Progress:** {len(state["completed_cycles"])}/100 cycles complete ({progress_pct:.0f}%)
|
|
275
|
+
"""
|
|
276
|
+
|
|
277
|
+
# Add parallel execution opportunities
|
|
278
|
+
if parallel_ops:
|
|
279
|
+
context += f"\n**Parallel Opportunities:** {', '.join(parallel_ops)}\n"
|
|
280
|
+
|
|
281
|
+
context += """
|
|
282
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
283
|
+
🎯 NEXT 5 CYCLEENCES:
|
|
284
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
285
|
+
"""
|
|
286
|
+
|
|
287
|
+
# Add next 5 cycles with enhanced info
|
|
288
|
+
for i in range(current, min(current + 5, 101)):
|
|
289
|
+
task_desc = CYCLEENCE_TASKS.get(i, "Unknown")
|
|
290
|
+
dims = get_dimensions_for_cycle(i)
|
|
291
|
+
spec = get_specialist_for_cycle(i)
|
|
292
|
+
inf_phase = get_phase_for_cycle(i)
|
|
293
|
+
status = "✅" if i in state["completed_cycles"] else "⏸️ " if i == current else "⏹️ "
|
|
294
|
+
|
|
295
|
+
context += f"{status} Cycle {i}: {task_desc}\n"
|
|
296
|
+
if i == current:
|
|
297
|
+
# Show more detail for current cycle
|
|
298
|
+
context += f" {inf_phase['icon']} Phase: {inf_phase['name']}\n"
|
|
299
|
+
if dims:
|
|
300
|
+
context += f" 📊 Dimensions: {', '.join(dims)}\n"
|
|
301
|
+
if spec:
|
|
302
|
+
context += f" 👤 Specialist: {spec}\n"
|
|
303
|
+
else:
|
|
304
|
+
# Condensed info for upcoming cycles
|
|
305
|
+
if dims or spec:
|
|
306
|
+
context += f" └─ {', '.join(dims) if dims else 'Foundation'} | {spec if spec else 'director'}\n"
|
|
307
|
+
|
|
308
|
+
context += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
|
309
|
+
|
|
310
|
+
# Add recent lessons learned (only if meaningful)
|
|
311
|
+
if state.get("lessons_learned"):
|
|
312
|
+
recent_lessons = [l for l in state["lessons_learned"][-5:] if l["lesson"] != f"Completed cycle {l['cycle']} successfully"]
|
|
313
|
+
if recent_lessons:
|
|
314
|
+
context += "💡 RECENT LESSONS LEARNED:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
|
315
|
+
for lesson in recent_lessons[-3:]: # Last 3 meaningful lessons
|
|
316
|
+
context += f"• Cycle {lesson['cycle']}: {lesson['lesson']}\n"
|
|
317
|
+
context += "\n"
|
|
318
|
+
|
|
319
|
+
context += """
|
|
320
|
+
🔄 WORKFLOW COMMANDS:
|
|
321
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
322
|
+
/done - Mark current cycle complete and advance
|
|
323
|
+
/next - Skip to next cycle (if not applicable)
|
|
324
|
+
/reset - Start new feature (reset to Cycle 1)
|
|
325
|
+
/plan - View complete 100-cycle plan
|
|
326
|
+
|
|
327
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
328
|
+
"""
|
|
329
|
+
|
|
330
|
+
return context
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def main():
|
|
334
|
+
try:
|
|
335
|
+
# Load hook input from stdin
|
|
336
|
+
input_data = json.load(sys.stdin)
|
|
337
|
+
prompt = input_data.get("prompt", "")
|
|
338
|
+
|
|
339
|
+
# Load current state
|
|
340
|
+
state = load_state()
|
|
341
|
+
|
|
342
|
+
# Check if prompt is a workflow command
|
|
343
|
+
if prompt.strip().startswith("/"):
|
|
344
|
+
# Don't inject context for commands (they handle their own context)
|
|
345
|
+
sys.exit(0)
|
|
346
|
+
|
|
347
|
+
# Generate and output context
|
|
348
|
+
context = generate_context(state)
|
|
349
|
+
|
|
350
|
+
# Output as JSON with additionalContext
|
|
351
|
+
output = {
|
|
352
|
+
"hookSpecificOutput": {
|
|
353
|
+
"hookEventName": "UserPromptSubmit",
|
|
354
|
+
"additionalContext": context,
|
|
355
|
+
},
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
print(json.dumps(output))
|
|
359
|
+
sys.exit(0)
|
|
360
|
+
|
|
361
|
+
except Exception as e:
|
|
362
|
+
# Don't block on errors, just log to stderr
|
|
363
|
+
print(f"Error in todo hook: {e}", file=sys.stderr)
|
|
364
|
+
sys.exit(0)
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
if __name__ == "__main__":
|
|
368
|
+
main()
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Track Changes Hook - ONE Platform
|
|
4
|
+
# Tracks file paths and names (most important for customizations)
|
|
5
|
+
# Helps users diff from template and export their changes
|
|
6
|
+
# Works regardless of custom directory names
|
|
7
|
+
|
|
8
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel)}"
|
|
9
|
+
CHANGES_LOG="$PROJECT_DIR/one/events/0-changes.md"
|
|
10
|
+
|
|
11
|
+
# Get commit info
|
|
12
|
+
COMMIT_SHORT=$(git rev-parse --short HEAD)
|
|
13
|
+
COMMIT_MSG=$(git log -1 --pretty=%B | head -1)
|
|
14
|
+
COMMIT_FILES=$(git diff-tree --no-commit-id --name-only -r HEAD)
|
|
15
|
+
|
|
16
|
+
# Separate template vs custom files
|
|
17
|
+
TEMPLATE_FILES=""
|
|
18
|
+
CUSTOM_FILES=""
|
|
19
|
+
|
|
20
|
+
while IFS= read -r file; do
|
|
21
|
+
# Template directories
|
|
22
|
+
if [[ "$file" =~ ^(web|one|\.claude)/ ]]; then
|
|
23
|
+
TEMPLATE_FILES+=" - $file"$'\n'
|
|
24
|
+
else
|
|
25
|
+
CUSTOM_FILES+=" - $file"$'\n'
|
|
26
|
+
fi
|
|
27
|
+
done <<< "$COMMIT_FILES"
|
|
28
|
+
|
|
29
|
+
# Count files
|
|
30
|
+
TEMPLATE_COUNT=$(echo "$TEMPLATE_FILES" | grep -c " - " || true)
|
|
31
|
+
CUSTOM_COUNT=$(echo "$CUSTOM_FILES" | grep -c " - " || true)
|
|
32
|
+
|
|
33
|
+
# Create summary header
|
|
34
|
+
SUMMARY=""
|
|
35
|
+
[ "$TEMPLATE_COUNT" -gt 0 ] && SUMMARY+="template:$TEMPLATE_COUNT "
|
|
36
|
+
[ "$CUSTOM_COUNT" -gt 0 ] && SUMMARY+="custom:$CUSTOM_COUNT"
|
|
37
|
+
|
|
38
|
+
SUMMARY=$(echo "$SUMMARY" | xargs)
|
|
39
|
+
TAG=""
|
|
40
|
+
[ "$CUSTOM_COUNT" -gt 0 ] && TAG=" [customization]"
|
|
41
|
+
|
|
42
|
+
# Create detailed markdown entry with file paths
|
|
43
|
+
ENTRY="### **$COMMIT_SHORT** — $SUMMARY — \`$COMMIT_MSG\`\`$TAG
|
|
44
|
+
|
|
45
|
+
"
|
|
46
|
+
|
|
47
|
+
if [ "$TEMPLATE_COUNT" -gt 0 ]; then
|
|
48
|
+
ENTRY+="**Template:**
|
|
49
|
+
$TEMPLATE_FILES
|
|
50
|
+
"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
if [ "$CUSTOM_COUNT" -gt 0 ]; then
|
|
54
|
+
ENTRY+="**Your Changes:**
|
|
55
|
+
$CUSTOM_FILES
|
|
56
|
+
"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
ENTRY+="
|
|
60
|
+
"
|
|
61
|
+
|
|
62
|
+
# Create one/events directory if it doesn't exist
|
|
63
|
+
mkdir -p "$(dirname "$CHANGES_LOG")" 2>/dev/null
|
|
64
|
+
|
|
65
|
+
# Initialize changes log if it doesn't exist
|
|
66
|
+
if [ ! -f "$CHANGES_LOG" ]; then
|
|
67
|
+
cat > "$CHANGES_LOG" << 'EOF'
|
|
68
|
+
# Change Tracking
|
|
69
|
+
|
|
70
|
+
Track your customizations with file paths. Updated on each commit.
|
|
71
|
+
|
|
72
|
+
**What's tracked:**
|
|
73
|
+
- All file names and relative paths
|
|
74
|
+
- Which changes are template upgrades vs your customizations
|
|
75
|
+
- Easy to export for diffs, upgrades, or documentation
|
|
76
|
+
|
|
77
|
+
**Format:**
|
|
78
|
+
```
|
|
79
|
+
### hash — template:N custom:M — `message` [customization]
|
|
80
|
+
|
|
81
|
+
**Template:**
|
|
82
|
+
- path/to/file1
|
|
83
|
+
- path/to/file2
|
|
84
|
+
|
|
85
|
+
**Your Changes:**
|
|
86
|
+
- custom/path/file1
|
|
87
|
+
- custom/path/file2
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
EOF
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
# Prepend new entry to changes log (newest first)
|
|
96
|
+
{
|
|
97
|
+
echo "$ENTRY"
|
|
98
|
+
cat "$CHANGES_LOG"
|
|
99
|
+
} > "$CHANGES_LOG.tmp" && mv "$CHANGES_LOG.tmp" "$CHANGES_LOG" 2>/dev/null
|
|
100
|
+
|
|
101
|
+
exit 0
|