forgeos 0.1.0-alpha.7 → 0.1.0-alpha.71
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/.agents/skills/forge-agent-fabric/SKILL.md +178 -0
- package/.agents/skills/forge-agent-fabric/references/managed-workflows.md +95 -0
- package/.agents/skills/forge-agent-fabric/references/repository-analysis.md +102 -0
- package/.agents/skills/forge-agent-fabric/scripts/fabric.mjs +46 -0
- package/.agents/skills/forge-agent-fabric/scripts/repository.mjs +44 -0
- package/.npmignore +10 -0
- package/AGENTS.md +142 -90
- package/CHANGELOG.md +870 -9
- package/LICENSE +21 -0
- package/README.md +121 -6
- package/adapters/go/README.md +23 -0
- package/adapters/go/go.mod +3 -0
- package/adapters/go/http.go +149 -0
- package/adapters/go/registry.go +234 -0
- package/adapters/go/types.go +136 -0
- package/adapters/java/README.md +68 -0
- package/adapters/java/pom.xml +47 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Auth.java +20 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Diagnostic.java +16 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Entry.java +38 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/EntryKind.java +16 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ErrorInfo.java +4 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Forge.java +94 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeCall.java +12 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeContext.java +11 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeHandler.java +8 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeHttpHandler.java +179 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ForgeRegistry.java +121 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Json.java +14 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Manifest.java +14 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/RequestEnvelope.java +6 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/ResponseEnvelope.java +25 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Risk.java +18 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Schemas.java +36 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/Service.java +65 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/TransactionMode.java +18 -0
- package/adapters/java/src/main/java/dev/forgeos/adapter/TypedForgeHandler.java +6 -0
- package/adapters/java-spring-boot-starter/README.md +32 -0
- package/adapters/java-spring-boot-starter/pom.xml +49 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeCommand.java +22 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeExternalService.java +15 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeQuery.java +16 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeServiceBeanCondition.java +18 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeSpringAutoConfiguration.java +16 -0
- package/adapters/java-spring-boot-starter/src/main/java/dev/forgeos/adapter/spring/ForgeSpringRuntime.java +104 -0
- package/adapters/java-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +1 -0
- package/bin/forge.mjs +18 -0
- package/docs/agent-fabric-programs.md +151 -0
- package/docs/agent-fabric.md +582 -0
- package/docs/architecture/agent-fabric/PORTABLE_PROJECTS_PLAN.md +136 -0
- package/docs/architecture/agent-fabric/README.md +180 -0
- package/docs/architecture/agent-fabric/REPOSITORY_MANIFEST_PLAN.md +284 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_ADR.md +81 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS.md +39 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_CORRECTIONS_EVIDENCE.md +53 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_EVIDENCE.md +49 -0
- package/docs/architecture/agent-fabric/WORKFLOW_PROGRAM_V2_PLAN.md +590 -0
- package/docs/cair-protocol.md +103 -0
- package/docs/changelog.md +1070 -0
- package/docs/forge-protocol.md +189 -0
- package/docs/repository-agent-benchmark.md +179 -0
- package/docs/repository-analysis.md +139 -0
- package/docs/repository-context-quality.md +179 -0
- package/docs/repository-runtime-observation.md +82 -0
- package/examples/agent-fabric-v2/README.md +70 -0
- package/examples/agent-fabric-v2/item-child.workflow.ts +11 -0
- package/examples/agent-fabric-v2/make-request.mjs +4 -0
- package/examples/agent-fabric-v2/map-child.workflow.ts +10 -0
- package/examples/agent-fabric-v2/migrate.workflow.ts +35 -0
- package/examples/agent-fabric-v2/registry.example.json +256 -0
- package/examples/agent-fabric-v2/run-ui-fixture.ts +48 -0
- package/examples/agent-fabric-v2/ui-audit.workflow.ts +28 -0
- package/examples/agent-fabric-v2/ui-fixture-worker.cjs +36 -0
- package/examples/agent-fabric-v2/visual-population.json +13 -0
- package/examples/agent-fabric-v2/workers/check.mjs +2 -0
- package/examples/agent-fabric-v2/workers/common.mjs +7 -0
- package/examples/agent-fabric-v2/workers/discover.mjs +2 -0
- package/examples/agent-fabric-v2/workers/migrate.mjs +4 -0
- package/examples/agent-fabric-v2/workers/review.mjs +3 -0
- package/examples/go-billing/go.mod +7 -0
- package/examples/go-billing/main.go +120 -0
- package/examples/java-billing/pom.xml +60 -0
- package/examples/java-billing/src/main/java/dev/forgeos/examples/billing/CreateInvoiceInput.java +4 -0
- package/examples/java-billing/src/main/java/dev/forgeos/examples/billing/Invoice.java +11 -0
- package/examples/java-billing/src/main/java/dev/forgeos/examples/billing/Main.java +127 -0
- package/package.json +60 -5
- package/schemas/agent-fabric/v0.1/control-event.schema.json +281 -0
- package/schemas/forge-manifest.schema.json +389 -0
- package/scripts/field-test-forgeos.mjs +1021 -0
- package/scripts/install-agent-fabric-skill.mjs +105 -0
- package/src/forge/_generated/releaseManifest.json +1 -2
- package/src/forge/_generated/releaseManifest.ts +3 -3
- package/src/forge/agent-adapters/index.ts +1592 -125
- package/src/forge/agent-adapters/types.ts +225 -1
- package/src/forge/agent-fabric/adapter.ts +131 -0
- package/src/forge/agent-fabric/attached-snapshot.ts +55 -0
- package/src/forge/agent-fabric/attached-task-contract.ts +105 -0
- package/src/forge/agent-fabric/attached-task-service.ts +127 -0
- package/src/forge/agent-fabric/attached-task-store.ts +109 -0
- package/src/forge/agent-fabric/authority.ts +298 -0
- package/src/forge/agent-fabric/canonical.ts +135 -0
- package/src/forge/agent-fabric/codex-adversarial-review.ts +229 -0
- package/src/forge/agent-fabric/codex-sdk-worker.ts +203 -0
- package/src/forge/agent-fabric/conductor.ts +754 -0
- package/src/forge/agent-fabric/dictionary.ts +12 -0
- package/src/forge/agent-fabric/errors.ts +32 -0
- package/src/forge/agent-fabric/hardened-conductor.ts +485 -0
- package/src/forge/agent-fabric/hardened-reducer.ts +211 -0
- package/src/forge/agent-fabric/index.ts +48 -0
- package/src/forge/agent-fabric/journal.ts +116 -0
- package/src/forge/agent-fabric/local-adaptive-digest-worker.mjs +26 -0
- package/src/forge/agent-fabric/local-adaptive-harness.ts +343 -0
- package/src/forge/agent-fabric/local-adaptive-service.ts +398 -0
- package/src/forge/agent-fabric/local-adaptive-worker.ts +146 -0
- package/src/forge/agent-fabric/local-approval-window.ts +211 -0
- package/src/forge/agent-fabric/local-change-review-service.ts +374 -0
- package/src/forge/agent-fabric/local-coding-worker.ts +285 -0
- package/src/forge/agent-fabric/local-control-store.ts +239 -0
- package/src/forge/agent-fabric/local-effect-broker.ts +348 -0
- package/src/forge/agent-fabric/local-evolution-approval.ts +81 -0
- package/src/forge/agent-fabric/local-evolution-profile.ts +87 -0
- package/src/forge/agent-fabric/local-evolution-registry.ts +427 -0
- package/src/forge/agent-fabric/local-evolution-service.ts +200 -0
- package/src/forge/agent-fabric/local-intelligence.ts +281 -0
- package/src/forge/agent-fabric/local-paths.ts +18 -0
- package/src/forge/agent-fabric/local-task-contract.ts +203 -0
- package/src/forge/agent-fabric/local-task-inbox.ts +543 -0
- package/src/forge/agent-fabric/local-task-server.ts +374 -0
- package/src/forge/agent-fabric/local-task-service.ts +982 -0
- package/src/forge/agent-fabric/local-verification.ts +551 -0
- package/src/forge/agent-fabric/managed-environment.ts +205 -0
- package/src/forge/agent-fabric/managed-run-contract.ts +103 -0
- package/src/forge/agent-fabric/managed-run-service.ts +401 -0
- package/src/forge/agent-fabric/managed-run-store.ts +165 -0
- package/src/forge/agent-fabric/managed-workspace.ts +253 -0
- package/src/forge/agent-fabric/p0a.ts +104 -0
- package/src/forge/agent-fabric/p0b-model-adapter.ts +434 -0
- package/src/forge/agent-fabric/planning.ts +155 -0
- package/src/forge/agent-fabric/program-api.ts +37 -0
- package/src/forge/agent-fabric/program-contract.ts +283 -0
- package/src/forge/agent-fabric/program-dsl.ts +126 -0
- package/src/forge/agent-fabric/program-evidence.ts +22 -0
- package/src/forge/agent-fabric/program-image.ts +15 -0
- package/src/forge/agent-fabric/program-lock.ts +50 -0
- package/src/forge/agent-fabric/program-owner.ts +16 -0
- package/src/forge/agent-fabric/program-scheduler.ts +38 -0
- package/src/forge/agent-fabric/program-service.ts +793 -0
- package/src/forge/agent-fabric/program-store.ts +142 -0
- package/src/forge/agent-fabric/program-structure.ts +65 -0
- package/src/forge/agent-fabric/program-types.ts +110 -0
- package/src/forge/agent-fabric/program-view.ts +12 -0
- package/src/forge/agent-fabric/program-worker.ts +108 -0
- package/src/forge/agent-fabric/project-profile.ts +50 -0
- package/src/forge/agent-fabric/project-registry.ts +120 -0
- package/src/forge/agent-fabric/project-runtime.ts +85 -0
- package/src/forge/agent-fabric/readiness.ts +26 -0
- package/src/forge/agent-fabric/reducer.ts +863 -0
- package/src/forge/agent-fabric/repository-context.ts +83 -0
- package/src/forge/agent-fabric/resource-ledger.ts +266 -0
- package/src/forge/agent-fabric/serialized-local-adapter.ts +60 -0
- package/src/forge/agent-fabric/types.ts +424 -0
- package/src/forge/agent-fabric/validation.ts +500 -0
- package/src/forge/agent-fabric/workflow-engine.ts +218 -0
- package/src/forge/agent-fabric/workflow-task-actions.ts +104 -0
- package/src/forge/agent-fabric/workflow-templates.ts +11 -0
- package/src/forge/agent-memory/bridge.ts +1728 -0
- package/src/forge/agent-memory/context-pack.ts +284 -0
- package/src/forge/agent-memory/hook-runner.ts +331 -0
- package/src/forge/agent-memory/mcp.ts +597 -0
- package/src/forge/agent-memory/normalize.ts +498 -0
- package/src/forge/agent-memory/redaction.ts +103 -0
- package/src/forge/agent-memory/sources/claude-code.ts +51 -0
- package/src/forge/agent-memory/sources/codex-hook-runner.mjs +343 -0
- package/src/forge/agent-memory/sources/codex.ts +161 -0
- package/src/forge/agent-memory/sources/cursor.ts +35 -0
- package/src/forge/agent-memory/types.ts +215 -0
- package/src/forge/bench.ts +248 -0
- package/src/forge/brownfield-import/index.ts +896 -0
- package/src/forge/brownfield-import/types.ts +127 -0
- package/src/forge/cair/action-journal.ts +61 -0
- package/src/forge/cair/action-parser.ts +314 -0
- package/src/forge/cair/action-validator.ts +40 -0
- package/src/forge/cair/actions.ts +1818 -0
- package/src/forge/cair/format.ts +77 -0
- package/src/forge/cair/index.ts +118 -0
- package/src/forge/cair/query.ts +478 -0
- package/src/forge/cair/snapshot.ts +315 -0
- package/src/forge/cair/types.ts +255 -0
- package/src/forge/cli/adaptive.ts +51 -0
- package/src/forge/cli/ai.ts +16 -1
- package/src/forge/cli/auth.ts +459 -15
- package/src/forge/cli/authmd.ts +441 -0
- package/src/forge/cli/baseline.ts +112 -0
- package/src/forge/cli/build.ts +20 -4
- package/src/forge/cli/changed.ts +418 -0
- package/src/forge/cli/codex-app-server.ts +877 -0
- package/src/forge/cli/commands.ts +1859 -20
- package/src/forge/cli/db.ts +209 -2
- package/src/forge/cli/deploy.ts +1339 -0
- package/src/forge/cli/deps.ts +150 -23
- package/src/forge/cli/dev.ts +1137 -53
- package/src/forge/cli/docs.ts +265 -0
- package/src/forge/cli/doctor.ts +297 -0
- package/src/forge/cli/env-placeholders.ts +62 -0
- package/src/forge/cli/evolution.ts +40 -0
- package/src/forge/cli/fabric.ts +253 -0
- package/src/forge/cli/field-test.ts +568 -0
- package/src/forge/cli/golden-path.ts +487 -0
- package/src/forge/cli/handoff.ts +336 -0
- package/src/forge/cli/index.ts +1 -0
- package/src/forge/cli/last-run.ts +84 -0
- package/src/forge/cli/main.ts +196 -3
- package/src/forge/cli/new.ts +169 -17
- package/src/forge/cli/next-actions.ts +23 -0
- package/src/forge/cli/output.ts +398 -6
- package/src/forge/cli/parse.ts +1377 -38
- package/src/forge/cli/progress.ts +51 -0
- package/src/forge/cli/query.ts +32 -0
- package/src/forge/cli/release.ts +35 -11
- package/src/forge/cli/repository.ts +151 -0
- package/src/forge/cli/run.ts +42 -0
- package/src/forge/cli/secrets.ts +137 -1
- package/src/forge/cli/seed.ts +581 -0
- package/src/forge/cli/self-host.ts +56 -14
- package/src/forge/cli/studio.ts +2282 -0
- package/src/forge/cli/verify.ts +1458 -32
- package/src/forge/cli/windows.ts +23 -0
- package/src/forge/cli/workos.ts +3509 -0
- package/src/forge/compiler/agent-contract/build.ts +728 -64
- package/src/forge/compiler/agent-contract/types.ts +45 -2
- package/src/forge/compiler/ai-registry/parse.ts +71 -2
- package/src/forge/compiler/api-surface/build.ts +47 -0
- package/src/forge/compiler/app-graph/build.ts +112 -9
- package/src/forge/compiler/app-graph/extract.ts +107 -0
- package/src/forge/compiler/app-graph/module-graph.ts +73 -78
- package/src/forge/compiler/app-graph/parser.ts +24 -24
- package/src/forge/compiler/app-graph/profile.ts +26 -0
- package/src/forge/compiler/app-graph/tsconfig-hash.ts +41 -4
- package/src/forge/compiler/app-graph/versions.ts +1 -1
- package/src/forge/compiler/classifier/capabilities.ts +3 -2
- package/src/forge/compiler/classifier/classify.ts +32 -8
- package/src/forge/compiler/classifier/secrets.ts +3 -2
- package/src/forge/compiler/classifier/signals.ts +91 -1
- package/src/forge/compiler/client-sdk/build-manifest.ts +59 -0
- package/src/forge/compiler/client-sdk/render-client.ts +295 -13
- package/src/forge/compiler/data-graph/build.ts +29 -1
- package/src/forge/compiler/data-graph/parse.ts +20 -4
- package/src/forge/compiler/data-graph/sql/ddl.ts +144 -31
- package/src/forge/compiler/data-graph/sql/serialize.ts +4 -0
- package/src/forge/compiler/data-graph/sql/types.ts +1 -0
- package/src/forge/compiler/diagnostics/codes.ts +38 -0
- package/src/forge/compiler/diagnostics/create.ts +28 -2
- package/src/forge/compiler/diagnostics/index.ts +2 -0
- package/src/forge/compiler/emitter/barrel.ts +3 -0
- package/src/forge/compiler/emitter/render.ts +9 -0
- package/src/forge/compiler/external-manifest/registry.ts +217 -0
- package/src/forge/compiler/external-manifest/types.ts +91 -0
- package/src/forge/compiler/external-manifest/validate.ts +373 -0
- package/src/forge/compiler/frontend-graph/build.ts +142 -14
- package/src/forge/compiler/integration/add.ts +991 -33
- package/src/forge/compiler/integration/plan.ts +43 -12
- package/src/forge/compiler/integration/render.ts +29 -0
- package/src/forge/compiler/integration/snapshot.ts +2 -0
- package/src/forge/compiler/integration/templates/convex.ts +70 -0
- package/src/forge/compiler/integration/templates/index.ts +1 -0
- package/src/forge/compiler/integration/templates/render.ts +38 -0
- package/src/forge/compiler/integration/templates/types.ts +3 -0
- package/src/forge/compiler/integration/templates/workos.ts +1439 -0
- package/src/forge/compiler/make-registry/build.ts +8 -9
- package/src/forge/compiler/orchestrator/fast-check.ts +4 -0
- package/src/forge/compiler/orchestrator/generate-lock.ts +14 -3
- package/src/forge/compiler/orchestrator/manifest.ts +1 -1
- package/src/forge/compiler/orchestrator/plan-profile.ts +23 -0
- package/src/forge/compiler/orchestrator/plan.ts +249 -10
- package/src/forge/compiler/orchestrator/profile.ts +65 -0
- package/src/forge/compiler/orchestrator/run.ts +101 -33
- package/src/forge/compiler/orchestrator/serialize.ts +33 -8
- package/src/forge/compiler/orchestrator/types.ts +1 -1
- package/src/forge/compiler/package-graph/compiler.ts +3 -1
- package/src/forge/compiler/package-graph/constants.ts +1 -1
- package/src/forge/compiler/package-graph/dts-extractor.ts +14 -1
- package/src/forge/compiler/package-manager/adapter.ts +4 -1
- package/src/forge/compiler/package-manager/commands.ts +4 -0
- package/src/forge/compiler/package-manager/executor.ts +30 -1
- package/src/forge/compiler/package-manager/version.ts +36 -12
- package/src/forge/compiler/package-upgrades/planner.ts +155 -18
- package/src/forge/compiler/package-upgrades/types.ts +2 -0
- package/src/forge/compiler/policy-registry/build.ts +47 -2
- package/src/forge/compiler/policy-registry/parse.ts +32 -2
- package/src/forge/compiler/recipes/definitions.ts +63 -0
- package/src/forge/compiler/recipes/index.ts +2 -0
- package/src/forge/compiler/recipes/profiles.ts +81 -0
- package/src/forge/compiler/recipes/registry.ts +6 -0
- package/src/forge/compiler/test-graph/build.ts +11 -3
- package/src/forge/compiler/types/app-graph.ts +8 -2
- package/src/forge/compiler/types/cli.ts +76 -1
- package/src/forge/compiler/types/dev-manifest.ts +4 -0
- package/src/forge/compiler/types/emit.ts +2 -0
- package/src/forge/compiler/types/frontend-graph.ts +2 -2
- package/src/forge/compiler/types/integration.ts +1 -0
- package/src/forge/compiler/types/package-graph.ts +6 -0
- package/src/forge/compiler/types/policy-registry.ts +3 -1
- package/src/forge/delta/broker-runner.mjs +5 -0
- package/src/forge/delta/broker.ts +429 -0
- package/src/forge/delta/classifier.ts +52 -0
- package/src/forge/delta/explain.ts +238 -0
- package/src/forge/delta/git-observer.ts +67 -0
- package/src/forge/delta/ids.ts +44 -0
- package/src/forge/delta/index.ts +25 -0
- package/src/forge/delta/process-identity.ts +37 -0
- package/src/forge/delta/queue-status.ts +190 -0
- package/src/forge/delta/recorder.ts +540 -0
- package/src/forge/delta/redaction.ts +50 -0
- package/src/forge/delta/schema.ts +240 -0
- package/src/forge/delta/session.ts +142 -0
- package/src/forge/delta/status.ts +1139 -0
- package/src/forge/delta/store.ts +3329 -0
- package/src/forge/delta/timeline.ts +178 -0
- package/src/forge/dev/server.ts +1061 -22
- package/src/forge/dev/types.ts +15 -1
- package/src/forge/dev/watch.ts +17 -7
- package/src/forge/dev-console/cycle.ts +285 -33
- package/src/forge/dev-console/types.ts +47 -1
- package/src/forge/impact/index.ts +222 -30
- package/src/forge/impact/types.ts +33 -1
- package/src/forge/intent/index.ts +35 -16
- package/src/forge/make/fields.ts +26 -0
- package/src/forge/make/index.ts +42 -6
- package/src/forge/make/templates.ts +211 -4
- package/src/forge/make/types.ts +2 -1
- package/src/forge/policy.ts +1 -1
- package/src/forge/react/index.ts +160 -2
- package/src/forge/refactor/index.ts +1 -0
- package/src/forge/repair/rules/index.ts +2 -2
- package/src/forge/repository-analysis/adapters/common.ts +72 -0
- package/src/forge/repository-analysis/adapters/docker.ts +185 -0
- package/src/forge/repository-analysis/adapters/java.ts +133 -0
- package/src/forge/repository-analysis/adapters/typescript.ts +350 -0
- package/src/forge/repository-analysis/adapters/vue.ts +71 -0
- package/src/forge/repository-analysis/analyze.ts +434 -0
- package/src/forge/repository-analysis/benchmark.ts +336 -0
- package/src/forge/repository-analysis/cache-gc.ts +154 -0
- package/src/forge/repository-analysis/check-selection.ts +123 -0
- package/src/forge/repository-analysis/context-node.ts +17 -0
- package/src/forge/repository-analysis/context.ts +456 -0
- package/src/forge/repository-analysis/http-resolution.ts +135 -0
- package/src/forge/repository-analysis/identity.ts +45 -0
- package/src/forge/repository-analysis/index.ts +18 -0
- package/src/forge/repository-analysis/nuxt-resolution.ts +188 -0
- package/src/forge/repository-analysis/quality.ts +60 -0
- package/src/forge/repository-analysis/retrieval.ts +309 -0
- package/src/forge/repository-analysis/runtime-artifacts.ts +195 -0
- package/src/forge/repository-analysis/runtime-observation.ts +325 -0
- package/src/forge/repository-analysis/scanner.ts +174 -0
- package/src/forge/repository-analysis/storage.ts +193 -0
- package/src/forge/repository-analysis/test-associations.ts +59 -0
- package/src/forge/repository-analysis/types.ts +99 -0
- package/src/forge/repository-manifest/index.ts +178 -0
- package/src/forge/repository-manifest/types.ts +63 -0
- package/src/forge/review/index.ts +162 -12
- package/src/forge/review/types.ts +15 -0
- package/src/forge/runtime/ai/providers.ts +19 -4
- package/src/forge/runtime/auth/config.ts +17 -0
- package/src/forge/runtime/auth/evaluate.ts +15 -2
- package/src/forge/runtime/auth/resolve.ts +61 -6
- package/src/forge/runtime/auth/types.ts +1 -0
- package/src/forge/runtime/db/factory.ts +1 -3
- package/src/forge/runtime/db/generated-client.ts +13 -2
- package/src/forge/runtime/db/memory-adapter.ts +139 -32
- package/src/forge/runtime/db/pglite-adapter.ts +285 -2
- package/src/forge/runtime/executor.ts +129 -16
- package/src/forge/runtime/external/bridge.ts +663 -0
- package/src/forge/runtime/runner/run-entry.ts +16 -7
- package/src/forge/runtime/telemetry/buffer.ts +4 -1
- package/src/forge/runtime/telemetry/scrubber.ts +35 -5
- package/src/forge/runtime/webhooks/security.ts +12 -7
- package/src/forge/server.ts +71 -7
- package/src/forge/ui/index.ts +831 -19
- package/src/forge/ui/types.ts +3 -1
- package/src/forge/version.ts +1 -1
- package/src/forge/vue/index.ts +422 -0
- package/src/forge/workspace/baseline.ts +112 -0
- package/src/forge/workspace/change-summary.ts +292 -0
- package/src/forge/workspace/forge-cli.ts +42 -0
- package/src/forge/workspace/git-summary.ts +393 -0
- package/templates/agent-workroom/AGENTS.md +29 -0
- package/templates/agent-workroom/README.md +34 -0
- package/templates/agent-workroom/forge.config.ts +3 -0
- package/templates/agent-workroom/package.json +34 -0
- package/templates/agent-workroom/pnpm-workspace.yaml +2 -0
- package/templates/agent-workroom/src/actions/indexAgentSignal.ts +10 -0
- package/templates/agent-workroom/src/commands/openWorkroom.ts +61 -0
- package/templates/agent-workroom/src/commands/recordAgentSignal.ts +119 -0
- package/templates/agent-workroom/src/commands/recordCheckRun.ts +52 -0
- package/templates/agent-workroom/src/forge/schema.ts +54 -0
- package/templates/agent-workroom/src/policies.ts +6 -0
- package/templates/agent-workroom/src/queries/listWorkrooms.ts +11 -0
- package/templates/agent-workroom/src/queries/liveWorkroom.ts +63 -0
- package/templates/agent-workroom/tsconfig.json +16 -0
- package/templates/agent-workroom/web/index.html +13 -0
- package/templates/agent-workroom/web/package.json +21 -0
- package/templates/agent-workroom/web/src/App.tsx +345 -0
- package/templates/agent-workroom/web/src/lib/forge.ts +20 -0
- package/templates/agent-workroom/web/src/main.tsx +13 -0
- package/templates/agent-workroom/web/src/styles.css +545 -0
- package/templates/agent-workroom/web/tsconfig.json +27 -0
- package/templates/agent-workroom/web/vite.config.ts +36 -0
- package/templates/b2b-support-web/package.json +2 -0
- package/templates/b2b-support-web/pnpm-workspace.yaml +2 -0
- package/templates/b2b-support-web/web/app/page.tsx +2 -2
- package/templates/b2b-support-web/web/lib/forge.ts +9 -2
- package/templates/b2b-support-web/web/next.config.ts +24 -0
- package/templates/b2b-support-web/web/package.json +1 -1
- package/templates/minimal-web/package.json +2 -1
- package/templates/minimal-web/pnpm-workspace.yaml +2 -0
- package/templates/minimal-web/web/index.html +1 -0
- package/templates/minimal-web/web/src/App.tsx +12 -6
- package/templates/minimal-web/web/src/lib/forge.ts +9 -2
- package/templates/minimal-web/web/src/styles.css +34 -0
- package/templates/minimal-web/web/vite.config.ts +36 -0
- package/templates/nuxt-web/.vscode/settings.json +14 -0
- package/templates/nuxt-web/.yarnrc.yml +1 -0
- package/templates/nuxt-web/README.md +30 -0
- package/templates/nuxt-web/forge.config.ts +3 -0
- package/templates/nuxt-web/package.json +37 -0
- package/templates/nuxt-web/pnpm-workspace.yaml +2 -0
- package/templates/nuxt-web/src/actions/logNoteCreated.ts +11 -0
- package/templates/nuxt-web/src/commands/createNote.ts +26 -0
- package/templates/nuxt-web/src/forge/schema.ts +12 -0
- package/templates/nuxt-web/src/policies.ts +6 -0
- package/templates/nuxt-web/src/queries/listNotes.ts +8 -0
- package/templates/nuxt-web/src/queries/liveNotes.ts +8 -0
- package/templates/nuxt-web/tsconfig.json +17 -0
- package/templates/nuxt-web/web/app.vue +67 -0
- package/templates/nuxt-web/web/components/LiveNotes.vue +89 -0
- package/templates/nuxt-web/web/components/NoteComposer.vue +100 -0
- package/templates/nuxt-web/web/composables/forge.ts +13 -0
- package/templates/nuxt-web/web/composables/useNotes.ts +24 -0
- package/templates/nuxt-web/web/nuxt.config.ts +11 -0
- package/templates/nuxt-web/web/package.json +22 -0
- package/templates/nuxt-web/web/plugins/forge.client.ts +10 -0
- package/templates/nuxt-web/web/plugins/forge.server.ts +10 -0
- package/templates/nuxt-web/web/server/api/forge-health.get.ts +7 -0
- package/templates/nuxt-web/web/tsconfig.json +6 -0
- package/templates/vendor-access/.vscode/settings.json +14 -0
- package/templates/vendor-access/README.md +30 -0
- package/templates/vendor-access/forge.config.ts +3 -0
- package/templates/vendor-access/package.json +35 -0
- package/templates/vendor-access/pnpm-workspace.yaml +2 -0
- package/templates/vendor-access/src/commands/addEvidence.ts +42 -0
- package/templates/vendor-access/src/commands/approveAccessRequest.ts +43 -0
- package/templates/vendor-access/src/commands/createAccessRequest.ts +49 -0
- package/templates/vendor-access/src/commands/seedVendorAccessDemo.ts +200 -0
- package/templates/vendor-access/src/forge/schema.ts +74 -0
- package/templates/vendor-access/src/policies.ts +11 -0
- package/templates/vendor-access/src/queries/listVendorAccessDashboard.ts +24 -0
- package/templates/vendor-access/src/queries/liveVendorAccessDashboard.ts +24 -0
- package/templates/vendor-access/tsconfig.json +17 -0
- package/templates/vendor-access/web/index.html +13 -0
- package/templates/vendor-access/web/package.json +21 -0
- package/templates/vendor-access/web/src/App.tsx +573 -0
- package/templates/vendor-access/web/src/lib/forge.ts +20 -0
- package/templates/vendor-access/web/src/main.tsx +205 -0
- package/templates/vendor-access/web/src/styles.css +682 -0
- package/templates/vendor-access/web/tsconfig.json +18 -0
- package/templates/vendor-access/web/vite.config.ts +36 -0
- package/src/forge/_generated/actionSubscriptions.json +0 -2
- package/src/forge/_generated/actionSubscriptions.ts +0 -10
- package/src/forge/_generated/agentAdapterManifest.json +0 -2
- package/src/forge/_generated/agentAdapterManifest.ts +0 -73
- package/src/forge/_generated/agentContract.json +0 -2
- package/src/forge/_generated/agentContract.ts +0 -7829
- package/src/forge/_generated/agentQuickstart.md +0 -34
- package/src/forge/_generated/agentTools.json +0 -2
- package/src/forge/_generated/agentTools.md +0 -16
- package/src/forge/_generated/agentTools.ts +0 -12
- package/src/forge/_generated/aiContext.ts +0 -125
- package/src/forge/_generated/aiModels.json +0 -2
- package/src/forge/_generated/aiModels.ts +0 -51
- package/src/forge/_generated/aiProviders.json +0 -2
- package/src/forge/_generated/aiProviders.ts +0 -23
- package/src/forge/_generated/aiRegistry.json +0 -2
- package/src/forge/_generated/aiRegistry.ts +0 -31
- package/src/forge/_generated/api.json +0 -2
- package/src/forge/_generated/api.ts +0 -8
- package/src/forge/_generated/appGraph.json +0 -2
- package/src/forge/_generated/appGraph.ts +0 -14937
- package/src/forge/_generated/appMap.md +0 -55
- package/src/forge/_generated/artifactManifest.json +0 -2
- package/src/forge/_generated/artifactManifest.ts +0 -7
- package/src/forge/_generated/authClaims.json +0 -2
- package/src/forge/_generated/authClaims.ts +0 -13
- package/src/forge/_generated/authConfig.json +0 -2
- package/src/forge/_generated/authConfig.ts +0 -17
- package/src/forge/_generated/authContext.ts +0 -23
- package/src/forge/_generated/authRegistry.json +0 -2
- package/src/forge/_generated/authRegistry.ts +0 -25
- package/src/forge/_generated/buildInfo.json +0 -2
- package/src/forge/_generated/buildInfo.ts +0 -9
- package/src/forge/_generated/capabilityMap.json +0 -2
- package/src/forge/_generated/capabilityMap.md +0 -15
- package/src/forge/_generated/capabilityMap.ts +0 -17
- package/src/forge/_generated/client.ts +0 -282
- package/src/forge/_generated/clientApi.ts +0 -9
- package/src/forge/_generated/clientManifest.json +0 -2
- package/src/forge/_generated/clientManifest.ts +0 -39
- package/src/forge/_generated/clientTypes.ts +0 -78
- package/src/forge/_generated/configRegistry.json +0 -2
- package/src/forge/_generated/configRegistry.ts +0 -4
- package/src/forge/_generated/dataGraph.json +0 -2
- package/src/forge/_generated/dataGraph.ts +0 -8
- package/src/forge/_generated/db.json +0 -2
- package/src/forge/_generated/db.ts +0 -2
- package/src/forge/_generated/dbSecurityManifest.json +0 -2
- package/src/forge/_generated/dbSecurityManifest.ts +0 -15
- package/src/forge/_generated/dbSessionContext.json +0 -2
- package/src/forge/_generated/dbSessionContext.ts +0 -39
- package/src/forge/_generated/deployManifest.json +0 -2
- package/src/forge/_generated/deployManifest.ts +0 -14
- package/src/forge/_generated/devManifest.json +0 -2
- package/src/forge/_generated/devManifest.ts +0 -62
- package/src/forge/_generated/envSchema.json +0 -2
- package/src/forge/_generated/envSchema.ts +0 -59
- package/src/forge/_generated/frontendGraph.json +0 -2
- package/src/forge/_generated/frontendGraph.ts +0 -27
- package/src/forge/_generated/importGuards.json +0 -2
- package/src/forge/_generated/importGuards.ts +0 -686
- package/src/forge/_generated/index.ts +0 -68
- package/src/forge/_generated/liveProductionManifest.json +0 -2
- package/src/forge/_generated/liveProductionManifest.ts +0 -23
- package/src/forge/_generated/liveProtocol.json +0 -2
- package/src/forge/_generated/liveProtocol.ts +0 -21
- package/src/forge/_generated/liveQueryRegistry.json +0 -2
- package/src/forge/_generated/liveQueryRegistry.ts +0 -9
- package/src/forge/_generated/liveTransportConfig.json +0 -2
- package/src/forge/_generated/liveTransportConfig.ts +0 -19
- package/src/forge/_generated/makeRegistry.json +0 -2
- package/src/forge/_generated/makeRegistry.ts +0 -177
- package/src/forge/_generated/makeTemplates.json +0 -2
- package/src/forge/_generated/makeTemplates.ts +0 -66
- package/src/forge/_generated/mockMap.json +0 -2
- package/src/forge/_generated/mockMap.ts +0 -7
- package/src/forge/_generated/operationPlaybooks.md +0 -167
- package/src/forge/_generated/packageGraph.json +0 -2
- package/src/forge/_generated/packageGraph.ts +0 -249334
- package/src/forge/_generated/packageUpgradeRegistry.json +0 -2
- package/src/forge/_generated/packageUpgradeRegistry.ts +0 -15
- package/src/forge/_generated/permissionMatrix.json +0 -2
- package/src/forge/_generated/permissionMatrix.ts +0 -7
- package/src/forge/_generated/policyRegistry.json +0 -2
- package/src/forge/_generated/policyRegistry.ts +0 -11
- package/src/forge/_generated/queryRegistry.json +0 -2
- package/src/forge/_generated/queryRegistry.ts +0 -9
- package/src/forge/_generated/react.d.ts +0 -22
- package/src/forge/_generated/react.ts +0 -29
- package/src/forge/_generated/reactManifest.json +0 -2
- package/src/forge/_generated/reactManifest.ts +0 -19
- package/src/forge/_generated/rlsPolicies.json +0 -2
- package/src/forge/_generated/rlsPolicies.sql +0 -34
- package/src/forge/_generated/rlsPolicies.ts +0 -6
- package/src/forge/_generated/runtimeGraph.json +0 -2
- package/src/forge/_generated/runtimeGraph.ts +0 -8
- package/src/forge/_generated/runtimeMatrix.json +0 -2
- package/src/forge/_generated/runtimeMatrix.ts +0 -334130
- package/src/forge/_generated/runtimeRegistry.ts +0 -2
- package/src/forge/_generated/runtimeRules.md +0 -91
- package/src/forge/_generated/secretRegistry.json +0 -2
- package/src/forge/_generated/secretRegistry.ts +0 -50
- package/src/forge/_generated/secretsContext.ts +0 -11
- package/src/forge/_generated/serverApi.ts +0 -10
- package/src/forge/_generated/sourceMapManifest.json +0 -2
- package/src/forge/_generated/sourceMapManifest.ts +0 -7
- package/src/forge/_generated/sqlPlan.json +0 -2
- package/src/forge/_generated/sqlPlan.ts +0 -88
- package/src/forge/_generated/subscriptionManifest.json +0 -2
- package/src/forge/_generated/subscriptionManifest.ts +0 -7
- package/src/forge/_generated/symbolicationManifest.json +0 -2
- package/src/forge/_generated/symbolicationManifest.ts +0 -17
- package/src/forge/_generated/telemetryRegistry.json +0 -2
- package/src/forge/_generated/telemetryRegistry.ts +0 -9
- package/src/forge/_generated/telemetrySinks.json +0 -2
- package/src/forge/_generated/telemetrySinks.ts +0 -11
- package/src/forge/_generated/tenantScope.json +0 -2
- package/src/forge/_generated/tenantScope.ts +0 -8
- package/src/forge/_generated/testGraph.json +0 -2
- package/src/forge/_generated/testGraph.ts +0 -3452
- package/src/forge/_generated/testPlanRegistry.json +0 -2
- package/src/forge/_generated/testPlanRegistry.ts +0 -33
- package/src/forge/_generated/uiRoutes.json +0 -2
- package/src/forge/_generated/uiRoutes.ts +0 -16
- package/src/forge/_generated/uiScenarios.json +0 -2
- package/src/forge/_generated/uiScenarios.ts +0 -30
- package/src/forge/_generated/uiTestManifest.json +0 -2
- package/src/forge/_generated/uiTestManifest.ts +0 -27
- package/src/forge/_generated/workflowRegistry.json +0 -2
- package/src/forge/_generated/workflowRegistry.ts +0 -9
- package/src/forge/_generated/workflowSubscriptions.json +0 -2
- package/src/forge/_generated/workflowSubscriptions.ts +0 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createDiagnostic } from "../diagnostics/create.ts";
|
|
2
|
+
import { FORGE_DB_INVALID_ID_FIELD } from "../diagnostics/codes.ts";
|
|
2
3
|
import { hashStable } from "../primitives/hash.ts";
|
|
3
4
|
import { canonicalJson } from "../primitives/serialize.ts";
|
|
4
5
|
import type { AppGraph } from "../types/app-graph.ts";
|
|
@@ -64,6 +65,32 @@ function detectDuplicateTableNames(tables: DataTable[]): DataGraph["diagnostics"
|
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
function detectInvalidIdFields(tables: DataTable[]): DataGraph["diagnostics"] {
|
|
69
|
+
const diagnostics: DataGraph["diagnostics"] = [];
|
|
70
|
+
for (const table of tables) {
|
|
71
|
+
const idField = table.fields.find((field) => field.name === "id");
|
|
72
|
+
if (!idField || idField.type.trim().replace(/\?$/, "").toLowerCase() !== "text") {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
diagnostics.push(
|
|
76
|
+
createDiagnostic({
|
|
77
|
+
severity: "error",
|
|
78
|
+
code: FORGE_DB_INVALID_ID_FIELD,
|
|
79
|
+
message: `table '${table.name}' declares id as 'text'; Forge requires id to be omitted or declared as 'uuid' so the database primary key and runtime id semantics stay aligned`,
|
|
80
|
+
file: table.file,
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return diagnostics.sort((a, b) => {
|
|
85
|
+
const fileA = a.file ?? "";
|
|
86
|
+
const fileB = b.file ?? "";
|
|
87
|
+
if (fileA !== fileB) {
|
|
88
|
+
return fileA < fileB ? -1 : 1;
|
|
89
|
+
}
|
|
90
|
+
return a.message < b.message ? -1 : a.message > b.message ? 1 : 0;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
67
94
|
export function buildDataGraph(appGraph: AppGraph): DataGraph {
|
|
68
95
|
const tables: DataTable[] = [];
|
|
69
96
|
const diagnostics: DataGraph["diagnostics"] = [];
|
|
@@ -114,6 +141,7 @@ export function buildDataGraph(appGraph: AppGraph): DataGraph {
|
|
|
114
141
|
}
|
|
115
142
|
|
|
116
143
|
const dupDiagnostics = detectDuplicateTableNames(tables);
|
|
144
|
+
const idDiagnostics = detectInvalidIdFields(tables);
|
|
117
145
|
|
|
118
146
|
return {
|
|
119
147
|
schemaVersion: DATA_GRAPH_SCHEMA_VERSION,
|
|
@@ -126,6 +154,6 @@ export function buildDataGraph(appGraph: AppGraph): DataGraph {
|
|
|
126
154
|
}),
|
|
127
155
|
),
|
|
128
156
|
tables: stableSortTables(tables),
|
|
129
|
-
diagnostics: [...diagnostics, ...dupDiagnostics],
|
|
157
|
+
diagnostics: [...diagnostics, ...dupDiagnostics, ...idDiagnostics],
|
|
130
158
|
};
|
|
131
159
|
}
|
|
@@ -36,7 +36,23 @@ function unwrapStringLiteral(node: SyntaxNode): string | null {
|
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function
|
|
39
|
+
function unwrapNullableType(node: SyntaxNode): string | null {
|
|
40
|
+
if (node.type !== "call_expression") {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const functionNode = node.childForFieldName("function");
|
|
44
|
+
if (functionNode?.type !== "identifier" || functionNode.text !== "nullable") {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const argsNode = node.childForFieldName("arguments");
|
|
48
|
+
const firstArg = argsNode?.namedChildren.find((child) =>
|
|
49
|
+
child.type !== "," && child.type !== "comment" && child.type !== "(" && child.type !== ")"
|
|
50
|
+
);
|
|
51
|
+
const inner = firstArg ? unwrapStringLiteral(firstArg) : null;
|
|
52
|
+
return inner ? `${inner}?` : null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function extractFieldsFromObject(objectNode: SyntaxNode, options: { skipConfigName?: boolean } = {}): DataField[] {
|
|
40
56
|
const fields: DataField[] = [];
|
|
41
57
|
|
|
42
58
|
for (const child of objectNode.namedChildren) {
|
|
@@ -55,7 +71,7 @@ function extractFieldsFromObject(objectNode: SyntaxNode): DataField[] {
|
|
|
55
71
|
? keyNode.text
|
|
56
72
|
: unwrapStringLiteral(keyNode);
|
|
57
73
|
|
|
58
|
-
if (!key || key === "name") {
|
|
74
|
+
if (!key || (options.skipConfigName && key === "name")) {
|
|
59
75
|
continue;
|
|
60
76
|
}
|
|
61
77
|
|
|
@@ -64,7 +80,7 @@ function extractFieldsFromObject(objectNode: SyntaxNode): DataField[] {
|
|
|
64
80
|
continue;
|
|
65
81
|
}
|
|
66
82
|
|
|
67
|
-
const typeValue = unwrapStringLiteral(valueNode);
|
|
83
|
+
const typeValue = unwrapStringLiteral(valueNode) ?? unwrapNullableType(valueNode);
|
|
68
84
|
if (typeValue !== null) {
|
|
69
85
|
fields.push({ name: key, type: typeValue });
|
|
70
86
|
}
|
|
@@ -131,7 +147,7 @@ function parseCallArguments(callNode: SyntaxNode): ParsedDefineTable | null {
|
|
|
131
147
|
|
|
132
148
|
if (first.type === "object") {
|
|
133
149
|
const tableName = extractNameFromObject(first);
|
|
134
|
-
const fields = extractFieldsFromObject(first);
|
|
150
|
+
const fields = extractFieldsFromObject(first, { skipConfigName: true });
|
|
135
151
|
return { tableName, fields };
|
|
136
152
|
}
|
|
137
153
|
|
|
@@ -34,6 +34,7 @@ const SYSTEM_LIVE_SUBSCRIPTION_DEBUG_SQL = `CREATE TABLE IF NOT EXISTS _forge_li
|
|
|
34
34
|
|
|
35
35
|
interface ParsedFieldType {
|
|
36
36
|
sqlType: string;
|
|
37
|
+
nullable?: boolean;
|
|
37
38
|
references?: { table: string; column: string };
|
|
38
39
|
checkConstraint?: string;
|
|
39
40
|
}
|
|
@@ -42,36 +43,100 @@ function stableSortTables(tables: DataTable[]): DataTable[] {
|
|
|
42
43
|
return [...tables].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
function stableSortTableChangesByReferences(tables: SqlChange[]): SqlChange[] {
|
|
47
|
+
const orderedInput = [...tables].sort((a, b) => {
|
|
48
|
+
const tableA = a.table ?? "";
|
|
49
|
+
const tableB = b.table ?? "";
|
|
50
|
+
return tableA < tableB ? -1 : tableA > tableB ? 1 : 0;
|
|
51
|
+
});
|
|
52
|
+
const byName = new Map<string, SqlChange>();
|
|
53
|
+
|
|
54
|
+
for (const table of orderedInput) {
|
|
55
|
+
if (table.table) {
|
|
56
|
+
byName.set(table.table, table);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const pending = new Set(byName.keys());
|
|
61
|
+
const emitted = new Set<string>();
|
|
62
|
+
const ordered: SqlChange[] = [];
|
|
63
|
+
|
|
64
|
+
while (pending.size > 0) {
|
|
65
|
+
let progressed = false;
|
|
66
|
+
|
|
67
|
+
for (const tableName of pending) {
|
|
68
|
+
const table = byName.get(tableName);
|
|
69
|
+
if (!table) {
|
|
70
|
+
pending.delete(tableName);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const dependencies = (table.columns ?? [])
|
|
75
|
+
.map((column) => column.references?.table)
|
|
76
|
+
.filter((dependency): dependency is string => Boolean(dependency))
|
|
77
|
+
.filter((dependency) => dependency !== tableName && byName.has(dependency));
|
|
78
|
+
|
|
79
|
+
if (dependencies.every((dependency) => emitted.has(dependency))) {
|
|
80
|
+
ordered.push(table);
|
|
81
|
+
emitted.add(tableName);
|
|
82
|
+
pending.delete(tableName);
|
|
83
|
+
progressed = true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!progressed) {
|
|
88
|
+
for (const tableName of pending) {
|
|
89
|
+
const table = byName.get(tableName);
|
|
90
|
+
if (table) {
|
|
91
|
+
ordered.push(table);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return ordered;
|
|
99
|
+
}
|
|
100
|
+
|
|
45
101
|
function parseFieldType(
|
|
46
102
|
field: DataField,
|
|
47
103
|
tableName: string,
|
|
48
104
|
diagnostics: Diagnostic[],
|
|
105
|
+
refTables: Map<string, string>,
|
|
49
106
|
): ParsedFieldType | null {
|
|
50
|
-
const
|
|
107
|
+
const declared = field.type.trim();
|
|
108
|
+
const nullable = declared.endsWith("?");
|
|
109
|
+
const raw = (nullable ? declared.slice(0, -1) : declared).trim();
|
|
110
|
+
const lowered = raw.toLowerCase();
|
|
111
|
+
|
|
112
|
+
const withNullability = (parsed: Omit<ParsedFieldType, "nullable">): ParsedFieldType => ({
|
|
113
|
+
...parsed,
|
|
114
|
+
...(nullable ? { nullable: true } : {}),
|
|
115
|
+
});
|
|
51
116
|
|
|
52
|
-
if (
|
|
53
|
-
return { sqlType: "uuid" };
|
|
117
|
+
if (lowered === "uuid") {
|
|
118
|
+
return withNullability({ sqlType: "uuid" });
|
|
54
119
|
}
|
|
55
|
-
if (
|
|
56
|
-
return { sqlType: "text" };
|
|
120
|
+
if (lowered === "text" || lowered === "string") {
|
|
121
|
+
return withNullability({ sqlType: "text" });
|
|
57
122
|
}
|
|
58
|
-
if (
|
|
59
|
-
return { sqlType: "double precision" };
|
|
123
|
+
if (lowered === "number") {
|
|
124
|
+
return withNullability({ sqlType: "double precision" });
|
|
60
125
|
}
|
|
61
|
-
if (
|
|
62
|
-
return { sqlType: "integer" };
|
|
126
|
+
if (lowered === "integer" || lowered === "int") {
|
|
127
|
+
return withNullability({ sqlType: "integer" });
|
|
63
128
|
}
|
|
64
|
-
if (
|
|
65
|
-
return { sqlType: "boolean" };
|
|
129
|
+
if (lowered === "boolean" || lowered === "bool") {
|
|
130
|
+
return withNullability({ sqlType: "boolean" });
|
|
66
131
|
}
|
|
67
|
-
if (
|
|
68
|
-
return { sqlType: "timestamptz" };
|
|
132
|
+
if (lowered === "timestamp" || lowered === "timestamptz") {
|
|
133
|
+
return withNullability({ sqlType: "timestamptz" });
|
|
69
134
|
}
|
|
70
|
-
if (
|
|
71
|
-
return { sqlType: "jsonb" };
|
|
135
|
+
if (lowered === "json") {
|
|
136
|
+
return withNullability({ sqlType: "jsonb" });
|
|
72
137
|
}
|
|
73
138
|
|
|
74
|
-
if (
|
|
139
|
+
if (lowered.startsWith("enum:")) {
|
|
75
140
|
const values = raw
|
|
76
141
|
.slice("enum:".length)
|
|
77
142
|
.split(",")
|
|
@@ -89,16 +154,17 @@ function parseFieldType(
|
|
|
89
154
|
}
|
|
90
155
|
const checkValues = values.map((value) => `'${value.replace(/'/g, "''")}'`).join(", ");
|
|
91
156
|
return {
|
|
157
|
+
...(nullable ? { nullable: true } : {}),
|
|
92
158
|
sqlType: "text",
|
|
93
159
|
checkConstraint: `${quoteIdent(toSnakeCase(field.name))} IN (${checkValues})`,
|
|
94
160
|
};
|
|
95
161
|
}
|
|
96
162
|
|
|
97
|
-
if (
|
|
98
|
-
return { sqlType: "text" };
|
|
163
|
+
if (lowered.startsWith("enum_")) {
|
|
164
|
+
return withNullability({ sqlType: "text" });
|
|
99
165
|
}
|
|
100
166
|
|
|
101
|
-
if (
|
|
167
|
+
if (lowered.startsWith("ref:")) {
|
|
102
168
|
const refTable = raw.slice("ref:".length).trim();
|
|
103
169
|
if (!refTable) {
|
|
104
170
|
diagnostics.push(
|
|
@@ -110,14 +176,27 @@ function parseFieldType(
|
|
|
110
176
|
);
|
|
111
177
|
return null;
|
|
112
178
|
}
|
|
179
|
+
const resolvedRefTable = refTables.get(refTable) ?? refTables.get(toSnakeCase(refTable));
|
|
180
|
+
if (!resolvedRefTable) {
|
|
181
|
+
diagnostics.push(
|
|
182
|
+
createDiagnostic({
|
|
183
|
+
severity: "error",
|
|
184
|
+
code: FORGE_DB_INVALID_SQL_PLAN,
|
|
185
|
+
message: `unknown ref target '${refTable}' on ${tableName}.${field.name}; expected one of ${[...new Set(refTables.values())].sort().join(", ")}`,
|
|
186
|
+
}),
|
|
187
|
+
);
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
113
190
|
return {
|
|
191
|
+
...(nullable ? { nullable: true } : {}),
|
|
114
192
|
sqlType: "uuid",
|
|
115
|
-
references: { table:
|
|
193
|
+
references: { table: resolvedRefTable, column: "id" },
|
|
116
194
|
};
|
|
117
195
|
}
|
|
118
196
|
|
|
119
|
-
if (
|
|
197
|
+
if (lowered === "ref") {
|
|
120
198
|
return {
|
|
199
|
+
...(nullable ? { nullable: true } : {}),
|
|
121
200
|
sqlType: "uuid",
|
|
122
201
|
references: { table: toSnakeCase(field.name.replace(/Id$/i, "")), column: "id" },
|
|
123
202
|
};
|
|
@@ -133,9 +212,21 @@ function parseFieldType(
|
|
|
133
212
|
return null;
|
|
134
213
|
}
|
|
135
214
|
|
|
215
|
+
function buildReferenceTableLookup(tables: DataTable[]): Map<string, string> {
|
|
216
|
+
const lookup = new Map<string, string>();
|
|
217
|
+
for (const table of tables) {
|
|
218
|
+
const sqlTableName = toSnakeCase(table.name);
|
|
219
|
+
lookup.set(table.name, sqlTableName);
|
|
220
|
+
lookup.set(table.exportName, sqlTableName);
|
|
221
|
+
lookup.set(sqlTableName, sqlTableName);
|
|
222
|
+
lookup.set(toSnakeCase(table.exportName), sqlTableName);
|
|
223
|
+
}
|
|
224
|
+
return lookup;
|
|
225
|
+
}
|
|
226
|
+
|
|
136
227
|
function defaultExprForField(field: DataField): string | undefined {
|
|
137
228
|
const name = field.name;
|
|
138
|
-
const type = field.type.trim().toLowerCase();
|
|
229
|
+
const type = field.type.trim().replace(/\?$/, "").toLowerCase();
|
|
139
230
|
|
|
140
231
|
if (name === "id" && type === "uuid") {
|
|
141
232
|
return "gen_random_uuid()";
|
|
@@ -151,7 +242,11 @@ function defaultExprForField(field: DataField): string | undefined {
|
|
|
151
242
|
return undefined;
|
|
152
243
|
}
|
|
153
244
|
|
|
154
|
-
function buildColumns(
|
|
245
|
+
function buildColumns(
|
|
246
|
+
table: DataTable,
|
|
247
|
+
diagnostics: Diagnostic[],
|
|
248
|
+
refTables: Map<string, string>,
|
|
249
|
+
): ColumnDef[] {
|
|
155
250
|
const columns: ColumnDef[] = [];
|
|
156
251
|
const fields = [...table.fields].sort((a, b) =>
|
|
157
252
|
a.name < b.name ? -1 : a.name > b.name ? 1 : 0,
|
|
@@ -170,7 +265,7 @@ function buildColumns(table: DataTable, diagnostics: Diagnostic[]): ColumnDef[]
|
|
|
170
265
|
}
|
|
171
266
|
|
|
172
267
|
for (const field of fields) {
|
|
173
|
-
const parsed = parseFieldType(field, table.name, diagnostics);
|
|
268
|
+
const parsed = parseFieldType(field, table.name, diagnostics, refTables);
|
|
174
269
|
if (!parsed) {
|
|
175
270
|
continue;
|
|
176
271
|
}
|
|
@@ -183,7 +278,7 @@ function buildColumns(table: DataTable, diagnostics: Diagnostic[]): ColumnDef[]
|
|
|
183
278
|
name: snakeName,
|
|
184
279
|
fieldName: field.name,
|
|
185
280
|
sqlType: parsed.sqlType,
|
|
186
|
-
nullable: false,
|
|
281
|
+
nullable: isPrimaryKey ? false : parsed.nullable === true,
|
|
187
282
|
primaryKey: isPrimaryKey,
|
|
188
283
|
defaultExpr,
|
|
189
284
|
references: parsed.references,
|
|
@@ -191,7 +286,17 @@ function buildColumns(table: DataTable, diagnostics: Diagnostic[]): ColumnDef[]
|
|
|
191
286
|
});
|
|
192
287
|
}
|
|
193
288
|
|
|
194
|
-
if (!columns.some((column) => column.
|
|
289
|
+
if (hasIdField && !columns.some((column) => column.name === "id" && column.primaryKey)) {
|
|
290
|
+
const idField = fields.find((field) => field.name === "id");
|
|
291
|
+
diagnostics.push(
|
|
292
|
+
createDiagnostic({
|
|
293
|
+
severity: "warning",
|
|
294
|
+
code: FORGE_DB_INVALID_SQL_PLAN,
|
|
295
|
+
message: `table '${table.name}' declares id as '${idField?.type ?? "unknown"}'; Forge runtime requires id: "uuid" or no id field so Forge can generate one`,
|
|
296
|
+
file: table.file,
|
|
297
|
+
}),
|
|
298
|
+
);
|
|
299
|
+
} else if (!columns.some((column) => column.primaryKey) && columns.length > 0) {
|
|
195
300
|
columns[0]!.primaryKey = true;
|
|
196
301
|
}
|
|
197
302
|
|
|
@@ -235,9 +340,13 @@ function buildForeignKeyIndexes(tableName: string, columns: ColumnDef[]): IndexD
|
|
|
235
340
|
return indexes;
|
|
236
341
|
}
|
|
237
342
|
|
|
238
|
-
function buildTableChange(
|
|
343
|
+
function buildTableChange(
|
|
344
|
+
table: DataTable,
|
|
345
|
+
diagnostics: Diagnostic[],
|
|
346
|
+
refTables: Map<string, string>,
|
|
347
|
+
): SqlChange | null {
|
|
239
348
|
const tableName = toSnakeCase(table.name);
|
|
240
|
-
const columns = buildColumns(table, diagnostics);
|
|
349
|
+
const columns = buildColumns(table, diagnostics, refTables);
|
|
241
350
|
|
|
242
351
|
if (columns.length === 0) {
|
|
243
352
|
diagnostics.push(
|
|
@@ -254,6 +363,7 @@ function buildTableChange(table: DataTable, diagnostics: Diagnostic[]): SqlChang
|
|
|
254
363
|
return {
|
|
255
364
|
kind: "create_table",
|
|
256
365
|
table: tableName,
|
|
366
|
+
accessName: table.name,
|
|
257
367
|
columns,
|
|
258
368
|
sql: buildCreateTableSql(tableName, columns),
|
|
259
369
|
};
|
|
@@ -274,6 +384,7 @@ export function buildSqlPlan(dataGraph: DataGraph): SqlPlan {
|
|
|
274
384
|
const diagnostics: Diagnostic[] = [];
|
|
275
385
|
const tables: SqlChange[] = [];
|
|
276
386
|
const indexes: SqlChange[] = [];
|
|
387
|
+
const refTables = buildReferenceTableLookup(dataGraph.tables);
|
|
277
388
|
|
|
278
389
|
const systemTables: SqlChange[] = [
|
|
279
390
|
{
|
|
@@ -329,7 +440,7 @@ export function buildSqlPlan(dataGraph: DataGraph): SqlPlan {
|
|
|
329
440
|
];
|
|
330
441
|
|
|
331
442
|
for (const table of stableSortTables(dataGraph.tables)) {
|
|
332
|
-
const change = buildTableChange(table, diagnostics);
|
|
443
|
+
const change = buildTableChange(table, diagnostics, refTables);
|
|
333
444
|
if (!change) {
|
|
334
445
|
continue;
|
|
335
446
|
}
|
|
@@ -342,6 +453,8 @@ export function buildSqlPlan(dataGraph: DataGraph): SqlPlan {
|
|
|
342
453
|
}
|
|
343
454
|
}
|
|
344
455
|
|
|
456
|
+
const orderedTables = stableSortTableChangesByReferences(tables);
|
|
457
|
+
|
|
345
458
|
indexes.sort((a, b) => {
|
|
346
459
|
const nameA = a.index?.name ?? "";
|
|
347
460
|
const nameB = b.index?.name ?? "";
|
|
@@ -364,7 +477,7 @@ export function buildSqlPlan(dataGraph: DataGraph): SqlPlan {
|
|
|
364
477
|
const payload = {
|
|
365
478
|
schemaVersion: SQL_PLAN_SCHEMA_VERSION,
|
|
366
479
|
systemTables: systemTables.map((change) => change.sql),
|
|
367
|
-
tables:
|
|
480
|
+
tables: orderedTables.map((change) => change.sql),
|
|
368
481
|
indexes: indexes.map((change) => change.sql),
|
|
369
482
|
};
|
|
370
483
|
|
|
@@ -376,7 +489,7 @@ export function buildSqlPlan(dataGraph: DataGraph): SqlPlan {
|
|
|
376
489
|
migrationId,
|
|
377
490
|
checksum,
|
|
378
491
|
systemTables,
|
|
379
|
-
tables,
|
|
492
|
+
tables: orderedTables,
|
|
380
493
|
indexes,
|
|
381
494
|
diagnostics: diagnostics.sort((a, b) => {
|
|
382
495
|
const fileA = a.file ?? "";
|
|
@@ -15,6 +15,7 @@ export function serializeSqlPlanJson(plan: SqlPlan): string {
|
|
|
15
15
|
tables: plan.tables.map((change) => ({
|
|
16
16
|
kind: change.kind,
|
|
17
17
|
table: change.table,
|
|
18
|
+
accessName: change.accessName,
|
|
18
19
|
columns: change.columns,
|
|
19
20
|
sql: change.sql,
|
|
20
21
|
})),
|
|
@@ -69,6 +70,9 @@ export function buildTableMap(
|
|
|
69
70
|
? { tenantScoped: true, tenantIdColumn }
|
|
70
71
|
: {}),
|
|
71
72
|
};
|
|
73
|
+
if (change.accessName && change.accessName !== change.table) {
|
|
74
|
+
map[change.accessName] = map[change.table]!;
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
return map;
|
|
@@ -27,19 +27,36 @@ export const FORGE_DUP_RUNTIME_ENTRY = "FORGE_DUP_RUNTIME_ENTRY" as const;
|
|
|
27
27
|
export const FORGE_RUNTIME_UNRESOLVABLE = "FORGE_RUNTIME_UNRESOLVABLE" as const;
|
|
28
28
|
export const FORGE_RUNTIME_NOT_FOUND = "FORGE_RUNTIME_NOT_FOUND" as const;
|
|
29
29
|
export const FORGE_RUNTIME_GUARD_BLOCKED = "FORGE_RUNTIME_GUARD_BLOCKED" as const;
|
|
30
|
+
export const FORGE_RUNTIME_EXPORT_NAME_REQUIRED =
|
|
31
|
+
"FORGE_RUNTIME_EXPORT_NAME_REQUIRED" as const;
|
|
32
|
+
export const FORGE_EXTERNAL_RUNTIME_NOT_FOUND =
|
|
33
|
+
"FORGE_EXTERNAL_RUNTIME_NOT_FOUND" as const;
|
|
34
|
+
export const FORGE_EXTERNAL_RUNTIME_UNSUPPORTED =
|
|
35
|
+
"FORGE_EXTERNAL_RUNTIME_UNSUPPORTED" as const;
|
|
36
|
+
export const FORGE_EXTERNAL_RUNTIME_FAILED =
|
|
37
|
+
"FORGE_EXTERNAL_RUNTIME_FAILED" as const;
|
|
38
|
+
export const FORGE_EXTERNAL_RUNTIME_BAD_RESPONSE =
|
|
39
|
+
"FORGE_EXTERNAL_RUNTIME_BAD_RESPONSE" as const;
|
|
30
40
|
export const FORGE_DEV_SERVER_ERROR = "FORGE_DEV_SERVER_ERROR" as const;
|
|
31
41
|
export const FORGE_DEV_WATCH_FAILED = "FORGE_DEV_WATCH_FAILED" as const;
|
|
32
42
|
export const FORGE_DEV_INVOKE_FAILED = "FORGE_DEV_INVOKE_FAILED" as const;
|
|
33
43
|
export const FORGE_DEV_DOCTOR_MISSING_ARTIFACT =
|
|
34
44
|
"FORGE_DEV_DOCTOR_MISSING_ARTIFACT" as const;
|
|
45
|
+
export const FORGE_DEV_DB_RESET = "FORGE_DEV_DB_RESET" as const;
|
|
35
46
|
export const FORGE_DB_CONNECT_FAILED = "FORGE_DB_CONNECT_FAILED" as const;
|
|
36
47
|
export const FORGE_DB_MIGRATION_FAILED = "FORGE_DB_MIGRATION_FAILED" as const;
|
|
37
48
|
export const FORGE_DB_UNSUPPORTED_FIELD_TYPE =
|
|
38
49
|
"FORGE_DB_UNSUPPORTED_FIELD_TYPE" as const;
|
|
39
50
|
export const FORGE_DB_INVALID_SQL_PLAN = "FORGE_DB_INVALID_SQL_PLAN" as const;
|
|
51
|
+
export const FORGE_DB_INVALID_ID_FIELD =
|
|
52
|
+
"FORGE_DB_INVALID_ID_FIELD" as const;
|
|
53
|
+
export const FORGE_DB_EMPTY_TIMESTAMP_LITERAL =
|
|
54
|
+
"FORGE_DB_EMPTY_TIMESTAMP_LITERAL" as const;
|
|
40
55
|
export const FORGE_DB_TRANSACTION_FAILED = "FORGE_DB_TRANSACTION_FAILED" as const;
|
|
41
56
|
export const FORGE_DB_OUTBOX_WRITE_FAILED = "FORGE_DB_OUTBOX_WRITE_FAILED" as const;
|
|
42
57
|
export const FORGE_DB_ADAPTER_UNAVAILABLE = "FORGE_DB_ADAPTER_UNAVAILABLE" as const;
|
|
58
|
+
export const FORGE_PGLITE_STORE_ABORTED = "FORGE_PGLITE_STORE_ABORTED" as const;
|
|
59
|
+
export const FORGE_PGLITE_STORE_ACTIVE = "FORGE_PGLITE_STORE_ACTIVE" as const;
|
|
43
60
|
export const FORGE_RLS_POLICY_MISSING = "FORGE_RLS_POLICY_MISSING" as const;
|
|
44
61
|
export const FORGE_RLS_TENANT_FIELD_MISSING =
|
|
45
62
|
"FORGE_RLS_TENANT_FIELD_MISSING" as const;
|
|
@@ -92,6 +109,12 @@ export const FORGE_RELEASE_DIRTY_WORKTREE =
|
|
|
92
109
|
export const FORGE_RELEASE_GENERATED_DRIFT =
|
|
93
110
|
"FORGE_RELEASE_GENERATED_DRIFT" as const;
|
|
94
111
|
export const FORGE_RELEASE_ID_MISSING = "FORGE_RELEASE_ID_MISSING" as const;
|
|
112
|
+
export const FORGE_RELEASE_PACKAGE_PACK_FAILED =
|
|
113
|
+
"FORGE_RELEASE_PACKAGE_PACK_FAILED" as const;
|
|
114
|
+
export const FORGE_RELEASE_NPM_DIST_TAG_STALE =
|
|
115
|
+
"FORGE_RELEASE_NPM_DIST_TAG_STALE" as const;
|
|
116
|
+
export const FORGE_RELEASE_NPM_DIST_TAG_CHECK_FAILED =
|
|
117
|
+
"FORGE_RELEASE_NPM_DIST_TAG_CHECK_FAILED" as const;
|
|
95
118
|
export const FORGE_SOURCEMAP_PUBLIC_EXPOSURE =
|
|
96
119
|
"FORGE_SOURCEMAP_PUBLIC_EXPOSURE" as const;
|
|
97
120
|
export const FORGE_SOURCEMAP_UPLOAD_MISSING =
|
|
@@ -216,6 +239,8 @@ export const FORGE_TEST_DOCKER_REQUIRED = "FORGE_TEST_DOCKER_REQUIRED" as const;
|
|
|
216
239
|
export const FORGE_TEST_BROWSER_REQUIRED = "FORGE_TEST_BROWSER_REQUIRED" as const;
|
|
217
240
|
export const FORGE_VERIFY_CHANGED_INCOMPLETE =
|
|
218
241
|
"FORGE_VERIFY_CHANGED_INCOMPLETE" as const;
|
|
242
|
+
export const FORGE_VERIFY_NO_TESTS_SELECTED =
|
|
243
|
+
"FORGE_VERIFY_NO_TESTS_SELECTED" as const;
|
|
219
244
|
export const FORGE_VERIFY_SCRIPT_TIMEOUT =
|
|
220
245
|
"FORGE_VERIFY_SCRIPT_TIMEOUT" as const;
|
|
221
246
|
export const FORGE_REPAIR_SOURCE_NOT_FOUND =
|
|
@@ -399,17 +424,26 @@ export const DIAGNOSTIC_CODES = [
|
|
|
399
424
|
FORGE_RUNTIME_UNRESOLVABLE,
|
|
400
425
|
FORGE_RUNTIME_NOT_FOUND,
|
|
401
426
|
FORGE_RUNTIME_GUARD_BLOCKED,
|
|
427
|
+
FORGE_RUNTIME_EXPORT_NAME_REQUIRED,
|
|
428
|
+
FORGE_EXTERNAL_RUNTIME_NOT_FOUND,
|
|
429
|
+
FORGE_EXTERNAL_RUNTIME_UNSUPPORTED,
|
|
430
|
+
FORGE_EXTERNAL_RUNTIME_FAILED,
|
|
431
|
+
FORGE_EXTERNAL_RUNTIME_BAD_RESPONSE,
|
|
402
432
|
FORGE_DEV_SERVER_ERROR,
|
|
403
433
|
FORGE_DEV_WATCH_FAILED,
|
|
404
434
|
FORGE_DEV_INVOKE_FAILED,
|
|
405
435
|
FORGE_DEV_DOCTOR_MISSING_ARTIFACT,
|
|
436
|
+
FORGE_DEV_DB_RESET,
|
|
406
437
|
FORGE_DB_CONNECT_FAILED,
|
|
407
438
|
FORGE_DB_MIGRATION_FAILED,
|
|
408
439
|
FORGE_DB_UNSUPPORTED_FIELD_TYPE,
|
|
409
440
|
FORGE_DB_INVALID_SQL_PLAN,
|
|
441
|
+
FORGE_DB_EMPTY_TIMESTAMP_LITERAL,
|
|
410
442
|
FORGE_DB_TRANSACTION_FAILED,
|
|
411
443
|
FORGE_DB_OUTBOX_WRITE_FAILED,
|
|
412
444
|
FORGE_DB_ADAPTER_UNAVAILABLE,
|
|
445
|
+
FORGE_PGLITE_STORE_ABORTED,
|
|
446
|
+
FORGE_PGLITE_STORE_ACTIVE,
|
|
413
447
|
FORGE_RLS_POLICY_MISSING,
|
|
414
448
|
FORGE_RLS_TENANT_FIELD_MISSING,
|
|
415
449
|
FORGE_RLS_UNSUPPORTED_TENANT_TYPE,
|
|
@@ -444,6 +478,9 @@ export const DIAGNOSTIC_CODES = [
|
|
|
444
478
|
FORGE_RELEASE_DIRTY_WORKTREE,
|
|
445
479
|
FORGE_RELEASE_GENERATED_DRIFT,
|
|
446
480
|
FORGE_RELEASE_ID_MISSING,
|
|
481
|
+
FORGE_RELEASE_PACKAGE_PACK_FAILED,
|
|
482
|
+
FORGE_RELEASE_NPM_DIST_TAG_STALE,
|
|
483
|
+
FORGE_RELEASE_NPM_DIST_TAG_CHECK_FAILED,
|
|
447
484
|
FORGE_SOURCEMAP_PUBLIC_EXPOSURE,
|
|
448
485
|
FORGE_SOURCEMAP_UPLOAD_MISSING,
|
|
449
486
|
FORGE_SOURCEMAP_UPLOAD_FAILED,
|
|
@@ -521,6 +558,7 @@ export const DIAGNOSTIC_CODES = [
|
|
|
521
558
|
FORGE_TEST_DOCKER_REQUIRED,
|
|
522
559
|
FORGE_TEST_BROWSER_REQUIRED,
|
|
523
560
|
FORGE_VERIFY_CHANGED_INCOMPLETE,
|
|
561
|
+
FORGE_VERIFY_NO_TESTS_SELECTED,
|
|
524
562
|
FORGE_REPAIR_SOURCE_NOT_FOUND,
|
|
525
563
|
FORGE_REPAIR_UNKNOWN_FAILURE,
|
|
526
564
|
FORGE_REPAIR_NO_RULE_MATCHED,
|
|
@@ -47,9 +47,16 @@ function defaultGuidanceForCode(code: string): DiagnosticGuidance | null {
|
|
|
47
47
|
docs: ["src/forge/_generated/runtimeRules.md", "AGENTS.md"],
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
+
if (code === "FORGE_RUNTIME_EXPORT_NAME_REQUIRED") {
|
|
51
|
+
return {
|
|
52
|
+
fixHint: "Forge runtime entries must be named exports. Replace `export default command(...)` with `export const createThing = command(...)` so generated API, frontend bindings, and capability maps have a stable name.",
|
|
53
|
+
suggestedCommands: ["forge check --json", "forge generate"],
|
|
54
|
+
docs: ["AGENTS.md", "src/forge/_generated/runtimeRules.md"],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
50
57
|
if (code === "FORGE_SECRET_DIRECT_PROCESS_ENV") {
|
|
51
58
|
return {
|
|
52
|
-
fixHint: "Use ctx.secrets or ctx.config
|
|
59
|
+
fixHint: "Use ctx.secrets or ctx.config for Forge runtime secrets/config; public frontend bridge env may use the framework's public env surface.",
|
|
53
60
|
suggestedCommands: ["forge repair diagnose --diagnostic FORGE_SECRET_DIRECT_PROCESS_ENV --json", "forge refactor replace-process-env <ENV_NAME> --dry-run --json"],
|
|
54
61
|
docs: ["src/forge/_generated/runtimeRules.md"],
|
|
55
62
|
};
|
|
@@ -75,6 +82,20 @@ function defaultGuidanceForCode(code: string): DiagnosticGuidance | null {
|
|
|
75
82
|
docs: ["src/forge/_generated/agentContract.json"],
|
|
76
83
|
};
|
|
77
84
|
}
|
|
85
|
+
if (code === "FORGE_DB_EMPTY_TIMESTAMP_LITERAL") {
|
|
86
|
+
return {
|
|
87
|
+
fixHint: "Do not use an empty string for timestamp fields. Use a real ISO timestamp, omit an optional timestamp field, declare it as `timestamp?` / `nullable(\"timestamp\")`, or model it as text if empty string is meaningful.",
|
|
88
|
+
suggestedCommands: ["forge check --json", "forge dev --db pglite --once --json"],
|
|
89
|
+
docs: ["AGENTS.md"],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (code === "FORGE_DB_INVALID_ID_FIELD") {
|
|
93
|
+
return {
|
|
94
|
+
fixHint: "Do not declare `id: \"text\"` in defineTable. Remove the id field so Forge generates a UUID primary key, or declare `id: \"uuid\"` when you need to provide ids explicitly.",
|
|
95
|
+
suggestedCommands: ["forge check --json", "forge inspect schema --json"],
|
|
96
|
+
docs: ["AGENTS.md"],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
78
99
|
if (code.startsWith("FORGE_UI_")) {
|
|
79
100
|
return {
|
|
80
101
|
fixHint: "Inspect the last UI run and use the UI report as repair input.",
|
|
@@ -106,7 +127,12 @@ function defaultGuidanceForCode(code: string): DiagnosticGuidance | null {
|
|
|
106
127
|
if (code.startsWith("FORGE_FRONTEND_")) {
|
|
107
128
|
return {
|
|
108
129
|
fixHint: "Use the generated frontend bridge and inspect src/forge/_generated/frontendGraph.json before editing UI wiring.",
|
|
109
|
-
suggestedCommands: [
|
|
130
|
+
suggestedCommands: [
|
|
131
|
+
"forge inspect frontend --json",
|
|
132
|
+
"forge make ui --framework vite --dry-run --json",
|
|
133
|
+
"forge make ui --framework nuxt --dry-run --json",
|
|
134
|
+
"forge generate",
|
|
135
|
+
],
|
|
110
136
|
docs: ["src/forge/_generated/frontendGraph.json", "AGENTS.md"],
|
|
111
137
|
};
|
|
112
138
|
}
|
|
@@ -37,6 +37,8 @@ export {
|
|
|
37
37
|
FORGE_LIVEQUERY_UNKNOWN,
|
|
38
38
|
FORGE_LIVEQUERY_SUBSCRIPTION_FAILED,
|
|
39
39
|
FORGE_LIVEQUERY_RERUN_FAILED,
|
|
40
|
+
FORGE_RELEASE_PACKAGE_PACK_FAILED,
|
|
41
|
+
FORGE_VERIFY_NO_TESTS_SELECTED,
|
|
40
42
|
DIAGNOSTIC_CODES,
|
|
41
43
|
} from "./codes.ts";
|
|
42
44
|
export type { DiagnosticCode } from "./codes.ts";
|
|
@@ -33,6 +33,9 @@ export function buildBarrelIndexBody(exportFilePaths: string[]): string {
|
|
|
33
33
|
|
|
34
34
|
const lines = unique.map((path) => {
|
|
35
35
|
const exportPath = toBarrelExportPath(path);
|
|
36
|
+
if (exportPath === "./vue") {
|
|
37
|
+
return `export * as vue from "${exportPath}";`;
|
|
38
|
+
}
|
|
36
39
|
return `export * from "${exportPath}";`;
|
|
37
40
|
});
|
|
38
41
|
|
|
@@ -59,6 +59,7 @@ export function renderBody(file: EmitFile): string {
|
|
|
59
59
|
*/
|
|
60
60
|
export function render(file: EmitFile, context: RenderContext): string {
|
|
61
61
|
const body = renderBody(file);
|
|
62
|
+
const kind = detectArtifactKind(file.path);
|
|
62
63
|
|
|
63
64
|
if (file.contentHash !== hashStable(body)) {
|
|
64
65
|
throw new Error(
|
|
@@ -66,6 +67,14 @@ export function render(file: EmitFile, context: RenderContext): string {
|
|
|
66
67
|
);
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
if (kind === "json") {
|
|
71
|
+
return body;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (file.header === "none") {
|
|
75
|
+
return body;
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
return prependDeterministicHeader(body, {
|
|
70
79
|
generatorVersion: context.generatorVersion,
|
|
71
80
|
inputHash: context.inputHash,
|