@jaguilar87/gaia-ops 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +315 -0
  2. package/CLAUDE.md +154 -0
  3. package/LICENSE +21 -0
  4. package/README.md +221 -0
  5. package/agents/aws-troubleshooter.md +50 -0
  6. package/agents/claude-architect.md +821 -0
  7. package/agents/devops-developer.md +92 -0
  8. package/agents/gcp-troubleshooter.md +50 -0
  9. package/agents/gitops-operator.md +360 -0
  10. package/agents/terraform-architect.md +289 -0
  11. package/bin/gaia-init.js +620 -0
  12. package/commands/architect.md +97 -0
  13. package/commands/restore-session.md +87 -0
  14. package/commands/save-session.md +88 -0
  15. package/commands/session-status.md +61 -0
  16. package/commands/speckit.add-task.md +144 -0
  17. package/commands/speckit.analyze-task.md +65 -0
  18. package/commands/speckit.implement.md +96 -0
  19. package/commands/speckit.init.md +237 -0
  20. package/commands/speckit.plan.md +88 -0
  21. package/commands/speckit.specify.md +161 -0
  22. package/commands/speckit.tasks.md +188 -0
  23. package/config/AGENTS.md +162 -0
  24. package/config/agent-catalog.md +604 -0
  25. package/config/context-contracts.md +682 -0
  26. package/config/git-standards.md +674 -0
  27. package/config/git_standards.json +69 -0
  28. package/config/orchestration-workflow.md +735 -0
  29. package/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
  30. package/hooks/__pycache__/pre_kubectl_security.cpython-312.pyc +0 -0
  31. package/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
  32. package/hooks/__pycache__/session_start.cpython-312.pyc +0 -0
  33. package/hooks/__pycache__/subagent_stop.cpython-312.pyc +0 -0
  34. package/hooks/post_tool_use.py +463 -0
  35. package/hooks/pre_kubectl_security.py +205 -0
  36. package/hooks/pre_tool_use.py +530 -0
  37. package/hooks/session_start.py +315 -0
  38. package/hooks/subagent_stop.py +549 -0
  39. package/index.js +92 -0
  40. package/package.json +59 -0
  41. package/speckit/README.en.md +648 -0
  42. package/speckit/README.md +353 -0
  43. package/speckit/governance.md +169 -0
  44. package/speckit/scripts/check-prerequisites.sh +194 -0
  45. package/speckit/scripts/common.sh +126 -0
  46. package/speckit/scripts/create-new-feature.sh +131 -0
  47. package/speckit/scripts/init.sh +42 -0
  48. package/speckit/scripts/setup-plan.sh +95 -0
  49. package/speckit/scripts/update-agent-context.sh +718 -0
  50. package/speckit/templates/adr-template.md +118 -0
  51. package/speckit/templates/agent-file-template.md +23 -0
  52. package/speckit/templates/plan-template.md +233 -0
  53. package/speckit/templates/spec-template.md +116 -0
  54. package/speckit/templates/tasks-template-bkp.md +136 -0
  55. package/speckit/templates/tasks-template.md +345 -0
  56. package/templates/CLAUDE.template.md +170 -0
  57. package/templates/code-examples/approval_gate_workflow.py +141 -0
  58. package/templates/code-examples/clarification_workflow.py +94 -0
  59. package/templates/code-examples/commit_validation.py +86 -0
  60. package/templates/project-context.template.json +126 -0
  61. package/templates/settings.template.json +307 -0
  62. package/tools/__pycache__/agent_router.cpython-312.pyc +0 -0
  63. package/tools/__pycache__/approval_gate.cpython-312.pyc +0 -0
  64. package/tools/__pycache__/clarify_engine.cpython-312.pyc +0 -0
  65. package/tools/__pycache__/clarify_patterns.cpython-312.pyc +0 -0
  66. package/tools/__pycache__/commit_validator.cpython-312.pyc +0 -0
  67. package/tools/__pycache__/context_section_reader.cpython-312.pyc +0 -0
  68. package/tools/__pycache__/routing_dashboard.cpython-312.pyc +0 -0
  69. package/tools/__pycache__/routing_feedback.cpython-312.pyc +0 -0
  70. package/tools/__pycache__/semantic_matcher.cpython-312.pyc +0 -0
  71. package/tools/__pycache__/task_manager.cpython-312.pyc +0 -0
  72. package/tools/agent_capabilities.json +231 -0
  73. package/tools/agent_invoker_helper.py +239 -0
  74. package/tools/agent_router.py +730 -0
  75. package/tools/approval_gate.py +318 -0
  76. package/tools/clarify_engine.py +511 -0
  77. package/tools/clarify_patterns.py +356 -0
  78. package/tools/commit_validator.py +338 -0
  79. package/tools/context_provider.py +181 -0
  80. package/tools/context_section_reader.py +301 -0
  81. package/tools/demo_clarify.py +104 -0
  82. package/tools/generate_embeddings.py +168 -0
  83. package/tools/quicktriage_aws_troubleshooter.sh +45 -0
  84. package/tools/quicktriage_devops_developer.sh +38 -0
  85. package/tools/quicktriage_gcp_troubleshooter.sh +51 -0
  86. package/tools/quicktriage_gitops_operator.sh +47 -0
  87. package/tools/quicktriage_terraform_architect.sh +40 -0
  88. package/tools/semantic_matcher.py +222 -0
  89. package/tools/task_manager.py +547 -0
  90. package/tools/task_manager_README.md +395 -0
  91. package/tools/task_manager_example.py +215 -0
