scene-capability-engine 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/CHANGELOG.md +2513 -0
  2. package/LICENSE +21 -0
  3. package/README.md +765 -0
  4. package/README.zh.md +630 -0
  5. package/bin/kiro-spec-engine.js +796 -0
  6. package/bin/kse.js +3 -0
  7. package/bin/sce.js +3 -0
  8. package/bin/sco.js +3 -0
  9. package/docs/331-poc-adaptation-roadmap.md +156 -0
  10. package/docs/331-poc-dual-track-integration-guide.md +120 -0
  11. package/docs/331-poc-weekly-delivery-checklist.md +52 -0
  12. package/docs/OFFLINE_INSTALL.md +96 -0
  13. package/docs/README.md +279 -0
  14. package/docs/adopt-migration-guide.md +599 -0
  15. package/docs/adoption-guide.md +616 -0
  16. package/docs/agent-hooks-analysis.md +815 -0
  17. package/docs/architecture.md +733 -0
  18. package/docs/articles/ai-driven-development-philosophy-and-practice-review.md +208 -0
  19. package/docs/articles/ai-driven-development-philosophy-and-practice.en.md +459 -0
  20. package/docs/articles/ai-driven-development-philosophy-and-practice.md +492 -0
  21. package/docs/autonomous-control-guide.md +851 -0
  22. package/docs/command-reference.md +1368 -0
  23. package/docs/community.md +115 -0
  24. package/docs/cross-tool-guide.md +555 -0
  25. package/docs/developer-guide.md +619 -0
  26. package/docs/document-governance.md +865 -0
  27. package/docs/environment-management-guide.md +526 -0
  28. package/docs/examples/add-export-command/design.md +194 -0
  29. package/docs/examples/add-export-command/requirements.md +110 -0
  30. package/docs/examples/add-export-command/tasks.md +88 -0
  31. package/docs/examples/add-rest-api/design.md +855 -0
  32. package/docs/examples/add-rest-api/requirements.md +323 -0
  33. package/docs/examples/add-rest-api/tasks.md +355 -0
  34. package/docs/examples/add-user-dashboard/design.md +192 -0
  35. package/docs/examples/add-user-dashboard/requirements.md +143 -0
  36. package/docs/examples/add-user-dashboard/tasks.md +91 -0
  37. package/docs/faq.md +697 -0
  38. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.json +156 -0
  39. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.md +24 -0
  40. package/docs/images/wechat-qr.png +0 -0
  41. package/docs/integration-modes.md +529 -0
  42. package/docs/integration-philosophy.md +313 -0
  43. package/docs/knowledge-management-guide.md +263 -0
  44. package/docs/manual-workflows-guide.md +418 -0
  45. package/docs/moqui-capability-matrix.md +73 -0
  46. package/docs/moqui-template-core-library-playbook.md +109 -0
  47. package/docs/multi-agent-coordination-guide.md +553 -0
  48. package/docs/multi-repo-management-guide.md +1344 -0
  49. package/docs/quick-start-with-ai-tools.md +375 -0
  50. package/docs/quick-start.md +146 -0
  51. package/docs/release-checklist.md +121 -0
  52. package/docs/releases/README.md +13 -0
  53. package/docs/releases/v1.46.2-validation.md +45 -0
  54. package/docs/releases/v1.46.2.md +50 -0
  55. package/docs/scene-runtime-guide.md +347 -0
  56. package/docs/spec-collaboration-guide.md +369 -0
  57. package/docs/spec-locking-guide.md +225 -0
  58. package/docs/spec-numbering-guide.md +348 -0
  59. package/docs/spec-workflow.md +519 -0
  60. package/docs/steering-strategy-guide.md +196 -0
  61. package/docs/team-collaboration-guide.md +465 -0
  62. package/docs/testing-strategy.md +272 -0
  63. package/docs/tools/claude-guide.md +654 -0
  64. package/docs/tools/cursor-guide.md +706 -0
  65. package/docs/tools/generic-guide.md +446 -0
  66. package/docs/tools/kiro-guide.md +308 -0
  67. package/docs/tools/vscode-guide.md +445 -0
  68. package/docs/tools/windsurf-guide.md +391 -0
  69. package/docs/troubleshooting.md +1135 -0
  70. package/docs/upgrade-guide.md +639 -0
  71. package/docs/value-observability-guide.md +127 -0
  72. package/docs/zh/README.md +341 -0
  73. package/docs/zh/quick-start.md +764 -0
  74. package/docs/zh/release-checklist.md +121 -0
  75. package/docs/zh/releases/README.md +13 -0
  76. package/docs/zh/releases/v1.46.2-validation.md +45 -0
  77. package/docs/zh/releases/v1.46.2.md +50 -0
  78. package/docs/zh/spec-numbering-guide.md +348 -0
  79. package/docs/zh/tools/claude-guide.md +349 -0
  80. package/docs/zh/tools/cursor-guide.md +281 -0
  81. package/docs/zh/tools/generic-guide.md +499 -0
  82. package/docs/zh/tools/kiro-guide.md +342 -0
  83. package/docs/zh/tools/vscode-guide.md +449 -0
  84. package/docs/zh/tools/windsurf-guide.md +378 -0
  85. package/docs/zh/value-observability-guide.md +127 -0
  86. package/docs//344/272/244/344/273/230/346/270/205/345/215/225.md +75 -0
  87. package/lib/adoption/adoption-logger.js +487 -0
  88. package/lib/adoption/adoption-strategy.js +538 -0
  89. package/lib/adoption/backup-manager.js +420 -0
  90. package/lib/adoption/conflict-resolver.js +410 -0
  91. package/lib/adoption/detection-engine.js +275 -0
  92. package/lib/adoption/diff-viewer.js +226 -0
  93. package/lib/adoption/error-formatter.js +509 -0
  94. package/lib/adoption/file-classifier.js +385 -0
  95. package/lib/adoption/progress-reporter.js +534 -0
  96. package/lib/adoption/smart-orchestrator.js +470 -0
  97. package/lib/adoption/strategy-selector.js +218 -0
  98. package/lib/adoption/summary-generator.js +493 -0
  99. package/lib/adoption/template-sync.js +605 -0
  100. package/lib/auto/autonomous-engine.js +485 -0
  101. package/lib/auto/checkpoint-manager.js +300 -0
  102. package/lib/auto/close-loop-runner.js +2476 -0
  103. package/lib/auto/config-schema.js +176 -0
  104. package/lib/auto/decision-engine.js +344 -0
  105. package/lib/auto/error-recovery-manager.js +580 -0
  106. package/lib/auto/goal-decomposer.js +278 -0
  107. package/lib/auto/progress-tracker.js +502 -0
  108. package/lib/auto/safety-manager.js +186 -0
  109. package/lib/auto/semantic-decomposer.js +137 -0
  110. package/lib/auto/state-manager.js +126 -0
  111. package/lib/auto/task-queue-manager.js +340 -0
  112. package/lib/backup/backup-system.js +372 -0
  113. package/lib/backup/selective-backup.js +207 -0
  114. package/lib/collab/agent-registry.js +240 -0
  115. package/lib/collab/collab-manager.js +285 -0
  116. package/lib/collab/contract-manager.js +320 -0
  117. package/lib/collab/coordinator.js +370 -0
  118. package/lib/collab/dependency-manager.js +280 -0
  119. package/lib/collab/index.js +20 -0
  120. package/lib/collab/integration-manager.js +202 -0
  121. package/lib/collab/merge-coordinator.js +252 -0
  122. package/lib/collab/metadata-manager.js +233 -0
  123. package/lib/collab/multi-agent-config.js +120 -0
  124. package/lib/collab/spec-lifecycle-manager.js +304 -0
  125. package/lib/collab/sync-barrier.js +88 -0
  126. package/lib/collab/visualizer.js +208 -0
  127. package/lib/commands/adopt.js +749 -0
  128. package/lib/commands/auto.js +19559 -0
  129. package/lib/commands/collab.js +275 -0
  130. package/lib/commands/context.js +99 -0
  131. package/lib/commands/docs.js +808 -0
  132. package/lib/commands/doctor.js +273 -0
  133. package/lib/commands/env.js +420 -0
  134. package/lib/commands/knowledge.js +309 -0
  135. package/lib/commands/lock.js +235 -0
  136. package/lib/commands/ops.js +409 -0
  137. package/lib/commands/orchestrate.js +446 -0
  138. package/lib/commands/prompt.js +105 -0
  139. package/lib/commands/repo.js +118 -0
  140. package/lib/commands/rollback.js +219 -0
  141. package/lib/commands/scene.js +15549 -0
  142. package/lib/commands/spec-bootstrap.js +147 -0
  143. package/lib/commands/spec-gate.js +157 -0
  144. package/lib/commands/spec-pipeline.js +205 -0
  145. package/lib/commands/status.js +321 -0
  146. package/lib/commands/task.js +199 -0
  147. package/lib/commands/templates.js +654 -0
  148. package/lib/commands/upgrade.js +231 -0
  149. package/lib/commands/value.js +569 -0
  150. package/lib/commands/watch.js +684 -0
  151. package/lib/commands/workflows.js +240 -0
  152. package/lib/commands/workspace-multi.js +325 -0
  153. package/lib/commands/workspace.js +189 -0
  154. package/lib/context/context-exporter.js +378 -0
  155. package/lib/context/prompt-generator.js +482 -0
  156. package/lib/data/moqui-capability-lexicon.json +45 -0
  157. package/lib/environment/backup-system.js +189 -0
  158. package/lib/environment/environment-manager.js +379 -0
  159. package/lib/environment/environment-registry.js +168 -0
  160. package/lib/gitignore/gitignore-backup.js +229 -0
  161. package/lib/gitignore/gitignore-detector.js +239 -0
  162. package/lib/gitignore/gitignore-integration.js +267 -0
  163. package/lib/gitignore/gitignore-transformer.js +193 -0
  164. package/lib/gitignore/layered-rules-template.js +42 -0
  165. package/lib/governance/archive-tool.js +284 -0
  166. package/lib/governance/cleanup-tool.js +237 -0
  167. package/lib/governance/config-manager.js +186 -0
  168. package/lib/governance/diagnostic-engine.js +271 -0
  169. package/lib/governance/doc-reference-checker.js +200 -0
  170. package/lib/governance/execution-logger.js +243 -0
  171. package/lib/governance/file-scanner.js +285 -0
  172. package/lib/governance/hooks-manager.js +333 -0
  173. package/lib/governance/reporter.js +337 -0
  174. package/lib/governance/validation-engine.js +181 -0
  175. package/lib/i18n.js +79 -0
  176. package/lib/knowledge/entry-manager.js +208 -0
  177. package/lib/knowledge/index-manager.js +261 -0
  178. package/lib/knowledge/knowledge-manager.js +273 -0
  179. package/lib/knowledge/template-manager.js +191 -0
  180. package/lib/lock/index.js +21 -0
  181. package/lib/lock/lock-file.js +192 -0
  182. package/lib/lock/lock-manager.js +321 -0
  183. package/lib/lock/machine-identifier.js +135 -0
  184. package/lib/lock/steering-file-lock.js +207 -0
  185. package/lib/lock/task-lock-manager.js +345 -0
  186. package/lib/operations/audit-logger.js +293 -0
  187. package/lib/operations/feedback-manager.js +1147 -0
  188. package/lib/operations/index.js +23 -0
  189. package/lib/operations/models/index.js +170 -0
  190. package/lib/operations/operations-manager.js +151 -0
  191. package/lib/operations/operations-validator.js +280 -0
  192. package/lib/operations/permission-manager.js +354 -0
  193. package/lib/operations/template-loader.js +143 -0
  194. package/lib/orchestrator/agent-spawner.js +629 -0
  195. package/lib/orchestrator/bootstrap-prompt-builder.js +236 -0
  196. package/lib/orchestrator/index.js +19 -0
  197. package/lib/orchestrator/orchestration-engine.js +1270 -0
  198. package/lib/orchestrator/orchestrator-config.js +173 -0
  199. package/lib/orchestrator/status-monitor.js +591 -0
  200. package/lib/python-checker.js +209 -0
  201. package/lib/repo/config-manager.js +580 -0
  202. package/lib/repo/errors/config-error.js +13 -0
  203. package/lib/repo/errors/git-error.js +15 -0
  204. package/lib/repo/errors/repo-error.js +14 -0
  205. package/lib/repo/git-operations.js +181 -0
  206. package/lib/repo/handlers/.gitkeep +1 -0
  207. package/lib/repo/handlers/exec-handler.js +155 -0
  208. package/lib/repo/handlers/health-handler.js +169 -0
  209. package/lib/repo/handlers/init-handler.js +197 -0
  210. package/lib/repo/handlers/status-handler.js +176 -0
  211. package/lib/repo/output-formatter.js +184 -0
  212. package/lib/repo/path-resolver.js +178 -0
  213. package/lib/repo/repo-manager.js +514 -0
  214. package/lib/scene-runtime/audit-emitter.js +59 -0
  215. package/lib/scene-runtime/binding-plugin-loader.js +351 -0
  216. package/lib/scene-runtime/binding-registry.js +349 -0
  217. package/lib/scene-runtime/eval-bridge.js +44 -0
  218. package/lib/scene-runtime/index.js +19 -0
  219. package/lib/scene-runtime/moqui-adapter.js +620 -0
  220. package/lib/scene-runtime/moqui-client.js +606 -0
  221. package/lib/scene-runtime/moqui-extractor.js +2029 -0
  222. package/lib/scene-runtime/plan-compiler.js +208 -0
  223. package/lib/scene-runtime/policy-gate.js +58 -0
  224. package/lib/scene-runtime/runtime-executor.js +358 -0
  225. package/lib/scene-runtime/scene-loader.js +96 -0
  226. package/lib/scene-runtime/scene-ontology.js +959 -0
  227. package/lib/scene-runtime/scene-template-linter.js +852 -0
  228. package/lib/scene-runtime/templates/scene-template-erp-query-v0.1.yaml +28 -0
  229. package/lib/scene-runtime/templates/scene-template-hybrid-shadow-v0.1.yaml +34 -0
  230. package/lib/spec/bootstrap/context-collector.js +48 -0
  231. package/lib/spec/bootstrap/draft-generator.js +158 -0
  232. package/lib/spec/bootstrap/questionnaire-engine.js +70 -0
  233. package/lib/spec/bootstrap/trace-emitter.js +59 -0
  234. package/lib/spec/multi-spec-orchestrate.js +93 -0
  235. package/lib/spec/pipeline/constants.js +6 -0
  236. package/lib/spec/pipeline/stage-adapters.js +118 -0
  237. package/lib/spec/pipeline/stage-runner.js +146 -0
  238. package/lib/spec/pipeline/state-store.js +119 -0
  239. package/lib/spec-gate/engine/gate-engine.js +165 -0
  240. package/lib/spec-gate/policy/default-policy.js +22 -0
  241. package/lib/spec-gate/policy/policy-loader.js +103 -0
  242. package/lib/spec-gate/result-emitter.js +81 -0
  243. package/lib/spec-gate/rules/default-rules.js +156 -0
  244. package/lib/spec-gate/rules/rule-registry.js +51 -0
  245. package/lib/steering/adoption-config.js +164 -0
  246. package/lib/steering/compliance-auto-fixer.js +204 -0
  247. package/lib/steering/compliance-cache.js +99 -0
  248. package/lib/steering/compliance-error-reporter.js +70 -0
  249. package/lib/steering/context-sync-manager.js +273 -0
  250. package/lib/steering/index.js +92 -0
  251. package/lib/steering/spec-steering.js +230 -0
  252. package/lib/steering/steering-compliance-checker.js +73 -0
  253. package/lib/steering/steering-loader.js +144 -0
  254. package/lib/steering/steering-manager.js +289 -0
  255. package/lib/task/index.js +12 -0
  256. package/lib/task/task-claimer.js +489 -0
  257. package/lib/task/task-status-store.js +418 -0
  258. package/lib/templates/cache-manager.js +440 -0
  259. package/lib/templates/content-generalizer.js +247 -0
  260. package/lib/templates/frontmatter-generator.js +128 -0
  261. package/lib/templates/git-handler.js +471 -0
  262. package/lib/templates/metadata-collector.js +328 -0
  263. package/lib/templates/path-utils.js +144 -0
  264. package/lib/templates/registry-parser.js +505 -0
  265. package/lib/templates/spec-reader.js +216 -0
  266. package/lib/templates/template-applicator.js +249 -0
  267. package/lib/templates/template-creator.js +256 -0
  268. package/lib/templates/template-error.js +143 -0
  269. package/lib/templates/template-exporter.js +502 -0
  270. package/lib/templates/template-manager.js +782 -0
  271. package/lib/templates/template-validator.js +361 -0
  272. package/lib/upgrade/migration-engine.js +382 -0
  273. package/lib/upgrade/migrations/.gitkeep +52 -0
  274. package/lib/upgrade/migrations/1.0.0-to-1.1.0.js +78 -0
  275. package/lib/utils/file-diff.js +177 -0
  276. package/lib/utils/fs-utils.js +274 -0
  277. package/lib/utils/tool-detector.js +383 -0
  278. package/lib/utils/validation.js +324 -0
  279. package/lib/value/gate-summary-emitter.js +99 -0
  280. package/lib/value/metric-contract-loader.js +210 -0
  281. package/lib/value/risk-evaluator.js +117 -0
  282. package/lib/value/weekly-snapshot-builder.js +61 -0
  283. package/lib/version/version-checker.js +156 -0
  284. package/lib/version/version-manager.js +327 -0
  285. package/lib/watch/action-executor.js +458 -0
  286. package/lib/watch/event-debouncer.js +323 -0
  287. package/lib/watch/execution-logger.js +550 -0
  288. package/lib/watch/file-watcher.js +499 -0
  289. package/lib/watch/presets.js +266 -0
  290. package/lib/watch/watch-manager.js +533 -0
  291. package/lib/workspace/multi/global-config.js +150 -0
  292. package/lib/workspace/multi/index.js +22 -0
  293. package/lib/workspace/multi/path-utils.js +173 -0
  294. package/lib/workspace/multi/workspace-context-resolver.js +244 -0
  295. package/lib/workspace/multi/workspace-registry.js +196 -0
  296. package/lib/workspace/multi/workspace-state-manager.js +537 -0
  297. package/lib/workspace/multi/workspace.js +90 -0
  298. package/lib/workspace/workspace-manager.js +370 -0
  299. package/lib/workspace/workspace-sync.js +356 -0
  300. package/locales/en.json +114 -0
  301. package/locales/zh.json +114 -0
  302. package/package.json +102 -0
  303. package/template/.kiro/README.md +247 -0
  304. package/template/.kiro/hooks/check-spec-on-create.kiro.hook +17 -0
  305. package/template/.kiro/hooks/run-tests-on-save.kiro.hook +13 -0
  306. package/template/.kiro/hooks/sync-tasks-on-edit.kiro.hook +16 -0
  307. package/template/.kiro/specs/SPEC_WORKFLOW_GUIDE.md +134 -0
  308. package/template/.kiro/steering/CORE_PRINCIPLES.md +133 -0
  309. package/template/.kiro/steering/CURRENT_CONTEXT.md +30 -0
  310. package/template/.kiro/steering/ENVIRONMENT.md +35 -0
  311. package/template/.kiro/steering/RULES_GUIDE.md +46 -0
  312. package/template/.kiro/templates/operations/default/change-impact.md +112 -0
  313. package/template/.kiro/templates/operations/default/deployment.md +91 -0
  314. package/template/.kiro/templates/operations/default/feedback-response.md +269 -0
  315. package/template/.kiro/templates/operations/default/migration-plan.md +172 -0
  316. package/template/.kiro/templates/operations/default/monitoring.md +135 -0
  317. package/template/.kiro/templates/operations/default/operations.md +135 -0
  318. package/template/.kiro/templates/operations/default/rollback.md +143 -0
  319. package/template/.kiro/templates/operations/default/tools.yaml +364 -0
  320. package/template/.kiro/templates/operations/default/troubleshooting.md +123 -0
  321. package/template/.kiro/tools/backup_manager.py +295 -0
  322. package/template/.kiro/tools/configuration_manager.py +218 -0
  323. package/template/.kiro/tools/document_evaluator.py +550 -0
  324. package/template/.kiro/tools/enhancement_logger.py +168 -0
  325. package/template/.kiro/tools/error_handler.py +335 -0
  326. package/template/.kiro/tools/improvement_identifier.py +444 -0
  327. package/template/.kiro/tools/modification_applicator.py +737 -0
  328. package/template/.kiro/tools/quality_gate_enforcer.py +207 -0
  329. package/template/.kiro/tools/quality_scorer.py +305 -0
  330. package/template/.kiro/tools/report_generator.py +154 -0
  331. package/template/.kiro/tools/ultrawork_enhancer.py +676 -0
  332. package/template/.kiro/tools/ultrawork_enhancer_refactored.py +0 -0
  333. package/template/.kiro/tools/ultrawork_enhancer_v2.py +463 -0
  334. package/template/.kiro/tools/ultrawork_enhancer_v3.py +606 -0
  335. package/template/.kiro/tools/workflow_quality_gate.py +100 -0
  336. package/template/README.md +111 -0
