@stackonward/cli 0.0.1 → 1.0.0
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/dist/index.js +4588 -205
- package/dist/index.js.map +1 -1
- package/dist/resources/apple/.claude/docs/architecture-template.md +54 -0
- package/dist/resources/apple/.claude/docs/architecture.md +52 -0
- package/dist/resources/apple/.claude/docs/index.md +13 -0
- package/dist/resources/apple/.claude/docs/security-lifecycle.md +57 -0
- package/dist/resources/apple/.claude/docs/stack.md +93 -0
- package/dist/resources/apple/.claude/docs/verification.md +63 -0
- package/dist/resources/apple/AGENTS.md +397 -0
- package/dist/resources/apple/CLAUDE.md +397 -0
- package/dist/resources/apple/Gemfile +2 -0
- package/dist/resources/apple/Gemfile.lock +365 -0
- package/dist/resources/apple/_gitignore +14 -0
- package/dist/resources/apple/fastlane/Fastfile +123 -0
- package/dist/resources/components/nuxt/site-source/app/app.vue +42 -0
- package/dist/resources/components/nuxt/site-source/app/assets/css/site-shell.css +1035 -0
- package/dist/resources/components/nuxt/site-source/app/assets/icons/brand/.gitkeep +0 -0
- package/dist/resources/components/nuxt/site-source/app/assets/icons/common/.gitkeep +0 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationHeader.vue +35 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationShell.vue +56 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ApplicationSidebar.vue +40 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/BackToTop.vue +42 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ContentArticlePage.vue +40 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ContentListPage.vue +30 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/CookieConsent.vue +18 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingFooter.vue +52 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingHeader.vue +106 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/MarketingShell.vue +35 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/SiteBrand.vue +10 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/StaticPage.vue +21 -0
- package/dist/resources/components/nuxt/site-source/app/components/site/ToastViewport.vue +25 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseButton.vue +86 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseGradientBorder.vue +59 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseModal.vue +131 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BasePopover.vue +150 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/BaseText.vue +138 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/CheckoutStatus.vue +112 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/CheckoutSummary.vue +172 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/GoogleSignInButton.vue +113 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/InfiniteScroll.vue +123 -0
- package/dist/resources/components/nuxt/site-source/app/components/ui/YoutubeEmbed.vue +126 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useAnalytics.ts +24 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useCheckout.ts +121 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useConsent.ts +31 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useGoogleIdentity.ts +163 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useNavigation.ts +11 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useSeo.ts +33 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useSiteShell.ts +58 -0
- package/dist/resources/components/nuxt/site-source/app/composables/useToasts.ts +48 -0
- package/dist/resources/components/nuxt/site-source/app/layouts/app.vue +5 -0
- package/dist/resources/components/nuxt/site-source/app/layouts/default.vue +5 -0
- package/dist/resources/components/nuxt/site-source/app/plugins/analytics.client.ts +121 -0
- package/dist/resources/components/nuxt/site-source/app/plugins/google-identity.client.ts +24 -0
- package/dist/resources/components/nuxt/site-source/app/theme/accordion.ts +9 -0
- package/dist/resources/components/nuxt/site-source/app/theme/breadcrumb.ts +8 -0
- package/dist/resources/components/nuxt/site-source/app/theme/button.ts +92 -0
- package/dist/resources/components/nuxt/site-source/app/theme/carousel.ts +11 -0
- package/dist/resources/components/nuxt/site-source/app/theme/checkbox.ts +12 -0
- package/dist/resources/components/nuxt/site-source/app/theme/index.ts +30 -0
- package/dist/resources/components/nuxt/site-source/app/theme/input.ts +47 -0
- package/dist/resources/components/nuxt/site-source/app/theme/modal.ts +9 -0
- package/dist/resources/components/nuxt/site-source/app/theme/pagination.ts +6 -0
- package/dist/resources/components/nuxt/site-source/app/theme/select.ts +23 -0
- package/dist/resources/components/nuxt/site-source/app/theme/stepper.ts +10 -0
- package/dist/resources/components/nuxt/site-source/app/theme/toast.ts +8 -0
- package/dist/resources/components/nuxt/site-source/app/theme/tooltip.ts +6 -0
- package/dist/resources/components/nuxt/site-source/app/types/site-shell.ts +85 -0
- package/dist/resources/components/react/ui/Button.tsx +73 -0
- package/dist/resources/components/react/ui/Input.tsx +44 -0
- package/dist/resources/components/registry.json +355 -0
- package/dist/resources/components/vue/feedback/Toast.vue +120 -0
- package/dist/resources/components/vue/feedback/useToast.ts +70 -0
- package/dist/resources/components/vue/media/FileUpload.vue +229 -0
- package/dist/resources/components/vue/media/VideoPlayer.vue +157 -0
- package/dist/resources/components/vue/ui/AppImage.vue +147 -0
- package/dist/resources/components/vue/ui/BottomSheet.vue +217 -0
- package/dist/resources/components/vue/ui/Button.vue +154 -0
- package/dist/resources/components/vue/ui/Card.vue +111 -0
- package/dist/resources/components/vue/ui/Input.vue +113 -0
- package/dist/resources/components/vue/ui/Modal.vue +193 -0
- package/dist/resources/components/vue/ui/ScrollArea.vue +163 -0
- package/dist/resources/components/vue/ui/Tooltip.vue +115 -0
- package/dist/resources/registry.json +158 -0
- package/dist/resources/snippets/node/cache.ts +116 -0
- package/dist/resources/snippets/node/date.ts +126 -0
- package/dist/resources/snippets/node/logger.ts +104 -0
- package/dist/resources/snippets/node/validation.ts +132 -0
- package/dist/resources/snippets/react/useDebounce.ts +90 -0
- package/dist/resources/snippets/registry.json +65 -0
- package/dist/resources/snippets/vue/useAsync.ts +96 -0
- package/dist/resources/snippets/vue/usePagination.ts +102 -0
- package/dist/resources/templates/base/.claude/docs/architecture-template.md +459 -0
- package/dist/resources/templates/base/.claude/docs/architecture.md +137 -0
- package/dist/resources/templates/base/.claude/docs/index.md +42 -0
- package/dist/resources/templates/base/.claude/docs/security-lifecycle.md +129 -0
- package/dist/resources/templates/base/.claude/docs/verification.md +121 -0
- package/dist/resources/templates/base/AGENTS.md +415 -0
- package/dist/resources/templates/base/CLAUDE.md +415 -0
- package/dist/resources/templates/go-backend/.claude/docs/api-design.md +486 -0
- package/dist/resources/templates/go-backend/.claude/docs/architecture-template.md +449 -0
- package/dist/resources/templates/go-backend/.claude/docs/check-list.md +155 -0
- package/dist/resources/templates/go-backend/.claude/docs/database.md +369 -0
- package/dist/resources/templates/go-backend/.claude/docs/e2e-standards.md +161 -0
- package/dist/resources/templates/go-backend/.claude/docs/error-handling.md +558 -0
- package/dist/resources/templates/go-backend/.claude/docs/event-runtime-boundary.md +124 -0
- package/dist/resources/templates/go-backend/.claude/docs/identifier-contract.md +195 -0
- package/dist/resources/templates/go-backend/.claude/docs/index.md +22 -0
- package/dist/resources/templates/go-backend/.claude/docs/logging.md +314 -0
- package/dist/resources/templates/go-backend/.claude/docs/mediagen-provider-onboarding-sop.md +917 -0
- package/dist/resources/templates/go-backend/.claude/docs/mediagen-provider-quick-reference.md +195 -0
- package/dist/resources/templates/go-backend/.claude/docs/module-standards.md +309 -0
- package/dist/resources/templates/go-backend/.claude/docs/openapi-contract.md +141 -0
- package/dist/resources/templates/go-backend/.claude/docs/payment-gateway-onboarding.md +283 -0
- package/dist/resources/templates/go-backend/.claude/docs/platform-boundary.md +191 -0
- package/dist/resources/templates/go-backend/.claude/docs/quality-gates.md +112 -0
- package/dist/resources/templates/go-backend/.dockerignore +6 -0
- package/dist/resources/templates/go-backend/.env.example +13 -0
- package/dist/resources/templates/go-backend/.gitattributes +2 -0
- package/dist/resources/templates/go-backend/AGENTS.md +1139 -0
- package/dist/resources/templates/go-backend/CLAUDE.md +1139 -0
- package/dist/resources/templates/go-backend/Dockerfile +14 -0
- package/dist/resources/templates/go-backend/Makefile +71 -0
- package/dist/resources/templates/go-backend/README.md +66 -0
- package/dist/resources/templates/go-backend/_gitignore +10 -0
- package/dist/resources/templates/go-backend/api/openapi/README.md +29 -0
- package/dist/resources/templates/go-backend/api/openapi/dist/artifact-manifest.json +19 -0
- package/dist/resources/templates/go-backend/api/openapi/dist/conformance-matrix.json +276 -0
- package/dist/resources/templates/go-backend/api/openapi/document.go +30 -0
- package/dist/resources/templates/go-backend/api/openapi/package.json +28 -0
- package/dist/resources/templates/go-backend/api/openapi/pnpm-lock.yaml +3052 -0
- package/dist/resources/templates/go-backend/api/openapi/redocly-source.yaml +18 -0
- package/dist/resources/templates/go-backend/api/openapi/redocly.yaml +8 -0
- package/dist/resources/templates/go-backend/api/openapi/sdk-generators.json +16 -0
- package/dist/resources/templates/go-backend/api/openapi/service-registry.json +39 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/conformance/runtime.arazzo.yaml +65 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/dist/internal.openapi.json +327 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/dist/runtime-contract.json +56 -0
- package/dist/resources/templates/go-backend/api/openapi/services/product-api/openapi.yaml +222 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/conformance/runtime.arazzo.yaml +65 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/dist/internal.openapi.json +327 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/dist/runtime-contract.json +56 -0
- package/dist/resources/templates/go-backend/api/openapi/services/worker/openapi.yaml +222 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/breaking.mjs +416 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/build.mjs +103 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/conformance_coverage.mjs +111 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/contract_compiler.mjs +62 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/contract_policy.mjs +208 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/delegated_contract.mjs +302 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/deterministic_archive.mjs +69 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/documentation_example_privacy.mjs +93 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/documentation_projection.mjs +498 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/documentation_quality.mjs +346 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/git_artifact_history.mjs +188 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/manifest.mjs +170 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/overlay.mjs +98 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/project.mjs +549 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/route_contract.mjs +156 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/runtime_conformance.mjs +193 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/scalar_asset_localization.mjs +164 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/sdk_generator.mjs +229 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/semantic_version.mjs +64 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/service_contract_inputs.mjs +16 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/breaking.test.mjs +365 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/build.test.mjs +42 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/conformance_coverage.test.mjs +88 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/contract_policy.test.mjs +257 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/delegated_contract.test.mjs +205 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/documentation_example_privacy.test.mjs +51 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/documentation_projection.test.mjs +368 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/documentation_quality.test.mjs +151 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/git_artifact_history.test.mjs +60 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/head_policy.test.mjs +8 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/overlay.test.mjs +44 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/projection.test.mjs +270 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/redocly_documentation_rules.test.mjs +146 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/release_manifest.test.mjs +76 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/route_contract.test.mjs +119 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/runtime_conformance.test.mjs +75 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/scalar_asset_localization.test.mjs +50 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/sdk_generator.test.mjs +31 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/semantic_version.test.mjs +60 -0
- package/dist/resources/templates/go-backend/api/openapi/tooling/test/service_contract_inputs.test.mjs +27 -0
- package/dist/resources/templates/go-backend/cmd/internal/runtime/resources.go +125 -0
- package/dist/resources/templates/go-backend/cmd/internal/runtime/runtime.go +102 -0
- package/dist/resources/templates/go-backend/cmd/internal/runtime/runtime_test.go +70 -0
- package/dist/resources/templates/go-backend/cmd/product-api/lifecycle_test.go +58 -0
- package/dist/resources/templates/go-backend/cmd/product-api/main.go +32 -0
- package/dist/resources/templates/go-backend/cmd/product-api/wire.go +13 -0
- package/dist/resources/templates/go-backend/cmd/product-api/wire_gen.go +94 -0
- package/dist/resources/templates/go-backend/cmd/worker/main.go +47 -0
- package/dist/resources/templates/go-backend/cmd/worker/wire.go +14 -0
- package/dist/resources/templates/go-backend/cmd/worker/wire_gen.go +111 -0
- package/dist/resources/templates/go-backend/configs/config.yaml +37 -0
- package/dist/resources/templates/go-backend/deployments/compose.yaml +71 -0
- package/dist/resources/templates/go-backend/docs/openapi-provenance.json +489 -0
- package/dist/resources/templates/go-backend/docs/runtime-provenance.json +175 -0
- package/dist/resources/templates/go-backend/docs/source-provenance.json +3568 -0
- package/dist/resources/templates/go-backend/docs/standards-provenance.json +1624 -0
- package/dist/resources/templates/go-backend/go.mod +256 -0
- package/dist/resources/templates/go-backend/go.sum +805 -0
- package/dist/resources/templates/go-backend/internal/common/canonicaljson/canonical.go +370 -0
- package/dist/resources/templates/go-backend/internal/common/canonicaljson/canonical_test.go +223 -0
- package/dist/resources/templates/go-backend/internal/common/checkoutbff/contracts.go +125 -0
- package/dist/resources/templates/go-backend/internal/common/checkoutbff/platform_client.go +212 -0
- package/dist/resources/templates/go-backend/internal/common/checkoutbff/platform_client_test.go +319 -0
- package/dist/resources/templates/go-backend/internal/common/contentaccess/contentaccess.go +50 -0
- package/dist/resources/templates/go-backend/internal/common/contracts/contact.go +85 -0
- package/dist/resources/templates/go-backend/internal/common/ctxutil/identity.go +20 -0
- package/dist/resources/templates/go-backend/internal/common/ctxutil/product.go +53 -0
- package/dist/resources/templates/go-backend/internal/common/enumdomain/payment.go +12 -0
- package/dist/resources/templates/go-backend/internal/common/enums/dto_admin.go +9 -0
- package/dist/resources/templates/go-backend/internal/common/enums/enum.go +1247 -0
- package/dist/resources/templates/go-backend/internal/common/enums/handler_admin.go +66 -0
- package/dist/resources/templates/go-backend/internal/common/enums/module.go +46 -0
- package/dist/resources/templates/go-backend/internal/common/enums/provider.go +10 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register.go +11 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_audit.go +274 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_command_replay.go +12 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_config.go +27 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_locale.go +37 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_ops.go +14 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_outbox.go +15 -0
- package/dist/resources/templates/go-backend/internal/common/enums/register_rule_expression.go +63 -0
- package/dist/resources/templates/go-backend/internal/common/enums/registry.go +77 -0
- package/dist/resources/templates/go-backend/internal/common/httporigin/origin.go +62 -0
- package/dist/resources/templates/go-backend/internal/common/httporigin/origin_test.go +38 -0
- package/dist/resources/templates/go-backend/internal/common/iamcredential/plaintext.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/iamcredential/plaintext_test.go +29 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope.go +212 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope_binding.go +26 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope_filter.go +173 -0
- package/dist/resources/templates/go-backend/internal/common/iamscope/scope_filter_test.go +279 -0
- package/dist/resources/templates/go-backend/internal/common/internalapi/authorization_details.go +10 -0
- package/dist/resources/templates/go-backend/internal/common/internalapi/route_permission_policies.go +660 -0
- package/dist/resources/templates/go-backend/internal/common/internalapi/route_permission_policies_test.go +331 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/audience_token_source.go +166 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/bootstrap_token_exchanger.go +183 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/bound_service_token_signer.go +52 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/delegated_access_token_exchanger.go +189 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/delegated_access_token_exchanger_test.go +159 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/product_scoped_service_token_signer.go +92 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/provider.go +25 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/request_signer.go +86 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/resolver.go +69 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/resolver_test.go +42 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/route_scope.go +95 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/route_scope_test.go +78 -0
- package/dist/resources/templates/go-backend/internal/common/internalservice/service_identity_test.go +387 -0
- package/dist/resources/templates/go-backend/internal/common/jsonschema/compiler.go +100 -0
- package/dist/resources/templates/go-backend/internal/common/jsonschema/compiler_test.go +41 -0
- package/dist/resources/templates/go-backend/internal/common/jwksapi/handler.go +83 -0
- package/dist/resources/templates/go-backend/internal/common/jwksapi/handler_test.go +104 -0
- package/dist/resources/templates/go-backend/internal/common/locale/locale.go +145 -0
- package/dist/resources/templates/go-backend/internal/common/locale/locale_test.go +75 -0
- package/dist/resources/templates/go-backend/internal/common/mediaref/mediaref.go +54 -0
- package/dist/resources/templates/go-backend/internal/common/mediaref/mediaref_test.go +77 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/apikey_auth.go +320 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/apikey_throttle.go +158 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/auth.go +40 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/auth_test.go +50 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/client_context.go +86 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/cors.go +68 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/event_context.go +18 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/gateway_identity.go +279 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/helpers.go +159 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_delegated_route_permission.go +171 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_delegated_token_auth.go +151 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_delegated_token_auth_test.go +99 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_service_identity.go +138 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/iam_service_token_auth.go +74 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/idempotent.go +273 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/idempotent_test.go +83 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/internal_route_permission.go +45 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/internal_route_permission_test.go +186 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/logging.go +191 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/metrics.go +45 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/middleware_test.go +1516 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/principal_context.go +160 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/principal_context_test.go +355 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/product_context.go +100 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/recovery.go +40 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/referral_attribution.go +178 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/requestid.go +48 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/resource_permission.go +790 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/resource_permission_test.go +440 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/service_credential_auth.go +67 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/tenant.go +148 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/throttle.go +310 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/trusted_client_ip.go +23 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/trusted_client_ip_test.go +60 -0
- package/dist/resources/templates/go-backend/internal/common/money/currency.go +25 -0
- package/dist/resources/templates/go-backend/internal/common/money/errors.go +23 -0
- package/dist/resources/templates/go-backend/internal/common/money/format.go +123 -0
- package/dist/resources/templates/go-backend/internal/common/money/format_test.go +204 -0
- package/dist/resources/templates/go-backend/internal/common/money/gateway.go +144 -0
- package/dist/resources/templates/go-backend/internal/common/money/gateway_test.go +165 -0
- package/dist/resources/templates/go-backend/internal/common/money/rounding.go +56 -0
- package/dist/resources/templates/go-backend/internal/common/money/rounding_test.go +51 -0
- package/dist/resources/templates/go-backend/internal/common/principal/context.go +56 -0
- package/dist/resources/templates/go-backend/internal/common/principal/principal.go +49 -0
- package/dist/resources/templates/go-backend/internal/common/productcode/code.go +24 -0
- package/dist/resources/templates/go-backend/internal/common/productcode/code_test.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/providerconfig/schema.go +577 -0
- package/dist/resources/templates/go-backend/internal/common/providerconfig/schema_test.go +47 -0
- package/dist/resources/templates/go-backend/internal/common/requestprivacy/request.go +246 -0
- package/dist/resources/templates/go-backend/internal/common/requestprivacy/request_test.go +170 -0
- package/dist/resources/templates/go-backend/internal/common/response/pagination.go +60 -0
- package/dist/resources/templates/go-backend/internal/common/response/response.go +110 -0
- package/dist/resources/templates/go-backend/internal/common/response/response_test.go +463 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/ast.go +141 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/ast_test.go +81 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/canonical.go +184 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/canonical_test.go +319 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/decoder.go +555 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/decoder_test.go +260 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/errors.go +55 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/evaluator.go +96 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/evaluator_test.go +220 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/fuzz_test.go +116 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/limits.go +331 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/schema.go +412 -0
- package/dist/resources/templates/go-backend/internal/common/ruleexpression/schema_test.go +164 -0
- package/dist/resources/templates/go-backend/internal/common/runtimeinput/runtime_input.go +627 -0
- package/dist/resources/templates/go-backend/internal/common/runtimeinput/runtime_input_test.go +245 -0
- package/dist/resources/templates/go-backend/internal/common/semver/errors.go +6 -0
- package/dist/resources/templates/go-backend/internal/common/semver/semver.go +125 -0
- package/dist/resources/templates/go-backend/internal/common/semver/semver_test.go +205 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/audience.go +48 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/audience_test.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/resource_identifier.go +33 -0
- package/dist/resources/templates/go-backend/internal/common/serviceidentity/resource_identifier_test.go +32 -0
- package/dist/resources/templates/go-backend/internal/common/tradeno/generator.go +99 -0
- package/dist/resources/templates/go-backend/internal/common/tradeno/generator_test.go +396 -0
- package/dist/resources/templates/go-backend/internal/common/tradeno/prefix.go +247 -0
- package/dist/resources/templates/go-backend/internal/common/types/asset_url.go +11 -0
- package/dist/resources/templates/go-backend/internal/common/types/billing.go +89 -0
- package/dist/resources/templates/go-backend/internal/common/types/billing_test.go +77 -0
- package/dist/resources/templates/go-backend/internal/common/types/country.go +74 -0
- package/dist/resources/templates/go-backend/internal/common/types/country_test.go +28 -0
- package/dist/resources/templates/go-backend/internal/common/types/currency.go +60 -0
- package/dist/resources/templates/go-backend/internal/common/types/identifiers.go +41 -0
- package/dist/resources/templates/go-backend/internal/common/types/operator.go +28 -0
- package/dist/resources/templates/go-backend/internal/common/types/subscription_entitlement.go +24 -0
- package/dist/resources/templates/go-backend/internal/common/types/subscription_entitlement_test.go +35 -0
- package/dist/resources/templates/go-backend/internal/common/types/tier.go +72 -0
- package/dist/resources/templates/go-backend/internal/common/types/types.go +411 -0
- package/dist/resources/templates/go-backend/internal/common/types/types_test.go +295 -0
- package/dist/resources/templates/go-backend/internal/common/utils/constants.go +100 -0
- package/dist/resources/templates/go-backend/internal/common/utils/crypto.go +158 -0
- package/dist/resources/templates/go-backend/internal/common/utils/crypto_test.go +345 -0
- package/dist/resources/templates/go-backend/internal/common/utils/duration.go +25 -0
- package/dist/resources/templates/go-backend/internal/common/utils/helpers.go +18 -0
- package/dist/resources/templates/go-backend/internal/common/utils/json.go +62 -0
- package/dist/resources/templates/go-backend/internal/common/utils/json_test.go +76 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pagination.go +51 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pagination_test.go +45 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pointer.go +107 -0
- package/dist/resources/templates/go-backend/internal/common/utils/pointer_test.go +15 -0
- package/dist/resources/templates/go-backend/internal/common/utils/slice.go +24 -0
- package/dist/resources/templates/go-backend/internal/common/utils/snowflake.go +110 -0
- package/dist/resources/templates/go-backend/internal/common/utils/snowflake_test.go +316 -0
- package/dist/resources/templates/go-backend/internal/common/utils/string.go +16 -0
- package/dist/resources/templates/go-backend/internal/common/utils/timefmt.go +42 -0
- package/dist/resources/templates/go-backend/internal/common/validator/validator.go +136 -0
- package/dist/resources/templates/go-backend/internal/common/validator/validator_test.go +240 -0
- package/dist/resources/templates/go-backend/internal/common/youtubeapi/client.go +224 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/document.go +269 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/document_test.go +104 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/route_validator.go +78 -0
- package/dist/resources/templates/go-backend/internal/core/apicontract/route_validator_test.go +108 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/assets/scalar-api-reference.js +2385 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/assets/scalar-api-reference.metadata.json +10 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/route.go +107 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/route_test.go +200 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/scalar.go +117 -0
- package/dist/resources/templates/go-backend/internal/core/apidocs/scalar_test.go +99 -0
- package/dist/resources/templates/go-backend/internal/core/audit/access_log_policy.go +91 -0
- package/dist/resources/templates/go-backend/internal/core/audit/access_log_policy_test.go +51 -0
- package/dist/resources/templates/go-backend/internal/core/audit/actor_resolver.go +36 -0
- package/dist/resources/templates/go-backend/internal/core/audit/constants.go +30 -0
- package/dist/resources/templates/go-backend/internal/core/audit/context.go +119 -0
- package/dist/resources/templates/go-backend/internal/core/audit/context_test.go +310 -0
- package/dist/resources/templates/go-backend/internal/core/audit/dto.go +468 -0
- package/dist/resources/templates/go-backend/internal/core/audit/dto_admin.go +172 -0
- package/dist/resources/templates/go-backend/internal/core/audit/enum.go +460 -0
- package/dist/resources/templates/go-backend/internal/core/audit/enum_test.go +314 -0
- package/dist/resources/templates/go-backend/internal/core/audit/errors.go +9 -0
- package/dist/resources/templates/go-backend/internal/core/audit/handler.go +568 -0
- package/dist/resources/templates/go-backend/internal/core/audit/listener.go +319 -0
- package/dist/resources/templates/go-backend/internal/core/audit/listener_test.go +98 -0
- package/dist/resources/templates/go-backend/internal/core/audit/middleware.go +669 -0
- package/dist/resources/templates/go-backend/internal/core/audit/middleware_test.go +268 -0
- package/dist/resources/templates/go-backend/internal/core/audit/model.go +306 -0
- package/dist/resources/templates/go-backend/internal/core/audit/partition_job.go +316 -0
- package/dist/resources/templates/go-backend/internal/core/audit/ports.go +9 -0
- package/dist/resources/templates/go-backend/internal/core/audit/provider.go +30 -0
- package/dist/resources/templates/go-backend/internal/core/audit/repository.go +1007 -0
- package/dist/resources/templates/go-backend/internal/core/audit/repository_test.go +934 -0
- package/dist/resources/templates/go-backend/internal/core/audit/router.go +85 -0
- package/dist/resources/templates/go-backend/internal/core/audit/service.go +770 -0
- package/dist/resources/templates/go-backend/internal/core/audit/service_test.go +331 -0
- package/dist/resources/templates/go-backend/internal/core/audit/vo_admin.go +475 -0
- package/dist/resources/templates/go-backend/internal/core/cache/config.go +30 -0
- package/dist/resources/templates/go-backend/internal/core/cache/key.go +41 -0
- package/dist/resources/templates/go-backend/internal/core/cache/key_test.go +62 -0
- package/dist/resources/templates/go-backend/internal/core/cache/l1.go +153 -0
- package/dist/resources/templates/go-backend/internal/core/cache/l1_test.go +212 -0
- package/dist/resources/templates/go-backend/internal/core/cache/manager.go +278 -0
- package/dist/resources/templates/go-backend/internal/core/cache/manager_provider.go +24 -0
- package/dist/resources/templates/go-backend/internal/core/cache/metrics.go +126 -0
- package/dist/resources/templates/go-backend/internal/core/cache/namespace.go +46 -0
- package/dist/resources/templates/go-backend/internal/core/cache/namespace_test.go +90 -0
- package/dist/resources/templates/go-backend/internal/core/cache/options.go +39 -0
- package/dist/resources/templates/go-backend/internal/core/cache/options_test.go +96 -0
- package/dist/resources/templates/go-backend/internal/core/cache/redis.go +311 -0
- package/dist/resources/templates/go-backend/internal/core/cache/redis_test.go +51 -0
- package/dist/resources/templates/go-backend/internal/core/cache/serializer.go +31 -0
- package/dist/resources/templates/go-backend/internal/core/cache/serializer_test.go +139 -0
- package/dist/resources/templates/go-backend/internal/core/cache/singleflight.go +53 -0
- package/dist/resources/templates/go-backend/internal/core/cache/singleflight_test.go +211 -0
- package/dist/resources/templates/go-backend/internal/core/cache/warming.go +86 -0
- package/dist/resources/templates/go-backend/internal/core/clock/clock.go +66 -0
- package/dist/resources/templates/go-backend/internal/core/clock/clock_test.go +26 -0
- package/dist/resources/templates/go-backend/internal/core/clock/runtime_clock.go +283 -0
- package/dist/resources/templates/go-backend/internal/core/clock/runtime_clock_test.go +98 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/errors.go +6 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/model.go +90 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/model_test.go +79 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/namespace.go +7 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/persistence.go +269 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/persistence_test.go +185 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/provider.go +9 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/repository.go +22 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/service.go +853 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/service_persistence_test.go +432 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/service_test.go +891 -0
- package/dist/resources/templates/go-backend/internal/core/commandreplay/types.go +121 -0
- package/dist/resources/templates/go-backend/internal/core/config/config.go +2069 -0
- package/dist/resources/templates/go-backend/internal/core/config/config_test.go +1122 -0
- package/dist/resources/templates/go-backend/internal/core/config/contract/contract_test.go +388 -0
- package/dist/resources/templates/go-backend/internal/core/config/contract/docs.go +198 -0
- package/dist/resources/templates/go-backend/internal/core/config/contract/verify.go +424 -0
- package/dist/resources/templates/go-backend/internal/core/config/enum.go +46 -0
- package/dist/resources/templates/go-backend/internal/core/config/metadata.go +717 -0
- package/dist/resources/templates/go-backend/internal/core/config/metadata_test.go +228 -0
- package/dist/resources/templates/go-backend/internal/core/config/product_admin_config_test.go +210 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/aes_gcm.go +111 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/aes_gcm_test.go +364 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/encryptor.go +12 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/envelope_encryptor.go +134 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/envelope_encryptor_test.go +118 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/pem.go +112 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/pem_test.go +44 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/provider.go +130 -0
- package/dist/resources/templates/go-backend/internal/core/crypto/provider_test.go +92 -0
- package/dist/resources/templates/go-backend/internal/core/database/base_model.go +24 -0
- package/dist/resources/templates/go-backend/internal/core/database/clickhouse.go +121 -0
- package/dist/resources/templates/go-backend/internal/core/database/database.go +112 -0
- package/dist/resources/templates/go-backend/internal/core/database/database_logger_test.go +95 -0
- package/dist/resources/templates/go-backend/internal/core/database/errors.go +25 -0
- package/dist/resources/templates/go-backend/internal/core/database/metrics_plugin.go +105 -0
- package/dist/resources/templates/go-backend/internal/core/database/pool_collector.go +71 -0
- package/dist/resources/templates/go-backend/internal/core/database/read_replica.go +520 -0
- package/dist/resources/templates/go-backend/internal/core/database/transaction.go +170 -0
- package/dist/resources/templates/go-backend/internal/core/database/transaction_test.go +282 -0
- package/dist/resources/templates/go-backend/internal/core/distlock/lock.go +353 -0
- package/dist/resources/templates/go-backend/internal/core/distlock/lock_test.go +106 -0
- package/dist/resources/templates/go-backend/internal/core/errors/handler.go +189 -0
- package/dist/resources/templates/go-backend/internal/core/errors/handler_test.go +515 -0
- package/dist/resources/templates/go-backend/internal/core/eventbus/eventbus.go +667 -0
- package/dist/resources/templates/go-backend/internal/core/eventbus/eventbus_test.go +792 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/noop.go +22 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/provider.go +20 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/publisher.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/redis.go +109 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/routing.go +104 -0
- package/dist/resources/templates/go-backend/internal/core/eventstream/routing_test.go +71 -0
- package/dist/resources/templates/go-backend/internal/core/geoip/model.go +19 -0
- package/dist/resources/templates/go-backend/internal/core/geoip/service.go +88 -0
- package/dist/resources/templates/go-backend/internal/core/health/health.go +333 -0
- package/dist/resources/templates/go-backend/internal/core/health/health_test.go +27 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/client.go +772 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/client_test.go +287 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/download.go +578 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/download_test.go +374 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/jwk.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/keyring.go +144 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/keyring_test.go +128 -0
- package/dist/resources/templates/go-backend/internal/core/jwtkeyring/registry.go +60 -0
- package/dist/resources/templates/go-backend/internal/core/logger/logger.go +53 -0
- package/dist/resources/templates/go-backend/internal/core/logger/logger_test.go +194 -0
- package/dist/resources/templates/go-backend/internal/core/observability/metrics.go +358 -0
- package/dist/resources/templates/go-backend/internal/core/observability/sentry.go +445 -0
- package/dist/resources/templates/go-backend/internal/core/observability/sentry_privacy_test.go +175 -0
- package/dist/resources/templates/go-backend/internal/core/observability/tracing.go +187 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/model.go +314 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/model_test.go +77 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/persistence.go +51 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/provider.go +23 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/relay.go +1138 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/relay_postgres_test.go +257 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/relay_test.go +690 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/rescheduler.go +164 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/rescheduler_test.go +209 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/writer.go +249 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/writer_postgres_test.go +170 -0
- package/dist/resources/templates/go-backend/internal/core/outbox/writer_test.go +123 -0
- package/dist/resources/templates/go-backend/internal/core/provider.go +198 -0
- package/dist/resources/templates/go-backend/internal/core/queue/metrics_middleware.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/queue/metrics_middleware_test.go +12 -0
- package/dist/resources/templates/go-backend/internal/core/queue/queue.go +288 -0
- package/dist/resources/templates/go-backend/internal/core/queue/queue_test.go +159 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/bulkhead.go +514 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/bulkhead_test.go +984 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/circuitbreaker.go +358 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/circuitbreaker_test.go +788 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/retry.go +318 -0
- package/dist/resources/templates/go-backend/internal/core/resilience/retry_test.go +735 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/recorder.go +305 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/run_context.go +124 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/run_context_test.go +85 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/scheduler.go +1589 -0
- package/dist/resources/templates/go-backend/internal/core/schedule/scheduler_control_test.go +808 -0
- package/dist/resources/templates/go-backend/internal/core/storage/oss_provider.go +398 -0
- package/dist/resources/templates/go-backend/internal/core/storage/oss_provider_test.go +89 -0
- package/dist/resources/templates/go-backend/internal/core/storage/path.go +110 -0
- package/dist/resources/templates/go-backend/internal/core/storage/path_test.go +301 -0
- package/dist/resources/templates/go-backend/internal/core/storage/s3_provider.go +489 -0
- package/dist/resources/templates/go-backend/internal/core/storage/s3_provider_test.go +60 -0
- package/dist/resources/templates/go-backend/internal/core/storage/storage.go +268 -0
- package/dist/resources/templates/go-backend/internal/core/storage/validation.go +225 -0
- package/dist/resources/templates/go-backend/internal/core/storage/validation_test.go +495 -0
- package/dist/resources/templates/go-backend/internal/core/temporal/logger.go +38 -0
- package/dist/resources/templates/go-backend/internal/core/temporal/provider.go +126 -0
- package/dist/resources/templates/go-backend/internal/core/temporal/provider_test.go +67 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/client.go +282 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/client_test.go +81 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/config.go +58 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/handler.go +53 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/hub.go +269 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/message.go +273 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/notifier.go +92 -0
- package/dist/resources/templates/go-backend/internal/core/websocket/provider.go +33 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/action.go +77 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/action_test.go +238 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/condition.go +107 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/decision.go +256 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/enum.go +643 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/errors.go +102 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/principal_record.go +21 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/product_context.go +486 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/resource.go +215 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/iam/resource_test.go +242 -0
- package/dist/resources/templates/go-backend/internal/products/README.md +5 -0
- package/dist/resources/templates/go-backend/internal/sharedevents/README.md +5 -0
- package/dist/resources/templates/go-backend/migrations/000001_infrastructure.down.sql +13 -0
- package/dist/resources/templates/go-backend/migrations/000001_infrastructure.up.sql +886 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error.go +327 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error_code.go +65 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error_test.go +41 -0
- package/dist/resources/templates/go-backend/pkg/apierror/error_type.go +14 -0
- package/dist/resources/templates/go-backend/pkg/apierror/http_response.go +216 -0
- package/dist/resources/templates/go-backend/pkg/apierror/http_response_test.go +216 -0
- package/dist/resources/templates/go-backend/scripts/check-openapi-clean-deletion.sh +54 -0
- package/dist/resources/templates/go-backend/scripts/test-migrations.sh +32 -0
- package/dist/resources/templates/go-backend/tests/infrastructure.sql +69 -0
- package/dist/resources/templates/mcp-server/.claude/docs/stack.md +338 -0
- package/dist/resources/templates/mcp-server/.editorconfig +13 -0
- package/dist/resources/templates/mcp-server/.env.example +8 -0
- package/dist/resources/templates/mcp-server/.github/ISSUE_TEMPLATE/bug_report.yml +104 -0
- package/dist/resources/templates/mcp-server/.github/ISSUE_TEMPLATE/feature_request.yml +54 -0
- package/dist/resources/templates/mcp-server/.github/PULL_REQUEST_TEMPLATE.md +36 -0
- package/dist/resources/templates/mcp-server/.github/workflows/ci.yml +78 -0
- package/dist/resources/templates/mcp-server/.husky/commit-msg +1 -0
- package/dist/resources/templates/mcp-server/.husky/pre-commit +1 -0
- package/dist/resources/templates/mcp-server/.lintstagedrc.json +4 -0
- package/dist/resources/templates/mcp-server/.nvmrc +1 -0
- package/dist/resources/templates/mcp-server/.prettierrc +8 -0
- package/dist/resources/templates/mcp-server/CONTRIBUTING.md +184 -0
- package/dist/resources/templates/mcp-server/Dockerfile +23 -0
- package/dist/resources/templates/mcp-server/LICENSE +21 -0
- package/dist/resources/templates/mcp-server/README.md +123 -0
- package/dist/resources/templates/mcp-server/_gitignore +26 -0
- package/dist/resources/templates/mcp-server/commitlint.config.js +24 -0
- package/dist/resources/templates/mcp-server/eslint.config.js +30 -0
- package/dist/resources/templates/mcp-server/package.json +72 -0
- package/dist/resources/templates/mcp-server/src/index.ts +27 -0
- package/dist/resources/templates/mcp-server/src/resources.ts +33 -0
- package/dist/resources/templates/mcp-server/src/services/.gitkeep +0 -0
- package/dist/resources/templates/mcp-server/src/tools.ts +43 -0
- package/dist/resources/templates/mcp-server/src/types/index.ts +19 -0
- package/dist/resources/templates/mcp-server/src/utils/index.ts +31 -0
- package/dist/resources/templates/mcp-server/tsconfig.json +22 -0
- package/dist/resources/templates/mcp-server/tsup.config.ts +14 -0
- package/dist/resources/templates/mcp-server/vitest.config.ts +15 -0
- package/dist/resources/templates/nuxt/.claude/docs/stack.md +666 -0
- package/dist/resources/templates/nuxt/.editorconfig +15 -0
- package/dist/resources/templates/nuxt/.env.example +22 -0
- package/dist/resources/templates/nuxt/.github/workflows/ci.yml +34 -0
- package/dist/resources/templates/nuxt/.husky/commit-msg +1 -0
- package/dist/resources/templates/nuxt/.husky/pre-commit +1 -0
- package/dist/resources/templates/nuxt/.nvmrc +1 -0
- package/dist/resources/templates/nuxt/.prettierignore +9 -0
- package/dist/resources/templates/nuxt/.prettierrc +1 -0
- package/dist/resources/templates/nuxt/README.md +23 -0
- package/dist/resources/templates/nuxt/_gitignore +7 -0
- package/dist/resources/templates/nuxt/app/app.config.ts +105 -0
- package/dist/resources/templates/nuxt/app/i18n/locales/en.json +5 -0
- package/dist/resources/templates/nuxt/app/pages/app/index.vue +224 -0
- package/dist/resources/templates/nuxt/app/pages/authors/[slug].vue +37 -0
- package/dist/resources/templates/nuxt/app/pages/blog/[slug].vue +55 -0
- package/dist/resources/templates/nuxt/app/pages/blog/category/[category].vue +38 -0
- package/dist/resources/templates/nuxt/app/pages/blog/index.vue +46 -0
- package/dist/resources/templates/nuxt/app/pages/index.vue +626 -0
- package/dist/resources/templates/nuxt/app/pages/legal/privacy.vue +21 -0
- package/dist/resources/templates/nuxt/app/pages/legal/terms.vue +21 -0
- package/dist/resources/templates/nuxt/app/pages/ui/index.vue +397 -0
- package/dist/resources/templates/nuxt/commitlint.config.mjs +1 -0
- package/dist/resources/templates/nuxt/eslint.config.mjs +4 -0
- package/dist/resources/templates/nuxt/lint-staged.config.mjs +8 -0
- package/dist/resources/templates/nuxt/nuxt.config.ts +71 -0
- package/dist/resources/templates/nuxt/package.json +67 -0
- package/dist/resources/templates/nuxt/public/apple-touch-icon.png +0 -0
- package/dist/resources/templates/nuxt/public/favicon.ico +0 -0
- package/dist/resources/templates/nuxt/public/favicon.svg +5 -0
- package/dist/resources/templates/nuxt/public/icon-16x16.png +0 -0
- package/dist/resources/templates/nuxt/public/icon-192x192.png +0 -0
- package/dist/resources/templates/nuxt/public/icon-32x32.png +0 -0
- package/dist/resources/templates/nuxt/public/icon-512x512.png +0 -0
- package/dist/resources/templates/nuxt/public/logo.svg +6 -0
- package/dist/resources/templates/nuxt/public/media/hero-product-gallery.png +0 -0
- package/dist/resources/templates/nuxt/server/api/content/sitemap-urls.get.ts +12 -0
- package/dist/resources/templates/nuxt/server/api/preview.get.ts +9 -0
- package/dist/resources/templates/nuxt/stylelint.config.mjs +3 -0
- package/dist/resources/templates/nuxt/test/e2e/rendering.test.ts +13 -0
- package/dist/resources/templates/nuxt/tsconfig.json +3 -0
- package/dist/resources/templates/nuxt/vitest.config.ts +8 -0
- package/package.json +16 -12
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { relative, resolve } from 'node:path';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
|
|
6
|
+
import { createClient } from '@hey-api/openapi-ts';
|
|
7
|
+
|
|
8
|
+
import { apiRoot, canonicalJSON, operationEntries, readStructured, sha256 } from './project.mjs';
|
|
9
|
+
|
|
10
|
+
export const sdkGeneratorRegistrySchemaVersion = 1;
|
|
11
|
+
|
|
12
|
+
const adapters = Object.freeze({
|
|
13
|
+
'hey-api': Object.freeze({ generate: generateHeyAPISDK }),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export async function readSDKGeneratorRegistry(path = resolve(apiRoot, 'sdk-generators.json')) {
|
|
17
|
+
const registry = await readStructured(path);
|
|
18
|
+
if (registry?.schema_version !== sdkGeneratorRegistrySchemaVersion || !Array.isArray(registry.generators) || registry.generators.length === 0) {
|
|
19
|
+
throw new Error('SDK generator registry must declare schema_version 1 and generators');
|
|
20
|
+
}
|
|
21
|
+
const ids = new Set();
|
|
22
|
+
for (const generator of registry.generators) {
|
|
23
|
+
if (!/^[a-z][a-z0-9-]*$/.test(generator.id ?? '') || ids.has(generator.id)) throw new Error(`invalid SDK generator id: ${generator.id}`);
|
|
24
|
+
ids.add(generator.id);
|
|
25
|
+
if (!adapters[generator.provider]) throw new Error(`unknown SDK generator provider: ${generator.provider}`);
|
|
26
|
+
if (generator.language !== 'typescript' || generator.runtime !== 'fetch') throw new Error(`unsupported SDK target: ${generator.language}/${generator.runtime}`);
|
|
27
|
+
if (!/^@[a-z][a-z0-9-]*$/.test(generator.package_scope ?? '')) throw new Error(`invalid SDK package scope: ${generator.package_scope}`);
|
|
28
|
+
if (!Array.isArray(generator.audiences) || generator.audiences.length === 0 || generator.audiences.some((audience) => !['partner', 'public'].includes(audience))) {
|
|
29
|
+
throw new Error(`invalid SDK audiences for ${generator.id}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return registry;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export async function generateSDKPackages({ audience, contractSha256, document, gitRevision, service, toolVersions }) {
|
|
36
|
+
const registry = await readSDKGeneratorRegistry();
|
|
37
|
+
const packages = [];
|
|
38
|
+
for (const generator of registry.generators.filter((entry) => entry.audiences.includes(audience))) {
|
|
39
|
+
const adapter = adapters[generator.provider];
|
|
40
|
+
const packageName = `${generator.package_scope}/${service}-${audience}-sdk`;
|
|
41
|
+
packages.push(await adapter.generate({
|
|
42
|
+
apiVersion: document.info.version,
|
|
43
|
+
audience,
|
|
44
|
+
contractSha256,
|
|
45
|
+
document,
|
|
46
|
+
generator,
|
|
47
|
+
gitRevision,
|
|
48
|
+
packageName,
|
|
49
|
+
service,
|
|
50
|
+
toolVersions,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
return packages;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function generateHeyAPISDK(context) {
|
|
57
|
+
const root = await mkdtemp(resolve(tmpdir(), 'onex-sdk-'));
|
|
58
|
+
const sourceRoot = resolve(root, 'src');
|
|
59
|
+
const packageRoot = resolve(root, 'package');
|
|
60
|
+
const outputRoot = resolve(packageRoot, 'src');
|
|
61
|
+
try {
|
|
62
|
+
await mkdir(sourceRoot, { recursive: true });
|
|
63
|
+
const inputPath = resolve(sourceRoot, 'openapi.json');
|
|
64
|
+
await writeFile(inputPath, canonicalJSON(context.document));
|
|
65
|
+
await createClient({
|
|
66
|
+
input: inputPath,
|
|
67
|
+
interactive: false,
|
|
68
|
+
logs: { file: false, level: 'silent' },
|
|
69
|
+
output: {
|
|
70
|
+
clean: true,
|
|
71
|
+
header: [],
|
|
72
|
+
module: { extension: '.js' },
|
|
73
|
+
path: outputRoot,
|
|
74
|
+
tsConfigPath: null,
|
|
75
|
+
},
|
|
76
|
+
plugins: [
|
|
77
|
+
{ comments: false, enums: 'javascript', name: '@hey-api/typescript' },
|
|
78
|
+
{ client: '@hey-api/client-fetch', comments: false, name: '@hey-api/sdk', paramsStructure: 'grouped' },
|
|
79
|
+
{ name: '@hey-api/client-fetch', throwOnError: false },
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
const entryPath = resolve(outputRoot, 'index.ts');
|
|
83
|
+
const entry = await readFile(entryPath, 'utf8');
|
|
84
|
+
await writeFile(entryPath, `${entry.trimEnd()}\nexport { client } from './client.gen.js';\n`);
|
|
85
|
+
|
|
86
|
+
const packageJSON = {
|
|
87
|
+
description: `${context.service} ${context.audience} TypeScript SDK`,
|
|
88
|
+
exports: {
|
|
89
|
+
'.': {
|
|
90
|
+
import: './dist/index.js',
|
|
91
|
+
types: './dist/index.d.ts',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
files: ['dist', 'README.md', 'sdk-provenance.json'],
|
|
95
|
+
name: context.packageName,
|
|
96
|
+
private: true,
|
|
97
|
+
sideEffects: false,
|
|
98
|
+
type: 'module',
|
|
99
|
+
version: context.apiVersion,
|
|
100
|
+
};
|
|
101
|
+
const tsconfig = {
|
|
102
|
+
compilerOptions: {
|
|
103
|
+
declaration: true,
|
|
104
|
+
declarationMap: false,
|
|
105
|
+
lib: ['DOM', 'DOM.Iterable', 'ES2022'],
|
|
106
|
+
module: 'NodeNext',
|
|
107
|
+
moduleResolution: 'NodeNext',
|
|
108
|
+
noEmitOnError: true,
|
|
109
|
+
noUncheckedIndexedAccess: true,
|
|
110
|
+
outDir: 'dist',
|
|
111
|
+
rootDir: 'src',
|
|
112
|
+
skipLibCheck: false,
|
|
113
|
+
strict: true,
|
|
114
|
+
target: 'ES2022',
|
|
115
|
+
},
|
|
116
|
+
include: ['src/**/*.ts'],
|
|
117
|
+
};
|
|
118
|
+
const examplePath = 'src/usage.example.ts';
|
|
119
|
+
const verificationCommand = 'tsc --project tsconfig.json --pretty false';
|
|
120
|
+
const provenance = {
|
|
121
|
+
api_version: context.apiVersion,
|
|
122
|
+
audience: context.audience,
|
|
123
|
+
contract_sha256: context.contractSha256,
|
|
124
|
+
evidence: {
|
|
125
|
+
code_example: {
|
|
126
|
+
command: verificationCommand,
|
|
127
|
+
path: examplePath,
|
|
128
|
+
status: 'passed',
|
|
129
|
+
},
|
|
130
|
+
typecheck: {
|
|
131
|
+
command: verificationCommand,
|
|
132
|
+
status: 'passed',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
generator: context.generator.id,
|
|
136
|
+
git_revision: context.gitRevision,
|
|
137
|
+
package: context.packageName,
|
|
138
|
+
schema_version: 1,
|
|
139
|
+
service: context.service,
|
|
140
|
+
tool_versions: context.toolVersions,
|
|
141
|
+
};
|
|
142
|
+
const readme = sdkReadme(context);
|
|
143
|
+
const example = sdkUsageExample(context, './index.js');
|
|
144
|
+
await Promise.all([
|
|
145
|
+
writeFile(resolve(packageRoot, 'README.md'), readme),
|
|
146
|
+
writeFile(resolve(packageRoot, 'package.json'), canonicalJSON(packageJSON)),
|
|
147
|
+
writeFile(resolve(packageRoot, examplePath), example),
|
|
148
|
+
writeFile(resolve(packageRoot, 'tsconfig.json'), canonicalJSON(tsconfig)),
|
|
149
|
+
]);
|
|
150
|
+
execFileSync(resolve(apiRoot, 'node_modules/.bin/tsc'), ['--project', resolve(packageRoot, 'tsconfig.json'), '--pretty', 'false'], {
|
|
151
|
+
cwd: packageRoot,
|
|
152
|
+
encoding: 'utf8',
|
|
153
|
+
env: { ...process.env, FORCE_COLOR: '0', NO_COLOR: '1' },
|
|
154
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
155
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
156
|
+
});
|
|
157
|
+
provenance.evidence.code_example.sha256 = sha256(example);
|
|
158
|
+
await writeFile(resolve(packageRoot, 'sdk-provenance.json'), canonicalJSON(provenance));
|
|
159
|
+
|
|
160
|
+
const files = new Map();
|
|
161
|
+
for (const path of await listFiles(packageRoot)) {
|
|
162
|
+
files.set(relative(packageRoot, path).replaceAll('\\', '/'), normalizeTextArtifact(await readFile(path)));
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
files,
|
|
166
|
+
generator: context.generator.id,
|
|
167
|
+
evidence: provenance.evidence,
|
|
168
|
+
packageName: context.packageName,
|
|
169
|
+
packageVersion: context.apiVersion,
|
|
170
|
+
sourceContractSha256: context.contractSha256,
|
|
171
|
+
};
|
|
172
|
+
} finally {
|
|
173
|
+
await rm(root, { recursive: true, force: true });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function normalizeTextArtifact(content) {
|
|
178
|
+
return Buffer.from(content.toString('utf8').replace(/[ \t]+$/gmu, ''));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function sdkReadme(context) {
|
|
182
|
+
return `# ${context.packageName}\n\n` +
|
|
183
|
+
`${context.service} 的 ${context.audience} 受众 TypeScript Fetch SDK,契约版本为 ${context.apiVersion}。\n\n` +
|
|
184
|
+
`该制品为私有的内部或合作方下载包,不声明公共 npm 发布许可。使用前必须按 release manifest 校验 SHA-256 与 sdk-provenance.json。\n\n` +
|
|
185
|
+
`## 安装\n\n` +
|
|
186
|
+
`下载并校验制品后,从本地目录安装:\n\n` +
|
|
187
|
+
'```bash\n' +
|
|
188
|
+
`pnpm add ./package.tgz\n` +
|
|
189
|
+
'```\n\n' +
|
|
190
|
+
`## 创建客户端\n\n` +
|
|
191
|
+
'```ts\n' +
|
|
192
|
+
sdkUsageExample(context, context.packageName) +
|
|
193
|
+
'```\n\n' +
|
|
194
|
+
`## 认证\n\n` +
|
|
195
|
+
`示例中的 \`configureClient\` 通过参数注入短期访问令牌;不得把凭证写入源码、日志或制品。\n\n` +
|
|
196
|
+
`## 错误处理\n\n` +
|
|
197
|
+
`示例检查 \`result.error\` 并携带 HTTP 状态抛出错误。发布流水线会对同一份示例执行 TypeScript 严格类型检查,证据记录在 \`sdk-provenance.json\`。\n\n` +
|
|
198
|
+
`生成的 operation 函数与类型均来自同一份 ${context.audience} OpenAPI 制品;调用参数以生成的类型声明为准。\n`;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function sdkUsageExample(context, importSpecifier) {
|
|
202
|
+
const operation = operationEntries(context.document)[0];
|
|
203
|
+
if (!operation) throw new Error(`${context.service}/${context.audience} SDK requires at least one operation`);
|
|
204
|
+
const requestPath = operation.path.replaceAll(/\{[^}]+\}/g, 'example-id');
|
|
205
|
+
return `import { client } from '${importSpecifier}';\n\n` +
|
|
206
|
+
`export function configureClient(accessToken: string): void {\n` +
|
|
207
|
+
` client.setConfig({\n` +
|
|
208
|
+
` auth: async () => accessToken,\n` +
|
|
209
|
+
` baseUrl: 'https://api.example.com',\n` +
|
|
210
|
+
` });\n` +
|
|
211
|
+
`}\n\n` +
|
|
212
|
+
`export async function requestExample(): Promise<unknown> {\n` +
|
|
213
|
+
` const result = await client.${operation.method}({ url: '${requestPath}' });\n` +
|
|
214
|
+
` if (result.error !== undefined) {\n` +
|
|
215
|
+
` throw new Error(\`API request failed with status \${result.response?.status ?? 'unknown'}\`);\n` +
|
|
216
|
+
` }\n` +
|
|
217
|
+
` return result.data;\n` +
|
|
218
|
+
`}\n`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function listFiles(root) {
|
|
222
|
+
const result = [];
|
|
223
|
+
for (const entry of await readdir(root, { withFileTypes: true })) {
|
|
224
|
+
const path = resolve(root, entry.name);
|
|
225
|
+
if (entry.isDirectory()) result.push(...await listFiles(path));
|
|
226
|
+
else if (entry.isFile()) result.push(path);
|
|
227
|
+
}
|
|
228
|
+
return result.sort();
|
|
229
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const semanticVersionPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
|
|
2
|
+
|
|
3
|
+
export function isSemanticVersion(value) {
|
|
4
|
+
if (typeof value !== 'string') return false;
|
|
5
|
+
const match = semanticVersionPattern.exec(value);
|
|
6
|
+
return match?.[0] === value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function parseSemanticVersion(value) {
|
|
10
|
+
if (typeof value !== 'string') throw new Error(`invalid semantic version: ${String(value)}`);
|
|
11
|
+
const match = semanticVersionPattern.exec(value);
|
|
12
|
+
if (!match || match[0] !== value) throw new Error(`invalid semantic version: ${value}`);
|
|
13
|
+
return Object.freeze({
|
|
14
|
+
build: Object.freeze(match[5]?.split('.') ?? []),
|
|
15
|
+
major: match[1],
|
|
16
|
+
minor: match[2],
|
|
17
|
+
patch: match[3],
|
|
18
|
+
prerelease: Object.freeze(match[4]?.split('.') ?? []),
|
|
19
|
+
raw: value,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function compareSemanticVersions(left, right) {
|
|
24
|
+
const leftVersion = parseSemanticVersion(left);
|
|
25
|
+
const rightVersion = parseSemanticVersion(right);
|
|
26
|
+
for (const field of ['major', 'minor', 'patch']) {
|
|
27
|
+
const compared = compareNumericIdentifiers(leftVersion[field], rightVersion[field]);
|
|
28
|
+
if (compared !== 0) return compared;
|
|
29
|
+
}
|
|
30
|
+
return comparePrerelease(leftVersion.prerelease, rightVersion.prerelease);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function comparePrerelease(left, right) {
|
|
34
|
+
if (left.length === 0 || right.length === 0) {
|
|
35
|
+
if (left.length === right.length) return 0;
|
|
36
|
+
return left.length === 0 ? 1 : -1;
|
|
37
|
+
}
|
|
38
|
+
const length = Math.max(left.length, right.length);
|
|
39
|
+
for (let index = 0; index < length; index += 1) {
|
|
40
|
+
if (left[index] === undefined) return -1;
|
|
41
|
+
if (right[index] === undefined) return 1;
|
|
42
|
+
const leftNumeric = /^\d+$/.test(left[index]);
|
|
43
|
+
const rightNumeric = /^\d+$/.test(right[index]);
|
|
44
|
+
if (leftNumeric && rightNumeric) {
|
|
45
|
+
const compared = compareNumericIdentifiers(left[index], right[index]);
|
|
46
|
+
if (compared !== 0) return compared;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (leftNumeric !== rightNumeric) return leftNumeric ? -1 : 1;
|
|
50
|
+
const compared = compareASCII(left[index], right[index]);
|
|
51
|
+
if (compared !== 0) return compared;
|
|
52
|
+
}
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function compareNumericIdentifiers(left, right) {
|
|
57
|
+
if (left.length !== right.length) return left.length < right.length ? -1 : 1;
|
|
58
|
+
return compareASCII(left, right);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function compareASCII(left, right) {
|
|
62
|
+
if (left === right) return 0;
|
|
63
|
+
return left < right ? -1 : 1;
|
|
64
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { extname } from 'node:path';
|
|
2
|
+
|
|
3
|
+
const serviceContractSourceExtensions = Object.freeze(['.json', '.yaml', '.yml']);
|
|
4
|
+
|
|
5
|
+
export function isServiceContractBuildInput(path) {
|
|
6
|
+
const segments = path.replaceAll('\\', '/').split('/');
|
|
7
|
+
return !segments.includes('dist') && serviceContractSourceExtensions.includes(extname(path));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function serviceContractReviewPathspecs(sourceRoot) {
|
|
11
|
+
return Object.freeze([
|
|
12
|
+
...serviceContractSourceExtensions.map((extension) => `:(glob)${sourceRoot}/**/*${extension}`),
|
|
13
|
+
`:(glob,exclude)${sourceRoot}/conformance/**`,
|
|
14
|
+
`:(glob,exclude)${sourceRoot}/dist/**`,
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
buildComparisonPlan,
|
|
6
|
+
buildOASDiffArguments,
|
|
7
|
+
evaluateComparisonPolicy,
|
|
8
|
+
projectDocumentForOASDiff,
|
|
9
|
+
renderCompatibilityReportMarkdown,
|
|
10
|
+
semanticBreakingChanges,
|
|
11
|
+
} from '../breaking.mjs';
|
|
12
|
+
|
|
13
|
+
test('comparison plan rejects a service and audience slot removed from the protected base', () => {
|
|
14
|
+
const base = artifact();
|
|
15
|
+
const plan = buildComparisonPlan({
|
|
16
|
+
baseManifest: manifest([base]),
|
|
17
|
+
headManifest: manifest([]),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
assert.deepEqual(plan.errors, [{
|
|
21
|
+
after: null,
|
|
22
|
+
before: `platform-api/public/1.0.0/${'a'.repeat(64)}`,
|
|
23
|
+
code: 'artifact_identity_removed',
|
|
24
|
+
identity: 'platform-api/public',
|
|
25
|
+
}]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('comparison plan compares a same-version content change and preserves both full identities', () => {
|
|
29
|
+
const base = artifact();
|
|
30
|
+
const head = artifact({ digest: 'b' });
|
|
31
|
+
const plan = buildComparisonPlan({
|
|
32
|
+
baseManifest: manifest([base]),
|
|
33
|
+
headManifest: manifest([head]),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
assert.equal(plan.comparisons.length, 1);
|
|
37
|
+
assert.equal(
|
|
38
|
+
plan.comparisons[0].id,
|
|
39
|
+
`platform-api/public/1.0.0@${'a'.repeat(64)}->platform-api/public/1.0.0@${'b'.repeat(64)}`,
|
|
40
|
+
);
|
|
41
|
+
assert.equal(plan.comparisons[0].intentionalMajorVersionChange, false);
|
|
42
|
+
assert.deepEqual(plan.comparisons[0].origins, ['protected_base']);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('comparison plan pairs version changes by service and audience slot', () => {
|
|
46
|
+
const plan = buildComparisonPlan({
|
|
47
|
+
baseManifest: manifest([artifact({ apiVersion: '1.2.3' })]),
|
|
48
|
+
headManifest: manifest([artifact({ apiVersion: '1.3.0', digest: 'b' })]),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
assert.deepEqual(plan.errors, []);
|
|
52
|
+
assert.equal(plan.comparisons.length, 1);
|
|
53
|
+
assert.match(plan.comparisons[0].id, /^platform-api\/public\/1\.2\.3@.+->platform-api\/public\/1\.3\.0@/);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('comparison plan rejects semantic version downgrades', () => {
|
|
57
|
+
for (const [baseVersion, headVersion] of [
|
|
58
|
+
['1.1.0', '1.0.9'],
|
|
59
|
+
['1.0.0', '1.0.0-rc.1'],
|
|
60
|
+
]) {
|
|
61
|
+
const plan = buildComparisonPlan({
|
|
62
|
+
baseManifest: manifest([artifact({ apiVersion: baseVersion })]),
|
|
63
|
+
headManifest: manifest([artifact({ apiVersion: headVersion, digest: 'b' })]),
|
|
64
|
+
});
|
|
65
|
+
assert.deepEqual(plan.comparisons, []);
|
|
66
|
+
assert.deepEqual(plan.errors, [{
|
|
67
|
+
after: headVersion,
|
|
68
|
+
before: baseVersion,
|
|
69
|
+
code: 'artifact_version_downgraded',
|
|
70
|
+
identity: 'platform-api/public',
|
|
71
|
+
}]);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('comparison plan ordering is deterministic across manifest input order', () => {
|
|
76
|
+
const base = [
|
|
77
|
+
artifact({ audience: 'partner', service: 'zeta-api' }),
|
|
78
|
+
artifact({ audience: 'public', service: 'alpha-api', digest: 'b' }),
|
|
79
|
+
];
|
|
80
|
+
const head = [
|
|
81
|
+
artifact({ audience: 'partner', service: 'zeta-api', digest: 'c' }),
|
|
82
|
+
artifact({ audience: 'public', service: 'alpha-api', digest: 'd' }),
|
|
83
|
+
];
|
|
84
|
+
const forward = buildComparisonPlan({ baseManifest: manifest(base), headManifest: manifest(head) });
|
|
85
|
+
const reverse = buildComparisonPlan({
|
|
86
|
+
baseManifest: manifest([...base].reverse()),
|
|
87
|
+
headManifest: manifest([...head].reverse()),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
assert.deepEqual(reverse, forward);
|
|
91
|
+
assert.deepEqual(forward.comparisons.map((entry) => entry.base.service), ['alpha-api', 'zeta-api']);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('semantic gate reports an operation removed from the contract', () => {
|
|
95
|
+
const findings = semanticBreakingChanges(document({ operationId: 'getWidget' }), { paths: {} });
|
|
96
|
+
|
|
97
|
+
assert.deepEqual(findings, [{
|
|
98
|
+
after: null,
|
|
99
|
+
before: 'getWidget',
|
|
100
|
+
code: 'operation_removed',
|
|
101
|
+
identity: 'GET /widgets/{id}',
|
|
102
|
+
}]);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('semantic gate rejects operation identity and contract metadata regressions', () => {
|
|
106
|
+
const base = document({
|
|
107
|
+
operationId: 'getWidget',
|
|
108
|
+
'x-onex-audience': 'public',
|
|
109
|
+
'x-onex-lifecycle': lifecycle(),
|
|
110
|
+
'x-onex-stability': 'stable',
|
|
111
|
+
});
|
|
112
|
+
const head = document({
|
|
113
|
+
operationId: 'findWidget',
|
|
114
|
+
'x-onex-audience': 'partner',
|
|
115
|
+
'x-onex-lifecycle': lifecycle({ deprecated: '2026-08-01' }),
|
|
116
|
+
'x-onex-stability': 'beta',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
assert.deepEqual(semanticBreakingChanges(base, head).map((entry) => entry.code), [
|
|
120
|
+
'audience_visibility_reduced',
|
|
121
|
+
'operation_id_changed',
|
|
122
|
+
'stability_reduced',
|
|
123
|
+
]);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('semantic gate allows additive lifecycle metadata and rejects mutation after publication', () => {
|
|
127
|
+
const baseLifecycle = lifecycle({ deprecated: '2026-08-01' });
|
|
128
|
+
const additive = lifecycle({
|
|
129
|
+
deprecated: '2026-08-01',
|
|
130
|
+
migrationUrl: 'https://docs.example.com/migrate',
|
|
131
|
+
replacementOperationId: 'getWidgetV2',
|
|
132
|
+
sunset: '2028-08-01',
|
|
133
|
+
});
|
|
134
|
+
assert.deepEqual(semanticBreakingChanges(document({
|
|
135
|
+
operationId: 'getWidget',
|
|
136
|
+
'x-onex-lifecycle': baseLifecycle,
|
|
137
|
+
'x-onex-stability': 'stable',
|
|
138
|
+
}), document({
|
|
139
|
+
operationId: 'getWidget',
|
|
140
|
+
'x-onex-lifecycle': additive,
|
|
141
|
+
'x-onex-stability': 'stable',
|
|
142
|
+
})), []);
|
|
143
|
+
|
|
144
|
+
const changed = semanticBreakingChanges(document({
|
|
145
|
+
operationId: 'getWidget',
|
|
146
|
+
'x-onex-lifecycle': additive,
|
|
147
|
+
'x-onex-stability': 'stable',
|
|
148
|
+
}), document({
|
|
149
|
+
operationId: 'getWidget',
|
|
150
|
+
'x-onex-lifecycle': lifecycle({ deprecated: '2026-09-01' }),
|
|
151
|
+
'x-onex-stability': 'stable',
|
|
152
|
+
}));
|
|
153
|
+
assert.ok(changed.some((entry) => entry.code === 'lifecycle_deprecated_changed'));
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test('same-major removals fail for stable and zero-major version lines', () => {
|
|
157
|
+
const removal = semanticBreakingChanges(document({ operationId: 'getWidget' }), { paths: {} });
|
|
158
|
+
for (const [baseVersion, headVersion] of [
|
|
159
|
+
['1.0.0', '1.1.0'],
|
|
160
|
+
['0.1.0', '0.2.0'],
|
|
161
|
+
]) {
|
|
162
|
+
const outcome = evaluateComparisonPolicy(comparison(baseVersion, headVersion), {
|
|
163
|
+
oasdiffBreaking: false,
|
|
164
|
+
semanticFindings: removal,
|
|
165
|
+
});
|
|
166
|
+
assert.equal(outcome.status, 'failed');
|
|
167
|
+
assert.deepEqual(outcome.errors.map((entry) => entry.code), ['operation_removed']);
|
|
168
|
+
assert.deepEqual(outcome.versionFindings, []);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('same-version content changes still enforce operation removal policy', () => {
|
|
173
|
+
const removal = semanticBreakingChanges(document({ operationId: 'getWidget' }), { paths: {} });
|
|
174
|
+
const outcome = evaluateComparisonPolicy(comparison('1.0.0', '1.0.0'), {
|
|
175
|
+
oasdiffBreaking: true,
|
|
176
|
+
semanticFindings: removal,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
assert.equal(outcome.status, 'failed');
|
|
180
|
+
assert.deepEqual(outcome.errors.map((entry) => entry.code), [
|
|
181
|
+
'oasdiff_breaking_change',
|
|
182
|
+
'operation_removed',
|
|
183
|
+
]);
|
|
184
|
+
assert.deepEqual(outcome.versionFindings, []);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test('major version changes retain breaking findings without failing the gate', () => {
|
|
188
|
+
const removal = semanticBreakingChanges(document({ operationId: 'getWidget' }), { paths: {} });
|
|
189
|
+
const candidate = comparison('1.9.0', '2.0.0');
|
|
190
|
+
const outcome = evaluateComparisonPolicy(candidate, {
|
|
191
|
+
oasdiffBreaking: true,
|
|
192
|
+
semanticFindings: removal,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
assert.deepEqual(outcome.errors, []);
|
|
196
|
+
assert.equal(outcome.status, 'intentional_major_version_change');
|
|
197
|
+
assert.deepEqual(outcome.versionFindings, [{
|
|
198
|
+
after: '2.0.0',
|
|
199
|
+
before: '1.9.0',
|
|
200
|
+
code: 'intentional_major_version_change',
|
|
201
|
+
identity: 'platform-api/public',
|
|
202
|
+
}]);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test('nonbreaking patch, minor, and major version changes pass', () => {
|
|
206
|
+
for (const headVersion of ['1.2.4', '1.3.0', '2.0.0']) {
|
|
207
|
+
const outcome = evaluateComparisonPolicy(comparison('1.2.3', headVersion), {
|
|
208
|
+
oasdiffBreaking: false,
|
|
209
|
+
semanticFindings: [],
|
|
210
|
+
});
|
|
211
|
+
assert.deepEqual(outcome.errors, []);
|
|
212
|
+
assert.equal(outcome.status, headVersion === '2.0.0' ? 'intentional_major_version_change' : 'compatible');
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test('oasdiff arguments disable clock-dependent beta and stable deprecation windows', () => {
|
|
217
|
+
assert.deepEqual(buildOASDiffArguments('/tmp/base.json', '/tmp/head.json'), [
|
|
218
|
+
'breaking',
|
|
219
|
+
'/tmp/base.json',
|
|
220
|
+
'/tmp/head.json',
|
|
221
|
+
'--allow-external-refs=false',
|
|
222
|
+
'--attributes',
|
|
223
|
+
'x-onex-audience,x-onex-stability,x-onex-lifecycle',
|
|
224
|
+
'--deprecation-days-beta',
|
|
225
|
+
'4294967295',
|
|
226
|
+
'--deprecation-days-stable',
|
|
227
|
+
'4294967295',
|
|
228
|
+
'--fail-on',
|
|
229
|
+
'ERR',
|
|
230
|
+
'--format',
|
|
231
|
+
'json',
|
|
232
|
+
'--include-path-params',
|
|
233
|
+
]);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test('oasdiff projection preserves OpenAPI data while adapting every boolean Schema slot', () => {
|
|
237
|
+
const source = {
|
|
238
|
+
components: {
|
|
239
|
+
schemas: {
|
|
240
|
+
ClosedChoice: {
|
|
241
|
+
additionalProperties: false,
|
|
242
|
+
oneOf: [
|
|
243
|
+
{
|
|
244
|
+
properties: {
|
|
245
|
+
forbidden: false,
|
|
246
|
+
unconstrained: true,
|
|
247
|
+
visible: { readOnly: true, type: 'boolean' },
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
paths: {
|
|
255
|
+
'/closed': {
|
|
256
|
+
get: {
|
|
257
|
+
responses: {
|
|
258
|
+
200: {
|
|
259
|
+
content: {
|
|
260
|
+
'application/json': { schema: false },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
'x-onex-evidence': { schema: false },
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const projected = projectDocumentForOASDiff(source);
|
|
271
|
+
|
|
272
|
+
assert.deepEqual(projected.components.schemas.ClosedChoice.additionalProperties, { not: {} });
|
|
273
|
+
assert.deepEqual(projected.components.schemas.ClosedChoice.oneOf[0].properties.forbidden, { not: {} });
|
|
274
|
+
assert.deepEqual(projected.components.schemas.ClosedChoice.oneOf[0].properties.unconstrained, {});
|
|
275
|
+
assert.equal(projected.components.schemas.ClosedChoice.oneOf[0].properties.visible.readOnly, true);
|
|
276
|
+
assert.deepEqual(projected.paths['/closed'].get.responses[200].content['application/json'].schema, { not: {} });
|
|
277
|
+
assert.deepEqual(projected.paths['/closed'].get['x-onex-evidence'], { schema: false });
|
|
278
|
+
assert.equal(source.components.schemas.ClosedChoice.additionalProperties, false);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
test('Markdown evidence separates allowed major-version findings from gate errors', () => {
|
|
282
|
+
const candidate = comparison('1.0.0', '2.0.0');
|
|
283
|
+
const removal = semanticBreakingChanges(document({ operationId: 'getWidget' }), { paths: {} });
|
|
284
|
+
const outcome = evaluateComparisonPolicy(candidate, {
|
|
285
|
+
oasdiffBreaking: true,
|
|
286
|
+
semanticFindings: removal,
|
|
287
|
+
});
|
|
288
|
+
const markdown = renderCompatibilityReportMarkdown({
|
|
289
|
+
base_revision: 'a'.repeat(40),
|
|
290
|
+
candidate_revision: 'b'.repeat(40),
|
|
291
|
+
comparisons: [{
|
|
292
|
+
base_api_version: candidate.base.api_version,
|
|
293
|
+
base_sha256: candidate.base.sha256,
|
|
294
|
+
head_api_version: candidate.head.api_version,
|
|
295
|
+
head_sha256: candidate.head.sha256,
|
|
296
|
+
id: candidate.id,
|
|
297
|
+
oasdiff: [{ id: 'paths' }],
|
|
298
|
+
oasdiff_breaking: true,
|
|
299
|
+
origins: candidate.origins,
|
|
300
|
+
semantic_findings: removal,
|
|
301
|
+
status: outcome.status,
|
|
302
|
+
version_findings: outcome.versionFindings,
|
|
303
|
+
}],
|
|
304
|
+
errors: outcome.errors,
|
|
305
|
+
fingerprint: 'c'.repeat(64),
|
|
306
|
+
schema_version: 1,
|
|
307
|
+
tool_versions: { oasdiff: '1.23.0' },
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
assert.match(markdown, /oasdiff breaking=yes, findings=1/);
|
|
311
|
+
assert.match(markdown, /OneX semantic=operation_removed/);
|
|
312
|
+
assert.match(markdown, /version=intentional_major_version_change/);
|
|
313
|
+
assert.match(markdown, /No gate-blocking compatibility findings\./);
|
|
314
|
+
assert.doesNotMatch(markdown, /No compatibility findings\./);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
function comparison(baseVersion, headVersion) {
|
|
318
|
+
const plan = buildComparisonPlan({
|
|
319
|
+
baseManifest: manifest([artifact({ apiVersion: baseVersion })]),
|
|
320
|
+
headManifest: manifest([artifact({ apiVersion: headVersion, digest: 'b' })]),
|
|
321
|
+
});
|
|
322
|
+
assert.deepEqual(plan.errors, []);
|
|
323
|
+
assert.equal(plan.comparisons.length, 1);
|
|
324
|
+
return plan.comparisons[0];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function artifact({
|
|
328
|
+
apiVersion = '1.0.0',
|
|
329
|
+
audience = 'public',
|
|
330
|
+
digest = 'a',
|
|
331
|
+
service = 'platform-api',
|
|
332
|
+
} = {}) {
|
|
333
|
+
return {
|
|
334
|
+
api_version: apiVersion,
|
|
335
|
+
audience,
|
|
336
|
+
path: `services/${service}/dist/${audience}.openapi.json`,
|
|
337
|
+
service,
|
|
338
|
+
sha256: digest.repeat(64),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function manifest(artifacts) {
|
|
343
|
+
return { artifacts, schema_version: 1 };
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function document(operation) {
|
|
347
|
+
return {
|
|
348
|
+
paths: {
|
|
349
|
+
'/widgets/{id}': {
|
|
350
|
+
get: operation,
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function lifecycle(overrides = {}) {
|
|
357
|
+
return {
|
|
358
|
+
deprecated: null,
|
|
359
|
+
introduced: '2026-07-16',
|
|
360
|
+
migrationUrl: null,
|
|
361
|
+
replacementOperationId: null,
|
|
362
|
+
sunset: null,
|
|
363
|
+
...overrides,
|
|
364
|
+
};
|
|
365
|
+
}
|