bps-kit 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/package.json +1 -1
  2. package/templates/.agents/agents/backend-specialist.md +263 -0
  3. package/templates/.agents/agents/code-archaeologist.md +106 -0
  4. package/templates/.agents/agents/database-architect.md +226 -0
  5. package/templates/.agents/agents/debugger.md +225 -0
  6. package/templates/.agents/agents/devops-engineer.md +242 -0
  7. package/templates/.agents/agents/documentation-writer.md +104 -0
  8. package/templates/.agents/agents/explorer-agent.md +73 -0
  9. package/templates/.agents/agents/frontend-specialist.md +593 -0
  10. package/templates/.agents/agents/game-developer.md +162 -0
  11. package/templates/.agents/agents/mobile-developer.md +377 -0
  12. package/templates/.agents/agents/orchestrator.md +416 -0
  13. package/templates/.agents/agents/penetration-tester.md +188 -0
  14. package/templates/.agents/agents/performance-optimizer.md +187 -0
  15. package/templates/.agents/agents/product-manager.md +112 -0
  16. package/templates/.agents/agents/product-owner.md +95 -0
  17. package/templates/.agents/agents/project-planner.md +406 -0
  18. package/templates/.agents/agents/qa-automation-engineer.md +103 -0
  19. package/templates/.agents/agents/security-auditor.md +170 -0
  20. package/templates/.agents/agents/seo-specialist.md +111 -0
  21. package/templates/.agents/agents/test-engineer.md +158 -0
  22. package/templates/.agents/rules/GEMINI.md +219 -0
  23. package/templates/.agents/scripts/auto_preview.py +148 -0
  24. package/templates/.agents/scripts/checklist.py +217 -0
  25. package/templates/.agents/scripts/session_manager.py +120 -0
  26. package/templates/.agents/scripts/verify_all.py +327 -0
  27. package/templates/.agents/workflows/brainstorm.md +113 -0
  28. package/templates/.agents/workflows/create.md +59 -0
  29. package/templates/.agents/workflows/debug.md +103 -0
  30. package/templates/.agents/workflows/deploy.md +176 -0
  31. package/templates/.agents/workflows/enhance.md +63 -0
  32. package/templates/.agents/workflows/orchestrate.md +237 -0
  33. package/templates/.agents/workflows/plan.md +89 -0
  34. package/templates/.agents/workflows/preview.md +81 -0
  35. package/templates/.agents/workflows/setup-brain.md +39 -0
  36. package/templates/.agents/workflows/status.md +86 -0
  37. package/templates/.agents/workflows/test.md +144 -0
  38. package/templates/.agents/workflows/ui-ux-pro-max.md +296 -0
  39. package/templates/skills_normal/api-patterns/scripts/api_validator.py +211 -0
  40. package/templates/skills_normal/database-design/scripts/schema_validator.py +172 -0
  41. package/templates/skills_normal/frontend-design/scripts/accessibility_checker.py +183 -0
  42. package/templates/skills_normal/frontend-design/scripts/ux_audit.py +722 -0
  43. package/templates/skills_normal/git-pushing/scripts/smart_commit.sh +19 -0
  44. package/templates/skills_normal/lint-and-validate/scripts/lint_runner.py +184 -0
  45. package/templates/skills_normal/lint-and-validate/scripts/type_coverage.py +173 -0
  46. package/templates/skills_normal/performance-profiling/scripts/lighthouse_audit.py +76 -0
  47. package/templates/skills_normal/senior-fullstack/scripts/code_quality_analyzer.py +114 -0
  48. package/templates/skills_normal/senior-fullstack/scripts/fullstack_scaffolder.py +114 -0
  49. package/templates/skills_normal/senior-fullstack/scripts/project_scaffolder.py +114 -0
  50. package/templates/skills_normal/seo-fundamentals/scripts/seo_checker.py +219 -0
  51. package/templates/skills_normal/testing-patterns/scripts/test_runner.py +219 -0
  52. package/templates/skills_normal/vulnerability-scanner/scripts/security_scan.py +458 -0
  53. package/templates/vault/007/scripts/config.py +472 -0
  54. package/templates/vault/007/scripts/full_audit.py +1306 -0
  55. package/templates/vault/007/scripts/quick_scan.py +481 -0
  56. package/templates/vault/007/scripts/requirements.txt +26 -0
  57. package/templates/vault/007/scripts/scanners/__init__.py +0 -0
  58. package/templates/vault/007/scripts/scanners/dependency_scanner.py +1305 -0
  59. package/templates/vault/007/scripts/scanners/injection_scanner.py +1104 -0
  60. package/templates/vault/007/scripts/scanners/secrets_scanner.py +1008 -0
  61. package/templates/vault/007/scripts/score_calculator.py +693 -0
  62. package/templates/vault/agent-orchestrator/scripts/match_skills.py +329 -0
  63. package/templates/vault/agent-orchestrator/scripts/orchestrate.py +304 -0
  64. package/templates/vault/agent-orchestrator/scripts/requirements.txt +1 -0
  65. package/templates/vault/agent-orchestrator/scripts/scan_registry.py +508 -0
  66. package/templates/vault/ai-studio-image/scripts/config.py +613 -0
  67. package/templates/vault/ai-studio-image/scripts/generate.py +630 -0
  68. package/templates/vault/ai-studio-image/scripts/prompt_engine.py +424 -0
  69. package/templates/vault/ai-studio-image/scripts/requirements.txt +4 -0
  70. package/templates/vault/ai-studio-image/scripts/templates.py +349 -0
  71. package/templates/vault/android_ui_verification/scripts/verify_ui.sh +32 -0
  72. package/templates/vault/apify-audience-analysis/reference/scripts/run_actor.js +363 -0
  73. package/templates/vault/apify-brand-reputation-monitoring/reference/scripts/run_actor.js +363 -0
  74. package/templates/vault/apify-competitor-intelligence/reference/scripts/run_actor.js +363 -0
  75. package/templates/vault/apify-content-analytics/reference/scripts/run_actor.js +363 -0
  76. package/templates/vault/apify-ecommerce/reference/scripts/package.json +3 -0
  77. package/templates/vault/apify-ecommerce/reference/scripts/run_actor.js +369 -0
  78. package/templates/vault/apify-influencer-discovery/reference/scripts/run_actor.js +363 -0
  79. package/templates/vault/apify-lead-generation/reference/scripts/run_actor.js +363 -0
  80. package/templates/vault/apify-market-research/reference/scripts/run_actor.js +363 -0
  81. package/templates/vault/apify-trend-analysis/reference/scripts/run_actor.js +363 -0
  82. package/templates/vault/apify-ultimate-scraper/reference/scripts/run_actor.js +363 -0
  83. package/templates/vault/audio-transcriber/scripts/install-requirements.sh +190 -0
  84. package/templates/vault/audio-transcriber/scripts/transcribe.py +486 -0
  85. package/templates/vault/claude-monitor/scripts/api_bench.py +240 -0
  86. package/templates/vault/claude-monitor/scripts/config.py +69 -0
  87. package/templates/vault/claude-monitor/scripts/health_check.py +362 -0
  88. package/templates/vault/claude-monitor/scripts/monitor.py +296 -0
  89. package/templates/vault/content-creator/scripts/brand_voice_analyzer.py +185 -0
  90. package/templates/vault/content-creator/scripts/seo_optimizer.py +419 -0
  91. package/templates/vault/context-agent/scripts/active_context.py +227 -0
  92. package/templates/vault/context-agent/scripts/compressor.py +149 -0
  93. package/templates/vault/context-agent/scripts/config.py +69 -0
  94. package/templates/vault/context-agent/scripts/context_loader.py +155 -0
  95. package/templates/vault/context-agent/scripts/context_manager.py +302 -0
  96. package/templates/vault/context-agent/scripts/models.py +103 -0
  97. package/templates/vault/context-agent/scripts/project_registry.py +132 -0
  98. package/templates/vault/context-agent/scripts/requirements.txt +6 -0
  99. package/templates/vault/context-agent/scripts/search.py +115 -0
  100. package/templates/vault/context-agent/scripts/session_parser.py +206 -0
  101. package/templates/vault/context-agent/scripts/session_summary.py +319 -0
  102. package/templates/vault/context-guardian/scripts/context_snapshot.py +229 -0
  103. package/templates/vault/docx/ooxml/scripts/pack.py +159 -0
  104. package/templates/vault/docx/ooxml/scripts/unpack.py +29 -0
  105. package/templates/vault/docx/ooxml/scripts/validate.py +69 -0
  106. package/templates/vault/docx/ooxml/scripts/validation/__init__.py +15 -0
  107. package/templates/vault/docx/ooxml/scripts/validation/base.py +951 -0
  108. package/templates/vault/docx/ooxml/scripts/validation/docx.py +274 -0
  109. package/templates/vault/docx/ooxml/scripts/validation/pptx.py +315 -0
  110. package/templates/vault/docx/ooxml/scripts/validation/redlining.py +279 -0
  111. package/templates/vault/docx/scripts/__init__.py +1 -0
  112. package/templates/vault/docx/scripts/document.py +1276 -0
  113. package/templates/vault/docx/scripts/templates/comments.xml +3 -0
  114. package/templates/vault/docx/scripts/templates/commentsExtended.xml +3 -0
  115. package/templates/vault/docx/scripts/templates/commentsExtensible.xml +3 -0
  116. package/templates/vault/docx/scripts/templates/commentsIds.xml +3 -0
  117. package/templates/vault/docx/scripts/templates/people.xml +3 -0
  118. package/templates/vault/docx/scripts/utilities.py +374 -0
  119. package/templates/vault/docx-official/ooxml/scripts/pack.py +159 -0
  120. package/templates/vault/docx-official/ooxml/scripts/unpack.py +29 -0
  121. package/templates/vault/docx-official/ooxml/scripts/validate.py +69 -0
  122. package/templates/vault/docx-official/ooxml/scripts/validation/__init__.py +15 -0
  123. package/templates/vault/docx-official/ooxml/scripts/validation/base.py +951 -0
  124. package/templates/vault/docx-official/ooxml/scripts/validation/docx.py +274 -0
  125. package/templates/vault/docx-official/ooxml/scripts/validation/pptx.py +315 -0
  126. package/templates/vault/docx-official/ooxml/scripts/validation/redlining.py +279 -0
  127. package/templates/vault/docx-official/scripts/__init__.py +1 -0
  128. package/templates/vault/docx-official/scripts/document.py +1276 -0
  129. package/templates/vault/docx-official/scripts/templates/comments.xml +3 -0
  130. package/templates/vault/docx-official/scripts/templates/commentsExtended.xml +3 -0
  131. package/templates/vault/docx-official/scripts/templates/commentsExtensible.xml +3 -0
  132. package/templates/vault/docx-official/scripts/templates/commentsIds.xml +3 -0
  133. package/templates/vault/docx-official/scripts/templates/people.xml +3 -0
  134. package/templates/vault/docx-official/scripts/utilities.py +374 -0
  135. package/templates/vault/geo-fundamentals/scripts/geo_checker.py +289 -0
  136. package/templates/vault/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
  137. package/templates/vault/i18n-localization/scripts/i18n_checker.py +241 -0
  138. package/templates/vault/instagram/scripts/account_setup.py +233 -0
  139. package/templates/vault/instagram/scripts/analyze.py +221 -0
  140. package/templates/vault/instagram/scripts/api_client.py +444 -0
  141. package/templates/vault/instagram/scripts/auth.py +411 -0
  142. package/templates/vault/instagram/scripts/comments.py +160 -0
  143. package/templates/vault/instagram/scripts/config.py +111 -0
  144. package/templates/vault/instagram/scripts/db.py +467 -0
  145. package/templates/vault/instagram/scripts/export.py +138 -0
  146. package/templates/vault/instagram/scripts/governance.py +233 -0
  147. package/templates/vault/instagram/scripts/hashtags.py +114 -0
  148. package/templates/vault/instagram/scripts/insights.py +170 -0
  149. package/templates/vault/instagram/scripts/media.py +65 -0
  150. package/templates/vault/instagram/scripts/messages.py +103 -0
  151. package/templates/vault/instagram/scripts/profile.py +58 -0
  152. package/templates/vault/instagram/scripts/publish.py +449 -0
  153. package/templates/vault/instagram/scripts/requirements.txt +5 -0
  154. package/templates/vault/instagram/scripts/run_all.py +189 -0
  155. package/templates/vault/instagram/scripts/schedule.py +189 -0
  156. package/templates/vault/instagram/scripts/serve_api.py +234 -0
  157. package/templates/vault/instagram/scripts/templates.py +155 -0
  158. package/templates/vault/junta-leiloeiros/scripts/db.py +216 -0
  159. package/templates/vault/junta-leiloeiros/scripts/export.py +137 -0
  160. package/templates/vault/junta-leiloeiros/scripts/requirements.txt +15 -0
  161. package/templates/vault/junta-leiloeiros/scripts/run_all.py +190 -0
  162. package/templates/vault/junta-leiloeiros/scripts/scraper/__init__.py +4 -0
  163. package/templates/vault/junta-leiloeiros/scripts/scraper/base_scraper.py +209 -0
  164. package/templates/vault/junta-leiloeiros/scripts/scraper/generic_scraper.py +110 -0
  165. package/templates/vault/junta-leiloeiros/scripts/scraper/jucap.py +110 -0
  166. package/templates/vault/junta-leiloeiros/scripts/scraper/juceac.py +72 -0
  167. package/templates/vault/junta-leiloeiros/scripts/scraper/juceal.py +72 -0
  168. package/templates/vault/junta-leiloeiros/scripts/scraper/juceb.py +68 -0
  169. package/templates/vault/junta-leiloeiros/scripts/scraper/jucec.py +63 -0
  170. package/templates/vault/junta-leiloeiros/scripts/scraper/jucema.py +211 -0
  171. package/templates/vault/junta-leiloeiros/scripts/scraper/jucemg.py +218 -0
  172. package/templates/vault/junta-leiloeiros/scripts/scraper/jucep.py +70 -0
  173. package/templates/vault/junta-leiloeiros/scripts/scraper/jucepa.py +74 -0
  174. package/templates/vault/junta-leiloeiros/scripts/scraper/jucepar.py +80 -0
  175. package/templates/vault/junta-leiloeiros/scripts/scraper/jucepe.py +78 -0
  176. package/templates/vault/junta-leiloeiros/scripts/scraper/jucepi.py +69 -0
  177. package/templates/vault/junta-leiloeiros/scripts/scraper/jucer.py +256 -0
  178. package/templates/vault/junta-leiloeiros/scripts/scraper/jucerja.py +170 -0
  179. package/templates/vault/junta-leiloeiros/scripts/scraper/jucern.py +71 -0
  180. package/templates/vault/junta-leiloeiros/scripts/scraper/jucesc.py +89 -0
  181. package/templates/vault/junta-leiloeiros/scripts/scraper/jucesp.py +233 -0
  182. package/templates/vault/junta-leiloeiros/scripts/scraper/jucetins.py +134 -0
  183. package/templates/vault/junta-leiloeiros/scripts/scraper/jucis_df.py +63 -0
  184. package/templates/vault/junta-leiloeiros/scripts/scraper/jucisrs.py +299 -0
  185. package/templates/vault/junta-leiloeiros/scripts/scraper/states.py +99 -0
  186. package/templates/vault/junta-leiloeiros/scripts/serve_api.py +164 -0
  187. package/templates/vault/junta-leiloeiros/scripts/web_scraper_fallback.py +233 -0
  188. package/templates/vault/last30days/scripts/last30days.py +521 -0
  189. package/templates/vault/last30days/scripts/lib/__init__.py +1 -0
  190. package/templates/vault/last30days/scripts/lib/cache.py +152 -0
  191. package/templates/vault/last30days/scripts/lib/dates.py +124 -0
  192. package/templates/vault/last30days/scripts/lib/dedupe.py +120 -0
  193. package/templates/vault/last30days/scripts/lib/env.py +149 -0
  194. package/templates/vault/last30days/scripts/lib/http.py +152 -0
  195. package/templates/vault/last30days/scripts/lib/models.py +175 -0
  196. package/templates/vault/last30days/scripts/lib/normalize.py +160 -0
  197. package/templates/vault/last30days/scripts/lib/openai_reddit.py +230 -0
  198. package/templates/vault/last30days/scripts/lib/reddit_enrich.py +232 -0
  199. package/templates/vault/last30days/scripts/lib/render.py +383 -0
  200. package/templates/vault/last30days/scripts/lib/schema.py +336 -0
  201. package/templates/vault/last30days/scripts/lib/score.py +311 -0
  202. package/templates/vault/last30days/scripts/lib/ui.py +324 -0
  203. package/templates/vault/last30days/scripts/lib/websearch.py +401 -0
  204. package/templates/vault/last30days/scripts/lib/xai_x.py +217 -0
  205. package/templates/vault/leiloeiro-avaliacao/scripts/governance.py +106 -0
  206. package/templates/vault/leiloeiro-avaliacao/scripts/requirements.txt +1 -0
  207. package/templates/vault/leiloeiro-edital/scripts/governance.py +106 -0
  208. package/templates/vault/leiloeiro-edital/scripts/requirements.txt +1 -0
  209. package/templates/vault/leiloeiro-ia/scripts/governance.py +106 -0
  210. package/templates/vault/leiloeiro-ia/scripts/requirements.txt +1 -0
  211. package/templates/vault/leiloeiro-juridico/scripts/governance.py +106 -0
  212. package/templates/vault/leiloeiro-juridico/scripts/requirements.txt +1 -0
  213. package/templates/vault/leiloeiro-mercado/scripts/governance.py +106 -0
  214. package/templates/vault/leiloeiro-mercado/scripts/requirements.txt +1 -0
  215. package/templates/vault/leiloeiro-risco/scripts/governance.py +106 -0
  216. package/templates/vault/leiloeiro-risco/scripts/requirements.txt +1 -0
  217. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/database.ts +24 -0
  218. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/db.ts +35 -0
  219. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/index.ts +2 -0
  220. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/migrations.ts +31 -0
  221. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/db/schema.sql +8 -0
  222. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/index.ts +44 -0
  223. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/routes/todos.ts +155 -0
  224. package/templates/vault/loki-mode/examples/todo-app-generated/backend/src/types/index.ts +35 -0
  225. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/App.css +384 -0
  226. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/App.tsx +81 -0
  227. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/api/todos.ts +57 -0
  228. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/ConfirmDialog.tsx +26 -0
  229. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/EmptyState.tsx +8 -0
  230. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/TodoForm.tsx +43 -0
  231. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/TodoItem.tsx +36 -0
  232. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/components/TodoList.tsx +27 -0
  233. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/hooks/useTodos.ts +81 -0
  234. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/index.css +48 -0
  235. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/main.tsx +10 -0
  236. package/templates/vault/loki-mode/examples/todo-app-generated/frontend/src/vite-env.d.ts +1 -0
  237. package/templates/vault/loki-mode/scripts/export-to-vibe-kanban.sh +178 -0
  238. package/templates/vault/loki-mode/scripts/loki-wrapper.sh +281 -0
  239. package/templates/vault/loki-mode/scripts/take-screenshots.js +55 -0
  240. package/templates/vault/matematico-tao/scripts/complexity_analyzer.py +544 -0
  241. package/templates/vault/matematico-tao/scripts/dependency_graph.py +538 -0
  242. package/templates/vault/mcp-builder/scripts/connections.py +151 -0
  243. package/templates/vault/mcp-builder/scripts/evaluation.py +373 -0
  244. package/templates/vault/mcp-builder/scripts/example_evaluation.xml +22 -0
  245. package/templates/vault/mcp-builder/scripts/requirements.txt +2 -0
  246. package/templates/vault/mobile-design/scripts/mobile_audit.py +670 -0
  247. package/templates/vault/notebooklm/scripts/__init__.py +81 -0
  248. package/templates/vault/notebooklm/scripts/ask_question.py +256 -0
  249. package/templates/vault/notebooklm/scripts/auth_manager.py +358 -0
  250. package/templates/vault/notebooklm/scripts/browser_session.py +255 -0
  251. package/templates/vault/notebooklm/scripts/browser_utils.py +107 -0
  252. package/templates/vault/notebooklm/scripts/cleanup_manager.py +302 -0
  253. package/templates/vault/notebooklm/scripts/config.py +44 -0
  254. package/templates/vault/notebooklm/scripts/notebook_manager.py +410 -0
  255. package/templates/vault/notebooklm/scripts/run.py +102 -0
  256. package/templates/vault/notebooklm/scripts/setup_environment.py +204 -0
  257. package/templates/vault/pdf/scripts/check_bounding_boxes.py +70 -0
  258. package/templates/vault/pdf/scripts/check_bounding_boxes_test.py +226 -0
  259. package/templates/vault/pdf/scripts/check_fillable_fields.py +12 -0
  260. package/templates/vault/pdf/scripts/convert_pdf_to_images.py +35 -0
  261. package/templates/vault/pdf/scripts/create_validation_image.py +41 -0
  262. package/templates/vault/pdf/scripts/extract_form_field_info.py +152 -0
  263. package/templates/vault/pdf/scripts/fill_fillable_fields.py +114 -0
  264. package/templates/vault/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
  265. package/templates/vault/pdf-official/scripts/check_bounding_boxes.py +70 -0
  266. package/templates/vault/pdf-official/scripts/check_bounding_boxes_test.py +226 -0
  267. package/templates/vault/pdf-official/scripts/check_fillable_fields.py +12 -0
  268. package/templates/vault/pdf-official/scripts/convert_pdf_to_images.py +35 -0
  269. package/templates/vault/pdf-official/scripts/create_validation_image.py +41 -0
  270. package/templates/vault/pdf-official/scripts/extract_form_field_info.py +152 -0
  271. package/templates/vault/pdf-official/scripts/fill_fillable_fields.py +114 -0
  272. package/templates/vault/pdf-official/scripts/fill_pdf_form_with_annotations.py +108 -0
  273. package/templates/vault/planning-with-files/scripts/check-complete.sh +44 -0
  274. package/templates/vault/planning-with-files/scripts/init-session.sh +120 -0
  275. package/templates/vault/pptx/ooxml/scripts/pack.py +159 -0
  276. package/templates/vault/pptx/ooxml/scripts/unpack.py +29 -0
  277. package/templates/vault/pptx/ooxml/scripts/validate.py +69 -0
  278. package/templates/vault/pptx/ooxml/scripts/validation/__init__.py +15 -0
  279. package/templates/vault/pptx/ooxml/scripts/validation/base.py +951 -0
  280. package/templates/vault/pptx/ooxml/scripts/validation/docx.py +274 -0
  281. package/templates/vault/pptx/ooxml/scripts/validation/pptx.py +315 -0
  282. package/templates/vault/pptx/ooxml/scripts/validation/redlining.py +279 -0
  283. package/templates/vault/pptx/scripts/html2pptx.js +979 -0
  284. package/templates/vault/pptx/scripts/inventory.py +1020 -0
  285. package/templates/vault/pptx/scripts/rearrange.py +231 -0
  286. package/templates/vault/pptx/scripts/replace.py +385 -0
  287. package/templates/vault/pptx/scripts/thumbnail.py +450 -0
  288. package/templates/vault/pptx-official/ooxml/scripts/pack.py +159 -0
  289. package/templates/vault/pptx-official/ooxml/scripts/unpack.py +29 -0
  290. package/templates/vault/pptx-official/ooxml/scripts/validate.py +69 -0
  291. package/templates/vault/pptx-official/ooxml/scripts/validation/__init__.py +15 -0
  292. package/templates/vault/pptx-official/ooxml/scripts/validation/base.py +951 -0
  293. package/templates/vault/pptx-official/ooxml/scripts/validation/docx.py +274 -0
  294. package/templates/vault/pptx-official/ooxml/scripts/validation/pptx.py +315 -0
  295. package/templates/vault/pptx-official/ooxml/scripts/validation/redlining.py +279 -0
  296. package/templates/vault/pptx-official/scripts/html2pptx.js +979 -0
  297. package/templates/vault/pptx-official/scripts/inventory.py +1020 -0
  298. package/templates/vault/pptx-official/scripts/rearrange.py +231 -0
  299. package/templates/vault/pptx-official/scripts/replace.py +385 -0
  300. package/templates/vault/pptx-official/scripts/thumbnail.py +450 -0
  301. package/templates/vault/product-manager-toolkit/scripts/customer_interview_analyzer.py +441 -0
  302. package/templates/vault/product-manager-toolkit/scripts/rice_prioritizer.py +296 -0
  303. package/templates/vault/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
  304. package/templates/vault/scripts/.skill_cache.json +7538 -0
  305. package/templates/vault/scripts/skill_search.py +228 -0
  306. package/templates/vault/senior-architect/scripts/architecture_diagram_generator.py +114 -0
  307. package/templates/vault/senior-architect/scripts/dependency_analyzer.py +114 -0
  308. package/templates/vault/senior-architect/scripts/project_architect.py +114 -0
  309. package/templates/vault/shopify-development/scripts/requirements.txt +19 -0
  310. package/templates/vault/shopify-development/scripts/shopify_graphql.py +428 -0
  311. package/templates/vault/shopify-development/scripts/shopify_init.py +441 -0
  312. package/templates/vault/shopify-development/scripts/tests/test_shopify_init.py +379 -0
  313. package/templates/vault/skill-creator/scripts/init_skill.py +303 -0
  314. package/templates/vault/skill-creator/scripts/package_skill.py +110 -0
  315. package/templates/vault/skill-creator/scripts/quick_validate.py +95 -0
  316. package/templates/vault/skill-installer/scripts/detect_skills.py +318 -0
  317. package/templates/vault/skill-installer/scripts/install_skill.py +1708 -0
  318. package/templates/vault/skill-installer/scripts/package_skill.py +417 -0
  319. package/templates/vault/skill-installer/scripts/requirements.txt +1 -0
  320. package/templates/vault/skill-installer/scripts/validate_skill.py +430 -0
  321. package/templates/vault/skill-sentinel/scripts/analyzers/__init__.py +13 -0
  322. package/templates/vault/skill-sentinel/scripts/analyzers/code_quality.py +247 -0
  323. package/templates/vault/skill-sentinel/scripts/analyzers/cross_skill.py +134 -0
  324. package/templates/vault/skill-sentinel/scripts/analyzers/dependencies.py +121 -0
  325. package/templates/vault/skill-sentinel/scripts/analyzers/documentation.py +189 -0
  326. package/templates/vault/skill-sentinel/scripts/analyzers/governance_audit.py +153 -0
  327. package/templates/vault/skill-sentinel/scripts/analyzers/performance.py +164 -0
  328. package/templates/vault/skill-sentinel/scripts/analyzers/security.py +189 -0
  329. package/templates/vault/skill-sentinel/scripts/config.py +158 -0
  330. package/templates/vault/skill-sentinel/scripts/cost_optimizer.py +146 -0
  331. package/templates/vault/skill-sentinel/scripts/db.py +354 -0
  332. package/templates/vault/skill-sentinel/scripts/governance.py +58 -0
  333. package/templates/vault/skill-sentinel/scripts/recommender.py +228 -0
  334. package/templates/vault/skill-sentinel/scripts/report_generator.py +224 -0
  335. package/templates/vault/skill-sentinel/scripts/requirements.txt +1 -0
  336. package/templates/vault/skill-sentinel/scripts/run_audit.py +290 -0
  337. package/templates/vault/skill-sentinel/scripts/scanner.py +271 -0
  338. package/templates/vault/stability-ai/scripts/config.py +266 -0
  339. package/templates/vault/stability-ai/scripts/generate.py +687 -0
  340. package/templates/vault/stability-ai/scripts/requirements.txt +4 -0
  341. package/templates/vault/stability-ai/scripts/styles.py +174 -0
  342. package/templates/vault/telegram/assets/boilerplate/nodejs/src/bot-client.ts +86 -0
  343. package/templates/vault/telegram/assets/boilerplate/nodejs/src/handlers.ts +79 -0
  344. package/templates/vault/telegram/assets/boilerplate/nodejs/src/index.ts +32 -0
  345. package/templates/vault/telegram/scripts/send_message.py +143 -0
  346. package/templates/vault/telegram/scripts/setup_project.py +103 -0
  347. package/templates/vault/telegram/scripts/test_bot.py +144 -0
  348. package/templates/vault/typescript-expert/scripts/ts_diagnostic.py +203 -0
  349. package/templates/vault/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
  350. package/templates/vault/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
  351. package/templates/vault/ui-ux-pro-max/scripts/core.py +257 -0
  352. package/templates/vault/ui-ux-pro-max/scripts/design_system.py +487 -0
  353. package/templates/vault/ui-ux-pro-max/scripts/search.py +76 -0
  354. package/templates/vault/videodb/scripts/ws_listener.py +204 -0
  355. package/templates/vault/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
  356. package/templates/vault/web-artifacts-builder/scripts/init-artifact.sh +322 -0
  357. package/templates/vault/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  358. package/templates/vault/webapp-testing/scripts/with_server.py +106 -0
  359. package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/index.ts +125 -0
  360. package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/template-manager.ts +67 -0
  361. package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/types.ts +216 -0
  362. package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/webhook-handler.ts +173 -0
  363. package/templates/vault/whatsapp-cloud-api/assets/boilerplate/nodejs/src/whatsapp-client.ts +193 -0
  364. package/templates/vault/whatsapp-cloud-api/scripts/send_test_message.py +137 -0
  365. package/templates/vault/whatsapp-cloud-api/scripts/setup_project.py +118 -0
  366. package/templates/vault/whatsapp-cloud-api/scripts/validate_config.py +190 -0
  367. package/templates/vault/youtube-summarizer/scripts/extract-transcript.py +65 -0
  368. package/templates/vault/youtube-summarizer/scripts/install-dependencies.sh +28 -0