@@ -0,0 +1,315 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Session start hook for Claude Code Agent System
4
+ Auto-primes environment and provides default context for new sessions
5
+ """
6
+
7
+ import os
8
+ import sys
9
+ import json
10
+ from datetime import datetime
11
+ from pathlib import Path
12
+ from typing import Dict, Any, Optional
13
+
14
+ class EnvironmentDetector:
15
+ """Detects current environment and workspace context"""
16
+
17
+ def __init__(self):
18
+ self.cwd = Path.cwd()
19
+ self.context = {}
20
+
21
+ def detect_workspace(self) -> Dict[str, Any]:
22
+ """Detect workspace type and project context"""
23
+
24
+ context = {
25
+ "working_directory": str(self.cwd),
26
+ "workspace_type": "unknown",
27
+ "projects": [],
28
+ "tools_available": [],
29
+ "environment": "development"
30
+ }
31
+
32
+ # Check for multi-project repository
33
+ if (self.cwd / "training-compliance-management").exists():
34
+ context["workspace_type"] = "multi-project"
35
+ context["projects"].append({
36
+ "name": "Training Compliance Management",
37
+ "path": "training-compliance-management",
38
+ "type": "application",
39
+ "tech_stack": "Node.js/TypeScript, NestJS, Next.js"
40
+ })
41
+
42
+ if (self.cwd / "terraform").exists():
43
+ context["projects"].append({
44
+ "name": "Infrastructure",
45
+ "path": "terraform",
46
+ "type": "infrastructure",
47
+ "tech_stack": "Terraform/Terragrunt"
48
+ })
49
+
50
+ if (self.cwd / "gitops").exists():
51
+ context["projects"].append({
52
+ "name": "GitOps",
53
+ "path": "gitops",
54
+ "type": "deployment",
55
+ "tech_stack": "Kubernetes/Flux CD"
56
+ })
57
+
58
+ # Check for agent system
59
+ if (self.cwd / ".claude").exists():
60
+ context["agent_system"] = True
61
+ context["projects"].append({
62
+ "name": "Agent System",
63
+ "path": ".claude",
64
+ "type": "devops-automation",
65
+ "tech_stack": "Claude Code Agents"
66
+ })
67
+
68
+ # Detect available tools
69
+ tools = []
70
+ if self._command_exists("terraform"):
71
+ tools.append("terraform")
72
+ if self._command_exists("kubectl"):
73
+ tools.append("kubectl")
74
+ if self._command_exists("helm"):
75
+ tools.append("helm")
76
+ if self._command_exists("gcloud"):
77
+ tools.append("gcloud")
78
+ if self._command_exists("flux"):
79
+ tools.append("flux")
80
+ if self._command_exists("docker"):
81
+ tools.append("docker")
82
+ if self._command_exists("npm"):
83
+ tools.append("npm")
84
+
85
+ context["tools_available"] = tools
86
+
87
+ return context
88
+
89
+ def _command_exists(self, command: str) -> bool:
90
+ """Check if a command exists in PATH"""
91
+ return os.system(f"which {command} >/dev/null 2>&1") == 0
92
+
93
+ def load_agent_config(self) -> Optional[Dict[str, Any]]:
94
+ """Load agent system configuration"""
95
+ settings_file = self.cwd / ".claude" / "settings.json"
96
+ if settings_file.exists():
97
+ try:
98
+ with open(settings_file, 'r') as f:
99
+ return json.load(f)
100
+ except Exception:
101
+ pass
102
+ return None
103
+
104
+ class SessionPrimer:
105
+ """Generates session primer content"""
106
+
107
+ def __init__(self, context: Dict[str, Any], config: Optional[Dict[str, Any]] = None):
108
+ self.context = context
109
+ self.config = config or {}
110
+
111
+ def generate_banner(self) -> str:
112
+ """Generate session start banner"""
113
+
114
+ banner = [
115
+ "🚀 Claude Code Agent System - Session Started",
116
+ "=" * 50,
117
+ "",
118
+ f"📁 **Workspace**: {self.context['workspace_type']}",
119
+ f"📍 **Directory**: {self.context['working_directory']}",
120
+ f"🕐 **Time**: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
121
+ "",
122
+ ]
123
+
124
+ # Project overview
125
+ if self.context.get("projects"):
126
+ banner.extend([
127
+ "📋 **Available Projects**:",
128
+ ""
129
+ ])
130
+
131
+ for project in self.context["projects"]:
132
+ icon = self._get_project_icon(project["type"])
133
+ banner.append(f" {icon} **{project['name']}** (`{project['path']}`)")
134
+ banner.append(f" └─ {project['tech_stack']}")
135
+
136
+ banner.append("")
137
+
138
+ # Tools available
139
+ if self.context.get("tools_available"):
140
+ banner.extend([
141
+ "🛠️ **Tools Available**: " + ", ".join(self.context["tools_available"]),
142
+ ""
143
+ ])
144
+
145
+ # Agent system status
146
+ if self.context.get("agent_system"):
147
+ banner.extend([
148
+ "🤖 **Agent System**: Active",
149
+ ""
150
+ ])
151
+
152
+ # Show available commands
153
+ if self.config.get("commands"):
154
+ banner.extend([
155
+ "⚡ **Available Commands**:",
156
+ ""
157
+ ])
158
+ for cmd_name, cmd_info in self.config["commands"].items():
159
+ banner.append(f" `/{cmd_name}` - {cmd_info.get('description', 'No description')}")
160
+
161
+ banner.append("")
162
+
163
+ return "\n".join(banner)
164
+
165
+ def _get_project_icon(self, project_type: str) -> str:
166
+ """Get icon for project type"""
167
+ icons = {
168
+ "application": "📱",
169
+ "infrastructure": "🏗️",
170
+ "deployment": "⚓",
171
+ "devops-automation": "🤖"
172
+ }
173
+ return icons.get(project_type, "📁")
174
+
175
+ def generate_environment_summary(self) -> str:
176
+ """Generate environment summary"""
177
+
178
+ summary = [
179
+ "## Environment Context",
180
+ ""
181
+ ]
182
+
183
+ # GCP context if available
184
+ env_config = self.config.get("environment", {})
185
+ if env_config:
186
+ summary.extend([
187
+ "☁️ **Cloud Environment**:",
188
+ f" - Project: {env_config.get('project_id', 'Unknown')}",
189
+ f" - Region: {env_config.get('region', 'Unknown')}",
190
+ f" - Cluster: {env_config.get('cluster_name', 'Unknown')}",
191
+ ""
192
+ ])
193
+
194
+ # Security context
195
+ summary.extend([
196
+ "🔒 **Security Context**:",
197
+ f" - Default Tier: {self.config.get('security', {}).get('default_tier', 'T0')}",
198
+ " - Read-only operations preferred",
199
+ " - Policy gates active",
200
+ ""
201
+ ])
202
+
203
+ return "\n".join(summary)
204
+
205
+ def generate_quick_start(self) -> str:
206
+ """Generate quick start guide"""
207
+
208
+ quick_start = [
209
+ "## Quick Start",
210
+ "",
211
+ "### Common Workflows:",
212
+ "",
213
+ "1. **Diagnose Task**: `/diagnose T004` or `/diagnose 'Check cluster health'`",
214
+ "2. **Enrich Tasks**: `/enrich --spec-kit-path=/path/to/spec`",
215
+ "3. **View Bundles**: `ls contexts/bundles/`",
216
+ "4. **Restore Context**: `./scripts/headless/reprime-from-bundle.sh latest`",
217
+ "",
218
+ "### Agent Specialists Available:",
219
+ ""
220
+ ]
221
+
222
+ # Show agents if available
223
+ agents = self.config.get("agents", {})
224
+ for agent_name, agent_info in agents.items():
225
+ triggers = agent_info.get("triggers", [])
226
+ trigger_text = ", ".join(triggers[:3]) + ("..." if len(triggers) > 3 else "")
227
+ quick_start.append(f" - **{agent_name}**: {trigger_text}")
228
+
229
+ quick_start.extend([
230
+ "",
231
+ "### Security Reminders:",
232
+ "- All destructive operations are blocked (T3 tier)",
233
+ "- Validation and dry-run operations are preferred",
234
+ "- Session activities are logged for audit",
235
+ ""
236
+ ])
237
+
238
+ return "\n".join(quick_start)
239
+
240
+ def session_start_hook() -> str:
241
+ """
242
+ Main session start hook
243
+
244
+ Returns:
245
+ Session primer content
246
+ """
247
+
248
+ try:
249
+ # Detect environment
250
+ detector = EnvironmentDetector()
251
+ context = detector.detect_workspace()
252
+ config = detector.load_agent_config()
253
+
254
+ # Generate primer
255
+ primer = SessionPrimer(context, config)
256
+
257
+ # Combine sections
258
+ content = [
259
+ primer.generate_banner(),
260
+ primer.generate_environment_summary(),
261
+ primer.generate_quick_start(),
262
+ "---",
263
+ "",
264
+ "🎯 **Ready for agent operations!**",
265
+ "Use `/diagnose` to route tasks to specialized agents or explore the available projects.",
266
+ ""
267
+ ]
268
+
269
+ return "\n".join(content)
270
+
271
+ except Exception as e:
272
+ return f"⚠️ Error generating session primer: {e}"
273
+
274
+ def main():
275
+ """CLI interface for session start hook"""
276
+
277
+ if len(sys.argv) > 1:
278
+ command = sys.argv[1]
279
+
280
+ if command == "--check":
281
+ # Check hook configuration
282
+ print("🔍 Checking session start hook configuration...")
283
+
284
+ detector = EnvironmentDetector()
285
+ context = detector.detect_workspace()
286
+ config = detector.load_agent_config()
287
+
288
+ print(f"✅ Workspace detected: {context['workspace_type']}")
289
+ print(f"✅ Projects found: {len(context.get('projects', []))}")
290
+ print(f"✅ Tools available: {len(context.get('tools_available', []))}")
291
+
292
+ if config:
293
+ print(f"✅ Agent config loaded: {len(config.get('agents', {}))} agents")
294
+ else:
295
+ print("⚠️ Agent config not found")
296
+
297
+ print("✅ Hook configuration check completed")
298
+
299
+ elif command == "--init":
300
+ # Initialize session
301
+ print("🚀 Initializing Claude Agent session...")
302
+ primer_content = session_start_hook()
303
+ print(primer_content)
304
+
305
+ else:
306
+ print(f"Unknown command: {command}")
307
+ print("Usage: python session_start.py [--check|--init]")
308
+
309
+ else:
310
+ # Default: output session primer
311
+ primer_content = session_start_hook()
312
+ print(primer_content)
313
+
314
+ if __name__ == "__main__":
315
+ main()