merlya 0.3.4__tar.gz

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 (308) hide show
  1. merlya-0.3.4/LICENSE +46 -0
  2. merlya-0.3.4/PKG-INFO +490 -0
  3. merlya-0.3.4/README.md +425 -0
  4. merlya-0.3.4/merlya/__init__.py +29 -0
  5. merlya-0.3.4/merlya/agents/__init__.py +61 -0
  6. merlya-0.3.4/merlya/agents/autogen_tools.py +117 -0
  7. merlya-0.3.4/merlya/agents/base.py +50 -0
  8. merlya-0.3.4/merlya/agents/base_orchestrator.py +196 -0
  9. merlya-0.3.4/merlya/agents/chain_of_thought.py +448 -0
  10. merlya-0.3.4/merlya/agents/cloud.py +79 -0
  11. merlya-0.3.4/merlya/agents/coordinator.py +188 -0
  12. merlya-0.3.4/merlya/agents/diagnostic.py +96 -0
  13. merlya-0.3.4/merlya/agents/knowledge_tools.py +178 -0
  14. merlya-0.3.4/merlya/agents/monitoring.py +70 -0
  15. merlya-0.3.4/merlya/agents/orchestrator.py +666 -0
  16. merlya-0.3.4/merlya/agents/orchestrator_service/continuation.py +283 -0
  17. merlya-0.3.4/merlya/agents/orchestrator_service/intent.py +288 -0
  18. merlya-0.3.4/merlya/agents/orchestrator_service/planner.py +768 -0
  19. merlya-0.3.4/merlya/agents/planner.py +454 -0
  20. merlya-0.3.4/merlya/agents/provisioning.py +79 -0
  21. merlya-0.3.4/merlya/agents/remediation.py +439 -0
  22. merlya-0.3.4/merlya/agents/request_classifier.py +436 -0
  23. merlya-0.3.4/merlya/agents/sentinel.py +341 -0
  24. merlya-0.3.4/merlya/agents/sentinel_service/alerts.py +176 -0
  25. merlya-0.3.4/merlya/agents/sentinel_service/checks.py +175 -0
  26. merlya-0.3.4/merlya/agents/sentinel_service/models.py +56 -0
  27. merlya-0.3.4/merlya/ci/__init__.py +88 -0
  28. merlya-0.3.4/merlya/ci/adapters/__init__.py +14 -0
  29. merlya-0.3.4/merlya/ci/adapters/base.py +207 -0
  30. merlya-0.3.4/merlya/ci/adapters/github.py +524 -0
  31. merlya-0.3.4/merlya/ci/analysis/__init__.py +10 -0
  32. merlya-0.3.4/merlya/ci/analysis/error_classifier.py +639 -0
  33. merlya-0.3.4/merlya/ci/clients/__init__.py +14 -0
  34. merlya-0.3.4/merlya/ci/clients/base.py +146 -0
  35. merlya-0.3.4/merlya/ci/clients/cli_client.py +412 -0
  36. merlya-0.3.4/merlya/ci/config.py +122 -0
  37. merlya-0.3.4/merlya/ci/learning/__init__.py +15 -0
  38. merlya-0.3.4/merlya/ci/learning/engine.py +299 -0
  39. merlya-0.3.4/merlya/ci/learning/memory_router.py +369 -0
  40. merlya-0.3.4/merlya/ci/manager.py +413 -0
  41. merlya-0.3.4/merlya/ci/models.py +186 -0
  42. merlya-0.3.4/merlya/ci/protocols.py +245 -0
  43. merlya-0.3.4/merlya/ci/registry.py +249 -0
  44. merlya-0.3.4/merlya/cli.py +355 -0
  45. merlya-0.3.4/merlya/commands/__init__.py +9 -0
  46. merlya-0.3.4/merlya/commands/builtin/healthcheck.md +37 -0
  47. merlya-0.3.4/merlya/commands/builtin/incident.md +33 -0
  48. merlya-0.3.4/merlya/commands/loader.py +272 -0
  49. merlya-0.3.4/merlya/context/__init__.py +88 -0
  50. merlya-0.3.4/merlya/context/cache_manager/__init__.py +35 -0
  51. merlya-0.3.4/merlya/context/cache_manager/executor.py +45 -0
  52. merlya-0.3.4/merlya/context/cache_manager/manager.py +456 -0
  53. merlya-0.3.4/merlya/context/cache_manager/models.py +67 -0
  54. merlya-0.3.4/merlya/context/cache_manager/stats.py +59 -0
  55. merlya-0.3.4/merlya/context/data_collector.py +363 -0
  56. merlya-0.3.4/merlya/context/discovery.py +126 -0
  57. merlya-0.3.4/merlya/context/host_registry.py +344 -0
  58. merlya-0.3.4/merlya/context/host_resolver.py +276 -0
  59. merlya-0.3.4/merlya/context/inventory_setup.py +458 -0
  60. merlya-0.3.4/merlya/context/inventory_sources.py +261 -0
  61. merlya-0.3.4/merlya/context/local_scanner/__init__.py +4 -0
  62. merlya-0.3.4/merlya/context/local_scanner/models.py +147 -0
  63. merlya-0.3.4/merlya/context/local_scanner/scanner.py +158 -0
  64. merlya-0.3.4/merlya/context/local_scanner/scanners/files.py +143 -0
  65. merlya-0.3.4/merlya/context/local_scanner/scanners/network.py +201 -0
  66. merlya-0.3.4/merlya/context/local_scanner/scanners/os_info.py +69 -0
  67. merlya-0.3.4/merlya/context/local_scanner/scanners/resources.py +183 -0
  68. merlya-0.3.4/merlya/context/local_scanner/scanners/services.py +150 -0
  69. merlya-0.3.4/merlya/context/manager.py +167 -0
  70. merlya-0.3.4/merlya/context/on_demand_scanner/__init__.py +29 -0
  71. merlya-0.3.4/merlya/context/on_demand_scanner/config.py +90 -0
  72. merlya-0.3.4/merlya/context/on_demand_scanner/models.py +23 -0
  73. merlya-0.3.4/merlya/context/on_demand_scanner/rate_limiter.py +94 -0
  74. merlya-0.3.4/merlya/context/on_demand_scanner/scanner.py +399 -0
  75. merlya-0.3.4/merlya/context/on_demand_scanner/ssh_scanner.py +416 -0
  76. merlya-0.3.4/merlya/context/smart_cache.py +204 -0
  77. merlya-0.3.4/merlya/context/sources/ansible.py +102 -0
  78. merlya-0.3.4/merlya/context/sources/base.py +103 -0
  79. merlya-0.3.4/merlya/context/sources/cloud.py +107 -0
  80. merlya-0.3.4/merlya/context/sources/local.py +109 -0
  81. merlya-0.3.4/merlya/context/sources/sqlite.py +119 -0
  82. merlya-0.3.4/merlya/context/utils.py +44 -0
  83. merlya-0.3.4/merlya/core/__init__.py +96 -0
  84. merlya-0.3.4/merlya/core/exceptions.py +253 -0
  85. merlya-0.3.4/merlya/core/hooks.py +360 -0
  86. merlya-0.3.4/merlya/core/protocols.py +169 -0
  87. merlya-0.3.4/merlya/core/registry.py +211 -0
  88. merlya-0.3.4/merlya/core/types.py +57 -0
  89. merlya-0.3.4/merlya/domains/__init__.py +6 -0
  90. merlya-0.3.4/merlya/domains/analysis/__init__.py +11 -0
  91. merlya-0.3.4/merlya/domains/analysis/service.py +198 -0
  92. merlya-0.3.4/merlya/domains/codegen/__init__.py +9 -0
  93. merlya-0.3.4/merlya/domains/codegen/generator.py +394 -0
  94. merlya-0.3.4/merlya/domains/codegen/templates/ansible/playbook.yml.j2 +43 -0
  95. merlya-0.3.4/merlya/domains/codegen/templates/docker/Dockerfile.j2 +40 -0
  96. merlya-0.3.4/merlya/domains/codegen/templates/k8s/deployment.yml.j2 +61 -0
  97. merlya-0.3.4/merlya/domains/codegen/templates/k8s/service.yml.j2 +33 -0
  98. merlya-0.3.4/merlya/domains/codegen/templates/terraform/main.tf.j2 +77 -0
  99. merlya-0.3.4/merlya/domains/codegen/validators.py +253 -0
  100. merlya-0.3.4/merlya/domains/entity_extraction/__init__.py +9 -0
  101. merlya-0.3.4/merlya/domains/entity_extraction/extractor.py +433 -0
  102. merlya-0.3.4/merlya/domains/error_correction/__init__.py +11 -0
  103. merlya-0.3.4/merlya/domains/error_correction/service.py +485 -0
  104. merlya-0.3.4/merlya/domains/info_request/__init__.py +11 -0
  105. merlya-0.3.4/merlya/domains/info_request/service.py +132 -0
  106. merlya-0.3.4/merlya/domains/investigation/__init__.py +13 -0
  107. merlya-0.3.4/merlya/domains/investigation/service.py +176 -0
  108. merlya-0.3.4/merlya/domains/orchestration/__init__.py +23 -0
  109. merlya-0.3.4/merlya/domains/orchestration/execution_coordinator.py +263 -0
  110. merlya-0.3.4/merlya/domains/orchestration/intelligence_engine.py +398 -0
  111. merlya-0.3.4/merlya/domains/orchestration/plan_manager.py +431 -0
  112. merlya-0.3.4/merlya/domains/orchestration/request_processor.py +343 -0
  113. merlya-0.3.4/merlya/domains/planning/__init__.py +15 -0
  114. merlya-0.3.4/merlya/domains/planning/executor.py +393 -0
  115. merlya-0.3.4/merlya/domains/planning/optimizer.py +294 -0
  116. merlya-0.3.4/merlya/domains/planning/validator.py +310 -0
  117. merlya-0.3.4/merlya/domains/predictive_scanning/__init__.py +11 -0
  118. merlya-0.3.4/merlya/domains/predictive_scanning/service.py +169 -0
  119. merlya-0.3.4/merlya/domains/preview/__init__.py +9 -0
  120. merlya-0.3.4/merlya/domains/preview/engine.py +122 -0
  121. merlya-0.3.4/merlya/domains/preview/formatters.py +131 -0
  122. merlya-0.3.4/merlya/domains/preview/previewer.py +189 -0
  123. merlya-0.3.4/merlya/domains/role_inference/__init__.py +10 -0
  124. merlya-0.3.4/merlya/domains/role_inference/service.py +217 -0
  125. merlya-0.3.4/merlya/domains/sources/__init__.py +21 -0
  126. merlya-0.3.4/merlya/domains/sources/connectors/__init__.py +25 -0
  127. merlya-0.3.4/merlya/domains/sources/connectors/api.py +213 -0
  128. merlya-0.3.4/merlya/domains/sources/connectors/base.py +117 -0
  129. merlya-0.3.4/merlya/domains/sources/connectors/mongodb.py +223 -0
  130. merlya-0.3.4/merlya/domains/sources/connectors/mysql.py +166 -0
  131. merlya-0.3.4/merlya/domains/sources/connectors/postgres.py +241 -0
  132. merlya-0.3.4/merlya/domains/sources/discovery.py +215 -0
  133. merlya-0.3.4/merlya/domains/sources/registry.py +241 -0
  134. merlya-0.3.4/merlya/domains/sources/router.py +444 -0
  135. merlya-0.3.4/merlya/domains/synthesis/__init__.py +14 -0
  136. merlya-0.3.4/merlya/domains/synthesis/analyzers.py +194 -0
  137. merlya-0.3.4/merlya/domains/synthesis/parsers.py +218 -0
  138. merlya-0.3.4/merlya/domains/synthesis/synthesizer.py +279 -0
  139. merlya-0.3.4/merlya/domains/tools/__init__.py +18 -0
  140. merlya-0.3.4/merlya/domains/tools/base.py +150 -0
  141. merlya-0.3.4/merlya/domains/tools/mcp_adapter.py +309 -0
  142. merlya-0.3.4/merlya/domains/tools/mcp_client.py +84 -0
  143. merlya-0.3.4/merlya/domains/tools/registry.py +224 -0
  144. merlya-0.3.4/merlya/domains/tools/selector.py +607 -0
  145. merlya-0.3.4/merlya/executors/__init__.py +0 -0
  146. merlya-0.3.4/merlya/executors/action_executor.py +418 -0
  147. merlya-0.3.4/merlya/executors/ansible.py +50 -0
  148. merlya-0.3.4/merlya/executors/auto_corrector.py +191 -0
  149. merlya-0.3.4/merlya/executors/aws.py +52 -0
  150. merlya-0.3.4/merlya/executors/connectivity.py +72 -0
  151. merlya-0.3.4/merlya/executors/k8s.py +53 -0
  152. merlya-0.3.4/merlya/executors/ssh.py +220 -0
  153. merlya-0.3.4/merlya/executors/ssh_connection_pool.py +242 -0
  154. merlya-0.3.4/merlya/executors/ssh_utils.py +182 -0
  155. merlya-0.3.4/merlya/executors/terraform.py +53 -0
  156. merlya-0.3.4/merlya/inventory/__init__.py +23 -0
  157. merlya-0.3.4/merlya/inventory/parser/__init__.py +4 -0
  158. merlya-0.3.4/merlya/inventory/parser/fallback_helper.py +148 -0
  159. merlya-0.3.4/merlya/inventory/parser/main.py +317 -0
  160. merlya-0.3.4/merlya/inventory/parser/models.py +51 -0
  161. merlya-0.3.4/merlya/inventory/parser/parsers/llm/__init__.py +3 -0
  162. merlya-0.3.4/merlya/inventory/parser/parsers/llm/config.py +57 -0
  163. merlya-0.3.4/merlya/inventory/parser/parsers/llm/engine.py +344 -0
  164. merlya-0.3.4/merlya/inventory/parser/parsers/llm/sanitizer.py +317 -0
  165. merlya-0.3.4/merlya/inventory/parser/parsers/llm/validator.py +239 -0
  166. merlya-0.3.4/merlya/inventory/parser/parsers/structured.py +292 -0
  167. merlya-0.3.4/merlya/inventory/parser/parsers/text.py +286 -0
  168. merlya-0.3.4/merlya/inventory/relation_classifier/__init__.py +38 -0
  169. merlya-0.3.4/merlya/inventory/relation_classifier/classifier.py +257 -0
  170. merlya-0.3.4/merlya/inventory/relation_classifier/embeddings.py +415 -0
  171. merlya-0.3.4/merlya/inventory/relation_classifier/heuristics.py +241 -0
  172. merlya-0.3.4/merlya/inventory/relation_classifier/llm.py +226 -0
  173. merlya-0.3.4/merlya/inventory/relation_classifier/models.py +29 -0
  174. merlya-0.3.4/merlya/knowledge/__init__.py +54 -0
  175. merlya-0.3.4/merlya/knowledge/cve_monitor.py +398 -0
  176. merlya-0.3.4/merlya/knowledge/falkordb_client.py +46 -0
  177. merlya-0.3.4/merlya/knowledge/graph/client.py +552 -0
  178. merlya-0.3.4/merlya/knowledge/graph/config.py +13 -0
  179. merlya-0.3.4/merlya/knowledge/incident_memory.py +372 -0
  180. merlya-0.3.4/merlya/knowledge/ops/risk.py +67 -0
  181. merlya-0.3.4/merlya/knowledge/ops/suggestions.py +138 -0
  182. merlya-0.3.4/merlya/knowledge/ops_knowledge_manager.py +498 -0
  183. merlya-0.3.4/merlya/knowledge/pattern_learner.py +470 -0
  184. merlya-0.3.4/merlya/knowledge/schema.py +358 -0
  185. merlya-0.3.4/merlya/knowledge/storage/falkordb_store.py +94 -0
  186. merlya-0.3.4/merlya/knowledge/storage/models.py +30 -0
  187. merlya-0.3.4/merlya/knowledge/storage/sqlite_store.py +401 -0
  188. merlya-0.3.4/merlya/knowledge/storage_manager.py +406 -0
  189. merlya-0.3.4/merlya/knowledge/web_search.py +440 -0
  190. merlya-0.3.4/merlya/llm/__init__.py +0 -0
  191. merlya-0.3.4/merlya/llm/litellm_router.py +199 -0
  192. merlya-0.3.4/merlya/llm/model_config.py +499 -0
  193. merlya-0.3.4/merlya/llm/ollama_client.py +309 -0
  194. merlya-0.3.4/merlya/llm/readiness.py +289 -0
  195. merlya-0.3.4/merlya/llm/router.py +270 -0
  196. merlya-0.3.4/merlya/mcp/__init__.py +8 -0
  197. merlya-0.3.4/merlya/mcp/manager.py +210 -0
  198. merlya-0.3.4/merlya/memory/__init__.py +21 -0
  199. merlya-0.3.4/merlya/memory/context_memory.py +244 -0
  200. merlya-0.3.4/merlya/memory/conversation.py +104 -0
  201. merlya-0.3.4/merlya/memory/conversation_history.py +247 -0
  202. merlya-0.3.4/merlya/memory/conversation_manager/context.py +97 -0
  203. merlya-0.3.4/merlya/memory/conversation_manager/history.py +118 -0
  204. merlya-0.3.4/merlya/memory/conversation_manager/models.py +101 -0
  205. merlya-0.3.4/merlya/memory/conversation_manager/storage.py +441 -0
  206. merlya-0.3.4/merlya/memory/migrate_to_sqlite.py +326 -0
  207. merlya-0.3.4/merlya/memory/persistence/base.py +221 -0
  208. merlya-0.3.4/merlya/memory/persistence/host_repository.py +442 -0
  209. merlya-0.3.4/merlya/memory/persistence/inventory_repository.py +148 -0
  210. merlya-0.3.4/merlya/memory/persistence/metrics_repository.py +997 -0
  211. merlya-0.3.4/merlya/memory/persistence/repositories/__init__.py +41 -0
  212. merlya-0.3.4/merlya/memory/persistence/repositories/host/__init__.py +8 -0
  213. merlya-0.3.4/merlya/memory/persistence/repositories/host/converters.py +60 -0
  214. merlya-0.3.4/merlya/memory/persistence/repositories/host/models.py +78 -0
  215. merlya-0.3.4/merlya/memory/persistence/repositories/host/repository.py +649 -0
  216. merlya-0.3.4/merlya/memory/persistence/repositories/host/schema.py +93 -0
  217. merlya-0.3.4/merlya/memory/persistence/repositories/host/versioning.py +63 -0
  218. merlya-0.3.4/merlya/memory/persistence/repositories/local_context.py +183 -0
  219. merlya-0.3.4/merlya/memory/persistence/repositories/relation.py +456 -0
  220. merlya-0.3.4/merlya/memory/persistence/repositories/scan_cache.py +302 -0
  221. merlya-0.3.4/merlya/memory/persistence/repositories/snapshot.py +236 -0
  222. merlya-0.3.4/merlya/memory/persistence/repositories/source.py +253 -0
  223. merlya-0.3.4/merlya/memory/persistence/session_repository.py +776 -0
  224. merlya-0.3.4/merlya/memory/persistent_store.py +205 -0
  225. merlya-0.3.4/merlya/memory/session.py +343 -0
  226. merlya-0.3.4/merlya/memory/skill_store.py +170 -0
  227. merlya-0.3.4/merlya/remediation/action_stack.py +380 -0
  228. merlya-0.3.4/merlya/remediation/rollback.py +249 -0
  229. merlya-0.3.4/merlya/repl/__init__.py +3 -0
  230. merlya-0.3.4/merlya/repl/command_processor/executor.py +66 -0
  231. merlya-0.3.4/merlya/repl/command_processor/registry.py +33 -0
  232. merlya-0.3.4/merlya/repl/commands/__init__.py +33 -0
  233. merlya-0.3.4/merlya/repl/commands/cicd.py +491 -0
  234. merlya-0.3.4/merlya/repl/commands/context.py +182 -0
  235. merlya-0.3.4/merlya/repl/commands/help.py +605 -0
  236. merlya-0.3.4/merlya/repl/commands/inventory/__init__.py +3 -0
  237. merlya-0.3.4/merlya/repl/commands/inventory/handler.py +331 -0
  238. merlya-0.3.4/merlya/repl/commands/inventory/importer.py +233 -0
  239. merlya-0.3.4/merlya/repl/commands/inventory/manager.py +261 -0
  240. merlya-0.3.4/merlya/repl/commands/inventory/relations.py +211 -0
  241. merlya-0.3.4/merlya/repl/commands/inventory/viewer.py +214 -0
  242. merlya-0.3.4/merlya/repl/commands/language.py +25 -0
  243. merlya-0.3.4/merlya/repl/commands/log.py +368 -0
  244. merlya-0.3.4/merlya/repl/commands/mcp.py +102 -0
  245. merlya-0.3.4/merlya/repl/commands/model.py +560 -0
  246. merlya-0.3.4/merlya/repl/commands/secret.py +512 -0
  247. merlya-0.3.4/merlya/repl/commands/session.py +514 -0
  248. merlya-0.3.4/merlya/repl/commands/ssh/__init__.py +6 -0
  249. merlya-0.3.4/merlya/repl/commands/ssh/agent.py +43 -0
  250. merlya-0.3.4/merlya/repl/commands/ssh/handler.py +140 -0
  251. merlya-0.3.4/merlya/repl/commands/ssh/hosts.py +193 -0
  252. merlya-0.3.4/merlya/repl/commands/ssh/keys.py +289 -0
  253. merlya-0.3.4/merlya/repl/commands/ssh/passphrase.py +143 -0
  254. merlya-0.3.4/merlya/repl/commands/ssh/test.py +56 -0
  255. merlya-0.3.4/merlya/repl/commands/stats.py +478 -0
  256. merlya-0.3.4/merlya/repl/commands/triage.py +127 -0
  257. merlya-0.3.4/merlya/repl/commands/variables.py +203 -0
  258. merlya-0.3.4/merlya/repl/completer.py +271 -0
  259. merlya-0.3.4/merlya/repl/core.py +726 -0
  260. merlya-0.3.4/merlya/repl/handlers.py +361 -0
  261. merlya-0.3.4/merlya/repl/ui.py +119 -0
  262. merlya-0.3.4/merlya/security/__init__.py +45 -0
  263. merlya-0.3.4/merlya/security/audit_logger.py +473 -0
  264. merlya-0.3.4/merlya/security/credentials.py +569 -0
  265. merlya-0.3.4/merlya/security/keyring_store.py +461 -0
  266. merlya-0.3.4/merlya/security/permissions.py +333 -0
  267. merlya-0.3.4/merlya/security/preflight_checker.py +288 -0
  268. merlya-0.3.4/merlya/security/risk_assessor.py +33 -0
  269. merlya-0.3.4/merlya/security/ssh_credentials.py +652 -0
  270. merlya-0.3.4/merlya/tests/executors/test_action_executor_credentials.py +198 -0
  271. merlya-0.3.4/merlya/tests/tools/test_request_credentials.py +236 -0
  272. merlya-0.3.4/merlya/tools/__init__.py +140 -0
  273. merlya-0.3.4/merlya/tools/base.py +427 -0
  274. merlya-0.3.4/merlya/tools/cicd.py +430 -0
  275. merlya-0.3.4/merlya/tools/commands.py +234 -0
  276. merlya-0.3.4/merlya/tools/containers.py +72 -0
  277. merlya-0.3.4/merlya/tools/files.py +224 -0
  278. merlya-0.3.4/merlya/tools/hosts.py +440 -0
  279. merlya-0.3.4/merlya/tools/infra_tools.py +351 -0
  280. merlya-0.3.4/merlya/tools/interaction.py +625 -0
  281. merlya-0.3.4/merlya/tools/security.py +125 -0
  282. merlya-0.3.4/merlya/tools/system.py +250 -0
  283. merlya-0.3.4/merlya/tools/web.py +111 -0
  284. merlya-0.3.4/merlya/triage/__init__.py +51 -0
  285. merlya-0.3.4/merlya/triage/ai_classifier.py +295 -0
  286. merlya-0.3.4/merlya/triage/behavior.py +155 -0
  287. merlya-0.3.4/merlya/triage/classifier.py +213 -0
  288. merlya-0.3.4/merlya/triage/embedding_config.py +347 -0
  289. merlya-0.3.4/merlya/triage/error_analyzer.py +491 -0
  290. merlya-0.3.4/merlya/triage/priority.py +218 -0
  291. merlya-0.3.4/merlya/triage/signals.py +424 -0
  292. merlya-0.3.4/merlya/triage/smart_classifier/__init__.py +21 -0
  293. merlya-0.3.4/merlya/triage/smart_classifier/classifier.py +301 -0
  294. merlya-0.3.4/merlya/triage/smart_classifier/embedding_cache.py +196 -0
  295. merlya-0.3.4/merlya/triage/smart_classifier/factory.py +74 -0
  296. merlya-0.3.4/merlya/triage/smart_classifier/pattern_store.py +328 -0
  297. merlya-0.3.4/merlya/triage/variable_detector.py +268 -0
  298. merlya-0.3.4/merlya/utils/__init__.py +0 -0
  299. merlya-0.3.4/merlya/utils/config.py +139 -0
  300. merlya-0.3.4/merlya/utils/config_validator.py +311 -0
  301. merlya-0.3.4/merlya/utils/display.py +309 -0
  302. merlya-0.3.4/merlya/utils/log_config.py +300 -0
  303. merlya-0.3.4/merlya/utils/logger.py +396 -0
  304. merlya-0.3.4/merlya/utils/security.py +198 -0
  305. merlya-0.3.4/merlya/utils/stats_manager.py +541 -0
  306. merlya-0.3.4/merlya/utils/tokenizer.py +175 -0
  307. merlya-0.3.4/merlya/utils/verbosity.py +334 -0
  308. merlya-0.3.4/pyproject.toml +152 -0