@@ -0,0 +1,419 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SEO Content Optimizer - Analyzes and optimizes content for SEO
4
+ """
5
+
6
+ import re
7
+ from typing import Dict, List, Set
8
+ import json
9
+
10
+ class SEOOptimizer:
11
+ def __init__(self):
12
+ # Common stop words to filter
13
+ self.stop_words = {
14
+ 'the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for',
15
+ 'of', 'with', 'by', 'from', 'as', 'is', 'was', 'are', 'were', 'be',
16
+ 'been', 'being', 'have', 'has', 'had', 'do', 'does', 'did', 'will',
17
+ 'would', 'could', 'should', 'may', 'might', 'must', 'can', 'shall'
18
+ }
19
+
20
+ # SEO best practices
21
+ self.best_practices = {
22
+ 'title_length': (50, 60),
23
+ 'meta_description_length': (150, 160),
24
+ 'url_length': (50, 60),
25
+ 'paragraph_length': (40, 150),
26
+ 'heading_keyword_placement': True,
27
+ 'keyword_density': (0.01, 0.03) # 1-3%
28
+ }
29
+
30
+ def analyze(self, content: str, target_keyword: str = None,
31
+ secondary_keywords: List[str] = None) -> Dict:
32
+ """Analyze content for SEO optimization"""
33
+
34
+ analysis = {
35
+ 'content_length': len(content.split()),
36
+ 'keyword_analysis': {},
37
+ 'structure_analysis': self._analyze_structure(content),
38
+ 'readability': self._analyze_readability(content),
39
+ 'meta_suggestions': {},
40
+ 'optimization_score': 0,
41
+ 'recommendations': []
42
+ }
43
+
44
+ # Keyword analysis
45
+ if target_keyword:
46
+ analysis['keyword_analysis'] = self._analyze_keywords(
47
+ content, target_keyword, secondary_keywords or []
48
+ )
49
+
50
+ # Generate meta suggestions
51
+ analysis['meta_suggestions'] = self._generate_meta_suggestions(
52
+ content, target_keyword
53
+ )
54
+
55
+ # Calculate optimization score
56
+ analysis['optimization_score'] = self._calculate_seo_score(analysis)
57
+
58
+ # Generate recommendations
59
+ analysis['recommendations'] = self._generate_recommendations(analysis)
60
+
61
+ return analysis
62
+
63
+ def _analyze_keywords(self, content: str, primary: str,
64
+ secondary: List[str]) -> Dict:
65
+ """Analyze keyword usage and density"""
66
+ content_lower = content.lower()
67
+ word_count = len(content.split())
68
+
69
+ results = {
70
+ 'primary_keyword': {
71
+ 'keyword': primary,
72
+ 'count': content_lower.count(primary.lower()),
73
+ 'density': 0,
74
+ 'in_title': False,
75
+ 'in_headings': False,
76
+ 'in_first_paragraph': False
77
+ },
78
+ 'secondary_keywords': [],
79
+ 'lsi_keywords': []
80
+ }
81
+
82
+ # Calculate primary keyword metrics
83
+ if word_count > 0:
84
+ results['primary_keyword']['density'] = (
85
+ results['primary_keyword']['count'] / word_count
86
+ )
87
+
88
+ # Check keyword placement
89
+ first_para = content.split('\n\n')[0] if '\n\n' in content else content[:200]
90
+ results['primary_keyword']['in_first_paragraph'] = (
91
+ primary.lower() in first_para.lower()
92
+ )
93
+
94
+ # Analyze secondary keywords
95
+ for keyword in secondary:
96
+ count = content_lower.count(keyword.lower())
97
+ results['secondary_keywords'].append({
98
+ 'keyword': keyword,
99
+ 'count': count,
100
+ 'density': count / word_count if word_count > 0 else 0
101
+ })
102
+
103
+ # Extract potential LSI keywords
104
+ results['lsi_keywords'] = self._extract_lsi_keywords(content, primary)
105
+
106
+ return results
107
+
108
+ def _analyze_structure(self, content: str) -> Dict:
109
+ """Analyze content structure for SEO"""
110
+ lines = content.split('\n')
111
+
112
+ structure = {
113
+ 'headings': {'h1': 0, 'h2': 0, 'h3': 0, 'total': 0},
114
+ 'paragraphs': 0,
115
+ 'lists': 0,
116
+ 'images': 0,
117
+ 'links': {'internal': 0, 'external': 0},
118
+ 'avg_paragraph_length': 0
119
+ }
120
+
121
+ paragraphs = []
122
+ current_para = []
123
+
124
+ for line in lines:
125
+ # Count headings
126
+ if line.startswith('# '):
127
+ structure['headings']['h1'] += 1
128
+ structure['headings']['total'] += 1
129
+ elif line.startswith('## '):
130
+ structure['headings']['h2'] += 1
131
+ structure['headings']['total'] += 1
132
+ elif line.startswith('### '):
133
+ structure['headings']['h3'] += 1
134
+ structure['headings']['total'] += 1
135
+
136
+ # Count lists
137
+ if line.strip().startswith(('- ', '* ', '1. ')):
138
+ structure['lists'] += 1
139
+
140
+ # Count links
141
+ internal_links = len(re.findall(r'\[.*?\]\(/.*?\)', line))
142
+ external_links = len(re.findall(r'\[.*?\]\(https?://.*?\)', line))
143
+ structure['links']['internal'] += internal_links
144
+ structure['links']['external'] += external_links
145
+
146
+ # Track paragraphs
147
+ if line.strip() and not line.startswith('#'):
148
+ current_para.append(line)
149
+ elif current_para:
150
+ paragraphs.append(' '.join(current_para))
151
+ current_para = []
152
+
153
+ if current_para:
154
+ paragraphs.append(' '.join(current_para))
155
+
156
+ structure['paragraphs'] = len(paragraphs)
157
+
158
+ if paragraphs:
159
+ avg_length = sum(len(p.split()) for p in paragraphs) / len(paragraphs)
160
+ structure['avg_paragraph_length'] = round(avg_length, 1)
161
+
162
+ return structure
163
+
164
+ def _analyze_readability(self, content: str) -> Dict:
165
+ """Analyze content readability"""
166
+ sentences = re.split(r'[.!?]+', content)
167
+ words = content.split()
168
+
169
+ if not sentences or not words:
170
+ return {'score': 0, 'level': 'Unknown'}
171
+
172
+ avg_sentence_length = len(words) / len(sentences)
173
+
174
+ # Simple readability scoring
175
+ if avg_sentence_length < 15:
176
+ level = 'Easy'
177
+ score = 90
178
+ elif avg_sentence_length < 20:
179
+ level = 'Moderate'
180
+ score = 70
181
+ elif avg_sentence_length < 25:
182
+ level = 'Difficult'
183
+ score = 50
184
+ else:
185
+ level = 'Very Difficult'
186
+ score = 30
187
+
188
+ return {
189
+ 'score': score,
190
+ 'level': level,
191
+ 'avg_sentence_length': round(avg_sentence_length, 1)
192
+ }
193
+
194
+ def _extract_lsi_keywords(self, content: str, primary_keyword: str) -> List[str]:
195
+ """Extract potential LSI (semantically related) keywords"""
196
+ words = re.findall(r'\b[a-z]+\b', content.lower())
197
+ word_freq = {}
198
+
199
+ # Count word frequencies
200
+ for word in words:
201
+ if word not in self.stop_words and len(word) > 3:
202
+ word_freq[word] = word_freq.get(word, 0) + 1
203
+
204
+ # Sort by frequency and return top related terms
205
+ sorted_words = sorted(word_freq.items(), key=lambda x: x[1], reverse=True)
206
+
207
+ # Filter out the primary keyword and return top 10
208
+ lsi_keywords = []
209
+ for word, count in sorted_words:
210
+ if word != primary_keyword.lower() and count > 1:
211
+ lsi_keywords.append(word)
212
+ if len(lsi_keywords) >= 10:
213
+ break
214
+
215
+ return lsi_keywords
216
+
217
+ def _generate_meta_suggestions(self, content: str, keyword: str = None) -> Dict:
218
+ """Generate SEO meta tag suggestions"""
219
+ # Extract first sentence for description base
220
+ sentences = re.split(r'[.!?]+', content)
221
+ first_sentence = sentences[0] if sentences else content[:160]
222
+
223
+ suggestions = {
224
+ 'title': '',
225
+ 'meta_description': '',
226
+ 'url_slug': '',
227
+ 'og_title': '',
228
+ 'og_description': ''
229
+ }
230
+
231
+ if keyword:
232
+ # Title suggestion
233
+ suggestions['title'] = f"{keyword.title()} - Complete Guide"
234
+ if len(suggestions['title']) > 60:
235
+ suggestions['title'] = keyword.title()[:57] + "..."
236
+
237
+ # Meta description
238
+ desc_base = f"Learn everything about {keyword}. {first_sentence}"
239
+ if len(desc_base) > 160:
240
+ desc_base = desc_base[:157] + "..."
241
+ suggestions['meta_description'] = desc_base
242
+
243
+ # URL slug
244
+ suggestions['url_slug'] = re.sub(r'[^a-z0-9-]+', '-',
245
+ keyword.lower()).strip('-')
246
+
247
+ # Open Graph tags
248
+ suggestions['og_title'] = suggestions['title']
249
+ suggestions['og_description'] = suggestions['meta_description']
250
+
251
+ return suggestions
252
+
253
+ def _calculate_seo_score(self, analysis: Dict) -> int:
254
+ """Calculate overall SEO optimization score"""
255
+ score = 0
256
+ max_score = 100
257
+
258
+ # Content length scoring (20 points)
259
+ if 300 <= analysis['content_length'] <= 2500:
260
+ score += 20
261
+ elif 200 <= analysis['content_length'] < 300:
262
+ score += 10
263
+ elif analysis['content_length'] > 2500:
264
+ score += 15
265
+
266
+ # Keyword optimization (30 points)
267
+ if analysis['keyword_analysis']:
268
+ kw_data = analysis['keyword_analysis']['primary_keyword']
269
+
270
+ # Density scoring
271
+ if 0.01 <= kw_data['density'] <= 0.03:
272
+ score += 15
273
+ elif 0.005 <= kw_data['density'] < 0.01:
274
+ score += 8
275
+
276
+ # Placement scoring
277
+ if kw_data['in_first_paragraph']:
278
+ score += 10
279
+ if kw_data.get('in_headings'):
280
+ score += 5
281
+
282
+ # Structure scoring (25 points)
283
+ struct = analysis['structure_analysis']
284
+ if struct['headings']['total'] > 0:
285
+ score += 10
286
+ if struct['paragraphs'] >= 3:
287
+ score += 10
288
+ if struct['links']['internal'] > 0 or struct['links']['external'] > 0:
289
+ score += 5
290
+
291
+ # Readability scoring (25 points)
292
+ readability_score = analysis['readability']['score']
293
+ score += int(readability_score * 0.25)
294
+
295
+ return min(score, max_score)
296
+
297
+ def _generate_recommendations(self, analysis: Dict) -> List[str]:
298
+ """Generate SEO improvement recommendations"""
299
+ recommendations = []
300
+
301
+ # Content length recommendations
302
+ if analysis['content_length'] < 300:
303
+ recommendations.append(
304
+ f"Increase content length to at least 300 words (currently {analysis['content_length']})"
305
+ )
306
+ elif analysis['content_length'] > 3000:
307
+ recommendations.append(
308
+ "Consider breaking long content into multiple pages or adding a table of contents"
309
+ )
310
+
311
+ # Keyword recommendations
312
+ if analysis['keyword_analysis']:
313
+ kw_data = analysis['keyword_analysis']['primary_keyword']
314
+
315
+ if kw_data['density'] < 0.01:
316
+ recommendations.append(
317
+ f"Increase keyword density for '{kw_data['keyword']}' (currently {kw_data['density']:.2%})"
318
+ )
319
+ elif kw_data['density'] > 0.03:
320
+ recommendations.append(
321
+ f"Reduce keyword density to avoid over-optimization (currently {kw_data['density']:.2%})"
322
+ )
323
+
324
+ if not kw_data['in_first_paragraph']:
325
+ recommendations.append(
326
+ "Include primary keyword in the first paragraph"
327
+ )
328
+
329
+ # Structure recommendations
330
+ struct = analysis['structure_analysis']
331
+ if struct['headings']['total'] == 0:
332
+ recommendations.append("Add headings (H1, H2, H3) to improve content structure")
333
+ if struct['links']['internal'] == 0:
334
+ recommendations.append("Add internal links to related content")
335
+ if struct['avg_paragraph_length'] > 150:
336
+ recommendations.append("Break up long paragraphs for better readability")
337
+
338
+ # Readability recommendations
339
+ if analysis['readability']['avg_sentence_length'] > 20:
340
+ recommendations.append("Simplify sentences for better readability")
341
+
342
+ return recommendations
343
+
344
+ def optimize_content(content: str, keyword: str = None,
345
+ secondary_keywords: List[str] = None) -> str:
346
+ """Main function to optimize content"""
347
+ optimizer = SEOOptimizer()
348
+
349
+ # Parse secondary keywords from comma-separated string if provided
350
+ if secondary_keywords and isinstance(secondary_keywords, str):
351
+ secondary_keywords = [kw.strip() for kw in secondary_keywords.split(',')]
352
+
353
+ results = optimizer.analyze(content, keyword, secondary_keywords)
354
+
355
+ # Format output
356
+ output = [
357
+ "=== SEO Content Analysis ===",
358
+ f"Overall SEO Score: {results['optimization_score']}/100",
359
+ f"Content Length: {results['content_length']} words",
360
+ f"",
361
+ "Content Structure:",
362
+ f" Headings: {results['structure_analysis']['headings']['total']}",
363
+ f" Paragraphs: {results['structure_analysis']['paragraphs']}",
364
+ f" Avg Paragraph Length: {results['structure_analysis']['avg_paragraph_length']} words",
365
+ f" Internal Links: {results['structure_analysis']['links']['internal']}",
366
+ f" External Links: {results['structure_analysis']['links']['external']}",
367
+ f"",
368
+ f"Readability: {results['readability']['level']} (Score: {results['readability']['score']})",
369
+ f""
370
+ ]
371
+
372
+ if results['keyword_analysis']:
373
+ kw = results['keyword_analysis']['primary_keyword']
374
+ output.extend([
375
+ "Keyword Analysis:",
376
+ f" Primary Keyword: {kw['keyword']}",
377
+ f" Count: {kw['count']}",
378
+ f" Density: {kw['density']:.2%}",
379
+ f" In First Paragraph: {'Yes' if kw['in_first_paragraph'] else 'No'}",
380
+ f""
381
+ ])
382
+
383
+ if results['keyword_analysis']['lsi_keywords']:
384
+ output.append(" Related Keywords Found:")
385
+ for lsi in results['keyword_analysis']['lsi_keywords'][:5]:
386
+ output.append(f" • {lsi}")
387
+ output.append("")
388
+
389
+ if results['meta_suggestions']:
390
+ output.extend([
391
+ "Meta Tag Suggestions:",
392
+ f" Title: {results['meta_suggestions']['title']}",
393
+ f" Description: {results['meta_suggestions']['meta_description']}",
394
+ f" URL Slug: {results['meta_suggestions']['url_slug']}",
395
+ f""
396
+ ])
397
+
398
+ output.extend([
399
+ "Recommendations:",
400
+ ])
401
+
402
+ for rec in results['recommendations']:
403
+ output.append(f" • {rec}")
404
+
405
+ return '\n'.join(output)
406
+
407
+ if __name__ == "__main__":
408
+ import sys
409
+
410
+ if len(sys.argv) > 1:
411
+ with open(sys.argv[1], 'r') as f:
412
+ content = f.read()
413
+
414
+ keyword = sys.argv[2] if len(sys.argv) > 2 else None
415
+ secondary = sys.argv[3] if len(sys.argv) > 3 else None
416
+
417
+ print(optimize_content(content, keyword, secondary))
418
+ else:
419
+ print("Usage: python seo_optimizer.py <file> [primary_keyword] [secondary_keywords]")
@@ -0,0 +1,227 @@
1
+ """
2
+ Gerencia o ACTIVE_CONTEXT.md — arquivo que é sincronizado com MEMORY.md.
3
+ Limite rígido de ~150 linhas para caber no system prompt.
4
+ """
5
+
6
+ import shutil
7
+ from datetime import datetime
8
+ from pathlib import Path
9
+
10
+ from config import (
11
+ ACTIVE_CONTEXT_PATH,
12
+ MEMORY_DIR,
13
+ MEMORY_MD_PATH,
14
+ MAX_ACTIVE_CONTEXT_LINES,
15
+ )
16
+ from models import ActiveContext, SessionSummary, ProjectInfo, PendingTask
17
+
18
+
19
+ def load_active_context() -> ActiveContext:
20
+ """Carrega o contexto ativo do arquivo markdown."""
21
+ if not ACTIVE_CONTEXT_PATH.exists():
22
+ return ActiveContext()
23
+
24
+ text = ACTIVE_CONTEXT_PATH.read_text(encoding="utf-8")
25
+ ctx = ActiveContext()
26
+
27
+ # Parse simples por seções
28
+ current_section = ""
29
+ for line in text.splitlines():
30
+ if line.startswith("# Contexto Ativo"):
31
+ continue
32
+ if line.startswith("## "):
33
+ current_section = line[3:].strip().lower()
34
+ continue
35
+
36
+ stripped = line.strip()
37
+ if not stripped or stripped.startswith("|---"):
38
+ continue
39
+
40
+ if current_section == "tarefas pendentes":
41
+ if stripped.startswith("- [ ]"):
42
+ task_text = stripped[5:].strip()
43
+ priority = "medium"
44
+ if "(alta)" in task_text.lower() or "(high)" in task_text.lower():
45
+ priority = "high"
46
+ elif "(baixa)" in task_text.lower() or "(low)" in task_text.lower():
47
+ priority = "low"
48
+ ctx.pending_tasks.append(PendingTask(
49
+ description=task_text,
50
+ priority=priority,
51
+ ))
52
+ elif current_section == "decisões recentes":
53
+ if stripped.startswith("- "):
54
+ ctx.recent_decisions.append(stripped[2:])
55
+ elif current_section == "bloqueadores ativos":
56
+ if stripped.startswith("- ") and stripped != "- Nenhum":
57
+ ctx.active_blockers.append(stripped[2:])
58
+ elif current_section == "convenções estabelecidas":
59
+ if stripped.startswith("- "):
60
+ ctx.conventions.append(stripped[2:])
61
+ elif current_section.startswith("últimas sessões"):
62
+ if stripped.startswith("- "):
63
+ ctx.recent_sessions.append(stripped[2:])
64
+
65
+ return ctx
66
+
67
+
68
+ def update_active_context(ctx: ActiveContext, summary: SessionSummary) -> ActiveContext:
69
+ """Merge uma nova sessão no contexto ativo."""
70
+ ctx.last_updated = datetime.now().strftime("%Y-%m-%d %H:%M")
71
+ ctx.total_sessions = summary.session_number
72
+
73
+ # Adicionar decisões novas (prefixar com número da sessão)
74
+ for d in summary.decisions:
75
+ entry = f"[session-{summary.session_number:03d}] {d}"
76
+ if entry not in ctx.recent_decisions:
77
+ ctx.recent_decisions.append(entry)
78
+
79
+ # Manter apenas as 15 decisões mais recentes
80
+ ctx.recent_decisions = ctx.recent_decisions[-15:]
81
+
82
+ # Atualizar tarefas: marcar completadas, adicionar novas
83
+ completed_descriptions = {t.lower().strip() for t in summary.tasks_completed}
84
+ ctx.pending_tasks = [
85
+ t for t in ctx.pending_tasks
86
+ if t.description.lower().strip() not in completed_descriptions
87
+ ]
88
+
89
+ for pt in summary.tasks_pending:
90
+ if isinstance(pt, PendingTask):
91
+ if not any(t.description == pt.description for t in ctx.pending_tasks):
92
+ ctx.pending_tasks.append(pt)
93
+ elif isinstance(pt, str):
94
+ if not any(t.description == pt for t in ctx.pending_tasks):
95
+ ctx.pending_tasks.append(PendingTask(
96
+ description=pt,
97
+ source_session=summary.session_number,
98
+ created_date=summary.date,
99
+ ))
100
+
101
+ # Atualizar sessões recentes
102
+ session_entry = f"session-{summary.session_number:03d}: {', '.join(summary.topics[:3])}"
103
+ ctx.recent_sessions.append(session_entry)
104
+ ctx.recent_sessions = ctx.recent_sessions[-5:]
105
+
106
+ # Adicionar bloqueadores se houver
107
+ for q in summary.open_questions:
108
+ if q not in ctx.active_blockers:
109
+ ctx.active_blockers.append(q)
110
+
111
+ return ctx
112
+
113
+
114
+ def save_active_context(ctx: ActiveContext, projects: list[ProjectInfo] = None):
115
+ """Salva ACTIVE_CONTEXT.md respeitando limite de linhas."""
116
+ ACTIVE_CONTEXT_PATH.parent.mkdir(parents=True, exist_ok=True)
117
+ now = datetime.now().strftime("%Y-%m-%d %H:%M")
118
+
119
+ lines = [
120
+ f"# Contexto Ativo — Atualizado em {now}",
121
+ "",
122
+ ]
123
+
124
+ # Projetos ativos
125
+ if projects:
126
+ lines.append("## Projetos Ativos")
127
+ lines.append("| Projeto | Status | Última Sessão | Próxima Ação |")
128
+ lines.append("|---------|--------|---------------|--------------|")
129
+ for p in projects:
130
+ session_ref = f"session-{p.last_session:03d}" if p.last_session else "—"
131
+ action = p.next_actions[0] if p.next_actions else "—"
132
+ lines.append(f"| {p.name} | {p.status} | {session_ref} | {action} |")
133
+ lines.append("")
134
+
135
+ # Tarefas pendentes
136
+ if ctx.pending_tasks:
137
+ lines.append("## Tarefas Pendentes")
138
+ high = [t for t in ctx.pending_tasks if t.priority == "high"]
139
+ medium = [t for t in ctx.pending_tasks if t.priority == "medium"]
140
+ low = [t for t in ctx.pending_tasks if t.priority == "low"]
141
+
142
+ if high:
143
+ lines.append("### Alta Prioridade")
144
+ for t in high:
145
+ src = f" (desde session-{t.source_session:03d})" if t.source_session else ""
146
+ lines.append(f"- [ ] {t.description}{src}")
147
+ if medium:
148
+ lines.append("### Média Prioridade")
149
+ for t in medium:
150
+ src = f" (desde session-{t.source_session:03d})" if t.source_session else ""
151
+ lines.append(f"- [ ] {t.description}{src}")
152
+ if low:
153
+ lines.append("### Baixa Prioridade")
154
+ for t in low[:5]: # Limitar para economizar espaço
155
+ lines.append(f"- [ ] {t.description}")
156
+ lines.append("")
157
+
158
+ # Decisões recentes
159
+ if ctx.recent_decisions:
160
+ lines.append("## Decisões Recentes")
161
+ for d in ctx.recent_decisions[-10:]:
162
+ lines.append(f"- {d}")
163
+ lines.append("")
164
+
165
+ # Bloqueadores
166
+ lines.append("## Bloqueadores Ativos")
167
+ if ctx.active_blockers:
168
+ for b in ctx.active_blockers[:5]:
169
+ lines.append(f"- {b}")
170
+ else:
171
+ lines.append("- Nenhum")
172
+ lines.append("")
173
+
174
+ # Convenções
175
+ if ctx.conventions:
176
+ lines.append("## Convenções Estabelecidas")
177
+ for c in ctx.conventions:
178
+ lines.append(f"- {c}")
179
+ lines.append("")
180
+
181
+ # Últimas sessões
182
+ if ctx.recent_sessions:
183
+ lines.append("## Últimas Sessões")
184
+ for s in ctx.recent_sessions:
185
+ lines.append(f"- {s}")
186
+ lines.append("")
187
+
188
+ # Garantir limite de linhas
189
+ if len(lines) > MAX_ACTIVE_CONTEXT_LINES:
190
+ lines = lines[:MAX_ACTIVE_CONTEXT_LINES - 1]
191
+ lines.append("*[Contexto truncado — execute `python context_manager.py maintain` para otimizar]*")
192
+
193
+ ACTIVE_CONTEXT_PATH.write_text("\n".join(lines), encoding="utf-8")
194
+
195
+
196
+ def sync_to_memory():
197
+ """Copia ACTIVE_CONTEXT.md para MEMORY.md no diretório de auto-memory do Claude."""
198
+ if not ACTIVE_CONTEXT_PATH.exists():
199
+ return
200
+
201
+ MEMORY_DIR.mkdir(parents=True, exist_ok=True)
202
+
203
+ # Ler conteúdo e adaptar para MEMORY.md
204
+ content = ACTIVE_CONTEXT_PATH.read_text(encoding="utf-8")
205
+
206
+ # Adicionar cabeçalho de referência para o agente
207
+ header = (
208
+ "<!-- Auto-generated by context-agent. Para detalhes: "
209
+ "python C:\\Users\\renat\\skills\\context-agent\\scripts\\context_manager.py load -->\n\n"
210
+ )
211
+
212
+ MEMORY_MD_PATH.write_text(header + content, encoding="utf-8")
213
+
214
+
215
+ def check_drift() -> bool:
216
+ """Verifica se ACTIVE_CONTEXT.md e MEMORY.md estão sincronizados."""
217
+ if not ACTIVE_CONTEXT_PATH.exists() or not MEMORY_MD_PATH.exists():
218
+ return True # Drift se algum não existe
219
+
220
+ active = ACTIVE_CONTEXT_PATH.read_text(encoding="utf-8").strip()
221
+ memory = MEMORY_MD_PATH.read_text(encoding="utf-8").strip()
222
+
223
+ # MEMORY.md tem header extra, então compara sem ele
224
+ if "<!-- Auto-generated" in memory:
225
+ memory = memory.split("-->", 1)[-1].strip()
226
+
227
+ return active != memory