@m2-ai/lattice-cli 0.0.0-stage → 0.8.7

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 (743) hide show
  1. package/DISCLOSURE +1 -0
  2. package/README.md +118 -2
  3. package/bundles/expo-mobile/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
  4. package/bundles/expo-mobile/.agents/skills/lattice-release-manager/SKILL.md +29 -0
  5. package/bundles/expo-mobile/.agents/skills/lattice-verify/SKILL.md +27 -0
  6. package/bundles/expo-mobile/.claude/agents/lattice-feature-agent.md +10 -0
  7. package/bundles/expo-mobile/.claude/agents/lattice-release-manager.md +9 -0
  8. package/bundles/expo-mobile/.claude/hooks/README.md +9 -0
  9. package/bundles/expo-mobile/.claude/hooks/pre-commit-verify.mjs +10 -0
  10. package/bundles/expo-mobile/.claude/hooks/pre-tool-use.mjs +51 -0
  11. package/bundles/expo-mobile/.claude/rules/lattice-core.md +20 -0
  12. package/bundles/expo-mobile/.claude/settings.json +38 -0
  13. package/bundles/expo-mobile/.claude/skills/lattice-verify/SKILL.md +27 -0
  14. package/bundles/expo-mobile/.codex/agents/lattice-feature-agent.toml +9 -0
  15. package/bundles/expo-mobile/.codex/agents/lattice-release-manager.toml +9 -0
  16. package/bundles/expo-mobile/.cursor/mcp.json +34 -0
  17. package/bundles/expo-mobile/.cursor/rules/lattice-core.mdc +35 -0
  18. package/bundles/expo-mobile/.cursor/rules.md +94 -0
  19. package/bundles/expo-mobile/.env.example +19 -0
  20. package/bundles/expo-mobile/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  21. package/bundles/expo-mobile/.github/agents/lattice-feature-agent.agent.md +7 -0
  22. package/bundles/expo-mobile/.github/agents/lattice-release-manager.agent.md +7 -0
  23. package/bundles/expo-mobile/.github/copilot-instructions.md +37 -0
  24. package/bundles/expo-mobile/.github/instructions/lattice-core.instructions.md +11 -0
  25. package/bundles/expo-mobile/.github/workflows/ci.yml +26 -0
  26. package/bundles/expo-mobile/.gitmessage +24 -0
  27. package/bundles/expo-mobile/.lattice/config.json +9 -0
  28. package/bundles/expo-mobile/.lattice/dependency-security.json +91 -0
  29. package/bundles/expo-mobile/.lattice/prompts/01-feature.md +36 -0
  30. package/bundles/expo-mobile/.lattice/prompts/02-bugfix.md +32 -0
  31. package/bundles/expo-mobile/.lattice/prompts/03-refactor.md +30 -0
  32. package/bundles/expo-mobile/.lattice/prompts/04-test.md +31 -0
  33. package/bundles/expo-mobile/.lattice/prompts/05-polish.md +38 -0
  34. package/bundles/expo-mobile/.lattice/prompts/06-security.md +32 -0
  35. package/bundles/expo-mobile/.lattice/release-workflow.json +55 -0
  36. package/bundles/expo-mobile/.lattice/schemas/feature-handoff.schema.json +264 -0
  37. package/bundles/expo-mobile/.lattice/templates/feature-handoff.json +52 -0
  38. package/bundles/expo-mobile/.mcp.json +35 -0
  39. package/bundles/expo-mobile/AGENTS.md +58 -0
  40. package/bundles/expo-mobile/CLAUDE.md +75 -0
  41. package/bundles/expo-mobile/PROJECT_GUIDE.md +299 -0
  42. package/bundles/expo-mobile/README.md +39 -0
  43. package/bundles/expo-mobile/__tests__/home.test.tsx +22 -0
  44. package/bundles/expo-mobile/app/_layout.tsx +20 -0
  45. package/bundles/expo-mobile/app/index.tsx +72 -0
  46. package/bundles/expo-mobile/app.json +33 -0
  47. package/bundles/expo-mobile/components/ui/Button.tsx +75 -0
  48. package/bundles/expo-mobile/components/ui/Input.tsx +50 -0
  49. package/bundles/expo-mobile/components/ui/index.ts +2 -0
  50. package/bundles/expo-mobile/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
  51. package/bundles/expo-mobile/docs/rules/codex.md +62 -0
  52. package/bundles/expo-mobile/eslint.config.js +7 -0
  53. package/bundles/expo-mobile/lib/supabase/client.ts +22 -0
  54. package/bundles/expo-mobile/lib/supabase/realtime.ts +10 -0
  55. package/bundles/expo-mobile/lib/supabase/storage.ts +6 -0
  56. package/bundles/expo-mobile/package.json +65 -0
  57. package/bundles/expo-mobile/plugins/with-lattice-commons-io.cjs +42 -0
  58. package/bundles/expo-mobile/prompts/01-feature-implementation.md +48 -0
  59. package/bundles/expo-mobile/prompts/02-bug-fix.md +43 -0
  60. package/bundles/expo-mobile/prompts/03-safe-refactor.md +38 -0
  61. package/bundles/expo-mobile/prompts/04-test-first.md +41 -0
  62. package/bundles/expo-mobile/prompts/05-ui-polish.md +44 -0
  63. package/bundles/expo-mobile/prompts/06-security-review.md +39 -0
  64. package/bundles/expo-mobile/prompts/quality.md +143 -0
  65. package/bundles/expo-mobile/supabase/migrations/001_initial_schema.sql +66 -0
  66. package/bundles/expo-mobile/tsconfig.json +21 -0
  67. package/bundles/expo-mobile/types/database.types.ts +76 -0
  68. package/bundles/expo-mobile/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
  69. package/bundles/expo-supabase/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
  70. package/bundles/expo-supabase/.agents/skills/lattice-release-manager/SKILL.md +29 -0
  71. package/bundles/expo-supabase/.agents/skills/lattice-verify/SKILL.md +27 -0
  72. package/bundles/expo-supabase/.claude/agents/lattice-feature-agent.md +10 -0
  73. package/bundles/expo-supabase/.claude/agents/lattice-release-manager.md +9 -0
  74. package/bundles/expo-supabase/.claude/hooks/README.md +9 -0
  75. package/bundles/expo-supabase/.claude/hooks/pre-commit-verify.mjs +10 -0
  76. package/bundles/expo-supabase/.claude/hooks/pre-tool-use.mjs +51 -0
  77. package/bundles/expo-supabase/.claude/rules/lattice-core.md +20 -0
  78. package/bundles/expo-supabase/.claude/settings.json +38 -0
  79. package/bundles/expo-supabase/.claude/skills/lattice-verify/SKILL.md +27 -0
  80. package/bundles/expo-supabase/.codex/agents/lattice-feature-agent.toml +9 -0
  81. package/bundles/expo-supabase/.codex/agents/lattice-release-manager.toml +9 -0
  82. package/bundles/expo-supabase/.cursor/mcp.json +34 -0
  83. package/bundles/expo-supabase/.cursor/rules/lattice-core.mdc +35 -0
  84. package/bundles/expo-supabase/.cursor/rules.md +94 -0
  85. package/bundles/expo-supabase/.env.example +12 -0
  86. package/bundles/expo-supabase/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  87. package/bundles/expo-supabase/.github/agents/lattice-feature-agent.agent.md +7 -0
  88. package/bundles/expo-supabase/.github/agents/lattice-release-manager.agent.md +7 -0
  89. package/bundles/expo-supabase/.github/copilot-instructions.md +37 -0
  90. package/bundles/expo-supabase/.github/instructions/lattice-core.instructions.md +11 -0
  91. package/bundles/expo-supabase/.github/workflows/ci.yml +26 -0
  92. package/bundles/expo-supabase/.gitmessage +24 -0
  93. package/bundles/expo-supabase/.lattice/config.json +9 -0
  94. package/bundles/expo-supabase/.lattice/dependency-security.json +91 -0
  95. package/bundles/expo-supabase/.lattice/prompts/01-feature.md +36 -0
  96. package/bundles/expo-supabase/.lattice/prompts/02-bugfix.md +32 -0
  97. package/bundles/expo-supabase/.lattice/prompts/03-refactor.md +30 -0
  98. package/bundles/expo-supabase/.lattice/prompts/04-test.md +31 -0
  99. package/bundles/expo-supabase/.lattice/prompts/05-polish.md +38 -0
  100. package/bundles/expo-supabase/.lattice/prompts/06-security.md +32 -0
  101. package/bundles/expo-supabase/.lattice/release-workflow.json +55 -0
  102. package/bundles/expo-supabase/.lattice/schemas/feature-handoff.schema.json +264 -0
  103. package/bundles/expo-supabase/.lattice/templates/feature-handoff.json +52 -0
  104. package/bundles/expo-supabase/.mcp.json +35 -0
  105. package/bundles/expo-supabase/AGENTS.md +58 -0
  106. package/bundles/expo-supabase/CLAUDE.md +75 -0
  107. package/bundles/expo-supabase/PROJECT_GUIDE.md +201 -0
  108. package/bundles/expo-supabase/README.md +38 -0
  109. package/bundles/expo-supabase/__tests__/home.test.tsx +22 -0
  110. package/bundles/expo-supabase/app/_layout.tsx +14 -0
  111. package/bundles/expo-supabase/app/index.tsx +72 -0
  112. package/bundles/expo-supabase/app.json +33 -0
  113. package/bundles/expo-supabase/components/ui/Button.tsx +75 -0
  114. package/bundles/expo-supabase/components/ui/Input.tsx +50 -0
  115. package/bundles/expo-supabase/components/ui/index.ts +2 -0
  116. package/bundles/expo-supabase/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
  117. package/bundles/expo-supabase/docs/rules/codex.md +62 -0
  118. package/bundles/expo-supabase/eslint.config.js +7 -0
  119. package/bundles/expo-supabase/lib/supabase/client.ts +22 -0
  120. package/bundles/expo-supabase/lib/supabase/realtime.ts +10 -0
  121. package/bundles/expo-supabase/lib/supabase/storage.ts +6 -0
  122. package/bundles/expo-supabase/package.json +60 -0
  123. package/bundles/expo-supabase/plugins/with-lattice-commons-io.cjs +42 -0
  124. package/bundles/expo-supabase/prompts/01-feature-implementation.md +8 -0
  125. package/bundles/expo-supabase/prompts/02-bug-fix.md +9 -0
  126. package/bundles/expo-supabase/prompts/03-safe-refactor.md +8 -0
  127. package/bundles/expo-supabase/prompts/04-test-first.md +7 -0
  128. package/bundles/expo-supabase/prompts/05-ui-polish.md +7 -0
  129. package/bundles/expo-supabase/prompts/06-security-review.md +7 -0
  130. package/bundles/expo-supabase/prompts/quality.md +143 -0
  131. package/bundles/expo-supabase/supabase/migrations/001_initial_schema.sql +66 -0
  132. package/bundles/expo-supabase/tsconfig.json +21 -0
  133. package/bundles/expo-supabase/types/database.types.ts +76 -0
  134. package/bundles/expo-supabase/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
  135. package/bundles/nextjs-landing/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
  136. package/bundles/nextjs-landing/.agents/skills/lattice-release-manager/SKILL.md +29 -0
  137. package/bundles/nextjs-landing/.agents/skills/lattice-verify/SKILL.md +27 -0
  138. package/bundles/nextjs-landing/.claude/agents/lattice-feature-agent.md +10 -0
  139. package/bundles/nextjs-landing/.claude/agents/lattice-release-manager.md +9 -0
  140. package/bundles/nextjs-landing/.claude/hooks/README.md +9 -0
  141. package/bundles/nextjs-landing/.claude/hooks/pre-commit-verify.mjs +10 -0
  142. package/bundles/nextjs-landing/.claude/hooks/pre-tool-use.mjs +51 -0
  143. package/bundles/nextjs-landing/.claude/rules/lattice-core.md +20 -0
  144. package/bundles/nextjs-landing/.claude/settings.json +38 -0
  145. package/bundles/nextjs-landing/.claude/skills/lattice-verify/SKILL.md +27 -0
  146. package/bundles/nextjs-landing/.codex/agents/lattice-feature-agent.toml +9 -0
  147. package/bundles/nextjs-landing/.codex/agents/lattice-release-manager.toml +9 -0
  148. package/bundles/nextjs-landing/.cursor/mcp.json +34 -0
  149. package/bundles/nextjs-landing/.cursor/rules/lattice-core.mdc +35 -0
  150. package/bundles/nextjs-landing/.cursor/rules.md +95 -0
  151. package/bundles/nextjs-landing/.env.example +24 -0
  152. package/bundles/nextjs-landing/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  153. package/bundles/nextjs-landing/.github/agents/lattice-feature-agent.agent.md +7 -0
  154. package/bundles/nextjs-landing/.github/agents/lattice-release-manager.agent.md +7 -0
  155. package/bundles/nextjs-landing/.github/copilot-instructions.md +37 -0
  156. package/bundles/nextjs-landing/.github/instructions/lattice-core.instructions.md +11 -0
  157. package/bundles/nextjs-landing/.github/workflows/ci.yml +26 -0
  158. package/bundles/nextjs-landing/.gitmessage +24 -0
  159. package/bundles/nextjs-landing/.lattice/config.json +9 -0
  160. package/bundles/nextjs-landing/.lattice/dependency-security.json +46 -0
  161. package/bundles/nextjs-landing/.lattice/prompts/01-feature.md +36 -0
  162. package/bundles/nextjs-landing/.lattice/prompts/02-bugfix.md +32 -0
  163. package/bundles/nextjs-landing/.lattice/prompts/03-refactor.md +30 -0
  164. package/bundles/nextjs-landing/.lattice/prompts/04-test.md +31 -0
  165. package/bundles/nextjs-landing/.lattice/prompts/05-polish.md +38 -0
  166. package/bundles/nextjs-landing/.lattice/prompts/06-security.md +32 -0
  167. package/bundles/nextjs-landing/.lattice/release-workflow.json +55 -0
  168. package/bundles/nextjs-landing/.lattice/schemas/feature-handoff.schema.json +264 -0
  169. package/bundles/nextjs-landing/.lattice/templates/feature-handoff.json +52 -0
  170. package/bundles/nextjs-landing/.mcp.json +35 -0
  171. package/bundles/nextjs-landing/AGENTS.md +58 -0
  172. package/bundles/nextjs-landing/CLAUDE.md +76 -0
  173. package/bundles/nextjs-landing/PROJECT_GUIDE.md +216 -0
  174. package/bundles/nextjs-landing/README.md +39 -0
  175. package/bundles/nextjs-landing/app/api/example/[id]/route.ts +34 -0
  176. package/bundles/nextjs-landing/app/api/example/route.ts +24 -0
  177. package/bundles/nextjs-landing/app/api/health/route.ts +8 -0
  178. package/bundles/nextjs-landing/app/global-error.tsx +17 -0
  179. package/bundles/nextjs-landing/app/globals.css +55 -0
  180. package/bundles/nextjs-landing/app/layout.tsx +22 -0
  181. package/bundles/nextjs-landing/app/page.tsx +42 -0
  182. package/bundles/nextjs-landing/components/ui/button.tsx +39 -0
  183. package/bundles/nextjs-landing/components/ui/card.tsx +53 -0
  184. package/bundles/nextjs-landing/components/ui/index.ts +4 -0
  185. package/bundles/nextjs-landing/components/ui/input.tsx +23 -0
  186. package/bundles/nextjs-landing/components/ui/spinner.tsx +22 -0
  187. package/bundles/nextjs-landing/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
  188. package/bundles/nextjs-landing/docs/rules/codex.md +62 -0
  189. package/bundles/nextjs-landing/eslint.config.mjs +16 -0
  190. package/bundles/nextjs-landing/instrumentation-client.ts +30 -0
  191. package/bundles/nextjs-landing/instrumentation.ts +12 -0
  192. package/bundles/nextjs-landing/jest.config.mjs +16 -0
  193. package/bundles/nextjs-landing/jest.setup.js +1 -0
  194. package/bundles/nextjs-landing/lib/utils.ts +6 -0
  195. package/bundles/nextjs-landing/next-env.d.ts +5 -0
  196. package/bundles/nextjs-landing/next.config.ts +15 -0
  197. package/bundles/nextjs-landing/package.json +48 -0
  198. package/bundles/nextjs-landing/postcss.config.mjs +7 -0
  199. package/bundles/nextjs-landing/prompts/01-feature-implementation.md +9 -0
  200. package/bundles/nextjs-landing/prompts/02-bug-fix.md +10 -0
  201. package/bundles/nextjs-landing/prompts/03-safe-refactor.md +8 -0
  202. package/bundles/nextjs-landing/prompts/04-test-first.md +8 -0
  203. package/bundles/nextjs-landing/prompts/05-ui-polish.md +8 -0
  204. package/bundles/nextjs-landing/prompts/06-security-review.md +7 -0
  205. package/bundles/nextjs-landing/prompts/quality.md +269 -0
  206. package/bundles/nextjs-landing/sentry.edge.config.ts +15 -0
  207. package/bundles/nextjs-landing/sentry.server.config.ts +15 -0
  208. package/bundles/nextjs-landing/tsconfig.json +42 -0
  209. package/bundles/nextjs-landing/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
  210. package/bundles/nextjs-saas/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
  211. package/bundles/nextjs-saas/.agents/skills/lattice-release-manager/SKILL.md +29 -0
  212. package/bundles/nextjs-saas/.agents/skills/lattice-verify/SKILL.md +27 -0
  213. package/bundles/nextjs-saas/.claude/agents/lattice-feature-agent.md +10 -0
  214. package/bundles/nextjs-saas/.claude/agents/lattice-release-manager.md +9 -0
  215. package/bundles/nextjs-saas/.claude/hooks/README.md +9 -0
  216. package/bundles/nextjs-saas/.claude/hooks/pre-commit-verify.mjs +10 -0
  217. package/bundles/nextjs-saas/.claude/hooks/pre-tool-use.mjs +51 -0
  218. package/bundles/nextjs-saas/.claude/rules/lattice-core.md +20 -0
  219. package/bundles/nextjs-saas/.claude/settings.json +38 -0
  220. package/bundles/nextjs-saas/.claude/skills/lattice-verify/SKILL.md +27 -0
  221. package/bundles/nextjs-saas/.codex/agents/lattice-feature-agent.toml +9 -0
  222. package/bundles/nextjs-saas/.codex/agents/lattice-release-manager.toml +9 -0
  223. package/bundles/nextjs-saas/.cursor/mcp.json +34 -0
  224. package/bundles/nextjs-saas/.cursor/rules/lattice-core.mdc +35 -0
  225. package/bundles/nextjs-saas/.cursor/rules.md +95 -0
  226. package/bundles/nextjs-saas/.env.example +48 -0
  227. package/bundles/nextjs-saas/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  228. package/bundles/nextjs-saas/.github/agents/lattice-feature-agent.agent.md +7 -0
  229. package/bundles/nextjs-saas/.github/agents/lattice-release-manager.agent.md +7 -0
  230. package/bundles/nextjs-saas/.github/copilot-instructions.md +37 -0
  231. package/bundles/nextjs-saas/.github/instructions/lattice-core.instructions.md +11 -0
  232. package/bundles/nextjs-saas/.github/workflows/ci.yml +26 -0
  233. package/bundles/nextjs-saas/.gitmessage +24 -0
  234. package/bundles/nextjs-saas/.lattice/config.json +9 -0
  235. package/bundles/nextjs-saas/.lattice/dependency-security.json +46 -0
  236. package/bundles/nextjs-saas/.lattice/prompts/01-feature.md +36 -0
  237. package/bundles/nextjs-saas/.lattice/prompts/02-bugfix.md +32 -0
  238. package/bundles/nextjs-saas/.lattice/prompts/03-refactor.md +30 -0
  239. package/bundles/nextjs-saas/.lattice/prompts/04-test.md +31 -0
  240. package/bundles/nextjs-saas/.lattice/prompts/05-polish.md +38 -0
  241. package/bundles/nextjs-saas/.lattice/prompts/06-security.md +32 -0
  242. package/bundles/nextjs-saas/.lattice/prompts/quality.md +269 -0
  243. package/bundles/nextjs-saas/.lattice/release-workflow.json +55 -0
  244. package/bundles/nextjs-saas/.lattice/schemas/feature-handoff.schema.json +264 -0
  245. package/bundles/nextjs-saas/.lattice/templates/feature-handoff.json +52 -0
  246. package/bundles/nextjs-saas/.mcp.json +35 -0
  247. package/bundles/nextjs-saas/AGENTS.md +58 -0
  248. package/bundles/nextjs-saas/CLAUDE.md +76 -0
  249. package/bundles/nextjs-saas/PROJECT_GUIDE.md +279 -0
  250. package/bundles/nextjs-saas/README.md +42 -0
  251. package/bundles/nextjs-saas/app/(auth)/forgot-password/page.tsx +101 -0
  252. package/bundles/nextjs-saas/app/(auth)/layout.tsx +7 -0
  253. package/bundles/nextjs-saas/app/(auth)/login/page.tsx +108 -0
  254. package/bundles/nextjs-saas/app/(auth)/reset-password/page.tsx +135 -0
  255. package/bundles/nextjs-saas/app/(auth)/signup/page.tsx +144 -0
  256. package/bundles/nextjs-saas/app/(dashboard)/dashboard/page.tsx +80 -0
  257. package/bundles/nextjs-saas/app/(dashboard)/layout.tsx +49 -0
  258. package/bundles/nextjs-saas/app/api/billing/checkout/route.ts +47 -0
  259. package/bundles/nextjs-saas/app/api/billing/portal/route.ts +29 -0
  260. package/bundles/nextjs-saas/app/api/example/[id]/route.ts +93 -0
  261. package/bundles/nextjs-saas/app/api/example/route.ts +61 -0
  262. package/bundles/nextjs-saas/app/api/health/route.ts +8 -0
  263. package/bundles/nextjs-saas/app/api/stripe/webhook/route.ts +57 -0
  264. package/bundles/nextjs-saas/app/api/user/route.ts +49 -0
  265. package/bundles/nextjs-saas/app/auth/callback/route.ts +16 -0
  266. package/bundles/nextjs-saas/app/auth/signout/route.ts +10 -0
  267. package/bundles/nextjs-saas/app/global-error.tsx +17 -0
  268. package/bundles/nextjs-saas/app/globals.css +55 -0
  269. package/bundles/nextjs-saas/app/layout.tsx +22 -0
  270. package/bundles/nextjs-saas/app/page.tsx +84 -0
  271. package/bundles/nextjs-saas/components/ui/button.tsx +39 -0
  272. package/bundles/nextjs-saas/components/ui/card.tsx +53 -0
  273. package/bundles/nextjs-saas/components/ui/index.ts +4 -0
  274. package/bundles/nextjs-saas/components/ui/input.tsx +23 -0
  275. package/bundles/nextjs-saas/components/ui/spinner.tsx +22 -0
  276. package/bundles/nextjs-saas/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
  277. package/bundles/nextjs-saas/docs/rules/codex.md +62 -0
  278. package/bundles/nextjs-saas/eslint.config.mjs +16 -0
  279. package/bundles/nextjs-saas/instrumentation-client.ts +30 -0
  280. package/bundles/nextjs-saas/instrumentation.ts +12 -0
  281. package/bundles/nextjs-saas/jest.config.mjs +16 -0
  282. package/bundles/nextjs-saas/jest.setup.js +1 -0
  283. package/bundles/nextjs-saas/lib/auth/password-recovery.ts +94 -0
  284. package/bundles/nextjs-saas/lib/stripe.ts +10 -0
  285. package/bundles/nextjs-saas/lib/supabase/admin.ts +14 -0
  286. package/bundles/nextjs-saas/lib/supabase/client.ts +8 -0
  287. package/bundles/nextjs-saas/lib/supabase/server.ts +27 -0
  288. package/bundles/nextjs-saas/lib/utils.ts +6 -0
  289. package/bundles/nextjs-saas/next-env.d.ts +5 -0
  290. package/bundles/nextjs-saas/next.config.ts +15 -0
  291. package/bundles/nextjs-saas/package.json +50 -0
  292. package/bundles/nextjs-saas/postcss.config.mjs +7 -0
  293. package/bundles/nextjs-saas/prompts/01-feature-implementation.md +92 -0
  294. package/bundles/nextjs-saas/prompts/02-bug-fix.md +78 -0
  295. package/bundles/nextjs-saas/prompts/03-safe-refactor.md +82 -0
  296. package/bundles/nextjs-saas/prompts/04-test-first.md +80 -0
  297. package/bundles/nextjs-saas/prompts/05-ui-polish.md +82 -0
  298. package/bundles/nextjs-saas/prompts/06-security-review.md +74 -0
  299. package/bundles/nextjs-saas/proxy.ts +61 -0
  300. package/bundles/nextjs-saas/sentry.edge.config.ts +15 -0
  301. package/bundles/nextjs-saas/sentry.server.config.ts +15 -0
  302. package/bundles/nextjs-saas/supabase/migrations/001_initial_schema.sql +66 -0
  303. package/bundles/nextjs-saas/supabase/migrations/002_billing.sql +17 -0
  304. package/bundles/nextjs-saas/tsconfig.json +42 -0
  305. package/bundles/nextjs-saas/types/database.types.ts +76 -0
  306. package/bundles/nextjs-saas/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
  307. package/bundles/nextjs-trpc/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
  308. package/bundles/nextjs-trpc/.agents/skills/lattice-release-manager/SKILL.md +29 -0
  309. package/bundles/nextjs-trpc/.agents/skills/lattice-verify/SKILL.md +27 -0
  310. package/bundles/nextjs-trpc/.claude/agents/lattice-feature-agent.md +10 -0
  311. package/bundles/nextjs-trpc/.claude/agents/lattice-release-manager.md +9 -0
  312. package/bundles/nextjs-trpc/.claude/hooks/README.md +9 -0
  313. package/bundles/nextjs-trpc/.claude/hooks/pre-commit-verify.mjs +10 -0
  314. package/bundles/nextjs-trpc/.claude/hooks/pre-tool-use.mjs +51 -0
  315. package/bundles/nextjs-trpc/.claude/rules/lattice-core.md +20 -0
  316. package/bundles/nextjs-trpc/.claude/settings.json +38 -0
  317. package/bundles/nextjs-trpc/.claude/skills/lattice-verify/SKILL.md +27 -0
  318. package/bundles/nextjs-trpc/.codex/agents/lattice-feature-agent.toml +9 -0
  319. package/bundles/nextjs-trpc/.codex/agents/lattice-release-manager.toml +9 -0
  320. package/bundles/nextjs-trpc/.cursor/mcp.json +34 -0
  321. package/bundles/nextjs-trpc/.cursor/rules/lattice-core.mdc +35 -0
  322. package/bundles/nextjs-trpc/.cursor/rules.md +95 -0
  323. package/bundles/nextjs-trpc/.env.example +21 -0
  324. package/bundles/nextjs-trpc/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  325. package/bundles/nextjs-trpc/.github/agents/lattice-feature-agent.agent.md +7 -0
  326. package/bundles/nextjs-trpc/.github/agents/lattice-release-manager.agent.md +7 -0
  327. package/bundles/nextjs-trpc/.github/copilot-instructions.md +37 -0
  328. package/bundles/nextjs-trpc/.github/instructions/lattice-core.instructions.md +11 -0
  329. package/bundles/nextjs-trpc/.github/workflows/ci.yml +26 -0
  330. package/bundles/nextjs-trpc/.gitmessage +24 -0
  331. package/bundles/nextjs-trpc/.lattice/config.json +9 -0
  332. package/bundles/nextjs-trpc/.lattice/dependency-security.json +46 -0
  333. package/bundles/nextjs-trpc/.lattice/prompts/01-feature.md +36 -0
  334. package/bundles/nextjs-trpc/.lattice/prompts/02-bugfix.md +32 -0
  335. package/bundles/nextjs-trpc/.lattice/prompts/03-refactor.md +30 -0
  336. package/bundles/nextjs-trpc/.lattice/prompts/04-test.md +31 -0
  337. package/bundles/nextjs-trpc/.lattice/prompts/05-polish.md +38 -0
  338. package/bundles/nextjs-trpc/.lattice/prompts/06-security.md +32 -0
  339. package/bundles/nextjs-trpc/.lattice/release-workflow.json +55 -0
  340. package/bundles/nextjs-trpc/.lattice/schemas/feature-handoff.schema.json +264 -0
  341. package/bundles/nextjs-trpc/.lattice/templates/feature-handoff.json +52 -0
  342. package/bundles/nextjs-trpc/.mcp.json +35 -0
  343. package/bundles/nextjs-trpc/AGENTS.md +58 -0
  344. package/bundles/nextjs-trpc/CLAUDE.md +76 -0
  345. package/bundles/nextjs-trpc/PROJECT_GUIDE.md +187 -0
  346. package/bundles/nextjs-trpc/README.md +49 -0
  347. package/bundles/nextjs-trpc/app/api/trpc/[trpc]/route.ts +12 -0
  348. package/bundles/nextjs-trpc/app/global-error.tsx +17 -0
  349. package/bundles/nextjs-trpc/app/globals.css +55 -0
  350. package/bundles/nextjs-trpc/app/layout.tsx +19 -0
  351. package/bundles/nextjs-trpc/app/page.tsx +16 -0
  352. package/bundles/nextjs-trpc/app/providers.tsx +24 -0
  353. package/bundles/nextjs-trpc/components/ui/button.tsx +39 -0
  354. package/bundles/nextjs-trpc/components/ui/card.tsx +53 -0
  355. package/bundles/nextjs-trpc/components/ui/index.ts +4 -0
  356. package/bundles/nextjs-trpc/components/ui/input.tsx +23 -0
  357. package/bundles/nextjs-trpc/components/ui/spinner.tsx +22 -0
  358. package/bundles/nextjs-trpc/components/user-list.tsx +17 -0
  359. package/bundles/nextjs-trpc/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
  360. package/bundles/nextjs-trpc/docs/rules/codex.md +62 -0
  361. package/bundles/nextjs-trpc/eslint.config.mjs +16 -0
  362. package/bundles/nextjs-trpc/instrumentation-client.ts +20 -0
  363. package/bundles/nextjs-trpc/instrumentation.ts +12 -0
  364. package/bundles/nextjs-trpc/jest.config.mjs +16 -0
  365. package/bundles/nextjs-trpc/jest.setup.js +1 -0
  366. package/bundles/nextjs-trpc/lib/db.ts +17 -0
  367. package/bundles/nextjs-trpc/lib/trpc/react.tsx +7 -0
  368. package/bundles/nextjs-trpc/lib/utils.ts +6 -0
  369. package/bundles/nextjs-trpc/next-env.d.ts +5 -0
  370. package/bundles/nextjs-trpc/next.config.ts +15 -0
  371. package/bundles/nextjs-trpc/package.json +62 -0
  372. package/bundles/nextjs-trpc/postcss.config.mjs +7 -0
  373. package/bundles/nextjs-trpc/prisma/schema.prisma +41 -0
  374. package/bundles/nextjs-trpc/prisma.config.ts +10 -0
  375. package/bundles/nextjs-trpc/prompts/01-feature-implementation.md +9 -0
  376. package/bundles/nextjs-trpc/prompts/02-bug-fix.md +9 -0
  377. package/bundles/nextjs-trpc/prompts/03-safe-refactor.md +8 -0
  378. package/bundles/nextjs-trpc/prompts/04-test-first.md +8 -0
  379. package/bundles/nextjs-trpc/prompts/05-ui-polish.md +7 -0
  380. package/bundles/nextjs-trpc/prompts/06-security-review.md +7 -0
  381. package/bundles/nextjs-trpc/prompts/quality.md +269 -0
  382. package/bundles/nextjs-trpc/sentry.edge.config.ts +15 -0
  383. package/bundles/nextjs-trpc/sentry.server.config.ts +15 -0
  384. package/bundles/nextjs-trpc/server/routers/_app.test.ts +60 -0
  385. package/bundles/nextjs-trpc/server/routers/_app.ts +25 -0
  386. package/bundles/nextjs-trpc/server/trpc.ts +12 -0
  387. package/bundles/nextjs-trpc/tsconfig.json +42 -0
  388. package/bundles/nextjs-trpc/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
  389. package/dist/agent-install-session.d.ts +17 -0
  390. package/dist/agent-install-session.d.ts.map +1 -0
  391. package/dist/agent-install-session.js +106 -0
  392. package/dist/agent-install-session.js.map +1 -0
  393. package/dist/agent-install-session.test.d.ts +2 -0
  394. package/dist/agent-install-session.test.d.ts.map +1 -0
  395. package/dist/agent-install-session.test.js +62 -0
  396. package/dist/agent-install-session.test.js.map +1 -0
  397. package/dist/agent-install.d.ts +41 -0
  398. package/dist/agent-install.d.ts.map +1 -0
  399. package/dist/agent-install.js +42 -0
  400. package/dist/agent-install.js.map +1 -0
  401. package/dist/agent-install.test.d.ts +2 -0
  402. package/dist/agent-install.test.d.ts.map +1 -0
  403. package/dist/agent-install.test.js +58 -0
  404. package/dist/agent-install.test.js.map +1 -0
  405. package/dist/apply-merge.test.d.ts +2 -0
  406. package/dist/apply-merge.test.d.ts.map +1 -0
  407. package/dist/apply-merge.test.js +123 -0
  408. package/dist/apply-merge.test.js.map +1 -0
  409. package/dist/bundle-download.d.ts +23 -0
  410. package/dist/bundle-download.d.ts.map +1 -0
  411. package/dist/bundle-download.js +180 -0
  412. package/dist/bundle-download.js.map +1 -0
  413. package/dist/bundle-download.test.d.ts +2 -0
  414. package/dist/bundle-download.test.d.ts.map +1 -0
  415. package/dist/bundle-download.test.js +200 -0
  416. package/dist/bundle-download.test.js.map +1 -0
  417. package/dist/bundle-rollback.test.d.ts +2 -0
  418. package/dist/bundle-rollback.test.d.ts.map +1 -0
  419. package/dist/bundle-rollback.test.js +127 -0
  420. package/dist/bundle-rollback.test.js.map +1 -0
  421. package/dist/bundle-scaffold.test.d.ts +2 -0
  422. package/dist/bundle-scaffold.test.d.ts.map +1 -0
  423. package/dist/bundle-scaffold.test.js +105 -0
  424. package/dist/bundle-scaffold.test.js.map +1 -0
  425. package/dist/commands.d.ts +132 -0
  426. package/dist/commands.d.ts.map +1 -0
  427. package/dist/commands.js +2012 -0
  428. package/dist/commands.js.map +1 -0
  429. package/dist/credential-store.d.ts +27 -0
  430. package/dist/credential-store.d.ts.map +1 -0
  431. package/dist/credential-store.js +48 -0
  432. package/dist/credential-store.js.map +1 -0
  433. package/dist/credential-store.test.d.ts +2 -0
  434. package/dist/credential-store.test.d.ts.map +1 -0
  435. package/dist/credential-store.test.js +80 -0
  436. package/dist/credential-store.test.js.map +1 -0
  437. package/dist/delivered-project-files.d.ts +31 -0
  438. package/dist/delivered-project-files.d.ts.map +1 -0
  439. package/dist/delivered-project-files.js +158 -0
  440. package/dist/delivered-project-files.js.map +1 -0
  441. package/dist/delivered-project-files.test.d.ts +2 -0
  442. package/dist/delivered-project-files.test.d.ts.map +1 -0
  443. package/dist/delivered-project-files.test.js +107 -0
  444. package/dist/delivered-project-files.test.js.map +1 -0
  445. package/dist/doctor-agents.test.d.ts +2 -0
  446. package/dist/doctor-agents.test.d.ts.map +1 -0
  447. package/dist/doctor-agents.test.js +65 -0
  448. package/dist/doctor-agents.test.js.map +1 -0
  449. package/dist/hermes-install.d.ts +102 -0
  450. package/dist/hermes-install.d.ts.map +1 -0
  451. package/dist/hermes-install.js +641 -0
  452. package/dist/hermes-install.js.map +1 -0
  453. package/dist/hermes-install.test.d.ts +2 -0
  454. package/dist/hermes-install.test.d.ts.map +1 -0
  455. package/dist/hermes-install.test.js +866 -0
  456. package/dist/hermes-install.test.js.map +1 -0
  457. package/dist/index.d.ts +115 -0
  458. package/dist/index.d.ts.map +1 -0
  459. package/dist/index.js +5311 -0
  460. package/dist/index.js.map +1 -0
  461. package/dist/openclaw-install.d.ts +67 -0
  462. package/dist/openclaw-install.d.ts.map +1 -0
  463. package/dist/openclaw-install.js +358 -0
  464. package/dist/openclaw-install.js.map +1 -0
  465. package/dist/openclaw-install.test.d.ts +2 -0
  466. package/dist/openclaw-install.test.d.ts.map +1 -0
  467. package/dist/openclaw-install.test.js +296 -0
  468. package/dist/openclaw-install.test.js.map +1 -0
  469. package/dist/password-recovery-bundle.test.d.ts +2 -0
  470. package/dist/password-recovery-bundle.test.d.ts.map +1 -0
  471. package/dist/password-recovery-bundle.test.js +132 -0
  472. package/dist/password-recovery-bundle.test.js.map +1 -0
  473. package/dist/project-bundle-env.d.ts +19 -0
  474. package/dist/project-bundle-env.d.ts.map +1 -0
  475. package/dist/project-bundle-env.js +111 -0
  476. package/dist/project-bundle-env.js.map +1 -0
  477. package/dist/project-bundle-env.test.d.ts +2 -0
  478. package/dist/project-bundle-env.test.d.ts.map +1 -0
  479. package/dist/project-bundle-env.test.js +93 -0
  480. package/dist/project-bundle-env.test.js.map +1 -0
  481. package/dist/project-path-confinement.test.d.ts +2 -0
  482. package/dist/project-path-confinement.test.d.ts.map +1 -0
  483. package/dist/project-path-confinement.test.js +222 -0
  484. package/dist/project-path-confinement.test.js.map +1 -0
  485. package/dist/security/api.d.ts +18 -0
  486. package/dist/security/api.d.ts.map +1 -0
  487. package/dist/security/api.js +238 -0
  488. package/dist/security/api.js.map +1 -0
  489. package/dist/security/api.test.d.ts +2 -0
  490. package/dist/security/api.test.d.ts.map +1 -0
  491. package/dist/security/api.test.js +220 -0
  492. package/dist/security/api.test.js.map +1 -0
  493. package/dist/security/artifact.d.ts +10 -0
  494. package/dist/security/artifact.d.ts.map +1 -0
  495. package/dist/security/artifact.js +283 -0
  496. package/dist/security/artifact.js.map +1 -0
  497. package/dist/security/artifact.test.d.ts +2 -0
  498. package/dist/security/artifact.test.d.ts.map +1 -0
  499. package/dist/security/artifact.test.js +229 -0
  500. package/dist/security/artifact.test.js.map +1 -0
  501. package/dist/security/commands.d.ts +42 -0
  502. package/dist/security/commands.d.ts.map +1 -0
  503. package/dist/security/commands.js +825 -0
  504. package/dist/security/commands.js.map +1 -0
  505. package/dist/security/commands.test.d.ts +2 -0
  506. package/dist/security/commands.test.d.ts.map +1 -0
  507. package/dist/security/commands.test.js +1051 -0
  508. package/dist/security/commands.test.js.map +1 -0
  509. package/dist/security/connection.d.ts +19 -0
  510. package/dist/security/connection.d.ts.map +1 -0
  511. package/dist/security/connection.js +145 -0
  512. package/dist/security/connection.js.map +1 -0
  513. package/dist/security/connection.test.d.ts +2 -0
  514. package/dist/security/connection.test.d.ts.map +1 -0
  515. package/dist/security/connection.test.js +62 -0
  516. package/dist/security/connection.test.js.map +1 -0
  517. package/dist/security/index-routing.test.d.ts +2 -0
  518. package/dist/security/index-routing.test.d.ts.map +1 -0
  519. package/dist/security/index-routing.test.js +169 -0
  520. package/dist/security/index-routing.test.js.map +1 -0
  521. package/dist/security/journal.d.ts +26 -0
  522. package/dist/security/journal.d.ts.map +1 -0
  523. package/dist/security/journal.js +441 -0
  524. package/dist/security/journal.js.map +1 -0
  525. package/dist/security/journal.test.d.ts +2 -0
  526. package/dist/security/journal.test.d.ts.map +1 -0
  527. package/dist/security/journal.test.js +226 -0
  528. package/dist/security/journal.test.js.map +1 -0
  529. package/dist/security/package-verifier.d.ts +15 -0
  530. package/dist/security/package-verifier.d.ts.map +1 -0
  531. package/dist/security/package-verifier.js +65 -0
  532. package/dist/security/package-verifier.js.map +1 -0
  533. package/dist/security/package-verifier.test.d.ts +2 -0
  534. package/dist/security/package-verifier.test.d.ts.map +1 -0
  535. package/dist/security/package-verifier.test.js +57 -0
  536. package/dist/security/package-verifier.test.js.map +1 -0
  537. package/dist/security/runtime.d.ts +43 -0
  538. package/dist/security/runtime.d.ts.map +1 -0
  539. package/dist/security/runtime.js +81 -0
  540. package/dist/security/runtime.js.map +1 -0
  541. package/dist/security/runtime.test.d.ts +2 -0
  542. package/dist/security/runtime.test.d.ts.map +1 -0
  543. package/dist/security/runtime.test.js +88 -0
  544. package/dist/security/runtime.test.js.map +1 -0
  545. package/dist/security/types.d.ts +169 -0
  546. package/dist/security/types.d.ts.map +1 -0
  547. package/dist/security/types.js +3 -0
  548. package/dist/security/types.js.map +1 -0
  549. package/dist/security-runtime/LICENSE +202 -0
  550. package/dist/security-runtime/NOTICE +16 -0
  551. package/dist/security-runtime/artifact-manifest.json +960 -0
  552. package/dist/security-runtime/bin/vsg.mjs +5 -0
  553. package/dist/security-runtime/lattice-catalog.json +176585 -0
  554. package/dist/security-runtime/lattice-runtime.mjs +90 -0
  555. package/dist/security-runtime/licensing/candidates/apache-source-license-evidence.json +478 -0
  556. package/dist/security-runtime/licensing/candidates/betterleaks-generic-api-key.json +76 -0
  557. package/dist/security-runtime/licensing/candidates/betterleaks-jwt.json +74 -0
  558. package/dist/security-runtime/licensing/candidates/blackberry-additional-source-declaration-evidence.json +276 -0
  559. package/dist/security-runtime/licensing/candidates/blackberry-source-declaration-evidence.json +369 -0
  560. package/dist/security-runtime/licensing/candidates/cado-source-declaration-evidence.json +283 -0
  561. package/dist/security-runtime/licensing/candidates/commercial-rule-candidate.json +280 -0
  562. package/dist/security-runtime/licensing/candidates/commercial-runtime-release.json +389 -0
  563. package/dist/security-runtime/licensing/candidates/data-feed-evidence.json +259 -0
  564. package/dist/security-runtime/licensing/candidates/gitlab-sast-rule-identities.json +178 -0
  565. package/dist/security-runtime/licensing/candidates/gitlab-sast-source-evidence.json +1824 -0
  566. package/dist/security-runtime/licensing/candidates/gitlab-sast-source-notice-bundle.json +45 -0
  567. package/dist/security-runtime/licensing/candidates/malpedia-source-license-evidence.json +41 -0
  568. package/dist/security-runtime/licensing/candidates/rule-license-evidence.json +376 -0
  569. package/dist/security-runtime/licensing/candidates/runner-image-composition.json +1500 -0
  570. package/dist/security-runtime/licensing/candidates/selected-runtime-coverage.json +91 -0
  571. package/dist/security-runtime/licensing/candidates/yara-forge-20260927.json +58502 -0
  572. package/dist/security-runtime/licensing/commercial-components.json +379 -0
  573. package/dist/security-runtime/licensing/notices/betterleaks-1.9.0-MIT.txt +21 -0
  574. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5.txt +428 -0
  575. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/33acf42afdd03163d75fe856cb431e70710e0b5deede3362e6d1c4697cfe1c6a.txt +28 -0
  576. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986.txt +674 -0
  577. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/4fecb8fcaf80fd9a6315bca5225ee43377015b46a0459c2925495be885cab19a.txt +21 -0
  578. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/811515f8723aa4007de2fbb75a364127fdec51cda534b87a7ea8f2fef2f96dd7.txt +24 -0
  579. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/814442c3987a2c0411171ad8ad43118e8c08f85c9c5d1dcdecc9787c7ca8689b.txt +664 -0
  580. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/8a959b2413d0c83ca1b3ce9153076c649abf2e4bbfebbb493fb24c2074a1eb8a.txt +38 -0
  581. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/995182e185856186fbbe49f150409ae026aa4cda7e94f83c6ed737cbb77fa9c7.txt +23 -0
  582. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/9b8e1305e46d1dd4011b6ed933c9f6223e08c9c4625001c5fd75a34fa930f616.txt +202 -0
  583. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/a01f1a28424bfe7f49a23d339a01847cfa9ace3864d5e7295051772a4bae2271.txt +38 -0
  584. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/a5681bf9b05db14d86776930017c647ad9e6e56ff6bbcfdf21e5848288dfaf1b.txt +165 -0
  585. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/a5b8bd9ae96c630bbf229d61c5c5def20274e00be39abfd2fab4d7879ceab462.txt +24 -0
  586. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/ada32b3747ce108d5e8bab7918af94abbd03f2fe2a46304f74c6333bbfd914ed.txt +8 -0
  587. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4.txt +201 -0
  588. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/c738ae413cf561f174e34f6961f8ca458aae2369a73640dda6234c629b98bcc4.txt +2732 -0
  589. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/ce41c9a2c986277f7f9ab146a2195c1888a5d8da062e22d7c9c88666bb7c38cd.txt +17 -0
  590. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/d5f4c36a0528e01cfdd9e4fc60879201d3af49b41c520200643d321fe53da5f9.txt +17 -0
  591. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/e08c368ccd455f85c7fb9e04830e730f26e9dbb5c0f77bc88e09a5b0cb37df5b.txt +38 -0
  592. package/dist/security-runtime/licensing/notices/candidate-sources/sha256/e9efb2f7daf11bb6379c06c16b870dddcecc4a10f8704bb8aad807529c8b3c97.txt +8 -0
  593. package/dist/security-runtime/licensing/notices/gitleaks-generic-origin-782f3104-MIT.txt +21 -0
  594. package/dist/security-runtime/package.json +17 -0
  595. package/dist/security-runtime/playbook/README.md +76 -0
  596. package/dist/security-runtime/playbook/access-control.md +56 -0
  597. package/dist/security-runtime/playbook/ai-features.md +53 -0
  598. package/dist/security-runtime/playbook/desktop-python.md +59 -0
  599. package/dist/security-runtime/playbook/input-handling.md +59 -0
  600. package/dist/security-runtime/playbook/mobile-expo.md +59 -0
  601. package/dist/security-runtime/playbook/payments.md +53 -0
  602. package/dist/security-runtime/playbook/privacy-account-recovery.md +59 -0
  603. package/dist/security-runtime/playbook/secrets-config.md +47 -0
  604. package/dist/security-runtime/playbook/supabase.md +48 -0
  605. package/dist/security-runtime/playbook/supply-chain.md +62 -0
  606. package/dist/security-runtime/playbook/webhooks-integrations.md +52 -0
  607. package/dist/security-runtime/rules/vsg-ai-key-in-client.yaml +41 -0
  608. package/dist/security-runtime/rules/vsg-ai-output-raw-html.yaml +35 -0
  609. package/dist/security-runtime/rules/vsg-angular-sanitizer-bypass.yaml +23 -0
  610. package/dist/security-runtime/rules/vsg-expo-token-in-asyncstorage.yaml +22 -0
  611. package/dist/security-runtime/rules/vsg-flask-public-bind.yaml +32 -0
  612. package/dist/security-runtime/rules/vsg-nextjs-action-write-no-auth.yaml +144 -0
  613. package/dist/security-runtime/rules/vsg-nextjs-inline-action-write-no-auth.yaml +161 -0
  614. package/dist/security-runtime/rules/vsg-nextjs-route-write-no-auth.yaml +193 -0
  615. package/dist/security-runtime/rules/vsg-nosql-where-injection.yaml +36 -0
  616. package/dist/security-runtime/rules/vsg-python-pickle-load.yaml +26 -0
  617. package/dist/security-runtime/rules/vsg-python-requests-verify-false.yaml +34 -0
  618. package/dist/security-runtime/rules/vsg-python-subprocess-shell.yaml +23 -0
  619. package/dist/security-runtime/rules/vsg-stripe-client-price.yaml +51 -0
  620. package/dist/security-runtime/rules/vsg-stripe-webhook-no-signature.yaml +31 -0
  621. package/dist/security-runtime/rules/vsg-stripe-webhook-pages-no-signature.yaml +51 -0
  622. package/dist/security-runtime/rules/vsg-supabase-service-role-in-client.yaml +27 -0
  623. package/dist/security-runtime/rules/vsg-supabase-service-role-public-env.yaml +24 -0
  624. package/dist/security-runtime/rules/vsg-xml-external-entities.yaml +19 -0
  625. package/dist/security-runtime/src/agent/brief.mjs +95 -0
  626. package/dist/security-runtime/src/agent/discover.mjs +108 -0
  627. package/dist/security-runtime/src/agent/exec.mjs +64 -0
  628. package/dist/security-runtime/src/agent/ingest.mjs +213 -0
  629. package/dist/security-runtime/src/agent/report.mjs +94 -0
  630. package/dist/security-runtime/src/agent/schema.mjs +62 -0
  631. package/dist/security-runtime/src/agent/tokenize.mjs +38 -0
  632. package/dist/security-runtime/src/checks/README.md +8 -0
  633. package/dist/security-runtime/src/checks/_lib/gitfiles.mjs +35 -0
  634. package/dist/security-runtime/src/checks/_lib/lockfiles.mjs +135 -0
  635. package/dist/security-runtime/src/checks/_lib/osv.mjs +6 -0
  636. package/dist/security-runtime/src/checks/_lib/secrets.mjs +381 -0
  637. package/dist/security-runtime/src/checks/_lib/targets.mjs +79 -0
  638. package/dist/security-runtime/src/checks/agent-review/index.mjs +52 -0
  639. package/dist/security-runtime/src/checks/agent-surface/config.mjs +223 -0
  640. package/dist/security-runtime/src/checks/agent-surface/index.mjs +113 -0
  641. package/dist/security-runtime/src/checks/agent-surface/instructions.mjs +87 -0
  642. package/dist/security-runtime/src/checks/agent-surface/patterns.mjs +68 -0
  643. package/dist/security-runtime/src/checks/agent-surface/unicode.mjs +88 -0
  644. package/dist/security-runtime/src/checks/code/auth-helpers.mjs +659 -0
  645. package/dist/security-runtime/src/checks/code/index.mjs +617 -0
  646. package/dist/security-runtime/src/checks/code/opengrep-container.mjs +85 -0
  647. package/dist/security-runtime/src/checks/code/opengrep-runner.mjs +86 -0
  648. package/dist/security-runtime/src/checks/code/selected-opengrep-runner.mjs +112 -0
  649. package/dist/security-runtime/src/checks/dep-change/guarddog.mjs +142 -0
  650. package/dist/security-runtime/src/checks/dep-change/index.mjs +316 -0
  651. package/dist/security-runtime/src/checks/dep-change/registries.mjs +199 -0
  652. package/dist/security-runtime/src/checks/deps-vuln/index.mjs +305 -0
  653. package/dist/security-runtime/src/checks/desktop-config/index.mjs +112 -0
  654. package/dist/security-runtime/src/checks/dns-mail/index.mjs +71 -0
  655. package/dist/security-runtime/src/checks/iac/index.mjs +83 -0
  656. package/dist/security-runtime/src/checks/install-posture/index.mjs +123 -0
  657. package/dist/security-runtime/src/checks/licenses/index.mjs +143 -0
  658. package/dist/security-runtime/src/checks/live-basic/index.mjs +77 -0
  659. package/dist/security-runtime/src/checks/live-js-secrets/index.mjs +100 -0
  660. package/dist/security-runtime/src/checks/malware/clamav.mjs +17 -0
  661. package/dist/security-runtime/src/checks/malware/defender.mjs +43 -0
  662. package/dist/security-runtime/src/checks/malware/index.mjs +186 -0
  663. package/dist/security-runtime/src/checks/malware/targets.mjs +147 -0
  664. package/dist/security-runtime/src/checks/malware/yara-runner.mjs +201 -0
  665. package/dist/security-runtime/src/checks/malware/yara.mjs +124 -0
  666. package/dist/security-runtime/src/checks/mobile-config/index.mjs +173 -0
  667. package/dist/security-runtime/src/checks/mobile-config/mobsf.mjs +105 -0
  668. package/dist/security-runtime/src/checks/posture/index.mjs +133 -0
  669. package/dist/security-runtime/src/checks/project-scripts/index.mjs +187 -0
  670. package/dist/security-runtime/src/checks/sbom/index.mjs +98 -0
  671. package/dist/security-runtime/src/checks/secrets-build/index.mjs +63 -0
  672. package/dist/security-runtime/src/checks/secrets-history/index.mjs +112 -0
  673. package/dist/security-runtime/src/checks/secrets-tree/env.mjs +120 -0
  674. package/dist/security-runtime/src/checks/secrets-tree/index.mjs +73 -0
  675. package/dist/security-runtime/src/checks/supabase-static/index.mjs +240 -0
  676. package/dist/security-runtime/src/checks/supabase-static/sql.mjs +557 -0
  677. package/dist/security-runtime/src/checks/workflows/index.mjs +93 -0
  678. package/dist/security-runtime/src/cli/deep.mjs +13 -0
  679. package/dist/security-runtime/src/cli/doctor.mjs +82 -0
  680. package/dist/security-runtime/src/cli/index.mjs +60 -0
  681. package/dist/security-runtime/src/cli/live-common.mjs +27 -0
  682. package/dist/security-runtime/src/cli/parse.mjs +56 -0
  683. package/dist/security-runtime/src/cli/portfolio.mjs +34 -0
  684. package/dist/security-runtime/src/cli/release.mjs +28 -0
  685. package/dist/security-runtime/src/cli/report.mjs +18 -0
  686. package/dist/security-runtime/src/cli/run-common.mjs +54 -0
  687. package/dist/security-runtime/src/cli/scan.mjs +12 -0
  688. package/dist/security-runtime/src/cli/setup.mjs +59 -0
  689. package/dist/security-runtime/src/cli/url.mjs +38 -0
  690. package/dist/security-runtime/src/core/accept.mjs +141 -0
  691. package/dist/security-runtime/src/core/archive.mjs +114 -0
  692. package/dist/security-runtime/src/core/base-ref.mjs +43 -0
  693. package/dist/security-runtime/src/core/checks.mjs +39 -0
  694. package/dist/security-runtime/src/core/detect.mjs +90 -0
  695. package/dist/security-runtime/src/core/errors.mjs +5 -0
  696. package/dist/security-runtime/src/core/fetch.mjs +139 -0
  697. package/dist/security-runtime/src/core/findings.mjs +177 -0
  698. package/dist/security-runtime/src/core/gate.mjs +131 -0
  699. package/dist/security-runtime/src/core/installer.mjs +255 -0
  700. package/dist/security-runtime/src/core/lock.mjs +38 -0
  701. package/dist/security-runtime/src/core/nested.mjs +107 -0
  702. package/dist/security-runtime/src/core/paths.mjs +20 -0
  703. package/dist/security-runtime/src/core/pipeline.mjs +196 -0
  704. package/dist/security-runtime/src/core/registry.mjs +81 -0
  705. package/dist/security-runtime/src/core/report.mjs +128 -0
  706. package/dist/security-runtime/src/core/runner.mjs +86 -0
  707. package/dist/security-runtime/src/core/sarif.mjs +141 -0
  708. package/dist/security-runtime/src/lattice/artifact.mjs +1201 -0
  709. package/dist/security-runtime/src/lattice/execution.mjs +45 -0
  710. package/dist/security-runtime/src/lattice/export.mjs +215 -0
  711. package/dist/security-runtime/src/lattice/provenance.mjs +70 -0
  712. package/dist/security-runtime/src/lattice/runtime.mjs +158 -0
  713. package/dist/security-runtime/src/lattice/selected-runtime.mjs +189 -0
  714. package/dist/security-runtime/src/lattice/source-acquirer.mjs +51 -0
  715. package/dist/security-runtime/src/lattice/source-fetcher.mjs +88 -0
  716. package/dist/security-runtime/src/lattice/transport.mjs +232 -0
  717. package/dist/security-runtime/src/live/analyze.mjs +101 -0
  718. package/dist/security-runtime/src/live/exposure.mjs +79 -0
  719. package/dist/security-runtime/src/live/secrets.mjs +31 -0
  720. package/dist/security-runtime/src/live/session.mjs +98 -0
  721. package/dist/security-runtime/src/live/targets.mjs +81 -0
  722. package/dist/security-runtime/src/portfolio/index.mjs +116 -0
  723. package/dist/security-runtime/tools/registry/betterleaks.json +29 -0
  724. package/dist/security-runtime/tools/registry/guarddog.json +9 -0
  725. package/dist/security-runtime/tools/registry/mobsf.json +10 -0
  726. package/dist/security-runtime/tools/registry/opengrep.json +28 -0
  727. package/dist/security-runtime/tools/registry/osv-scanner.json +14 -0
  728. package/dist/security-runtime/tools/registry/semgrep-rules.json +21 -0
  729. package/dist/security-runtime/tools/registry/trivy.json +30 -0
  730. package/dist/security-runtime/tools/registry/yara-forge-exclusions.json +14 -0
  731. package/dist/security-runtime/tools/registry/yara-forge.json +22 -0
  732. package/dist/security-runtime/tools/registry/yara-runner.json +10 -0
  733. package/dist/security-runtime/tools/registry/yara-x.json +24 -0
  734. package/dist/security-runtime/tools/registry/zizmor.json +30 -0
  735. package/dist/spinner.d.ts +16 -0
  736. package/dist/spinner.d.ts.map +1 -0
  737. package/dist/spinner.js +72 -0
  738. package/dist/spinner.js.map +1 -0
  739. package/dist/verify.test.d.ts +2 -0
  740. package/dist/verify.test.d.ts.map +1 -0
  741. package/dist/verify.test.js +98 -0
  742. package/dist/verify.test.js.map +1 -0
  743. package/package.json +73 -4
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_fs_1 = require("node:fs");
9
+ const node_os_1 = require("node:os");
10
+ const node_path_1 = require("node:path");
11
+ const node_test_1 = __importDefault(require("node:test"));
12
+ const journal_js_1 = require("./journal.js");
13
+ const ID = '11111111-1111-4111-8111-111111111111';
14
+ const journalContext = {
15
+ recoveryParentId: null,
16
+ recoveryRootId: null,
17
+ repo: 'C:\\fixture',
18
+ outDir: 'C:\\fixture\\.vsg\\security\\output',
19
+ artifactRoot: 'C:\\fixture\\artifact',
20
+ artifactManifestSha256: 'a'.repeat(64),
21
+ repositoryIdentity: 'github.com/example/fixture',
22
+ retainedCompleted: true,
23
+ localExit: 0,
24
+ acknowledgedExit: null,
25
+ };
26
+ (0, node_test_1.default)('retains exact finish bytes without credentials and detects later changes', async () => {
27
+ const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-journal-'));
28
+ try {
29
+ const body = '{"outcome":"completed","report":{"transportVersion":"3.0"}}';
30
+ const journal = await (0, journal_js_1.createSecurityPublishJournal)({
31
+ id: ID,
32
+ apiUrl: 'https://latticeai.app',
33
+ appId: '22222222-2222-4222-8222-222222222222',
34
+ clientRequestId: '33333333-3333-4333-8333-333333333333',
35
+ entitlementId: '44444444-4444-4444-8444-444444444444',
36
+ mode: 'scan',
37
+ parentRunId: null,
38
+ ...journalContext,
39
+ runId: '55555555-5555-4555-8555-555555555555',
40
+ reservationExpiresAt: '2026-10-20T02:00:00.000Z',
41
+ reportPath: 'C:\\fixture\\sanitized-report.json',
42
+ }, body, root, new Date('2026-10-20T00:00:00.000Z'));
43
+ const retained = await (0, journal_js_1.readSecurityPublishJournal)(ID, root);
44
+ strict_1.default.equal(retained.exactRequestBody, body);
45
+ strict_1.default.doesNotMatch(JSON.stringify(journal), /token|authorization/i);
46
+ strict_1.default.ok(journal.requestBodyPath);
47
+ await node_fs_1.promises.appendFile(journal.requestBodyPath, ' ');
48
+ await strict_1.default.rejects((0, journal_js_1.readSecurityPublishJournal)(ID, root), /changed after capture/);
49
+ await node_fs_1.promises.writeFile(journal.requestBodyPath, body);
50
+ await (0, journal_js_1.removeSecurityPublishJournal)(ID, root);
51
+ await strict_1.default.rejects(node_fs_1.promises.lstat((0, node_path_1.join)(root, ID)), { code: 'ENOENT' });
52
+ }
53
+ finally {
54
+ await node_fs_1.promises.rm(root, { recursive: true, force: true });
55
+ }
56
+ });
57
+ (0, node_test_1.default)('rejects non-JSON payloads before creating a journal', async () => {
58
+ const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-journal-invalid-'));
59
+ try {
60
+ await strict_1.default.rejects((0, journal_js_1.createSecurityPublishJournal)({
61
+ id: ID,
62
+ apiUrl: 'https://latticeai.app',
63
+ appId: ID,
64
+ clientRequestId: ID,
65
+ entitlementId: ID,
66
+ mode: 'scan',
67
+ parentRunId: null,
68
+ ...journalContext,
69
+ runId: ID,
70
+ reservationExpiresAt: '2026-10-20T02:00:00.000Z',
71
+ reportPath: 'report.json',
72
+ }, 'not json', root), SyntaxError);
73
+ }
74
+ finally {
75
+ await node_fs_1.promises.rm(root, { recursive: true, force: true });
76
+ }
77
+ });
78
+ (0, node_test_1.default)('persists the idempotent begin request before adding the server reservation', async () => {
79
+ const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-journal-begin-'));
80
+ try {
81
+ const pending = await (0, journal_js_1.createSecurityBeginJournal)({
82
+ id: ID,
83
+ apiUrl: 'https://latticeai.app',
84
+ appId: '22222222-2222-4222-8222-222222222222',
85
+ clientRequestId: ID,
86
+ entitlementId: '44444444-4444-4444-8444-444444444444',
87
+ mode: 'scan',
88
+ parentRunId: null,
89
+ ...journalContext,
90
+ retainedCompleted: false,
91
+ localExit: null,
92
+ reportPath: null,
93
+ }, root);
94
+ strict_1.default.equal((await (0, journal_js_1.readSecurityJournal)(ID, root)).state, 'begin_pending');
95
+ const reserved = await (0, journal_js_1.setSecurityJournalReservation)(pending, {
96
+ runId: '55555555-5555-4555-8555-555555555555',
97
+ reservationExpiresAt: '2026-10-20T02:00:00.000Z',
98
+ }, root);
99
+ strict_1.default.equal(reserved.state, 'reserved');
100
+ strict_1.default.equal((await (0, journal_js_1.readSecurityJournal)(ID, root)).runId, '55555555-5555-4555-8555-555555555555');
101
+ }
102
+ finally {
103
+ await node_fs_1.promises.rm(root, { recursive: true, force: true });
104
+ }
105
+ });
106
+ (0, node_test_1.default)('creates one durable recovery child under concurrent callers', async () => {
107
+ const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-journal-recovery-'));
108
+ try {
109
+ await (0, journal_js_1.createSecurityBeginJournal)({
110
+ id: ID,
111
+ apiUrl: 'https://latticeai.app',
112
+ appId: '22222222-2222-4222-8222-222222222222',
113
+ clientRequestId: ID,
114
+ entitlementId: '44444444-4444-4444-8444-444444444444',
115
+ mode: 'report',
116
+ parentRunId: null,
117
+ ...journalContext,
118
+ reportPath: 'C:\\fixture\\.vsg\\security\\output\\lattice-report.json',
119
+ }, root);
120
+ const records = await Promise.all(Array.from({ length: 8 }, () => (0, journal_js_1.createOrReadSecurityRecovery)(ID, root)));
121
+ strict_1.default.equal(new Set(records.map((record) => record.childJournalId)).size, 1);
122
+ }
123
+ finally {
124
+ await node_fs_1.promises.rm(root, { recursive: true, force: true });
125
+ }
126
+ });
127
+ (0, node_test_1.default)('creates one immutable acknowledgment receipt across processes and rejects a conflicting terminal result', async () => {
128
+ const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-journal-ack-contention-'));
129
+ const finalJournalId = '77777777-7777-4777-8777-777777777777';
130
+ const receipt = {
131
+ version: 1,
132
+ rootJournalId: ID,
133
+ finalJournalId,
134
+ finalRunId: '88888888-8888-4888-8888-888888888888',
135
+ journalIds: [finalJournalId, ID],
136
+ apiUrl: 'https://latticeai.app',
137
+ appId: '22222222-2222-4222-8222-222222222222',
138
+ localExit: 0,
139
+ acknowledgedAt: '2026-10-20T00:00:00.000Z',
140
+ };
141
+ try {
142
+ for (const journalId of receipt.journalIds) {
143
+ const directory = (0, node_path_1.join)(root, journalId);
144
+ await node_fs_1.promises.mkdir(directory, { recursive: true });
145
+ await Promise.all([
146
+ node_fs_1.promises.writeFile((0, node_path_1.join)(directory, 'journal.json'), '{}'),
147
+ node_fs_1.promises.writeFile((0, node_path_1.join)(directory, 'finish-request.json'), '{}'),
148
+ node_fs_1.promises.writeFile((0, node_path_1.join)(directory, 'recovery.json'), '{}'),
149
+ ]);
150
+ }
151
+ const journalModule = (0, node_path_1.join)(__dirname, 'journal.js');
152
+ const childScript = `
153
+ const { removeSecurityPublishJournal, saveSecurityAcknowledgment } = require(process.env.LATTICE_TEST_JOURNAL_MODULE);
154
+ (async () => {
155
+ const receipt = JSON.parse(process.env.LATTICE_TEST_ACK_RECEIPT);
156
+ const root = process.env.LATTICE_TEST_ACK_ROOT;
157
+ await saveSecurityAcknowledgment(receipt, root);
158
+ for (const journalId of receipt.journalIds) await removeSecurityPublishJournal(journalId, root, true);
159
+ })().catch((error) => { console.error(error); process.exitCode = 1; });
160
+ `;
161
+ const runChild = () => new Promise((resolve, reject) => {
162
+ const child = (0, node_child_process_1.spawn)(process.execPath, ['--eval', childScript], {
163
+ env: {
164
+ ...process.env,
165
+ LATTICE_TEST_JOURNAL_MODULE: journalModule,
166
+ LATTICE_TEST_ACK_RECEIPT: JSON.stringify(receipt),
167
+ LATTICE_TEST_ACK_ROOT: root,
168
+ },
169
+ stdio: ['ignore', 'ignore', 'pipe'],
170
+ });
171
+ let stderr = '';
172
+ child.stderr.setEncoding('utf8');
173
+ child.stderr.on('data', (chunk) => { stderr += chunk; });
174
+ child.once('error', reject);
175
+ child.once('exit', (code) => {
176
+ if (code === 0)
177
+ resolve();
178
+ else
179
+ reject(new Error(`acknowledgment child exited ${code}: ${stderr}`));
180
+ });
181
+ });
182
+ await Promise.all(Array.from({ length: 8 }, runChild));
183
+ strict_1.default.deepEqual(await (0, journal_js_1.readSecurityAcknowledgment)(ID, root), receipt);
184
+ strict_1.default.deepEqual(await (0, journal_js_1.readSecurityAcknowledgment)(finalJournalId, root), receipt);
185
+ strict_1.default.deepEqual((await node_fs_1.promises.readdir(root)).sort(), [
186
+ `${ID}.ack.json`, `${finalJournalId}.ack.json`, ID, finalJournalId,
187
+ ].sort());
188
+ strict_1.default.deepEqual(await node_fs_1.promises.readdir((0, node_path_1.join)(root, ID)), ['recovery.json']);
189
+ strict_1.default.deepEqual(await node_fs_1.promises.readdir((0, node_path_1.join)(root, finalJournalId)), ['recovery.json']);
190
+ await strict_1.default.rejects((0, journal_js_1.saveSecurityAcknowledgment)({
191
+ ...receipt,
192
+ finalRunId: '99999999-9999-4999-8999-999999999999',
193
+ }, root), /conflicts with an existing terminal result/);
194
+ strict_1.default.deepEqual(await (0, journal_js_1.readSecurityAcknowledgment)(ID, root), receipt);
195
+ }
196
+ finally {
197
+ await node_fs_1.promises.rm(root, { recursive: true, force: true });
198
+ }
199
+ });
200
+ (0, node_test_1.default)('acknowledges before removing finish body and metadata', async () => {
201
+ const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-journal-ack-'));
202
+ try {
203
+ const pending = await (0, journal_js_1.createSecurityPublishJournal)({
204
+ id: ID,
205
+ apiUrl: 'https://latticeai.app',
206
+ appId: '22222222-2222-4222-8222-222222222222',
207
+ clientRequestId: ID,
208
+ entitlementId: '44444444-4444-4444-8444-444444444444',
209
+ mode: 'scan',
210
+ parentRunId: null,
211
+ ...journalContext,
212
+ runId: '55555555-5555-4555-8555-555555555555',
213
+ reservationExpiresAt: '2026-10-20T02:00:00.000Z',
214
+ reportPath: 'C:\\fixture\\sanitized-report.json',
215
+ }, '{"outcome":"completed","report":{}}', root);
216
+ const acknowledged = await (0, journal_js_1.markSecurityJournalAcknowledged)(pending, root);
217
+ strict_1.default.equal((await (0, journal_js_1.readSecurityJournal)(ID, root)).state, 'acknowledged');
218
+ strict_1.default.equal((await (0, journal_js_1.readSecurityPublishJournal)(ID, root)).exactRequestBody, '{"outcome":"completed","report":{}}');
219
+ await (0, journal_js_1.removeSecurityPublishJournal)(acknowledged.id, root);
220
+ await strict_1.default.rejects(node_fs_1.promises.lstat((0, node_path_1.join)(root, ID)), { code: 'ENOENT' });
221
+ }
222
+ finally {
223
+ await node_fs_1.promises.rm(root, { recursive: true, force: true });
224
+ }
225
+ });
226
+ //# sourceMappingURL=journal.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.test.js","sourceRoot":"","sources":["../../src/security/journal.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,2DAA2C;AAC3C,qCAAyC;AACzC,qCAAiC;AACjC,yCAAiC;AACjC,0DAA6B;AAC7B,6CAWsB;AAGtB,MAAM,EAAE,GAAG,sCAAsC,CAAC;AAClD,MAAM,cAAc,GAAG;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,IAAI;IACpB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,qCAAqC;IAC7C,YAAY,EAAE,uBAAuB;IACrC,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;IACtC,kBAAkB,EAAE,4BAA4B;IAChD,iBAAiB,EAAE,IAAI;IACvB,SAAS,EAAE,CAAC;IACZ,gBAAgB,EAAE,IAAI;CACvB,CAAC;AAEF,IAAA,mBAAI,EAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;IAC1F,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,IAAA,gBAAI,EAAC,IAAA,gBAAM,GAAE,EAAE,2BAA2B,CAAC,CAAC,CAAC;IAC3E,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,6DAA6D,CAAC;QAC3E,MAAM,OAAO,GAAG,MAAM,IAAA,yCAA4B,EAAC;YAC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C1E,gBAAM,CAAC,KAAK,CAAC,CAAC,MAAM,IAAA,uCAA0B,EAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,qCAAqC,CAAC,CAAC;QACnH,MAAM,IAAA,yCAA4B,EAAC,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC1D,MAAM,gBAAM,CAAC,OAAO,CAAC,kBAAE,CAAC,KAAK,CAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;YAAS,CAAC;QACT,MAAM,kBAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { SecurityArtifactInspection } from './artifact.js';
2
+ export interface NpmPackFile {
3
+ path: string;
4
+ size: number;
5
+ }
6
+ export interface NpmPackResult {
7
+ filename: string;
8
+ shasum: string;
9
+ integrity: string;
10
+ files: NpmPackFile[];
11
+ }
12
+ export declare function assertVerifiedOutputOutsideStage(stageRoot: string, outputRoot: string): void;
13
+ export declare function verifySecurityPackageListing(pack: NpmPackResult, inspection: SecurityArtifactInspection, manifestBytes: number): void;
14
+ export declare function verifyPackedTarballDigest(pack: NpmPackResult, tarball: Uint8Array): void;
15
+ //# sourceMappingURL=package-verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-verifier.d.ts","sourceRoot":"","sources":["../../src/security/package-verifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAOhE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAO5F;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,aAAa,EACnB,UAAU,EAAE,0BAA0B,EACtC,aAAa,EAAE,MAAM,GACpB,IAAI,CA+BN;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAMxF"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertVerifiedOutputOutsideStage = assertVerifiedOutputOutsideStage;
4
+ exports.verifySecurityPackageListing = verifySecurityPackageListing;
5
+ exports.verifyPackedTarballDigest = verifyPackedTarballDigest;
6
+ const node_crypto_1 = require("node:crypto");
7
+ const node_path_1 = require("node:path");
8
+ const SHA1 = /^[0-9a-f]{40}$/;
9
+ const FORBIDDEN_PACKAGE_PARTS = new Set([
10
+ '.git', '.vsg', 'node_modules', 'raw', 'cache', 'security-connections.json', 'credentials.json', 'security-pending',
11
+ ]);
12
+ function assertVerifiedOutputOutsideStage(stageRoot, outputRoot) {
13
+ const fold = (value) => process.platform === 'win32' ? value.toLowerCase() : value;
14
+ const stage = fold((0, node_path_1.resolve)(stageRoot));
15
+ const output = fold((0, node_path_1.resolve)(outputRoot));
16
+ if (output === stage || output.startsWith(`${stage}${node_path_1.sep}`)) {
17
+ throw new Error('Commercial Security verified output must be outside dist/security-runtime.');
18
+ }
19
+ }
20
+ function verifySecurityPackageListing(pack, inspection, manifestBytes) {
21
+ if (!pack || typeof pack.filename !== 'string' || !pack.filename.endsWith('.tgz')
22
+ || typeof pack.shasum !== 'string' || !SHA1.test(pack.shasum)
23
+ || typeof pack.integrity !== 'string' || !pack.integrity.startsWith('sha512-')
24
+ || !Array.isArray(pack.files) || pack.files.length === 0) {
25
+ throw new Error('Commercial Security npm pack result is invalid.');
26
+ }
27
+ const seen = new Set();
28
+ const lower = new Set();
29
+ for (const file of pack.files) {
30
+ if (!file || typeof file.path !== 'string' || !file.path || file.path.includes('\\')
31
+ || !Number.isSafeInteger(file.size) || file.size < 0)
32
+ throw new Error('Commercial Security npm pack file entry is invalid.');
33
+ const folded = file.path.toLowerCase();
34
+ if (seen.has(file.path) || lower.has(folded))
35
+ throw new Error(`Commercial Security npm pack path ${file.path} is duplicate or case-colliding.`);
36
+ if (file.path.split('/').some((part) => FORBIDDEN_PACKAGE_PARTS.has(part.toLowerCase()))) {
37
+ throw new Error(`Commercial Security npm package contains forbidden path ${file.path}.`);
38
+ }
39
+ seen.add(file.path);
40
+ lower.add(folded);
41
+ }
42
+ const prefix = 'dist/security-runtime/';
43
+ const expected = new Map([[`${prefix}artifact-manifest.json`, manifestBytes]]);
44
+ for (const file of inspection.manifest.files)
45
+ expected.set(`${prefix}${file.path}`, file.bytes);
46
+ const actualSecurityFiles = pack.files.filter((file) => file.path.startsWith(prefix));
47
+ if (actualSecurityFiles.length !== expected.size)
48
+ throw new Error('Commercial Security npm package file list does not match the artifact manifest.');
49
+ for (const file of actualSecurityFiles) {
50
+ if (expected.get(file.path) !== file.size)
51
+ throw new Error(`Commercial Security npm package file ${file.path} has an unexpected size.`);
52
+ }
53
+ for (const path of expected.keys()) {
54
+ if (!seen.has(path))
55
+ throw new Error(`Commercial Security npm package is missing ${path}.`);
56
+ }
57
+ }
58
+ function verifyPackedTarballDigest(pack, tarball) {
59
+ const sha1 = (0, node_crypto_1.createHash)('sha1').update(tarball).digest('hex');
60
+ const integrity = `sha512-${(0, node_crypto_1.createHash)('sha512').update(tarball).digest('base64')}`;
61
+ if (pack.shasum !== sha1 || pack.integrity !== integrity) {
62
+ throw new Error('Commercial Security npm tarball digest does not match npm pack output.');
63
+ }
64
+ }
65
+ //# sourceMappingURL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GAAG,IAAA,wBAAU,EAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,UAAU,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACpF,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IAC5F,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=package-verifier.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-verifier.test.d.ts","sourceRoot":"","sources":["../../src/security/package-verifier.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const strict_1 = __importDefault(require("node:assert/strict"));
7
+ const node_crypto_1 = require("node:crypto");
8
+ const node_path_1 = require("node:path");
9
+ const node_test_1 = __importDefault(require("node:test"));
10
+ const package_verifier_js_1 = require("./package-verifier.js");
11
+ function inspection() {
12
+ return {
13
+ artifactRoot: 'fixture', manifestSha256: 'f'.repeat(64),
14
+ manifest: {
15
+ format: 'lattice-security-artifact-v1', sourceCommit: 'a'.repeat(40),
16
+ identity: {
17
+ vsgVersion: '1.0.2', profileId: 'commercial-default', profileVersion: '1.0.0',
18
+ rulesDigest: '1'.repeat(64), registryDigest: '2'.repeat(64), commercialManifestDigest: '3'.repeat(64),
19
+ evaluatorDigest: '4'.repeat(64), catalogDigest: '5'.repeat(64),
20
+ },
21
+ entryPoint: 'bin/vsg.mjs', exporterPath: 'src/lattice/export.mjs',
22
+ transportPath: 'src/lattice/transport.mjs', evaluatorPath: 'lattice-runtime.mjs',
23
+ releaseEligibility: { status: 'approved', blockers: [] },
24
+ files: [{ path: 'bin/vsg.mjs', sha256: '6'.repeat(64), bytes: 12 }],
25
+ },
26
+ };
27
+ }
28
+ function pack() {
29
+ const bytes = new TextEncoder().encode('synthetic tarball');
30
+ return {
31
+ filename: 'latticeai-cli-0.8.4.tgz',
32
+ shasum: (0, node_crypto_1.createHash)('sha1').update(bytes).digest('hex'),
33
+ integrity: `sha512-${(0, node_crypto_1.createHash)('sha512').update(bytes).digest('base64')}`,
34
+ files: [
35
+ { path: 'package.json', size: 100 },
36
+ { path: 'dist/security-runtime/artifact-manifest.json', size: 40 },
37
+ { path: 'dist/security-runtime/bin/vsg.mjs', size: 12 },
38
+ ],
39
+ };
40
+ }
41
+ (0, node_test_1.default)('synthetic approved package fixture requires the exact staged file list and matching tarball digests', () => {
42
+ const result = pack();
43
+ (0, package_verifier_js_1.verifySecurityPackageListing)(result, inspection(), 40);
44
+ (0, package_verifier_js_1.verifyPackedTarballDigest)(result, new TextEncoder().encode('synthetic tarball'));
45
+ strict_1.default.throws(() => (0, package_verifier_js_1.verifySecurityPackageListing)({ ...result, files: result.files.slice(0, -1) }, inspection(), 40), /file list/);
46
+ strict_1.default.throws(() => (0, package_verifier_js_1.verifySecurityPackageListing)({
47
+ ...result, files: [...result.files, { path: 'dist/security-runtime/src/RAW/secret', size: 1 }],
48
+ }, inspection(), 40), /forbidden path/);
49
+ strict_1.default.throws(() => (0, package_verifier_js_1.verifyPackedTarballDigest)(result, new TextEncoder().encode('changed')), /digest/);
50
+ });
51
+ (0, node_test_1.default)('requires retained verified output outside the temporary staged runtime', () => {
52
+ const stage = (0, node_path_1.resolve)('fixture', 'package', 'dist', 'security-runtime');
53
+ strict_1.default.throws(() => (0, package_verifier_js_1.assertVerifiedOutputOutsideStage)(stage, stage), /outside dist\/security-runtime/);
54
+ strict_1.default.throws(() => (0, package_verifier_js_1.assertVerifiedOutputOutsideStage)(stage, (0, node_path_1.join)(stage, 'verified')), /outside dist\/security-runtime/);
55
+ strict_1.default.doesNotThrow(() => (0, package_verifier_js_1.assertVerifiedOutputOutsideStage)(stage, (0, node_path_1.resolve)('fixture', 'verified-package')));
56
+ });
57
+ //# sourceMappingURL=package-verifier.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-verifier.test.js","sourceRoot":"","sources":["../../src/security/package-verifier.test.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AACxC,6CAAyC;AACzC,yCAA0C;AAC1C,0DAA6B;AAC7B,+DAK+B;AAG/B,SAAS,UAAU;IACjB,OAAO;QACL,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,QAAQ,EAAE;YACR,MAAM,EAAE,8BAA8B,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACpE,QAAQ,EAAE;gBACR,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,cAAc,EAAE,OAAO;gBAC7E,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,wBAAwB,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACrG,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;aAC/D;YACD,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,wBAAwB;YACjE,aAAa,EAAE,2BAA2B,EAAE,aAAa,EAAE,qBAAqB;YAChF,kBAAkB,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE;YACxD,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,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AE,CAAC,IAAA,kDAA4B,EAAC;QAC/C,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,sCAAsC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;KAC/F,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACxC,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,+CAAyB,EAAC,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxG,CAAC,CAAC,CAAC;AAEH,IAAA,mBAAI,EAAC,wEAAwE,EAAE,GAAG,EAAE;IAClF,MAAM,KAAK,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACxE,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,sDAAgC,EAAC,KAAK,EAAE,KAAK,CAAC,EAAE,gCAAgC,CAAC,CAAC;IACtG,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,sDAAgC,EAAC,KAAK,EAAE,IAAA,gBAAI,EAAC,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,gCAAgC,CAAC,CAAC;IACxH,gBAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAA,sDAAgC,EAAC,KAAK,EAAE,IAAA,mBAAO,EAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAC7G,CAAC,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { spawn } from 'node:child_process';
2
+ import type { SecurityArtifactInspection } from './artifact.js';
3
+ import type { SecurityRunMode } from './types.js';
4
+ export interface RunSecurityRuntimeOptions {
5
+ inspection: SecurityArtifactInspection;
6
+ repo: string;
7
+ outDir: string;
8
+ runId: string;
9
+ mode: SecurityRunMode;
10
+ repositoryIdentity: string;
11
+ validateCredentials?: boolean;
12
+ releaseUrl?: string;
13
+ base?: string;
14
+ compare?: string;
15
+ env?: NodeJS.ProcessEnv;
16
+ spawnProcess?: typeof spawn;
17
+ }
18
+ export interface ExportSecurityReportOptions {
19
+ inspection: SecurityArtifactInspection;
20
+ repo: string;
21
+ outDir: string;
22
+ runId: string;
23
+ mode: SecurityRunMode;
24
+ repositoryIdentity: string;
25
+ writeLocalReport?: boolean;
26
+ }
27
+ declare function scrubRuntimeEnvironment(source: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
28
+ export declare function runSecurityRuntime(options: RunSecurityRuntimeOptions): Promise<{
29
+ exitCode: 0 | 1 | 2 | 3;
30
+ report: unknown | null;
31
+ compactReport: unknown | null;
32
+ reportPath: string | null;
33
+ }>;
34
+ export declare function exportSecurityReport(options: ExportSecurityReportOptions): Promise<{
35
+ report: unknown;
36
+ compactReport: unknown;
37
+ reportPath: string;
38
+ }>;
39
+ export declare const securityRuntimeInternals: {
40
+ scrubRuntimeEnvironment: typeof scrubRuntimeEnvironment;
41
+ };
42
+ export {};
43
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/security/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiBlD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,0BAA0B,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,KAAK,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,0BAA0B,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,iBAAS,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAM7E;AAQD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC;IACpF,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,aAAa,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,CA2BD;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC;IACxF,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAuBD;AAED,eAAO,MAAM,wBAAwB;;CAA8B,CAAC"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.securityRuntimeInternals = void 0;
4
+ exports.runSecurityRuntime = runSecurityRuntime;
5
+ exports.exportSecurityReport = exportSecurityReport;
6
+ const node_child_process_1 = require("node:child_process");
7
+ const node_fs_1 = require("node:fs");
8
+ const node_path_1 = require("node:path");
9
+ const node_url_1 = require("node:url");
10
+ function scrubRuntimeEnvironment(source) {
11
+ const result = { ...source };
12
+ for (const key of Object.keys(result)) {
13
+ if (/^LATTICE_/i.test(key))
14
+ delete result[key];
15
+ }
16
+ return result;
17
+ }
18
+ async function importFrozenModule(file, expectedExport) {
19
+ const module = await import((0, node_url_1.pathToFileURL)(file).href);
20
+ if (typeof module[expectedExport] !== 'function')
21
+ throw new Error(`Security runtime module is missing ${expectedExport}.`);
22
+ return module;
23
+ }
24
+ async function runSecurityRuntime(options) {
25
+ const artifactRoot = options.inspection.artifactRoot;
26
+ const entryPoint = (0, node_path_1.join)(artifactRoot, ...options.inspection.manifest.entryPoint.split('/'));
27
+ const repo = (0, node_path_1.resolve)(options.repo);
28
+ const outDir = (0, node_path_1.resolve)(options.outDir);
29
+ const argv = [entryPoint, options.mode, repo, '--out', outDir];
30
+ if ((options.mode === 'deep' || options.mode === 'release') && !options.validateCredentials)
31
+ argv.push('--no-validate');
32
+ if (options.mode === 'release' && options.releaseUrl)
33
+ argv.push('--url', options.releaseUrl);
34
+ if (options.base && options.mode !== 'report')
35
+ argv.push('--base', options.base);
36
+ if (options.compare && options.mode !== 'report')
37
+ argv.push('--compare', options.compare);
38
+ const exitCode = await new Promise((resolveExit, reject) => {
39
+ const child = (options.spawnProcess ?? node_child_process_1.spawn)(process.execPath, argv, {
40
+ cwd: repo,
41
+ env: scrubRuntimeEnvironment(options.env ?? process.env),
42
+ shell: false,
43
+ stdio: 'inherit',
44
+ windowsHide: true,
45
+ });
46
+ child.once('error', reject);
47
+ child.once('exit', (code, signal) => resolveExit(signal ? 2 : (code ?? 2)));
48
+ });
49
+ if (![0, 1, 2, 3].includes(exitCode))
50
+ throw new Error(`Security runtime returned unsupported exit code ${exitCode}.`);
51
+ if (exitCode === 3)
52
+ return { exitCode, report: null, compactReport: null, reportPath: null };
53
+ const exported = await exportSecurityReport({ ...options, repo, outDir, writeLocalReport: true });
54
+ return { exitCode: exitCode, ...exported };
55
+ }
56
+ async function exportSecurityReport(options) {
57
+ const artifactRoot = options.inspection.artifactRoot;
58
+ const exporterFile = (0, node_path_1.join)(artifactRoot, ...options.inspection.manifest.exporterPath.split('/'));
59
+ const transportFile = (0, node_path_1.join)(artifactRoot, ...options.inspection.manifest.transportPath.split('/'));
60
+ const repo = (0, node_path_1.resolve)(options.repo);
61
+ const outDir = (0, node_path_1.resolve)(options.outDir);
62
+ const exporter = await importFrozenModule(exporterFile, 'exportLatticeReport');
63
+ const transport = await importFrozenModule(transportFile, 'encodeLatticeReportV3');
64
+ const report = await exporter.exportLatticeReport({
65
+ repo,
66
+ outDir,
67
+ runId: options.runId,
68
+ mode: options.mode,
69
+ artifactRoot,
70
+ repositoryIdentity: options.repositoryIdentity,
71
+ });
72
+ const compactReport = transport.encodeLatticeReportV3(report);
73
+ const reportPath = (0, node_path_1.join)(outDir, 'lattice-report.json');
74
+ if (options.writeLocalReport !== false) {
75
+ await node_fs_1.promises.mkdir((0, node_path_1.dirname)(reportPath), { recursive: true });
76
+ await node_fs_1.promises.writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`, { encoding: 'utf8', flag: 'w' });
77
+ }
78
+ return { report, compactReport, reportPath };
79
+ }
80
+ exports.securityRuntimeInternals = { scrubRuntimeEnvironment };
81
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/security/runtime.ts"],"names":[],"mappings":";;;AA6DA,gDAgCC;AAED,oDA2BC;AA1HD,2DAA2C;AAC3C,qCAAyC;AACzC,yCAAmD;AACnD,uCAAyC;AA4CzC,SAAS,uBAAuB,CAAC,MAAyB;IACxD,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,IAAI,YAAY,CAAC,I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