@zaip-ai/cli 0.1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (795) hide show
  1. package/README.md +17 -9
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +5 -0
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/index.d.ts +2 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +57 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/services/adapters.d.ts +17 -0
  10. package/dist/services/adapters.d.ts.map +1 -0
  11. package/dist/services/adapters.js +790 -0
  12. package/dist/services/adapters.js.map +1 -0
  13. package/dist/services/adapters.test.d.ts +2 -0
  14. package/dist/services/adapters.test.d.ts.map +1 -0
  15. package/dist/services/adapters.test.js +25 -0
  16. package/dist/services/adapters.test.js.map +1 -0
  17. package/dist/services/agent-adapters.d.ts +41 -0
  18. package/dist/services/agent-adapters.d.ts.map +1 -0
  19. package/dist/services/agent-adapters.js +122 -0
  20. package/dist/services/agent-adapters.js.map +1 -0
  21. package/dist/services/agent-adapters.test.d.ts +2 -0
  22. package/dist/services/agent-adapters.test.d.ts.map +1 -0
  23. package/dist/services/agent-adapters.test.js +40 -0
  24. package/dist/services/agent-adapters.test.js.map +1 -0
  25. package/dist/services/codex-rules.d.ts +3 -0
  26. package/dist/services/codex-rules.d.ts.map +1 -0
  27. package/dist/services/codex-rules.js +114 -0
  28. package/dist/services/codex-rules.js.map +1 -0
  29. package/dist/services/doctor.d.ts +12 -0
  30. package/dist/services/doctor.d.ts.map +1 -0
  31. package/dist/services/doctor.js +207 -0
  32. package/dist/services/doctor.js.map +1 -0
  33. package/dist/services/global-codex-config.d.ts +15 -0
  34. package/dist/services/global-codex-config.d.ts.map +1 -0
  35. package/dist/services/global-codex-config.js +48 -0
  36. package/dist/services/global-codex-config.js.map +1 -0
  37. package/dist/services/global-codex-config.test.d.ts +2 -0
  38. package/dist/services/global-codex-config.test.d.ts.map +1 -0
  39. package/dist/services/global-codex-config.test.js +102 -0
  40. package/dist/services/global-codex-config.test.js.map +1 -0
  41. package/dist/services/install-agents-template.d.ts.map +1 -1
  42. package/dist/services/install-agents-template.js +174 -79
  43. package/dist/services/install-agents-template.js.map +1 -1
  44. package/dist/services/logger.d.ts.map +1 -1
  45. package/dist/services/logger.js +13 -3
  46. package/dist/services/logger.js.map +1 -1
  47. package/dist/services/logger.test.d.ts +2 -0
  48. package/dist/services/logger.test.d.ts.map +1 -0
  49. package/dist/services/logger.test.js +32 -0
  50. package/dist/services/logger.test.js.map +1 -0
  51. package/dist/services/runtime-template.test.d.ts +2 -0
  52. package/dist/services/runtime-template.test.d.ts.map +1 -0
  53. package/dist/services/runtime-template.test.js +199 -0
  54. package/dist/services/runtime-template.test.js.map +1 -0
  55. package/dist/services/template-manifest.d.ts +6 -2
  56. package/dist/services/template-manifest.d.ts.map +1 -1
  57. package/dist/services/template-manifest.js +93 -10
  58. package/dist/services/template-manifest.js.map +1 -1
  59. package/dist/services/transactional-files.d.ts +11 -0
  60. package/dist/services/transactional-files.d.ts.map +1 -0
  61. package/dist/services/transactional-files.js +114 -0
  62. package/dist/services/transactional-files.js.map +1 -0
  63. package/dist/types.d.ts +13 -0
  64. package/dist/types.d.ts.map +1 -1
  65. package/dist/version.d.ts +2 -0
  66. package/dist/version.d.ts.map +1 -0
  67. package/dist/version.js +6 -0
  68. package/dist/version.js.map +1 -0
  69. package/package.json +4 -2
  70. package/templates/.agents/config/agents/catalog.yaml +246 -0
  71. package/templates/.agents/config/framework.lock.yaml +1 -1
  72. package/templates/.agents/config/project.yaml +8 -0
  73. package/templates/.agents/config/src/icon_zaip.png +0 -0
  74. package/templates/.agents/dashboard/.zaip-managed.json +46 -0
  75. package/templates/.agents/dashboard/README.md +91 -0
  76. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-BOLwg8VW.js +1009 -0
  77. package/templates/.agents/dashboard/apps/frontend/dist/assets/index-_yxs47Hd.css +1 -0
  78. package/templates/.agents/dashboard/apps/frontend/dist/assets/logo_novo_azul-BBx5pA2B.png +0 -0
  79. package/templates/.agents/dashboard/apps/frontend/dist/icon_zaip.png +0 -0
  80. package/templates/.agents/dashboard/apps/frontend/dist/index.html +15 -0
  81. package/templates/.agents/dashboard/apps/frontend/dist/logo_novo_azul.png +0 -0
  82. package/templates/.agents/dashboard/packages/local-runtime/server.mjs +179 -0
  83. package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +726 -0
  84. package/templates/.agents/dashboard/zaip-dashboard.exe +0 -0
  85. package/templates/.agents/design/DESIGN.md +180 -0
  86. package/templates/.agents/design/README.md +47 -0
  87. package/templates/.agents/design/apps/catalog/.storybook/main.ts +15 -0
  88. package/templates/.agents/design/apps/catalog/.storybook/preview.ts +21 -0
  89. package/templates/.agents/design/apps/catalog/dist/assets/index-B4pfFtvJ.css +1 -0
  90. package/templates/.agents/design/apps/catalog/dist/assets/index-Bvwc3Bgw.js +9 -0
  91. package/templates/.agents/design/apps/catalog/dist/index.html +14 -0
  92. package/templates/.agents/design/apps/catalog/dist/logo_novo_azul.png +0 -0
  93. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Color-6AOWCN3U-D8qyAXo4.js +1 -0
  94. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Components.stories-DkBtOSHX.js +1 -0
  95. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-BttERyCr.js +1 -0
  96. package/templates/.agents/design/apps/catalog/dist/storybook/assets/DocsRenderer-JROSPFPF-LmiVo77Q.js +46 -0
  97. package/templates/.agents/design/apps/catalog/dist/storybook/assets/Primitives-HZpQ6PjX.js +1 -0
  98. package/templates/.agents/design/apps/catalog/dist/storybook/assets/WithTooltip-7X4HQR7L-CTMWAwDe.js +9 -0
  99. package/templates/.agents/design/apps/catalog/dist/storybook/assets/axe-Bk3eEgJf.js +20 -0
  100. package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-242VQQM5-DB2JSNUA.js +1 -0
  101. package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-DRQKCCAG-DUhJxxRU.js +1 -0
  102. package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-QQBDHPVZ-nYh9QWsm.js +1 -0
  103. package/templates/.agents/design/apps/catalog/dist/storybook/assets/chunk-W22LQPXL-9RCn9-l7.js +18 -0
  104. package/templates/.agents/design/apps/catalog/dist/storybook/assets/components-BX1OfYUi.js +243 -0
  105. package/templates/.agents/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-Bu6KfEwW.js +1 -0
  106. package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-B4pfFtvJ.css +1 -0
  107. package/templates/.agents/design/apps/catalog/dist/storybook/assets/iframe-LMhZM1ce.js +1154 -0
  108. package/templates/.agents/design/apps/catalog/dist/storybook/assets/jsx-runtime-f3rHp9ZU.js +1 -0
  109. package/templates/.agents/design/apps/catalog/dist/storybook/assets/matchers-JIUQ3HVY-9iRExWZO.js +28 -0
  110. package/templates/.agents/design/apps/catalog/dist/storybook/assets/preload-helper-BdFrVu1K.js +1 -0
  111. package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-18-jAz3avmR.js +9 -0
  112. package/templates/.agents/design/apps/catalog/dist/storybook/assets/react-DvDPBd6Q.js +1 -0
  113. package/templates/.agents/design/apps/catalog/dist/storybook/assets/syntaxhighlighter-YFXUGROL-DV8X2acD.js +6 -0
  114. package/templates/.agents/design/apps/catalog/dist/storybook/assets/theming-CHbHkcNi.js +39 -0
  115. package/templates/.agents/design/apps/catalog/dist/storybook/favicon-wrapper.svg +46 -0
  116. package/templates/.agents/design/apps/catalog/dist/storybook/favicon.svg +1 -0
  117. package/templates/.agents/design/apps/catalog/dist/storybook/iframe.html +710 -0
  118. package/templates/.agents/design/apps/catalog/dist/storybook/index.html +152 -0
  119. package/templates/.agents/design/apps/catalog/dist/storybook/index.json +1 -0
  120. package/templates/.agents/design/apps/catalog/dist/storybook/logo_novo_azul.png +0 -0
  121. package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-bold-italic.woff2 +0 -0
  122. package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-bold.woff2 +0 -0
  123. package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-italic.woff2 +0 -0
  124. package/templates/.agents/design/apps/catalog/dist/storybook/nunito-sans-regular.woff2 +0 -0
  125. package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/a11y-2/manager-bundle.js +57 -0
  126. package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/docs-1/manager-bundle.js +18 -0
  127. package/templates/.agents/design/apps/catalog/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +632 -0
  128. package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/favicon-wrapper.svg +46 -0
  129. package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/favicon.svg +1 -0
  130. package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  131. package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  132. package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  133. package/templates/.agents/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  134. package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/globals-runtime.js +78957 -0
  135. package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/globals.js +24 -0
  136. package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/manager-stores.js +23 -0
  137. package/templates/.agents/design/apps/catalog/dist/storybook/sb-manager/runtime.js +28253 -0
  138. package/templates/.agents/design/apps/catalog/dist/storybook/vite-inject-mocker-entry.js +2 -0
  139. package/templates/.agents/design/apps/catalog/index.html +13 -0
  140. package/templates/.agents/design/apps/catalog/package.json +32 -0
  141. package/templates/.agents/design/apps/catalog/public/logo_novo_azul.png +0 -0
  142. package/templates/.agents/design/apps/catalog/src/App.tsx +29 -0
  143. package/templates/.agents/design/apps/catalog/src/components/CatalogShell.tsx +78 -0
  144. package/templates/.agents/design/apps/catalog/src/components/Primitives.tsx +137 -0
  145. package/templates/.agents/design/apps/catalog/src/design-contract.test.ts +33 -0
  146. package/templates/.agents/design/apps/catalog/src/main.tsx +13 -0
  147. package/templates/.agents/design/apps/catalog/src/pages/ComponentsPage.tsx +83 -0
  148. package/templates/.agents/design/apps/catalog/src/pages/DesignSystemPage.tsx +185 -0
  149. package/templates/.agents/design/apps/catalog/src/stories/Components.stories.tsx +12 -0
  150. package/templates/.agents/design/apps/catalog/src/stories/DesignSystem.stories.tsx +12 -0
  151. package/templates/.agents/design/apps/catalog/src/styles/catalog.css +315 -0
  152. package/templates/.agents/design/apps/catalog/src/styles/components.css +228 -0
  153. package/templates/.agents/design/apps/catalog/src/styles/design-system.css +137 -0
  154. package/templates/.agents/design/apps/catalog/src/styles.css +85 -0
  155. package/templates/.agents/design/apps/catalog/tsconfig.json +16 -0
  156. package/templates/.agents/design/apps/catalog/vite.config.ts +10 -0
  157. package/templates/.agents/design/apps/catalog/vitest.config.ts +5 -0
  158. package/templates/.agents/design/packages/local-runtime/package.json +9 -0
  159. package/templates/.agents/design/packages/local-runtime/runtime.mjs +238 -0
  160. package/templates/.agents/design/packages/local-runtime/runtime.test.mjs +66 -0
  161. package/templates/.agents/design/packages/local-runtime/start-design.mjs +46 -0
  162. package/templates/.agents/design/packages/windows-launcher/Program.cs +110 -0
  163. package/templates/.agents/design/packages/windows-launcher/build-design-launcher.ps1 +107 -0
  164. package/templates/.agents/design/tokens.json +52 -0
  165. package/templates/.agents/design/zaip-design.exe +0 -0
  166. package/templates/.agents/requirements/autonomous-assurance.md +63 -0
  167. package/templates/.agents/requirements/context-engine.md +27 -3
  168. package/templates/.agents/requirements/cost-observability.md +22 -3
  169. package/templates/.agents/requirements/design-system.md +48 -0
  170. package/templates/.agents/requirements/execution-engine.md +33 -8
  171. package/templates/.agents/requirements/kanban-dashboard.md +13 -4
  172. package/templates/.agents/requirements/model-orchestration.md +58 -0
  173. package/templates/.agents/requirements/public-distribution.md +40 -0
  174. package/templates/.agents/requirements/software-architecture.md +57 -0
  175. package/templates/.agents/requirements/work-lifecycle.md +61 -6
  176. package/templates/.agents/rules/project/.gitkeep +0 -0
  177. package/templates/.agents/rules/zaip/architecture.md +28 -0
  178. package/templates/.agents/rules/zaip/context.md +22 -0
  179. package/templates/.agents/rules/zaip/core.md +24 -0
  180. package/templates/.agents/rules/zaip/evolution.md +22 -0
  181. package/templates/.agents/rules/zaip/model-orchestration.md +48 -0
  182. package/templates/.agents/rules/zaip/workflow.md +35 -0
  183. package/templates/.agents/skills/zaip-skill-adapt-stack/SKILL.md +1 -1
  184. package/templates/.agents/skills/zaip-skill-adapt-stack/agents/openai.yaml +3 -3
  185. package/templates/.agents/skills/zaip-skill-adapters/SKILL.md +9 -6
  186. package/templates/.agents/skills/zaip-skill-adapters/agents/openai.yaml +2 -2
  187. package/templates/.agents/skills/zaip-skill-api-to-mcp/SKILL.md +19 -0
  188. package/templates/.agents/skills/zaip-skill-api-to-mcp/agents/openai.yaml +4 -0
  189. package/templates/.agents/skills/zaip-skill-api-to-mcp/assets/adapter.example.yaml +26 -0
  190. package/templates/.agents/skills/zaip-skill-api-to-mcp/references/security-contract.md +10 -0
  191. package/templates/.agents/skills/zaip-skill-api-to-mcp/references/server-layout.md +19 -0
  192. package/templates/.agents/skills/zaip-skill-api-to-mcp/scripts/inspect-openapi.mjs +60 -0
  193. package/templates/.agents/skills/zaip-skill-api-to-mcp/scripts/scaffold-local-mcp.mjs +47 -0
  194. package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +21 -0
  195. package/templates/.agents/skills/zaip-skill-author-skills/agents/openai.yaml +4 -0
  196. package/templates/.agents/skills/zaip-skill-change/SKILL.md +20 -0
  197. package/templates/.agents/skills/zaip-skill-change/agents/openai.yaml +4 -0
  198. package/templates/.agents/skills/zaip-skill-config/SKILL.md +22 -0
  199. package/templates/.agents/skills/zaip-skill-config/agents/openai.yaml +4 -0
  200. package/templates/.agents/skills/zaip-skill-context/SKILL.md +10 -6
  201. package/templates/.agents/skills/zaip-skill-context/agents/openai.yaml +2 -2
  202. package/templates/.agents/skills/zaip-skill-cqrs/SKILL.md +2 -2
  203. package/templates/.agents/skills/zaip-skill-cqrs/agents/openai.yaml +3 -3
  204. package/templates/.agents/skills/zaip-skill-decisions/SKILL.md +7 -5
  205. package/templates/.agents/skills/zaip-skill-decisions/agents/openai.yaml +2 -2
  206. package/templates/.agents/skills/zaip-skill-enforce-architecture/SKILL.md +8 -5
  207. package/templates/.agents/skills/zaip-skill-enforce-architecture/agents/openai.yaml +3 -3
  208. package/templates/.agents/skills/zaip-skill-eval/SKILL.md +7 -5
  209. package/templates/.agents/skills/zaip-skill-eval/agents/openai.yaml +3 -3
  210. package/templates/.agents/skills/zaip-skill-execution/SKILL.md +36 -0
  211. package/templates/.agents/skills/zaip-skill-execution/agents/openai.yaml +6 -0
  212. package/templates/.agents/skills/zaip-skill-execution/references/prepared-plan.md +31 -0
  213. package/templates/.agents/skills/zaip-skill-frontend-launcher/SKILL.md +29 -0
  214. package/templates/.agents/skills/zaip-skill-frontend-launcher/agents/openai.yaml +4 -0
  215. package/templates/.agents/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +36 -0
  216. package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +49 -58
  217. package/templates/.agents/skills/zaip-skill-github-deploy/agents/openai.yaml +3 -3
  218. package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +256 -0
  219. package/templates/.agents/skills/zaip-skill-github-setup/SKILL.md +1 -1
  220. package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +37 -0
  221. package/templates/.agents/skills/zaip-skill-move-prd/agents/openai.yaml +4 -0
  222. package/templates/.agents/skills/zaip-skill-move-spec/SKILL.md +38 -0
  223. package/templates/.agents/skills/zaip-skill-move-spec/agents/openai.yaml +4 -0
  224. package/templates/.agents/skills/zaip-skill-navigate-work/SKILL.md +9 -6
  225. package/templates/.agents/skills/zaip-skill-navigate-work/agents/openai.yaml +3 -3
  226. package/templates/.agents/skills/zaip-skill-observability/SKILL.md +24 -0
  227. package/templates/.agents/skills/zaip-skill-observability/agents/openai.yaml +4 -0
  228. package/templates/.agents/skills/zaip-skill-openai-docs/SKILL.md +17 -0
  229. package/templates/.agents/skills/zaip-skill-openai-docs/agents/openai.yaml +4 -0
  230. package/templates/.agents/skills/zaip-skill-openai-docs/references/routing.md +11 -0
  231. package/templates/.agents/skills/zaip-skill-prd/SKILL.md +37 -6
  232. package/templates/.agents/skills/zaip-skill-prd/agents/openai.yaml +2 -2
  233. package/templates/.agents/skills/zaip-skill-preview/SKILL.md +16 -0
  234. package/templates/.agents/skills/zaip-skill-preview/agents/openai.yaml +4 -0
  235. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/SKILL.md +39 -0
  236. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/agents/openai.yaml +4 -0
  237. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/inspect-local-sqlite.py +52 -0
  238. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/normalize-run-agents.mjs +63 -0
  239. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +698 -0
  240. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +361 -0
  241. package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +187 -0
  242. package/templates/.agents/skills/zaip-skill-requirements/SKILL.md +10 -6
  243. package/templates/.agents/skills/zaip-skill-requirements/agents/openai.yaml +2 -2
  244. package/templates/.agents/skills/zaip-skill-review/SKILL.md +18 -0
  245. package/templates/.agents/skills/zaip-skill-review/agents/openai.yaml +4 -0
  246. package/templates/.agents/skills/zaip-skill-rules/SKILL.md +19 -0
  247. package/templates/.agents/skills/zaip-skill-rules/agents/openai.yaml +4 -0
  248. package/templates/.agents/skills/zaip-skill-security/SKILL.md +30 -0
  249. package/templates/.agents/skills/zaip-skill-security/agents/openai.yaml +4 -0
  250. package/templates/.agents/skills/zaip-skill-setup/SKILL.md +19 -6
  251. package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +2 -2
  252. package/templates/.agents/skills/zaip-skill-spec/SKILL.md +39 -6
  253. package/templates/.agents/skills/zaip-skill-spec/agents/openai.yaml +2 -2
  254. package/templates/.agents/skills/zaip-skill-task/SKILL.md +36 -8
  255. package/templates/.agents/skills/zaip-skill-task/agents/openai.yaml +2 -2
  256. package/templates/.agents/skills/zaip-skill-text-encoding/SKILL.md +3 -3
  257. package/templates/.agents/skills/zaip-skill-tool-setup/SKILL.md +22 -0
  258. package/templates/.agents/skills/zaip-skill-tool-setup/agents/openai.yaml +4 -0
  259. package/templates/.agents/skills/zaip-skill-tool-setup/references/codex-config.md +24 -0
  260. package/templates/.agents/skills/zaip-skill-tool-setup/references/secrets.md +8 -0
  261. package/templates/.agents/skills/zaip-skill-tool-setup/scripts/configure-local-mcp.mjs +52 -0
  262. package/templates/.agents/skills/zaip-skill-tool-setup/scripts/inspect-tool.mjs +35 -0
  263. package/templates/.agents/skills/zaip-skill-tool-setup/scripts/tool-state.mjs +26 -0
  264. package/templates/.agents/tools/README.md +9 -0
  265. package/templates/.agents/tools/api/asaas/README.md +22 -0
  266. package/templates/.agents/tools/api/asaas/manifest.yaml +20 -0
  267. package/templates/.agents/tools/api/github/README.md +22 -0
  268. package/templates/.agents/tools/api/github/manifest.yaml +20 -0
  269. package/templates/.agents/tools/api/google-ads/README.md +23 -0
  270. package/templates/.agents/tools/api/google-ads/manifest.yaml +21 -0
  271. package/templates/.agents/tools/api/google-analytics/README.md +22 -0
  272. package/templates/.agents/tools/api/google-analytics/manifest.yaml +20 -0
  273. package/templates/.agents/tools/api/google-search-console/README.md +21 -0
  274. package/templates/.agents/tools/api/google-search-console/manifest.yaml +19 -0
  275. package/templates/.agents/tools/api/google-tag-manager/README.md +22 -0
  276. package/templates/.agents/tools/api/google-tag-manager/manifest.yaml +20 -0
  277. package/templates/.agents/tools/api/hubspot/README.md +22 -0
  278. package/templates/.agents/tools/api/hubspot/manifest.yaml +20 -0
  279. package/templates/.agents/tools/api/instagram-graph/README.md +23 -0
  280. package/templates/.agents/tools/api/instagram-graph/manifest.yaml +21 -0
  281. package/templates/.agents/tools/api/kommo-crm/README.md +23 -0
  282. package/templates/.agents/tools/api/kommo-crm/manifest.yaml +21 -0
  283. package/templates/.agents/tools/api/linkedin-ads/README.md +23 -0
  284. package/templates/.agents/tools/api/linkedin-ads/manifest.yaml +21 -0
  285. package/templates/.agents/tools/api/meta-ads/README.md +23 -0
  286. package/templates/.agents/tools/api/meta-ads/manifest.yaml +21 -0
  287. package/templates/.agents/tools/api/openai/README.md +22 -0
  288. package/templates/.agents/tools/api/openai/manifest.yaml +20 -0
  289. package/templates/.agents/tools/api/shopify/README.md +23 -0
  290. package/templates/.agents/tools/api/shopify/manifest.yaml +21 -0
  291. package/templates/.agents/tools/api/slack/README.md +22 -0
  292. package/templates/.agents/tools/api/slack/manifest.yaml +20 -0
  293. package/templates/.agents/tools/api/stripe/README.md +22 -0
  294. package/templates/.agents/tools/api/stripe/manifest.yaml +20 -0
  295. package/templates/.agents/tools/api/tiktok-ads/README.md +23 -0
  296. package/templates/.agents/tools/api/tiktok-ads/manifest.yaml +21 -0
  297. package/templates/.agents/tools/api/youtube-analytics/README.md +22 -0
  298. package/templates/.agents/tools/api/youtube-analytics/manifest.yaml +20 -0
  299. package/templates/.agents/tools/catalog.yaml +358 -0
  300. package/templates/.agents/tools/mcp/development/browser/README.md +20 -0
  301. package/templates/.agents/tools/mcp/development/browser/manifest.yaml +24 -0
  302. package/templates/.agents/tools/mcp/development/filesystem/README.md +20 -0
  303. package/templates/.agents/tools/mcp/development/filesystem/manifest.yaml +24 -0
  304. package/templates/.agents/tools/mcp/development/git/README.md +20 -0
  305. package/templates/.agents/tools/mcp/development/git/manifest.yaml +24 -0
  306. package/templates/.agents/tools/mcp/development/github/README.md +20 -0
  307. package/templates/.agents/tools/mcp/development/github/manifest.yaml +25 -0
  308. package/templates/.agents/tools/mcp/development/gitlab/README.md +20 -0
  309. package/templates/.agents/tools/mcp/development/gitlab/manifest.yaml +25 -0
  310. package/templates/.agents/tools/mcp/development/jira/README.md +21 -0
  311. package/templates/.agents/tools/mcp/development/jira/manifest.yaml +26 -0
  312. package/templates/.agents/tools/mcp/development/linear/README.md +20 -0
  313. package/templates/.agents/tools/mcp/development/linear/manifest.yaml +25 -0
  314. package/templates/.agents/tools/mcp/development/notion/README.md +20 -0
  315. package/templates/.agents/tools/mcp/development/notion/manifest.yaml +25 -0
  316. package/templates/.agents/tools/mcp/development/openai-docs/README.md +15 -0
  317. package/templates/.agents/tools/mcp/development/openai-docs/manifest.yaml +21 -0
  318. package/templates/.agents/tools/mcp/development/postgresql/README.md +20 -0
  319. package/templates/.agents/tools/mcp/development/postgresql/manifest.yaml +25 -0
  320. package/templates/.agents/tools/mcp/development/slack/README.md +20 -0
  321. package/templates/.agents/tools/mcp/development/slack/manifest.yaml +25 -0
  322. package/templates/.agents/tools/mcp/development/sqlite/README.md +20 -0
  323. package/templates/.agents/tools/mcp/development/sqlite/manifest.yaml +25 -0
  324. package/templates/.agents/tools/mcp/infra/aws/README.md +21 -0
  325. package/templates/.agents/tools/mcp/infra/aws/manifest.yaml +26 -0
  326. package/templates/.agents/tools/mcp/infra/azure/README.md +20 -0
  327. package/templates/.agents/tools/mcp/infra/azure/manifest.yaml +25 -0
  328. package/templates/.agents/tools/mcp/infra/cloudflare/README.md +21 -0
  329. package/templates/.agents/tools/mcp/infra/cloudflare/manifest.yaml +26 -0
  330. package/templates/.agents/tools/mcp/infra/docker/README.md +20 -0
  331. package/templates/.agents/tools/mcp/infra/docker/manifest.yaml +24 -0
  332. package/templates/.agents/tools/mcp/infra/gcp/README.md +21 -0
  333. package/templates/.agents/tools/mcp/infra/gcp/manifest.yaml +26 -0
  334. package/templates/.agents/tools/mcp/infra/hostinger/README.md +20 -0
  335. package/templates/.agents/tools/mcp/infra/hostinger/manifest.yaml +25 -0
  336. package/templates/.agents/tools/mcp/infra/kubernetes/README.md +20 -0
  337. package/templates/.agents/tools/mcp/infra/kubernetes/manifest.yaml +25 -0
  338. package/templates/.agents/tools/mcp/infra/terraform/README.md +20 -0
  339. package/templates/.agents/tools/mcp/infra/terraform/manifest.yaml +24 -0
  340. package/templates/.agents/tools/mcp/marketing/google-ads/README.md +21 -0
  341. package/templates/.agents/tools/mcp/marketing/google-ads/manifest.yaml +26 -0
  342. package/templates/.agents/tools/mcp/marketing/google-analytics/README.md +20 -0
  343. package/templates/.agents/tools/mcp/marketing/google-analytics/manifest.yaml +25 -0
  344. package/templates/.agents/tools/mcp/marketing/google-search-console/README.md +19 -0
  345. package/templates/.agents/tools/mcp/marketing/google-search-console/manifest.yaml +24 -0
  346. package/templates/.agents/tools/mcp/marketing/google-tag-manager/README.md +21 -0
  347. package/templates/.agents/tools/mcp/marketing/google-tag-manager/manifest.yaml +26 -0
  348. package/templates/.agents/tools/mcp/marketing/hubspot/README.md +20 -0
  349. package/templates/.agents/tools/mcp/marketing/hubspot/manifest.yaml +25 -0
  350. package/templates/.agents/tools/mcp/marketing/instagram-insights/README.md +21 -0
  351. package/templates/.agents/tools/mcp/marketing/instagram-insights/manifest.yaml +26 -0
  352. package/templates/.agents/tools/mcp/marketing/linkedin-ads/README.md +21 -0
  353. package/templates/.agents/tools/mcp/marketing/linkedin-ads/manifest.yaml +26 -0
  354. package/templates/.agents/tools/mcp/marketing/mailchimp/README.md +21 -0
  355. package/templates/.agents/tools/mcp/marketing/mailchimp/manifest.yaml +26 -0
  356. package/templates/.agents/tools/mcp/marketing/meta-ads/README.md +21 -0
  357. package/templates/.agents/tools/mcp/marketing/meta-ads/manifest.yaml +26 -0
  358. package/templates/.agents/tools/mcp/marketing/semrush/README.md +20 -0
  359. package/templates/.agents/tools/mcp/marketing/semrush/manifest.yaml +25 -0
  360. package/templates/.agents/tools/mcp/marketing/tiktok-ads/README.md +21 -0
  361. package/templates/.agents/tools/mcp/marketing/tiktok-ads/manifest.yaml +26 -0
  362. package/templates/.agents/tools/mcp/marketing/youtube-analytics/README.md +21 -0
  363. package/templates/.agents/tools/mcp/marketing/youtube-analytics/manifest.yaml +26 -0
  364. package/templates/.agents/tools/mcp/observability/cloudwatch/README.md +21 -0
  365. package/templates/.agents/tools/mcp/observability/cloudwatch/manifest.yaml +26 -0
  366. package/templates/.agents/tools/mcp/observability/datadog/README.md +21 -0
  367. package/templates/.agents/tools/mcp/observability/datadog/manifest.yaml +26 -0
  368. package/templates/.agents/tools/mcp/observability/elasticsearch/README.md +21 -0
  369. package/templates/.agents/tools/mcp/observability/elasticsearch/manifest.yaml +26 -0
  370. package/templates/.agents/tools/mcp/observability/grafana/README.md +21 -0
  371. package/templates/.agents/tools/mcp/observability/grafana/manifest.yaml +26 -0
  372. package/templates/.agents/tools/mcp/observability/kibana/README.md +21 -0
  373. package/templates/.agents/tools/mcp/observability/kibana/manifest.yaml +26 -0
  374. package/templates/.agents/tools/mcp/observability/loki/README.md +19 -0
  375. package/templates/.agents/tools/mcp/observability/loki/manifest.yaml +24 -0
  376. package/templates/.agents/tools/mcp/observability/new-relic/README.md +21 -0
  377. package/templates/.agents/tools/mcp/observability/new-relic/manifest.yaml +26 -0
  378. package/templates/.agents/tools/mcp/observability/opentelemetry/README.md +20 -0
  379. package/templates/.agents/tools/mcp/observability/opentelemetry/manifest.yaml +25 -0
  380. package/templates/.agents/tools/mcp/observability/prometheus/README.md +19 -0
  381. package/templates/.agents/tools/mcp/observability/prometheus/manifest.yaml +24 -0
  382. package/templates/.agents/tools/mcp/observability/sentry/README.md +21 -0
  383. package/templates/.agents/tools/mcp/observability/sentry/manifest.yaml +26 -0
  384. package/templates/.agents/tools/policies/approval-rules.yaml +8 -0
  385. package/templates/.agents/tools/policies/financial-limits.yaml +6 -0
  386. package/templates/.agents/tools/policies/permissions.yaml +8 -0
  387. package/templates/.agents/tools/policies/secret-handling.md +7 -0
  388. package/templates/.agents/tools/profiles/business.yaml +8 -0
  389. package/templates/.agents/tools/profiles/default.yaml +8 -0
  390. package/templates/.agents/tools/profiles/development.yaml +13 -0
  391. package/templates/.agents/tools/profiles/infrastructure.yaml +8 -0
  392. package/templates/.agents/tools/profiles/marketing.yaml +9 -0
  393. package/templates/.agents/tools/profiles/observability.yaml +8 -0
  394. package/templates/.agents/tools/runtime/README.md +3 -0
  395. package/templates/.agents/tools/runtime/api-mcp-runtime.mjs +217 -0
  396. package/templates/.agents/tools/runtime/api-mcp-runtime.test.mjs +56 -0
  397. package/templates/.agents/tools/runtime/fixtures/definition.json +17 -0
  398. package/templates/.agents/tools/runtime/runner.mjs +16 -0
  399. package/templates/.agents/tools/runtime/stdio.test.mjs +32 -0
  400. package/templates/.agents/tools/state.example.yaml +8 -0
  401. package/templates/.agents/zaip-aios/INDEX.md +26 -0
  402. package/templates/.agents/zaip-aios/README.md +13 -0
  403. package/templates/.agents/zaip-aios/VERSION +1 -0
  404. package/templates/.agents/zaip-aios/guides/01-primeiros-passos.md +10 -0
  405. package/templates/.agents/zaip-aios/guides/02-requirements.md +12 -0
  406. package/templates/.agents/zaip-aios/guides/03-tasks.md +12 -0
  407. package/templates/.agents/zaip-aios/guides/04-specs.md +16 -0
  408. package/templates/.agents/zaip-aios/guides/05-prds.md +13 -0
  409. package/templates/.agents/zaip-aios/guides/06-execucao.md +13 -0
  410. package/templates/.agents/zaip-aios/guides/07-revisao-e-validacao.md +8 -0
  411. package/templates/.agents/zaip-aios/guides/08-contexto-e-tokens.md +10 -0
  412. package/templates/.agents/zaip-aios/guides/09-agentes-e-squads.md +8 -0
  413. package/templates/.agents/zaip-aios/guides/10-seguranca.md +206 -0
  414. package/templates/.agents/zaip-aios/guides/11-observabilidade-e-custos.md +10 -0
  415. package/templates/.agents/zaip-aios/guides/12-instalacao-e-upgrade.md +10 -0
  416. package/templates/.agents/zaip-aios/guides/13-boas-praticas.md +12 -0
  417. package/templates/.agents/zaip-aios/guides/14-troubleshooting.md +12 -0
  418. package/templates/.agents/zaip-aios/guides/15-tools-e-codex.md +25 -0
  419. package/templates/.agents/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +47 -0
  420. package/templates/.zaip-aios/LICENSE +1 -0
  421. package/templates/.zaip-aios/THIRD_PARTY_NOTICES.md +10 -0
  422. package/templates/.zaip-aios/VERSION +1 -0
  423. package/templates/.zaip-aios/bin/zaip.mjs +1285 -0
  424. package/templates/.zaip-aios/checksums.sha256 +369 -0
  425. package/templates/.zaip-aios/dashboard/.zaip-managed.json +46 -0
  426. package/templates/.zaip-aios/dashboard/README.md +91 -0
  427. package/templates/.zaip-aios/dashboard/apps/frontend/dist/assets/index-BOLwg8VW.js +1009 -0
  428. package/templates/.zaip-aios/dashboard/apps/frontend/dist/assets/index-_yxs47Hd.css +1 -0
  429. package/templates/.zaip-aios/dashboard/apps/frontend/dist/assets/logo_novo_azul-BBx5pA2B.png +0 -0
  430. package/templates/.zaip-aios/dashboard/apps/frontend/dist/icon_zaip.png +0 -0
  431. package/templates/.zaip-aios/dashboard/apps/frontend/dist/index.html +15 -0
  432. package/templates/.zaip-aios/dashboard/apps/frontend/dist/logo_novo_azul.png +0 -0
  433. package/templates/.zaip-aios/dashboard/packages/local-runtime/server.mjs +179 -0
  434. package/templates/.zaip-aios/dashboard/packages/local-runtime/start-dashboard.mjs +726 -0
  435. package/templates/.zaip-aios/dashboard/zaip-dashboard.exe +0 -0
  436. package/templates/.zaip-aios/design/.zaip-managed.json +330 -0
  437. package/templates/.zaip-aios/design/DESIGN.md +180 -0
  438. package/templates/.zaip-aios/design/README.md +47 -0
  439. package/templates/.zaip-aios/design/apps/catalog/.storybook/main.ts +15 -0
  440. package/templates/.zaip-aios/design/apps/catalog/.storybook/preview.ts +21 -0
  441. package/templates/.zaip-aios/design/apps/catalog/dist/assets/index-B4pfFtvJ.css +1 -0
  442. package/templates/.zaip-aios/design/apps/catalog/dist/assets/index-Bvwc3Bgw.js +9 -0
  443. package/templates/.zaip-aios/design/apps/catalog/dist/index.html +14 -0
  444. package/templates/.zaip-aios/design/apps/catalog/dist/logo_novo_azul.png +0 -0
  445. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/Color-6AOWCN3U-D8qyAXo4.js +1 -0
  446. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/Components.stories-DkBtOSHX.js +1 -0
  447. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/DesignSystem.stories-BttERyCr.js +1 -0
  448. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/DocsRenderer-JROSPFPF-LmiVo77Q.js +46 -0
  449. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/Primitives-HZpQ6PjX.js +1 -0
  450. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/WithTooltip-7X4HQR7L-CTMWAwDe.js +9 -0
  451. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/axe-Bk3eEgJf.js +20 -0
  452. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-242VQQM5-DB2JSNUA.js +1 -0
  453. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-DRQKCCAG-DUhJxxRU.js +1 -0
  454. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-QQBDHPVZ-nYh9QWsm.js +1 -0
  455. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/chunk-W22LQPXL-9RCn9-l7.js +18 -0
  456. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/components-BX1OfYUi.js +243 -0
  457. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/formatter-L2YTDE3Q-Bu6KfEwW.js +1 -0
  458. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/iframe-B4pfFtvJ.css +1 -0
  459. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/iframe-LMhZM1ce.js +1154 -0
  460. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/jsx-runtime-f3rHp9ZU.js +1 -0
  461. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/matchers-JIUQ3HVY-9iRExWZO.js +28 -0
  462. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/preload-helper-BdFrVu1K.js +1 -0
  463. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/react-18-jAz3avmR.js +9 -0
  464. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/react-DvDPBd6Q.js +1 -0
  465. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/syntaxhighlighter-YFXUGROL-DV8X2acD.js +6 -0
  466. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/assets/theming-CHbHkcNi.js +39 -0
  467. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/favicon-wrapper.svg +46 -0
  468. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/favicon.svg +1 -0
  469. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/iframe.html +710 -0
  470. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/index.html +152 -0
  471. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/index.json +1 -0
  472. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/logo_novo_azul.png +0 -0
  473. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-bold-italic.woff2 +0 -0
  474. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-bold.woff2 +0 -0
  475. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-italic.woff2 +0 -0
  476. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/nunito-sans-regular.woff2 +0 -0
  477. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-addons/a11y-2/manager-bundle.js +57 -0
  478. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-addons/docs-1/manager-bundle.js +18 -0
  479. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +632 -0
  480. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/favicon-wrapper.svg +46 -0
  481. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/favicon.svg +1 -0
  482. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  483. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  484. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  485. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  486. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/globals-runtime.js +78957 -0
  487. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/globals.js +24 -0
  488. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/manager-stores.js +23 -0
  489. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/sb-manager/runtime.js +28253 -0
  490. package/templates/.zaip-aios/design/apps/catalog/dist/storybook/vite-inject-mocker-entry.js +2 -0
  491. package/templates/.zaip-aios/design/apps/catalog/index.html +13 -0
  492. package/templates/.zaip-aios/design/apps/catalog/package.json +32 -0
  493. package/templates/.zaip-aios/design/apps/catalog/public/logo_novo_azul.png +0 -0
  494. package/templates/.zaip-aios/design/apps/catalog/src/App.tsx +29 -0
  495. package/templates/.zaip-aios/design/apps/catalog/src/components/CatalogShell.tsx +78 -0
  496. package/templates/.zaip-aios/design/apps/catalog/src/components/Primitives.tsx +137 -0
  497. package/templates/.zaip-aios/design/apps/catalog/src/design-contract.test.ts +33 -0
  498. package/templates/.zaip-aios/design/apps/catalog/src/main.tsx +13 -0
  499. package/templates/.zaip-aios/design/apps/catalog/src/pages/ComponentsPage.tsx +83 -0
  500. package/templates/.zaip-aios/design/apps/catalog/src/pages/DesignSystemPage.tsx +185 -0
  501. package/templates/.zaip-aios/design/apps/catalog/src/stories/Components.stories.tsx +12 -0
  502. package/templates/.zaip-aios/design/apps/catalog/src/stories/DesignSystem.stories.tsx +12 -0
  503. package/templates/.zaip-aios/design/apps/catalog/src/styles/catalog.css +315 -0
  504. package/templates/.zaip-aios/design/apps/catalog/src/styles/components.css +228 -0
  505. package/templates/.zaip-aios/design/apps/catalog/src/styles/design-system.css +137 -0
  506. package/templates/.zaip-aios/design/apps/catalog/src/styles.css +85 -0
  507. package/templates/.zaip-aios/design/apps/catalog/tsconfig.json +16 -0
  508. package/templates/.zaip-aios/design/apps/catalog/vite.config.ts +10 -0
  509. package/templates/.zaip-aios/design/apps/catalog/vitest.config.ts +5 -0
  510. package/templates/.zaip-aios/design/packages/local-runtime/package.json +9 -0
  511. package/templates/.zaip-aios/design/packages/local-runtime/runtime.mjs +238 -0
  512. package/templates/.zaip-aios/design/packages/local-runtime/runtime.test.mjs +66 -0
  513. package/templates/.zaip-aios/design/packages/local-runtime/start-design.mjs +46 -0
  514. package/templates/.zaip-aios/design/packages/windows-launcher/Program.cs +110 -0
  515. package/templates/.zaip-aios/design/packages/windows-launcher/build-design-launcher.ps1 +107 -0
  516. package/templates/.zaip-aios/design/tokens.json +52 -0
  517. package/templates/.zaip-aios/design/zaip-design.exe +0 -0
  518. package/templates/.zaip-aios/manifest.json +376 -0
  519. package/templates/.zaip-aios/migrations/001-layout-v1.json +5 -0
  520. package/templates/.zaip-aios/migrations/002-layout-v2.json +6 -0
  521. package/templates/.zaip-aios/pricing/fx/2026/07/12/usd-brl.json +9 -0
  522. package/templates/.zaip-aios/pricing/models.json +172 -0
  523. package/templates/.zaip-aios/profiles/clients.json +506 -0
  524. package/templates/.zaip-aios/profiles/fixtures/architecture/negative/modules/orders/application/queries/list.query.ts +5 -0
  525. package/templates/.zaip-aios/profiles/fixtures/architecture/negative/modules/orders/domain/order.ts +3 -0
  526. package/templates/.zaip-aios/profiles/fixtures/architecture/positive/modules/orders/application/queries/list.query.ts +5 -0
  527. package/templates/.zaip-aios/profiles/typescript-hono-kysely.json +41 -0
  528. package/templates/.zaip-aios/sbom.cdx.json +3440 -0
  529. package/templates/.zaip-aios/schemas/contracts.schema.json +243 -0
  530. package/templates/.zaip-aios/templates/config/agents/catalog.yaml +246 -0
  531. package/templates/.zaip-aios/templates/requirements/.gitkeep +0 -0
  532. package/templates/.zaip-aios/templates/requirements/autonomous-assurance.md +63 -0
  533. package/templates/.zaip-aios/templates/requirements/context-engine.md +44 -0
  534. package/templates/.zaip-aios/templates/requirements/cost-observability.md +39 -0
  535. package/templates/.zaip-aios/templates/requirements/design-system.md +48 -0
  536. package/templates/.zaip-aios/templates/requirements/execution-engine.md +60 -0
  537. package/templates/.zaip-aios/templates/requirements/kanban-dashboard.md +30 -0
  538. package/templates/.zaip-aios/templates/requirements/model-orchestration.md +58 -0
  539. package/templates/.zaip-aios/templates/requirements/public-distribution.md +40 -0
  540. package/templates/.zaip-aios/templates/requirements/software-architecture.md +57 -0
  541. package/templates/.zaip-aios/templates/requirements/work-lifecycle.md +82 -0
  542. package/templates/.zaip-aios/templates/rules/project/.gitkeep +0 -0
  543. package/templates/.zaip-aios/templates/rules/zaip/architecture.md +28 -0
  544. package/templates/.zaip-aios/templates/rules/zaip/context.md +22 -0
  545. package/templates/.zaip-aios/templates/rules/zaip/core.md +24 -0
  546. package/templates/.zaip-aios/templates/rules/zaip/evolution.md +22 -0
  547. package/templates/.zaip-aios/templates/rules/zaip/model-orchestration.md +48 -0
  548. package/templates/.zaip-aios/templates/rules/zaip/security.md +20 -0
  549. package/templates/.zaip-aios/templates/rules/zaip/workflow.md +35 -0
  550. package/templates/.zaip-aios/templates/skills/.gitkeep +0 -0
  551. package/templates/.zaip-aios/templates/skills/zaip-skill-adapt-stack/SKILL.md +11 -0
  552. package/templates/.zaip-aios/templates/skills/zaip-skill-adapt-stack/agents/openai.yaml +4 -0
  553. package/templates/.zaip-aios/templates/skills/zaip-skill-adapters/SKILL.md +15 -0
  554. package/templates/.zaip-aios/templates/skills/zaip-skill-adapters/agents/openai.yaml +4 -0
  555. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/SKILL.md +19 -0
  556. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/agents/openai.yaml +4 -0
  557. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/assets/adapter.example.yaml +26 -0
  558. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/references/security-contract.md +10 -0
  559. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/references/server-layout.md +19 -0
  560. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/scripts/inspect-openapi.mjs +60 -0
  561. package/templates/.zaip-aios/templates/skills/zaip-skill-api-to-mcp/scripts/scaffold-local-mcp.mjs +47 -0
  562. package/templates/.zaip-aios/templates/skills/zaip-skill-author-skills/SKILL.md +21 -0
  563. package/templates/.zaip-aios/templates/skills/zaip-skill-author-skills/agents/openai.yaml +4 -0
  564. package/templates/.zaip-aios/templates/skills/zaip-skill-change/SKILL.md +20 -0
  565. package/templates/.zaip-aios/templates/skills/zaip-skill-change/agents/openai.yaml +4 -0
  566. package/templates/.zaip-aios/templates/skills/zaip-skill-config/SKILL.md +22 -0
  567. package/templates/.zaip-aios/templates/skills/zaip-skill-config/agents/openai.yaml +4 -0
  568. package/templates/.zaip-aios/templates/skills/zaip-skill-context/SKILL.md +16 -0
  569. package/templates/.zaip-aios/templates/skills/zaip-skill-context/agents/openai.yaml +4 -0
  570. package/templates/.zaip-aios/templates/skills/zaip-skill-cqrs/SKILL.md +11 -0
  571. package/templates/.zaip-aios/templates/skills/zaip-skill-cqrs/agents/openai.yaml +4 -0
  572. package/templates/.zaip-aios/templates/skills/zaip-skill-decisions/SKILL.md +14 -0
  573. package/templates/.zaip-aios/templates/skills/zaip-skill-decisions/agents/openai.yaml +4 -0
  574. package/templates/.zaip-aios/templates/skills/zaip-skill-enforce-architecture/SKILL.md +14 -0
  575. package/templates/.zaip-aios/templates/skills/zaip-skill-enforce-architecture/agents/openai.yaml +4 -0
  576. package/templates/.zaip-aios/templates/skills/zaip-skill-eval/SKILL.md +14 -0
  577. package/templates/.zaip-aios/templates/skills/zaip-skill-eval/agents/openai.yaml +4 -0
  578. package/templates/.zaip-aios/templates/skills/zaip-skill-execution/SKILL.md +36 -0
  579. package/templates/.zaip-aios/templates/skills/zaip-skill-execution/agents/openai.yaml +6 -0
  580. package/templates/.zaip-aios/templates/skills/zaip-skill-execution/references/prepared-plan.md +31 -0
  581. package/templates/.zaip-aios/templates/skills/zaip-skill-frontend-launcher/SKILL.md +29 -0
  582. package/templates/.zaip-aios/templates/skills/zaip-skill-frontend-launcher/agents/openai.yaml +4 -0
  583. package/templates/.zaip-aios/templates/skills/zaip-skill-frontend-launcher/references/launcher-contract.md +36 -0
  584. package/templates/.zaip-aios/templates/skills/zaip-skill-github-deploy/SKILL.md +75 -0
  585. package/templates/.zaip-aios/templates/skills/zaip-skill-github-deploy/agents/openai.yaml +6 -0
  586. package/templates/.zaip-aios/templates/skills/zaip-skill-github-deploy/scripts/preflight.mjs +256 -0
  587. package/templates/.zaip-aios/templates/skills/zaip-skill-github-setup/SKILL.md +80 -0
  588. package/templates/.zaip-aios/templates/skills/zaip-skill-github-setup/agents/openai.yaml +4 -0
  589. package/templates/.zaip-aios/templates/skills/zaip-skill-move-prd/SKILL.md +37 -0
  590. package/templates/.zaip-aios/templates/skills/zaip-skill-move-prd/agents/openai.yaml +4 -0
  591. package/templates/.zaip-aios/templates/skills/zaip-skill-move-spec/SKILL.md +38 -0
  592. package/templates/.zaip-aios/templates/skills/zaip-skill-move-spec/agents/openai.yaml +4 -0
  593. package/templates/.zaip-aios/templates/skills/zaip-skill-navigate-work/SKILL.md +16 -0
  594. package/templates/.zaip-aios/templates/skills/zaip-skill-navigate-work/agents/openai.yaml +4 -0
  595. package/templates/.zaip-aios/templates/skills/zaip-skill-observability/SKILL.md +24 -0
  596. package/templates/.zaip-aios/templates/skills/zaip-skill-observability/agents/openai.yaml +4 -0
  597. package/templates/.zaip-aios/templates/skills/zaip-skill-openai-docs/SKILL.md +17 -0
  598. package/templates/.zaip-aios/templates/skills/zaip-skill-openai-docs/agents/openai.yaml +4 -0
  599. package/templates/.zaip-aios/templates/skills/zaip-skill-openai-docs/references/routing.md +11 -0
  600. package/templates/.zaip-aios/templates/skills/zaip-skill-prd/SKILL.md +44 -0
  601. package/templates/.zaip-aios/templates/skills/zaip-skill-prd/agents/openai.yaml +4 -0
  602. package/templates/.zaip-aios/templates/skills/zaip-skill-preview/SKILL.md +16 -0
  603. package/templates/.zaip-aios/templates/skills/zaip-skill-preview/agents/openai.yaml +4 -0
  604. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/SKILL.md +39 -0
  605. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/agents/openai.yaml +4 -0
  606. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/inspect-local-sqlite.py +52 -0
  607. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/normalize-run-agents.mjs +63 -0
  608. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +698 -0
  609. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +361 -0
  610. package/templates/.zaip-aios/templates/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +187 -0
  611. package/templates/.zaip-aios/templates/skills/zaip-skill-requirements/SKILL.md +16 -0
  612. package/templates/.zaip-aios/templates/skills/zaip-skill-requirements/agents/openai.yaml +4 -0
  613. package/templates/.zaip-aios/templates/skills/zaip-skill-review/SKILL.md +18 -0
  614. package/templates/.zaip-aios/templates/skills/zaip-skill-review/agents/openai.yaml +4 -0
  615. package/templates/.zaip-aios/templates/skills/zaip-skill-rules/SKILL.md +19 -0
  616. package/templates/.zaip-aios/templates/skills/zaip-skill-rules/agents/openai.yaml +4 -0
  617. package/templates/.zaip-aios/templates/skills/zaip-skill-security/SKILL.md +30 -0
  618. package/templates/.zaip-aios/templates/skills/zaip-skill-security/agents/openai.yaml +4 -0
  619. package/templates/.zaip-aios/templates/skills/zaip-skill-setup/SKILL.md +25 -0
  620. package/templates/.zaip-aios/templates/skills/zaip-skill-setup/agents/openai.yaml +4 -0
  621. package/templates/.zaip-aios/templates/skills/zaip-skill-spec/SKILL.md +45 -0
  622. package/templates/.zaip-aios/templates/skills/zaip-skill-spec/agents/openai.yaml +4 -0
  623. package/templates/.zaip-aios/templates/skills/zaip-skill-task/SKILL.md +41 -0
  624. package/templates/.zaip-aios/templates/skills/zaip-skill-task/agents/openai.yaml +4 -0
  625. package/templates/.zaip-aios/templates/skills/zaip-skill-text-encoding/SKILL.md +27 -0
  626. package/templates/.zaip-aios/templates/skills/zaip-skill-text-encoding/agents/openai.yaml +6 -0
  627. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/SKILL.md +22 -0
  628. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/agents/openai.yaml +4 -0
  629. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/references/codex-config.md +24 -0
  630. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/references/secrets.md +8 -0
  631. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/scripts/configure-local-mcp.mjs +52 -0
  632. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/scripts/inspect-tool.mjs +35 -0
  633. package/templates/.zaip-aios/templates/skills/zaip-skill-tool-setup/scripts/tool-state.mjs +26 -0
  634. package/templates/.zaip-aios/templates/tools/README.md +9 -0
  635. package/templates/.zaip-aios/templates/tools/api/asaas/README.md +22 -0
  636. package/templates/.zaip-aios/templates/tools/api/asaas/manifest.yaml +20 -0
  637. package/templates/.zaip-aios/templates/tools/api/github/README.md +22 -0
  638. package/templates/.zaip-aios/templates/tools/api/github/manifest.yaml +20 -0
  639. package/templates/.zaip-aios/templates/tools/api/google-ads/README.md +23 -0
  640. package/templates/.zaip-aios/templates/tools/api/google-ads/manifest.yaml +21 -0
  641. package/templates/.zaip-aios/templates/tools/api/google-analytics/README.md +22 -0
  642. package/templates/.zaip-aios/templates/tools/api/google-analytics/manifest.yaml +20 -0
  643. package/templates/.zaip-aios/templates/tools/api/google-search-console/README.md +21 -0
  644. package/templates/.zaip-aios/templates/tools/api/google-search-console/manifest.yaml +19 -0
  645. package/templates/.zaip-aios/templates/tools/api/google-tag-manager/README.md +22 -0
  646. package/templates/.zaip-aios/templates/tools/api/google-tag-manager/manifest.yaml +20 -0
  647. package/templates/.zaip-aios/templates/tools/api/hubspot/README.md +22 -0
  648. package/templates/.zaip-aios/templates/tools/api/hubspot/manifest.yaml +20 -0
  649. package/templates/.zaip-aios/templates/tools/api/instagram-graph/README.md +23 -0
  650. package/templates/.zaip-aios/templates/tools/api/instagram-graph/manifest.yaml +21 -0
  651. package/templates/.zaip-aios/templates/tools/api/kommo-crm/README.md +23 -0
  652. package/templates/.zaip-aios/templates/tools/api/kommo-crm/manifest.yaml +21 -0
  653. package/templates/.zaip-aios/templates/tools/api/linkedin-ads/README.md +23 -0
  654. package/templates/.zaip-aios/templates/tools/api/linkedin-ads/manifest.yaml +21 -0
  655. package/templates/.zaip-aios/templates/tools/api/meta-ads/README.md +23 -0
  656. package/templates/.zaip-aios/templates/tools/api/meta-ads/manifest.yaml +21 -0
  657. package/templates/.zaip-aios/templates/tools/api/openai/README.md +22 -0
  658. package/templates/.zaip-aios/templates/tools/api/openai/manifest.yaml +20 -0
  659. package/templates/.zaip-aios/templates/tools/api/shopify/README.md +23 -0
  660. package/templates/.zaip-aios/templates/tools/api/shopify/manifest.yaml +21 -0
  661. package/templates/.zaip-aios/templates/tools/api/slack/README.md +22 -0
  662. package/templates/.zaip-aios/templates/tools/api/slack/manifest.yaml +20 -0
  663. package/templates/.zaip-aios/templates/tools/api/stripe/README.md +22 -0
  664. package/templates/.zaip-aios/templates/tools/api/stripe/manifest.yaml +20 -0
  665. package/templates/.zaip-aios/templates/tools/api/tiktok-ads/README.md +23 -0
  666. package/templates/.zaip-aios/templates/tools/api/tiktok-ads/manifest.yaml +21 -0
  667. package/templates/.zaip-aios/templates/tools/api/youtube-analytics/README.md +22 -0
  668. package/templates/.zaip-aios/templates/tools/api/youtube-analytics/manifest.yaml +20 -0
  669. package/templates/.zaip-aios/templates/tools/catalog.yaml +358 -0
  670. package/templates/.zaip-aios/templates/tools/mcp/development/browser/README.md +20 -0
  671. package/templates/.zaip-aios/templates/tools/mcp/development/browser/manifest.yaml +24 -0
  672. package/templates/.zaip-aios/templates/tools/mcp/development/filesystem/README.md +20 -0
  673. package/templates/.zaip-aios/templates/tools/mcp/development/filesystem/manifest.yaml +24 -0
  674. package/templates/.zaip-aios/templates/tools/mcp/development/git/README.md +20 -0
  675. package/templates/.zaip-aios/templates/tools/mcp/development/git/manifest.yaml +24 -0
  676. package/templates/.zaip-aios/templates/tools/mcp/development/github/README.md +20 -0
  677. package/templates/.zaip-aios/templates/tools/mcp/development/github/manifest.yaml +25 -0
  678. package/templates/.zaip-aios/templates/tools/mcp/development/gitlab/README.md +20 -0
  679. package/templates/.zaip-aios/templates/tools/mcp/development/gitlab/manifest.yaml +25 -0
  680. package/templates/.zaip-aios/templates/tools/mcp/development/jira/README.md +21 -0
  681. package/templates/.zaip-aios/templates/tools/mcp/development/jira/manifest.yaml +26 -0
  682. package/templates/.zaip-aios/templates/tools/mcp/development/linear/README.md +20 -0
  683. package/templates/.zaip-aios/templates/tools/mcp/development/linear/manifest.yaml +25 -0
  684. package/templates/.zaip-aios/templates/tools/mcp/development/notion/README.md +20 -0
  685. package/templates/.zaip-aios/templates/tools/mcp/development/notion/manifest.yaml +25 -0
  686. package/templates/.zaip-aios/templates/tools/mcp/development/openai-docs/README.md +15 -0
  687. package/templates/.zaip-aios/templates/tools/mcp/development/openai-docs/manifest.yaml +21 -0
  688. package/templates/.zaip-aios/templates/tools/mcp/development/postgresql/README.md +20 -0
  689. package/templates/.zaip-aios/templates/tools/mcp/development/postgresql/manifest.yaml +25 -0
  690. package/templates/.zaip-aios/templates/tools/mcp/development/slack/README.md +20 -0
  691. package/templates/.zaip-aios/templates/tools/mcp/development/slack/manifest.yaml +25 -0
  692. package/templates/.zaip-aios/templates/tools/mcp/development/sqlite/README.md +20 -0
  693. package/templates/.zaip-aios/templates/tools/mcp/development/sqlite/manifest.yaml +25 -0
  694. package/templates/.zaip-aios/templates/tools/mcp/infra/aws/README.md +21 -0
  695. package/templates/.zaip-aios/templates/tools/mcp/infra/aws/manifest.yaml +26 -0
  696. package/templates/.zaip-aios/templates/tools/mcp/infra/azure/README.md +20 -0
  697. package/templates/.zaip-aios/templates/tools/mcp/infra/azure/manifest.yaml +25 -0
  698. package/templates/.zaip-aios/templates/tools/mcp/infra/cloudflare/README.md +21 -0
  699. package/templates/.zaip-aios/templates/tools/mcp/infra/cloudflare/manifest.yaml +26 -0
  700. package/templates/.zaip-aios/templates/tools/mcp/infra/docker/README.md +20 -0
  701. package/templates/.zaip-aios/templates/tools/mcp/infra/docker/manifest.yaml +24 -0
  702. package/templates/.zaip-aios/templates/tools/mcp/infra/gcp/README.md +21 -0
  703. package/templates/.zaip-aios/templates/tools/mcp/infra/gcp/manifest.yaml +26 -0
  704. package/templates/.zaip-aios/templates/tools/mcp/infra/hostinger/README.md +20 -0
  705. package/templates/.zaip-aios/templates/tools/mcp/infra/hostinger/manifest.yaml +25 -0
  706. package/templates/.zaip-aios/templates/tools/mcp/infra/kubernetes/README.md +20 -0
  707. package/templates/.zaip-aios/templates/tools/mcp/infra/kubernetes/manifest.yaml +25 -0
  708. package/templates/.zaip-aios/templates/tools/mcp/infra/terraform/README.md +20 -0
  709. package/templates/.zaip-aios/templates/tools/mcp/infra/terraform/manifest.yaml +24 -0
  710. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-ads/README.md +21 -0
  711. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-ads/manifest.yaml +26 -0
  712. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-analytics/README.md +20 -0
  713. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-analytics/manifest.yaml +25 -0
  714. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-search-console/README.md +19 -0
  715. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-search-console/manifest.yaml +24 -0
  716. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-tag-manager/README.md +21 -0
  717. package/templates/.zaip-aios/templates/tools/mcp/marketing/google-tag-manager/manifest.yaml +26 -0
  718. package/templates/.zaip-aios/templates/tools/mcp/marketing/hubspot/README.md +20 -0
  719. package/templates/.zaip-aios/templates/tools/mcp/marketing/hubspot/manifest.yaml +25 -0
  720. package/templates/.zaip-aios/templates/tools/mcp/marketing/instagram-insights/README.md +21 -0
  721. package/templates/.zaip-aios/templates/tools/mcp/marketing/instagram-insights/manifest.yaml +26 -0
  722. package/templates/.zaip-aios/templates/tools/mcp/marketing/linkedin-ads/README.md +21 -0
  723. package/templates/.zaip-aios/templates/tools/mcp/marketing/linkedin-ads/manifest.yaml +26 -0
  724. package/templates/.zaip-aios/templates/tools/mcp/marketing/mailchimp/README.md +21 -0
  725. package/templates/.zaip-aios/templates/tools/mcp/marketing/mailchimp/manifest.yaml +26 -0
  726. package/templates/.zaip-aios/templates/tools/mcp/marketing/meta-ads/README.md +21 -0
  727. package/templates/.zaip-aios/templates/tools/mcp/marketing/meta-ads/manifest.yaml +26 -0
  728. package/templates/.zaip-aios/templates/tools/mcp/marketing/semrush/README.md +20 -0
  729. package/templates/.zaip-aios/templates/tools/mcp/marketing/semrush/manifest.yaml +25 -0
  730. package/templates/.zaip-aios/templates/tools/mcp/marketing/tiktok-ads/README.md +21 -0
  731. package/templates/.zaip-aios/templates/tools/mcp/marketing/tiktok-ads/manifest.yaml +26 -0
  732. package/templates/.zaip-aios/templates/tools/mcp/marketing/youtube-analytics/README.md +21 -0
  733. package/templates/.zaip-aios/templates/tools/mcp/marketing/youtube-analytics/manifest.yaml +26 -0
  734. package/templates/.zaip-aios/templates/tools/mcp/observability/cloudwatch/README.md +21 -0
  735. package/templates/.zaip-aios/templates/tools/mcp/observability/cloudwatch/manifest.yaml +26 -0
  736. package/templates/.zaip-aios/templates/tools/mcp/observability/datadog/README.md +21 -0
  737. package/templates/.zaip-aios/templates/tools/mcp/observability/datadog/manifest.yaml +26 -0
  738. package/templates/.zaip-aios/templates/tools/mcp/observability/elasticsearch/README.md +21 -0
  739. package/templates/.zaip-aios/templates/tools/mcp/observability/elasticsearch/manifest.yaml +26 -0
  740. package/templates/.zaip-aios/templates/tools/mcp/observability/grafana/README.md +21 -0
  741. package/templates/.zaip-aios/templates/tools/mcp/observability/grafana/manifest.yaml +26 -0
  742. package/templates/.zaip-aios/templates/tools/mcp/observability/kibana/README.md +21 -0
  743. package/templates/.zaip-aios/templates/tools/mcp/observability/kibana/manifest.yaml +26 -0
  744. package/templates/.zaip-aios/templates/tools/mcp/observability/loki/README.md +19 -0
  745. package/templates/.zaip-aios/templates/tools/mcp/observability/loki/manifest.yaml +24 -0
  746. package/templates/.zaip-aios/templates/tools/mcp/observability/new-relic/README.md +21 -0
  747. package/templates/.zaip-aios/templates/tools/mcp/observability/new-relic/manifest.yaml +26 -0
  748. package/templates/.zaip-aios/templates/tools/mcp/observability/opentelemetry/README.md +20 -0
  749. package/templates/.zaip-aios/templates/tools/mcp/observability/opentelemetry/manifest.yaml +25 -0
  750. package/templates/.zaip-aios/templates/tools/mcp/observability/prometheus/README.md +19 -0
  751. package/templates/.zaip-aios/templates/tools/mcp/observability/prometheus/manifest.yaml +24 -0
  752. package/templates/.zaip-aios/templates/tools/mcp/observability/sentry/README.md +21 -0
  753. package/templates/.zaip-aios/templates/tools/mcp/observability/sentry/manifest.yaml +26 -0
  754. package/templates/.zaip-aios/templates/tools/policies/approval-rules.yaml +8 -0
  755. package/templates/.zaip-aios/templates/tools/policies/financial-limits.yaml +6 -0
  756. package/templates/.zaip-aios/templates/tools/policies/permissions.yaml +8 -0
  757. package/templates/.zaip-aios/templates/tools/policies/secret-handling.md +7 -0
  758. package/templates/.zaip-aios/templates/tools/profiles/business.yaml +8 -0
  759. package/templates/.zaip-aios/templates/tools/profiles/default.yaml +8 -0
  760. package/templates/.zaip-aios/templates/tools/profiles/development.yaml +13 -0
  761. package/templates/.zaip-aios/templates/tools/profiles/infrastructure.yaml +8 -0
  762. package/templates/.zaip-aios/templates/tools/profiles/marketing.yaml +9 -0
  763. package/templates/.zaip-aios/templates/tools/profiles/observability.yaml +8 -0
  764. package/templates/.zaip-aios/templates/tools/runtime/README.md +3 -0
  765. package/templates/.zaip-aios/templates/tools/runtime/api-mcp-runtime.mjs +217 -0
  766. package/templates/.zaip-aios/templates/tools/runtime/api-mcp-runtime.test.mjs +56 -0
  767. package/templates/.zaip-aios/templates/tools/runtime/fixtures/definition.json +17 -0
  768. package/templates/.zaip-aios/templates/tools/runtime/runner.mjs +16 -0
  769. package/templates/.zaip-aios/templates/tools/runtime/stdio.test.mjs +32 -0
  770. package/templates/.zaip-aios/templates/tools/state.example.yaml +8 -0
  771. package/templates/.zaip-aios/templates/zaip-aios/INDEX.md +26 -0
  772. package/templates/.zaip-aios/templates/zaip-aios/README.md +13 -0
  773. package/templates/.zaip-aios/templates/zaip-aios/VERSION +1 -0
  774. package/templates/.zaip-aios/templates/zaip-aios/guides/01-primeiros-passos.md +10 -0
  775. package/templates/.zaip-aios/templates/zaip-aios/guides/02-requirements.md +12 -0
  776. package/templates/.zaip-aios/templates/zaip-aios/guides/03-tasks.md +12 -0
  777. package/templates/.zaip-aios/templates/zaip-aios/guides/04-specs.md +16 -0
  778. package/templates/.zaip-aios/templates/zaip-aios/guides/05-prds.md +13 -0
  779. package/templates/.zaip-aios/templates/zaip-aios/guides/06-execucao.md +13 -0
  780. package/templates/.zaip-aios/templates/zaip-aios/guides/07-revisao-e-validacao.md +8 -0
  781. package/templates/.zaip-aios/templates/zaip-aios/guides/08-contexto-e-tokens.md +10 -0
  782. package/templates/.zaip-aios/templates/zaip-aios/guides/09-agentes-e-squads.md +8 -0
  783. package/templates/.zaip-aios/templates/zaip-aios/guides/10-seguranca.md +206 -0
  784. package/templates/.zaip-aios/templates/zaip-aios/guides/11-observabilidade-e-custos.md +10 -0
  785. package/templates/.zaip-aios/templates/zaip-aios/guides/12-instalacao-e-upgrade.md +10 -0
  786. package/templates/.zaip-aios/templates/zaip-aios/guides/13-boas-praticas.md +12 -0
  787. package/templates/.zaip-aios/templates/zaip-aios/guides/14-troubleshooting.md +12 -0
  788. package/templates/.zaip-aios/templates/zaip-aios/guides/15-tools-e-codex.md +25 -0
  789. package/templates/.zaip-aios/templates/zaip-aios/guides/16-lifecycle-e-reconciliacao.md +47 -0
  790. package/templates/template-manifest.json +3210 -69
  791. package/templates/.agents/rules/architecture.md +0 -21
  792. package/templates/.agents/rules/context.md +0 -18
  793. package/templates/.agents/rules/core.md +0 -16
  794. package/templates/.agents/rules/workflow.md +0 -21
  795. /package/templates/.agents/rules/{security.md → zaip/security.md} +0 -0