merlya-0.3.4/LICENSE ADDED
@@ -0,0 +1,46 @@
1
+ MIT License with Commons Clause
2
+
3
+ Copyright (c) 2025 Cédric Merlin, M-KIS
4
+
5
+ "Commons Clause" License Condition v1.0
6
+
7
+ The Software is provided to you by the Licensor under the License, as defined
8
+ below, subject to the following condition.
9
+
10
+ Without limiting other conditions in the License, the grant of rights under
11
+ the License will not include, and the License does not grant to you, the
12
+ right to Sell the Software.
13
+
14
+ For purposes of the foregoing, "Sell" means practicing any or all of the
15
+ rights granted to you under the License to provide to third parties, for a
16
+ fee or other consideration (including without limitation fees for hosting or
17
+ consulting/support services related to the Software), a product or service
18
+ whose value derives, entirely or substantially, from the functionality of the
19
+ Software. Any license notice or attribution required by the License must also
20
+ include this Commons Clause License Condition notice.
21
+
22
+ Software: Merlya
23
+ License: MIT
24
+ Licensor: Cédric Merlin, M-KIS
25
+
26
+ ---
27
+
28
+ MIT License (Modified by Commons Clause)
29
+
30
+ Permission is hereby granted, free of charge, to any person obtaining a copy
31
+ of this software and associated documentation files (the "Software"), to deal
32
+ in the Software without restriction, including without limitation the rights
33
+ to use, copy, modify, merge, publish, distribute, and sublicense copies of
34
+ the Software, and to permit persons to whom the Software is furnished to do
35
+ so, subject to the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be included in all
38
+ copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46
+ SOFTWARE.
merlya-0.3.4/PKG-INFO ADDED
@@ -0,0 +1,490 @@
1
+ Metadata-Version: 2.4
2
+ Name: merlya
3
+ Version: 0.3.4
4
+ Summary: AI-powered infrastructure orchestration CLI - Vibe Infra for DevOps
5
+ License: MIT-Commons-Clause
6
+ License-File: LICENSE
7
+ Keywords: cli,infrastructure,devops,ai,automation,ssh,autogen,llm,ops
8
+ Author: Merlya Contributors
9
+ Requires-Python: >=3.11,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: Other/Proprietary License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: System :: Monitoring
24
+ Classifier: Topic :: System :: Systems Administration
25
+ Provides-Extra: all
26
+ Provides-Extra: knowledge
27
+ Provides-Extra: smart-triage
28
+ Requires-Dist: ansible-runner (>=2.4,<3.0)
29
+ Requires-Dist: anthropic (>=0.70,<0.71)
30
+ Requires-Dist: autogen-ext[openai] (>=0.7,<0.8)
31
+ Requires-Dist: beautifulsoup4 (>=4.12,<5.0)
32
+ Requires-Dist: click (>=8.1,<9.0)
33
+ Requires-Dist: cryptography (>=44.0,<45.0)
34
+ Requires-Dist: duckduckgo-search (>=8.0,<9.0) ; extra == "knowledge" or extra == "all"
35
+ Requires-Dist: fabric (>=3.2,<4.0)
36
+ Requires-Dist: falkordb (>=1.2,<2.0) ; extra == "knowledge" or extra == "smart-triage" or extra == "all"
37
+ Requires-Dist: jinja2 (>=3.1,<4.0)
38
+ Requires-Dist: keyring (>=25.5,<26.0)
39
+ Requires-Dist: litellm (>=1.80,<2.0)
40
+ Requires-Dist: loguru (>=0.7,<0.8)
41
+ Requires-Dist: netmiko (>=4.4,<5.0)
42
+ Requires-Dist: openai (>=2.0,<3.0)
43
+ Requires-Dist: openai-agents (>=0.6.0,<0.7.0)
44
+ Requires-Dist: paramiko (>=4.0,<5.0)
45
+ Requires-Dist: prompt_toolkit (>=3.0,<4.0)
46
+ Requires-Dist: psycopg2-binary (>=2.9,<3.0)
47
+ Requires-Dist: pyautogen (>=0.10.0,<0.11.0)
48
+ Requires-Dist: pydantic (>=2.12,<3.0)
49
+ Requires-Dist: pymongo (>=4.10,<5.0)
50
+ Requires-Dist: pymysql (>=1.1,<2.0)
51
+ Requires-Dist: python-dotenv (>=1.0,<2.0)
52
+ Requires-Dist: python-terraform (>=0.10,<0.11)
53
+ Requires-Dist: pyyaml (>=6.0,<7.0)
54
+ Requires-Dist: redis (>=5.2,<6.0)
55
+ Requires-Dist: requests (>=2.32,<3.0)
56
+ Requires-Dist: rich (>=14.0,<15.0)
57
+ Requires-Dist: sentence-transformers (>=5.1,<6.0) ; extra == "smart-triage" or extra == "all"
58
+ Requires-Dist: sqlalchemy (>=2.0,<3.0)
59
+ Requires-Dist: tenacity (>=9.0,<10.0)
60
+ Project-URL: Documentation, https://github.com/m-kis/merlya#readme
61
+ Project-URL: Homepage, https://github.com/m-kis/merlya
62
+ Project-URL: Repository, https://github.com/m-kis/merlya
63
+ Description-Content-Type: text/markdown
64
+
65
+ # Merlya
66
+
67
+ **AI-powered infrastructure orchestration CLI** - A natural language interface for managing your infrastructure.
68
+
69
+ [![PyPI version](https://badge.fury.io/py/merlya.svg)](https://pypi.org/project/merlya/)
70
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
71
+ [![License: MIT](https://img.shields.io/badge/License-MIT%20Commons%20Clause-yellow.svg)](LICENSE)
72
+
73
+ ## Features
74
+
75
+ ### Core Capabilities
76
+
77
+ - **Natural Language Interface** - Query and manage infrastructure using plain English
78
+ - **Multi-LLM Support** - OpenRouter, Anthropic, OpenAI, Ollama (local/offline)
79
+ - **Multi-Agent Orchestration** - AutoGen 0.7+ powered agent teams
80
+ - **48 Slash Commands** - Comprehensive CLI command system
81
+ - **SSH Execution** - Connection pooling, key management, passphrase caching
82
+
83
+ ### Security & Credentials
84
+
85
+ - **Persistent Secrets** - System keyring integration (macOS Keychain, Windows Credential Locker, Linux SecretService)
86
+ - **Session Secrets** - In-memory temporary credentials with TTL
87
+ - **SSH Key Management** - Per-host key configuration, agent forwarding
88
+ - **Permission Detection** - Automatic capability detection on hosts
89
+ - **Audit Logging** - Compliance-ready action logging
90
+
91
+ ### Intelligence & Learning
92
+
93
+ - **Smart Triage** - AI/embedding/keyword-based request classification (P0-P3)
94
+ - **Knowledge Graph** - FalkorDB incident memory and pattern learning
95
+ - **CVE Monitoring** - Vulnerability tracking integration
96
+ - **Error Analysis** - Semantic error classification and auto-correction suggestions
97
+
98
+ ### Infrastructure Management
99
+
100
+ - **Local Scanner** - Comprehensive local machine scanning (12h TTL, SQLite cache)
101
+ - **Remote Scanner** - JIT on-demand SSH-based scanning
102
+ - **Host Registry** - Metadata, relationships, versioning
103
+ - **Inventory System** - Multi-format import (CSV/JSON/YAML/INI/hosts/ssh-config)
104
+
105
+ ### CI/CD Integration
106
+
107
+ - **GitHub Actions** - Full workflow management, failure analysis
108
+ - **Learning Engine** - Learn from CI failures for better suggestions
109
+ - **Extensible** - Plugin architecture for GitLab, Jenkins, CircleCI
110
+
111
+ ### Executors
112
+
113
+ - **SSH** - Connection pooling, error correction
114
+ - **Ansible** - Playbook execution
115
+ - **Terraform** - Plan/apply/destroy operations
116
+ - **Kubernetes** - kubectl integration
117
+ - **AWS** - Cloud API operations
118
+ - **Docker** - Container management
119
+
120
+ ## Installation
121
+
122
+ ### From PyPI (Recommended)
123
+
124
+ ```bash
125
+ # Basic installation
126
+ pip install merlya
127
+
128
+ # With knowledge graph support (DuckDuckGo search, FalkorDB)
129
+ pip install "merlya[knowledge]"
130
+
131
+ # With smart error triage (ML-based error classification)
132
+ pip install "merlya[smart-triage]"
133
+
134
+ # Full installation (all features)
135
+ pip install "merlya[all]"
136
+ ```
137
+
138
+ ### From Source
139
+
140
+ ```bash
141
+ git clone https://github.com/m-kis/merlya.git
142
+ cd merlya
143
+ poetry install -E all
144
+ ```
145
+
146
+ ### Installation Extras
147
+
148
+ | Extra | Dependencies | Features |
149
+ |-------|-------------|----------|
150
+ | `knowledge` | `duckduckgo-search`, `falkordb` | Web search, knowledge graph storage |
151
+ | `smart-triage` | `sentence-transformers`, `falkordb` | ML-based error classification, semantic tool selection |
152
+ | `all` | All of the above | Full feature set |
153
+
154
+ ## Quick Start
155
+
156
+ ```bash
157
+ # Configure your LLM provider
158
+ export OPENROUTER_API_KEY="sk-or-..."
159
+ # or ANTHROPIC_API_KEY, OPENAI_API_KEY, OLLAMA_HOST
160
+
161
+ # Launch interactive REPL
162
+ merlya
163
+
164
+ # Or run a single query
165
+ merlya ask "list all mongo hosts"
166
+ ```
167
+
168
+ ## Usage
169
+
170
+ ### Interactive Mode (REPL)
171
+
172
+ ```bash
173
+ $ merlya
174
+
175
+ Merlya REPL - Type /help for commands
176
+
177
+ > list mongo preprod IPs
178
+ MongoDB Preprod hosts:
179
+ - mongo-preprod-1: 203.0.113.10
180
+ - mongo-preprod-2: 198.51.100.20
181
+
182
+ > check if mongodb is running on mongo-preprod-1
183
+ [SSH] systemctl status mongod
184
+ mongod.service - MongoDB Database Server
185
+ Active: active (running)
186
+
187
+ > /help
188
+ ```
189
+
190
+ ### Command Reference
191
+
192
+ #### Context & Scanning
193
+
194
+ | Command | Description |
195
+ |---------|-------------|
196
+ | `/scan` | Scan local machine or specific host |
197
+ | `/scan --full` | Full SSH scan of all hosts |
198
+ | `/refresh` | Force refresh context cache |
199
+ | `/cache-stats` | Show cache validity, TTL, fingerprints |
200
+ | `/context` | Show current infrastructure context |
201
+ | `/permissions` | Show detected permission capabilities |
202
+
203
+ #### Secrets & Variables
204
+
205
+ | Command | Description |
206
+ |---------|-------------|
207
+ | `/secret set <name>` | Store persistent secret (keyring) |
208
+ | `/secret list` | List stored secrets |
209
+ | `/secret delete <name>` | Delete a secret |
210
+ | `/variables set <key> <value>` | Set a variable |
211
+ | `/variables set-secret <key>` | Set session secret (hidden input, TTL) |
212
+
213
+ #### SSH Management
214
+
215
+ | Command | Description |
216
+ |---------|-------------|
217
+ | `/ssh keys` | List available SSH keys |
218
+ | `/ssh host <host> set-key <key>` | Set SSH key for host |
219
+ | `/ssh passphrase <key>` | Cache SSH key passphrase |
220
+ | `/ssh test <host>` | Test SSH connectivity |
221
+
222
+ #### Inventory
223
+
224
+ | Command | Description |
225
+ |---------|-------------|
226
+ | `/inventory list` | List inventory sources |
227
+ | `/inventory show <source>` | Show hosts from source |
228
+ | `/inventory search <pattern>` | Search hosts |
229
+ | `/inventory add <file>` | Import from CSV/JSON/YAML/INI |
230
+ | `/inventory add-host` | Interactive host addition |
231
+ | `/inventory export <format>` | Export as JSON/CSV/YAML |
232
+ | `/inventory relations` | AI-suggested host relations |
233
+
234
+ #### CI/CD
235
+
236
+ | Command | Description |
237
+ |---------|-------------|
238
+ | `/cicd status` | Show recent CI run status |
239
+ | `/cicd workflows` | List available workflows |
240
+ | `/cicd runs` | List recent runs |
241
+ | `/cicd analyze <run_id>` | Deep analysis of failure |
242
+ | `/cicd trigger <workflow>` | Trigger workflow execution |
243
+ | `/debug-workflow` | Debug most recent failure |
244
+
245
+ #### Model & Configuration
246
+
247
+ | Command | Description |
248
+ |---------|-------------|
249
+ | `/model list` | List available models |
250
+ | `/model set <provider> <model>` | Switch LLM model |
251
+ | `/model task set <task> <model>` | Set task-specific model |
252
+ | `/log level <level>` | Change log verbosity |
253
+ | `/log show [n]` | Display recent logs |
254
+ | `/stats` | Show usage statistics |
255
+
256
+ #### Session Management
257
+
258
+ | Command | Description |
259
+ |---------|-------------|
260
+ | `/conversations` | List conversations |
261
+ | `/new [title]` | Start new conversation |
262
+ | `/load <id>` | Load conversation |
263
+ | `/compact` | Compress conversation (reduce tokens) |
264
+ | `/delete <id>` | Delete conversation |
265
+
266
+ #### Triage & Learning
267
+
268
+ | Command | Description |
269
+ |---------|-------------|
270
+ | `/triage <query>` | Test priority classification |
271
+ | `/feedback` | Correct triage classifications |
272
+ | `/triage-stats` | Show learned patterns |
273
+
274
+ ### Persistent Secrets
275
+
276
+ Store secrets securely using your system's keyring:
277
+
278
+ ```bash
279
+ # Store a secret (prompts for hidden input)
280
+ /secret set db-password
281
+
282
+ # Use secrets in queries with @name syntax
283
+ check mongodb status with password @db-password
284
+ ```
285
+
286
+ Storage priority:
287
+
288
+ 1. **System Keyring** (preferred): macOS Keychain, Windows Credential Locker, Linux SecretService
289
+ 2. **Encrypted File** (fallback): `~/.merlya/secrets.enc`
290
+
291
+ ### Task-Specific Model Routing
292
+
293
+ Configure different models for different task types:
294
+
295
+ ```bash
296
+ # Use fast model for quick fixes (P0/P1 priority)
297
+ /model task set correction claude-3-5-haiku-latest
298
+
299
+ # Use powerful model for complex planning (P3)
300
+ /model task set planning claude-sonnet-4
301
+
302
+ # Use balanced model for general tasks (P2)
303
+ /model task set synthesis claude-sonnet-4
304
+ ```
305
+
306
+ ### Custom Commands
307
+
308
+ Create markdown files in `~/.merlya/commands/`:
309
+
310
+ ```markdown
311
+ ---
312
+ name: healthcheck
313
+ description: Run health check on a host
314
+ aliases: [hc, health]
315
+ ---
316
+
317
+ Perform health check on {{$1}}:
318
+ - Check CPU, memory, disk
319
+ - List running services
320
+ - Check for errors in logs
321
+ ```
322
+
323
+ Then use: `/healthcheck web-prod-1`
324
+
325
+ ## Configuration
326
+
327
+ ### LLM Providers
328
+
329
+ ```bash
330
+ # OpenRouter (recommended - multiple models)
331
+ export OPENROUTER_API_KEY="sk-or-..."
332
+ export OPENROUTER_MODEL="anthropic/claude-sonnet-4"
333
+
334
+ # Anthropic
335
+ export ANTHROPIC_API_KEY="sk-ant-..."
336
+
337
+ # OpenAI
338
+ export OPENAI_API_KEY="sk-..."
339
+
340
+ # Ollama (local/offline)
341
+ export OLLAMA_HOST="http://localhost:11434"
342
+ export OLLAMA_MODEL="llama3"
343
+ ```
344
+
345
+ ### SSH Configuration
346
+
347
+ Merlya uses your existing SSH setup:
348
+
349
+ ```ssh
350
+ # ~/.ssh/config
351
+ Host mongo-*
352
+ User mongodb-admin
353
+ IdentityFile ~/.ssh/id_mongo
354
+
355
+ Host *.prod
356
+ User ops
357
+ IdentityFile ~/.ssh/id_prod
358
+ ```
359
+
360
+ ### Inventory Sources
361
+
362
+ Merlya discovers hosts from:
363
+
364
+ - `/etc/hosts`
365
+ - `~/.ssh/config`
366
+ - SSH scanning
367
+ - Custom inventory files (`~/.merlya/inventory.yaml`)
368
+
369
+ ## Architecture
370
+
371
+ ```text
372
+ User Query
373
+
374
+
375
+ ┌───────────────────┐
376
+ │ REPL / CLI │ 48 slash commands
377
+ └───────────────────┘
378
+
379
+
380
+ ┌───────────────────┐
381
+ │ Orchestrator │ AutoGen 0.7+ multi-agent
382
+ └───────────────────┘
383
+
384
+ ├──▶ SentinelAgent (security)
385
+ ├──▶ DiagnosticAgent (analysis)
386
+ ├──▶ RemediationAgent (actions)
387
+ ├──▶ ProvisioningAgent (infra)
388
+ └──▶ MonitoringAgent (health)
389
+
390
+
391
+ ┌───────────────────┐
392
+ │ LLM Router │ Task-specific model selection
393
+ └───────────────────┘
394
+
395
+
396
+ ┌───────────────────┐
397
+ │ Context Manager │ JIT scanning, smart cache
398
+ └───────────────────┘
399
+
400
+
401
+ ┌───────────────────┐
402
+ │ Executors │ SSH, Ansible, Terraform, K8s, AWS
403
+ └───────────────────┘
404
+ ```
405
+
406
+ ## Security
407
+
408
+ ### Risk Assessment
409
+
410
+ Commands are evaluated before execution:
411
+
412
+ - **Low**: read-only (ps, cat, df) - auto-execute
413
+ - **Moderate**: config changes (chmod) - prompt confirmation
414
+ - **Critical**: destructive (rm, reboot, stop) - requires `--confirm`
415
+
416
+ ### Host Validation
417
+
418
+ All commands are validated against the host registry. Operations on unknown/hallucinated hostnames are blocked.
419
+
420
+ ### Credential Management
421
+
422
+ When authentication errors occur, Merlya:
423
+
424
+ 1. **Detects the error** - Classifies with confidence score
425
+ 2. **Prompts the user** - Secure input (getpass)
426
+ 3. **Caches credentials** - In-memory with 15-minute TTL
427
+ 4. **Retries automatically** - Re-executes with new credentials
428
+
429
+ Use `/secret` for persistent storage or `/variables set-secret` for session-only secrets.
430
+
431
+ ### Audit Trail
432
+
433
+ All actions logged to `~/.merlya/logs/`
434
+
435
+ ## Optional Features
436
+
437
+ ### Knowledge Graph (FalkorDB)
438
+
439
+ ```bash
440
+ pip install "merlya[knowledge]"
441
+
442
+ # Start FalkorDB
443
+ docker run -p 6379:6379 falkordb/falkordb
444
+
445
+ export FALKORDB_HOST="localhost"
446
+ ```
447
+
448
+ Features:
449
+
450
+ - Incident memory with similarity matching
451
+ - Pattern learning from past incidents
452
+ - CVE vulnerability tracking
453
+ - Web search integration
454
+
455
+ ### Smart Triage (Embeddings)
456
+
457
+ ```bash
458
+ pip install "merlya[smart-triage]"
459
+ ```
460
+
461
+ Uses sentence-transformers for semantic classification when LLM is unavailable.
462
+
463
+ ## Development
464
+
465
+ ```bash
466
+ poetry install
467
+ pytest
468
+ mypy merlya
469
+ ruff check merlya/
470
+ ```
471
+
472
+ ## Roadmap
473
+
474
+ See [ROADMAP.md](ROADMAP.md) for planned features.
475
+
476
+ **Coming in v0.4.0:**
477
+
478
+ - Docker image
479
+ - Session export/import
480
+ - Enhanced Ansible/Terraform/K8s integration
481
+ - Cloud provider APIs (AWS, GCP, Azure)
482
+
483
+ ## License
484
+
485
+ **MIT License with Commons Clause** - See [LICENSE](LICENSE)
486
+
487
+ Free for personal, educational, and community use.
488
+
489
+ **Commercial use prohibited without written permission from Cedric Merlin and M-KIS.**
490
+