@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.
- package/DISCLOSURE +1 -0
- package/README.md +118 -2
- package/bundles/expo-mobile/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
- package/bundles/expo-mobile/.agents/skills/lattice-release-manager/SKILL.md +29 -0
- package/bundles/expo-mobile/.agents/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/expo-mobile/.claude/agents/lattice-feature-agent.md +10 -0
- package/bundles/expo-mobile/.claude/agents/lattice-release-manager.md +9 -0
- package/bundles/expo-mobile/.claude/hooks/README.md +9 -0
- package/bundles/expo-mobile/.claude/hooks/pre-commit-verify.mjs +10 -0
- package/bundles/expo-mobile/.claude/hooks/pre-tool-use.mjs +51 -0
- package/bundles/expo-mobile/.claude/rules/lattice-core.md +20 -0
- package/bundles/expo-mobile/.claude/settings.json +38 -0
- package/bundles/expo-mobile/.claude/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/expo-mobile/.codex/agents/lattice-feature-agent.toml +9 -0
- package/bundles/expo-mobile/.codex/agents/lattice-release-manager.toml +9 -0
- package/bundles/expo-mobile/.cursor/mcp.json +34 -0
- package/bundles/expo-mobile/.cursor/rules/lattice-core.mdc +35 -0
- package/bundles/expo-mobile/.cursor/rules.md +94 -0
- package/bundles/expo-mobile/.env.example +19 -0
- package/bundles/expo-mobile/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/bundles/expo-mobile/.github/agents/lattice-feature-agent.agent.md +7 -0
- package/bundles/expo-mobile/.github/agents/lattice-release-manager.agent.md +7 -0
- package/bundles/expo-mobile/.github/copilot-instructions.md +37 -0
- package/bundles/expo-mobile/.github/instructions/lattice-core.instructions.md +11 -0
- package/bundles/expo-mobile/.github/workflows/ci.yml +26 -0
- package/bundles/expo-mobile/.gitmessage +24 -0
- package/bundles/expo-mobile/.lattice/config.json +9 -0
- package/bundles/expo-mobile/.lattice/dependency-security.json +91 -0
- package/bundles/expo-mobile/.lattice/prompts/01-feature.md +36 -0
- package/bundles/expo-mobile/.lattice/prompts/02-bugfix.md +32 -0
- package/bundles/expo-mobile/.lattice/prompts/03-refactor.md +30 -0
- package/bundles/expo-mobile/.lattice/prompts/04-test.md +31 -0
- package/bundles/expo-mobile/.lattice/prompts/05-polish.md +38 -0
- package/bundles/expo-mobile/.lattice/prompts/06-security.md +32 -0
- package/bundles/expo-mobile/.lattice/release-workflow.json +55 -0
- package/bundles/expo-mobile/.lattice/schemas/feature-handoff.schema.json +264 -0
- package/bundles/expo-mobile/.lattice/templates/feature-handoff.json +52 -0
- package/bundles/expo-mobile/.mcp.json +35 -0
- package/bundles/expo-mobile/AGENTS.md +58 -0
- package/bundles/expo-mobile/CLAUDE.md +75 -0
- package/bundles/expo-mobile/PROJECT_GUIDE.md +299 -0
- package/bundles/expo-mobile/README.md +39 -0
- package/bundles/expo-mobile/__tests__/home.test.tsx +22 -0
- package/bundles/expo-mobile/app/_layout.tsx +20 -0
- package/bundles/expo-mobile/app/index.tsx +72 -0
- package/bundles/expo-mobile/app.json +33 -0
- package/bundles/expo-mobile/components/ui/Button.tsx +75 -0
- package/bundles/expo-mobile/components/ui/Input.tsx +50 -0
- package/bundles/expo-mobile/components/ui/index.ts +2 -0
- package/bundles/expo-mobile/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
- package/bundles/expo-mobile/docs/rules/codex.md +62 -0
- package/bundles/expo-mobile/eslint.config.js +7 -0
- package/bundles/expo-mobile/lib/supabase/client.ts +22 -0
- package/bundles/expo-mobile/lib/supabase/realtime.ts +10 -0
- package/bundles/expo-mobile/lib/supabase/storage.ts +6 -0
- package/bundles/expo-mobile/package.json +65 -0
- package/bundles/expo-mobile/plugins/with-lattice-commons-io.cjs +42 -0
- package/bundles/expo-mobile/prompts/01-feature-implementation.md +48 -0
- package/bundles/expo-mobile/prompts/02-bug-fix.md +43 -0
- package/bundles/expo-mobile/prompts/03-safe-refactor.md +38 -0
- package/bundles/expo-mobile/prompts/04-test-first.md +41 -0
- package/bundles/expo-mobile/prompts/05-ui-polish.md +44 -0
- package/bundles/expo-mobile/prompts/06-security-review.md +39 -0
- package/bundles/expo-mobile/prompts/quality.md +143 -0
- package/bundles/expo-mobile/supabase/migrations/001_initial_schema.sql +66 -0
- package/bundles/expo-mobile/tsconfig.json +21 -0
- package/bundles/expo-mobile/types/database.types.ts +76 -0
- package/bundles/expo-mobile/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
- package/bundles/expo-supabase/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
- package/bundles/expo-supabase/.agents/skills/lattice-release-manager/SKILL.md +29 -0
- package/bundles/expo-supabase/.agents/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/expo-supabase/.claude/agents/lattice-feature-agent.md +10 -0
- package/bundles/expo-supabase/.claude/agents/lattice-release-manager.md +9 -0
- package/bundles/expo-supabase/.claude/hooks/README.md +9 -0
- package/bundles/expo-supabase/.claude/hooks/pre-commit-verify.mjs +10 -0
- package/bundles/expo-supabase/.claude/hooks/pre-tool-use.mjs +51 -0
- package/bundles/expo-supabase/.claude/rules/lattice-core.md +20 -0
- package/bundles/expo-supabase/.claude/settings.json +38 -0
- package/bundles/expo-supabase/.claude/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/expo-supabase/.codex/agents/lattice-feature-agent.toml +9 -0
- package/bundles/expo-supabase/.codex/agents/lattice-release-manager.toml +9 -0
- package/bundles/expo-supabase/.cursor/mcp.json +34 -0
- package/bundles/expo-supabase/.cursor/rules/lattice-core.mdc +35 -0
- package/bundles/expo-supabase/.cursor/rules.md +94 -0
- package/bundles/expo-supabase/.env.example +12 -0
- package/bundles/expo-supabase/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/bundles/expo-supabase/.github/agents/lattice-feature-agent.agent.md +7 -0
- package/bundles/expo-supabase/.github/agents/lattice-release-manager.agent.md +7 -0
- package/bundles/expo-supabase/.github/copilot-instructions.md +37 -0
- package/bundles/expo-supabase/.github/instructions/lattice-core.instructions.md +11 -0
- package/bundles/expo-supabase/.github/workflows/ci.yml +26 -0
- package/bundles/expo-supabase/.gitmessage +24 -0
- package/bundles/expo-supabase/.lattice/config.json +9 -0
- package/bundles/expo-supabase/.lattice/dependency-security.json +91 -0
- package/bundles/expo-supabase/.lattice/prompts/01-feature.md +36 -0
- package/bundles/expo-supabase/.lattice/prompts/02-bugfix.md +32 -0
- package/bundles/expo-supabase/.lattice/prompts/03-refactor.md +30 -0
- package/bundles/expo-supabase/.lattice/prompts/04-test.md +31 -0
- package/bundles/expo-supabase/.lattice/prompts/05-polish.md +38 -0
- package/bundles/expo-supabase/.lattice/prompts/06-security.md +32 -0
- package/bundles/expo-supabase/.lattice/release-workflow.json +55 -0
- package/bundles/expo-supabase/.lattice/schemas/feature-handoff.schema.json +264 -0
- package/bundles/expo-supabase/.lattice/templates/feature-handoff.json +52 -0
- package/bundles/expo-supabase/.mcp.json +35 -0
- package/bundles/expo-supabase/AGENTS.md +58 -0
- package/bundles/expo-supabase/CLAUDE.md +75 -0
- package/bundles/expo-supabase/PROJECT_GUIDE.md +201 -0
- package/bundles/expo-supabase/README.md +38 -0
- package/bundles/expo-supabase/__tests__/home.test.tsx +22 -0
- package/bundles/expo-supabase/app/_layout.tsx +14 -0
- package/bundles/expo-supabase/app/index.tsx +72 -0
- package/bundles/expo-supabase/app.json +33 -0
- package/bundles/expo-supabase/components/ui/Button.tsx +75 -0
- package/bundles/expo-supabase/components/ui/Input.tsx +50 -0
- package/bundles/expo-supabase/components/ui/index.ts +2 -0
- package/bundles/expo-supabase/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
- package/bundles/expo-supabase/docs/rules/codex.md +62 -0
- package/bundles/expo-supabase/eslint.config.js +7 -0
- package/bundles/expo-supabase/lib/supabase/client.ts +22 -0
- package/bundles/expo-supabase/lib/supabase/realtime.ts +10 -0
- package/bundles/expo-supabase/lib/supabase/storage.ts +6 -0
- package/bundles/expo-supabase/package.json +60 -0
- package/bundles/expo-supabase/plugins/with-lattice-commons-io.cjs +42 -0
- package/bundles/expo-supabase/prompts/01-feature-implementation.md +8 -0
- package/bundles/expo-supabase/prompts/02-bug-fix.md +9 -0
- package/bundles/expo-supabase/prompts/03-safe-refactor.md +8 -0
- package/bundles/expo-supabase/prompts/04-test-first.md +7 -0
- package/bundles/expo-supabase/prompts/05-ui-polish.md +7 -0
- package/bundles/expo-supabase/prompts/06-security-review.md +7 -0
- package/bundles/expo-supabase/prompts/quality.md +143 -0
- package/bundles/expo-supabase/supabase/migrations/001_initial_schema.sql +66 -0
- package/bundles/expo-supabase/tsconfig.json +21 -0
- package/bundles/expo-supabase/types/database.types.ts +76 -0
- package/bundles/expo-supabase/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
- package/bundles/nextjs-landing/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
- package/bundles/nextjs-landing/.agents/skills/lattice-release-manager/SKILL.md +29 -0
- package/bundles/nextjs-landing/.agents/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/nextjs-landing/.claude/agents/lattice-feature-agent.md +10 -0
- package/bundles/nextjs-landing/.claude/agents/lattice-release-manager.md +9 -0
- package/bundles/nextjs-landing/.claude/hooks/README.md +9 -0
- package/bundles/nextjs-landing/.claude/hooks/pre-commit-verify.mjs +10 -0
- package/bundles/nextjs-landing/.claude/hooks/pre-tool-use.mjs +51 -0
- package/bundles/nextjs-landing/.claude/rules/lattice-core.md +20 -0
- package/bundles/nextjs-landing/.claude/settings.json +38 -0
- package/bundles/nextjs-landing/.claude/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/nextjs-landing/.codex/agents/lattice-feature-agent.toml +9 -0
- package/bundles/nextjs-landing/.codex/agents/lattice-release-manager.toml +9 -0
- package/bundles/nextjs-landing/.cursor/mcp.json +34 -0
- package/bundles/nextjs-landing/.cursor/rules/lattice-core.mdc +35 -0
- package/bundles/nextjs-landing/.cursor/rules.md +95 -0
- package/bundles/nextjs-landing/.env.example +24 -0
- package/bundles/nextjs-landing/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/bundles/nextjs-landing/.github/agents/lattice-feature-agent.agent.md +7 -0
- package/bundles/nextjs-landing/.github/agents/lattice-release-manager.agent.md +7 -0
- package/bundles/nextjs-landing/.github/copilot-instructions.md +37 -0
- package/bundles/nextjs-landing/.github/instructions/lattice-core.instructions.md +11 -0
- package/bundles/nextjs-landing/.github/workflows/ci.yml +26 -0
- package/bundles/nextjs-landing/.gitmessage +24 -0
- package/bundles/nextjs-landing/.lattice/config.json +9 -0
- package/bundles/nextjs-landing/.lattice/dependency-security.json +46 -0
- package/bundles/nextjs-landing/.lattice/prompts/01-feature.md +36 -0
- package/bundles/nextjs-landing/.lattice/prompts/02-bugfix.md +32 -0
- package/bundles/nextjs-landing/.lattice/prompts/03-refactor.md +30 -0
- package/bundles/nextjs-landing/.lattice/prompts/04-test.md +31 -0
- package/bundles/nextjs-landing/.lattice/prompts/05-polish.md +38 -0
- package/bundles/nextjs-landing/.lattice/prompts/06-security.md +32 -0
- package/bundles/nextjs-landing/.lattice/release-workflow.json +55 -0
- package/bundles/nextjs-landing/.lattice/schemas/feature-handoff.schema.json +264 -0
- package/bundles/nextjs-landing/.lattice/templates/feature-handoff.json +52 -0
- package/bundles/nextjs-landing/.mcp.json +35 -0
- package/bundles/nextjs-landing/AGENTS.md +58 -0
- package/bundles/nextjs-landing/CLAUDE.md +76 -0
- package/bundles/nextjs-landing/PROJECT_GUIDE.md +216 -0
- package/bundles/nextjs-landing/README.md +39 -0
- package/bundles/nextjs-landing/app/api/example/[id]/route.ts +34 -0
- package/bundles/nextjs-landing/app/api/example/route.ts +24 -0
- package/bundles/nextjs-landing/app/api/health/route.ts +8 -0
- package/bundles/nextjs-landing/app/global-error.tsx +17 -0
- package/bundles/nextjs-landing/app/globals.css +55 -0
- package/bundles/nextjs-landing/app/layout.tsx +22 -0
- package/bundles/nextjs-landing/app/page.tsx +42 -0
- package/bundles/nextjs-landing/components/ui/button.tsx +39 -0
- package/bundles/nextjs-landing/components/ui/card.tsx +53 -0
- package/bundles/nextjs-landing/components/ui/index.ts +4 -0
- package/bundles/nextjs-landing/components/ui/input.tsx +23 -0
- package/bundles/nextjs-landing/components/ui/spinner.tsx +22 -0
- package/bundles/nextjs-landing/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
- package/bundles/nextjs-landing/docs/rules/codex.md +62 -0
- package/bundles/nextjs-landing/eslint.config.mjs +16 -0
- package/bundles/nextjs-landing/instrumentation-client.ts +30 -0
- package/bundles/nextjs-landing/instrumentation.ts +12 -0
- package/bundles/nextjs-landing/jest.config.mjs +16 -0
- package/bundles/nextjs-landing/jest.setup.js +1 -0
- package/bundles/nextjs-landing/lib/utils.ts +6 -0
- package/bundles/nextjs-landing/next-env.d.ts +5 -0
- package/bundles/nextjs-landing/next.config.ts +15 -0
- package/bundles/nextjs-landing/package.json +48 -0
- package/bundles/nextjs-landing/postcss.config.mjs +7 -0
- package/bundles/nextjs-landing/prompts/01-feature-implementation.md +9 -0
- package/bundles/nextjs-landing/prompts/02-bug-fix.md +10 -0
- package/bundles/nextjs-landing/prompts/03-safe-refactor.md +8 -0
- package/bundles/nextjs-landing/prompts/04-test-first.md +8 -0
- package/bundles/nextjs-landing/prompts/05-ui-polish.md +8 -0
- package/bundles/nextjs-landing/prompts/06-security-review.md +7 -0
- package/bundles/nextjs-landing/prompts/quality.md +269 -0
- package/bundles/nextjs-landing/sentry.edge.config.ts +15 -0
- package/bundles/nextjs-landing/sentry.server.config.ts +15 -0
- package/bundles/nextjs-landing/tsconfig.json +42 -0
- package/bundles/nextjs-landing/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
- package/bundles/nextjs-saas/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
- package/bundles/nextjs-saas/.agents/skills/lattice-release-manager/SKILL.md +29 -0
- package/bundles/nextjs-saas/.agents/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/nextjs-saas/.claude/agents/lattice-feature-agent.md +10 -0
- package/bundles/nextjs-saas/.claude/agents/lattice-release-manager.md +9 -0
- package/bundles/nextjs-saas/.claude/hooks/README.md +9 -0
- package/bundles/nextjs-saas/.claude/hooks/pre-commit-verify.mjs +10 -0
- package/bundles/nextjs-saas/.claude/hooks/pre-tool-use.mjs +51 -0
- package/bundles/nextjs-saas/.claude/rules/lattice-core.md +20 -0
- package/bundles/nextjs-saas/.claude/settings.json +38 -0
- package/bundles/nextjs-saas/.claude/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/nextjs-saas/.codex/agents/lattice-feature-agent.toml +9 -0
- package/bundles/nextjs-saas/.codex/agents/lattice-release-manager.toml +9 -0
- package/bundles/nextjs-saas/.cursor/mcp.json +34 -0
- package/bundles/nextjs-saas/.cursor/rules/lattice-core.mdc +35 -0
- package/bundles/nextjs-saas/.cursor/rules.md +95 -0
- package/bundles/nextjs-saas/.env.example +48 -0
- package/bundles/nextjs-saas/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/bundles/nextjs-saas/.github/agents/lattice-feature-agent.agent.md +7 -0
- package/bundles/nextjs-saas/.github/agents/lattice-release-manager.agent.md +7 -0
- package/bundles/nextjs-saas/.github/copilot-instructions.md +37 -0
- package/bundles/nextjs-saas/.github/instructions/lattice-core.instructions.md +11 -0
- package/bundles/nextjs-saas/.github/workflows/ci.yml +26 -0
- package/bundles/nextjs-saas/.gitmessage +24 -0
- package/bundles/nextjs-saas/.lattice/config.json +9 -0
- package/bundles/nextjs-saas/.lattice/dependency-security.json +46 -0
- package/bundles/nextjs-saas/.lattice/prompts/01-feature.md +36 -0
- package/bundles/nextjs-saas/.lattice/prompts/02-bugfix.md +32 -0
- package/bundles/nextjs-saas/.lattice/prompts/03-refactor.md +30 -0
- package/bundles/nextjs-saas/.lattice/prompts/04-test.md +31 -0
- package/bundles/nextjs-saas/.lattice/prompts/05-polish.md +38 -0
- package/bundles/nextjs-saas/.lattice/prompts/06-security.md +32 -0
- package/bundles/nextjs-saas/.lattice/prompts/quality.md +269 -0
- package/bundles/nextjs-saas/.lattice/release-workflow.json +55 -0
- package/bundles/nextjs-saas/.lattice/schemas/feature-handoff.schema.json +264 -0
- package/bundles/nextjs-saas/.lattice/templates/feature-handoff.json +52 -0
- package/bundles/nextjs-saas/.mcp.json +35 -0
- package/bundles/nextjs-saas/AGENTS.md +58 -0
- package/bundles/nextjs-saas/CLAUDE.md +76 -0
- package/bundles/nextjs-saas/PROJECT_GUIDE.md +279 -0
- package/bundles/nextjs-saas/README.md +42 -0
- package/bundles/nextjs-saas/app/(auth)/forgot-password/page.tsx +101 -0
- package/bundles/nextjs-saas/app/(auth)/layout.tsx +7 -0
- package/bundles/nextjs-saas/app/(auth)/login/page.tsx +108 -0
- package/bundles/nextjs-saas/app/(auth)/reset-password/page.tsx +135 -0
- package/bundles/nextjs-saas/app/(auth)/signup/page.tsx +144 -0
- package/bundles/nextjs-saas/app/(dashboard)/dashboard/page.tsx +80 -0
- package/bundles/nextjs-saas/app/(dashboard)/layout.tsx +49 -0
- package/bundles/nextjs-saas/app/api/billing/checkout/route.ts +47 -0
- package/bundles/nextjs-saas/app/api/billing/portal/route.ts +29 -0
- package/bundles/nextjs-saas/app/api/example/[id]/route.ts +93 -0
- package/bundles/nextjs-saas/app/api/example/route.ts +61 -0
- package/bundles/nextjs-saas/app/api/health/route.ts +8 -0
- package/bundles/nextjs-saas/app/api/stripe/webhook/route.ts +57 -0
- package/bundles/nextjs-saas/app/api/user/route.ts +49 -0
- package/bundles/nextjs-saas/app/auth/callback/route.ts +16 -0
- package/bundles/nextjs-saas/app/auth/signout/route.ts +10 -0
- package/bundles/nextjs-saas/app/global-error.tsx +17 -0
- package/bundles/nextjs-saas/app/globals.css +55 -0
- package/bundles/nextjs-saas/app/layout.tsx +22 -0
- package/bundles/nextjs-saas/app/page.tsx +84 -0
- package/bundles/nextjs-saas/components/ui/button.tsx +39 -0
- package/bundles/nextjs-saas/components/ui/card.tsx +53 -0
- package/bundles/nextjs-saas/components/ui/index.ts +4 -0
- package/bundles/nextjs-saas/components/ui/input.tsx +23 -0
- package/bundles/nextjs-saas/components/ui/spinner.tsx +22 -0
- package/bundles/nextjs-saas/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
- package/bundles/nextjs-saas/docs/rules/codex.md +62 -0
- package/bundles/nextjs-saas/eslint.config.mjs +16 -0
- package/bundles/nextjs-saas/instrumentation-client.ts +30 -0
- package/bundles/nextjs-saas/instrumentation.ts +12 -0
- package/bundles/nextjs-saas/jest.config.mjs +16 -0
- package/bundles/nextjs-saas/jest.setup.js +1 -0
- package/bundles/nextjs-saas/lib/auth/password-recovery.ts +94 -0
- package/bundles/nextjs-saas/lib/stripe.ts +10 -0
- package/bundles/nextjs-saas/lib/supabase/admin.ts +14 -0
- package/bundles/nextjs-saas/lib/supabase/client.ts +8 -0
- package/bundles/nextjs-saas/lib/supabase/server.ts +27 -0
- package/bundles/nextjs-saas/lib/utils.ts +6 -0
- package/bundles/nextjs-saas/next-env.d.ts +5 -0
- package/bundles/nextjs-saas/next.config.ts +15 -0
- package/bundles/nextjs-saas/package.json +50 -0
- package/bundles/nextjs-saas/postcss.config.mjs +7 -0
- package/bundles/nextjs-saas/prompts/01-feature-implementation.md +92 -0
- package/bundles/nextjs-saas/prompts/02-bug-fix.md +78 -0
- package/bundles/nextjs-saas/prompts/03-safe-refactor.md +82 -0
- package/bundles/nextjs-saas/prompts/04-test-first.md +80 -0
- package/bundles/nextjs-saas/prompts/05-ui-polish.md +82 -0
- package/bundles/nextjs-saas/prompts/06-security-review.md +74 -0
- package/bundles/nextjs-saas/proxy.ts +61 -0
- package/bundles/nextjs-saas/sentry.edge.config.ts +15 -0
- package/bundles/nextjs-saas/sentry.server.config.ts +15 -0
- package/bundles/nextjs-saas/supabase/migrations/001_initial_schema.sql +66 -0
- package/bundles/nextjs-saas/supabase/migrations/002_billing.sql +17 -0
- package/bundles/nextjs-saas/tsconfig.json +42 -0
- package/bundles/nextjs-saas/types/database.types.ts +76 -0
- package/bundles/nextjs-saas/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
- package/bundles/nextjs-trpc/.agents/skills/lattice-feature-handoff/SKILL.md +31 -0
- package/bundles/nextjs-trpc/.agents/skills/lattice-release-manager/SKILL.md +29 -0
- package/bundles/nextjs-trpc/.agents/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/nextjs-trpc/.claude/agents/lattice-feature-agent.md +10 -0
- package/bundles/nextjs-trpc/.claude/agents/lattice-release-manager.md +9 -0
- package/bundles/nextjs-trpc/.claude/hooks/README.md +9 -0
- package/bundles/nextjs-trpc/.claude/hooks/pre-commit-verify.mjs +10 -0
- package/bundles/nextjs-trpc/.claude/hooks/pre-tool-use.mjs +51 -0
- package/bundles/nextjs-trpc/.claude/rules/lattice-core.md +20 -0
- package/bundles/nextjs-trpc/.claude/settings.json +38 -0
- package/bundles/nextjs-trpc/.claude/skills/lattice-verify/SKILL.md +27 -0
- package/bundles/nextjs-trpc/.codex/agents/lattice-feature-agent.toml +9 -0
- package/bundles/nextjs-trpc/.codex/agents/lattice-release-manager.toml +9 -0
- package/bundles/nextjs-trpc/.cursor/mcp.json +34 -0
- package/bundles/nextjs-trpc/.cursor/rules/lattice-core.mdc +35 -0
- package/bundles/nextjs-trpc/.cursor/rules.md +95 -0
- package/bundles/nextjs-trpc/.env.example +21 -0
- package/bundles/nextjs-trpc/.github/PULL_REQUEST_TEMPLATE.md +42 -0
- package/bundles/nextjs-trpc/.github/agents/lattice-feature-agent.agent.md +7 -0
- package/bundles/nextjs-trpc/.github/agents/lattice-release-manager.agent.md +7 -0
- package/bundles/nextjs-trpc/.github/copilot-instructions.md +37 -0
- package/bundles/nextjs-trpc/.github/instructions/lattice-core.instructions.md +11 -0
- package/bundles/nextjs-trpc/.github/workflows/ci.yml +26 -0
- package/bundles/nextjs-trpc/.gitmessage +24 -0
- package/bundles/nextjs-trpc/.lattice/config.json +9 -0
- package/bundles/nextjs-trpc/.lattice/dependency-security.json +46 -0
- package/bundles/nextjs-trpc/.lattice/prompts/01-feature.md +36 -0
- package/bundles/nextjs-trpc/.lattice/prompts/02-bugfix.md +32 -0
- package/bundles/nextjs-trpc/.lattice/prompts/03-refactor.md +30 -0
- package/bundles/nextjs-trpc/.lattice/prompts/04-test.md +31 -0
- package/bundles/nextjs-trpc/.lattice/prompts/05-polish.md +38 -0
- package/bundles/nextjs-trpc/.lattice/prompts/06-security.md +32 -0
- package/bundles/nextjs-trpc/.lattice/release-workflow.json +55 -0
- package/bundles/nextjs-trpc/.lattice/schemas/feature-handoff.schema.json +264 -0
- package/bundles/nextjs-trpc/.lattice/templates/feature-handoff.json +52 -0
- package/bundles/nextjs-trpc/.mcp.json +35 -0
- package/bundles/nextjs-trpc/AGENTS.md +58 -0
- package/bundles/nextjs-trpc/CLAUDE.md +76 -0
- package/bundles/nextjs-trpc/PROJECT_GUIDE.md +187 -0
- package/bundles/nextjs-trpc/README.md +49 -0
- package/bundles/nextjs-trpc/app/api/trpc/[trpc]/route.ts +12 -0
- package/bundles/nextjs-trpc/app/global-error.tsx +17 -0
- package/bundles/nextjs-trpc/app/globals.css +55 -0
- package/bundles/nextjs-trpc/app/layout.tsx +19 -0
- package/bundles/nextjs-trpc/app/page.tsx +16 -0
- package/bundles/nextjs-trpc/app/providers.tsx +24 -0
- package/bundles/nextjs-trpc/components/ui/button.tsx +39 -0
- package/bundles/nextjs-trpc/components/ui/card.tsx +53 -0
- package/bundles/nextjs-trpc/components/ui/index.ts +4 -0
- package/bundles/nextjs-trpc/components/ui/input.tsx +23 -0
- package/bundles/nextjs-trpc/components/ui/spinner.tsx +22 -0
- package/bundles/nextjs-trpc/components/user-list.tsx +17 -0
- package/bundles/nextjs-trpc/docs/LATTICE_RELEASE_WORKFLOW.md +53 -0
- package/bundles/nextjs-trpc/docs/rules/codex.md +62 -0
- package/bundles/nextjs-trpc/eslint.config.mjs +16 -0
- package/bundles/nextjs-trpc/instrumentation-client.ts +20 -0
- package/bundles/nextjs-trpc/instrumentation.ts +12 -0
- package/bundles/nextjs-trpc/jest.config.mjs +16 -0
- package/bundles/nextjs-trpc/jest.setup.js +1 -0
- package/bundles/nextjs-trpc/lib/db.ts +17 -0
- package/bundles/nextjs-trpc/lib/trpc/react.tsx +7 -0
- package/bundles/nextjs-trpc/lib/utils.ts +6 -0
- package/bundles/nextjs-trpc/next-env.d.ts +5 -0
- package/bundles/nextjs-trpc/next.config.ts +15 -0
- package/bundles/nextjs-trpc/package.json +62 -0
- package/bundles/nextjs-trpc/postcss.config.mjs +7 -0
- package/bundles/nextjs-trpc/prisma/schema.prisma +41 -0
- package/bundles/nextjs-trpc/prisma.config.ts +10 -0
- package/bundles/nextjs-trpc/prompts/01-feature-implementation.md +9 -0
- package/bundles/nextjs-trpc/prompts/02-bug-fix.md +9 -0
- package/bundles/nextjs-trpc/prompts/03-safe-refactor.md +8 -0
- package/bundles/nextjs-trpc/prompts/04-test-first.md +8 -0
- package/bundles/nextjs-trpc/prompts/05-ui-polish.md +7 -0
- package/bundles/nextjs-trpc/prompts/06-security-review.md +7 -0
- package/bundles/nextjs-trpc/prompts/quality.md +269 -0
- package/bundles/nextjs-trpc/sentry.edge.config.ts +15 -0
- package/bundles/nextjs-trpc/sentry.server.config.ts +15 -0
- package/bundles/nextjs-trpc/server/routers/_app.test.ts +60 -0
- package/bundles/nextjs-trpc/server/routers/_app.ts +25 -0
- package/bundles/nextjs-trpc/server/trpc.ts +12 -0
- package/bundles/nextjs-trpc/tsconfig.json +42 -0
- package/bundles/nextjs-trpc/vendor/m2ai-braces-3.0.3-m2ai.1.tar +0 -0
- package/dist/agent-install-session.d.ts +17 -0
- package/dist/agent-install-session.d.ts.map +1 -0
- package/dist/agent-install-session.js +106 -0
- package/dist/agent-install-session.js.map +1 -0
- package/dist/agent-install-session.test.d.ts +2 -0
- package/dist/agent-install-session.test.d.ts.map +1 -0
- package/dist/agent-install-session.test.js +62 -0
- package/dist/agent-install-session.test.js.map +1 -0
- package/dist/agent-install.d.ts +41 -0
- package/dist/agent-install.d.ts.map +1 -0
- package/dist/agent-install.js +42 -0
- package/dist/agent-install.js.map +1 -0
- package/dist/agent-install.test.d.ts +2 -0
- package/dist/agent-install.test.d.ts.map +1 -0
- package/dist/agent-install.test.js +58 -0
- package/dist/agent-install.test.js.map +1 -0
- package/dist/apply-merge.test.d.ts +2 -0
- package/dist/apply-merge.test.d.ts.map +1 -0
- package/dist/apply-merge.test.js +123 -0
- package/dist/apply-merge.test.js.map +1 -0
- package/dist/bundle-download.d.ts +23 -0
- package/dist/bundle-download.d.ts.map +1 -0
- package/dist/bundle-download.js +180 -0
- package/dist/bundle-download.js.map +1 -0
- package/dist/bundle-download.test.d.ts +2 -0
- package/dist/bundle-download.test.d.ts.map +1 -0
- package/dist/bundle-download.test.js +200 -0
- package/dist/bundle-download.test.js.map +1 -0
- package/dist/bundle-rollback.test.d.ts +2 -0
- package/dist/bundle-rollback.test.d.ts.map +1 -0
- package/dist/bundle-rollback.test.js +127 -0
- package/dist/bundle-rollback.test.js.map +1 -0
- package/dist/bundle-scaffold.test.d.ts +2 -0
- package/dist/bundle-scaffold.test.d.ts.map +1 -0
- package/dist/bundle-scaffold.test.js +105 -0
- package/dist/bundle-scaffold.test.js.map +1 -0
- package/dist/commands.d.ts +132 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +2012 -0
- package/dist/commands.js.map +1 -0
- package/dist/credential-store.d.ts +27 -0
- package/dist/credential-store.d.ts.map +1 -0
- package/dist/credential-store.js +48 -0
- package/dist/credential-store.js.map +1 -0
- package/dist/credential-store.test.d.ts +2 -0
- package/dist/credential-store.test.d.ts.map +1 -0
- package/dist/credential-store.test.js +80 -0
- package/dist/credential-store.test.js.map +1 -0
- package/dist/delivered-project-files.d.ts +31 -0
- package/dist/delivered-project-files.d.ts.map +1 -0
- package/dist/delivered-project-files.js +158 -0
- package/dist/delivered-project-files.js.map +1 -0
- package/dist/delivered-project-files.test.d.ts +2 -0
- package/dist/delivered-project-files.test.d.ts.map +1 -0
- package/dist/delivered-project-files.test.js +107 -0
- package/dist/delivered-project-files.test.js.map +1 -0
- package/dist/doctor-agents.test.d.ts +2 -0
- package/dist/doctor-agents.test.d.ts.map +1 -0
- package/dist/doctor-agents.test.js +65 -0
- package/dist/doctor-agents.test.js.map +1 -0
- package/dist/hermes-install.d.ts +102 -0
- package/dist/hermes-install.d.ts.map +1 -0
- package/dist/hermes-install.js +641 -0
- package/dist/hermes-install.js.map +1 -0
- package/dist/hermes-install.test.d.ts +2 -0
- package/dist/hermes-install.test.d.ts.map +1 -0
- package/dist/hermes-install.test.js +866 -0
- package/dist/hermes-install.test.js.map +1 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5311 -0
- package/dist/index.js.map +1 -0
- package/dist/openclaw-install.d.ts +67 -0
- package/dist/openclaw-install.d.ts.map +1 -0
- package/dist/openclaw-install.js +358 -0
- package/dist/openclaw-install.js.map +1 -0
- package/dist/openclaw-install.test.d.ts +2 -0
- package/dist/openclaw-install.test.d.ts.map +1 -0
- package/dist/openclaw-install.test.js +296 -0
- package/dist/openclaw-install.test.js.map +1 -0
- package/dist/password-recovery-bundle.test.d.ts +2 -0
- package/dist/password-recovery-bundle.test.d.ts.map +1 -0
- package/dist/password-recovery-bundle.test.js +132 -0
- package/dist/password-recovery-bundle.test.js.map +1 -0
- package/dist/project-bundle-env.d.ts +19 -0
- package/dist/project-bundle-env.d.ts.map +1 -0
- package/dist/project-bundle-env.js +111 -0
- package/dist/project-bundle-env.js.map +1 -0
- package/dist/project-bundle-env.test.d.ts +2 -0
- package/dist/project-bundle-env.test.d.ts.map +1 -0
- package/dist/project-bundle-env.test.js +93 -0
- package/dist/project-bundle-env.test.js.map +1 -0
- package/dist/project-path-confinement.test.d.ts +2 -0
- package/dist/project-path-confinement.test.d.ts.map +1 -0
- package/dist/project-path-confinement.test.js +222 -0
- package/dist/project-path-confinement.test.js.map +1 -0
- package/dist/security/api.d.ts +18 -0
- package/dist/security/api.d.ts.map +1 -0
- package/dist/security/api.js +238 -0
- package/dist/security/api.js.map +1 -0
- package/dist/security/api.test.d.ts +2 -0
- package/dist/security/api.test.d.ts.map +1 -0
- package/dist/security/api.test.js +220 -0
- package/dist/security/api.test.js.map +1 -0
- package/dist/security/artifact.d.ts +10 -0
- package/dist/security/artifact.d.ts.map +1 -0
- package/dist/security/artifact.js +283 -0
- package/dist/security/artifact.js.map +1 -0
- package/dist/security/artifact.test.d.ts +2 -0
- package/dist/security/artifact.test.d.ts.map +1 -0
- package/dist/security/artifact.test.js +229 -0
- package/dist/security/artifact.test.js.map +1 -0
- package/dist/security/commands.d.ts +42 -0
- package/dist/security/commands.d.ts.map +1 -0
- package/dist/security/commands.js +825 -0
- package/dist/security/commands.js.map +1 -0
- package/dist/security/commands.test.d.ts +2 -0
- package/dist/security/commands.test.d.ts.map +1 -0
- package/dist/security/commands.test.js +1051 -0
- package/dist/security/commands.test.js.map +1 -0
- package/dist/security/connection.d.ts +19 -0
- package/dist/security/connection.d.ts.map +1 -0
- package/dist/security/connection.js +145 -0
- package/dist/security/connection.js.map +1 -0
- package/dist/security/connection.test.d.ts +2 -0
- package/dist/security/connection.test.d.ts.map +1 -0
- package/dist/security/connection.test.js +62 -0
- package/dist/security/connection.test.js.map +1 -0
- package/dist/security/index-routing.test.d.ts +2 -0
- package/dist/security/index-routing.test.d.ts.map +1 -0
- package/dist/security/index-routing.test.js +169 -0
- package/dist/security/index-routing.test.js.map +1 -0
- package/dist/security/journal.d.ts +26 -0
- package/dist/security/journal.d.ts.map +1 -0
- package/dist/security/journal.js +441 -0
- package/dist/security/journal.js.map +1 -0
- package/dist/security/journal.test.d.ts +2 -0
- package/dist/security/journal.test.d.ts.map +1 -0
- package/dist/security/journal.test.js +226 -0
- package/dist/security/journal.test.js.map +1 -0
- package/dist/security/package-verifier.d.ts +15 -0
- package/dist/security/package-verifier.d.ts.map +1 -0
- package/dist/security/package-verifier.js +65 -0
- package/dist/security/package-verifier.js.map +1 -0
- package/dist/security/package-verifier.test.d.ts +2 -0
- package/dist/security/package-verifier.test.d.ts.map +1 -0
- package/dist/security/package-verifier.test.js +57 -0
- package/dist/security/package-verifier.test.js.map +1 -0
- package/dist/security/runtime.d.ts +43 -0
- package/dist/security/runtime.d.ts.map +1 -0
- package/dist/security/runtime.js +81 -0
- package/dist/security/runtime.js.map +1 -0
- package/dist/security/runtime.test.d.ts +2 -0
- package/dist/security/runtime.test.d.ts.map +1 -0
- package/dist/security/runtime.test.js +88 -0
- package/dist/security/runtime.test.js.map +1 -0
- package/dist/security/types.d.ts +169 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/types.js +3 -0
- package/dist/security/types.js.map +1 -0
- package/dist/security-runtime/LICENSE +202 -0
- package/dist/security-runtime/NOTICE +16 -0
- package/dist/security-runtime/artifact-manifest.json +960 -0
- package/dist/security-runtime/bin/vsg.mjs +5 -0
- package/dist/security-runtime/lattice-catalog.json +176585 -0
- package/dist/security-runtime/lattice-runtime.mjs +90 -0
- package/dist/security-runtime/licensing/candidates/apache-source-license-evidence.json +478 -0
- package/dist/security-runtime/licensing/candidates/betterleaks-generic-api-key.json +76 -0
- package/dist/security-runtime/licensing/candidates/betterleaks-jwt.json +74 -0
- package/dist/security-runtime/licensing/candidates/blackberry-additional-source-declaration-evidence.json +276 -0
- package/dist/security-runtime/licensing/candidates/blackberry-source-declaration-evidence.json +369 -0
- package/dist/security-runtime/licensing/candidates/cado-source-declaration-evidence.json +283 -0
- package/dist/security-runtime/licensing/candidates/commercial-rule-candidate.json +280 -0
- package/dist/security-runtime/licensing/candidates/commercial-runtime-release.json +389 -0
- package/dist/security-runtime/licensing/candidates/data-feed-evidence.json +259 -0
- package/dist/security-runtime/licensing/candidates/gitlab-sast-rule-identities.json +178 -0
- package/dist/security-runtime/licensing/candidates/gitlab-sast-source-evidence.json +1824 -0
- package/dist/security-runtime/licensing/candidates/gitlab-sast-source-notice-bundle.json +45 -0
- package/dist/security-runtime/licensing/candidates/malpedia-source-license-evidence.json +41 -0
- package/dist/security-runtime/licensing/candidates/rule-license-evidence.json +376 -0
- package/dist/security-runtime/licensing/candidates/runner-image-composition.json +1500 -0
- package/dist/security-runtime/licensing/candidates/selected-runtime-coverage.json +91 -0
- package/dist/security-runtime/licensing/candidates/yara-forge-20260927.json +58502 -0
- package/dist/security-runtime/licensing/commercial-components.json +379 -0
- package/dist/security-runtime/licensing/notices/betterleaks-1.9.0-MIT.txt +21 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5.txt +428 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/33acf42afdd03163d75fe856cb431e70710e0b5deede3362e6d1c4697cfe1c6a.txt +28 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986.txt +674 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/4fecb8fcaf80fd9a6315bca5225ee43377015b46a0459c2925495be885cab19a.txt +21 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/811515f8723aa4007de2fbb75a364127fdec51cda534b87a7ea8f2fef2f96dd7.txt +24 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/814442c3987a2c0411171ad8ad43118e8c08f85c9c5d1dcdecc9787c7ca8689b.txt +664 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/8a959b2413d0c83ca1b3ce9153076c649abf2e4bbfebbb493fb24c2074a1eb8a.txt +38 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/995182e185856186fbbe49f150409ae026aa4cda7e94f83c6ed737cbb77fa9c7.txt +23 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/9b8e1305e46d1dd4011b6ed933c9f6223e08c9c4625001c5fd75a34fa930f616.txt +202 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/a01f1a28424bfe7f49a23d339a01847cfa9ace3864d5e7295051772a4bae2271.txt +38 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/a5681bf9b05db14d86776930017c647ad9e6e56ff6bbcfdf21e5848288dfaf1b.txt +165 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/a5b8bd9ae96c630bbf229d61c5c5def20274e00be39abfd2fab4d7879ceab462.txt +24 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/ada32b3747ce108d5e8bab7918af94abbd03f2fe2a46304f74c6333bbfd914ed.txt +8 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4.txt +201 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/c738ae413cf561f174e34f6961f8ca458aae2369a73640dda6234c629b98bcc4.txt +2732 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/ce41c9a2c986277f7f9ab146a2195c1888a5d8da062e22d7c9c88666bb7c38cd.txt +17 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/d5f4c36a0528e01cfdd9e4fc60879201d3af49b41c520200643d321fe53da5f9.txt +17 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/e08c368ccd455f85c7fb9e04830e730f26e9dbb5c0f77bc88e09a5b0cb37df5b.txt +38 -0
- package/dist/security-runtime/licensing/notices/candidate-sources/sha256/e9efb2f7daf11bb6379c06c16b870dddcecc4a10f8704bb8aad807529c8b3c97.txt +8 -0
- package/dist/security-runtime/licensing/notices/gitleaks-generic-origin-782f3104-MIT.txt +21 -0
- package/dist/security-runtime/package.json +17 -0
- package/dist/security-runtime/playbook/README.md +76 -0
- package/dist/security-runtime/playbook/access-control.md +56 -0
- package/dist/security-runtime/playbook/ai-features.md +53 -0
- package/dist/security-runtime/playbook/desktop-python.md +59 -0
- package/dist/security-runtime/playbook/input-handling.md +59 -0
- package/dist/security-runtime/playbook/mobile-expo.md +59 -0
- package/dist/security-runtime/playbook/payments.md +53 -0
- package/dist/security-runtime/playbook/privacy-account-recovery.md +59 -0
- package/dist/security-runtime/playbook/secrets-config.md +47 -0
- package/dist/security-runtime/playbook/supabase.md +48 -0
- package/dist/security-runtime/playbook/supply-chain.md +62 -0
- package/dist/security-runtime/playbook/webhooks-integrations.md +52 -0
- package/dist/security-runtime/rules/vsg-ai-key-in-client.yaml +41 -0
- package/dist/security-runtime/rules/vsg-ai-output-raw-html.yaml +35 -0
- package/dist/security-runtime/rules/vsg-angular-sanitizer-bypass.yaml +23 -0
- package/dist/security-runtime/rules/vsg-expo-token-in-asyncstorage.yaml +22 -0
- package/dist/security-runtime/rules/vsg-flask-public-bind.yaml +32 -0
- package/dist/security-runtime/rules/vsg-nextjs-action-write-no-auth.yaml +144 -0
- package/dist/security-runtime/rules/vsg-nextjs-inline-action-write-no-auth.yaml +161 -0
- package/dist/security-runtime/rules/vsg-nextjs-route-write-no-auth.yaml +193 -0
- package/dist/security-runtime/rules/vsg-nosql-where-injection.yaml +36 -0
- package/dist/security-runtime/rules/vsg-python-pickle-load.yaml +26 -0
- package/dist/security-runtime/rules/vsg-python-requests-verify-false.yaml +34 -0
- package/dist/security-runtime/rules/vsg-python-subprocess-shell.yaml +23 -0
- package/dist/security-runtime/rules/vsg-stripe-client-price.yaml +51 -0
- package/dist/security-runtime/rules/vsg-stripe-webhook-no-signature.yaml +31 -0
- package/dist/security-runtime/rules/vsg-stripe-webhook-pages-no-signature.yaml +51 -0
- package/dist/security-runtime/rules/vsg-supabase-service-role-in-client.yaml +27 -0
- package/dist/security-runtime/rules/vsg-supabase-service-role-public-env.yaml +24 -0
- package/dist/security-runtime/rules/vsg-xml-external-entities.yaml +19 -0
- package/dist/security-runtime/src/agent/brief.mjs +95 -0
- package/dist/security-runtime/src/agent/discover.mjs +108 -0
- package/dist/security-runtime/src/agent/exec.mjs +64 -0
- package/dist/security-runtime/src/agent/ingest.mjs +213 -0
- package/dist/security-runtime/src/agent/report.mjs +94 -0
- package/dist/security-runtime/src/agent/schema.mjs +62 -0
- package/dist/security-runtime/src/agent/tokenize.mjs +38 -0
- package/dist/security-runtime/src/checks/README.md +8 -0
- package/dist/security-runtime/src/checks/_lib/gitfiles.mjs +35 -0
- package/dist/security-runtime/src/checks/_lib/lockfiles.mjs +135 -0
- package/dist/security-runtime/src/checks/_lib/osv.mjs +6 -0
- package/dist/security-runtime/src/checks/_lib/secrets.mjs +381 -0
- package/dist/security-runtime/src/checks/_lib/targets.mjs +79 -0
- package/dist/security-runtime/src/checks/agent-review/index.mjs +52 -0
- package/dist/security-runtime/src/checks/agent-surface/config.mjs +223 -0
- package/dist/security-runtime/src/checks/agent-surface/index.mjs +113 -0
- package/dist/security-runtime/src/checks/agent-surface/instructions.mjs +87 -0
- package/dist/security-runtime/src/checks/agent-surface/patterns.mjs +68 -0
- package/dist/security-runtime/src/checks/agent-surface/unicode.mjs +88 -0
- package/dist/security-runtime/src/checks/code/auth-helpers.mjs +659 -0
- package/dist/security-runtime/src/checks/code/index.mjs +617 -0
- package/dist/security-runtime/src/checks/code/opengrep-container.mjs +85 -0
- package/dist/security-runtime/src/checks/code/opengrep-runner.mjs +86 -0
- package/dist/security-runtime/src/checks/code/selected-opengrep-runner.mjs +112 -0
- package/dist/security-runtime/src/checks/dep-change/guarddog.mjs +142 -0
- package/dist/security-runtime/src/checks/dep-change/index.mjs +316 -0
- package/dist/security-runtime/src/checks/dep-change/registries.mjs +199 -0
- package/dist/security-runtime/src/checks/deps-vuln/index.mjs +305 -0
- package/dist/security-runtime/src/checks/desktop-config/index.mjs +112 -0
- package/dist/security-runtime/src/checks/dns-mail/index.mjs +71 -0
- package/dist/security-runtime/src/checks/iac/index.mjs +83 -0
- package/dist/security-runtime/src/checks/install-posture/index.mjs +123 -0
- package/dist/security-runtime/src/checks/licenses/index.mjs +143 -0
- package/dist/security-runtime/src/checks/live-basic/index.mjs +77 -0
- package/dist/security-runtime/src/checks/live-js-secrets/index.mjs +100 -0
- package/dist/security-runtime/src/checks/malware/clamav.mjs +17 -0
- package/dist/security-runtime/src/checks/malware/defender.mjs +43 -0
- package/dist/security-runtime/src/checks/malware/index.mjs +186 -0
- package/dist/security-runtime/src/checks/malware/targets.mjs +147 -0
- package/dist/security-runtime/src/checks/malware/yara-runner.mjs +201 -0
- package/dist/security-runtime/src/checks/malware/yara.mjs +124 -0
- package/dist/security-runtime/src/checks/mobile-config/index.mjs +173 -0
- package/dist/security-runtime/src/checks/mobile-config/mobsf.mjs +105 -0
- package/dist/security-runtime/src/checks/posture/index.mjs +133 -0
- package/dist/security-runtime/src/checks/project-scripts/index.mjs +187 -0
- package/dist/security-runtime/src/checks/sbom/index.mjs +98 -0
- package/dist/security-runtime/src/checks/secrets-build/index.mjs +63 -0
- package/dist/security-runtime/src/checks/secrets-history/index.mjs +112 -0
- package/dist/security-runtime/src/checks/secrets-tree/env.mjs +120 -0
- package/dist/security-runtime/src/checks/secrets-tree/index.mjs +73 -0
- package/dist/security-runtime/src/checks/supabase-static/index.mjs +240 -0
- package/dist/security-runtime/src/checks/supabase-static/sql.mjs +557 -0
- package/dist/security-runtime/src/checks/workflows/index.mjs +93 -0
- package/dist/security-runtime/src/cli/deep.mjs +13 -0
- package/dist/security-runtime/src/cli/doctor.mjs +82 -0
- package/dist/security-runtime/src/cli/index.mjs +60 -0
- package/dist/security-runtime/src/cli/live-common.mjs +27 -0
- package/dist/security-runtime/src/cli/parse.mjs +56 -0
- package/dist/security-runtime/src/cli/portfolio.mjs +34 -0
- package/dist/security-runtime/src/cli/release.mjs +28 -0
- package/dist/security-runtime/src/cli/report.mjs +18 -0
- package/dist/security-runtime/src/cli/run-common.mjs +54 -0
- package/dist/security-runtime/src/cli/scan.mjs +12 -0
- package/dist/security-runtime/src/cli/setup.mjs +59 -0
- package/dist/security-runtime/src/cli/url.mjs +38 -0
- package/dist/security-runtime/src/core/accept.mjs +141 -0
- package/dist/security-runtime/src/core/archive.mjs +114 -0
- package/dist/security-runtime/src/core/base-ref.mjs +43 -0
- package/dist/security-runtime/src/core/checks.mjs +39 -0
- package/dist/security-runtime/src/core/detect.mjs +90 -0
- package/dist/security-runtime/src/core/errors.mjs +5 -0
- package/dist/security-runtime/src/core/fetch.mjs +139 -0
- package/dist/security-runtime/src/core/findings.mjs +177 -0
- package/dist/security-runtime/src/core/gate.mjs +131 -0
- package/dist/security-runtime/src/core/installer.mjs +255 -0
- package/dist/security-runtime/src/core/lock.mjs +38 -0
- package/dist/security-runtime/src/core/nested.mjs +107 -0
- package/dist/security-runtime/src/core/paths.mjs +20 -0
- package/dist/security-runtime/src/core/pipeline.mjs +196 -0
- package/dist/security-runtime/src/core/registry.mjs +81 -0
- package/dist/security-runtime/src/core/report.mjs +128 -0
- package/dist/security-runtime/src/core/runner.mjs +86 -0
- package/dist/security-runtime/src/core/sarif.mjs +141 -0
- package/dist/security-runtime/src/lattice/artifact.mjs +1201 -0
- package/dist/security-runtime/src/lattice/execution.mjs +45 -0
- package/dist/security-runtime/src/lattice/export.mjs +215 -0
- package/dist/security-runtime/src/lattice/provenance.mjs +70 -0
- package/dist/security-runtime/src/lattice/runtime.mjs +158 -0
- package/dist/security-runtime/src/lattice/selected-runtime.mjs +189 -0
- package/dist/security-runtime/src/lattice/source-acquirer.mjs +51 -0
- package/dist/security-runtime/src/lattice/source-fetcher.mjs +88 -0
- package/dist/security-runtime/src/lattice/transport.mjs +232 -0
- package/dist/security-runtime/src/live/analyze.mjs +101 -0
- package/dist/security-runtime/src/live/exposure.mjs +79 -0
- package/dist/security-runtime/src/live/secrets.mjs +31 -0
- package/dist/security-runtime/src/live/session.mjs +98 -0
- package/dist/security-runtime/src/live/targets.mjs +81 -0
- package/dist/security-runtime/src/portfolio/index.mjs +116 -0
- package/dist/security-runtime/tools/registry/betterleaks.json +29 -0
- package/dist/security-runtime/tools/registry/guarddog.json +9 -0
- package/dist/security-runtime/tools/registry/mobsf.json +10 -0
- package/dist/security-runtime/tools/registry/opengrep.json +28 -0
- package/dist/security-runtime/tools/registry/osv-scanner.json +14 -0
- package/dist/security-runtime/tools/registry/semgrep-rules.json +21 -0
- package/dist/security-runtime/tools/registry/trivy.json +30 -0
- package/dist/security-runtime/tools/registry/yara-forge-exclusions.json +14 -0
- package/dist/security-runtime/tools/registry/yara-forge.json +22 -0
- package/dist/security-runtime/tools/registry/yara-runner.json +10 -0
- package/dist/security-runtime/tools/registry/yara-x.json +24 -0
- package/dist/security-runtime/tools/registry/zizmor.json +30 -0
- package/dist/spinner.d.ts +16 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +72 -0
- package/dist/spinner.js.map +1 -0
- package/dist/verify.test.d.ts +2 -0
- package/dist/verify.test.d.ts.map +1 -0
- package/dist/verify.test.js +98 -0
- package/dist/verify.test.js.map +1 -0
- package/package.json +73 -4
|
@@ -0,0 +1,1051 @@
|
|
|
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_fs_1 = require("node:fs");
|
|
8
|
+
const node_os_1 = require("node:os");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
11
|
+
const commands_js_1 = require("./commands.js");
|
|
12
|
+
const api_js_1 = require("./api.js");
|
|
13
|
+
const journal_js_1 = require("./journal.js");
|
|
14
|
+
const APP_ID = '11111111-1111-4111-8111-111111111111';
|
|
15
|
+
const TOKEN = 'synthetic_security_token_123456789012345';
|
|
16
|
+
const ENTITLEMENT_ID = '22222222-2222-4222-8222-222222222222';
|
|
17
|
+
const RUN_ID = '33333333-3333-4333-8333-333333333333';
|
|
18
|
+
const JOURNAL_ID = '44444444-4444-4444-8444-444444444444';
|
|
19
|
+
const CHILD_RUN_ID = '55555555-5555-4555-8555-555555555555';
|
|
20
|
+
const BASELINE_RUN_ID = '66666666-6666-4666-8666-666666666666';
|
|
21
|
+
const connection = {
|
|
22
|
+
apiUrl: 'https://latticeai.app', appId: APP_ID, token: TOKEN, connectedAt: '2026-10-20T00:00:00.000Z',
|
|
23
|
+
};
|
|
24
|
+
function status() {
|
|
25
|
+
return {
|
|
26
|
+
app: {
|
|
27
|
+
id: APP_ID, name: 'Fixture', repositoryIdentity: 'github.com/example/fixture', origin: null,
|
|
28
|
+
repositoryLockedAt: null, createdAt: '2026-10-20T00:00:00.000Z',
|
|
29
|
+
},
|
|
30
|
+
entitledModes: ['scan'],
|
|
31
|
+
entitlements: [],
|
|
32
|
+
checkoutEnabled: false,
|
|
33
|
+
publicationEnabled: false,
|
|
34
|
+
releaseBlockers: ['commercial_artifact_unavailable'],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function blockedManifest() {
|
|
38
|
+
return {
|
|
39
|
+
format: 'lattice-security-artifact-v1', sourceCommit: 'a'.repeat(40),
|
|
40
|
+
identity: {
|
|
41
|
+
vsgVersion: '1.0.2', profileId: 'commercial-default', profileVersion: '1.0.0',
|
|
42
|
+
rulesDigest: '1'.repeat(64), registryDigest: '2'.repeat(64), commercialManifestDigest: '3'.repeat(64),
|
|
43
|
+
evaluatorDigest: '4'.repeat(64), catalogDigest: '5'.repeat(64),
|
|
44
|
+
},
|
|
45
|
+
entryPoint: 'bin/vsg.mjs', exporterPath: 'src/lattice/export.mjs',
|
|
46
|
+
transportPath: 'src/lattice/transport.mjs', evaluatorPath: 'lattice-runtime.mjs',
|
|
47
|
+
releaseEligibility: { status: 'blocked', blockers: ['artifact_release_approval_missing'] },
|
|
48
|
+
files: [],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function approvedStatus() {
|
|
52
|
+
const manifest = blockedManifest();
|
|
53
|
+
return {
|
|
54
|
+
...status(),
|
|
55
|
+
entitledModes: ['scan', 'deep', 'release', 'report'],
|
|
56
|
+
publicationEnabled: true,
|
|
57
|
+
releaseBlockers: [],
|
|
58
|
+
entitlements: [{
|
|
59
|
+
id: ENTITLEMENT_ID,
|
|
60
|
+
kind: 'security_subscription',
|
|
61
|
+
providerStatus: 'active',
|
|
62
|
+
artifactStatus: 'rights_cleared',
|
|
63
|
+
unitLimit: 50,
|
|
64
|
+
consumedUnits: 0,
|
|
65
|
+
reservedUnits: 0,
|
|
66
|
+
remainingUnits: 50,
|
|
67
|
+
periodStart: '2026-10-01T00:00:00.000Z',
|
|
68
|
+
periodEnd: '2026-11-01T00:00:00.000Z',
|
|
69
|
+
cancelAtPeriodEnd: false,
|
|
70
|
+
requiredRuntime: manifest.identity,
|
|
71
|
+
}],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function approvedInspection() {
|
|
75
|
+
return { artifactRoot: 'synthetic-artifact', manifest: blockedManifest(), manifestSha256: '6'.repeat(64) };
|
|
76
|
+
}
|
|
77
|
+
function approvedDeps() {
|
|
78
|
+
return {
|
|
79
|
+
resolveConnection: async () => connection,
|
|
80
|
+
getStatus: async () => approvedStatus(),
|
|
81
|
+
inspectArtifact: async () => approvedInspection(),
|
|
82
|
+
assertArtifactEligible: () => { },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function retainedJournalInput(root, overrides = {}) {
|
|
86
|
+
return {
|
|
87
|
+
id: JOURNAL_ID,
|
|
88
|
+
apiUrl: connection.apiUrl,
|
|
89
|
+
appId: APP_ID,
|
|
90
|
+
clientRequestId: JOURNAL_ID,
|
|
91
|
+
entitlementId: ENTITLEMENT_ID,
|
|
92
|
+
mode: 'report',
|
|
93
|
+
parentRunId: null,
|
|
94
|
+
recoveryParentId: null,
|
|
95
|
+
recoveryRootId: null,
|
|
96
|
+
repo: root,
|
|
97
|
+
outDir: (0, node_path_1.join)(root, 'retained-vsg-output'),
|
|
98
|
+
artifactRoot: approvedInspection().artifactRoot,
|
|
99
|
+
artifactManifestSha256: approvedInspection().manifestSha256,
|
|
100
|
+
repositoryIdentity: approvedStatus().app.repositoryIdentity,
|
|
101
|
+
retainedCompleted: true,
|
|
102
|
+
localExit: 0,
|
|
103
|
+
acknowledgedExit: null,
|
|
104
|
+
reportPath: (0, node_path_1.join)(root, 'retained-vsg-output', 'lattice-report.json'),
|
|
105
|
+
...overrides,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
(0, node_test_1.default)('connect verifies app binding before saving and never writes the token to output', async () => {
|
|
109
|
+
const output = [];
|
|
110
|
+
const saved = [];
|
|
111
|
+
await (0, commands_js_1.runSecurityCommand)(['connect', '--app', APP_ID], {
|
|
112
|
+
env: { LATTICE_SECURITY_TOKEN: TOKEN },
|
|
113
|
+
getStatus: async (received) => {
|
|
114
|
+
strict_1.default.equal(received.token, TOKEN);
|
|
115
|
+
return status();
|
|
116
|
+
},
|
|
117
|
+
saveConnection: async (received) => { saved.push(received); },
|
|
118
|
+
stdout: (line) => output.push(line),
|
|
119
|
+
});
|
|
120
|
+
strict_1.default.equal(saved.length, 1);
|
|
121
|
+
strict_1.default.ok(output.every((line) => !line.includes(TOKEN)));
|
|
122
|
+
strict_1.default.match(output.join('\n'), /Connected Security app Fixture/);
|
|
123
|
+
});
|
|
124
|
+
(0, node_test_1.default)('connect refuses tokens in command arguments and does not save after failed verification', async () => {
|
|
125
|
+
const tokenErrors = [];
|
|
126
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['connect', '--app', APP_ID, '--token', TOKEN], {
|
|
127
|
+
stderr: (line) => tokenErrors.push(line),
|
|
128
|
+
}), 3);
|
|
129
|
+
strict_1.default.match(tokenErrors.join('\n'), /--token is forbidden/);
|
|
130
|
+
strict_1.default.doesNotMatch(tokenErrors.join('\n'), new RegExp(TOKEN));
|
|
131
|
+
let saved = false;
|
|
132
|
+
const verificationErrors = [];
|
|
133
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['connect', '--app', APP_ID], {
|
|
134
|
+
env: { LATTICE_SECURITY_TOKEN: TOKEN },
|
|
135
|
+
getStatus: async () => { throw new Error(`synthetic rejection ${TOKEN}`); },
|
|
136
|
+
saveConnection: async () => { saved = true; },
|
|
137
|
+
stderr: (line) => verificationErrors.push(line),
|
|
138
|
+
}), 3);
|
|
139
|
+
strict_1.default.match(verificationErrors.join('\n'), /synthetic rejection \[REDACTED\]/);
|
|
140
|
+
strict_1.default.doesNotMatch(verificationErrors.join('\n'), new RegExp(TOKEN));
|
|
141
|
+
strict_1.default.equal(saved, false);
|
|
142
|
+
});
|
|
143
|
+
(0, node_test_1.default)('status reports server blockers without exposing credentials', async () => {
|
|
144
|
+
const output = [];
|
|
145
|
+
await (0, commands_js_1.runSecurityCommand)(['status'], {
|
|
146
|
+
resolveConnection: async () => connection,
|
|
147
|
+
getStatus: async () => status(),
|
|
148
|
+
stdout: (line) => output.push(line),
|
|
149
|
+
});
|
|
150
|
+
strict_1.default.match(output.join('\n'), /Publication: disabled/);
|
|
151
|
+
strict_1.default.match(output.join('\n'), /commercial_artifact_unavailable/);
|
|
152
|
+
strict_1.default.doesNotMatch(output.join('\n'), new RegExp(TOKEN));
|
|
153
|
+
});
|
|
154
|
+
(0, node_test_1.default)('commercial commands reject legacy mutation flags and blocked artifacts before execution', async () => {
|
|
155
|
+
const mutationErrors = [];
|
|
156
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['scan', '--fix'], { stderr: (line) => mutationErrors.push(line) }), 3);
|
|
157
|
+
strict_1.default.match(mutationErrors.join('\n'), /cannot be combined/);
|
|
158
|
+
const blockedErrors = [];
|
|
159
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['scan'], {
|
|
160
|
+
resolveConnection: async () => connection,
|
|
161
|
+
getStatus: async () => status(),
|
|
162
|
+
inspectArtifact: async () => ({
|
|
163
|
+
artifactRoot: 'fixture', manifest: blockedManifest(), manifestSha256: '6'.repeat(64),
|
|
164
|
+
}),
|
|
165
|
+
stderr: (line) => blockedErrors.push(line),
|
|
166
|
+
}), 3);
|
|
167
|
+
strict_1.default.match(blockedErrors.join('\n'), /artifact_release_approval_missing.*commercial_artifact_unavailable/);
|
|
168
|
+
});
|
|
169
|
+
(0, node_test_1.default)('local commercial scan invokes the approved runtime without reserving cloud quota', async () => {
|
|
170
|
+
let began = false;
|
|
171
|
+
let finished = false;
|
|
172
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['scan', '--out', 'synthetic-out'], {
|
|
173
|
+
...approvedDeps(),
|
|
174
|
+
beginRun: async () => { began = true; throw new Error('must not begin'); },
|
|
175
|
+
finishRun: async () => { finished = true; throw new Error('must not finish'); },
|
|
176
|
+
runRuntime: async (options) => {
|
|
177
|
+
strict_1.default.equal(options.mode, 'scan');
|
|
178
|
+
strict_1.default.equal(options.repositoryIdentity, 'github.com/example/fixture');
|
|
179
|
+
return { exitCode: 1, report: {}, compactReport: {}, reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json') };
|
|
180
|
+
},
|
|
181
|
+
stdout: () => { },
|
|
182
|
+
});
|
|
183
|
+
strict_1.default.equal(exit, 1);
|
|
184
|
+
strict_1.default.equal(began, false);
|
|
185
|
+
strict_1.default.equal(finished, false);
|
|
186
|
+
});
|
|
187
|
+
(0, node_test_1.default)('published scan journals before begin and finishes the exact retained bytes', async () => {
|
|
188
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-publish-'));
|
|
189
|
+
const events = [];
|
|
190
|
+
const bodies = [];
|
|
191
|
+
try {
|
|
192
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['scan', '--publish'], {
|
|
193
|
+
...approvedDeps(),
|
|
194
|
+
journalRoot: root,
|
|
195
|
+
createBeginJournal: async (input, journalRoot) => {
|
|
196
|
+
events.push('journal');
|
|
197
|
+
const { createSecurityBeginJournal } = await import('./journal.js');
|
|
198
|
+
return createSecurityBeginJournal(input, journalRoot);
|
|
199
|
+
},
|
|
200
|
+
beginRun: async (_connection, input) => {
|
|
201
|
+
events.push('begin');
|
|
202
|
+
strict_1.default.equal(input.entitlementId, ENTITLEMENT_ID);
|
|
203
|
+
return {
|
|
204
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
205
|
+
reservationExpiresAt: '2026-10-20T02:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
206
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
runRuntime: async (options) => ({
|
|
210
|
+
exitCode: 0, report: { semanticVersion: '1.1' },
|
|
211
|
+
compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
212
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
213
|
+
}),
|
|
214
|
+
finishRun: async (_connection, runId, body) => {
|
|
215
|
+
events.push('finish');
|
|
216
|
+
strict_1.default.equal(runId, RUN_ID);
|
|
217
|
+
bodies.push(body);
|
|
218
|
+
return {
|
|
219
|
+
result: 'finished', runId, state: 'finished', verdict: 'PASS',
|
|
220
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
stdout: () => { },
|
|
224
|
+
});
|
|
225
|
+
strict_1.default.equal(exit, 0);
|
|
226
|
+
strict_1.default.deepEqual(events, ['journal', 'begin', 'finish']);
|
|
227
|
+
strict_1.default.deepEqual(JSON.parse(bodies[0]), {
|
|
228
|
+
outcome: 'completed', report: { transportVersion: '3.0', runId: RUN_ID },
|
|
229
|
+
});
|
|
230
|
+
strict_1.default.deepEqual(await node_fs_1.promises.readdir(root), []);
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
(0, node_test_1.default)('sync failure keeps the exact finish journal and maps a successful local scan to exit 2', async () => {
|
|
237
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-pending-'));
|
|
238
|
+
const errors = [];
|
|
239
|
+
try {
|
|
240
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['scan', '--publish'], {
|
|
241
|
+
...approvedDeps(),
|
|
242
|
+
journalRoot: root,
|
|
243
|
+
beginRun: async () => ({
|
|
244
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
245
|
+
reservationExpiresAt: '2026-10-20T02:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
246
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
247
|
+
}),
|
|
248
|
+
runRuntime: async (options) => ({
|
|
249
|
+
exitCode: 0, report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
250
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
251
|
+
}),
|
|
252
|
+
finishRun: async () => { throw new api_js_1.SecurityApiRequestError('offline', null, 'network_error', true); },
|
|
253
|
+
stderr: (line) => errors.push(line),
|
|
254
|
+
});
|
|
255
|
+
strict_1.default.equal(exit, 2);
|
|
256
|
+
const journals = await node_fs_1.promises.readdir(root);
|
|
257
|
+
strict_1.default.equal(journals.length, 1);
|
|
258
|
+
const metadata = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.join)(root, journals[0], 'journal.json'), 'utf8'));
|
|
259
|
+
strict_1.default.equal(metadata.state, 'pending_finish');
|
|
260
|
+
strict_1.default.equal(metadata.runId, RUN_ID);
|
|
261
|
+
strict_1.default.deepEqual(errors, [`Security result is local; cloud sync is pending for app ${APP_ID} in journal ${metadata.id}. Retry the exact saved request with lattice security publish --app ${APP_ID} --journal ${metadata.id}. This replays the immutable request and does not include agent-review findings added afterward.`]);
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
(0, node_test_1.default)('retrying an interrupted incomplete deep upload replays its exact body then prints review guidance without rescanning', async () => {
|
|
268
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-review-journal-retry-'));
|
|
269
|
+
const repo = (0, node_path_1.join)(root, 'repo with spaces');
|
|
270
|
+
const outDir = (0, node_path_1.join)(repo, 'review output');
|
|
271
|
+
const journalRoot = (0, node_path_1.join)(root, 'journals');
|
|
272
|
+
const output = [];
|
|
273
|
+
const errors = [];
|
|
274
|
+
const reviewCheck = {
|
|
275
|
+
id: 'agent-review', status: 'missing', required: true,
|
|
276
|
+
coverageCodes: ['vsg.agent-review.not_run'], attributionIds: [],
|
|
277
|
+
};
|
|
278
|
+
let runtimeCalls = 0;
|
|
279
|
+
let beginCalls = 0;
|
|
280
|
+
let originalBody = '';
|
|
281
|
+
let retryBody = '';
|
|
282
|
+
try {
|
|
283
|
+
const firstExit = await (0, commands_js_1.runSecurityCommand)([
|
|
284
|
+
'deep', '--publish', '--allow-project-scripts', '--repo', repo, '--out', outDir,
|
|
285
|
+
], {
|
|
286
|
+
...approvedDeps(),
|
|
287
|
+
cwd: root,
|
|
288
|
+
journalRoot,
|
|
289
|
+
beginRun: async (_connection, input) => {
|
|
290
|
+
beginCalls += 1;
|
|
291
|
+
strict_1.default.equal(input.parentRunId, null);
|
|
292
|
+
return {
|
|
293
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
294
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
295
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
runRuntime: async (options) => {
|
|
299
|
+
runtimeCalls += 1;
|
|
300
|
+
return {
|
|
301
|
+
exitCode: 2,
|
|
302
|
+
report: { checks: [reviewCheck] },
|
|
303
|
+
compactReport: { transportVersion: '3.0', runId: options.runId, checks: [reviewCheck] },
|
|
304
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
305
|
+
};
|
|
306
|
+
},
|
|
307
|
+
finishRun: async (_connection, _runId, body) => {
|
|
308
|
+
originalBody = body;
|
|
309
|
+
throw new api_js_1.SecurityApiRequestError('offline', null, 'network_error', true);
|
|
310
|
+
},
|
|
311
|
+
stdout: (line) => output.push(line),
|
|
312
|
+
stderr: (line) => errors.push(line),
|
|
313
|
+
});
|
|
314
|
+
strict_1.default.equal(firstExit, 2);
|
|
315
|
+
strict_1.default.equal(runtimeCalls, 1);
|
|
316
|
+
strict_1.default.equal(beginCalls, 1);
|
|
317
|
+
strict_1.default.doesNotMatch(output.join('\n'), /VSG requires local agent review|lattice security report/);
|
|
318
|
+
const [journalId] = await node_fs_1.promises.readdir(journalRoot);
|
|
319
|
+
const saved = await (0, journal_js_1.readSecurityPublishJournal)(journalId, journalRoot);
|
|
320
|
+
strict_1.default.equal(saved.exactRequestBody, originalBody);
|
|
321
|
+
strict_1.default.deepEqual(JSON.parse(saved.exactRequestBody), {
|
|
322
|
+
outcome: 'completed', report: {
|
|
323
|
+
transportVersion: '3.0', runId: RUN_ID, checks: [reviewCheck],
|
|
324
|
+
},
|
|
325
|
+
});
|
|
326
|
+
strict_1.default.match(errors.join('\n'), new RegExp(`lattice security publish --app ${APP_ID} --journal ${journalId}`));
|
|
327
|
+
strict_1.default.match(errors.join('\n'), /immutable request and does not include agent-review findings added afterward/);
|
|
328
|
+
const retryExit = await (0, commands_js_1.runSecurityCommand)(['publish', '--app', APP_ID, '--journal', journalId], {
|
|
329
|
+
resolveConnection: async () => connection,
|
|
330
|
+
journalRoot,
|
|
331
|
+
beginRun: async () => { beginCalls += 1; throw new Error('journal retry must not begin a second run'); },
|
|
332
|
+
runRuntime: async () => { runtimeCalls += 1; throw new Error('journal retry must not rescan'); },
|
|
333
|
+
exportReport: async () => { throw new Error('journal retry must not re-export'); },
|
|
334
|
+
finishRun: async (_connection, runId, body) => {
|
|
335
|
+
strict_1.default.equal(runId, RUN_ID);
|
|
336
|
+
retryBody = body;
|
|
337
|
+
return {
|
|
338
|
+
result: 'finished', runId, state: 'finished', verdict: 'INCOMPLETE',
|
|
339
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: false,
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
stdout: (line) => output.push(line),
|
|
343
|
+
});
|
|
344
|
+
strict_1.default.equal(retryExit, 2);
|
|
345
|
+
strict_1.default.equal(retryBody, originalBody);
|
|
346
|
+
strict_1.default.equal(runtimeCalls, 1);
|
|
347
|
+
strict_1.default.equal(beginCalls, 1);
|
|
348
|
+
strict_1.default.ok(output.includes(`VSG requires local agent review. Open '${(0, node_path_1.join)(outDir, 'agent', 'brief.md')}' and complete the review with your chosen reviewer.`));
|
|
349
|
+
strict_1.default.ok(output.includes(` lattice security report --app ${APP_ID} --repo '${repo}' --out '${outDir}'`));
|
|
350
|
+
strict_1.default.ok(output.includes(` lattice security publish --app ${APP_ID} --repo '${repo}' --report '${outDir}' --parent-run ${RUN_ID}`));
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
(0, node_test_1.default)('nonretryable report rejection explains refusal and retains the local result without another reservation or finish', async () => {
|
|
357
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-refused-'));
|
|
358
|
+
const errors = [];
|
|
359
|
+
let beginCalls = 0;
|
|
360
|
+
let finishCalls = 0;
|
|
361
|
+
try {
|
|
362
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['scan', '--publish'], {
|
|
363
|
+
...approvedDeps(),
|
|
364
|
+
env: { LATTICE_SECURITY_TOKEN: TOKEN },
|
|
365
|
+
journalRoot: root,
|
|
366
|
+
beginRun: async () => {
|
|
367
|
+
beginCalls += 1;
|
|
368
|
+
return {
|
|
369
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
370
|
+
reservationExpiresAt: '2026-10-20T02:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
371
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
372
|
+
};
|
|
373
|
+
},
|
|
374
|
+
runRuntime: async (options) => ({
|
|
375
|
+
exitCode: 0, report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
376
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
377
|
+
}),
|
|
378
|
+
finishRun: async () => {
|
|
379
|
+
finishCalls += 1;
|
|
380
|
+
throw new api_js_1.SecurityApiRequestError(`Unsupported finding identity: ${TOKEN}`, 422, 'report_rejected', false);
|
|
381
|
+
},
|
|
382
|
+
stderr: (line) => errors.push(line),
|
|
383
|
+
});
|
|
384
|
+
strict_1.default.equal(exit, 2);
|
|
385
|
+
strict_1.default.equal(beginCalls, 1);
|
|
386
|
+
strict_1.default.equal(finishCalls, 1);
|
|
387
|
+
const [journalId] = await node_fs_1.promises.readdir(root);
|
|
388
|
+
const metadata = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.join)(root, journalId, 'journal.json'), 'utf8'));
|
|
389
|
+
strict_1.default.equal(metadata.state, 'pending_finish');
|
|
390
|
+
strict_1.default.equal(metadata.runId, RUN_ID);
|
|
391
|
+
strict_1.default.match(errors.join('\n'), /Security publication was refused by the service HTTP 422 \(report_rejected\)/);
|
|
392
|
+
strict_1.default.match(errors.join('\n'), new RegExp(`local result and journal ${journalId} are retained`));
|
|
393
|
+
strict_1.default.doesNotMatch(errors.join('\n'), new RegExp(TOKEN));
|
|
394
|
+
strict_1.default.doesNotMatch(errors.join('\n'), /retry.*fix|network.*retry/i);
|
|
395
|
+
}
|
|
396
|
+
finally {
|
|
397
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
(0, node_test_1.default)('deep mode refuses project scripts unless consent is explicit', async () => {
|
|
401
|
+
let ran = false;
|
|
402
|
+
const errors = [];
|
|
403
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['deep'], {
|
|
404
|
+
...approvedDeps(),
|
|
405
|
+
confirmProjectScripts: async () => false,
|
|
406
|
+
runRuntime: async () => { ran = true; throw new Error('must not run'); },
|
|
407
|
+
stderr: (line) => errors.push(line),
|
|
408
|
+
}), 3);
|
|
409
|
+
strict_1.default.match(errors.join('\n'), /requires consent/);
|
|
410
|
+
strict_1.default.equal(ran, false);
|
|
411
|
+
});
|
|
412
|
+
(0, node_test_1.default)('deep result requiring local review prints the exact fresh-report and parent-bound publication continuation', async () => {
|
|
413
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-review-guidance-'));
|
|
414
|
+
const repo = (0, node_path_1.join)(root, 'repo with spaces');
|
|
415
|
+
const outDir = (0, node_path_1.join)(repo, 'review output');
|
|
416
|
+
const output = [];
|
|
417
|
+
try {
|
|
418
|
+
const exit = await (0, commands_js_1.runSecurityCommand)([
|
|
419
|
+
'deep', '--publish', '--allow-project-scripts', '--repo', repo, '--out', outDir,
|
|
420
|
+
], {
|
|
421
|
+
...approvedDeps(),
|
|
422
|
+
cwd: root,
|
|
423
|
+
journalRoot: (0, node_path_1.join)(root, 'journals'),
|
|
424
|
+
beginRun: async (_connection, input) => {
|
|
425
|
+
strict_1.default.equal(input.parentRunId, null);
|
|
426
|
+
return {
|
|
427
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
428
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
429
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
430
|
+
};
|
|
431
|
+
},
|
|
432
|
+
runRuntime: async (options) => ({
|
|
433
|
+
exitCode: 2,
|
|
434
|
+
report: { checks: [{ id: 'agent-review', status: 'missing', required: true }] },
|
|
435
|
+
compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
436
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
437
|
+
}),
|
|
438
|
+
finishRun: async (_connection, runId, body) => {
|
|
439
|
+
strict_1.default.equal(runId, RUN_ID);
|
|
440
|
+
strict_1.default.deepEqual(JSON.parse(body), {
|
|
441
|
+
outcome: 'completed', report: { transportVersion: '3.0', runId: RUN_ID },
|
|
442
|
+
});
|
|
443
|
+
return {
|
|
444
|
+
result: 'finished', runId, state: 'finished', verdict: 'INCOMPLETE',
|
|
445
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: false,
|
|
446
|
+
};
|
|
447
|
+
},
|
|
448
|
+
stdout: (line) => output.push(line),
|
|
449
|
+
});
|
|
450
|
+
strict_1.default.equal(exit, 2);
|
|
451
|
+
strict_1.default.ok(output.includes(`VSG requires local agent review. Open '${(0, node_path_1.join)(outDir, 'agent', 'brief.md')}' and complete the review with your chosen reviewer.`));
|
|
452
|
+
strict_1.default.ok(output.includes(` lattice security report --app ${APP_ID} --repo '${repo}' --out '${outDir}'`));
|
|
453
|
+
strict_1.default.ok(output.includes(`Publish that fresh report as a retest of initial cloud run ${RUN_ID}:`));
|
|
454
|
+
strict_1.default.ok(output.includes(` lattice security publish --app ${APP_ID} --repo '${repo}' --report '${outDir}' --parent-run ${RUN_ID}`));
|
|
455
|
+
strict_1.default.doesNotMatch(output.join('\n'), /report .*--publish|security deep .*review|automated review/i);
|
|
456
|
+
}
|
|
457
|
+
finally {
|
|
458
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
(0, node_test_1.default)('local review continuation does not invent an initial cloud run ID', async () => {
|
|
462
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-local-review-guidance-'));
|
|
463
|
+
const output = [];
|
|
464
|
+
try {
|
|
465
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['deep', '--allow-project-scripts', '--out', 'review output'], {
|
|
466
|
+
...approvedDeps(),
|
|
467
|
+
cwd: root,
|
|
468
|
+
runRuntime: async (options) => ({
|
|
469
|
+
exitCode: 2,
|
|
470
|
+
report: { checks: [{ id: 'agent-review', status: 'missing', required: true }] },
|
|
471
|
+
compactReport: {},
|
|
472
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
473
|
+
}),
|
|
474
|
+
stdout: (line) => output.push(line),
|
|
475
|
+
}), 2);
|
|
476
|
+
strict_1.default.ok(output.includes('No initial cloud run ID is available for this local run; a parent-bound publication needs the actual initial run ID.'));
|
|
477
|
+
strict_1.default.doesNotMatch(output.join('\n'), /lattice security publish --app .*--report/);
|
|
478
|
+
}
|
|
479
|
+
finally {
|
|
480
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
(0, node_test_1.default)('local scanner exceptions map to incomplete while preflight status failures map to usage', async () => {
|
|
484
|
+
const scannerErrors = [];
|
|
485
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['scan'], {
|
|
486
|
+
...approvedDeps(),
|
|
487
|
+
runRuntime: async () => { throw new Error('synthetic scanner failure'); },
|
|
488
|
+
stderr: (line) => scannerErrors.push(line),
|
|
489
|
+
}), 2);
|
|
490
|
+
strict_1.default.match(scannerErrors.join('\n'), /scanner failed/);
|
|
491
|
+
const statusErrors = [];
|
|
492
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['status'], {
|
|
493
|
+
resolveConnection: async () => connection,
|
|
494
|
+
getStatus: async () => { throw new api_js_1.SecurityApiRequestError('offline', null, 'network_error', true); },
|
|
495
|
+
stderr: (line) => statusErrors.push(line),
|
|
496
|
+
}), 3);
|
|
497
|
+
strict_1.default.match(statusErrors.join('\n'), /offline/);
|
|
498
|
+
});
|
|
499
|
+
(0, node_test_1.default)('retained report publish re-exports through the frozen artifact without rerunning scanners', async () => {
|
|
500
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-report-'));
|
|
501
|
+
const parentRunId = '44444444-4444-4444-8444-444444444444';
|
|
502
|
+
const events = [];
|
|
503
|
+
try {
|
|
504
|
+
const exit = await (0, commands_js_1.runSecurityCommand)([
|
|
505
|
+
'publish', '--report', 'retained-vsg-output', '--parent-run', parentRunId,
|
|
506
|
+
], {
|
|
507
|
+
...approvedDeps(),
|
|
508
|
+
cwd: root,
|
|
509
|
+
journalRoot: (0, node_path_1.join)(root, 'journals'),
|
|
510
|
+
beginRun: async (_connection, input) => {
|
|
511
|
+
events.push('begin');
|
|
512
|
+
strict_1.default.equal(input.mode, 'report');
|
|
513
|
+
strict_1.default.equal(input.parentRunId, parentRunId);
|
|
514
|
+
return {
|
|
515
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
516
|
+
reservationExpiresAt: '2026-10-20T02:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
517
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
518
|
+
};
|
|
519
|
+
},
|
|
520
|
+
runRuntime: async () => { throw new Error('scanner must not run'); },
|
|
521
|
+
exportReport: async (options) => {
|
|
522
|
+
events.push(options.writeLocalReport === false ? 'preflight' : 'rebind');
|
|
523
|
+
strict_1.default.equal(options.mode, 'report');
|
|
524
|
+
if (options.writeLocalReport !== false)
|
|
525
|
+
strict_1.default.equal(options.runId, RUN_ID);
|
|
526
|
+
return {
|
|
527
|
+
report: { semanticVersion: '1.1', auditMode: 'deep' },
|
|
528
|
+
compactReport: { transportVersion: '3.0', auditMode: 'deep' },
|
|
529
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
530
|
+
};
|
|
531
|
+
},
|
|
532
|
+
finishRun: async (_connection, runId) => {
|
|
533
|
+
events.push('finish');
|
|
534
|
+
return {
|
|
535
|
+
result: 'finished', runId, state: 'finished', verdict: 'PASS',
|
|
536
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
537
|
+
};
|
|
538
|
+
},
|
|
539
|
+
stdout: () => { },
|
|
540
|
+
});
|
|
541
|
+
strict_1.default.equal(exit, 0);
|
|
542
|
+
strict_1.default.deepEqual(events, ['preflight', 'begin', 'rebind', 'finish']);
|
|
543
|
+
}
|
|
544
|
+
finally {
|
|
545
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
(0, node_test_1.default)('retained report source changes are rejected before begin and classified after reservation', async () => {
|
|
549
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-source-change-'));
|
|
550
|
+
const parentRunId = '44444444-4444-4444-8444-444444444444';
|
|
551
|
+
const sourceChanged = () => Object.assign(new Error('source changed'), { code: 'source_changed' });
|
|
552
|
+
try {
|
|
553
|
+
let began = false;
|
|
554
|
+
const preflightErrors = [];
|
|
555
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)([
|
|
556
|
+
'publish', '--report', 'retained-vsg-output', '--parent-run', parentRunId,
|
|
557
|
+
], {
|
|
558
|
+
...approvedDeps(),
|
|
559
|
+
cwd: root,
|
|
560
|
+
exportReport: async () => { throw sourceChanged(); },
|
|
561
|
+
beginRun: async () => { began = true; throw new Error('must not begin'); },
|
|
562
|
+
stderr: (line) => preflightErrors.push(line),
|
|
563
|
+
}), 3);
|
|
564
|
+
strict_1.default.equal(began, false);
|
|
565
|
+
strict_1.default.match(preflightErrors.join('\n'), /source changed/);
|
|
566
|
+
let exports = 0;
|
|
567
|
+
let finishBody = '';
|
|
568
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)([
|
|
569
|
+
'publish', '--report', 'retained-vsg-output', '--parent-run', parentRunId,
|
|
570
|
+
], {
|
|
571
|
+
...approvedDeps(),
|
|
572
|
+
cwd: root,
|
|
573
|
+
journalRoot: (0, node_path_1.join)(root, 'journals'),
|
|
574
|
+
exportReport: async (options) => {
|
|
575
|
+
exports += 1;
|
|
576
|
+
if (exports === 2)
|
|
577
|
+
throw sourceChanged();
|
|
578
|
+
return { report: {}, compactReport: {}, reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json') };
|
|
579
|
+
},
|
|
580
|
+
beginRun: async () => ({
|
|
581
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
582
|
+
reservationExpiresAt: '2026-10-20T02:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
583
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
584
|
+
}),
|
|
585
|
+
finishRun: async (_connection, runId, body) => {
|
|
586
|
+
finishBody = body;
|
|
587
|
+
return {
|
|
588
|
+
result: 'aborted', runId, state: 'aborted', verdict: null,
|
|
589
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: false,
|
|
590
|
+
};
|
|
591
|
+
},
|
|
592
|
+
stderr: () => { },
|
|
593
|
+
}), 2);
|
|
594
|
+
strict_1.default.equal(exports, 2);
|
|
595
|
+
strict_1.default.deepEqual(JSON.parse(finishBody), { outcome: 'aborted', reason: 'source_changed' });
|
|
596
|
+
}
|
|
597
|
+
finally {
|
|
598
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
(0, node_test_1.default)('expired pending finish recovers from retained evidence without rerunning scanners', async () => {
|
|
602
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-expired-finish-'));
|
|
603
|
+
const oldBody = '{"outcome":"completed","report":{"transportVersion":"3.0","runId":"old"}}';
|
|
604
|
+
try {
|
|
605
|
+
await (0, journal_js_1.createSecurityPublishJournal)({
|
|
606
|
+
...retainedJournalInput(root, { parentRunId: BASELINE_RUN_ID }),
|
|
607
|
+
runId: RUN_ID,
|
|
608
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z',
|
|
609
|
+
}, oldBody, root);
|
|
610
|
+
const beginIds = [];
|
|
611
|
+
let scans = 0;
|
|
612
|
+
let exports = 0;
|
|
613
|
+
let finishedBody = '';
|
|
614
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
615
|
+
...approvedDeps(),
|
|
616
|
+
journalRoot: root,
|
|
617
|
+
beginRun: async (_connection, input) => {
|
|
618
|
+
beginIds.push(input.clientRequestId);
|
|
619
|
+
strict_1.default.equal(input.mode, 'report');
|
|
620
|
+
strict_1.default.equal(input.parentRunId, BASELINE_RUN_ID);
|
|
621
|
+
return {
|
|
622
|
+
result: 'reserved', runId: CHILD_RUN_ID, state: 'reserved',
|
|
623
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
624
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
625
|
+
};
|
|
626
|
+
},
|
|
627
|
+
runRuntime: async () => { scans += 1; throw new Error('scanner must not run'); },
|
|
628
|
+
exportReport: async (options) => {
|
|
629
|
+
exports += 1;
|
|
630
|
+
return {
|
|
631
|
+
report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
632
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
633
|
+
};
|
|
634
|
+
},
|
|
635
|
+
finishRun: async (_connection, runId, body) => {
|
|
636
|
+
strict_1.default.equal(runId, CHILD_RUN_ID);
|
|
637
|
+
strict_1.default.equal((await (0, journal_js_1.readSecurityPublishJournal)(JOURNAL_ID, root)).exactRequestBody, oldBody);
|
|
638
|
+
finishedBody = body;
|
|
639
|
+
return {
|
|
640
|
+
result: 'finished', runId, state: 'finished', verdict: 'PASS',
|
|
641
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
642
|
+
};
|
|
643
|
+
},
|
|
644
|
+
stdout: () => { },
|
|
645
|
+
});
|
|
646
|
+
strict_1.default.equal(exit, 0);
|
|
647
|
+
strict_1.default.equal(scans, 0);
|
|
648
|
+
strict_1.default.equal(exports, 2);
|
|
649
|
+
strict_1.default.equal(beginIds.length, 1);
|
|
650
|
+
strict_1.default.notEqual(beginIds[0], JOURNAL_ID);
|
|
651
|
+
const receipt = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.join)(root, `${JOURNAL_ID}.ack.json`), 'utf8'));
|
|
652
|
+
strict_1.default.equal(receipt.finalJournalId, beginIds[0]);
|
|
653
|
+
strict_1.default.deepEqual(await node_fs_1.promises.readdir((0, node_path_1.join)(root, JOURNAL_ID)), ['recovery.json']);
|
|
654
|
+
await strict_1.default.rejects(node_fs_1.promises.lstat((0, node_path_1.join)(root, beginIds[0])), { code: 'ENOENT' });
|
|
655
|
+
strict_1.default.equal(JSON.parse(finishedBody).report.runId, CHILD_RUN_ID);
|
|
656
|
+
let retryFinishes = 0;
|
|
657
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
658
|
+
resolveConnection: async () => connection,
|
|
659
|
+
journalRoot: root,
|
|
660
|
+
finishRun: async () => { retryFinishes += 1; throw new Error('must not retry'); },
|
|
661
|
+
stdout: () => { },
|
|
662
|
+
}), 0);
|
|
663
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', beginIds[0]], {
|
|
664
|
+
resolveConnection: async () => connection,
|
|
665
|
+
journalRoot: root,
|
|
666
|
+
finishRun: async () => { retryFinishes += 1; throw new Error('must not retry'); },
|
|
667
|
+
stdout: () => { },
|
|
668
|
+
}), 0);
|
|
669
|
+
strict_1.default.equal(retryFinishes, 0);
|
|
670
|
+
}
|
|
671
|
+
finally {
|
|
672
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
(0, node_test_1.default)('expired begin replay without retained evidence stops without a replacement begin or scanner', async () => {
|
|
676
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-expired-begin-'));
|
|
677
|
+
try {
|
|
678
|
+
await (0, journal_js_1.createSecurityBeginJournal)({
|
|
679
|
+
...retainedJournalInput(root, {
|
|
680
|
+
retainedCompleted: false,
|
|
681
|
+
localExit: null,
|
|
682
|
+
reportPath: null,
|
|
683
|
+
}),
|
|
684
|
+
}, root);
|
|
685
|
+
const beginIds = [];
|
|
686
|
+
let scans = 0;
|
|
687
|
+
const errors = [];
|
|
688
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
689
|
+
resolveConnection: async () => connection,
|
|
690
|
+
journalRoot: root,
|
|
691
|
+
beginRun: async (_connection, input) => {
|
|
692
|
+
beginIds.push(input.clientRequestId);
|
|
693
|
+
return {
|
|
694
|
+
result: 'replay', runId: RUN_ID, state: 'expired',
|
|
695
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
696
|
+
grantKind: 'security_subscription', remainingUnits: 50, reservedUnits: 0,
|
|
697
|
+
};
|
|
698
|
+
},
|
|
699
|
+
runRuntime: async () => { scans += 1; throw new Error('scanner must not run'); },
|
|
700
|
+
stderr: (line) => errors.push(line),
|
|
701
|
+
});
|
|
702
|
+
strict_1.default.equal(exit, 3);
|
|
703
|
+
strict_1.default.deepEqual(beginIds, [JOURNAL_ID]);
|
|
704
|
+
strict_1.default.equal(scans, 0);
|
|
705
|
+
await strict_1.default.rejects(node_fs_1.promises.lstat((0, node_path_1.join)(root, JOURNAL_ID, 'recovery.json')), { code: 'ENOENT' });
|
|
706
|
+
strict_1.default.match(errors.join('\n'), /expired before a completed result was retained/);
|
|
707
|
+
}
|
|
708
|
+
finally {
|
|
709
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
(0, node_test_1.default)('result-ready and orphan-body interruptions resume from retained output without a scanner rerun', async () => {
|
|
713
|
+
for (const orphanBody of [false, true]) {
|
|
714
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-result-ready-'));
|
|
715
|
+
try {
|
|
716
|
+
const pending = await (0, journal_js_1.createSecurityBeginJournal)({
|
|
717
|
+
...retainedJournalInput(root, {
|
|
718
|
+
mode: 'scan',
|
|
719
|
+
retainedCompleted: false,
|
|
720
|
+
localExit: null,
|
|
721
|
+
reportPath: null,
|
|
722
|
+
}),
|
|
723
|
+
}, root);
|
|
724
|
+
const reserved = await (0, journal_js_1.setSecurityJournalReservation)(pending, {
|
|
725
|
+
runId: RUN_ID,
|
|
726
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z',
|
|
727
|
+
}, root);
|
|
728
|
+
await (0, journal_js_1.setSecurityJournalResult)(reserved, {
|
|
729
|
+
reportPath: (0, node_path_1.join)(root, 'retained-vsg-output', 'lattice-report.json'),
|
|
730
|
+
localExit: 0,
|
|
731
|
+
}, root);
|
|
732
|
+
if (orphanBody) {
|
|
733
|
+
await node_fs_1.promises.writeFile((0, node_path_1.join)(root, JOURNAL_ID, 'finish-request.json'), '{"partial":"orphaned-before-metadata-rename"}');
|
|
734
|
+
}
|
|
735
|
+
let scans = 0;
|
|
736
|
+
let finishedBody = '';
|
|
737
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
738
|
+
...approvedDeps(),
|
|
739
|
+
journalRoot: root,
|
|
740
|
+
runRuntime: async () => { scans += 1; throw new Error('scanner must not run'); },
|
|
741
|
+
exportReport: async (options) => ({
|
|
742
|
+
report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
743
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
744
|
+
}),
|
|
745
|
+
finishRun: async (_connection, runId, body) => {
|
|
746
|
+
finishedBody = body;
|
|
747
|
+
return {
|
|
748
|
+
result: 'finished', runId, state: 'finished', verdict: 'PASS',
|
|
749
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
750
|
+
};
|
|
751
|
+
},
|
|
752
|
+
stdout: () => { },
|
|
753
|
+
});
|
|
754
|
+
strict_1.default.equal(exit, 0);
|
|
755
|
+
strict_1.default.equal(scans, 0);
|
|
756
|
+
strict_1.default.equal(JSON.parse(finishedBody).report.runId, RUN_ID);
|
|
757
|
+
strict_1.default.deepEqual(await node_fs_1.promises.readdir(root), []);
|
|
758
|
+
}
|
|
759
|
+
finally {
|
|
760
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
(0, node_test_1.default)('recovery child created before begin is revalidated before any lease request', async () => {
|
|
765
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-recovery-prebegin-'));
|
|
766
|
+
try {
|
|
767
|
+
await (0, journal_js_1.createSecurityPublishJournal)({
|
|
768
|
+
...retainedJournalInput(root, { parentRunId: BASELINE_RUN_ID }),
|
|
769
|
+
runId: RUN_ID,
|
|
770
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z',
|
|
771
|
+
}, '{"outcome":"completed","report":{}}', root);
|
|
772
|
+
const recovery = await (0, journal_js_1.createOrReadSecurityRecovery)(JOURNAL_ID, root);
|
|
773
|
+
await (0, journal_js_1.createSecurityBeginJournal)({
|
|
774
|
+
...retainedJournalInput(root, {
|
|
775
|
+
id: recovery.childJournalId,
|
|
776
|
+
clientRequestId: recovery.childJournalId,
|
|
777
|
+
parentRunId: BASELINE_RUN_ID,
|
|
778
|
+
recoveryParentId: JOURNAL_ID,
|
|
779
|
+
recoveryRootId: JOURNAL_ID,
|
|
780
|
+
}),
|
|
781
|
+
}, root);
|
|
782
|
+
let begins = 0;
|
|
783
|
+
const errors = [];
|
|
784
|
+
const sourceChanged = Object.assign(new Error('synthetic source changed'), { code: 'source_changed' });
|
|
785
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
786
|
+
...approvedDeps(),
|
|
787
|
+
journalRoot: root,
|
|
788
|
+
exportReport: async () => { throw sourceChanged; },
|
|
789
|
+
beginRun: async () => { begins += 1; throw new Error('must not begin'); },
|
|
790
|
+
stderr: (line) => errors.push(line),
|
|
791
|
+
});
|
|
792
|
+
strict_1.default.equal(exit, 3);
|
|
793
|
+
strict_1.default.equal(begins, 0);
|
|
794
|
+
strict_1.default.match(errors.join('\n'), /synthetic source changed/);
|
|
795
|
+
strict_1.default.equal((await (0, journal_js_1.readSecurityJournal)(recovery.childJournalId, root)).state, 'begin_pending');
|
|
796
|
+
}
|
|
797
|
+
finally {
|
|
798
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
(0, node_test_1.default)('source change after recovery reservation sends one exact abort and retains its exit in the receipt', async () => {
|
|
802
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-recovery-source-change-'));
|
|
803
|
+
try {
|
|
804
|
+
await (0, journal_js_1.createSecurityPublishJournal)({
|
|
805
|
+
...retainedJournalInput(root, { parentRunId: BASELINE_RUN_ID }),
|
|
806
|
+
runId: RUN_ID,
|
|
807
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z',
|
|
808
|
+
}, '{"outcome":"completed","report":{}}', root);
|
|
809
|
+
let exports = 0;
|
|
810
|
+
let begins = 0;
|
|
811
|
+
const finishBodies = [];
|
|
812
|
+
const sourceChanged = Object.assign(new Error('synthetic source changed after begin'), { code: 'source_changed' });
|
|
813
|
+
const deps = {
|
|
814
|
+
...approvedDeps(),
|
|
815
|
+
journalRoot: root,
|
|
816
|
+
exportReport: async (options) => {
|
|
817
|
+
exports += 1;
|
|
818
|
+
if (exports === 2)
|
|
819
|
+
throw sourceChanged;
|
|
820
|
+
return { report: {}, compactReport: {}, reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json') };
|
|
821
|
+
},
|
|
822
|
+
beginRun: async () => {
|
|
823
|
+
begins += 1;
|
|
824
|
+
return {
|
|
825
|
+
result: 'reserved', runId: CHILD_RUN_ID, state: 'reserved',
|
|
826
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
827
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
828
|
+
};
|
|
829
|
+
},
|
|
830
|
+
finishRun: async (_connection, runId, body) => {
|
|
831
|
+
finishBodies.push(body);
|
|
832
|
+
if (finishBodies.length === 1)
|
|
833
|
+
throw new api_js_1.SecurityApiRequestError('synthetic offline', null, 'network_error', true);
|
|
834
|
+
return {
|
|
835
|
+
result: 'aborted', runId, state: 'aborted', verdict: null,
|
|
836
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: false,
|
|
837
|
+
};
|
|
838
|
+
},
|
|
839
|
+
stderr: () => { },
|
|
840
|
+
stdout: () => { },
|
|
841
|
+
};
|
|
842
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], deps), 2);
|
|
843
|
+
strict_1.default.equal(begins, 1);
|
|
844
|
+
strict_1.default.equal(exports, 2);
|
|
845
|
+
strict_1.default.deepEqual(JSON.parse(finishBodies[0]), { outcome: 'aborted', reason: 'source_changed' });
|
|
846
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], deps), 2);
|
|
847
|
+
strict_1.default.equal(new Set(finishBodies).size, 1);
|
|
848
|
+
strict_1.default.equal(finishBodies.length, 2);
|
|
849
|
+
const receipt = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.join)(root, `${JOURNAL_ID}.ack.json`), 'utf8'));
|
|
850
|
+
strict_1.default.equal(receipt.localExit, 2);
|
|
851
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
852
|
+
resolveConnection: async () => connection,
|
|
853
|
+
journalRoot: root,
|
|
854
|
+
finishRun: async () => { throw new Error('must not retry'); },
|
|
855
|
+
stdout: () => { },
|
|
856
|
+
}), 2);
|
|
857
|
+
strict_1.default.equal(finishBodies.length, 2);
|
|
858
|
+
}
|
|
859
|
+
finally {
|
|
860
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
(0, node_test_1.default)('concurrent expired resumes share one durable recovery child request ID', async () => {
|
|
864
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-concurrent-recovery-'));
|
|
865
|
+
try {
|
|
866
|
+
await (0, journal_js_1.createSecurityPublishJournal)({
|
|
867
|
+
...retainedJournalInput(root, { mode: 'scan', parentRunId: null }),
|
|
868
|
+
runId: RUN_ID,
|
|
869
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z',
|
|
870
|
+
}, '{"outcome":"completed","report":{}}', root);
|
|
871
|
+
const beginIds = [];
|
|
872
|
+
const deps = {
|
|
873
|
+
...approvedDeps(),
|
|
874
|
+
journalRoot: root,
|
|
875
|
+
beginRun: async (_connection, input) => {
|
|
876
|
+
beginIds.push(input.clientRequestId);
|
|
877
|
+
strict_1.default.equal(input.mode, 'scan');
|
|
878
|
+
strict_1.default.equal(input.parentRunId, null);
|
|
879
|
+
return {
|
|
880
|
+
result: 'reserved', runId: CHILD_RUN_ID, state: 'reserved',
|
|
881
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
882
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
883
|
+
};
|
|
884
|
+
},
|
|
885
|
+
exportReport: async (options) => ({
|
|
886
|
+
report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
887
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
888
|
+
}),
|
|
889
|
+
finishRun: async () => ({
|
|
890
|
+
result: 'finished', runId: CHILD_RUN_ID, state: 'finished', verdict: 'PASS',
|
|
891
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
892
|
+
}),
|
|
893
|
+
stdout: () => { },
|
|
894
|
+
stderr: () => { },
|
|
895
|
+
};
|
|
896
|
+
strict_1.default.deepEqual(await Promise.all(Array.from({ length: 8 }, () => (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], deps))), Array.from({ length: 8 }, () => 0));
|
|
897
|
+
strict_1.default.equal(new Set(beginIds).size, 1);
|
|
898
|
+
const receipt = JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.join)(root, `${JOURNAL_ID}.ack.json`), 'utf8'));
|
|
899
|
+
strict_1.default.equal(receipt.finalJournalId, beginIds[0]);
|
|
900
|
+
strict_1.default.deepEqual((await node_fs_1.promises.readdir(root)).sort(), [
|
|
901
|
+
`${JOURNAL_ID}.ack.json`, `${receipt.finalJournalId}.ack.json`, JOURNAL_ID,
|
|
902
|
+
].sort());
|
|
903
|
+
strict_1.default.deepEqual(await node_fs_1.promises.readdir((0, node_path_1.join)(root, JOURNAL_ID)), ['recovery.json']);
|
|
904
|
+
}
|
|
905
|
+
finally {
|
|
906
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
(0, node_test_1.default)('expired recovery preserves one-attempt pending sync semantics while offline', async () => {
|
|
910
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-recovery-offline-'));
|
|
911
|
+
let finishCalls = 0;
|
|
912
|
+
try {
|
|
913
|
+
await (0, journal_js_1.createSecurityPublishJournal)({
|
|
914
|
+
...retainedJournalInput(root, { mode: 'scan', parentRunId: null }),
|
|
915
|
+
runId: RUN_ID,
|
|
916
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z',
|
|
917
|
+
}, '{"outcome":"completed","report":{}}', root);
|
|
918
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], {
|
|
919
|
+
...approvedDeps(),
|
|
920
|
+
journalRoot: root,
|
|
921
|
+
beginRun: async () => ({
|
|
922
|
+
result: 'reserved', runId: CHILD_RUN_ID, state: 'reserved',
|
|
923
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
924
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
925
|
+
}),
|
|
926
|
+
exportReport: async (options) => ({
|
|
927
|
+
report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
928
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
929
|
+
}),
|
|
930
|
+
finishRun: async () => {
|
|
931
|
+
finishCalls += 1;
|
|
932
|
+
throw new api_js_1.SecurityApiRequestError('synthetic offline', null, 'network_error', true);
|
|
933
|
+
},
|
|
934
|
+
stdout: () => { },
|
|
935
|
+
stderr: () => { },
|
|
936
|
+
}), 2);
|
|
937
|
+
strict_1.default.equal(finishCalls, 1);
|
|
938
|
+
const recovery = await (0, journal_js_1.readSecurityRecovery)(JOURNAL_ID, root);
|
|
939
|
+
strict_1.default.ok(recovery);
|
|
940
|
+
strict_1.default.equal((await (0, journal_js_1.readSecurityJournal)(recovery.childJournalId, root)).state, 'pending_finish');
|
|
941
|
+
await strict_1.default.rejects(node_fs_1.promises.lstat((0, node_path_1.join)(root, `${JOURNAL_ID}.ack.json`)), { code: 'ENOENT' });
|
|
942
|
+
}
|
|
943
|
+
finally {
|
|
944
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
(0, node_test_1.default)('a terminal receipt and retained recovery identity stop a preflight loser from minting a new child', async () => {
|
|
948
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-terminal-recovery-race-'));
|
|
949
|
+
let releaseLoser;
|
|
950
|
+
let loserReachedPreflight;
|
|
951
|
+
const loserGate = new Promise((resolve) => { releaseLoser = resolve; });
|
|
952
|
+
const loserReady = new Promise((resolve) => { loserReachedPreflight = resolve; });
|
|
953
|
+
let statusCalls = 0;
|
|
954
|
+
const beginIds = [];
|
|
955
|
+
try {
|
|
956
|
+
await (0, journal_js_1.createSecurityPublishJournal)({
|
|
957
|
+
...retainedJournalInput(root, { mode: 'scan', parentRunId: null }),
|
|
958
|
+
runId: RUN_ID,
|
|
959
|
+
reservationExpiresAt: '2000-01-01T00:00:00.000Z',
|
|
960
|
+
}, '{"outcome":"completed","report":{}}', root);
|
|
961
|
+
const deps = {
|
|
962
|
+
...approvedDeps(),
|
|
963
|
+
journalRoot: root,
|
|
964
|
+
getStatus: async () => {
|
|
965
|
+
statusCalls += 1;
|
|
966
|
+
if (statusCalls === 1) {
|
|
967
|
+
loserReachedPreflight();
|
|
968
|
+
await loserGate;
|
|
969
|
+
}
|
|
970
|
+
return approvedStatus();
|
|
971
|
+
},
|
|
972
|
+
beginRun: async (_connection, input) => {
|
|
973
|
+
beginIds.push(input.clientRequestId);
|
|
974
|
+
return {
|
|
975
|
+
result: 'reserved', runId: CHILD_RUN_ID, state: 'reserved',
|
|
976
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
977
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
978
|
+
};
|
|
979
|
+
},
|
|
980
|
+
exportReport: async (options) => ({
|
|
981
|
+
report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
982
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
983
|
+
}),
|
|
984
|
+
finishRun: async () => ({
|
|
985
|
+
result: 'finished', runId: CHILD_RUN_ID, state: 'finished', verdict: 'PASS',
|
|
986
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
987
|
+
}),
|
|
988
|
+
stdout: () => { },
|
|
989
|
+
};
|
|
990
|
+
const loser = (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], deps);
|
|
991
|
+
await loserReady;
|
|
992
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', JOURNAL_ID], deps), 0);
|
|
993
|
+
const retainedIdentity = await (0, journal_js_1.readSecurityRecovery)(JOURNAL_ID, root);
|
|
994
|
+
strict_1.default.ok(retainedIdentity);
|
|
995
|
+
releaseLoser();
|
|
996
|
+
strict_1.default.equal(await loser, 0);
|
|
997
|
+
strict_1.default.deepEqual(beginIds, [retainedIdentity.childJournalId]);
|
|
998
|
+
strict_1.default.deepEqual(await node_fs_1.promises.readdir((0, node_path_1.join)(root, JOURNAL_ID)), ['recovery.json']);
|
|
999
|
+
}
|
|
1000
|
+
finally {
|
|
1001
|
+
releaseLoser();
|
|
1002
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
1005
|
+
(0, node_test_1.default)('cleanup failure after finish keeps an acknowledged journal and never retries the network', async () => {
|
|
1006
|
+
const root = await node_fs_1.promises.mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'lattice-security-command-cleanup-only-'));
|
|
1007
|
+
let finishCalls = 0;
|
|
1008
|
+
try {
|
|
1009
|
+
const warnings = [];
|
|
1010
|
+
const exit = await (0, commands_js_1.runSecurityCommand)(['scan', '--publish'], {
|
|
1011
|
+
...approvedDeps(),
|
|
1012
|
+
journalRoot: root,
|
|
1013
|
+
beginRun: async () => ({
|
|
1014
|
+
result: 'reserved', runId: RUN_ID, state: 'reserved',
|
|
1015
|
+
reservationExpiresAt: '2999-01-01T00:00:00.000Z', entitlementId: ENTITLEMENT_ID,
|
|
1016
|
+
grantKind: 'security_subscription', remainingUnits: 49, reservedUnits: 1,
|
|
1017
|
+
}),
|
|
1018
|
+
runRuntime: async (options) => ({
|
|
1019
|
+
exitCode: 0, report: {}, compactReport: { transportVersion: '3.0', runId: options.runId },
|
|
1020
|
+
reportPath: (0, node_path_1.join)(options.outDir, 'lattice-report.json'),
|
|
1021
|
+
}),
|
|
1022
|
+
finishRun: async (_connection, runId) => {
|
|
1023
|
+
finishCalls += 1;
|
|
1024
|
+
return {
|
|
1025
|
+
result: 'finished', runId, state: 'finished', verdict: 'PASS',
|
|
1026
|
+
completedAt: '2026-10-20T00:00:00.000Z', contentExpiresAt: null, consumedUnit: true,
|
|
1027
|
+
};
|
|
1028
|
+
},
|
|
1029
|
+
removeJournal: async () => { throw new Error('synthetic cleanup lock'); },
|
|
1030
|
+
stdout: () => { },
|
|
1031
|
+
stderr: (line) => warnings.push(line),
|
|
1032
|
+
});
|
|
1033
|
+
strict_1.default.equal(exit, 0);
|
|
1034
|
+
strict_1.default.equal(finishCalls, 1);
|
|
1035
|
+
strict_1.default.match(warnings.join('\n'), /cloud result was accepted; local journal cleanup remains/);
|
|
1036
|
+
const [journalId] = await node_fs_1.promises.readdir(root);
|
|
1037
|
+
strict_1.default.equal((await (0, journal_js_1.readSecurityJournal)(journalId, root)).state, 'acknowledged');
|
|
1038
|
+
strict_1.default.equal(await (0, commands_js_1.runSecurityCommand)(['publish', '--journal', journalId], {
|
|
1039
|
+
resolveConnection: async () => connection,
|
|
1040
|
+
journalRoot: root,
|
|
1041
|
+
finishRun: async () => { finishCalls += 1; throw new Error('must not retry'); },
|
|
1042
|
+
stdout: () => { },
|
|
1043
|
+
}), 0);
|
|
1044
|
+
strict_1.default.equal(finishCalls, 1);
|
|
1045
|
+
strict_1.default.deepEqual(await node_fs_1.promises.readdir(root), []);
|
|
1046
|
+
}
|
|
1047
|
+
finally {
|
|
1048
|
+
await node_fs_1.promises.rm(root, { recursive: true, force: true });
|
|
1049
|
+
}
|
|
1050
|
+
});
|
|
1051
|
+
//# sourceMappingURL=commands.test.js.map
|