@@ -0,0 +1,726 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createHash, randomBytes } from "node:crypto";
3
+ import { appendFileSync, mkdirSync } from "node:fs";
4
+ import { access, mkdir, readdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
5
+ import { createServer as createHttpServer } from "node:http";
6
+ import { createServer } from "node:net";
7
+ import { tmpdir } from "node:os";
8
+ import { dirname, join, resolve, win32 } from "node:path";
9
+ import process from "node:process";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ export const host = "127.0.0.1";
13
+ export const defaultPort = 4317;
14
+ export const maxPortAttempts = 25;
15
+ export const runtimeKind = "zaip-dashboard-local-runtime";
16
+
17
+ const packageRoot = dirname(fileURLToPath(import.meta.url));
18
+ export const workspaceRoot = resolve(packageRoot, "../../../..");
19
+ export const workspaceKey = createHash("sha256").update(workspaceRoot).digest("hex").slice(0, 16);
20
+ export const sessionDirectory = join(tmpdir(), "zaip-aios", workspaceKey);
21
+ export const sessionPath = join(sessionDirectory, "dashboard-session.json");
22
+ export const portRegistryPath = join(sessionDirectory, "dashboard-ports.json");
23
+ export const lockPath = join(sessionDirectory, "dashboard-launcher.lock");
24
+ export const launcherLogPath = join(sessionDirectory, "dashboard-launcher.log");
25
+
26
+ const frontendRoot = resolve(workspaceRoot, ".agents/dashboard/apps/frontend/dist");
27
+ const installedServer = resolve(packageRoot, "server.mjs");
28
+ const sourceServer = resolve(packageRoot, "dist/server.js");
29
+ const healthPath = "/api/v2/health";
30
+ const lockTimeoutMs = 10_000;
31
+ const staleLockMs = 30_000;
32
+ const startupTimeoutMs = 12_000;
33
+ const maxServerStartAttempts = 4;
34
+ const maxPortHistory = 50;
35
+ const dashboardSourceRoots = [
36
+ resolve(workspaceRoot, ".agents/dashboard/apps/frontend/src"),
37
+ resolve(workspaceRoot, ".agents/dashboard/modules"),
38
+ resolve(workspaceRoot, ".agents/dashboard/packages/ui/src"),
39
+ resolve(packageRoot, "src"),
40
+ ];
41
+
42
+ export function preferredPort(value = process.env.ZAIP_SERVER_PORT) {
43
+ const parsed = Number.parseInt(value ?? "", 10);
44
+ return Number.isInteger(parsed) && parsed > 0 && parsed <= 65_535 ? parsed : defaultPort;
45
+ }
46
+
47
+ export function dashboardHealthUrl(port) {
48
+ return `http://${host}:${port}${healthPath}`;
49
+ }
50
+
51
+ export function dashboardUrl(port, token) {
52
+ return `http://${host}:${port}/?token=${encodeURIComponent(token)}`;
53
+ }
54
+
55
+ export function appendLauncherLog(message) {
56
+ try {
57
+ mkdirSync(sessionDirectory, { recursive: true });
58
+ appendFileSync(
59
+ launcherLogPath,
60
+ `[${new Date().toISOString()}] ${stripTerminalControlCodes(message)}\n`,
61
+ "utf8",
62
+ );
63
+ } catch {
64
+ // Best-effort diagnostics must not hide the launcher failure.
65
+ }
66
+ }
67
+
68
+ export function stripTerminalControlCodes(value) {
69
+ return String(value)
70
+ .replace(/\u001B\][^\u0007]*(?:\u0007|\u001B\\)/g, "")
71
+ .replace(/\u001B\[[0-?]*[ -/]*[@-~]/g, "")
72
+ .replace(/\r/g, "")
73
+ .trim();
74
+ }
75
+
76
+ export function formatLauncherError(value, maximumLength = 3_600) {
77
+ const message = stripTerminalControlCodes(value);
78
+ if (message.length <= maximumLength) return message;
79
+
80
+ const firstHalf = Math.floor(maximumLength / 2);
81
+ const lastHalf = maximumLength - firstHalf;
82
+ return `${message.slice(0, firstHalf)}\n\n… detalhes reduzidos; consulte o log temporário …\n\n${message.slice(-lastHalf)}`;
83
+ }
84
+
85
+ export async function readDashboardSession(path = sessionPath) {
86
+ try {
87
+ return JSON.parse(await readFile(path, "utf8"));
88
+ } catch {
89
+ return null;
90
+ }
91
+ }
92
+
93
+ export async function writeDashboardSession(session, path = sessionPath) {
94
+ await writeJsonAtomic(path, session);
95
+ }
96
+
97
+ async function writeJsonAtomic(path, value) {
98
+ const directory = dirname(path);
99
+ await mkdir(directory, { recursive: true });
100
+ const temporaryPath = `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
101
+ await writeFile(temporaryPath, `${JSON.stringify(value, null, 2)}\n`, {
102
+ encoding: "utf8",
103
+ mode: 0o600,
104
+ });
105
+ await rename(temporaryPath, path);
106
+ }
107
+
108
+ export async function readPortRegistry(path = portRegistryPath) {
109
+ try {
110
+ const registry = JSON.parse(await readFile(path, "utf8"));
111
+ if (
112
+ registry?.workspace !== workspaceRoot ||
113
+ registry?.workspaceKey !== workspaceKey ||
114
+ !Array.isArray(registry?.ports)
115
+ ) {
116
+ return [];
117
+ }
118
+ return registry.ports;
119
+ } catch {
120
+ return [];
121
+ }
122
+ }
123
+
124
+ export async function recordPortStatus(session, status, path = portRegistryPath) {
125
+ const entries = await readPortRegistry(path);
126
+ const now = new Date().toISOString();
127
+ const matchingIndex = entries.findIndex(
128
+ (entry) => entry.rootPid === session.rootPid && entry.port === session.port,
129
+ );
130
+ const nextEntry = {
131
+ port: session.port,
132
+ rootPid: session.rootPid,
133
+ serverPid: session.serverPid ?? null,
134
+ openedAt: session.createdAt ?? session.openedAt ?? now,
135
+ status,
136
+ closedAt: status === "active" ? null : now,
137
+ };
138
+ if (matchingIndex >= 0) entries[matchingIndex] = { ...entries[matchingIndex], ...nextEntry };
139
+ else entries.push(nextEntry);
140
+ await writeJsonAtomic(path, {
141
+ schemaVersion: 1,
142
+ workspace: workspaceRoot,
143
+ workspaceKey,
144
+ updatedAt: now,
145
+ ports: entries.slice(-maxPortHistory),
146
+ });
147
+ }
148
+
149
+ export async function clearOwnedDashboardSession(rootPid = process.pid, path = sessionPath) {
150
+ const session = await readDashboardSession(path);
151
+ if (session?.rootPid === rootPid) await rm(path, { force: true });
152
+ }
153
+
154
+ export async function probeDashboardPort(
155
+ port,
156
+ fetchImpl = fetch,
157
+ expectedWorkspaceKey = workspaceKey,
158
+ requireHealthy = true,
159
+ ) {
160
+ try {
161
+ const response = await fetchImpl(dashboardHealthUrl(port), {
162
+ signal: AbortSignal.timeout(500),
163
+ });
164
+ const payload = await response.json();
165
+ const owned = payload?.kind === runtimeKind && payload.workspaceKey === expectedWorkspaceKey;
166
+ return owned && (!requireHealthy || response.ok);
167
+ } catch {
168
+ return false;
169
+ }
170
+ }
171
+
172
+ export async function findReusableDashboardSession({
173
+ path = sessionPath,
174
+ startPort = preferredPort(),
175
+ fetchImpl = fetch,
176
+ expectedWorkspaceKey = workspaceKey,
177
+ expectedBuildSignature = null,
178
+ } = {}) {
179
+ const session = await readDashboardSession(path);
180
+ if (
181
+ session?.kind !== runtimeKind ||
182
+ session?.workspace !== workspaceRoot ||
183
+ session?.workspaceKey !== expectedWorkspaceKey ||
184
+ typeof session?.token !== "string" ||
185
+ session.token.length === 0 ||
186
+ (expectedBuildSignature !== null && session?.buildSignature !== expectedBuildSignature)
187
+ ) {
188
+ return null;
189
+ }
190
+ if (
191
+ Number.isInteger(session.port) &&
192
+ (await probeDashboardPort(session.port, fetchImpl, expectedWorkspaceKey))
193
+ ) {
194
+ return session;
195
+ }
196
+
197
+ const ports = Array.from({ length: maxPortAttempts }, (_, index) => startPort + index).filter(
198
+ (port) => port <= 65_535 && port !== session.port,
199
+ );
200
+ const matches = await Promise.all(
201
+ ports.map(async (port) =>
202
+ (await probeDashboardPort(port, fetchImpl, expectedWorkspaceKey)) ? port : null,
203
+ ),
204
+ );
205
+ const port = matches.find((candidate) => candidate !== null);
206
+ return port === undefined ? null : { ...session, port };
207
+ }
208
+
209
+ async function latestModifiedAt(paths) {
210
+ let latest = 0;
211
+ for (const path of paths) {
212
+ const details = await stat(path).catch(() => null);
213
+ if (details === null) continue;
214
+ latest = Math.max(latest, details.mtimeMs);
215
+ if (!details.isDirectory()) continue;
216
+ const entries = await readdir(path, { withFileTypes: true }).catch(() => []);
217
+ latest = Math.max(
218
+ latest,
219
+ await latestModifiedAt(
220
+ entries
221
+ .filter((entry) => !new Set(["dist", "node_modules", ".turbo"]).has(entry.name))
222
+ .map((entry) => join(path, entry.name)),
223
+ ),
224
+ );
225
+ }
226
+ return latest;
227
+ }
228
+
229
+ async function runWorkspaceBuild(filter) {
230
+ const command = process.platform === "win32" ? (process.env.ComSpec ?? "cmd.exe") : "corepack";
231
+ const args =
232
+ process.platform === "win32"
233
+ ? ["/d", "/s", "/c", `corepack pnpm --filter ${filter} build`]
234
+ : ["pnpm", "--filter", filter, "build"];
235
+ const output = await new Promise((resolveBuild, rejectBuild) => {
236
+ const child = spawn(command, args, { cwd: workspaceRoot, windowsHide: true, stdio: "pipe" });
237
+ let outputText = "";
238
+ const appendOutput = (chunk) => {
239
+ outputText = `${outputText}${chunk}`.slice(-8_000);
240
+ };
241
+ child.stdout?.setEncoding("utf8");
242
+ child.stdout?.on("data", appendOutput);
243
+ child.stderr?.setEncoding("utf8");
244
+ child.stderr?.on("data", appendOutput);
245
+ child.once("error", rejectBuild);
246
+ child.once("exit", (code) => {
247
+ if (code === 0) resolveBuild();
248
+ else rejectBuild(new Error(`Build ${filter} failed (${code}): ${formatLauncherError(outputText)}`));
249
+ });
250
+ });
251
+ return output;
252
+ }
253
+
254
+ async function ensureFreshDashboardBuild() {
255
+ const artifacts = [resolve(frontendRoot, "index.html"), sourceServer];
256
+ const [sourcesModifiedAt, artifactsModifiedAt] = await Promise.all([
257
+ latestModifiedAt(dashboardSourceRoots),
258
+ latestModifiedAt(artifacts),
259
+ ]);
260
+ const forceRebuild = process.env.ZAIP_DASHBOARD_FORCE_REBUILD === "1";
261
+ if (forceRebuild || artifactsModifiedAt < sourcesModifiedAt) {
262
+ await runWorkspaceBuild("@zaip-ai/dashboard-frontend");
263
+ await runWorkspaceBuild("@zaip-ai/dashboard-local-runtime");
264
+ }
265
+ const artifactFingerprint = await Promise.all(
266
+ [...artifacts, resolve(packageRoot, "start-dashboard.mjs")].map(async (path) => {
267
+ const details = await stat(path);
268
+ return `${path}:${details.size}:${details.mtimeMs}`;
269
+ }),
270
+ );
271
+ return createHash("sha256").update(artifactFingerprint.join("|")).digest("hex");
272
+ }
273
+
274
+ export async function withLauncherLock(
275
+ action,
276
+ {
277
+ directory = sessionDirectory,
278
+ path = lockPath,
279
+ timeoutMs = lockTimeoutMs,
280
+ staleAfterMs = staleLockMs,
281
+ } = {},
282
+ ) {
283
+ await mkdir(directory, { recursive: true });
284
+ const deadline = Date.now() + timeoutMs;
285
+ while (Date.now() < deadline) {
286
+ try {
287
+ await mkdir(path);
288
+ try {
289
+ return await action();
290
+ } finally {
291
+ await rm(path, { recursive: true, force: true });
292
+ }
293
+ } catch (error) {
294
+ if (error?.code !== "EEXIST") throw error;
295
+ const lockStat = await stat(path).catch(() => null);
296
+ if (lockStat !== null && Date.now() - lockStat.mtimeMs > staleAfterMs) {
297
+ await rm(path, { recursive: true, force: true });
298
+ continue;
299
+ }
300
+ await delay(100);
301
+ }
302
+ }
303
+ throw new Error("Timed out waiting for the ZAIP dashboard launcher lock");
304
+ }
305
+
306
+ export async function findAvailablePort(startPort = preferredPort()) {
307
+ for (let port = startPort; port < Math.min(startPort + maxPortAttempts, 65_536); port += 1) {
308
+ if (await isPortFree(port)) return port;
309
+ }
310
+ throw new Error(
311
+ `No free dashboard port found between ${startPort} and ${Math.min(startPort + maxPortAttempts - 1, 65_535)}`,
312
+ );
313
+ }
314
+
315
+ export async function findAvailablePortWithFallback({
316
+ preferred = preferredPort(),
317
+ excludedPorts = [],
318
+ } = {}) {
319
+ const excluded = new Set(excludedPorts.filter(Number.isInteger));
320
+ const fallbackStarts = [preferred, defaultPort + 1_000, defaultPort + 4_000].filter(
321
+ (port, index, ports) => port <= 65_535 && ports.indexOf(port) === index,
322
+ );
323
+ for (const startPort of fallbackStarts) {
324
+ for (let port = startPort; port < Math.min(startPort + maxPortAttempts, 65_536); port += 1) {
325
+ if (!excluded.has(port) && (await isPortFree(port))) return port;
326
+ }
327
+ }
328
+ for (let attempt = 0; attempt < 5; attempt += 1) {
329
+ const ephemeralPort = await findEphemeralPort();
330
+ if (!excluded.has(ephemeralPort)) return ephemeralPort;
331
+ }
332
+ throw new Error(
333
+ "No free dashboard port was found in the preferred, fallback, or ephemeral ranges",
334
+ );
335
+ }
336
+
337
+ async function findEphemeralPort() {
338
+ return new Promise((resolvePort, rejectPort) => {
339
+ const server = createServer();
340
+ server.unref();
341
+ server.once("error", rejectPort);
342
+ server.listen({ host, port: 0 }, () => {
343
+ const address = server.address();
344
+ const port = typeof address === "object" && address !== null ? address.port : null;
345
+ server.close(() => {
346
+ if (Number.isInteger(port)) resolvePort(port);
347
+ else rejectPort(new Error("The operating system did not allocate an ephemeral port"));
348
+ });
349
+ });
350
+ });
351
+ }
352
+
353
+ export function browserLaunchCommands(
354
+ target,
355
+ platform = process.platform,
356
+ environment = process.env,
357
+ ) {
358
+ if (platform === "win32") {
359
+ const systemRoot = environment.SystemRoot ?? "C:\\Windows";
360
+ return [
361
+ [
362
+ win32.resolve(systemRoot, "System32", "rundll32.exe"),
363
+ ["url.dll,FileProtocolHandler", target],
364
+ ],
365
+ [
366
+ environment.ComSpec ?? win32.resolve(systemRoot, "System32", "cmd.exe"),
367
+ ["/d", "/c", "start", "", target],
368
+ ],
369
+ ];
370
+ }
371
+ return [[platform === "darwin" ? "open" : "xdg-open", [target]]];
372
+ }
373
+
374
+ export async function openBrowser(target, spawnImpl = spawn) {
375
+ if (process.env.ZAIP_UI_NO_BROWSER === "1") return true;
376
+ const commands = browserLaunchCommands(target);
377
+ for (const [command, args] of commands) {
378
+ const launched = await new Promise((resolveLaunch) => {
379
+ let settled = false;
380
+ const settle = (value) => {
381
+ if (settled) return;
382
+ settled = true;
383
+ resolveLaunch(value);
384
+ };
385
+ try {
386
+ const browser = spawnImpl(command, args, {
387
+ detached: true,
388
+ stdio: "ignore",
389
+ windowsHide: true,
390
+ });
391
+ browser.once("spawn", () => settle(true));
392
+ browser.once("error", () => settle(false));
393
+ browser.unref();
394
+ } catch {
395
+ settle(false);
396
+ }
397
+ });
398
+ if (launched) return true;
399
+ }
400
+ appendLauncherLog(`Could not dispatch the dashboard URL to the default browser: ${target}`);
401
+ return false;
402
+ }
403
+
404
+ export async function startDashboardLaunchPage(port) {
405
+ const server = createHttpServer((request, response) => {
406
+ response.setHeader("Cache-Control", "no-store");
407
+ if (request.url?.startsWith(healthPath)) {
408
+ response.writeHead(503, { "Content-Type": "application/json; charset=utf-8" });
409
+ response.end(JSON.stringify({ kind: "zaip-dashboard-launcher", status: "starting" }));
410
+ return;
411
+ }
412
+ response.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
413
+ response.end(`<!doctype html>
414
+ <html lang="pt-BR">
415
+ <head>
416
+ <meta charset="utf-8">
417
+ <meta name="viewport" content="width=device-width,initial-scale=1">
418
+ <title>Dashboard Zaip AIOS</title>
419
+ <style>
420
+ :root{color-scheme:dark;font-family:Inter,system-ui,sans-serif;background:#010610;color:#f1f5f9}
421
+ *{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at 50% 0,rgba(0,176,240,.07),transparent 42%),#010610}
422
+ main{padding:clamp(18px,2.4vw,38px)}header{display:flex;align-items:center;justify-content:space-between;margin-bottom:24px}h1{font-size:clamp(1.45rem,2.4vw,2.25rem);margin:8px 0 0}
423
+ .eyebrow,.line,.value,.action,.chart,.pill{display:block;position:relative;overflow:hidden;border-radius:999px;background:#172033}.eyebrow{width:110px;height:10px}.actions{display:flex;gap:10px}.action{width:48px;height:42px;border-radius:12px}
424
+ .kpis,.panels,.board{display:grid;gap:14px}.kpis{grid-template-columns:repeat(4,minmax(0,1fr))}.kpis article,.panels article,.board article{border:1px solid rgba(255,255,255,.08);border-radius:16px;background:linear-gradient(145deg,rgba(17,24,39,.86),rgba(10,14,23,.92))}
425
+ .kpis article{min-height:138px;padding:18px}.line{width:86%;height:10px;margin-top:12px}.value{width:42%;height:30px;margin-top:18px}.panels{grid-template-columns:1.7fr 1fr;margin-top:14px}.panels article{padding:18px}.chart{height:156px;margin-top:22px;border-radius:12px;background:repeating-linear-gradient(to bottom,rgba(51,65,85,.3) 0,rgba(51,65,85,.3) 1px,transparent 1px,transparent 38px)}
426
+ .board{grid-template-columns:repeat(5,minmax(210px,1fr));margin-top:18px;overflow:hidden}.board article{min-height:220px;padding:14px}.board h2{min-height:34px;margin:0 0 12px;color:#cbd5e1;font-size:.82rem}.card{min-height:92px;border:1px solid rgba(255,255,255,.06);border-radius:12px;padding:10px;background:rgba(2,6,23,.56)}.pill{width:52px;height:15px;margin-top:14px}
427
+ .eyebrow:after,.line:after,.value:after,.action:after,.chart:after,.pill:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(125,211,252,.12),transparent);animation:shine 1.35s ease-in-out infinite;transform:translateX(-100%)}
428
+ @keyframes shine{to{transform:translateX(100%)}}@media(max-width:860px){.kpis{grid-template-columns:repeat(2,1fr)}.panels{grid-template-columns:1fr}.board{overflow-x:auto}}
429
+ </style>
430
+ </head>
431
+ <body>
432
+ <main aria-label="Preparando dashboard">
433
+ <header><div><span class="eyebrow"></span><h1>Dashboard Zaip AIOS</h1></div><div class="actions"><span class="action"></span><span class="action"></span><span class="action"></span></div></header>
434
+ <section class="kpis">${Array.from({ length: 4 }, () => '<article><span class="line"></span><span class="value"></span><span class="line"></span></article>').join("")}</section>
435
+ <section class="panels"><article><span class="line"></span><div class="chart"></div></article><article><span class="line"></span><div class="chart"></div></article></section>
436
+ <section class="board">${["Definição", "Planejamento", "Pronto para Executar", "Execução", "Verificação"].map((label) => `<article><h2>${label}</h2><div class="card"><span class="line"></span><span class="line"></span><span class="pill"></span></div></article>`).join("")}</section>
437
+ </main>
438
+ <script>
439
+ async function waitForDashboard(){
440
+ try{
441
+ const response=await fetch("${healthPath}",{cache:"no-store"});
442
+ const payload=await response.json();
443
+ if(response.ok&&payload.kind==="${runtimeKind}"){location.reload();return}
444
+ }catch{}
445
+ setTimeout(waitForDashboard,250)
446
+ }
447
+ setTimeout(waitForDashboard,100)
448
+ </script>
449
+ </body>
450
+ </html>`);
451
+ });
452
+ await new Promise((resolveListen, rejectListen) => {
453
+ server.once("error", rejectListen);
454
+ server.listen({ host, port }, resolveListen);
455
+ });
456
+ server.unref();
457
+ const address = server.address();
458
+ const listeningPort = typeof address === "object" && address !== null ? address.port : port;
459
+ return {
460
+ port: listeningPort,
461
+ close: () =>
462
+ new Promise((resolveClose, rejectClose) => {
463
+ server.close((error) => (error ? rejectClose(error) : resolveClose()));
464
+ }),
465
+ };
466
+ }
467
+
468
+ async function assertRuntimeReady() {
469
+ const serverPath = (await exists(sourceServer)) ? sourceServer : installedServer;
470
+ if (!(await exists(serverPath))) {
471
+ throw new Error(
472
+ "Dashboard server bundle is missing; run the ZAIP release build or reinstall ZAIP-AIOS",
473
+ );
474
+ }
475
+ if (!(await exists(resolve(frontendRoot, "index.html")))) {
476
+ throw new Error(
477
+ "Dashboard frontend bundle is missing; run the ZAIP release build or reinstall ZAIP-AIOS",
478
+ );
479
+ }
480
+ return serverPath;
481
+ }
482
+
483
+ async function stopOwnedDashboard(session) {
484
+ if (!(await probeDashboardPort(session?.port, fetch, workspaceKey, false))) return true;
485
+ if (!Number.isInteger(session?.rootPid) || session.rootPid <= 0) return false;
486
+ await stopProcessTree(session.rootPid);
487
+ const deadline = Date.now() + 5_000;
488
+ while (Date.now() < deadline) {
489
+ if (!(await probeDashboardPort(session.port))) return true;
490
+ await delay(100);
491
+ }
492
+ return false;
493
+ }
494
+
495
+ async function stopProcessTree(pid) {
496
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) return;
497
+ if (process.platform === "win32") {
498
+ await new Promise((resolveStop) => {
499
+ const killer = spawn("taskkill", ["/pid", String(pid), "/t", "/f"], {
500
+ stdio: "ignore",
501
+ windowsHide: true,
502
+ });
503
+ killer.once("error", () => resolveStop());
504
+ killer.once("exit", () => resolveStop());
505
+ });
506
+ return;
507
+ }
508
+ try {
509
+ process.kill(pid, "SIGTERM");
510
+ } catch {
511
+ // A stale recorded PID is already stopped.
512
+ }
513
+ }
514
+
515
+ async function previousDashboardSessions() {
516
+ const session = await readDashboardSession();
517
+ const registryEntries = (await readPortRegistry()).filter((entry) => entry.status === "active");
518
+ const candidates = [session, ...registryEntries].filter(Boolean);
519
+ return candidates.filter(
520
+ (candidate, index) =>
521
+ Number.isInteger(candidate.port) &&
522
+ candidates.findIndex(
523
+ (entry) => entry.port === candidate.port && entry.rootPid === candidate.rootPid,
524
+ ) === index,
525
+ );
526
+ }
527
+
528
+ async function startDashboardServer(serverPath, token, excludedPorts, initialPort = null) {
529
+ const failures = [];
530
+ for (let attempt = 1; attempt <= maxServerStartAttempts; attempt += 1) {
531
+ const port =
532
+ attempt === 1 && Number.isInteger(initialPort)
533
+ ? initialPort
534
+ : await findAvailablePortWithFallback({ excludedPorts: [...excludedPorts] });
535
+ excludedPorts.add(port);
536
+ let stderr = "";
537
+ const child = spawn(process.execPath, [serverPath], {
538
+ cwd: packageRoot,
539
+ env: {
540
+ ...process.env,
541
+ ZAIP_WORKSPACE: workspaceRoot,
542
+ ZAIP_UI_ROOT: frontendRoot,
543
+ ZAIP_UI_TOKEN: token,
544
+ ZAIP_SERVER_PORT: String(port),
545
+ },
546
+ stdio: ["ignore", "ignore", "pipe"],
547
+ windowsHide: true,
548
+ });
549
+ child.stderr?.setEncoding("utf8");
550
+ child.stderr?.on("data", (chunk) => {
551
+ stderr = `${stderr}${chunk}`.slice(-4_000);
552
+ });
553
+ try {
554
+ await waitForDashboard(port, child);
555
+ return { child, port };
556
+ } catch (error) {
557
+ await stopProcessTree(child.pid);
558
+ const detail = stderr.trim();
559
+ failures.push(`porta ${port}: ${error.message}${detail ? ` — ${detail}` : ""}`);
560
+ appendLauncherLog(
561
+ `Dashboard start attempt ${attempt} failed on port ${port}: ${error.message}`,
562
+ );
563
+ if (error.retryable === false) break;
564
+ }
565
+ }
566
+ throw new Error(
567
+ `Não foi possível iniciar o dashboard após os fallbacks. ${failures.join(" | ")}`,
568
+ );
569
+ }
570
+
571
+ async function writeLauncherStatus(status, message = "") {
572
+ const path = process.env.ZAIP_LAUNCH_STATUS;
573
+ if (!path) return;
574
+ const temporaryPath = `${path}.${process.pid}.tmp`;
575
+ await writeFile(temporaryPath, `${status}\n${message}`.trimEnd(), "utf8");
576
+ await rename(temporaryPath, path);
577
+ }
578
+
579
+ async function main() {
580
+ let ownedChild = null;
581
+ let currentSession = null;
582
+ let launchPage = null;
583
+
584
+ await withLauncherLock(async () => {
585
+ const buildSignature = await ensureFreshDashboardBuild();
586
+ const reusable = await findReusableDashboardSession({ expectedBuildSignature: buildSignature });
587
+ if (reusable !== null) {
588
+ await writeDashboardSession(reusable);
589
+ await recordPortStatus(reusable, "active");
590
+ if (!(await openBrowser(dashboardUrl(reusable.port, reusable.token)))) {
591
+ throw new Error(
592
+ "O dashboard está saudável, mas nenhuma opção conseguiu abrir o navegador padrão.",
593
+ );
594
+ }
595
+ await writeLauncherStatus("ok");
596
+ return;
597
+ }
598
+
599
+ const previousSessions = await previousDashboardSessions();
600
+ const excludedPorts = new Set(previousSessions.map((session) => session.port));
601
+ const token = process.env.ZAIP_UI_TOKEN ?? randomBytes(24).toString("base64url");
602
+ const launchPort = await findAvailablePortWithFallback({ excludedPorts: [...excludedPorts] });
603
+ launchPage = await startDashboardLaunchPage(launchPort);
604
+ if (!(await openBrowser(dashboardUrl(launchPort, token)))) {
605
+ await launchPage.close();
606
+ launchPage = null;
607
+ throw new Error("Não foi possível abrir a preparação do dashboard no navegador padrão.");
608
+ }
609
+
610
+ const serverPath = await assertRuntimeReady();
611
+ await launchPage.close();
612
+ launchPage = null;
613
+ const { child, port } = await startDashboardServer(
614
+ serverPath,
615
+ token,
616
+ excludedPorts,
617
+ launchPort,
618
+ );
619
+ ownedChild = child;
620
+ try {
621
+ if (port !== launchPort && !(await openBrowser(dashboardUrl(port, token)))) {
622
+ throw new Error(
623
+ "O dashboard iniciou em uma porta alternativa, mas não foi possível abrir essa URL.",
624
+ );
625
+ }
626
+ currentSession = {
627
+ kind: runtimeKind,
628
+ workspace: workspaceRoot,
629
+ workspaceKey,
630
+ rootPid: process.pid,
631
+ serverPid: child.pid,
632
+ port,
633
+ token,
634
+ buildSignature,
635
+ createdAt: new Date().toISOString(),
636
+ };
637
+ await writeDashboardSession(currentSession);
638
+ await recordPortStatus(currentSession, "active");
639
+ const warnings = [];
640
+ for (const previous of previousSessions) {
641
+ const stopped = await stopOwnedDashboard(previous);
642
+ await recordPortStatus(previous, stopped ? "closed" : "close_failed");
643
+ if (!stopped) warnings.push(`não foi possível fechar a porta anterior ${previous.port}`);
644
+ }
645
+ await writeLauncherStatus(warnings.length > 0 ? "warning" : "ok", warnings.join("; "));
646
+ } catch (error) {
647
+ await stopProcessTree(child.pid);
648
+ if (currentSession !== null) await recordPortStatus(currentSession, "failed");
649
+ await clearOwnedDashboardSession();
650
+ throw error;
651
+ }
652
+ });
653
+
654
+ if (ownedChild === null) return;
655
+ for (const signal of ["SIGINT", "SIGTERM"]) {
656
+ process.once(signal, () => ownedChild?.kill(signal));
657
+ }
658
+ const exitCode = await new Promise((resolveExit, rejectExit) => {
659
+ ownedChild.once("error", rejectExit);
660
+ ownedChild.once("exit", (code) => resolveExit(code ?? 0));
661
+ });
662
+ await clearOwnedDashboardSession();
663
+ if (currentSession !== null) await recordPortStatus(currentSession, "closed");
664
+ process.exitCode = exitCode;
665
+ }
666
+
667
+ function isPortFree(port) {
668
+ return new Promise((resolvePort) => {
669
+ const server = createServer();
670
+ server.unref();
671
+ server.once("error", () => resolvePort(false));
672
+ server.listen({ host, port }, () => server.close(() => resolvePort(true)));
673
+ });
674
+ }
675
+
676
+ async function waitForDashboard(port, child) {
677
+ const deadline = Date.now() + startupTimeoutMs;
678
+ while (Date.now() < deadline) {
679
+ if (child.exitCode !== null) {
680
+ throw new Error(`Dashboard server exited before becoming healthy (${child.exitCode})`);
681
+ }
682
+ try {
683
+ const response = await fetch(dashboardHealthUrl(port), { signal: AbortSignal.timeout(750) });
684
+ const payload = await response.json().catch(() => null);
685
+ if (response.ok && payload?.kind === runtimeKind && payload?.workspaceKey === workspaceKey) {
686
+ return;
687
+ }
688
+ if (response.status >= 500) {
689
+ const unavailable = new Error(
690
+ `Dashboard health returned ${response.status}: ${payload?.error ?? "service unavailable"}`,
691
+ );
692
+ unavailable.retryable = false;
693
+ throw unavailable;
694
+ }
695
+ } catch (error) {
696
+ if (error?.retryable === false) throw error;
697
+ }
698
+ await delay(250);
699
+ }
700
+ throw new Error(`Timed out waiting for ${dashboardHealthUrl(port)}`);
701
+ }
702
+
703
+ function exists(path) {
704
+ return access(path).then(
705
+ () => true,
706
+ () => false,
707
+ );
708
+ }
709
+
710
+ function delay(milliseconds) {
711
+ return new Promise((resolveDelay) => setTimeout(resolveDelay, milliseconds));
712
+ }
713
+
714
+ const isMain = process.argv[1]
715
+ ? resolve(process.argv[1]) === fileURLToPath(import.meta.url)
716
+ : false;
717
+
718
+ if (isMain) {
719
+ main().catch(async (error) => {
720
+ const logMessage = error instanceof Error ? (error.stack ?? error.message) : String(error);
721
+ const userMessage = formatLauncherError(error instanceof Error ? error.message : String(error));
722
+ appendLauncherLog(logMessage);
723
+ await writeLauncherStatus("error", userMessage).catch(() => {});
724
+ process.exitCode = 1;
725
+ });
726
+ }