@@ -0,0 +1,143 @@
1
+ # Rollback Procedures
2
+
3
+ ## Rollback Triggers
4
+
5
+ ### Trigger 1: [Trigger Name]
6
+
7
+ **Condition**: What condition triggers rollback
8
+
9
+ **Severity**: Critical / High / Medium
10
+
11
+ **Decision maker**: Who authorizes rollback
12
+
13
+ **Time window**: How long to wait before rollback
14
+
15
+ **Automatic**: Yes / No (can this trigger automatic rollback)
16
+
17
+ ### Trigger 2: [Trigger Name]
18
+
19
+ **Condition**: What condition triggers rollback
20
+
21
+ **Severity**: Critical / High / Medium
22
+
23
+ **Decision maker**: Who authorizes rollback
24
+
25
+ **Time window**: How long to wait before rollback
26
+
27
+ **Automatic**: Yes / No (can this trigger automatic rollback)
28
+
29
+ ## Rollback Steps
30
+
31
+ ### Rollback Procedure 1: [Procedure Name]
32
+
33
+ **Scope**: What this rollback affects
34
+
35
+ **Downtime**: Expected downtime duration
36
+
37
+ **Prerequisites**:
38
+ - [ ] Prerequisite 1
39
+ - [ ] Prerequisite 2
40
+
41
+ **Steps**:
42
+ 1. Step 1
43
+ ```bash
44
+ # Command if applicable
45
+ ```
46
+ 2. Step 2
47
+ ```bash
48
+ # Command if applicable
49
+ ```
50
+ 3. Step 3
51
+ ```bash
52
+ # Command if applicable
53
+ ```
54
+
55
+ **Duration**: Expected time to complete
56
+
57
+ **Verification**:
58
+ - [ ] Rollback completed
59
+ - [ ] System functional
60
+ - [ ] Data integrity verified
61
+
62
+ ### Rollback Procedure 2: [Procedure Name]
63
+
64
+ **Scope**: What this rollback affects
65
+
66
+ **Downtime**: Expected downtime duration
67
+
68
+ **Prerequisites**:
69
+ - [ ] Prerequisite 1
70
+ - [ ] Prerequisite 2
71
+
72
+ **Steps**:
73
+ 1. Step 1
74
+ ```bash
75
+ # Command if applicable
76
+ ```
77
+ 2. Step 2
78
+ ```bash
79
+ # Command if applicable
80
+ ```
81
+ 3. Step 3
82
+ ```bash
83
+ # Command if applicable
84
+ ```
85
+
86
+ **Duration**: Expected time to complete
87
+
88
+ **Verification**:
89
+ - [ ] Rollback completed
90
+ - [ ] System functional
91
+ - [ ] Data integrity verified
92
+
93
+ ## Data Recovery Procedures
94
+
95
+ ### Recovery Procedure 1: [Procedure Name]
96
+
97
+ **What to recover**: Description of data
98
+
99
+ **Recovery point**: How far back to recover
100
+
101
+ **Data source**: Where to recover from (backup, snapshot, etc.)
102
+
103
+ **Steps**:
104
+ 1. Step 1
105
+ 2. Step 2
106
+ 3. Step 3
107
+
108
+ **Verification**:
109
+ - [ ] Data recovered
110
+ - [ ] Data integrity verified
111
+ - [ ] No data loss
112
+
113
+ **Risks**:
114
+ - Risk 1
115
+ - Risk 2
116
+
117
+ **Mitigation**:
118
+ - How to mitigate risks
119
+
120
+ ### Recovery Procedure 2: [Procedure Name]
121
+
122
+ **What to recover**: Description of data
123
+
124
+ **Recovery point**: How far back to recover
125
+
126
+ **Data source**: Where to recover from (backup, snapshot, etc.)
127
+
128
+ **Steps**:
129
+ 1. Step 1
130
+ 2. Step 2
131
+ 3. Step 3
132
+
133
+ **Verification**:
134
+ - [ ] Data recovered
135
+ - [ ] Data integrity verified
136
+ - [ ] No data loss
137
+
138
+ **Risks**:
139
+ - Risk 1
140
+ - Risk 2
141
+
142
+ **Mitigation**:
143
+ - How to mitigate risks
@@ -0,0 +1,364 @@
1
+ # AI-Driven Operations Tools Configuration
2
+ #
3
+ # This file defines tools and strategies for AI-driven operations.
4
+ # Focus on: 1) AI-friendly tools, 2) Version matching, 3) Execution efficiency
5
+
6
+ version: "1.0"
7
+ project: "project-name"
8
+ project_version: "1.0.0"
9
+
10
+ # Tool selection principles:
11
+ # - Prefer native system tools over third-party
12
+ # - Prioritize CLI-only, structured output, idempotent operations
13
+ # - Choose based on data size, network conditions, time windows
14
+ # - Match tool versions with system versions
15
+
16
+ tools:
17
+ # Database Operations
18
+ database_backup:
19
+ purpose: "Backup database with optimal strategy"
20
+
21
+ strategies:
22
+ - name: "logical_backup"
23
+ description: "Logical backup using native dump tool"
24
+ suitable_for:
25
+ data_size: "< 10GB"
26
+ downtime_acceptable: false
27
+ consistency_level: "transaction"
28
+
29
+ tool:
30
+ command: "pg_dump" # Example: PostgreSQL
31
+ native: true
32
+ version_match: "must match database version"
33
+ alternatives:
34
+ mysql: "mysqldump"
35
+ mongodb: "mongodump"
36
+
37
+ execution:
38
+ estimated_time_per_gb: "60 seconds"
39
+ cpu_intensive: false
40
+ io_intensive: true
41
+ network_intensive: false
42
+ parallelizable: false
43
+
44
+ ai_friendly:
45
+ cli_only: true
46
+ interactive: false
47
+ structured_output: true
48
+ output_format: "SQL"
49
+ idempotent: true
50
+ progress_reporting: false
51
+ exit_codes_clear: true
52
+
53
+ command_template: |
54
+ pg_dump -h {host} -U {user} -d {database} \
55
+ --format=custom \
56
+ --compress=9 \
57
+ --file={output_file}
58
+
59
+ - name: "physical_backup"
60
+ description: "Physical backup for large databases"
61
+ suitable_for:
62
+ data_size: "> 10GB"
63
+ downtime_acceptable: false
64
+ consistency_level: "point-in-time"
65
+
66
+ tool:
67
+ command: "pg_basebackup"
68
+ native: true
69
+ version_match: "must match database version"
70
+
71
+ execution:
72
+ estimated_time_per_gb: "30 seconds"
73
+ cpu_intensive: false
74
+ io_intensive: true
75
+ network_intensive: true
76
+ parallelizable: false
77
+
78
+ ai_friendly:
79
+ cli_only: true
80
+ interactive: false
81
+ structured_output: false
82
+ output_format: "binary"
83
+ idempotent: true
84
+ progress_reporting: true
85
+ exit_codes_clear: true
86
+
87
+ command_template: |
88
+ pg_basebackup -h {host} -U {user} \
89
+ --format=tar \
90
+ --gzip \
91
+ --progress \
92
+ --checkpoint=fast \
93
+ -D {output_dir}
94
+
95
+ - name: "snapshot_backup"
96
+ description: "Instant snapshot for very large databases"
97
+ suitable_for:
98
+ data_size: "> 100GB"
99
+ downtime_acceptable: true # Brief pause
100
+ storage_type: "LVM"
101
+
102
+ tool:
103
+ command: "lvcreate"
104
+ native: true
105
+ version_match: "LVM2"
106
+ requires_root: true
107
+
108
+ execution:
109
+ estimated_time_per_gb: "< 1 second"
110
+ cpu_intensive: false
111
+ io_intensive: false
112
+ network_intensive: false
113
+ parallelizable: false
114
+
115
+ ai_friendly:
116
+ cli_only: true
117
+ interactive: false
118
+ structured_output: true
119
+ output_format: "text"
120
+ idempotent: false # Need unique names
121
+ progress_reporting: false
122
+ exit_codes_clear: true
123
+
124
+ command_template: |
125
+ lvcreate --snapshot --size {snapshot_size} \
126
+ --name {snapshot_name} \
127
+ {volume_group}/{logical_volume}
128
+
129
+ # Log Analysis
130
+ log_analysis:
131
+ purpose: "Analyze application logs efficiently"
132
+
133
+ strategies:
134
+ - name: "native_text_processing"
135
+ description: "Use grep/awk for simple patterns"
136
+ suitable_for:
137
+ log_size: "< 1GB"
138
+ log_format: "text"
139
+ pattern_complexity: "simple"
140
+
141
+ tool:
142
+ command: "grep"
143
+ native: true
144
+ version_match: "any"
145
+ chain_with: ["awk", "sort", "uniq"]
146
+
147
+ execution:
148
+ estimated_time_per_100mb: "1 second"
149
+ cpu_intensive: true
150
+ io_intensive: true
151
+ network_intensive: false
152
+ parallelizable: true
153
+
154
+ ai_friendly:
155
+ cli_only: true
156
+ interactive: false
157
+ structured_output: true
158
+ output_format: "text/json"
159
+ idempotent: true
160
+ progress_reporting: false
161
+ exit_codes_clear: true
162
+
163
+ command_template: |
164
+ grep -E '{pattern}' {log_file} | \
165
+ awk '{print $1, $2, $NF}' | \
166
+ sort | uniq -c
167
+
168
+ - name: "json_log_processing"
169
+ description: "Process JSON logs with jq"
170
+ suitable_for:
171
+ log_size: "any"
172
+ log_format: "JSON"
173
+ pattern_complexity: "complex"
174
+
175
+ tool:
176
+ command: "jq"
177
+ native: false
178
+ version_match: ">= 1.6"
179
+ install_if_missing: "apt-get install jq"
180
+
181
+ execution:
182
+ estimated_time_per_100mb: "2 seconds"
183
+ cpu_intensive: true
184
+ io_intensive: false
185
+ network_intensive: false
186
+ parallelizable: false
187
+
188
+ ai_friendly:
189
+ cli_only: true
190
+ interactive: false
191
+ structured_output: true
192
+ output_format: "JSON"
193
+ idempotent: true
194
+ progress_reporting: false
195
+ exit_codes_clear: true
196
+
197
+ command_template: |
198
+ jq '{filter}' {log_file}
199
+
200
+ # Deployment
201
+ deployment:
202
+ purpose: "Deploy application to target environment"
203
+
204
+ strategies:
205
+ - name: "systemd_service"
206
+ description: "Deploy as systemd service (Linux native)"
207
+ suitable_for:
208
+ deployment_type: "system_service"
209
+ os: "Linux with systemd"
210
+ restart_strategy: "graceful"
211
+
212
+ tool:
213
+ command: "systemctl"
214
+ native: true
215
+ version_match: "systemd >= 230"
216
+ requires_root: true
217
+
218
+ execution:
219
+ estimated_time: "< 5 seconds"
220
+ cpu_intensive: false
221
+ io_intensive: false
222
+ network_intensive: false
223
+ parallelizable: false
224
+
225
+ ai_friendly:
226
+ cli_only: true
227
+ interactive: false
228
+ structured_output: true
229
+ output_format: "json"
230
+ idempotent: true
231
+ progress_reporting: false
232
+ exit_codes_clear: true
233
+
234
+ command_template: |
235
+ systemctl daemon-reload
236
+ systemctl restart {service_name}
237
+ systemctl status {service_name} --output=json
238
+
239
+ - name: "process_manager"
240
+ description: "Deploy using process manager (pm2, supervisor)"
241
+ suitable_for:
242
+ deployment_type: "application"
243
+ os: "any"
244
+ restart_strategy: "zero_downtime"
245
+
246
+ tool:
247
+ command: "pm2"
248
+ native: false
249
+ version_match: ">= 5.0"
250
+ install_if_missing: "npm install -g pm2"
251
+
252
+ execution:
253
+ estimated_time: "< 10 seconds"
254
+ cpu_intensive: false
255
+ io_intensive: false
256
+ network_intensive: false
257
+ parallelizable: false
258
+
259
+ ai_friendly:
260
+ cli_only: true
261
+ interactive: false
262
+ structured_output: true
263
+ output_format: "json"
264
+ idempotent: true
265
+ progress_reporting: false
266
+ exit_codes_clear: true
267
+
268
+ command_template: |
269
+ pm2 reload {app_name} --update-env
270
+
271
+ # Monitoring
272
+ health_check:
273
+ purpose: "Check system health"
274
+
275
+ strategies:
276
+ - name: "http_endpoint"
277
+ description: "Check HTTP health endpoint"
278
+ suitable_for:
279
+ service_type: "web_service"
280
+ protocol: "HTTP/HTTPS"
281
+
282
+ tool:
283
+ command: "curl"
284
+ native: true
285
+ version_match: "any"
286
+
287
+ execution:
288
+ estimated_time: "< 1 second"
289
+ cpu_intensive: false
290
+ io_intensive: false
291
+ network_intensive: true
292
+ parallelizable: true
293
+
294
+ ai_friendly:
295
+ cli_only: true
296
+ interactive: false
297
+ structured_output: true
298
+ output_format: "json"
299
+ idempotent: true
300
+ progress_reporting: false
301
+ exit_codes_clear: true
302
+
303
+ command_template: |
304
+ curl -f -s -o /dev/null -w "%{http_code}" \
305
+ --max-time 5 \
306
+ {health_endpoint}
307
+
308
+ - name: "process_check"
309
+ description: "Check if process is running"
310
+ suitable_for:
311
+ service_type: "system_service"
312
+ os: "Linux"
313
+
314
+ tool:
315
+ command: "systemctl"
316
+ native: true
317
+ version_match: "any"
318
+
319
+ execution:
320
+ estimated_time: "< 1 second"
321
+ cpu_intensive: false
322
+ io_intensive: false
323
+ network_intensive: false
324
+ parallelizable: true
325
+
326
+ ai_friendly:
327
+ cli_only: true
328
+ interactive: false
329
+ structured_output: true
330
+ output_format: "text"
331
+ idempotent: true
332
+ progress_reporting: false
333
+ exit_codes_clear: true
334
+
335
+ command_template: |
336
+ systemctl is-active {service_name}
337
+
338
+ # Tool selection algorithm parameters
339
+ selection_criteria:
340
+ weights:
341
+ ai_friendly: 0.4 # 40% weight
342
+ native_tool: 0.3 # 30% weight
343
+ execution_efficiency: 0.3 # 30% weight
344
+
345
+ efficiency_factors:
346
+ - data_size
347
+ - network_bandwidth
348
+ - time_window
349
+ - resource_availability
350
+
351
+ # Environment-specific overrides
352
+ environments:
353
+ development:
354
+ allow_non_native: true
355
+ auto_install_tools: true
356
+ prefer_verbose_output: true
357
+
358
+ production:
359
+ allow_non_native: false
360
+ auto_install_tools: false
361
+ prefer_silent_output: true
362
+ require_approval_for:
363
+ - snapshot_backup
364
+ - any operation requiring root
@@ -0,0 +1,123 @@
1
+ # Troubleshooting Guide
2
+
3
+ ## Common Issues
4
+
5
+ ### Issue 1: [Issue Name]
6
+
7
+ **Symptoms**:
8
+ - Symptom 1
9
+ - Symptom 2
10
+ - Symptom 3
11
+
12
+ **Possible causes**:
13
+ - Cause 1
14
+ - Cause 2
15
+ - Cause 3
16
+
17
+ **Impact**: Description of impact on users/system
18
+
19
+ **Frequency**: How often this occurs
20
+
21
+ **Related alerts**: Which monitoring alerts fire
22
+
23
+ ### Issue 2: [Issue Name]
24
+
25
+ **Symptoms**:
26
+ - Symptom 1
27
+ - Symptom 2
28
+ - Symptom 3
29
+
30
+ **Possible causes**:
31
+ - Cause 1
32
+ - Cause 2
33
+ - Cause 3
34
+
35
+ **Impact**: Description of impact on users/system
36
+
37
+ **Frequency**: How often this occurs
38
+
39
+ **Related alerts**: Which monitoring alerts fire
40
+
41
+ ## Diagnostic Commands
42
+
43
+ ### Diagnostic 1: [Diagnostic Name]
44
+
45
+ **Purpose**: What this diagnostic checks
46
+
47
+ **Command**:
48
+ ```bash
49
+ # Diagnostic command
50
+ ```
51
+
52
+ **Interpretation**:
53
+ - Normal output: What indicates healthy state
54
+ - Problem indicators: What to look for
55
+
56
+ **Next steps**: What to do based on results
57
+
58
+ ### Diagnostic 2: [Diagnostic Name]
59
+
60
+ **Purpose**: What this diagnostic checks
61
+
62
+ **Command**:
63
+ ```bash
64
+ # Diagnostic command
65
+ ```
66
+
67
+ **Interpretation**:
68
+ - Normal output: What indicates healthy state
69
+ - Problem indicators: What to look for
70
+
71
+ **Next steps**: What to do based on results
72
+
73
+ ## Resolution Steps
74
+
75
+ ### Resolution for Issue 1
76
+
77
+ **Quick fix** (if available):
78
+ ```bash
79
+ # Quick fix command
80
+ ```
81
+
82
+ **Detailed resolution**:
83
+ 1. Step 1
84
+ 2. Step 2
85
+ 3. Step 3
86
+
87
+ **Verification**:
88
+ - [ ] Issue resolved
89
+ - [ ] System stable
90
+ - [ ] No side effects
91
+
92
+ **Prevention**:
93
+ - How to prevent this issue in the future
94
+
95
+ **Escalation**:
96
+ - When to escalate: Conditions that require escalation
97
+ - Who to contact: Team/person to escalate to
98
+ - Information to provide: What details to include
99
+
100
+ ### Resolution for Issue 2
101
+
102
+ **Quick fix** (if available):
103
+ ```bash
104
+ # Quick fix command
105
+ ```
106
+
107
+ **Detailed resolution**:
108
+ 1. Step 1
109
+ 2. Step 2
110
+ 3. Step 3
111
+
112
+ **Verification**:
113
+ - [ ] Issue resolved
114
+ - [ ] System stable
115
+ - [ ] No side effects
116
+
117
+ **Prevention**:
118
+ - How to prevent this issue in the future
119
+
120
+ **Escalation**:
121
+ - When to escalate: Conditions that require escalation
122
+ - Who to contact: Team/person to escalate to
123
+ - Information to provide: What details to include