@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,199 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { dirname, join, relative, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { afterEach, describe, expect, it } from "vitest";
7
+ import { doctorProject } from "./doctor.js";
8
+ import { installAgentsTemplate } from "./install-agents-template.js";
9
+ import { loadTemplate, validateTemplatePath } from "./template-manifest.js";
10
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
11
+ const templateDirectory = resolve(packageRoot, "templates");
12
+ const roots = [];
13
+ let turnSequence = 0;
14
+ afterEach(async () => {
15
+ await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
16
+ });
17
+ describe("public lifecycle runtime template", { timeout: 90_000 }, () => {
18
+ it("rejects descendants of allowlisted runtime files", () => {
19
+ expect(() => validateTemplatePath(".zaip-aios/LICENSE/payload")).toThrow("outside");
20
+ expect(() => validateTemplatePath(".zaip-aios/bin/zaip.mjs")).not.toThrow();
21
+ });
22
+ it.each([
23
+ "after-stage",
24
+ "after-backup",
25
+ "after-runtime",
26
+ "after-manifest",
27
+ ])("restores runtime and manifest after an injected %s sync failure", async (failurePoint) => {
28
+ const root = await mkdtemp(join(tmpdir(), "zaip-runtime-sync-rollback-"));
29
+ roots.push(root);
30
+ const templates = resolve(root, "templates");
31
+ const runtime = resolve(templates, ".zaip-aios");
32
+ const manifestPath = resolve(templates, "template-manifest.json");
33
+ const originalManifest = `${JSON.stringify({ files: [], marker: "original" })}\n`;
34
+ await mkdir(runtime, { recursive: true });
35
+ await writeFile(resolve(runtime, "original.txt"), "preserve-me", "utf8");
36
+ await mkdir(resolve(runtime, "nested"), { recursive: true });
37
+ await writeFile(resolve(runtime, "nested/state.bin"), Buffer.from([0, 1, 2, 255]));
38
+ await writeFile(manifestPath, originalManifest, "utf8");
39
+ const before = await snapshotTree(templates);
40
+ const result = spawnSync(process.execPath, [resolve(packageRoot, "scripts/sync-runtime-template.mjs")], {
41
+ cwd: packageRoot,
42
+ encoding: "utf8",
43
+ windowsHide: true,
44
+ env: {
45
+ ...process.env,
46
+ ZAIP_PUBLIC_TEMPLATE_ROOT: templates,
47
+ ZAIP_RUNTIME_SYNC_FAIL_AT: failurePoint,
48
+ },
49
+ });
50
+ expect(result.status).not.toBe(0);
51
+ expect(await snapshotTree(templates)).toEqual(before);
52
+ });
53
+ it("installs the checksum-verified runtime used by generated guidance", async () => {
54
+ const template = await loadTemplate(templateDirectory, "1.0.1");
55
+ const runtime = template.files.find((file) => file.path === ".zaip-aios/bin/zaip.mjs");
56
+ expect(runtime?.binary).toBe(true);
57
+ expect(runtime?.content).toEqual(await readFile(resolve(templateDirectory, ".zaip-aios/bin/zaip.mjs")));
58
+ expect(template.manifest.runtimeFilesSha256).toMatch(/^[a-f0-9]{64}$/);
59
+ });
60
+ it("executes capture and activation commands in a clean installed workspace", async () => {
61
+ const root = await mkdtemp(join(tmpdir(), "zaip-public-runtime-"));
62
+ roots.push(root);
63
+ await installAgentsTemplate({ cwd: root, templateDirectory, cliVersion: "1.0.1" });
64
+ const runtime = resolve(root, ".zaip-aios/bin/zaip.mjs");
65
+ expect(run(runtime, root, ["status", "--json"]).enabled).toBe(true);
66
+ expect(run(runtime, root, ["disable", "--json"]).enabled).toBe(false);
67
+ expect(run(runtime, root, ["status", "--json"]).enabled).toBe(false);
68
+ expect(run(runtime, root, ["enable", "--json"]).enabled).toBe(true);
69
+ expect(run(runtime, root, ["conversation", "start", "--intent", "conversation", "--json"]).run).toMatchObject({ phase: "conversation", task_id: null });
70
+ });
71
+ it("reports a missing runtime and restores it transactionally", async () => {
72
+ const root = await mkdtemp(join(tmpdir(), "zaip-public-runtime-missing-"));
73
+ roots.push(root);
74
+ await installAgentsTemplate({ cwd: root, templateDirectory, cliVersion: "1.0.1" });
75
+ const runtime = resolve(root, ".zaip-aios/bin/zaip.mjs");
76
+ await rm(runtime);
77
+ await expect(doctorProject(root)).resolves.toMatchObject({
78
+ valid: false,
79
+ findings: expect.arrayContaining([
80
+ expect.objectContaining({
81
+ path: ".zaip-aios/bin/zaip.mjs",
82
+ message: expect.stringContaining("runtime"),
83
+ }),
84
+ ]),
85
+ });
86
+ const repaired = await installAgentsTemplate({
87
+ cwd: root,
88
+ templateDirectory,
89
+ cliVersion: "1.0.1",
90
+ });
91
+ expect(repaired.applied).toBe(true);
92
+ expect(repaired.created).toContain(".zaip-aios/bin/zaip.mjs");
93
+ await expect(readFile(runtime)).resolves.toHaveLength((await readFile(resolve(templateDirectory, ".zaip-aios/bin/zaip.mjs"))).length);
94
+ });
95
+ it("converges attributed work when a public runtime Run finishes", async () => {
96
+ const root = await mkdtemp(join(tmpdir(), "zaip-public-runtime-closure-"));
97
+ roots.push(root);
98
+ await installAgentsTemplate({ cwd: root, templateDirectory, cliVersion: "1.0.1" });
99
+ const runtime = resolve(root, ".zaip-aios/bin/zaip.mjs");
100
+ const ids = {
101
+ task: "TASK-2026-07-17-21-03-PUBLIC-CLOSURE-A7K2",
102
+ change: "CHG-2026-07-17-21-03-PUBLIC-CLOSURE-A7K2",
103
+ execution: "EXEC-2026-07-17-21-03-PUBLIC-CLOSURE-A7K2",
104
+ run: "RUN-2026-07-17-21-03-PUBLIC-CLOSURE-A7K2",
105
+ };
106
+ expect(run(runtime, root, [
107
+ "task",
108
+ "create",
109
+ "--id",
110
+ ids.task,
111
+ "--change",
112
+ ids.change,
113
+ "--execution",
114
+ ids.execution,
115
+ "--title",
116
+ "Public closure",
117
+ "--short-name",
118
+ "public-closure",
119
+ "--objective",
120
+ "Prove public terminal convergence",
121
+ "--requirements",
122
+ "REQ-WORK-006",
123
+ "--acceptance",
124
+ "AC-WORK-006-01,AC-WORK-006-04",
125
+ "--write-scopes",
126
+ "packages/public",
127
+ "--json",
128
+ ]).task).toMatchObject({ status: "draft" });
129
+ expect(run(runtime, root, ["task", "prepare", ids.task, "--execution", ids.execution, "--json"])
130
+ .task).toMatchObject({ status: "planned" });
131
+ run(runtime, root, ["task", "execute", ids.task, "--json"]);
132
+ run(runtime, root, [
133
+ "run",
134
+ "start",
135
+ "--id",
136
+ ids.run,
137
+ "--short-name",
138
+ "public-closure",
139
+ "--phase",
140
+ "execution",
141
+ "--entrypoint",
142
+ "task",
143
+ "--work-type",
144
+ "new",
145
+ "--client",
146
+ "codex",
147
+ "--model",
148
+ "gpt-5.6-terra",
149
+ "--execution",
150
+ ids.execution,
151
+ "--task",
152
+ ids.task,
153
+ "--change",
154
+ ids.change,
155
+ "--json",
156
+ ]);
157
+ const finished = run(runtime, root, [
158
+ "run",
159
+ "finish",
160
+ ids.run,
161
+ "--summary",
162
+ "No completed assurance was supplied",
163
+ "--json",
164
+ ]);
165
+ expect(finished.reconciliation).toMatchObject({ outcome: "blocked" });
166
+ expect(run(runtime, root, ["task", "show", ids.task, "--json"]).task).toMatchObject({
167
+ status: "blocked",
168
+ status_reason: expect.stringContaining("Finalization barrier missing"),
169
+ });
170
+ });
171
+ });
172
+ function run(runtime, cwd, arguments_) {
173
+ const result = spawnSync(process.execPath, [runtime, ...arguments_], {
174
+ cwd,
175
+ encoding: "utf8",
176
+ windowsHide: true,
177
+ env: {
178
+ ...process.env,
179
+ CODEX_THREAD_ID: "runtime-template-test-thread",
180
+ CODEX_TURN_ID: `runtime-template-test-${++turnSequence}`,
181
+ },
182
+ });
183
+ if (result.status !== 0) {
184
+ throw new Error(`Runtime command failed (${result.status}): ${result.stderr || result.stdout}`);
185
+ }
186
+ return JSON.parse(result.stdout);
187
+ }
188
+ async function snapshotTree(root) {
189
+ const entries = await readdir(root, { recursive: true, withFileTypes: true });
190
+ const files = entries
191
+ .filter((entry) => entry.isFile())
192
+ .map((entry) => resolve(entry.parentPath, entry.name))
193
+ .sort();
194
+ return Object.fromEntries(await Promise.all(files.map(async (path) => [
195
+ relative(root, path).replaceAll("\\", "/"),
196
+ (await readFile(path)).toString("base64"),
197
+ ])));
198
+ }
199
+ //# sourceMappingURL=runtime-template.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-template.test.js","sourceRoot":"","sources":["../../src/services/runtime-template.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACz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AK,CAAC,2BAA2B,MAAM,CAAC,MAAM,MAAM,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAA4B,CAAC;AAC9D,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,IAAY;IACtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,OAAO;SAClB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;SACjC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;SACrD,IAAI,EAAE,CAAC;IACV,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC;QACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;QAC1C,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAC1C,CAAC,CACH,CACF,CAAC;AACJ,CAAC"}
@@ -1,23 +1,27 @@
1
1
  export interface TemplateManifestFile {
2
2
  path: string;
3
3
  sha256: string;
4
+ binary?: boolean;
4
5
  }
5
6
  export interface TemplateManifest {
6
7
  schemaVersion: 1;
7
8
  templateVersion: string;
8
9
  minimumCliVersion: string;
9
10
  source: string;
11
+ sourceFilesSha256: string;
12
+ runtimeFilesSha256: string;
10
13
  files: readonly TemplateManifestFile[];
11
14
  }
12
15
  export interface LoadedTemplateFile extends TemplateManifestFile {
13
- content: string;
16
+ content: string | Buffer;
14
17
  }
15
18
  export interface LoadedTemplate {
16
19
  manifest: TemplateManifest;
17
20
  files: readonly LoadedTemplateFile[];
18
21
  }
19
22
  export declare function defaultTemplateDirectory(): string;
20
- export declare function loadTemplate(directory?: string): Promise<LoadedTemplate>;
23
+ export declare function loadTemplate(directory?: string, currentCliVersion?: string): Promise<LoadedTemplate>;
21
24
  export declare function validateTemplatePath(path: string): void;
22
25
  export declare function sha256(content: string | Buffer): string;
26
+ export declare function digestRuntimeFiles(files: readonly Pick<LoadedTemplateFile, "path" | "content">[]): string;
23
27
  //# sourceMappingURL=template-manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template-manifest.d.ts","sourceRoot":"","sources":["../../src/services/template-manifest.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,CAAC,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtC;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,wBAAsB,YAAY,CAChC,SAAS,SAA6B,GACrC,OAAO,CAAC,cAAc,CAAC,CAmBzB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAmBvD;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEvD"}
1
+ {"version":3,"file":"template-manifest.d.ts","sourceRoot":"","sources":["../../src/services/template-manifest.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,CAAC,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtC;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD;AAED,wBAAsB,YAAY,CAChC,SAAS,SAA6B,EACtC,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,cAAc,CAAC,CAmCzB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAyDvD;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,GAC7D,MAAM,CAQR"}
@@ -5,40 +5,96 @@ import { fileURLToPath } from "node:url";
5
5
  export function defaultTemplateDirectory() {
6
6
  return resolve(dirname(fileURLToPath(import.meta.url)), "../../templates");
7
7
  }
8
- export async function loadTemplate(directory = defaultTemplateDirectory()) {
8
+ export async function loadTemplate(directory = defaultTemplateDirectory(), currentCliVersion) {
9
9
  const manifestPath = resolve(directory, "template-manifest.json");
10
10
  const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
11
11
  const manifest = validateManifest(parsed);
12
+ if (currentCliVersion !== undefined &&
13
+ compareVersions(currentCliVersion, manifest.minimumCliVersion) < 0) {
14
+ throw new Error(`Template ${manifest.templateVersion} requires CLI ${manifest.minimumCliVersion} or newer; current CLI is ${currentCliVersion}`);
15
+ }
12
16
  const files = [];
13
17
  for (const record of manifest.files) {
14
18
  const absolute = resolve(directory, record.path);
15
- const content = await readFile(absolute, "utf8");
19
+ const bytes = await readFile(absolute);
20
+ const content = record.binary ? bytes : bytes.toString("utf8");
16
21
  const actual = sha256(content);
17
22
  if (actual !== record.sha256) {
18
23
  throw new Error(`Template integrity check failed for ${record.path}: expected ${record.sha256}, got ${actual}`);
19
24
  }
20
25
  files.push({ ...record, content });
21
26
  }
27
+ const runtimeFilesSha256 = digestRuntimeFiles(files);
28
+ if (runtimeFilesSha256 !== manifest.runtimeFilesSha256) {
29
+ throw new Error(`Runtime template digest drifted: expected ${manifest.runtimeFilesSha256}, got ${runtimeFilesSha256}`);
30
+ }
22
31
  return { manifest, files };
23
32
  }
24
33
  export function validateTemplatePath(path) {
25
- if (!path.startsWith(".agents/") ||
26
- path.includes("\\") ||
34
+ if (path.includes("\\") ||
27
35
  path.includes("\0") ||
28
36
  path.startsWith("/") ||
29
37
  /^[A-Za-z]:/.test(path) ||
30
38
  path.split("/").some((part) => part.length === 0 || part === "." || part === "..")) {
31
39
  throw new Error(`Unsafe template path: ${path}`);
32
40
  }
33
- const root = path.split("/")[1];
34
- if (root === undefined ||
35
- !new Set(["config", "rules", "requirements", "skills", "data"]).has(root)) {
36
- throw new Error(`Template path is outside the public V2 roots: ${path}`);
41
+ const parts = path.split("/");
42
+ const [namespace, root] = parts;
43
+ if (namespace === ".agents") {
44
+ if (root === undefined ||
45
+ !new Set([
46
+ "config",
47
+ "rules",
48
+ "requirements",
49
+ "skills",
50
+ "zaip-aios",
51
+ "tools",
52
+ "data",
53
+ "dashboard",
54
+ "design",
55
+ ]).has(root)) {
56
+ throw new Error(`Template path is outside the public V2 roots: ${path}`);
57
+ }
58
+ return;
37
59
  }
60
+ if (namespace === ".zaip-aios") {
61
+ const releaseRoots = new Set([
62
+ "bin",
63
+ "dashboard",
64
+ "design",
65
+ "migrations",
66
+ "pricing",
67
+ "profiles",
68
+ "schemas",
69
+ "templates",
70
+ ]);
71
+ const releaseFiles = new Set([
72
+ "LICENSE",
73
+ "THIRD_PARTY_NOTICES.md",
74
+ "VERSION",
75
+ "checksums.sha256",
76
+ "manifest.json",
77
+ "sbom.cdx.json",
78
+ ]);
79
+ if (root !== undefined && releaseRoots.has(root) && parts.length >= 3)
80
+ return;
81
+ if (root !== undefined && releaseFiles.has(root) && parts.length === 2)
82
+ return;
83
+ }
84
+ throw new Error(`Template path is outside the public ZAIP roots: ${path}`);
38
85
  }
39
86
  export function sha256(content) {
40
87
  return createHash("sha256").update(content).digest("hex");
41
88
  }
89
+ export function digestRuntimeFiles(files) {
90
+ const digest = createHash("sha256");
91
+ for (const file of files
92
+ .filter((candidate) => candidate.path.startsWith(".zaip-aios/"))
93
+ .toSorted((left, right) => left.path.localeCompare(right.path))) {
94
+ digest.update(file.path).update("\0").update(file.content).update("\0");
95
+ }
96
+ return digest.digest("hex");
97
+ }
42
98
  function validateManifest(value) {
43
99
  if (typeof value !== "object" || value === null)
44
100
  throw new Error("Invalid template manifest");
@@ -47,6 +103,10 @@ function validateManifest(value) {
47
103
  typeof candidate.templateVersion !== "string" ||
48
104
  typeof candidate.minimumCliVersion !== "string" ||
49
105
  typeof candidate.source !== "string" ||
106
+ typeof candidate.sourceFilesSha256 !== "string" ||
107
+ !/^[a-f0-9]{64}$/.test(candidate.sourceFilesSha256) ||
108
+ typeof candidate.runtimeFilesSha256 !== "string" ||
109
+ !/^[a-f0-9]{64}$/.test(candidate.runtimeFilesSha256) ||
50
110
  !Array.isArray(candidate.files)) {
51
111
  throw new Error("Invalid template manifest fields");
52
112
  }
@@ -57,21 +117,44 @@ function validateManifest(value) {
57
117
  const file = entry;
58
118
  if (typeof file.path !== "string" ||
59
119
  typeof file.sha256 !== "string" ||
60
- !/^[a-f0-9]{64}$/.test(file.sha256)) {
120
+ !/^[a-f0-9]{64}$/.test(file.sha256) ||
121
+ (file.binary !== undefined && typeof file.binary !== "boolean")) {
61
122
  throw new Error("Invalid manifest file fields");
62
123
  }
63
124
  validateTemplatePath(file.path);
64
125
  if (seen.has(file.path))
65
126
  throw new Error(`Duplicate template path: ${file.path}`);
66
127
  seen.add(file.path);
67
- return { path: file.path, sha256: file.sha256 };
128
+ return {
129
+ path: file.path,
130
+ sha256: file.sha256,
131
+ ...(file.binary === true ? { binary: true } : {}),
132
+ };
68
133
  });
69
134
  return {
70
135
  schemaVersion: 1,
71
136
  templateVersion: candidate.templateVersion,
72
137
  minimumCliVersion: candidate.minimumCliVersion,
73
138
  source: candidate.source,
139
+ sourceFilesSha256: candidate.sourceFilesSha256,
140
+ runtimeFilesSha256: candidate.runtimeFilesSha256,
74
141
  files,
75
142
  };
76
143
  }
144
+ function compareVersions(left, right) {
145
+ const parse = (value) => {
146
+ const match = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(value);
147
+ if (match === null)
148
+ throw new Error(`Invalid semantic version: ${value}`);
149
+ return match.slice(1, 4).map(Number);
150
+ };
151
+ const leftParts = parse(left);
152
+ const rightParts = parse(right);
153
+ for (let index = 0; index < 3; index += 1) {
154
+ const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
155
+ if (difference !== 0)
156
+ return Math.sign(difference);
157
+ }
158
+ return 0;
159
+ }
77
160
  //# sourceMappingURL=template-manifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template-manifest.js","sourceRoot":"","sources":["../../src/services/template-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,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rD,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface TransactionalWrite {
2
+ path: string;
3
+ content: string | Buffer;
4
+ }
5
+ export interface TransactionalDelete {
6
+ path: string;
7
+ }
8
+ export declare function applyTransactionalWrites(root: string, writes: readonly TransactionalWrite[], failAfterWrites?: number): Promise<void>;
9
+ export declare function applyTransactionalChanges(root: string, writes: readonly TransactionalWrite[], deletes: readonly TransactionalDelete[], failAfterChanges?: number): Promise<void>;
10
+ export declare function assertSafeDestination(root: string, portablePath: string): Promise<void>;
11
+ //# sourceMappingURL=transactional-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactional-files.d.ts","sourceRoot":"","sources":["../../src/services/transactional-files.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAQD,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,kBAAkB,EAAE,EACrC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,kBAAkB,EAAE,EACrC,OAAO,EAAE,SAAS,mBAAmB,EAAE,EACvC,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAiDf;AA2BD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B7F"}
@@ -0,0 +1,114 @@
1
+ import { lstat, mkdir, readFile, rename, rm, rmdir, writeFile } from "node:fs/promises";
2
+ import { dirname, relative, resolve, sep } from "node:path";
3
+ export async function applyTransactionalWrites(root, writes, failAfterWrites) {
4
+ await applyTransactionalChanges(root, writes, [], failAfterWrites);
5
+ }
6
+ export async function applyTransactionalChanges(root, writes, deletes, failAfterChanges) {
7
+ const normalizedRoot = resolve(root);
8
+ const snapshots = [];
9
+ const operations = [
10
+ ...writes.map((write) => ({ type: "write", ...write })),
11
+ ...deletes.map((deletion) => ({ type: "delete", ...deletion })),
12
+ ];
13
+ for (const operation of operations) {
14
+ await assertSafeDestination(normalizedRoot, operation.path);
15
+ const absolute = resolve(normalizedRoot, operation.path);
16
+ const current = await readFile(absolute).catch((error) => {
17
+ if (isNotFound(error))
18
+ return null;
19
+ throw error;
20
+ });
21
+ snapshots.push({
22
+ path: operation.path,
23
+ content: current ?? Buffer.alloc(0),
24
+ existed: current !== null,
25
+ });
26
+ }
27
+ let completed = 0;
28
+ let touched = 0;
29
+ let temporary = null;
30
+ try {
31
+ for (const operation of operations) {
32
+ if (failAfterChanges !== undefined && completed >= failAfterChanges) {
33
+ throw new Error("Injected transactional write failure");
34
+ }
35
+ touched = completed + 1;
36
+ const absolute = resolve(normalizedRoot, operation.path);
37
+ if (operation.type === "write") {
38
+ await mkdir(dirname(absolute), { recursive: true });
39
+ temporary = `${absolute}.zaip-tmp-${process.pid}-${completed}`;
40
+ await writeFile(temporary, operation.content, { flag: "wx" });
41
+ await rm(absolute, { force: true });
42
+ await rename(temporary, absolute);
43
+ temporary = null;
44
+ }
45
+ else {
46
+ await rm(absolute, { force: true });
47
+ }
48
+ completed += 1;
49
+ touched = completed;
50
+ }
51
+ }
52
+ catch (error) {
53
+ if (temporary !== null)
54
+ await rm(temporary, { force: true });
55
+ await rollback(normalizedRoot, snapshots.slice(0, touched));
56
+ throw error;
57
+ }
58
+ }
59
+ async function rollback(root, snapshots) {
60
+ for (const snapshot of [...snapshots].reverse()) {
61
+ const absolute = resolve(root, snapshot.path);
62
+ if (snapshot.existed) {
63
+ await mkdir(dirname(absolute), { recursive: true });
64
+ await writeFile(absolute, snapshot.content);
65
+ }
66
+ else {
67
+ await rm(absolute, { force: true });
68
+ await removeEmptyParents(root, dirname(absolute));
69
+ }
70
+ }
71
+ }
72
+ async function removeEmptyParents(root, start) {
73
+ let current = start;
74
+ while (current !== root && current.startsWith(`${root}${sep}`)) {
75
+ const removed = await rmdir(current).then(() => true, () => false);
76
+ if (!removed)
77
+ return;
78
+ current = dirname(current);
79
+ }
80
+ }
81
+ export async function assertSafeDestination(root, portablePath) {
82
+ if (portablePath.includes("\\") ||
83
+ portablePath.includes("\0") ||
84
+ portablePath.startsWith("/") ||
85
+ /^[A-Za-z]:/.test(portablePath) ||
86
+ portablePath.split("/").some((part) => part.length === 0 || part === "." || part === "..")) {
87
+ throw new Error(`Unsafe destination path: ${portablePath}`);
88
+ }
89
+ const normalizedRoot = resolve(root);
90
+ const destination = resolve(normalizedRoot, portablePath);
91
+ if (!destination.startsWith(`${normalizedRoot}${sep}`)) {
92
+ throw new Error(`Destination escapes project root: ${portablePath}`);
93
+ }
94
+ const parts = portablePath.split("/");
95
+ let current = normalizedRoot;
96
+ for (const part of parts) {
97
+ current = resolve(current, part);
98
+ const info = await lstat(current).catch((error) => {
99
+ if (isNotFound(error))
100
+ return null;
101
+ throw error;
102
+ });
103
+ if (info?.isSymbolicLink()) {
104
+ throw new Error(`Refusing to write through symlink: ${relative(root, current)}`);
105
+ }
106
+ if (current === destination && info !== null && !info.isFile()) {
107
+ throw new Error(`Destination is not a file: ${portablePath}`);
108
+ }
109
+ }
110
+ }
111
+ function isNotFound(error) {
112
+ return error instanceof Error && "code" in error && error.code === "ENOENT";
113
+ }
114
+ //# sourceMappingURL=transactional-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactional-files.js","sourceRoot":"","sources":["../../src/services/transactional-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC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EAAE,EAAE;YACzD,IAAI,UAAU,CAAC,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC;YACnC,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QACH,IAAI,IAAI,EAAE,cAAc,EAAE,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,OAAO,KAAK,WAAW,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,8BAA8B,YAAY,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC9E,CAAC"}
package/dist/types.d.ts CHANGED
@@ -9,6 +9,13 @@ export interface InitOptions {
9
9
  templateDirectory?: string;
10
10
  now?: Date;
11
11
  confirmForce?: (message: string) => Promise<boolean>;
12
+ cliVersion?: string;
13
+ /** Test-only override for the Codex user configuration directory. */
14
+ codexHome?: string;
15
+ /** Enables the user-level Codex configuration write; test callers opt in explicitly. */
16
+ installGlobalCodexConfig?: boolean;
17
+ /** Deterministic fault injection used by transactional rollback tests. */
18
+ failAfterWrites?: number;
12
19
  }
13
20
  export interface InitResult {
14
21
  root: string;
@@ -20,6 +27,12 @@ export interface InitResult {
20
27
  backupPath: string | null;
21
28
  dryRun: boolean;
22
29
  applied: boolean;
30
+ globalCodexConfig?: {
31
+ path: string;
32
+ sourcePath: string;
33
+ installed: boolean;
34
+ error: string | null;
35
+ };
23
36
  }
24
37
  export interface CliRuntime {
25
38
  cwd?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"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C;IACjB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB"}
@@ -0,0 +1,2 @@
1
+ export declare const CLI_VERSION: string;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,QAAsB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createRequire } from "node:module";
2
+ const packageJson = createRequire(import.meta.url)("../package.json");
3
+ if (typeof packageJson.version !== "string")
4
+ throw new Error("CLI package version is missing");
5
+ export const CLI_VERSION = packageJson.version;
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAA0B,CAAC;AAC/F,IAAI,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ;IAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAE/F,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC"}