@jaguilar87/gaia-ops 4.4.0 → 4.7.2
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-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +12 -3
- package/ARCHITECTURE.md +9 -8
- package/CHANGELOG.md +34 -0
- package/README.md +43 -11
- package/agents/terraform-architect.md +1 -1
- package/bin/README.md +2 -2
- package/bin/gaia-doctor.js +18 -5
- package/bin/gaia-history.js +0 -1
- package/bin/gaia-metrics.js +2 -2
- package/bin/gaia-scan.py +23 -1
- package/bin/gaia-update.js +346 -54
- package/bin/pre-publish-validate.js +33 -10
- package/commands/gaia.md +37 -0
- package/config/README.md +3 -9
- package/config/context-contracts.json +47 -15
- package/config/surface-routing.json +9 -1
- package/dist/gaia-ops/.claude-plugin/plugin.json +22 -0
- package/dist/gaia-ops/agents/cloud-troubleshooter.md +73 -0
- package/dist/gaia-ops/agents/devops-developer.md +57 -0
- package/dist/gaia-ops/agents/gaia-system.md +58 -0
- package/dist/gaia-ops/agents/gitops-operator.md +60 -0
- package/dist/gaia-ops/agents/speckit-planner.md +71 -0
- package/dist/gaia-ops/agents/terraform-architect.md +60 -0
- package/dist/gaia-ops/commands/gaia.md +37 -0
- package/dist/gaia-ops/config/README.md +58 -0
- package/dist/gaia-ops/config/cloud/aws.json +140 -0
- package/dist/gaia-ops/config/cloud/gcp.json +145 -0
- package/dist/gaia-ops/config/context-contracts.json +131 -0
- package/dist/gaia-ops/config/git_standards.json +72 -0
- package/dist/gaia-ops/config/surface-routing.json +197 -0
- package/dist/gaia-ops/config/universal-rules.json +10 -0
- package/dist/gaia-ops/hooks/adapters/__init__.py +52 -0
- package/dist/gaia-ops/hooks/adapters/base.py +219 -0
- package/dist/gaia-ops/hooks/adapters/channel.py +17 -0
- package/dist/gaia-ops/hooks/adapters/claude_code.py +1477 -0
- package/dist/gaia-ops/hooks/adapters/types.py +194 -0
- package/dist/gaia-ops/hooks/adapters/utils.py +25 -0
- package/dist/gaia-ops/hooks/hooks.json +126 -0
- package/dist/gaia-ops/hooks/modules/__init__.py +15 -0
- package/dist/gaia-ops/hooks/modules/agents/__init__.py +29 -0
- package/dist/gaia-ops/hooks/modules/agents/contract_validator.py +647 -0
- package/dist/gaia-ops/hooks/modules/agents/response_contract.py +496 -0
- package/dist/gaia-ops/hooks/modules/agents/skill_injection_verifier.py +124 -0
- package/dist/gaia-ops/hooks/modules/agents/task_info_builder.py +74 -0
- package/dist/gaia-ops/hooks/modules/agents/transcript_analyzer.py +458 -0
- package/dist/gaia-ops/hooks/modules/agents/transcript_reader.py +152 -0
- package/dist/gaia-ops/hooks/modules/audit/__init__.py +28 -0
- package/dist/gaia-ops/hooks/modules/audit/event_detector.py +168 -0
- package/dist/gaia-ops/hooks/modules/audit/logger.py +131 -0
- package/dist/gaia-ops/hooks/modules/audit/metrics.py +134 -0
- package/dist/gaia-ops/hooks/modules/audit/workflow_auditor.py +576 -0
- package/dist/gaia-ops/hooks/modules/audit/workflow_recorder.py +296 -0
- package/dist/gaia-ops/hooks/modules/context/__init__.py +11 -0
- package/dist/gaia-ops/hooks/modules/context/anchor_tracker.py +317 -0
- package/dist/gaia-ops/hooks/modules/context/compact_context_builder.py +215 -0
- package/dist/gaia-ops/hooks/modules/context/context_cache.py +129 -0
- package/dist/gaia-ops/hooks/modules/context/context_freshness.py +145 -0
- package/dist/gaia-ops/hooks/modules/context/context_injector.py +427 -0
- package/dist/gaia-ops/hooks/modules/context/context_writer.py +518 -0
- package/dist/gaia-ops/hooks/modules/context/contracts_loader.py +161 -0
- package/dist/gaia-ops/hooks/modules/core/__init__.py +40 -0
- package/dist/gaia-ops/hooks/modules/core/hook_entry.py +78 -0
- package/dist/gaia-ops/hooks/modules/core/paths.py +160 -0
- package/dist/gaia-ops/hooks/modules/core/plugin_mode.py +149 -0
- package/dist/gaia-ops/hooks/modules/core/plugin_setup.py +558 -0
- package/dist/gaia-ops/hooks/modules/core/state.py +179 -0
- package/dist/gaia-ops/hooks/modules/core/stdin.py +24 -0
- package/dist/gaia-ops/hooks/modules/events/__init__.py +1 -0
- package/dist/gaia-ops/hooks/modules/events/event_writer.py +210 -0
- package/dist/gaia-ops/hooks/modules/identity/__init__.py +0 -0
- package/dist/gaia-ops/hooks/modules/identity/identity_provider.py +21 -0
- package/dist/gaia-ops/hooks/modules/identity/ops_identity.py +34 -0
- package/dist/gaia-ops/hooks/modules/identity/security_identity.py +10 -0
- package/dist/gaia-ops/hooks/modules/memory/__init__.py +8 -0
- package/dist/gaia-ops/hooks/modules/memory/episode_writer.py +227 -0
- package/dist/gaia-ops/hooks/modules/orchestrator/__init__.py +1 -0
- package/dist/gaia-ops/hooks/modules/orchestrator/delegate_mode.py +128 -0
- package/dist/gaia-ops/hooks/modules/scanning/__init__.py +8 -0
- package/dist/gaia-ops/hooks/modules/scanning/scan_trigger.py +84 -0
- package/dist/gaia-ops/hooks/modules/security/__init__.py +89 -0
- package/dist/gaia-ops/hooks/modules/security/approval_cleanup.py +87 -0
- package/dist/gaia-ops/hooks/modules/security/approval_constants.py +23 -0
- package/dist/gaia-ops/hooks/modules/security/approval_grants.py +912 -0
- package/dist/gaia-ops/hooks/modules/security/approval_messages.py +71 -0
- package/dist/gaia-ops/hooks/modules/security/approval_scopes.py +153 -0
- package/dist/gaia-ops/hooks/modules/security/blocked_commands.py +584 -0
- package/dist/gaia-ops/hooks/modules/security/blocked_message_formatter.py +86 -0
- package/dist/gaia-ops/hooks/modules/security/command_semantics.py +130 -0
- package/dist/gaia-ops/hooks/modules/security/gitops_validator.py +179 -0
- package/dist/gaia-ops/hooks/modules/security/mutative_verbs.py +850 -0
- package/dist/gaia-ops/hooks/modules/security/prompt_validator.py +40 -0
- package/dist/gaia-ops/hooks/modules/security/tiers.py +196 -0
- package/dist/gaia-ops/hooks/modules/session/__init__.py +10 -0
- package/dist/gaia-ops/hooks/modules/session/session_context_writer.py +100 -0
- package/dist/gaia-ops/hooks/modules/session/session_event_injector.py +158 -0
- package/dist/gaia-ops/hooks/modules/session/session_manager.py +31 -0
- package/dist/gaia-ops/hooks/modules/tools/__init__.py +25 -0
- package/dist/gaia-ops/hooks/modules/tools/bash_validator.py +708 -0
- package/dist/gaia-ops/hooks/modules/tools/cloud_pipe_validator.py +181 -0
- package/dist/gaia-ops/hooks/modules/tools/hook_response.py +55 -0
- package/dist/gaia-ops/hooks/modules/tools/shell_parser.py +227 -0
- package/dist/gaia-ops/hooks/modules/tools/task_validator.py +283 -0
- package/dist/gaia-ops/hooks/modules/validation/__init__.py +23 -0
- package/dist/gaia-ops/hooks/modules/validation/commit_validator.py +380 -0
- package/dist/gaia-ops/hooks/post_compact.py +43 -0
- package/dist/gaia-ops/hooks/post_tool_use.py +54 -0
- package/dist/gaia-ops/hooks/pre_tool_use.py +383 -0
- package/dist/gaia-ops/hooks/session_start.py +69 -0
- package/dist/gaia-ops/hooks/stop_hook.py +69 -0
- package/dist/gaia-ops/hooks/subagent_start.py +71 -0
- package/dist/gaia-ops/hooks/subagent_stop.py +288 -0
- package/dist/gaia-ops/hooks/task_completed.py +70 -0
- package/dist/gaia-ops/hooks/user_prompt_submit.py +177 -0
- package/dist/gaia-ops/settings.json +72 -0
- package/dist/gaia-ops/skills/README.md +109 -0
- package/dist/gaia-ops/skills/agent-protocol/SKILL.md +105 -0
- package/dist/gaia-ops/skills/agent-protocol/examples.md +170 -0
- package/dist/gaia-ops/skills/agent-response/SKILL.md +53 -0
- package/dist/gaia-ops/skills/approval/SKILL.md +85 -0
- package/dist/gaia-ops/skills/approval/examples.md +140 -0
- package/dist/gaia-ops/skills/approval/reference.md +57 -0
- package/dist/gaia-ops/skills/command-execution/SKILL.md +64 -0
- package/dist/gaia-ops/skills/command-execution/reference.md +83 -0
- package/dist/gaia-ops/skills/context-updater/SKILL.md +76 -0
- package/dist/gaia-ops/skills/context-updater/examples.md +71 -0
- package/dist/gaia-ops/skills/developer-patterns/SKILL.md +93 -0
- package/dist/gaia-ops/skills/developer-patterns/reference.md +112 -0
- package/dist/gaia-ops/skills/execution/SKILL.md +66 -0
- package/dist/gaia-ops/skills/fast-queries/SKILL.md +47 -0
- package/dist/gaia-ops/skills/gaia-patterns/SKILL.md +92 -0
- package/dist/gaia-ops/skills/gaia-patterns/reference.md +22 -0
- package/dist/gaia-ops/skills/git-conventions/SKILL.md +48 -0
- package/dist/gaia-ops/skills/gitops-patterns/SKILL.md +73 -0
- package/dist/gaia-ops/skills/gitops-patterns/reference.md +183 -0
- package/dist/gaia-ops/skills/investigation/SKILL.md +77 -0
- package/dist/gaia-ops/skills/orchestrator-approval/SKILL.md +64 -0
- package/dist/gaia-ops/skills/reference.md +134 -0
- package/dist/gaia-ops/skills/security-tiers/SKILL.md +61 -0
- package/dist/gaia-ops/skills/security-tiers/destructive-commands-reference.md +623 -0
- package/dist/gaia-ops/skills/security-tiers/reference.md +39 -0
- package/dist/gaia-ops/skills/skill-creation/SKILL.md +119 -0
- package/dist/gaia-ops/skills/specification/SKILL.md +186 -0
- package/dist/gaia-ops/skills/speckit-workflow/SKILL.md +165 -0
- package/dist/gaia-ops/skills/speckit-workflow/reference.md +117 -0
- package/dist/gaia-ops/skills/terraform-patterns/SKILL.md +63 -0
- package/dist/gaia-ops/skills/terraform-patterns/reference.md +93 -0
- package/dist/gaia-ops/speckit/README.md +516 -0
- package/dist/gaia-ops/speckit/scripts/.gitkeep +0 -0
- package/dist/gaia-ops/speckit/templates/adr-template.md +118 -0
- package/dist/gaia-ops/speckit/templates/agent-file-template.md +23 -0
- package/dist/gaia-ops/speckit/templates/plan-template.md +227 -0
- package/dist/gaia-ops/speckit/templates/spec-template.md +140 -0
- package/dist/gaia-ops/speckit/templates/tasks-template.md +257 -0
- package/dist/gaia-ops/tools/context/README.md +132 -0
- package/dist/gaia-ops/tools/context/__init__.py +42 -0
- package/dist/gaia-ops/tools/context/_paths.py +20 -0
- package/dist/gaia-ops/tools/context/context_provider.py +476 -0
- package/dist/gaia-ops/tools/context/context_section_reader.py +330 -0
- package/dist/gaia-ops/tools/context/deep_merge.py +159 -0
- package/dist/gaia-ops/tools/context/pending_updates.py +760 -0
- package/dist/gaia-ops/tools/context/surface_router.py +278 -0
- package/dist/gaia-ops/tools/fast-queries/README.md +65 -0
- package/dist/gaia-ops/tools/fast-queries/__init__.py +30 -0
- package/dist/gaia-ops/tools/fast-queries/appservices/quicktriage_devops_developer.sh +75 -0
- package/dist/gaia-ops/tools/fast-queries/cloud/aws/quicktriage_aws_troubleshooter.sh +32 -0
- package/dist/gaia-ops/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh +88 -0
- package/dist/gaia-ops/tools/fast-queries/gitops/quicktriage_gitops_operator.sh +48 -0
- package/dist/gaia-ops/tools/fast-queries/run_triage.sh +59 -0
- package/dist/gaia-ops/tools/fast-queries/terraform/quicktriage_terraform_architect.sh +80 -0
- package/dist/gaia-ops/tools/gaia_simulator/__init__.py +33 -0
- package/dist/gaia-ops/tools/gaia_simulator/cli.py +354 -0
- package/dist/gaia-ops/tools/gaia_simulator/extractor.py +457 -0
- package/dist/gaia-ops/tools/gaia_simulator/reporter.py +258 -0
- package/dist/gaia-ops/tools/gaia_simulator/routing_simulator.py +334 -0
- package/dist/gaia-ops/tools/gaia_simulator/runner.py +539 -0
- package/dist/gaia-ops/tools/gaia_simulator/skills_mapper.py +262 -0
- package/dist/gaia-ops/tools/memory/README.md +0 -0
- package/dist/gaia-ops/tools/memory/__init__.py +20 -0
- package/dist/gaia-ops/tools/memory/episodic.py +1196 -0
- package/dist/gaia-ops/tools/persist_transcript_analysis.py +85 -0
- package/dist/gaia-ops/tools/review/__init__.py +1 -0
- package/dist/gaia-ops/tools/review/review_engine.py +157 -0
- package/dist/gaia-ops/tools/scan/__init__.py +35 -0
- package/dist/gaia-ops/tools/scan/config.py +247 -0
- package/dist/gaia-ops/tools/scan/merge.py +212 -0
- package/dist/gaia-ops/tools/scan/orchestrator.py +549 -0
- package/dist/gaia-ops/tools/scan/registry.py +127 -0
- package/dist/gaia-ops/tools/scan/scanners/__init__.py +18 -0
- package/dist/gaia-ops/tools/scan/scanners/base.py +137 -0
- package/dist/gaia-ops/tools/scan/scanners/environment.py +324 -0
- package/dist/gaia-ops/tools/scan/scanners/git.py +570 -0
- package/dist/gaia-ops/tools/scan/scanners/infrastructure.py +875 -0
- package/dist/gaia-ops/tools/scan/scanners/orchestration.py +600 -0
- package/dist/gaia-ops/tools/scan/scanners/stack.py +1085 -0
- package/dist/gaia-ops/tools/scan/scanners/tools.py +260 -0
- package/dist/gaia-ops/tools/scan/setup.py +753 -0
- package/dist/gaia-ops/tools/scan/tests/__init__.py +1 -0
- package/dist/gaia-ops/tools/scan/tests/conftest.py +796 -0
- package/dist/gaia-ops/tools/scan/tests/test_environment.py +323 -0
- package/dist/gaia-ops/tools/scan/tests/test_git.py +419 -0
- package/dist/gaia-ops/tools/scan/tests/test_infrastructure.py +382 -0
- package/dist/gaia-ops/tools/scan/tests/test_integration.py +920 -0
- package/dist/gaia-ops/tools/scan/tests/test_merge.py +269 -0
- package/dist/gaia-ops/tools/scan/tests/test_orchestration.py +304 -0
- package/dist/gaia-ops/tools/scan/tests/test_stack.py +604 -0
- package/dist/gaia-ops/tools/scan/tests/test_tools.py +349 -0
- package/dist/gaia-ops/tools/scan/ui.py +624 -0
- package/dist/gaia-ops/tools/scan/verify.py +266 -0
- package/dist/gaia-ops/tools/scan/walk.py +118 -0
- package/dist/gaia-ops/tools/scan/workspace.py +85 -0
- package/dist/gaia-ops/tools/validation/README.md +244 -0
- package/dist/gaia-ops/tools/validation/__init__.py +17 -0
- package/dist/gaia-ops/tools/validation/approval_gate.py +321 -0
- package/dist/gaia-ops/tools/validation/validate_skills.py +189 -0
- package/dist/gaia-security/.claude-plugin/plugin.json +22 -0
- package/dist/gaia-security/config/universal-rules.json +10 -0
- package/dist/gaia-security/hooks/adapters/__init__.py +52 -0
- package/dist/gaia-security/hooks/adapters/base.py +219 -0
- package/dist/gaia-security/hooks/adapters/channel.py +17 -0
- package/dist/gaia-security/hooks/adapters/claude_code.py +1477 -0
- package/dist/gaia-security/hooks/adapters/types.py +194 -0
- package/dist/gaia-security/hooks/adapters/utils.py +25 -0
- package/dist/gaia-security/hooks/hooks.json +57 -0
- package/dist/gaia-security/hooks/modules/__init__.py +15 -0
- package/dist/gaia-security/hooks/modules/agents/__init__.py +29 -0
- package/dist/gaia-security/hooks/modules/agents/contract_validator.py +647 -0
- package/dist/gaia-security/hooks/modules/agents/response_contract.py +496 -0
- package/dist/gaia-security/hooks/modules/agents/skill_injection_verifier.py +124 -0
- package/dist/gaia-security/hooks/modules/agents/task_info_builder.py +74 -0
- package/dist/gaia-security/hooks/modules/agents/transcript_analyzer.py +458 -0
- package/dist/gaia-security/hooks/modules/agents/transcript_reader.py +152 -0
- package/dist/gaia-security/hooks/modules/audit/__init__.py +28 -0
- package/dist/gaia-security/hooks/modules/audit/event_detector.py +168 -0
- package/dist/gaia-security/hooks/modules/audit/logger.py +131 -0
- package/dist/gaia-security/hooks/modules/audit/metrics.py +134 -0
- package/dist/gaia-security/hooks/modules/audit/workflow_auditor.py +576 -0
- package/dist/gaia-security/hooks/modules/audit/workflow_recorder.py +296 -0
- package/dist/gaia-security/hooks/modules/context/__init__.py +11 -0
- package/dist/gaia-security/hooks/modules/context/anchor_tracker.py +317 -0
- package/dist/gaia-security/hooks/modules/context/compact_context_builder.py +215 -0
- package/dist/gaia-security/hooks/modules/context/context_cache.py +129 -0
- package/dist/gaia-security/hooks/modules/context/context_freshness.py +145 -0
- package/dist/gaia-security/hooks/modules/context/context_injector.py +427 -0
- package/dist/gaia-security/hooks/modules/context/context_writer.py +518 -0
- package/dist/gaia-security/hooks/modules/context/contracts_loader.py +161 -0
- package/dist/gaia-security/hooks/modules/core/__init__.py +40 -0
- package/dist/gaia-security/hooks/modules/core/hook_entry.py +78 -0
- package/dist/gaia-security/hooks/modules/core/paths.py +160 -0
- package/dist/gaia-security/hooks/modules/core/plugin_mode.py +149 -0
- package/dist/gaia-security/hooks/modules/core/plugin_setup.py +558 -0
- package/dist/gaia-security/hooks/modules/core/state.py +179 -0
- package/dist/gaia-security/hooks/modules/core/stdin.py +24 -0
- package/dist/gaia-security/hooks/modules/events/__init__.py +1 -0
- package/dist/gaia-security/hooks/modules/events/event_writer.py +210 -0
- package/dist/gaia-security/hooks/modules/identity/__init__.py +0 -0
- package/dist/gaia-security/hooks/modules/identity/identity_provider.py +21 -0
- package/dist/gaia-security/hooks/modules/identity/ops_identity.py +34 -0
- package/dist/gaia-security/hooks/modules/identity/security_identity.py +10 -0
- package/dist/gaia-security/hooks/modules/memory/__init__.py +8 -0
- package/dist/gaia-security/hooks/modules/memory/episode_writer.py +227 -0
- package/dist/gaia-security/hooks/modules/orchestrator/__init__.py +1 -0
- package/dist/gaia-security/hooks/modules/orchestrator/delegate_mode.py +128 -0
- package/dist/gaia-security/hooks/modules/scanning/__init__.py +8 -0
- package/dist/gaia-security/hooks/modules/scanning/scan_trigger.py +84 -0
- package/dist/gaia-security/hooks/modules/security/__init__.py +89 -0
- package/dist/gaia-security/hooks/modules/security/approval_cleanup.py +87 -0
- package/dist/gaia-security/hooks/modules/security/approval_constants.py +23 -0
- package/dist/gaia-security/hooks/modules/security/approval_grants.py +912 -0
- package/dist/gaia-security/hooks/modules/security/approval_messages.py +71 -0
- package/dist/gaia-security/hooks/modules/security/approval_scopes.py +153 -0
- package/dist/gaia-security/hooks/modules/security/blocked_commands.py +584 -0
- package/dist/gaia-security/hooks/modules/security/blocked_message_formatter.py +86 -0
- package/dist/gaia-security/hooks/modules/security/command_semantics.py +130 -0
- package/dist/gaia-security/hooks/modules/security/gitops_validator.py +179 -0
- package/dist/gaia-security/hooks/modules/security/mutative_verbs.py +850 -0
- package/dist/gaia-security/hooks/modules/security/prompt_validator.py +40 -0
- package/dist/gaia-security/hooks/modules/security/tiers.py +196 -0
- package/dist/gaia-security/hooks/modules/session/__init__.py +10 -0
- package/dist/gaia-security/hooks/modules/session/session_context_writer.py +100 -0
- package/dist/gaia-security/hooks/modules/session/session_event_injector.py +158 -0
- package/dist/gaia-security/hooks/modules/session/session_manager.py +31 -0
- package/dist/gaia-security/hooks/modules/tools/__init__.py +25 -0
- package/dist/gaia-security/hooks/modules/tools/bash_validator.py +708 -0
- package/dist/gaia-security/hooks/modules/tools/cloud_pipe_validator.py +181 -0
- package/dist/gaia-security/hooks/modules/tools/hook_response.py +55 -0
- package/dist/gaia-security/hooks/modules/tools/shell_parser.py +227 -0
- package/dist/gaia-security/hooks/modules/tools/task_validator.py +283 -0
- package/dist/gaia-security/hooks/modules/validation/__init__.py +23 -0
- package/dist/gaia-security/hooks/modules/validation/commit_validator.py +380 -0
- package/dist/gaia-security/hooks/post_tool_use.py +54 -0
- package/dist/gaia-security/hooks/pre_tool_use.py +383 -0
- package/dist/gaia-security/hooks/session_start.py +69 -0
- package/dist/gaia-security/hooks/stop_hook.py +69 -0
- package/dist/gaia-security/hooks/user_prompt_submit.py +177 -0
- package/dist/gaia-security/settings.json +58 -0
- package/git-hooks/commit-msg +41 -0
- package/hooks/README.md +8 -6
- package/hooks/adapters/channel.py +0 -25
- package/hooks/adapters/claude_code.py +364 -125
- package/hooks/elicitation_result.py +132 -0
- package/hooks/hooks.json +10 -1
- package/hooks/modules/README.md +3 -2
- package/hooks/modules/agents/contract_validator.py +3 -51
- package/hooks/modules/agents/response_contract.py +4 -8
- package/hooks/modules/agents/transcript_reader.py +4 -5
- package/hooks/modules/audit/__init__.py +4 -6
- package/hooks/modules/audit/event_detector.py +0 -2
- package/hooks/modules/audit/metrics.py +108 -187
- package/hooks/modules/audit/workflow_auditor.py +0 -4
- package/hooks/modules/audit/workflow_recorder.py +0 -5
- package/hooks/modules/context/compact_context_builder.py +1 -0
- package/hooks/modules/context/context_cache.py +129 -0
- package/hooks/modules/context/context_injector.py +18 -40
- package/hooks/modules/context/context_writer.py +1 -25
- package/hooks/modules/context/contracts_loader.py +7 -10
- package/hooks/modules/core/hook_entry.py +1 -0
- package/hooks/modules/core/paths.py +12 -13
- package/hooks/modules/core/plugin_mode.py +74 -4
- package/hooks/modules/core/plugin_setup.py +395 -23
- package/hooks/modules/events/__init__.py +1 -0
- package/hooks/modules/events/event_writer.py +210 -0
- package/hooks/modules/identity/ops_identity.py +18 -27
- package/hooks/modules/memory/episode_writer.py +1 -6
- package/hooks/modules/orchestrator/__init__.py +1 -0
- package/hooks/modules/orchestrator/delegate_mode.py +128 -0
- package/hooks/modules/security/__init__.py +2 -4
- package/hooks/modules/security/approval_constants.py +5 -1
- package/hooks/modules/security/approval_grants.py +189 -6
- package/hooks/modules/security/approval_messages.py +9 -21
- package/hooks/modules/security/blocked_commands.py +98 -34
- package/hooks/modules/security/command_semantics.py +0 -4
- package/hooks/modules/security/gitops_validator.py +1 -11
- package/hooks/modules/security/mutative_verbs.py +179 -38
- package/hooks/modules/security/tiers.py +1 -19
- package/hooks/modules/session/session_event_injector.py +1 -25
- package/hooks/modules/tools/bash_validator.py +310 -94
- package/hooks/modules/tools/shell_parser.py +0 -1
- package/hooks/modules/tools/task_validator.py +9 -29
- package/hooks/post_tool_use.py +0 -72
- package/hooks/pre_tool_use.py +42 -102
- package/hooks/session_start.py +4 -2
- package/hooks/subagent_start.py +6 -2
- package/hooks/subagent_stop.py +1 -13
- package/hooks/user_prompt_submit.py +119 -37
- package/index.js +1 -1
- package/package.json +5 -3
- package/skills/README.md +3 -5
- package/skills/agent-protocol/SKILL.md +17 -16
- package/skills/agent-protocol/examples.md +6 -6
- package/skills/agent-response/SKILL.md +11 -14
- package/skills/approval/SKILL.md +28 -13
- package/skills/approval/reference.md +2 -2
- package/skills/execution/SKILL.md +1 -1
- package/skills/gaia-patterns/SKILL.md +2 -3
- package/skills/orchestrator-approval/SKILL.md +22 -50
- package/skills/security-tiers/SKILL.md +1 -1
- package/templates/README.md +9 -9
- package/templates/managed-settings.template.json +43 -0
- package/tools/gaia_simulator/runner.py +34 -1
- package/tools/scan/orchestrator.py +13 -0
- package/tools/scan/scanners/base.py +8 -0
- package/tools/scan/scanners/git.py +78 -0
- package/tools/scan/scanners/infrastructure.py +65 -0
- package/tools/scan/scanners/stack.py +110 -0
- package/tools/scan/setup.py +120 -13
- package/tools/scan/workspace.py +85 -0
- package/config/context-contracts.aws.json +0 -42
- package/config/context-contracts.gcp.json +0 -39
- package/skills/project-dispatch/SKILL.md +0 -34
- package/templates/settings.template.json +0 -226
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Surface routing and investigation brief generation.
|
|
4
|
+
|
|
5
|
+
Provides deterministic surface classification for Gaia tasks using generic
|
|
6
|
+
cross-repo surfaces instead of repo-specific routing tables.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
from dataclasses import asdict, dataclass
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any, Dict, List, Optional
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
from ._paths import resolve_config_dir
|
|
18
|
+
except ImportError:
|
|
19
|
+
from _paths import resolve_config_dir
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
DEFAULT_SURFACE_ROUTING_FILE = "surface-routing.json"
|
|
23
|
+
EVIDENCE_REPORT_FIELDS = [
|
|
24
|
+
"PATTERNS_CHECKED",
|
|
25
|
+
"FILES_CHECKED",
|
|
26
|
+
"COMMANDS_RUN",
|
|
27
|
+
"KEY_OUTPUTS",
|
|
28
|
+
"VERBATIM_OUTPUTS",
|
|
29
|
+
"CROSS_LAYER_IMPACTS",
|
|
30
|
+
"OPEN_GAPS",
|
|
31
|
+
]
|
|
32
|
+
# All fields including OWNERSHIP_ASSESSMENT (for investigation brief injection).
|
|
33
|
+
# The runtime validator in response_contract.py separates OWNERSHIP_ASSESSMENT
|
|
34
|
+
# for enum validation; its CONSOLIDATION_FIELDS list excludes it.
|
|
35
|
+
CONSOLIDATION_REPORT_FIELDS = [
|
|
36
|
+
"OWNERSHIP_ASSESSMENT",
|
|
37
|
+
"CONFIRMED_FINDINGS",
|
|
38
|
+
"SUSPECTED_FINDINGS",
|
|
39
|
+
"CONFLICTS",
|
|
40
|
+
"OPEN_GAPS",
|
|
41
|
+
"NEXT_BEST_AGENT",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _get_config_dir() -> Path:
|
|
46
|
+
"""Resolve config directory from installed project or package checkout."""
|
|
47
|
+
return resolve_config_dir()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def load_surface_routing_config(config_file: Optional[Path] = None) -> Dict[str, Any]:
|
|
51
|
+
"""Load surface routing config. Returns empty config if missing or invalid."""
|
|
52
|
+
if config_file is None:
|
|
53
|
+
config_file = _get_config_dir() / DEFAULT_SURFACE_ROUTING_FILE
|
|
54
|
+
|
|
55
|
+
if not config_file.is_file():
|
|
56
|
+
return {"version": "missing", "reconnaissance_agent": "devops-developer", "surfaces": {}}
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
return json.loads(config_file.read_text())
|
|
60
|
+
except Exception:
|
|
61
|
+
return {"version": "invalid", "reconnaissance_agent": "devops-developer", "surfaces": {}}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class SurfaceMatch:
|
|
66
|
+
surface: str
|
|
67
|
+
score: float
|
|
68
|
+
matched_signals: List[str]
|
|
69
|
+
|
|
70
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
71
|
+
return asdict(self)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _normalize_text(text: str) -> str:
|
|
75
|
+
return " ".join((text or "").lower().split())
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _score_surface(task_text: str, surface_name: str, surface_cfg: Dict[str, Any]) -> SurfaceMatch:
|
|
79
|
+
signals = surface_cfg.get("signals", {})
|
|
80
|
+
matched: List[str] = []
|
|
81
|
+
score = 0.0
|
|
82
|
+
|
|
83
|
+
for keyword in signals.get("keywords", []):
|
|
84
|
+
if keyword.lower() in task_text:
|
|
85
|
+
matched.append(keyword)
|
|
86
|
+
score += 1.0
|
|
87
|
+
|
|
88
|
+
for command in signals.get("commands", []):
|
|
89
|
+
if command.lower() in task_text:
|
|
90
|
+
matched.append(command)
|
|
91
|
+
score += 1.5
|
|
92
|
+
|
|
93
|
+
for artifact in signals.get("artifacts", []):
|
|
94
|
+
if artifact.lower() in task_text:
|
|
95
|
+
matched.append(artifact)
|
|
96
|
+
score += 1.0
|
|
97
|
+
|
|
98
|
+
# Small boost for explicit surface names.
|
|
99
|
+
if surface_name.lower() in task_text:
|
|
100
|
+
matched.append(surface_name)
|
|
101
|
+
score += 1.0
|
|
102
|
+
|
|
103
|
+
return SurfaceMatch(surface=surface_name, score=score, matched_signals=matched)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def classify_surfaces(
|
|
107
|
+
task: str,
|
|
108
|
+
*,
|
|
109
|
+
current_agent: str = "",
|
|
110
|
+
routing_config: Optional[Dict[str, Any]] = None,
|
|
111
|
+
) -> Dict[str, Any]:
|
|
112
|
+
"""
|
|
113
|
+
Deterministically classify active surfaces for a task.
|
|
114
|
+
|
|
115
|
+
The classifier uses generic surface signals, not repo-specific topology.
|
|
116
|
+
"""
|
|
117
|
+
config = routing_config or load_surface_routing_config()
|
|
118
|
+
surfaces_cfg = config.get("surfaces", {})
|
|
119
|
+
reconnaissance_agent = config.get("reconnaissance_agent", "devops-developer")
|
|
120
|
+
task_text = _normalize_text(task)
|
|
121
|
+
|
|
122
|
+
matches: List[SurfaceMatch] = []
|
|
123
|
+
for surface_name, surface_cfg in surfaces_cfg.items():
|
|
124
|
+
match = _score_surface(task_text, surface_name, surface_cfg)
|
|
125
|
+
if match.score > 0:
|
|
126
|
+
matches.append(match)
|
|
127
|
+
|
|
128
|
+
matches.sort(key=lambda item: item.score, reverse=True)
|
|
129
|
+
|
|
130
|
+
if matches:
|
|
131
|
+
top_score = matches[0].score
|
|
132
|
+
active_matches = [
|
|
133
|
+
match for match in matches
|
|
134
|
+
if match.score >= 1.0 and (match.score == top_score or match.score >= (top_score * 0.55))
|
|
135
|
+
]
|
|
136
|
+
else:
|
|
137
|
+
active_matches = []
|
|
138
|
+
|
|
139
|
+
agent_to_surface = {
|
|
140
|
+
cfg.get("primary_agent", ""): surface_name
|
|
141
|
+
for surface_name, cfg in surfaces_cfg.items()
|
|
142
|
+
}
|
|
143
|
+
fallback_surface = agent_to_surface.get(current_agent, "")
|
|
144
|
+
|
|
145
|
+
if not active_matches and fallback_surface:
|
|
146
|
+
active_matches = [SurfaceMatch(surface=fallback_surface, score=0.2, matched_signals=["agent-fallback"])]
|
|
147
|
+
|
|
148
|
+
active_surfaces = [match.surface for match in active_matches]
|
|
149
|
+
match_map = {match.surface: match for match in active_matches}
|
|
150
|
+
|
|
151
|
+
if not active_surfaces:
|
|
152
|
+
return {
|
|
153
|
+
"active_surfaces": [],
|
|
154
|
+
"primary_surface": "",
|
|
155
|
+
"multi_surface": False,
|
|
156
|
+
"dispatch_mode": "reconnaissance",
|
|
157
|
+
"confidence": 0.0,
|
|
158
|
+
"recommended_agents": [reconnaissance_agent],
|
|
159
|
+
"matched_signals": {},
|
|
160
|
+
"reconnaissance_agent": reconnaissance_agent,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if current_agent in agent_to_surface and agent_to_surface[current_agent] in active_surfaces:
|
|
164
|
+
primary_surface = agent_to_surface[current_agent]
|
|
165
|
+
else:
|
|
166
|
+
primary_surface = active_surfaces[0]
|
|
167
|
+
|
|
168
|
+
recommended_agents = []
|
|
169
|
+
for surface_name in active_surfaces:
|
|
170
|
+
agent = surfaces_cfg.get(surface_name, {}).get("primary_agent", "")
|
|
171
|
+
if agent and agent not in recommended_agents:
|
|
172
|
+
recommended_agents.append(agent)
|
|
173
|
+
|
|
174
|
+
if len(active_surfaces) == 1:
|
|
175
|
+
dispatch_mode = "single_surface"
|
|
176
|
+
elif "planning_specs" in active_surfaces:
|
|
177
|
+
dispatch_mode = "sequential"
|
|
178
|
+
else:
|
|
179
|
+
dispatch_mode = "parallel"
|
|
180
|
+
|
|
181
|
+
confidence = round(min(1.0, sum(match.score for match in active_matches) / max(len(active_matches) * 3.0, 1.0)), 2)
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
"active_surfaces": active_surfaces,
|
|
185
|
+
"primary_surface": primary_surface,
|
|
186
|
+
"multi_surface": len(active_surfaces) > 1,
|
|
187
|
+
"dispatch_mode": dispatch_mode,
|
|
188
|
+
"confidence": confidence,
|
|
189
|
+
"recommended_agents": recommended_agents or [reconnaissance_agent],
|
|
190
|
+
"matched_signals": {surface: match_map[surface].matched_signals for surface in active_surfaces},
|
|
191
|
+
"reconnaissance_agent": reconnaissance_agent,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def build_investigation_brief(
|
|
196
|
+
task: str,
|
|
197
|
+
agent_name: str,
|
|
198
|
+
contract_context: Dict[str, Any],
|
|
199
|
+
*,
|
|
200
|
+
routing_config: Optional[Dict[str, Any]] = None,
|
|
201
|
+
routing: Optional[Dict[str, Any]] = None,
|
|
202
|
+
) -> Dict[str, Any]:
|
|
203
|
+
"""
|
|
204
|
+
Build a deterministic investigation brief for the current agent.
|
|
205
|
+
"""
|
|
206
|
+
config = routing_config or load_surface_routing_config()
|
|
207
|
+
surfaces_cfg = config.get("surfaces", {})
|
|
208
|
+
if routing is None:
|
|
209
|
+
routing = classify_surfaces(task, current_agent=agent_name, routing_config=config)
|
|
210
|
+
|
|
211
|
+
primary_surface = routing.get("primary_surface", "")
|
|
212
|
+
primary_cfg = surfaces_cfg.get(primary_surface, {})
|
|
213
|
+
active_surfaces = routing.get("active_surfaces", [])
|
|
214
|
+
adjacent_surfaces = []
|
|
215
|
+
for surface_name in active_surfaces:
|
|
216
|
+
if surface_name != primary_surface and surface_name not in adjacent_surfaces:
|
|
217
|
+
adjacent_surfaces.append(surface_name)
|
|
218
|
+
for surface_name in primary_cfg.get("adjacent_surfaces", []):
|
|
219
|
+
if surface_name != primary_surface and surface_name not in adjacent_surfaces:
|
|
220
|
+
adjacent_surfaces.append(surface_name)
|
|
221
|
+
|
|
222
|
+
recommended_agents = routing.get("recommended_agents", [])
|
|
223
|
+
peer_agents = [agent for agent in recommended_agents if agent != agent_name]
|
|
224
|
+
|
|
225
|
+
agent_surface = ""
|
|
226
|
+
for surface_name, cfg in surfaces_cfg.items():
|
|
227
|
+
if cfg.get("primary_agent") == agent_name:
|
|
228
|
+
agent_surface = surface_name
|
|
229
|
+
break
|
|
230
|
+
|
|
231
|
+
if not active_surfaces:
|
|
232
|
+
role = "reconnaissance"
|
|
233
|
+
elif agent_surface == primary_surface:
|
|
234
|
+
role = "primary"
|
|
235
|
+
elif agent_surface in active_surfaces:
|
|
236
|
+
role = "cross_check"
|
|
237
|
+
else:
|
|
238
|
+
role = "adjacent"
|
|
239
|
+
|
|
240
|
+
cross_check_required = len(active_surfaces) > 1 or (agent_surface and agent_surface != primary_surface)
|
|
241
|
+
|
|
242
|
+
search_anchors = sorted(contract_context.keys())
|
|
243
|
+
required_checks = list(primary_cfg.get("required_checks", []))
|
|
244
|
+
for surface_name in adjacent_surfaces:
|
|
245
|
+
for check in surfaces_cfg.get(surface_name, {}).get("required_checks", []):
|
|
246
|
+
if check not in required_checks:
|
|
247
|
+
required_checks.append(check)
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
"goal": task,
|
|
251
|
+
"agent_role": role,
|
|
252
|
+
"primary_surface": primary_surface,
|
|
253
|
+
"active_surfaces": active_surfaces,
|
|
254
|
+
"adjacent_surfaces": adjacent_surfaces,
|
|
255
|
+
"dispatch_mode": routing.get("dispatch_mode", "single_surface"),
|
|
256
|
+
"cross_check_required": cross_check_required,
|
|
257
|
+
"patterns_required": True,
|
|
258
|
+
"contract_sections_to_anchor": search_anchors,
|
|
259
|
+
"required_checks": required_checks,
|
|
260
|
+
"evidence_required": EVIDENCE_REPORT_FIELDS,
|
|
261
|
+
"consolidation_required": cross_check_required,
|
|
262
|
+
"consolidation_fields": CONSOLIDATION_REPORT_FIELDS if cross_check_required else [],
|
|
263
|
+
"recommended_peer_agents": peer_agents,
|
|
264
|
+
"stop_conditions": [
|
|
265
|
+
"Stop when additional files or commands only confirm the same conclusion without changing the decision.",
|
|
266
|
+
"Do not declare cross-surface work complete without filling CROSS_LAYER_IMPACTS and OPEN_GAPS.",
|
|
267
|
+
"If another surface owns the fix, name the next agent instead of guessing across domains.",
|
|
268
|
+
],
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
__all__ = [
|
|
273
|
+
"EVIDENCE_REPORT_FIELDS",
|
|
274
|
+
"CONSOLIDATION_REPORT_FIELDS",
|
|
275
|
+
"build_investigation_brief",
|
|
276
|
+
"classify_surfaces",
|
|
277
|
+
"load_surface_routing_config",
|
|
278
|
+
]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Fast-Queries: Quick Health Checks
|
|
2
|
+
|
|
3
|
+
Optimized diagnostic scripts that provide instant health status in <5 seconds.
|
|
4
|
+
Only shows problems, not everything.
|
|
5
|
+
|
|
6
|
+
## Quick Usage
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Run all health checks
|
|
10
|
+
.claude/tools/fast-queries/run_triage.sh
|
|
11
|
+
|
|
12
|
+
# Run specific checks
|
|
13
|
+
.claude/tools/fast-queries/run_triage.sh gitops # Kubernetes/pods
|
|
14
|
+
.claude/tools/fast-queries/run_triage.sh terraform # Terraform validation
|
|
15
|
+
.claude/tools/fast-queries/run_triage.sh gcp # GCP resources
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Available Scripts
|
|
19
|
+
|
|
20
|
+
### 1. GitOps Health Check
|
|
21
|
+
```bash
|
|
22
|
+
.claude/tools/fast-queries/gitops/quicktriage_gitops_operator.sh [namespace]
|
|
23
|
+
```
|
|
24
|
+
**Output:** Only shows problematic pods, deployments not ready, and recent warnings.
|
|
25
|
+
|
|
26
|
+
### 2. Terraform Validation
|
|
27
|
+
```bash
|
|
28
|
+
.claude/tools/fast-queries/terraform/quicktriage_terraform_architect.sh [directory]
|
|
29
|
+
```
|
|
30
|
+
**Output:** ✅/❌ for format, validation, and drift detection.
|
|
31
|
+
|
|
32
|
+
### 3. GCP Resources Check
|
|
33
|
+
```bash
|
|
34
|
+
.claude/tools/fast-queries/cloud/gcp/quicktriage_gcp_troubleshooter.sh [project]
|
|
35
|
+
```
|
|
36
|
+
**Output:** Status of GKE clusters, Cloud SQL, recent errors, and quota warnings.
|
|
37
|
+
|
|
38
|
+
## For Agents
|
|
39
|
+
|
|
40
|
+
Add this to agent prompts for quick diagnostics:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Instead of multiple kubectl/terraform/gcloud commands:
|
|
44
|
+
bash .claude/tools/fast-queries/gitops/quicktriage_gitops_operator.sh namespace
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Output Format
|
|
48
|
+
|
|
49
|
+
All scripts follow the same pattern:
|
|
50
|
+
- ✅ = Healthy/OK
|
|
51
|
+
- ❌ = Problem detected
|
|
52
|
+
- ⚠️ = Warning/non-critical issue
|
|
53
|
+
|
|
54
|
+
Exit codes:
|
|
55
|
+
- 0 = All healthy
|
|
56
|
+
- 1 = Issues found
|
|
57
|
+
- 2 = Script error (missing tools)
|
|
58
|
+
|
|
59
|
+
## Performance
|
|
60
|
+
|
|
61
|
+
| Script | Duration | Focus |
|
|
62
|
+
|--------|----------|-------|
|
|
63
|
+
| GitOps | 2-3 sec | Pod/deployment health |
|
|
64
|
+
| Terraform | 3-4 sec | Validation & drift |
|
|
65
|
+
| GCP | 4-5 sec | Resource availability |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Fast-Queries Module: Agent diagnostic scripts
|
|
3
|
+
|
|
4
|
+
This module provides quick diagnostic and health-check scripts for each Gaia-Ops agent.
|
|
5
|
+
Scripts provide instant snapshots of system state without invoking the full orchestration workflow.
|
|
6
|
+
|
|
7
|
+
Typical usage:
|
|
8
|
+
# Run all diagnostics via CLI
|
|
9
|
+
$ .claude/tools/fast-queries/run_triage.sh all
|
|
10
|
+
|
|
11
|
+
# Run specific agent
|
|
12
|
+
$ .claude/tools/fast-queries/run_triage.sh terraform
|
|
13
|
+
|
|
14
|
+
Available agents:
|
|
15
|
+
- terraform: Terraform/Terragrunt validation
|
|
16
|
+
- gitops: Kubernetes/Flux/Helm snapshots
|
|
17
|
+
- gcp: GCP GKE/SQL/IAM diagnostics
|
|
18
|
+
- aws: AWS EKS/VPC/CloudWatch diagnostics
|
|
19
|
+
- devops: Application health & hygiene checks
|
|
20
|
+
|
|
21
|
+
See README.md for detailed documentation.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
__version__ = "1.0.0"
|
|
25
|
+
__all__ = [
|
|
26
|
+
"terraform",
|
|
27
|
+
"gitops",
|
|
28
|
+
"cloud",
|
|
29
|
+
"appservices",
|
|
30
|
+
]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# QuickTriage script for DevOps Developer
|
|
3
|
+
# Description: Quick health check for application services and development environment
|
|
4
|
+
|
|
5
|
+
# Usage: quicktriage_devops_developer.sh [repo_path]
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
REPO_PATH="${1:-.}"
|
|
10
|
+
|
|
11
|
+
echo "=========================================="
|
|
12
|
+
echo "DevOps Developer QuickTriage"
|
|
13
|
+
echo "=========================================="
|
|
14
|
+
echo "Repository: $REPO_PATH"
|
|
15
|
+
echo "=========================================="
|
|
16
|
+
echo ""
|
|
17
|
+
|
|
18
|
+
# Change to repo directory
|
|
19
|
+
cd "$REPO_PATH"
|
|
20
|
+
|
|
21
|
+
# Check for common configuration files
|
|
22
|
+
echo "### Configuration Files ###"
|
|
23
|
+
for file in package.json docker-compose.yml Dockerfile .env.example Makefile; do
|
|
24
|
+
if [ -f "$file" ]; then
|
|
25
|
+
echo "[OK] $file exists"
|
|
26
|
+
else
|
|
27
|
+
echo "[--] $file not found"
|
|
28
|
+
fi
|
|
29
|
+
done
|
|
30
|
+
echo ""
|
|
31
|
+
|
|
32
|
+
# Check git status
|
|
33
|
+
echo "### Git Status ###"
|
|
34
|
+
if [ -d ".git" ]; then
|
|
35
|
+
git status --short 2>/dev/null || echo "Git status failed"
|
|
36
|
+
echo ""
|
|
37
|
+
echo "Branch: $(git branch --show-current 2>/dev/null || echo 'unknown')"
|
|
38
|
+
else
|
|
39
|
+
echo "Not a git repository"
|
|
40
|
+
fi
|
|
41
|
+
echo ""
|
|
42
|
+
|
|
43
|
+
# Check for node modules (if package.json exists)
|
|
44
|
+
if [ -f "package.json" ]; then
|
|
45
|
+
echo "### Node.js Project ###"
|
|
46
|
+
if [ -d "node_modules" ]; then
|
|
47
|
+
echo "[OK] node_modules present"
|
|
48
|
+
else
|
|
49
|
+
echo "[WARN] node_modules missing - run npm install"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Check for common scripts
|
|
53
|
+
echo ""
|
|
54
|
+
echo "Available scripts:"
|
|
55
|
+
if command -v jq &> /dev/null; then
|
|
56
|
+
jq -r '.scripts | keys[]' package.json 2>/dev/null | head -10 || echo "Could not parse scripts"
|
|
57
|
+
else
|
|
58
|
+
grep -A20 '"scripts"' package.json 2>/dev/null | head -10 || echo "Could not read scripts"
|
|
59
|
+
fi
|
|
60
|
+
echo ""
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Check Docker
|
|
64
|
+
echo "### Docker Status ###"
|
|
65
|
+
if command -v docker &> /dev/null; then
|
|
66
|
+
echo "[OK] Docker available"
|
|
67
|
+
docker info --format '{{.ContainersRunning}} containers running' 2>/dev/null || echo "Docker not accessible"
|
|
68
|
+
else
|
|
69
|
+
echo "[--] Docker not installed"
|
|
70
|
+
fi
|
|
71
|
+
echo ""
|
|
72
|
+
|
|
73
|
+
echo "=========================================="
|
|
74
|
+
echo "QuickTriage Complete"
|
|
75
|
+
echo "=========================================="
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# QuickTriage script for AWS Troubleshooter
|
|
3
|
+
# Status: STANDBY - AWS agent not yet active
|
|
4
|
+
|
|
5
|
+
# Description: Quick health check for AWS infrastructure
|
|
6
|
+
# Usage: quicktriage_aws_troubleshooter.sh [profile] [region]
|
|
7
|
+
# Note: This agent is currently in standby mode
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
PROFILE="${1:-default}"
|
|
12
|
+
REGION="${2:-us-east-1}"
|
|
13
|
+
|
|
14
|
+
echo "=========================================="
|
|
15
|
+
echo "AWS QuickTriage - Troubleshooter"
|
|
16
|
+
echo "=========================================="
|
|
17
|
+
echo "Profile: $PROFILE"
|
|
18
|
+
echo "Region: $REGION"
|
|
19
|
+
echo "Status: STANDBY"
|
|
20
|
+
echo "=========================================="
|
|
21
|
+
echo ""
|
|
22
|
+
echo "AWS Troubleshooter is in standby mode."
|
|
23
|
+
echo "Use GCP Troubleshooter for cloud diagnostics."
|
|
24
|
+
echo ""
|
|
25
|
+
echo "When activated, this script will check:"
|
|
26
|
+
echo " - EC2 instance status"
|
|
27
|
+
echo " - RDS database health"
|
|
28
|
+
echo " - EKS cluster status"
|
|
29
|
+
echo " - IAM role configurations"
|
|
30
|
+
echo " - CloudWatch alarms"
|
|
31
|
+
echo ""
|
|
32
|
+
echo "=========================================="
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# QuickTriage for GCP - Optimized version
|
|
3
|
+
# Only shows critical resource status
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
PROJECT="${GCP_PROJECT:-${1:-}}"
|
|
8
|
+
CLUSTER="${GKE_CLUSTER:-${2:-}}"
|
|
9
|
+
REGION="${GKE_REGION:-${3:-us-central1}}"
|
|
10
|
+
|
|
11
|
+
# Get current project if not specified
|
|
12
|
+
if [ -z "$PROJECT" ]; then
|
|
13
|
+
PROJECT=$(gcloud config get-value project 2>/dev/null || echo "")
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
echo "=== GCP HEALTH CHECK: ${PROJECT:-no-project} ==="
|
|
17
|
+
|
|
18
|
+
if ! command -v gcloud >/dev/null 2>&1; then
|
|
19
|
+
echo "❌ gcloud CLI not installed"
|
|
20
|
+
exit 2
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [ -z "$PROJECT" ]; then
|
|
24
|
+
echo "❌ No GCP project configured"
|
|
25
|
+
echo " Run: gcloud config set project PROJECT_ID"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# 1. GKE Clusters status (only if unhealthy)
|
|
30
|
+
echo -n "GKE Clusters: "
|
|
31
|
+
CLUSTERS=$(gcloud container clusters list --project="$PROJECT" --format="value(name,status)" 2>/dev/null || echo "")
|
|
32
|
+
if [ -z "$CLUSTERS" ]; then
|
|
33
|
+
echo "⚠️ No clusters found"
|
|
34
|
+
else
|
|
35
|
+
UNHEALTHY=$(echo "$CLUSTERS" | grep -v "RUNNING" || echo "")
|
|
36
|
+
if [ -n "$UNHEALTHY" ]; then
|
|
37
|
+
echo "❌ Issues detected"
|
|
38
|
+
echo "$UNHEALTHY" | awk '{printf " - %s: %s\n", $1, $2}'
|
|
39
|
+
else
|
|
40
|
+
CLUSTER_COUNT=$(echo "$CLUSTERS" | wc -l)
|
|
41
|
+
echo "✅ $CLUSTER_COUNT cluster(s) running"
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# 2. Cloud SQL status (only if issues)
|
|
46
|
+
echo -n "Cloud SQL: "
|
|
47
|
+
SQL_INSTANCES=$(gcloud sql instances list --project="$PROJECT" --format="value(name,state)" 2>/dev/null || echo "")
|
|
48
|
+
if [ -z "$SQL_INSTANCES" ]; then
|
|
49
|
+
echo "⚠️ No instances found"
|
|
50
|
+
else
|
|
51
|
+
SQL_DOWN=$(echo "$SQL_INSTANCES" | grep -v "RUNNABLE" || echo "")
|
|
52
|
+
if [ -n "$SQL_DOWN" ]; then
|
|
53
|
+
echo "❌ Issues detected"
|
|
54
|
+
echo "$SQL_DOWN" | awk '{printf " - %s: %s\n", $1, $2}'
|
|
55
|
+
else
|
|
56
|
+
SQL_COUNT=$(echo "$SQL_INSTANCES" | wc -l)
|
|
57
|
+
echo "✅ $SQL_COUNT instance(s) running"
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# 3. Recent errors (only critical)
|
|
62
|
+
echo -n "Recent errors: "
|
|
63
|
+
ERROR_COUNT=$(gcloud logging read "severity>=ERROR AND timestamp>=\"$(date -u -d '1 hour ago' '+%Y-%m-%dT%H:%M:%S')\"" \
|
|
64
|
+
--limit=10 --project="$PROJECT" --format="value(textPayload)" 2>/dev/null | wc -l || echo "0")
|
|
65
|
+
|
|
66
|
+
if [ "$ERROR_COUNT" -gt 0 ]; then
|
|
67
|
+
echo "⚠️ $ERROR_COUNT errors in last hour"
|
|
68
|
+
# Show top 3 error sources
|
|
69
|
+
gcloud logging read "severity>=ERROR AND timestamp>=\"$(date -u -d '1 hour ago' '+%Y-%m-%dT%H:%M:%S')\"" \
|
|
70
|
+
--limit=10 --project="$PROJECT" --format="value(resource.labels.cluster_name,textPayload)" 2>/dev/null | \
|
|
71
|
+
head -3 | sed 's/^/ - /' || true
|
|
72
|
+
else
|
|
73
|
+
echo "✅ No recent errors"
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# 4. Quota warnings (only if near limits)
|
|
77
|
+
echo -n "Quota status: "
|
|
78
|
+
QUOTA_ISSUES=$(gcloud compute project-info describe --project="$PROJECT" --format="value(quotas[].usage,quotas[].limit)" 2>/dev/null | \
|
|
79
|
+
awk '{if ($1/$2 > 0.8) print "High usage"}' | head -1 || echo "")
|
|
80
|
+
|
|
81
|
+
if [ -n "$QUOTA_ISSUES" ]; then
|
|
82
|
+
echo "⚠️ Some quotas >80% used"
|
|
83
|
+
else
|
|
84
|
+
echo "✅ All quotas healthy"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Exit code based on critical issues
|
|
88
|
+
[ -n "$UNHEALTHY" ] || [ -n "$SQL_DOWN" ] && exit 1 || exit 0
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# QuickTriage for GitOps - Optimized version
|
|
3
|
+
# Only shows problems, not everything
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
NAMESPACE="${1:-tcm-non-prod}"
|
|
8
|
+
|
|
9
|
+
echo "=== HEALTH CHECK: $NAMESPACE ==="
|
|
10
|
+
|
|
11
|
+
# 1. Only problematic pods (not all pods)
|
|
12
|
+
PROBLEM_PODS=$(kubectl get pods -n "$NAMESPACE" --no-headers 2>/dev/null | grep -v "Running\|Completed" || echo "")
|
|
13
|
+
if [ -n "$PROBLEM_PODS" ]; then
|
|
14
|
+
echo "❌ PODS WITH ISSUES:"
|
|
15
|
+
echo "$PROBLEM_PODS" | awk '{printf " - %s: %s (restarts: %s)\n", $1, $3, $4}'
|
|
16
|
+
else
|
|
17
|
+
echo "✅ All pods healthy"
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# 2. Only deployments with missing replicas
|
|
21
|
+
DEPLOY_ISSUES=$(kubectl get deploy -n "$NAMESPACE" --no-headers 2>/dev/null | awk '$2!=$3 {print $1, $2"/"$3}' || echo "")
|
|
22
|
+
if [ -n "$DEPLOY_ISSUES" ]; then
|
|
23
|
+
echo "❌ DEPLOYMENTS NOT READY:"
|
|
24
|
+
echo "$DEPLOY_ISSUES" | awk '{printf " - %s: %s replicas\n", $1, $2}'
|
|
25
|
+
else
|
|
26
|
+
echo "✅ All deployments ready"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# 3. HelmRelease summary (1 line)
|
|
30
|
+
if command -v kubectl >/dev/null 2>&1 && kubectl api-resources | grep -q helmrelease 2>/dev/null; then
|
|
31
|
+
HR_COUNT=$(kubectl get helmrelease -n "$NAMESPACE" --no-headers 2>/dev/null | wc -l || echo "0")
|
|
32
|
+
HR_FAILED=$(kubectl get helmrelease -n "$NAMESPACE" --no-headers 2>/dev/null | grep -c False || echo "0")
|
|
33
|
+
if [ "$HR_FAILED" -gt 0 ]; then
|
|
34
|
+
echo "❌ HelmReleases: $HR_FAILED/$HR_COUNT failed"
|
|
35
|
+
elif [ "$HR_COUNT" -gt 0 ]; then
|
|
36
|
+
echo "✅ HelmReleases: $HR_COUNT healthy"
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# 4. Recent warnings only (last 5)
|
|
41
|
+
WARNINGS=$(kubectl get events -n "$NAMESPACE" --field-selector type=Warning --no-headers 2>/dev/null | tail -5 || echo "")
|
|
42
|
+
if [ -n "$WARNINGS" ]; then
|
|
43
|
+
echo "⚠️ Recent warnings:"
|
|
44
|
+
echo "$WARNINGS" | awk '{print " - " $5 ": " substr($0, index($0,$6))}'
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# Exit code based on issues
|
|
48
|
+
[ -n "$PROBLEM_PODS" ] || [ -n "$DEPLOY_ISSUES" ] || [ "$HR_FAILED" -gt 0 ] && exit 1 || exit 0
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Fast-Queries Runner - Simplified version
|
|
3
|
+
# Only runs the 3 essential triages
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
SELECTED="${1:-all}"
|
|
9
|
+
|
|
10
|
+
# Colors for output
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
YELLOW='\033[0;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
run_script() {
|
|
17
|
+
local script="$1"
|
|
18
|
+
local name="$2"
|
|
19
|
+
|
|
20
|
+
echo -e "\n${YELLOW}Running $name...${NC}"
|
|
21
|
+
|
|
22
|
+
if [ ! -f "$script" ]; then
|
|
23
|
+
echo -e "${RED}✗ Script not found: $script${NC}"
|
|
24
|
+
return 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if bash "$script"; then
|
|
28
|
+
echo -e "${GREEN}✓ $name completed${NC}"
|
|
29
|
+
return 0
|
|
30
|
+
else
|
|
31
|
+
echo -e "${RED}✗ $name found issues${NC}"
|
|
32
|
+
return 1
|
|
33
|
+
fi
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
echo "=== FAST HEALTH CHECK ==="
|
|
37
|
+
|
|
38
|
+
case "$SELECTED" in
|
|
39
|
+
all)
|
|
40
|
+
run_script "$SCRIPT_DIR/gitops/quicktriage_gitops_operator.sh" "GitOps"
|
|
41
|
+
run_script "$SCRIPT_DIR/terraform/quicktriage_terraform_architect.sh" "Terraform"
|
|
42
|
+
run_script "$SCRIPT_DIR/cloud/gcp/quicktriage_gcp_troubleshooter.sh" "GCP"
|
|
43
|
+
;;
|
|
44
|
+
gitops|k8s|kubernetes)
|
|
45
|
+
run_script "$SCRIPT_DIR/gitops/quicktriage_gitops_operator.sh" "GitOps"
|
|
46
|
+
;;
|
|
47
|
+
terraform|tf)
|
|
48
|
+
run_script "$SCRIPT_DIR/terraform/quicktriage_terraform_architect.sh" "Terraform"
|
|
49
|
+
;;
|
|
50
|
+
gcp|cloud)
|
|
51
|
+
run_script "$SCRIPT_DIR/cloud/gcp/quicktriage_gcp_troubleshooter.sh" "GCP"
|
|
52
|
+
;;
|
|
53
|
+
*)
|
|
54
|
+
echo "Usage: $0 [all|gitops|terraform|gcp]"
|
|
55
|
+
exit 1
|
|
56
|
+
;;
|
|
57
|
+
esac
|
|
58
|
+
|
|
59
|
+
echo -e "\n${GREEN}Health check complete${NC}"
|