forgeos 0.1.0-alpha.2 → 0.1.0-alpha.21
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/.npmignore +4 -0
- package/AGENTS.md +168 -81
- package/CHANGELOG.md +211 -0
- package/README.md +88 -14
- 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 +34 -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/target/classes/dev/forgeos/adapter/Auth.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Diagnostic.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Entry.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/EntryKind.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ErrorInfo.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Forge.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeCall.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeContext.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeHandler.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeHttpHandler.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeRegistry$EntryOption.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeRegistry$RegisteredEntry.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeRegistry$RegistryOption.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ForgeRegistry.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Json.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Manifest.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/RequestEnvelope.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/ResponseEnvelope.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Risk.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Schemas.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/Service.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/TransactionMode.class +0 -0
- package/adapters/java/target/classes/dev/forgeos/adapter/TypedForgeHandler.class +0 -0
- package/adapters/java/target/forge-java-adapter-0.1.0-alpha.11.jar +0 -0
- package/adapters/java/target/maven-archiver/pom.properties +3 -0
- package/adapters/java/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +23 -0
- package/adapters/java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +20 -0
- package/adapters/java-spring-boot-starter/README.md +32 -0
- package/adapters/java-spring-boot-starter/pom.xml +36 -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/adapters/java-spring-boot-starter/target/classes/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +1 -0
- package/adapters/java-spring-boot-starter/target/classes/dev/forgeos/adapter/spring/ForgeCommand.class +0 -0
- package/adapters/java-spring-boot-starter/target/classes/dev/forgeos/adapter/spring/ForgeExternalService.class +0 -0
- package/adapters/java-spring-boot-starter/target/classes/dev/forgeos/adapter/spring/ForgeQuery.class +0 -0
- package/adapters/java-spring-boot-starter/target/classes/dev/forgeos/adapter/spring/ForgeServiceBeanCondition.class +0 -0
- package/adapters/java-spring-boot-starter/target/classes/dev/forgeos/adapter/spring/ForgeSpringAutoConfiguration.class +0 -0
- package/adapters/java-spring-boot-starter/target/classes/dev/forgeos/adapter/spring/ForgeSpringRuntime.class +0 -0
- package/adapters/java-spring-boot-starter/target/forge-java-spring-boot-starter-0.1.0-alpha.11.jar +0 -0
- package/adapters/java-spring-boot-starter/target/maven-archiver/pom.properties +3 -0
- package/adapters/java-spring-boot-starter/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +6 -0
- package/adapters/java-spring-boot-starter/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +6 -0
- package/bin/forge.mjs +18 -0
- package/docs/changelog.md +242 -0
- package/docs/forge-protocol.md +189 -0
- package/examples/go-billing/go.mod +7 -0
- package/examples/go-billing/main.go +120 -0
- package/examples/java-billing/pom.xml +52 -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/examples/java-billing/target/classes/dev/forgeos/examples/billing/CreateInvoiceInput.class +0 -0
- package/examples/java-billing/target/classes/dev/forgeos/examples/billing/Invoice.class +0 -0
- package/examples/java-billing/target/classes/dev/forgeos/examples/billing/Main$EmptyInput.class +0 -0
- package/examples/java-billing/target/classes/dev/forgeos/examples/billing/Main$Options.class +0 -0
- package/examples/java-billing/target/classes/dev/forgeos/examples/billing/Main.class +0 -0
- package/examples/java-billing/target/java-billing-0.1.0-alpha.11-all.jar +0 -0
- package/examples/java-billing/target/java-billing-0.1.0-alpha.11.jar +0 -0
- package/examples/java-billing/target/maven-archiver/pom.properties +3 -0
- package/examples/java-billing/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +5 -0
- package/examples/java-billing/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +3 -0
- package/package.json +29 -7
- package/schemas/forge-manifest.schema.json +57 -0
- package/src/forge/_generated/releaseManifest.json +1 -2
- package/src/forge/_generated/releaseManifest.ts +3 -3
- package/src/forge/agent-adapters/index.ts +1511 -123
- package/src/forge/agent-adapters/types.ts +216 -1
- package/src/forge/agent-memory/bridge.ts +1245 -0
- package/src/forge/agent-memory/context-pack.ts +151 -0
- package/src/forge/agent-memory/hook-runner.ts +312 -0
- package/src/forge/agent-memory/mcp.ts +224 -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 +273 -0
- package/src/forge/agent-memory/sources/codex.ts +119 -0
- package/src/forge/agent-memory/sources/cursor.ts +35 -0
- package/src/forge/agent-memory/types.ts +191 -0
- package/src/forge/bench.ts +248 -0
- package/src/forge/brownfield-import/index.ts +801 -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 +106 -0
- package/src/forge/cair/query.ts +478 -0
- package/src/forge/cair/snapshot.ts +315 -0
- package/src/forge/cair/types.ts +248 -0
- package/src/forge/cli/ai.ts +671 -3
- package/src/forge/cli/auth.ts +36 -1
- package/src/forge/cli/build.ts +20 -4
- package/src/forge/cli/changed.ts +300 -0
- package/src/forge/cli/codex-app-server.ts +877 -0
- package/src/forge/cli/commands.ts +1285 -7
- package/src/forge/cli/db.ts +121 -2
- package/src/forge/cli/deps.ts +79 -12
- package/src/forge/cli/dev.ts +502 -38
- package/src/forge/cli/docs.ts +265 -0
- package/src/forge/cli/handoff.ts +250 -0
- package/src/forge/cli/index.ts +1 -0
- package/src/forge/cli/main.ts +49 -3
- package/src/forge/cli/new.ts +3 -1
- package/src/forge/cli/next-actions.ts +23 -0
- package/src/forge/cli/output.ts +290 -1
- package/src/forge/cli/parse.ts +770 -36
- package/src/forge/cli/query.ts +32 -0
- package/src/forge/cli/release.ts +35 -11
- package/src/forge/cli/rls.ts +568 -17
- package/src/forge/cli/run.ts +41 -0
- package/src/forge/cli/secrets.ts +46 -1
- package/src/forge/cli/security.ts +381 -0
- package/src/forge/cli/self-host.ts +56 -14
- package/src/forge/cli/studio.ts +2163 -0
- package/src/forge/cli/verify.ts +1422 -32
- package/src/forge/compiler/agent-contract/build.ts +725 -41
- package/src/forge/compiler/agent-contract/types.ts +85 -0
- package/src/forge/compiler/ai-registry/build.ts +62 -1
- package/src/forge/compiler/ai-registry/constants.ts +1 -1
- package/src/forge/compiler/ai-registry/parse.ts +168 -5
- package/src/forge/compiler/api-surface/build.ts +47 -0
- package/src/forge/compiler/app-graph/build.ts +68 -8
- package/src/forge/compiler/app-graph/extract.ts +107 -0
- package/src/forge/compiler/app-graph/forge-apis.ts +1 -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/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 +188 -13
- package/src/forge/compiler/data-graph/parse.ts +3 -3
- package/src/forge/compiler/data-graph/sql/ddl.ts +60 -2
- 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/dev-manifest/build.ts +3 -0
- package/src/forge/compiler/diagnostics/codes.ts +35 -0
- package/src/forge/compiler/diagnostics/create.ts +8 -3
- 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 +5 -0
- package/src/forge/compiler/external-manifest/registry.ts +205 -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 +85 -13
- package/src/forge/compiler/integration/add.ts +498 -22
- package/src/forge/compiler/integration/snapshot.ts +2 -0
- package/src/forge/compiler/make-registry/build.ts +19 -7
- package/src/forge/compiler/orchestrator/plan-profile.ts +23 -0
- package/src/forge/compiler/orchestrator/plan.ts +78 -7
- package/src/forge/compiler/orchestrator/profile.ts +65 -0
- package/src/forge/compiler/orchestrator/run.ts +97 -31
- package/src/forge/compiler/orchestrator/serialize.ts +101 -8
- package/src/forge/compiler/package-graph/compiler.ts +13 -3
- 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/policy-registry/build.ts +44 -1
- package/src/forge/compiler/test-graph/build.ts +11 -3
- package/src/forge/compiler/types/ai-registry.ts +25 -1
- package/src/forge/compiler/types/app-graph.ts +9 -2
- package/src/forge/compiler/types/cli.ts +76 -1
- package/src/forge/compiler/types/dev-manifest.ts +3 -0
- package/src/forge/compiler/types/frontend-graph.ts +2 -2
- package/src/forge/delta/classifier.ts +52 -0
- package/src/forge/delta/explain.ts +126 -0
- package/src/forge/delta/git-observer.ts +43 -0
- package/src/forge/delta/ids.ts +44 -0
- package/src/forge/delta/index.ts +13 -0
- package/src/forge/delta/recorder.ts +402 -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 +489 -0
- package/src/forge/delta/store.ts +2975 -0
- package/src/forge/delta/timeline.ts +104 -0
- package/src/forge/dev/server.ts +768 -15
- package/src/forge/dev/types.ts +15 -1
- package/src/forge/dev/watch.ts +17 -7
- package/src/forge/dev-console/cycle.ts +233 -21
- package/src/forge/dev-console/types.ts +46 -1
- package/src/forge/impact/index.ts +46 -8
- package/src/forge/impact/types.ts +6 -0
- package/src/forge/intent/index.ts +35 -16
- package/src/forge/make/index.ts +149 -6
- package/src/forge/make/templates.ts +343 -2
- package/src/forge/make/types.ts +3 -1
- package/src/forge/refactor/index.ts +1 -0
- package/src/forge/repair/rules/index.ts +2 -2
- package/src/forge/review/index.ts +158 -12
- package/src/forge/review/types.ts +15 -0
- package/src/forge/runtime/ai/context.ts +210 -5
- package/src/forge/runtime/ai/types.ts +70 -0
- package/src/forge/runtime/auth/claims.ts +32 -0
- package/src/forge/runtime/auth/errors.ts +2 -0
- package/src/forge/runtime/context/create-context.ts +30 -6
- package/src/forge/runtime/db/generated-client.ts +13 -2
- package/src/forge/runtime/db/memory-adapter.ts +2 -2
- package/src/forge/runtime/db/pglite-adapter.ts +77 -2
- package/src/forge/runtime/db/postgres-adapter.ts +6 -3
- package/src/forge/runtime/executor.ts +112 -2
- package/src/forge/runtime/external/bridge.ts +649 -0
- package/src/forge/runtime/runner/run-entry.ts +16 -7
- package/src/forge/runtime/telemetry/scrubber.ts +91 -10
- package/src/forge/runtime/webhooks/security.ts +184 -0
- package/src/forge/server.ts +100 -2
- package/src/forge/version.ts +1 -1
- package/src/forge/vue/index.ts +407 -0
- package/src/forge/workspace/change-summary.ts +209 -0
- package/src/forge/workspace/forge-cli.ts +14 -0
- package/src/forge/workspace/git-summary.ts +279 -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 +33 -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 +12 -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 +13 -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/b2b-support-web/package.json +2 -0
- package/templates/b2b-support-web/tsconfig.json +4 -1
- package/templates/b2b-support-web/web/package.json +1 -1
- package/templates/minimal-web/package.json +2 -1
- package/templates/minimal-web/tsconfig.json +3 -1
- package/templates/minimal-web/web/package.json +2 -2
- 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 -7696
- package/src/forge/_generated/agentQuickstart.md +0 -32
- package/src/forge/_generated/aiContext.ts +0 -59
- package/src/forge/_generated/aiModels.json +0 -2
- package/src/forge/_generated/aiModels.ts +0 -35
- 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 -29
- 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 -14667
- package/src/forge/_generated/appMap.md +0 -35
- 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 -47
- 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 -67
- 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 -163
- package/src/forge/_generated/makeTemplates.json +0 -2
- package/src/forge/_generated/makeTemplates.ts +0 -61
- package/src/forge/_generated/mockMap.json +0 -2
- package/src/forge/_generated/mockMap.ts +0 -7
- package/src/forge/_generated/operationPlaybooks.md +0 -147
- package/src/forge/_generated/packageGraph.json +0 -2
- package/src/forge/_generated/packageGraph.ts +0 -245249
- 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 -327385
- package/src/forge/_generated/runtimeRegistry.ts +0 -2
- package/src/forge/_generated/runtimeRules.md +0 -79
- 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 -3108
- 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
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { createDiagnostic } from "../compiler/diagnostics/create.ts";
|
|
4
|
+
import { GENERATED_DIR } from "../compiler/emitter/constants.ts";
|
|
5
|
+
import { nodeFileSystem } from "../compiler/fs/index.ts";
|
|
6
|
+
import { stripDeterministicHeader } from "../compiler/primitives/header.ts";
|
|
7
|
+
import {
|
|
8
|
+
stableSortByPath,
|
|
9
|
+
stableSortPackages,
|
|
10
|
+
stableSortSymbols,
|
|
11
|
+
} from "../compiler/primitives/sort.ts";
|
|
12
|
+
import type { ForgeSymbol, AppGraph, ModuleNode } from "../compiler/types/app-graph.ts";
|
|
13
|
+
import type { Diagnostic } from "../compiler/types/diagnostic.ts";
|
|
14
|
+
import type { PackageApi, PackageGraph } from "../compiler/types/package-graph.ts";
|
|
15
|
+
import type { TestGraph, TestGraphEntry } from "../compiler/types/test-graph.ts";
|
|
16
|
+
import {
|
|
17
|
+
CAIR_SCHEMA_VERSION,
|
|
18
|
+
type CairApiRef,
|
|
19
|
+
type CairLexicon,
|
|
20
|
+
type CairModuleRef,
|
|
21
|
+
type CairPackageRef,
|
|
22
|
+
type CairProjectRef,
|
|
23
|
+
type CairRuleRef,
|
|
24
|
+
type CairSnapshot,
|
|
25
|
+
type CairSnapshotLimits,
|
|
26
|
+
type CairSymbolRef,
|
|
27
|
+
type CairTestRef,
|
|
28
|
+
} from "./types.ts";
|
|
29
|
+
|
|
30
|
+
const DEFAULT_LIMITS: CairSnapshotLimits = {
|
|
31
|
+
modules: 80,
|
|
32
|
+
symbols: 120,
|
|
33
|
+
packages: 60,
|
|
34
|
+
apis: 120,
|
|
35
|
+
tests: 80,
|
|
36
|
+
};
|
|
37
|
+
const LOCAL_IMPORT_PREVIEW_LIMIT = 8;
|
|
38
|
+
|
|
39
|
+
function readJson<T>(
|
|
40
|
+
workspaceRoot: string,
|
|
41
|
+
relativePath: string,
|
|
42
|
+
diagnostics: Diagnostic[],
|
|
43
|
+
): T | null {
|
|
44
|
+
const absolute = join(workspaceRoot, relativePath);
|
|
45
|
+
const raw = nodeFileSystem.readText(absolute);
|
|
46
|
+
if (raw === null) {
|
|
47
|
+
diagnostics.push(createDiagnostic({
|
|
48
|
+
severity: "warning",
|
|
49
|
+
code: "FORGE_CAIR_MISSING_ARTIFACT",
|
|
50
|
+
message: `missing generated artifact: ${relativePath}`,
|
|
51
|
+
file: relativePath,
|
|
52
|
+
suggestedCommands: ["forge generate"],
|
|
53
|
+
}));
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(stripDeterministicHeader(raw)) as T;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
diagnostics.push(createDiagnostic({
|
|
61
|
+
severity: "error",
|
|
62
|
+
code: "FORGE_CAIR_INVALID_ARTIFACT",
|
|
63
|
+
message: `could not parse ${relativePath}: ${error instanceof Error ? error.message : String(error)}`,
|
|
64
|
+
file: relativePath,
|
|
65
|
+
}));
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readPackageProject(workspaceRoot: string): CairProjectRef {
|
|
71
|
+
const raw = nodeFileSystem.readText(join(workspaceRoot, "package.json"));
|
|
72
|
+
if (raw === null) {
|
|
73
|
+
return { name: "unknown", version: "unknown", type: "unknown" };
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const pkg = JSON.parse(raw) as { name?: unknown; version?: unknown; forge?: unknown };
|
|
77
|
+
return {
|
|
78
|
+
name: typeof pkg.name === "string" ? pkg.name : "unknown",
|
|
79
|
+
version: typeof pkg.version === "string" ? pkg.version : "unknown",
|
|
80
|
+
type: pkg.forge && typeof pkg.forge === "object" ? "forge" : "package",
|
|
81
|
+
};
|
|
82
|
+
} catch {
|
|
83
|
+
return { name: "unknown", version: "unknown", type: "unknown" };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function runtimeSummary(pkg: PackageApi): string | null {
|
|
88
|
+
const compatibility = pkg.runtimeCompatibility;
|
|
89
|
+
if (!compatibility) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return [
|
|
93
|
+
`node:${compatibility.node}`,
|
|
94
|
+
`bun:${compatibility.bun}`,
|
|
95
|
+
`browser:${compatibility.browser}`,
|
|
96
|
+
`edge:${compatibility.edge}`,
|
|
97
|
+
].join(",");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function moduleContexts(node: ModuleNode): string[] {
|
|
101
|
+
return [...new Set([...node.declaredContexts, ...node.effectiveContexts].map(String))].sort();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function packageImportNames(node: ModuleNode): string[] {
|
|
105
|
+
return [...new Set(node.directPackageImports.map((item) => item.packageName))].sort();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function buildModules(appGraph: AppGraph | null): CairModuleRef[] {
|
|
109
|
+
const nodes = [...(appGraph?.moduleGraph.nodes ?? [])].sort((left, right) =>
|
|
110
|
+
left.file.localeCompare(right.file),
|
|
111
|
+
);
|
|
112
|
+
return nodes.map((node, index) => ({
|
|
113
|
+
id: `M#${index + 1}`,
|
|
114
|
+
file: node.file,
|
|
115
|
+
packageImports: packageImportNames(node),
|
|
116
|
+
localImportCount: node.localImports.length,
|
|
117
|
+
localImports: node.localImports
|
|
118
|
+
.map((item) => item.toModuleId)
|
|
119
|
+
.sort()
|
|
120
|
+
.slice(0, LOCAL_IMPORT_PREVIEW_LIMIT),
|
|
121
|
+
contexts: moduleContexts(node),
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function moduleIdByFile(modules: CairModuleRef[]): Map<string, string> {
|
|
126
|
+
return new Map(modules.map((module) => [module.file, module.id]));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function buildSymbols(appGraph: AppGraph | null, modules: CairModuleRef[]): CairSymbolRef[] {
|
|
130
|
+
const moduleIds = moduleIdByFile(modules);
|
|
131
|
+
return stableSortSymbols(appGraph?.symbols ?? []).map((symbol: ForgeSymbol, index) => ({
|
|
132
|
+
id: `S#${index + 1}`,
|
|
133
|
+
sourceId: symbol.id,
|
|
134
|
+
kind: symbol.kind,
|
|
135
|
+
name: symbol.name,
|
|
136
|
+
qualifiedName: symbol.qualifiedName,
|
|
137
|
+
moduleId: moduleIds.get(symbol.file) ?? null,
|
|
138
|
+
file: symbol.file,
|
|
139
|
+
span: symbol.span,
|
|
140
|
+
hash: symbol.contentHash,
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function countPackageExports(pkg: PackageApi): number {
|
|
145
|
+
return pkg.entrypoints.reduce((count, entrypoint) => count + entrypoint.exports.length, 0);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function buildPackages(packageGraph: PackageGraph | null): CairPackageRef[] {
|
|
149
|
+
return stableSortPackages(packageGraph?.packages ?? []).map((pkg, index) => ({
|
|
150
|
+
id: `P#${index + 1}`,
|
|
151
|
+
name: pkg.name,
|
|
152
|
+
version: pkg.version,
|
|
153
|
+
entrypoints: pkg.entrypoints.length,
|
|
154
|
+
exports: countPackageExports(pkg),
|
|
155
|
+
runtime: runtimeSummary(pkg),
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function buildApis(packageGraph: PackageGraph | null, packages: CairPackageRef[]): CairApiRef[] {
|
|
160
|
+
const packageIds = new Map(packages.map((pkg) => [pkg.name, pkg.id]));
|
|
161
|
+
const refs: Array<Omit<CairApiRef, "id">> = [];
|
|
162
|
+
for (const pkg of stableSortPackages(packageGraph?.packages ?? [])) {
|
|
163
|
+
for (const entrypoint of [...pkg.entrypoints].sort((left, right) => left.subpath.localeCompare(right.subpath))) {
|
|
164
|
+
for (const signature of [...entrypoint.exports].sort((left, right) => left.name.localeCompare(right.name))) {
|
|
165
|
+
refs.push({
|
|
166
|
+
packageId: packageIds.get(pkg.name) ?? "P#?",
|
|
167
|
+
packageName: pkg.name,
|
|
168
|
+
entrypoint: entrypoint.subpath,
|
|
169
|
+
name: signature.name,
|
|
170
|
+
kind: signature.kind,
|
|
171
|
+
signature: signature.signature,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return refs.map((api, index) => ({ id: `API#${index + 1}`, ...api }));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function buildTests(testGraph: TestGraph | null): CairTestRef[] {
|
|
180
|
+
const tests = [...(testGraph?.tests ?? [])].sort((left: TestGraphEntry, right: TestGraphEntry) =>
|
|
181
|
+
left.file.localeCompare(right.file),
|
|
182
|
+
);
|
|
183
|
+
return tests.map((test, index) => ({
|
|
184
|
+
id: `T#${index + 1}`,
|
|
185
|
+
file: test.file,
|
|
186
|
+
kind: test.kind,
|
|
187
|
+
cost: test.cost,
|
|
188
|
+
confidence: test.confidence,
|
|
189
|
+
covers: {
|
|
190
|
+
commands: stableSortByPath(test.covers.commands),
|
|
191
|
+
queries: stableSortByPath(test.covers.queries),
|
|
192
|
+
liveQueries: stableSortByPath(test.covers.liveQueries),
|
|
193
|
+
actions: stableSortByPath(test.covers.actions),
|
|
194
|
+
workflows: stableSortByPath(test.covers.workflows),
|
|
195
|
+
tables: stableSortByPath(test.covers.tables),
|
|
196
|
+
policies: stableSortByPath(test.covers.policies),
|
|
197
|
+
components: stableSortByPath(test.covers.components),
|
|
198
|
+
packages: stableSortByPath(test.covers.packages),
|
|
199
|
+
},
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function defaultRules(): CairRuleRef[] {
|
|
204
|
+
return [
|
|
205
|
+
{
|
|
206
|
+
id: "R#1",
|
|
207
|
+
name: "generated.no_edit",
|
|
208
|
+
description: `Do not hand-edit ${GENERATED_DIR}; change source files and regenerate.`,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: "R#2",
|
|
212
|
+
name: "query.before_full_read",
|
|
213
|
+
description: "Use CAIR queries before reading whole files when symbol or package context is enough.",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "R#3",
|
|
217
|
+
name: "package_api.no_guess",
|
|
218
|
+
description: "Use Q DEP.API before assuming npm package exports or signatures.",
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
id: "R#4",
|
|
222
|
+
name: "action.dry_run_first",
|
|
223
|
+
description: "Use forge cair action --plan before applying CREATE, PATCH, import, export, semantic, or verify actions.",
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function cap<T>(items: T[], limit: number): T[] {
|
|
229
|
+
return items.slice(0, limit);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function hashSnapshotSeed(value: unknown): string {
|
|
233
|
+
return createHash("sha256").update(JSON.stringify(value)).digest("hex").slice(0, 16);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function buildCairSnapshot(
|
|
237
|
+
workspaceRoot: string,
|
|
238
|
+
limits: CairSnapshotLimits = DEFAULT_LIMITS,
|
|
239
|
+
): CairSnapshot {
|
|
240
|
+
const diagnostics: Diagnostic[] = [];
|
|
241
|
+
const appGraph = readJson<AppGraph>(workspaceRoot, `${GENERATED_DIR}/appGraph.json`, diagnostics);
|
|
242
|
+
const packageGraph = readJson<PackageGraph>(workspaceRoot, `${GENERATED_DIR}/packageGraph.json`, diagnostics);
|
|
243
|
+
const testGraph = readJson<TestGraph>(workspaceRoot, `${GENERATED_DIR}/testGraph.json`, diagnostics);
|
|
244
|
+
const modules = buildModules(appGraph);
|
|
245
|
+
const symbols = buildSymbols(appGraph, modules);
|
|
246
|
+
const packages = buildPackages(packageGraph);
|
|
247
|
+
const apis = buildApis(packageGraph, packages);
|
|
248
|
+
const tests = buildTests(testGraph);
|
|
249
|
+
const snapshotId = hashSnapshotSeed({
|
|
250
|
+
project: readPackageProject(workspaceRoot),
|
|
251
|
+
app: {
|
|
252
|
+
inputHash: appGraph?.inputHash,
|
|
253
|
+
symbols: appGraph?.symbols.map((symbol) => [symbol.id, symbol.file, symbol.contentHash]),
|
|
254
|
+
modules: appGraph?.moduleGraph.nodes.map((module) => module.file),
|
|
255
|
+
edges: appGraph?.edges.length ?? 0,
|
|
256
|
+
},
|
|
257
|
+
packages: packageGraph?.packages.map((pkg) => [pkg.name, pkg.version, pkg.contentChecksum]),
|
|
258
|
+
tests: testGraph?.inputHash,
|
|
259
|
+
});
|
|
260
|
+
const lexicon: CairLexicon = {
|
|
261
|
+
modules: cap(modules, limits.modules),
|
|
262
|
+
symbols: cap(symbols, limits.symbols),
|
|
263
|
+
packages: cap(packages, limits.packages),
|
|
264
|
+
apis: cap(apis, limits.apis),
|
|
265
|
+
tests: cap(tests, limits.tests),
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
schemaVersion: CAIR_SCHEMA_VERSION,
|
|
270
|
+
kind: "cair.snapshot",
|
|
271
|
+
snapshotId,
|
|
272
|
+
project: readPackageProject(workspaceRoot),
|
|
273
|
+
summary: {
|
|
274
|
+
modules: modules.length,
|
|
275
|
+
symbols: symbols.length,
|
|
276
|
+
edges: appGraph?.edges.length ?? 0,
|
|
277
|
+
packages: packages.length,
|
|
278
|
+
apis: apis.length,
|
|
279
|
+
tests: tests.length,
|
|
280
|
+
diagnostics: diagnostics.length +
|
|
281
|
+
(appGraph?.diagnostics?.length ?? 0) +
|
|
282
|
+
(testGraph?.diagnostics?.length ?? 0),
|
|
283
|
+
},
|
|
284
|
+
limits,
|
|
285
|
+
truncated: {
|
|
286
|
+
modules: Math.max(0, modules.length - limits.modules),
|
|
287
|
+
symbols: Math.max(0, symbols.length - limits.symbols),
|
|
288
|
+
packages: Math.max(0, packages.length - limits.packages),
|
|
289
|
+
apis: Math.max(0, apis.length - limits.apis),
|
|
290
|
+
tests: Math.max(0, tests.length - limits.tests),
|
|
291
|
+
},
|
|
292
|
+
rules: defaultRules(),
|
|
293
|
+
lexicon,
|
|
294
|
+
diagnostics: [
|
|
295
|
+
...diagnostics,
|
|
296
|
+
...(appGraph?.diagnostics ?? []),
|
|
297
|
+
...(testGraph?.diagnostics ?? []),
|
|
298
|
+
],
|
|
299
|
+
nextActions: [
|
|
300
|
+
"forge cair query \"Q STATUS\"",
|
|
301
|
+
"forge cair query \"Q S name=<symbol>\"",
|
|
302
|
+
"forge cair query \"Q REFS S#1\"",
|
|
303
|
+
"forge cair query \"Q IMPACT S#1\"",
|
|
304
|
+
"forge cair query \"Q CHANGED\"",
|
|
305
|
+
...(symbols.length > 0 ? ["forge cair query \"Q SYMBOL S#1\""] : []),
|
|
306
|
+
"forge cair query \"Q DEP.API package=<name> symbol=<export>\"",
|
|
307
|
+
"forge cair action --dry-run \"A CREATE.SYMBOL path=src/example.ts kind=function name=example export=true createFile=true\"",
|
|
308
|
+
"forge cair action --plan \"A RENAME.SYMBOL target=S#1 newName=<name> expect.file=<path> expect.kind=<kind> expect.hash=<hash>\"",
|
|
309
|
+
"forge cair action \"A APPLY plan=<P#|.forge/cair/plans/...json>\"",
|
|
310
|
+
"forge cair action --plan \"A MAKE.TABLE name=<name> fields=<fields>\"",
|
|
311
|
+
"forge cair action --plan \"A ADD.TEST target=S#1 kind=unit\"",
|
|
312
|
+
"forge cair action --plan \"A WIRE.EXPORT target=S#1 file=src/index.ts\"",
|
|
313
|
+
],
|
|
314
|
+
};
|
|
315
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import type { Diagnostic } from "../compiler/types/diagnostic.ts";
|
|
2
|
+
import type { ForgeKind } from "../compiler/types/app-graph.ts";
|
|
3
|
+
import type { TestConfidence, TestCost, TestKind } from "../compiler/types/test-graph.ts";
|
|
4
|
+
import type { CategorizedFileSummary } from "../workspace/change-summary.ts";
|
|
5
|
+
|
|
6
|
+
export const CAIR_SCHEMA_VERSION = "0.5.0";
|
|
7
|
+
|
|
8
|
+
export type CairSubcommand = "snapshot" | "query" | "action";
|
|
9
|
+
export type CairOutputFormat = "text" | "json";
|
|
10
|
+
|
|
11
|
+
export interface CairCommandOptions {
|
|
12
|
+
subcommand: CairSubcommand;
|
|
13
|
+
workspaceRoot: string;
|
|
14
|
+
json: boolean;
|
|
15
|
+
format: CairOutputFormat;
|
|
16
|
+
query?: string;
|
|
17
|
+
action?: string;
|
|
18
|
+
inputPath?: string;
|
|
19
|
+
dryRun?: boolean;
|
|
20
|
+
plan?: boolean;
|
|
21
|
+
allowGenerated?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface CairProjectRef {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CairModuleRef {
|
|
31
|
+
id: string;
|
|
32
|
+
file: string;
|
|
33
|
+
packageImports: string[];
|
|
34
|
+
localImportCount: number;
|
|
35
|
+
localImports: string[];
|
|
36
|
+
contexts: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface CairSymbolRef {
|
|
40
|
+
id: string;
|
|
41
|
+
sourceId: string;
|
|
42
|
+
kind: ForgeKind;
|
|
43
|
+
name: string;
|
|
44
|
+
qualifiedName: string;
|
|
45
|
+
moduleId: string | null;
|
|
46
|
+
file: string;
|
|
47
|
+
span: { start: number; end: number };
|
|
48
|
+
hash: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CairPackageRef {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
version: string;
|
|
55
|
+
entrypoints: number;
|
|
56
|
+
exports: number;
|
|
57
|
+
runtime: string | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface CairApiRef {
|
|
61
|
+
id: string;
|
|
62
|
+
packageId: string;
|
|
63
|
+
packageName: string;
|
|
64
|
+
entrypoint: string;
|
|
65
|
+
name: string;
|
|
66
|
+
kind: string;
|
|
67
|
+
signature: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface CairTestRef {
|
|
71
|
+
id: string;
|
|
72
|
+
file: string;
|
|
73
|
+
kind: TestKind;
|
|
74
|
+
cost: TestCost;
|
|
75
|
+
confidence: TestConfidence;
|
|
76
|
+
covers: {
|
|
77
|
+
commands: string[];
|
|
78
|
+
queries: string[];
|
|
79
|
+
liveQueries: string[];
|
|
80
|
+
actions: string[];
|
|
81
|
+
workflows: string[];
|
|
82
|
+
tables: string[];
|
|
83
|
+
policies: string[];
|
|
84
|
+
components: string[];
|
|
85
|
+
packages: string[];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface CairRuleRef {
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface CairLexicon {
|
|
96
|
+
modules: CairModuleRef[];
|
|
97
|
+
symbols: CairSymbolRef[];
|
|
98
|
+
packages: CairPackageRef[];
|
|
99
|
+
apis: CairApiRef[];
|
|
100
|
+
tests: CairTestRef[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface CairSnapshotLimits {
|
|
104
|
+
modules: number;
|
|
105
|
+
symbols: number;
|
|
106
|
+
packages: number;
|
|
107
|
+
apis: number;
|
|
108
|
+
tests: number;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface CairSnapshot {
|
|
112
|
+
schemaVersion: typeof CAIR_SCHEMA_VERSION;
|
|
113
|
+
kind: "cair.snapshot";
|
|
114
|
+
snapshotId: string;
|
|
115
|
+
project: CairProjectRef;
|
|
116
|
+
summary: {
|
|
117
|
+
modules: number;
|
|
118
|
+
symbols: number;
|
|
119
|
+
edges: number;
|
|
120
|
+
packages: number;
|
|
121
|
+
apis: number;
|
|
122
|
+
tests: number;
|
|
123
|
+
diagnostics: number;
|
|
124
|
+
};
|
|
125
|
+
limits: CairSnapshotLimits;
|
|
126
|
+
truncated: {
|
|
127
|
+
modules: number;
|
|
128
|
+
symbols: number;
|
|
129
|
+
packages: number;
|
|
130
|
+
apis: number;
|
|
131
|
+
tests: number;
|
|
132
|
+
};
|
|
133
|
+
rules: CairRuleRef[];
|
|
134
|
+
lexicon: CairLexicon;
|
|
135
|
+
diagnostics: Diagnostic[];
|
|
136
|
+
nextActions: string[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface CairObservation {
|
|
140
|
+
code: string;
|
|
141
|
+
text: string;
|
|
142
|
+
data?: Record<string, unknown>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface CairQueryResult {
|
|
146
|
+
ok: boolean;
|
|
147
|
+
query: string;
|
|
148
|
+
observations: CairObservation[];
|
|
149
|
+
diagnostics: Diagnostic[];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type CairActionVerb =
|
|
153
|
+
| "CREATE.FILE"
|
|
154
|
+
| "CREATE.SYMBOL"
|
|
155
|
+
| "PATCH"
|
|
156
|
+
| "ADD.EXPORT"
|
|
157
|
+
| "ADD.IMPORT"
|
|
158
|
+
| "APPLY"
|
|
159
|
+
| "ROLLBACK"
|
|
160
|
+
| "RENAME.SYMBOL"
|
|
161
|
+
| "MOVE.SYMBOL"
|
|
162
|
+
| "UPDATE.SIGNATURE"
|
|
163
|
+
| "ADD.PARAM"
|
|
164
|
+
| "UPDATE.CALLSITES"
|
|
165
|
+
| "ORGANIZE.IMPORTS"
|
|
166
|
+
| "FORMAT"
|
|
167
|
+
| "FIND.PATTERN"
|
|
168
|
+
| "REWRITE.PATTERN"
|
|
169
|
+
| "MAKE.COMMAND"
|
|
170
|
+
| "MAKE.QUERY"
|
|
171
|
+
| "MAKE.ACTION"
|
|
172
|
+
| "MAKE.TABLE"
|
|
173
|
+
| "ADD.TEST"
|
|
174
|
+
| "WIRE.EXPORT"
|
|
175
|
+
| "VERIFY";
|
|
176
|
+
|
|
177
|
+
export interface CairActionScriptHeader {
|
|
178
|
+
schemaVersion?: string;
|
|
179
|
+
snapshot?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface CairParsedAction {
|
|
183
|
+
raw: string;
|
|
184
|
+
phase: "A" | "V";
|
|
185
|
+
verb: CairActionVerb;
|
|
186
|
+
args: Record<string, string>;
|
|
187
|
+
body?: string;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface CairFileChange {
|
|
191
|
+
path: string;
|
|
192
|
+
operation: "create" | "patch" | "append" | "insert" | "noop";
|
|
193
|
+
beforeHash?: string;
|
|
194
|
+
afterHash?: string;
|
|
195
|
+
bytesBefore?: number;
|
|
196
|
+
bytesAfter?: number;
|
|
197
|
+
beforeContent?: string;
|
|
198
|
+
afterContent?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface CairActionStepResult {
|
|
202
|
+
ok: boolean;
|
|
203
|
+
action: CairParsedAction;
|
|
204
|
+
dryRun: boolean;
|
|
205
|
+
applied: boolean;
|
|
206
|
+
observations: CairObservation[];
|
|
207
|
+
diagnostics: Diagnostic[];
|
|
208
|
+
changes: CairFileChange[];
|
|
209
|
+
journalPath?: string;
|
|
210
|
+
planPath?: string;
|
|
211
|
+
planId?: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface CairActionResult {
|
|
215
|
+
ok: boolean;
|
|
216
|
+
dryRun: boolean;
|
|
217
|
+
plan: boolean;
|
|
218
|
+
header?: CairActionScriptHeader;
|
|
219
|
+
actionCount: number;
|
|
220
|
+
steps: CairActionStepResult[];
|
|
221
|
+
observations: CairObservation[];
|
|
222
|
+
diagnostics: Diagnostic[];
|
|
223
|
+
journalPaths: string[];
|
|
224
|
+
planPaths: string[];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface CairChangedObservation {
|
|
228
|
+
available: boolean;
|
|
229
|
+
branch?: string;
|
|
230
|
+
commit?: string;
|
|
231
|
+
changed: CategorizedFileSummary;
|
|
232
|
+
staged: CategorizedFileSummary;
|
|
233
|
+
unstaged: CategorizedFileSummary;
|
|
234
|
+
untracked: CategorizedFileSummary;
|
|
235
|
+
error?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface CairCommandResult {
|
|
239
|
+
ok: boolean;
|
|
240
|
+
subcommand: CairSubcommand;
|
|
241
|
+
snapshot: CairSnapshot;
|
|
242
|
+
query?: CairQueryResult;
|
|
243
|
+
action?: CairActionResult;
|
|
244
|
+
observations: CairObservation[];
|
|
245
|
+
diagnostics: Diagnostic[];
|
|
246
|
+
nextActions: string[];
|
|
247
|
+
exitCode: 0 | 1;
|
|
248
|
+
}
|