@techwavedev/agi-agent-kit 1.1.5 → 1.2.1

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.

Potentially problematic release.


This version of @techwavedev/agi-agent-kit might be problematic. Click here for more details.

Files changed (237) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +190 -12
  3. package/bin/init.js +30 -2
  4. package/package.json +6 -3
  5. package/templates/base/AGENTS.md +54 -23
  6. package/templates/base/README.md +325 -0
  7. package/templates/base/directives/memory_integration.md +95 -0
  8. package/templates/base/execution/memory_manager.py +309 -0
  9. package/templates/base/execution/session_boot.py +218 -0
  10. package/templates/base/execution/session_init.py +320 -0
  11. package/templates/base/skill-creator/LICENSE.txt +0 -0
  12. package/templates/base/skill-creator/references/output-patterns.md +0 -0
  13. package/templates/base/skill-creator/references/workflows.md +0 -0
  14. package/templates/base/skill-creator/scripts/init_skill.py +0 -0
  15. package/templates/base/skill-creator/scripts/package_skill.py +0 -0
  16. package/templates/base/skill-creator/scripts/quick_validate.py +0 -0
  17. package/templates/skills/core/documentation/SKILL.md +0 -0
  18. package/templates/skills/core/documentation/references/best_practices.md +0 -0
  19. package/templates/skills/core/documentation/scripts/analyze_code.py +0 -0
  20. package/templates/skills/core/documentation/scripts/detect_changes.py +0 -0
  21. package/templates/skills/core/documentation/scripts/generate_changelog.py +0 -0
  22. package/templates/skills/core/documentation/scripts/sync_docs.py +0 -0
  23. package/templates/skills/core/documentation/scripts/update_skill_docs.py +0 -0
  24. package/templates/skills/core/pdf-reader/SKILL.md +0 -0
  25. package/templates/skills/core/pdf-reader/references/pdf_libraries.md +0 -0
  26. package/templates/skills/core/pdf-reader/scripts/extract_text.py +0 -0
  27. package/templates/skills/core/qdrant-memory/SKILL.md +0 -0
  28. package/templates/skills/core/qdrant-memory/references/advanced_patterns.md +0 -0
  29. package/templates/skills/core/qdrant-memory/references/collection_schemas.md +0 -0
  30. package/templates/skills/core/qdrant-memory/references/complete_guide.md +0 -0
  31. package/templates/skills/core/qdrant-memory/references/embedding_models.md +0 -0
  32. package/templates/skills/core/qdrant-memory/scripts/__pycache__/embedding_utils.cpython-314.pyc +0 -0
  33. package/templates/skills/core/qdrant-memory/scripts/__pycache__/init_collection.cpython-314.pyc +0 -0
  34. package/templates/skills/core/qdrant-memory/scripts/benchmark_token_savings.py +0 -0
  35. package/templates/skills/core/qdrant-memory/scripts/embedding_utils.py +0 -0
  36. package/templates/skills/core/qdrant-memory/scripts/hybrid_search.py +0 -0
  37. package/templates/skills/core/qdrant-memory/scripts/init_collection.py +0 -0
  38. package/templates/skills/core/qdrant-memory/scripts/memory_retrieval.py +0 -0
  39. package/templates/skills/core/qdrant-memory/scripts/semantic_cache.py +0 -0
  40. package/templates/skills/core/qdrant-memory/scripts/test_skill.py +0 -0
  41. package/templates/skills/core/webcrawler/references/advanced_crawling.md +0 -0
  42. package/templates/skills/core/webcrawler/scripts/crawl_docs.py +0 -0
  43. package/templates/skills/core/webcrawler/scripts/extract_page.py +0 -0
  44. package/templates/skills/core/webcrawler/scripts/filter_docs.py +0 -0
  45. package/templates/skills/ec/README.md +31 -0
  46. package/templates/skills/ec/aws/SKILL.md +1020 -0
  47. package/templates/skills/ec/aws/defaults.yaml +13 -0
  48. package/templates/skills/ec/aws/references/common_patterns.md +80 -0
  49. package/templates/skills/ec/aws/references/mcp_servers.md +98 -0
  50. package/templates/skills/ec/aws-terraform/SKILL.md +349 -0
  51. package/templates/skills/ec/aws-terraform/references/best_practices.md +394 -0
  52. package/templates/skills/ec/aws-terraform/references/checkov_reference.md +337 -0
  53. package/templates/skills/ec/aws-terraform/scripts/configure_mcp.py +150 -0
  54. package/templates/skills/ec/confluent-kafka/SKILL.md +655 -0
  55. package/templates/skills/ec/confluent-kafka/references/ansible_playbooks.md +792 -0
  56. package/templates/skills/ec/confluent-kafka/references/ec_deployment.md +579 -0
  57. package/templates/skills/ec/confluent-kafka/references/kraft_migration.md +490 -0
  58. package/templates/skills/ec/confluent-kafka/references/troubleshooting.md +778 -0
  59. package/templates/skills/ec/confluent-kafka/references/upgrade_7x_to_8x.md +488 -0
  60. package/templates/skills/ec/confluent-kafka/scripts/kafka_health_check.py +435 -0
  61. package/templates/skills/ec/confluent-kafka/scripts/upgrade_preflight.py +568 -0
  62. package/templates/skills/ec/confluent-kafka/scripts/validate_config.py +455 -0
  63. package/templates/skills/ec/consul/SKILL.md +427 -0
  64. package/templates/skills/ec/consul/references/acl_setup.md +168 -0
  65. package/templates/skills/ec/consul/references/ha_config.md +196 -0
  66. package/templates/skills/ec/consul/references/troubleshooting.md +267 -0
  67. package/templates/skills/ec/consul/references/upgrades.md +213 -0
  68. package/templates/skills/ec/consul/scripts/consul_health_report.py +530 -0
  69. package/templates/skills/ec/consul/scripts/consul_status.py +264 -0
  70. package/templates/skills/ec/consul/scripts/generate_values.py +170 -0
  71. package/templates/skills/ec/documentation/SKILL.md +351 -0
  72. package/templates/skills/ec/documentation/references/best_practices.md +201 -0
  73. package/templates/skills/ec/documentation/scripts/analyze_code.py +307 -0
  74. package/templates/skills/ec/documentation/scripts/detect_changes.py +460 -0
  75. package/templates/skills/ec/documentation/scripts/generate_changelog.py +312 -0
  76. package/templates/skills/ec/documentation/scripts/sync_docs.py +272 -0
  77. package/templates/skills/ec/documentation/scripts/update_skill_docs.py +366 -0
  78. package/templates/skills/ec/gitlab/SKILL.md +529 -0
  79. package/templates/skills/ec/gitlab/references/agent_installation.md +416 -0
  80. package/templates/skills/ec/gitlab/references/api_reference.md +508 -0
  81. package/templates/skills/ec/gitlab/references/gitops_flux.md +465 -0
  82. package/templates/skills/ec/gitlab/references/troubleshooting.md +518 -0
  83. package/templates/skills/ec/gitlab/scripts/generate_agent_values.py +329 -0
  84. package/templates/skills/ec/gitlab/scripts/gitlab_agent_status.py +414 -0
  85. package/templates/skills/ec/jira/SKILL.md +484 -0
  86. package/templates/skills/ec/jira/references/jql_reference.md +148 -0
  87. package/templates/skills/ec/jira/scripts/add_comment.py +91 -0
  88. package/templates/skills/ec/jira/scripts/bulk_log_work.py +124 -0
  89. package/templates/skills/ec/jira/scripts/create_ticket.py +162 -0
  90. package/templates/skills/ec/jira/scripts/get_ticket.py +191 -0
  91. package/templates/skills/ec/jira/scripts/jira_client.py +383 -0
  92. package/templates/skills/ec/jira/scripts/log_work.py +154 -0
  93. package/templates/skills/ec/jira/scripts/search_tickets.py +104 -0
  94. package/templates/skills/ec/jira/scripts/update_comment.py +67 -0
  95. package/templates/skills/ec/jira/scripts/update_ticket.py +161 -0
  96. package/templates/skills/ec/karpenter/SKILL.md +301 -0
  97. package/templates/skills/ec/karpenter/references/ec2nodeclasses.md +421 -0
  98. package/templates/skills/ec/karpenter/references/migration.md +396 -0
  99. package/templates/skills/ec/karpenter/references/nodepools.md +400 -0
  100. package/templates/skills/ec/karpenter/references/troubleshooting.md +359 -0
  101. package/templates/skills/ec/karpenter/scripts/generate_ec2nodeclass.py +187 -0
  102. package/templates/skills/ec/karpenter/scripts/generate_nodepool.py +245 -0
  103. package/templates/skills/ec/karpenter/scripts/karpenter_status.py +359 -0
  104. package/templates/skills/ec/opensearch/SKILL.md +720 -0
  105. package/templates/skills/ec/opensearch/references/ml_neural_search.md +576 -0
  106. package/templates/skills/ec/opensearch/references/operator.md +532 -0
  107. package/templates/skills/ec/opensearch/references/query_dsl.md +532 -0
  108. package/templates/skills/ec/opensearch/scripts/configure_mcp.py +148 -0
  109. package/templates/skills/ec/victoriametrics/SKILL.md +598 -0
  110. package/templates/skills/ec/victoriametrics/references/kubernetes.md +531 -0
  111. package/templates/skills/ec/victoriametrics/references/prometheus_migration.md +333 -0
  112. package/templates/skills/ec/victoriametrics/references/troubleshooting.md +442 -0
  113. package/templates/skills/knowledge/SKILLS_CATALOG.md +1066 -0
  114. package/templates/skills/knowledge/api-patterns/SKILL.md +0 -0
  115. package/templates/skills/knowledge/api-patterns/api-style.md +0 -0
  116. package/templates/skills/knowledge/api-patterns/auth.md +0 -0
  117. package/templates/skills/knowledge/api-patterns/documentation.md +0 -0
  118. package/templates/skills/knowledge/api-patterns/graphql.md +0 -0
  119. package/templates/skills/knowledge/api-patterns/rate-limiting.md +0 -0
  120. package/templates/skills/knowledge/api-patterns/response.md +0 -0
  121. package/templates/skills/knowledge/api-patterns/rest.md +0 -0
  122. package/templates/skills/knowledge/api-patterns/scripts/api_validator.py +0 -0
  123. package/templates/skills/knowledge/api-patterns/security-testing.md +0 -0
  124. package/templates/skills/knowledge/api-patterns/trpc.md +0 -0
  125. package/templates/skills/knowledge/api-patterns/versioning.md +0 -0
  126. package/templates/skills/knowledge/app-builder/SKILL.md +0 -0
  127. package/templates/skills/knowledge/app-builder/agent-coordination.md +0 -0
  128. package/templates/skills/knowledge/app-builder/feature-building.md +0 -0
  129. package/templates/skills/knowledge/app-builder/project-detection.md +0 -0
  130. package/templates/skills/knowledge/app-builder/scaffolding.md +0 -0
  131. package/templates/skills/knowledge/app-builder/tech-stack.md +0 -0
  132. package/templates/skills/knowledge/app-builder/templates/SKILL.md +0 -0
  133. package/templates/skills/knowledge/app-builder/templates/astro-static/TEMPLATE.md +0 -0
  134. package/templates/skills/knowledge/app-builder/templates/chrome-extension/TEMPLATE.md +0 -0
  135. package/templates/skills/knowledge/app-builder/templates/cli-tool/TEMPLATE.md +0 -0
  136. package/templates/skills/knowledge/app-builder/templates/electron-desktop/TEMPLATE.md +0 -0
  137. package/templates/skills/knowledge/app-builder/templates/express-api/TEMPLATE.md +0 -0
  138. package/templates/skills/knowledge/app-builder/templates/flutter-app/TEMPLATE.md +0 -0
  139. package/templates/skills/knowledge/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -0
  140. package/templates/skills/knowledge/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -0
  141. package/templates/skills/knowledge/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -0
  142. package/templates/skills/knowledge/app-builder/templates/nextjs-static/TEMPLATE.md +0 -0
  143. package/templates/skills/knowledge/app-builder/templates/nuxt-app/TEMPLATE.md +0 -0
  144. package/templates/skills/knowledge/app-builder/templates/python-fastapi/TEMPLATE.md +0 -0
  145. package/templates/skills/knowledge/app-builder/templates/react-native-app/TEMPLATE.md +0 -0
  146. package/templates/skills/knowledge/architecture/SKILL.md +0 -0
  147. package/templates/skills/knowledge/architecture/context-discovery.md +0 -0
  148. package/templates/skills/knowledge/architecture/examples.md +0 -0
  149. package/templates/skills/knowledge/architecture/pattern-selection.md +0 -0
  150. package/templates/skills/knowledge/architecture/patterns-reference.md +0 -0
  151. package/templates/skills/knowledge/architecture/trade-off-analysis.md +0 -0
  152. package/templates/skills/knowledge/bash-linux/SKILL.md +0 -0
  153. package/templates/skills/knowledge/behavioral-modes/SKILL.md +0 -0
  154. package/templates/skills/knowledge/brainstorming/SKILL.md +0 -0
  155. package/templates/skills/knowledge/brainstorming/dynamic-questioning.md +0 -0
  156. package/templates/skills/knowledge/clean-code/SKILL.md +0 -0
  157. package/templates/skills/knowledge/code-review-checklist/SKILL.md +0 -0
  158. package/templates/skills/knowledge/database-design/SKILL.md +0 -0
  159. package/templates/skills/knowledge/database-design/database-selection.md +0 -0
  160. package/templates/skills/knowledge/database-design/indexing.md +0 -0
  161. package/templates/skills/knowledge/database-design/migrations.md +0 -0
  162. package/templates/skills/knowledge/database-design/optimization.md +0 -0
  163. package/templates/skills/knowledge/database-design/orm-selection.md +0 -0
  164. package/templates/skills/knowledge/database-design/schema-design.md +0 -0
  165. package/templates/skills/knowledge/database-design/scripts/schema_validator.py +0 -0
  166. package/templates/skills/knowledge/deployment-procedures/SKILL.md +0 -0
  167. package/templates/skills/knowledge/documentation-templates/SKILL.md +0 -0
  168. package/templates/skills/knowledge/frontend-design/SKILL.md +0 -0
  169. package/templates/skills/knowledge/frontend-design/animation-guide.md +0 -0
  170. package/templates/skills/knowledge/frontend-design/color-system.md +0 -0
  171. package/templates/skills/knowledge/frontend-design/decision-trees.md +0 -0
  172. package/templates/skills/knowledge/frontend-design/motion-graphics.md +0 -0
  173. package/templates/skills/knowledge/frontend-design/scripts/accessibility_checker.py +0 -0
  174. package/templates/skills/knowledge/frontend-design/scripts/ux_audit.py +0 -0
  175. package/templates/skills/knowledge/frontend-design/typography-system.md +0 -0
  176. package/templates/skills/knowledge/frontend-design/ux-psychology.md +0 -0
  177. package/templates/skills/knowledge/frontend-design/visual-effects.md +0 -0
  178. package/templates/skills/knowledge/game-development/2d-games/SKILL.md +0 -0
  179. package/templates/skills/knowledge/game-development/3d-games/SKILL.md +0 -0
  180. package/templates/skills/knowledge/game-development/SKILL.md +0 -0
  181. package/templates/skills/knowledge/game-development/game-art/SKILL.md +0 -0
  182. package/templates/skills/knowledge/game-development/game-audio/SKILL.md +0 -0
  183. package/templates/skills/knowledge/game-development/game-design/SKILL.md +0 -0
  184. package/templates/skills/knowledge/game-development/mobile-games/SKILL.md +0 -0
  185. package/templates/skills/knowledge/game-development/multiplayer/SKILL.md +0 -0
  186. package/templates/skills/knowledge/game-development/pc-games/SKILL.md +0 -0
  187. package/templates/skills/knowledge/game-development/vr-ar/SKILL.md +0 -0
  188. package/templates/skills/knowledge/game-development/web-games/SKILL.md +0 -0
  189. package/templates/skills/knowledge/geo-fundamentals/SKILL.md +0 -0
  190. package/templates/skills/knowledge/geo-fundamentals/scripts/geo_checker.py +0 -0
  191. package/templates/skills/knowledge/i18n-localization/SKILL.md +0 -0
  192. package/templates/skills/knowledge/i18n-localization/scripts/i18n_checker.py +0 -0
  193. package/templates/skills/knowledge/intelligent-routing/SKILL.md +237 -164
  194. package/templates/skills/knowledge/jira/scripts/__pycache__/jira_client.cpython-314.pyc +0 -0
  195. package/templates/skills/knowledge/lint-and-validate/SKILL.md +0 -0
  196. package/templates/skills/knowledge/lint-and-validate/scripts/lint_runner.py +0 -0
  197. package/templates/skills/knowledge/lint-and-validate/scripts/type_coverage.py +0 -0
  198. package/templates/skills/knowledge/mcp-builder/SKILL.md +0 -0
  199. package/templates/skills/knowledge/mobile-design/SKILL.md +0 -0
  200. package/templates/skills/knowledge/mobile-design/decision-trees.md +0 -0
  201. package/templates/skills/knowledge/mobile-design/mobile-backend.md +0 -0
  202. package/templates/skills/knowledge/mobile-design/mobile-color-system.md +0 -0
  203. package/templates/skills/knowledge/mobile-design/mobile-debugging.md +0 -0
  204. package/templates/skills/knowledge/mobile-design/mobile-design-thinking.md +0 -0
  205. package/templates/skills/knowledge/mobile-design/mobile-navigation.md +0 -0
  206. package/templates/skills/knowledge/mobile-design/mobile-performance.md +0 -0
  207. package/templates/skills/knowledge/mobile-design/mobile-testing.md +0 -0
  208. package/templates/skills/knowledge/mobile-design/mobile-typography.md +0 -0
  209. package/templates/skills/knowledge/mobile-design/platform-android.md +0 -0
  210. package/templates/skills/knowledge/mobile-design/platform-ios.md +0 -0
  211. package/templates/skills/knowledge/mobile-design/scripts/mobile_audit.py +0 -0
  212. package/templates/skills/knowledge/mobile-design/touch-psychology.md +0 -0
  213. package/templates/skills/knowledge/nextjs-best-practices/SKILL.md +0 -0
  214. package/templates/skills/knowledge/nodejs-best-practices/SKILL.md +0 -0
  215. package/templates/skills/knowledge/parallel-agents/SKILL.md +345 -73
  216. package/templates/skills/knowledge/performance-profiling/SKILL.md +0 -0
  217. package/templates/skills/knowledge/performance-profiling/scripts/lighthouse_audit.py +0 -0
  218. package/templates/skills/knowledge/plan-writing/SKILL.md +0 -0
  219. package/templates/skills/knowledge/plugin-discovery/SKILL.md +582 -0
  220. package/templates/skills/knowledge/plugin-discovery/scripts/platform_setup.py +1083 -0
  221. package/templates/skills/knowledge/powershell-windows/SKILL.md +0 -0
  222. package/templates/skills/knowledge/python-patterns/SKILL.md +0 -0
  223. package/templates/skills/knowledge/react-patterns/SKILL.md +0 -0
  224. package/templates/skills/knowledge/red-team-tactics/SKILL.md +0 -0
  225. package/templates/skills/knowledge/seo-fundamentals/SKILL.md +0 -0
  226. package/templates/skills/knowledge/seo-fundamentals/scripts/seo_checker.py +0 -0
  227. package/templates/skills/knowledge/server-management/SKILL.md +0 -0
  228. package/templates/skills/knowledge/systematic-debugging/SKILL.md +0 -0
  229. package/templates/skills/knowledge/tailwind-patterns/SKILL.md +0 -0
  230. package/templates/skills/knowledge/tdd-workflow/SKILL.md +0 -0
  231. package/templates/skills/knowledge/testing-patterns/SKILL.md +0 -0
  232. package/templates/skills/knowledge/testing-patterns/scripts/test_runner.py +0 -0
  233. package/templates/skills/knowledge/vulnerability-scanner/SKILL.md +0 -0
  234. package/templates/skills/knowledge/vulnerability-scanner/checklists.md +0 -0
  235. package/templates/skills/knowledge/vulnerability-scanner/scripts/security_scan.py +0 -0
  236. package/templates/skills/knowledge/webapp-testing/SKILL.md +0 -0
  237. package/templates/skills/knowledge/webapp-testing/scripts/playwright_runner.py +0 -0
@@ -0,0 +1,532 @@
1
+ # Query DSL Reference
2
+
3
+ Complete reference for OpenSearch Query DSL patterns.
4
+
5
+ ## Full-Text Queries
6
+
7
+ ### Match Query
8
+
9
+ ```json
10
+ {
11
+ "query": {
12
+ "match": {
13
+ "message": {
14
+ "query": "error connection",
15
+ "operator": "and",
16
+ "fuzziness": "AUTO"
17
+ }
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+ ### Multi-Match Query
24
+
25
+ ```json
26
+ {
27
+ "query": {
28
+ "multi_match": {
29
+ "query": "kubernetes deployment",
30
+ "fields": ["title^3", "description^2", "content"],
31
+ "type": "best_fields",
32
+ "tie_breaker": 0.3
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ **Types:**
39
+
40
+ - `best_fields` - Score from best matching field
41
+ - `most_fields` - Combine scores from all fields
42
+ - `cross_fields` - Treat fields as one field
43
+ - `phrase` - Match as phrase
44
+ - `phrase_prefix` - Match phrase prefix
45
+
46
+ ### Match Phrase
47
+
48
+ ```json
49
+ {
50
+ "query": {
51
+ "match_phrase": {
52
+ "message": {
53
+ "query": "connection timed out",
54
+ "slop": 2
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### Query String
62
+
63
+ ```json
64
+ {
65
+ "query": {
66
+ "query_string": {
67
+ "query": "status:error AND service:(api OR auth)",
68
+ "default_field": "message",
69
+ "analyze_wildcard": true
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Term-Level Queries
78
+
79
+ ### Term Query (Exact Match)
80
+
81
+ ```json
82
+ {
83
+ "query": {
84
+ "term": {
85
+ "status.keyword": "ERROR"
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ ### Terms Query (Multiple Values)
92
+
93
+ ```json
94
+ {
95
+ "query": {
96
+ "terms": {
97
+ "service": ["api-gateway", "auth-service", "user-service"]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ ### Range Query
104
+
105
+ ```json
106
+ {
107
+ "query": {
108
+ "range": {
109
+ "@timestamp": {
110
+ "gte": "now-1h",
111
+ "lt": "now",
112
+ "time_zone": "+01:00"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ ```json
120
+ {
121
+ "query": {
122
+ "range": {
123
+ "response_time_ms": {
124
+ "gte": 500,
125
+ "lte": 5000
126
+ }
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ ### Exists Query
133
+
134
+ ```json
135
+ {
136
+ "query": {
137
+ "exists": {
138
+ "field": "error.stack_trace"
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ ### Prefix Query
145
+
146
+ ```json
147
+ {
148
+ "query": {
149
+ "prefix": {
150
+ "hostname.keyword": "prod-api-"
151
+ }
152
+ }
153
+ }
154
+ ```
155
+
156
+ ### Wildcard Query
157
+
158
+ ```json
159
+ {
160
+ "query": {
161
+ "wildcard": {
162
+ "email.keyword": "*@company.com"
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ ### Regexp Query
169
+
170
+ ```json
171
+ {
172
+ "query": {
173
+ "regexp": {
174
+ "trace_id": "[a-f0-9]{32}"
175
+ }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Compound Queries
183
+
184
+ ### Bool Query
185
+
186
+ ```json
187
+ {
188
+ "query": {
189
+ "bool": {
190
+ "must": [
191
+ { "match": { "status": "error" } },
192
+ { "range": { "@timestamp": { "gte": "now-24h" } } }
193
+ ],
194
+ "should": [
195
+ { "term": { "priority": "high" } },
196
+ { "term": { "priority": "critical" } }
197
+ ],
198
+ "must_not": [{ "term": { "acknowledged": true } }],
199
+ "filter": [{ "term": { "environment": "production" } }],
200
+ "minimum_should_match": 1,
201
+ "boost": 1.0
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ **Clauses:**
208
+
209
+ - `must` - Must match, contributes to score
210
+ - `should` - Optional, contributes to score
211
+ - `must_not` - Must not match, no scoring
212
+ - `filter` - Must match, no scoring (cached)
213
+
214
+ ### Boosting Query
215
+
216
+ ```json
217
+ {
218
+ "query": {
219
+ "boosting": {
220
+ "positive": {
221
+ "match": { "content": "kubernetes" }
222
+ },
223
+ "negative": {
224
+ "term": { "deprecated": true }
225
+ },
226
+ "negative_boost": 0.5
227
+ }
228
+ }
229
+ }
230
+ ```
231
+
232
+ ### Constant Score
233
+
234
+ ```json
235
+ {
236
+ "query": {
237
+ "constant_score": {
238
+ "filter": {
239
+ "term": { "status": "published" }
240
+ },
241
+ "boost": 1.2
242
+ }
243
+ }
244
+ }
245
+ ```
246
+
247
+ ### Dis Max Query
248
+
249
+ ```json
250
+ {
251
+ "query": {
252
+ "dis_max": {
253
+ "queries": [
254
+ { "match": { "title": "kubernetes" } },
255
+ { "match": { "body": "kubernetes" } }
256
+ ],
257
+ "tie_breaker": 0.7
258
+ }
259
+ }
260
+ }
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Aggregations
266
+
267
+ ### Bucket Aggregations
268
+
269
+ ```json
270
+ {
271
+ "size": 0,
272
+ "aggs": {
273
+ "by_service": {
274
+ "terms": {
275
+ "field": "service.keyword",
276
+ "size": 20,
277
+ "order": { "_count": "desc" }
278
+ }
279
+ },
280
+ "by_hour": {
281
+ "date_histogram": {
282
+ "field": "@timestamp",
283
+ "fixed_interval": "1h",
284
+ "min_doc_count": 0,
285
+ "extended_bounds": {
286
+ "min": "now-24h",
287
+ "max": "now"
288
+ }
289
+ }
290
+ },
291
+ "response_ranges": {
292
+ "range": {
293
+ "field": "response_time_ms",
294
+ "ranges": [
295
+ { "to": 100, "key": "fast" },
296
+ { "from": 100, "to": 500, "key": "normal" },
297
+ { "from": 500, "key": "slow" }
298
+ ]
299
+ }
300
+ }
301
+ }
302
+ }
303
+ ```
304
+
305
+ ### Metric Aggregations
306
+
307
+ ```json
308
+ {
309
+ "size": 0,
310
+ "aggs": {
311
+ "avg_response": { "avg": { "field": "response_time_ms" } },
312
+ "max_response": { "max": { "field": "response_time_ms" } },
313
+ "min_response": { "min": { "field": "response_time_ms" } },
314
+ "sum_bytes": { "sum": { "field": "bytes_transferred" } },
315
+ "request_count": { "value_count": { "field": "request_id" } },
316
+ "unique_users": { "cardinality": { "field": "user_id" } },
317
+ "response_stats": { "stats": { "field": "response_time_ms" } },
318
+ "percentiles": {
319
+ "percentiles": {
320
+ "field": "response_time_ms",
321
+ "percents": [50, 90, 95, 99]
322
+ }
323
+ }
324
+ }
325
+ }
326
+ ```
327
+
328
+ ### Nested Aggregations
329
+
330
+ ```json
331
+ {
332
+ "size": 0,
333
+ "aggs": {
334
+ "by_service": {
335
+ "terms": { "field": "service.keyword" },
336
+ "aggs": {
337
+ "by_status": {
338
+ "terms": { "field": "status.keyword" },
339
+ "aggs": {
340
+ "avg_duration": { "avg": { "field": "duration_ms" } }
341
+ }
342
+ },
343
+ "error_rate": {
344
+ "filter": { "term": { "status": "error" } },
345
+ "aggs": {
346
+ "count": { "value_count": { "field": "_id" } }
347
+ }
348
+ }
349
+ }
350
+ }
351
+ }
352
+ }
353
+ ```
354
+
355
+ ### Pipeline Aggregations
356
+
357
+ ```json
358
+ {
359
+ "size": 0,
360
+ "aggs": {
361
+ "by_hour": {
362
+ "date_histogram": {
363
+ "field": "@timestamp",
364
+ "fixed_interval": "1h"
365
+ },
366
+ "aggs": {
367
+ "avg_latency": { "avg": { "field": "latency_ms" } },
368
+ "latency_diff": {
369
+ "derivative": { "buckets_path": "avg_latency" }
370
+ },
371
+ "moving_avg_latency": {
372
+ "moving_avg": {
373
+ "buckets_path": "avg_latency",
374
+ "window": 5
375
+ }
376
+ }
377
+ }
378
+ }
379
+ }
380
+ }
381
+ ```
382
+
383
+ ---
384
+
385
+ ## Pagination
386
+
387
+ ### Standard Pagination
388
+
389
+ ```json
390
+ {
391
+ "from": 0,
392
+ "size": 20,
393
+ "query": { ... }
394
+ }
395
+ ```
396
+
397
+ **Limit:** `from + size` ≤ 10,000 by default.
398
+
399
+ ### Search After (Deep Pagination)
400
+
401
+ ```json
402
+ {
403
+ "size": 20,
404
+ "sort": [
405
+ { "@timestamp": "desc" },
406
+ { "_id": "asc" }
407
+ ],
408
+ "search_after": ["2024-01-20T00:00:00.000Z", "doc123"],
409
+ "query": { ... }
410
+ }
411
+ ```
412
+
413
+ ### Scroll API (Bulk Export)
414
+
415
+ ```bash
416
+ # Initial request
417
+ POST /logs/_search?scroll=5m
418
+ {
419
+ "size": 1000,
420
+ "query": { "match_all": {} }
421
+ }
422
+
423
+ # Continue with scroll_id
424
+ POST /_search/scroll
425
+ {
426
+ "scroll": "5m",
427
+ "scroll_id": "<scroll_id>"
428
+ }
429
+
430
+ # Clear scroll
431
+ DELETE /_search/scroll
432
+ {
433
+ "scroll_id": ["<scroll_id>"]
434
+ }
435
+ ```
436
+
437
+ ### Point in Time (PIT)
438
+
439
+ ```bash
440
+ # Create PIT
441
+ POST /logs/_pit?keep_alive=5m
442
+
443
+ # Search with PIT
444
+ POST /_search
445
+ {
446
+ "pit": {
447
+ "id": "<pit_id>",
448
+ "keep_alive": "5m"
449
+ },
450
+ "size": 100,
451
+ "query": { ... },
452
+ "search_after": [...]
453
+ }
454
+
455
+ # Delete PIT
456
+ DELETE /_pit
457
+ {
458
+ "id": "<pit_id>"
459
+ }
460
+ ```
461
+
462
+ ---
463
+
464
+ ## Scoring & Relevance
465
+
466
+ ### Function Score
467
+
468
+ ```json
469
+ {
470
+ "query": {
471
+ "function_score": {
472
+ "query": { "match": { "title": "kubernetes" } },
473
+ "functions": [
474
+ {
475
+ "filter": { "term": { "featured": true } },
476
+ "weight": 2
477
+ },
478
+ {
479
+ "field_value_factor": {
480
+ "field": "popularity",
481
+ "factor": 1.2,
482
+ "modifier": "sqrt",
483
+ "missing": 1
484
+ }
485
+ },
486
+ {
487
+ "gauss": {
488
+ "publish_date": {
489
+ "origin": "now",
490
+ "scale": "7d",
491
+ "decay": 0.5
492
+ }
493
+ }
494
+ }
495
+ ],
496
+ "score_mode": "multiply",
497
+ "boost_mode": "multiply"
498
+ }
499
+ }
500
+ }
501
+ ```
502
+
503
+ ### Explain Query
504
+
505
+ ```json
506
+ POST /index/_explain/doc_id
507
+ {
508
+ "query": {
509
+ "match": { "title": "kubernetes" }
510
+ }
511
+ }
512
+ ```
513
+
514
+ ---
515
+
516
+ ## SQL Plugin
517
+
518
+ ```json
519
+ POST /_plugins/_sql
520
+ {
521
+ "query": "SELECT service, COUNT(*) as count, AVG(response_time_ms) as avg_response FROM logs WHERE status = 'error' AND @timestamp > NOW() - INTERVAL 1 HOUR GROUP BY service ORDER BY count DESC LIMIT 10"
522
+ }
523
+ ```
524
+
525
+ ### SQL to DSL Translation
526
+
527
+ ```json
528
+ POST /_plugins/_sql/_explain
529
+ {
530
+ "query": "SELECT * FROM logs WHERE status = 'error'"
531
+ }
532
+ ```
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Script: configure_mcp.py
4
+ Purpose: Configure the OpenSearch MCP server for the current environment
5
+
6
+ Usage:
7
+ python configure_mcp.py [--url URL] [--username USER] [--password PASS] [--config-path PATH]
8
+
9
+ Arguments:
10
+ --url OpenSearch URL (default: https://localhost:9200)
11
+ --username OpenSearch username (default: admin)
12
+ --password OpenSearch password (from env OPENSEARCH_PASSWORD if not specified)
13
+ --config-path Path to MCP config file (auto-detected if not specified)
14
+
15
+ Exit Codes:
16
+ 0 - Success
17
+ 1 - Invalid arguments
18
+ 2 - Config file not found
19
+ 3 - JSON parse error
20
+ 4 - Write error
21
+ """
22
+
23
+ import argparse
24
+ import json
25
+ import os
26
+ import sys
27
+ from pathlib import Path
28
+
29
+
30
+ def get_default_config_path() -> Path:
31
+ """Get the default MCP configuration path based on the environment."""
32
+ home = Path.home()
33
+
34
+ candidates = [
35
+ home / ".gemini" / "settings.json",
36
+ home / ".kiro" / "settings" / "mcp.json",
37
+ home / ".cursor" / "mcp.json",
38
+ home / ".vscode" / "mcp.json",
39
+ home / ".config" / "mcp" / "settings.json",
40
+ ]
41
+
42
+ for path in candidates:
43
+ if path.exists():
44
+ return path
45
+
46
+ return home / ".gemini" / "settings.json"
47
+
48
+
49
+ def create_opensearch_mcp_config(url: str, username: str, password: str) -> dict:
50
+ """Create the OpenSearch MCP server configuration."""
51
+ return {
52
+ "opensearch-mcp": {
53
+ "command": "npx",
54
+ "args": ["-y", "opensearch-mcp-server"],
55
+ "env": {
56
+ "OPENSEARCH_URL": url,
57
+ "OPENSEARCH_USERNAME": username,
58
+ "OPENSEARCH_PASSWORD": password if password else "${OPENSEARCH_PASSWORD}",
59
+ "OPENSEARCH_SSL_VERIFY": "false"
60
+ },
61
+ "disabled": False,
62
+ "autoApprove": []
63
+ }
64
+ }
65
+
66
+
67
+ def main():
68
+ parser = argparse.ArgumentParser(
69
+ description="Configure the OpenSearch MCP server"
70
+ )
71
+ parser.add_argument(
72
+ "--url",
73
+ default="https://localhost:9200",
74
+ help="OpenSearch URL (default: https://localhost:9200)"
75
+ )
76
+ parser.add_argument(
77
+ "--username",
78
+ default="admin",
79
+ help="OpenSearch username (default: admin)"
80
+ )
81
+ parser.add_argument(
82
+ "--password",
83
+ default=os.environ.get("OPENSEARCH_PASSWORD", ""),
84
+ help="OpenSearch password (default: from OPENSEARCH_PASSWORD env)"
85
+ )
86
+ parser.add_argument(
87
+ "--config-path",
88
+ type=Path,
89
+ help="Path to MCP config file (auto-detected if not specified)"
90
+ )
91
+ parser.add_argument(
92
+ "--dry-run",
93
+ action="store_true",
94
+ help="Print configuration without writing"
95
+ )
96
+ args = parser.parse_args()
97
+
98
+ config_path = args.config_path or get_default_config_path()
99
+ new_server_config = create_opensearch_mcp_config(args.url, args.username, args.password)
100
+
101
+ if args.dry_run:
102
+ print(f"Config path: {config_path}")
103
+ print("\nOpenSearch MCP Server configuration:")
104
+ print(json.dumps(new_server_config, indent=2))
105
+ sys.exit(0)
106
+
107
+ if config_path.exists():
108
+ try:
109
+ with open(config_path, 'r') as f:
110
+ config = json.load(f)
111
+ except json.JSONDecodeError as e:
112
+ print(json.dumps({
113
+ "status": "error",
114
+ "message": f"Failed to parse config: {e}"
115
+ }), file=sys.stderr)
116
+ sys.exit(3)
117
+ else:
118
+ config = {}
119
+ config_path.parent.mkdir(parents=True, exist_ok=True)
120
+
121
+ if "mcpServers" not in config:
122
+ config["mcpServers"] = {}
123
+
124
+ config["mcpServers"].update(new_server_config)
125
+
126
+ try:
127
+ with open(config_path, 'w') as f:
128
+ json.dump(config, f, indent=2)
129
+
130
+ print(json.dumps({
131
+ "status": "success",
132
+ "config_path": str(config_path),
133
+ "server": "opensearch-mcp",
134
+ "url": args.url,
135
+ "username": args.username
136
+ }, indent=2))
137
+ sys.exit(0)
138
+
139
+ except IOError as e:
140
+ print(json.dumps({
141
+ "status": "error",
142
+ "message": f"Failed to write config: {e}"
143
+ }), file=sys.stderr)
144
+ sys.exit(4)
145
+
146
+
147
+ if __name__ == "__main__":
148
+ main()