@bluefly/openstandardagents 0.2.4 → 0.2.5-RC
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/.cursorrules +84 -0
- package/.devfile.yaml +87 -0
- package/.env.example +25 -3
- package/.github/workflows/release.yml +1 -1
- package/.kiro/specs/agent-buildkit-templates/design.md +495 -0
- package/.kiro/specs/agent-buildkit-templates/requirements.md +165 -0
- package/.kiro/specs/kiro-ide-supercharger/README.md +202 -0
- package/.kiro/specs/kiro-ide-supercharger/design.md +1005 -0
- package/.kiro/specs/kiro-ide-supercharger/requirements.md +141 -0
- package/.kiro/specs/kiro-ide-supercharger/tasks.md +507 -0
- package/.kiro/specs/website-design-audit/design.md +679 -0
- package/.kiro/specs/website-design-audit/requirements.md +199 -0
- package/.releaserc.json +5 -4
- package/.version.json +6 -0
- package/CHANGELOG.md +140 -96
- package/CONTRIBUTING.md +23 -5
- package/README.md +121 -43
- package/bin/ossa +24 -3
- package/bin/ossa-validate-all +55 -0
- package/bin/ossa-version +23 -0
- package/bin/validate-ossa-0.2.4.ts +244 -0
- package/bin/validate-ossa-0.2.5-RC.ts +244 -0
- package/bin/validate-ossa.ts +273 -0
- package/dist/di-container.d.ts +1 -1
- package/dist/di-container.d.ts.map +1 -1
- package/dist/di-container.js.map +1 -1
- package/dist/repositories/schema.repository.d.ts +17 -2
- package/dist/repositories/schema.repository.d.ts.map +1 -1
- package/dist/repositories/schema.repository.js +96 -18
- package/dist/repositories/schema.repository.js.map +1 -1
- package/dist/services/generation.service.d.ts +7 -5
- package/dist/services/generation.service.d.ts.map +1 -1
- package/dist/services/generation.service.js +92 -44
- package/dist/services/generation.service.js.map +1 -1
- package/dist/services/gitlab-agent.service.d.ts +94 -0
- package/dist/services/gitlab-agent.service.d.ts.map +1 -0
- package/dist/services/gitlab-agent.service.js +162 -0
- package/dist/services/gitlab-agent.service.js.map +1 -0
- package/dist/services/migration.service.d.ts +3 -3
- package/dist/services/migration.service.d.ts.map +1 -1
- package/dist/services/migration.service.js +108 -61
- package/dist/services/migration.service.js.map +1 -1
- package/dist/services/release-automation/base-crud.service.d.ts +93 -0
- package/dist/services/release-automation/base-crud.service.d.ts.map +1 -0
- package/dist/services/release-automation/base-crud.service.js +68 -0
- package/dist/services/release-automation/base-crud.service.js.map +1 -0
- package/dist/services/release-automation/index.d.ts +12 -0
- package/dist/services/release-automation/index.d.ts.map +1 -0
- package/dist/services/release-automation/index.js +12 -0
- package/dist/services/release-automation/index.js.map +1 -0
- package/dist/services/release-automation/merge-request.service.d.ts +119 -0
- package/dist/services/release-automation/merge-request.service.d.ts.map +1 -0
- package/dist/services/release-automation/merge-request.service.js +212 -0
- package/dist/services/release-automation/merge-request.service.js.map +1 -0
- package/dist/services/release-automation/milestone.service.d.ts +104 -0
- package/dist/services/release-automation/milestone.service.d.ts.map +1 -0
- package/dist/services/release-automation/milestone.service.js +207 -0
- package/dist/services/release-automation/milestone.service.js.map +1 -0
- package/dist/services/release-automation/release.service.d.ts +118 -0
- package/dist/services/release-automation/release.service.d.ts.map +1 -0
- package/dist/services/release-automation/release.service.js +207 -0
- package/dist/services/release-automation/release.service.js.map +1 -0
- package/dist/services/release-automation/schemas/release.schema.d.ts +299 -0
- package/dist/services/release-automation/schemas/release.schema.d.ts.map +1 -0
- package/dist/services/release-automation/schemas/release.schema.js +269 -0
- package/dist/services/release-automation/schemas/release.schema.js.map +1 -0
- package/dist/services/release-automation/tag.service.d.ts +99 -0
- package/dist/services/release-automation/tag.service.d.ts.map +1 -0
- package/dist/services/release-automation/tag.service.js +180 -0
- package/dist/services/release-automation/tag.service.js.map +1 -0
- package/dist/services/release-automation/webhook.service.d.ts +37 -0
- package/dist/services/release-automation/webhook.service.d.ts.map +1 -0
- package/dist/services/release-automation/webhook.service.js +173 -0
- package/dist/services/release-automation/webhook.service.js.map +1 -0
- package/dist/services/runtime/openai.adapter.d.ts.map +1 -1
- package/dist/services/runtime/openai.adapter.js.map +1 -1
- package/dist/services/validation.service.d.ts.map +1 -1
- package/dist/services/validation.service.js +24 -11
- package/dist/services/validation.service.js.map +1 -1
- package/dist/services/validators/anthropic.validator.d.ts +2 -2
- package/dist/services/validators/anthropic.validator.d.ts.map +1 -1
- package/dist/services/validators/anthropic.validator.js +14 -9
- package/dist/services/validators/anthropic.validator.js.map +1 -1
- package/dist/services/validators/autogen.validator.d.ts +2 -2
- package/dist/services/validators/autogen.validator.d.ts.map +1 -1
- package/dist/services/validators/autogen.validator.js +18 -15
- package/dist/services/validators/autogen.validator.js.map +1 -1
- package/dist/services/validators/crewai.validator.d.ts +2 -2
- package/dist/services/validators/crewai.validator.d.ts.map +1 -1
- package/dist/services/validators/crewai.validator.js +18 -17
- package/dist/services/validators/crewai.validator.js.map +1 -1
- package/dist/services/validators/cursor.validator.d.ts +2 -2
- package/dist/services/validators/cursor.validator.d.ts.map +1 -1
- package/dist/services/validators/cursor.validator.js +15 -11
- package/dist/services/validators/cursor.validator.js.map +1 -1
- package/dist/services/validators/langchain.validator.d.ts +2 -2
- package/dist/services/validators/langchain.validator.d.ts.map +1 -1
- package/dist/services/validators/langchain.validator.js +14 -11
- package/dist/services/validators/langchain.validator.js.map +1 -1
- package/dist/services/validators/langflow.validator.d.ts +2 -2
- package/dist/services/validators/langflow.validator.d.ts.map +1 -1
- package/dist/services/validators/langflow.validator.js +14 -9
- package/dist/services/validators/langflow.validator.js.map +1 -1
- package/dist/services/validators/langgraph.validator.d.ts +2 -2
- package/dist/services/validators/langgraph.validator.d.ts.map +1 -1
- package/dist/services/validators/langgraph.validator.js +23 -18
- package/dist/services/validators/langgraph.validator.js.map +1 -1
- package/dist/services/validators/llamaindex.validator.d.ts +2 -2
- package/dist/services/validators/llamaindex.validator.d.ts.map +1 -1
- package/dist/services/validators/llamaindex.validator.js +19 -16
- package/dist/services/validators/llamaindex.validator.js.map +1 -1
- package/dist/services/validators/openai.validator.d.ts +2 -2
- package/dist/services/validators/openai.validator.d.ts.map +1 -1
- package/dist/services/validators/openai.validator.js +20 -16
- package/dist/services/validators/openai.validator.js.map +1 -1
- package/dist/services/validators/vercel-ai.validator.d.ts +2 -2
- package/dist/services/validators/vercel-ai.validator.d.ts.map +1 -1
- package/dist/services/validators/vercel-ai.validator.js +16 -15
- package/dist/services/validators/vercel-ai.validator.js.map +1 -1
- package/dist/spec/v0.2.0/ossa-0.2.0.schema.json +0 -0
- package/dist/spec/v0.2.1/ossa-0.2.1.schema.json +555 -0
- package/dist/spec/v0.2.3/CHANGELOG.md +7 -7
- package/dist/spec/v0.2.3/README.md +9 -9
- package/dist/spec/v0.2.3/migrations/v0.2.2-to-v0.2.3.md +18 -18
- package/{spec/v0.2.4-dev → dist/spec/v0.2.4}/CHANGELOG.md +8 -8
- package/dist/spec/{v0.2.4-dev → v0.2.4}/migrations/v0.2.3-to-v0.2.4.md +10 -10
- package/dist/spec/{v0.2.4-dev → v0.2.4}/ossa-0.2.4-dev.yaml +1 -1
- package/dist/spec/v0.2.4/ossa-0.2.4.schema.json +1819 -0
- package/dist/spec/v0.2.5/CHANGELOG.md +401 -0
- package/dist/spec/v0.2.5/README.md +72 -0
- package/dist/spec/v0.2.5/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/{v0.2.5-dev/ossa-0.2.5-dev.schema.json → v0.2.5/ossa-0.2.5.schema.json} +323 -359
- package/dist/spec/v0.2.5/ossa-0.2.5.yaml +581 -0
- package/dist/spec/v0.2.5-RC/CHANGELOG.md +401 -0
- package/dist/spec/v0.2.5-RC/README.md +72 -0
- package/{spec/v0.2.4-dev → dist/spec/v0.2.5-RC}/migrations/v0.2.3-to-v0.2.4.md +10 -10
- package/dist/spec/v0.2.5-RC/ossa-0.2.5-RC.schema.json +1696 -0
- package/dist/spec/v0.2.5-RC/ossa-0.2.5-RC.yaml +581 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/index.d.ts.map +1 -1
- package/docs/issue-19-completion-summary.md +648 -0
- package/docs/issue-19-validation.md +351 -0
- package/examples/anthropic/claude-assistant.ossa.json +1 -1
- package/examples/autogen/multi-agent.ossa.json +1 -1
- package/examples/bridges/Dockerfile.production +1 -1
- package/examples/crewai/research-team.ossa.json +1 -1
- package/examples/cursor/code-review-agent.ossa.json +1 -1
- package/examples/enterprise/agent.yml +1 -1
- package/examples/getting-started/hello-world-complete.ossa.yaml +2 -2
- package/examples/integration-patterns/agent-to-agent-orchestration.ossa.yaml +4 -4
- package/examples/langchain/chain-agent.ossa.json +1 -1
- package/examples/langflow/workflow-agent.ossa.json +1 -1
- package/examples/langgraph/state-machine-agent.ossa.json +1 -1
- package/examples/llamaindex/rag-agent.ossa.json +1 -1
- package/examples/openai/basic-agent.ossa.yaml +61 -0
- package/examples/openai/multi-tool-agent.ossa.json +165 -0
- package/examples/openai/swarm-agent.ossa.json +1 -1
- package/examples/openapi-extensions/README.md +1 -1
- package/examples/quickstart/support-agent.ossa.yaml +1 -1
- package/examples/vercel/edge-agent.ossa.json +1 -1
- package/infrastructure/gitlab-agent/rbac.yaml +126 -0
- package/infrastructure/gitlab-agent/values.yaml +150 -0
- package/infrastructure/k8s/monitoring/00-namespace.yaml +7 -0
- package/infrastructure/k8s/monitoring/01-prometheus.yaml +142 -0
- package/infrastructure/k8s/monitoring/02-grafana.yaml +63 -0
- package/infrastructure/k8s/monitoring/03-lightweight.yaml +121 -0
- package/infrastructure/k8s/monitoring/README.md +73 -0
- package/infrastructure/k8s/monitoring/deploy.sh +38 -0
- package/openapi/CHANGELOG.md +21 -0
- package/openapi/README.md +46 -0
- package/openapi/{ossa-core-api.openapi.yaml → core/ossa-core-api.openapi.yaml} +59 -4
- package/openapi/{ossa-registry.openapi.yaml → core/ossa-registry.openapi.yaml} +75 -2
- package/openapi/{unified-agent-gateway.openapi.yaml → core/unified-agent-gateway.openapi.yaml} +3 -3
- package/openapi/reference-implementations/aiflow-bridge-api.openapi.yaml +136 -0
- package/openapi/reference-implementations/compliance-agent-api.openapi.yaml +192 -0
- package/openapi/reference-implementations/crewai-agent-api.openapi.yaml +149 -0
- package/openapi/reference-implementations/critic-agent-api.openapi.yaml +151 -0
- package/openapi/reference-implementations/document-analyzer-api.openapi.yaml +217 -0
- package/openapi/reference-implementations/getting-started-hello-world-api.openapi.yaml +149 -0
- package/openapi/reference-implementations/gitlab-ml-recommender-api.openapi.yaml +151 -0
- package/openapi/reference-implementations/governor-agent-api.openapi.yaml +193 -0
- package/openapi/reference-implementations/integrator-agent-api.openapi.yaml +165 -0
- package/openapi/reference-implementations/judge-agent-api.openapi.yaml +148 -0
- package/openapi/reference-implementations/k8s-troubleshooter-api.openapi.yaml +167 -0
- package/openapi/reference-implementations/langchain-agent-api.openapi.yaml +171 -0
- package/openapi/reference-implementations/monitor-agent-api.openapi.yaml +171 -0
- package/openapi/reference-implementations/orchestrator-agent-api.openapi.yaml +242 -0
- package/openapi/reference-implementations/quickstart-support-agent-api.openapi.yaml +187 -0
- package/openapi/{self-evolving-ecosystem.openapi.yaml → reference-implementations/self-evolving-ecosystem.openapi.yaml} +2 -2
- package/openapi/reference-implementations/worker-agent-api.openapi.yaml +208 -0
- package/openapi/reference-implementations/workflow-orchestrator-api.openapi.yaml +193 -0
- package/package.json +31 -21
- package/release.config.js +20 -5
- package/scripts/bump-version.ts +57 -0
- package/scripts/enhanced-version-manager.ts +257 -0
- package/scripts/gen-types.ts +51 -0
- package/scripts/gen-zod.ts +51 -0
- package/scripts/lib/exec.ts +37 -0
- package/scripts/lib/file-ops.ts +58 -0
- package/scripts/lib/version.ts +83 -0
- package/scripts/process-doc-templates.ts +37 -0
- package/scripts/schemas/package.schema.ts +75 -0
- package/scripts/setup-branch-protection.sh +33 -0
- package/scripts/sync-version.ts +39 -0
- package/scripts/sync-versions.ts +488 -0
- package/scripts/validate-schema.ts +49 -0
- package/spec/v0.2.0/ossa-0.2.0.schema.json +0 -0
- package/spec/v0.2.1/ossa-0.2.1.schema.json +555 -0
- package/spec/v0.2.3/CHANGELOG.md +7 -7
- package/spec/v0.2.3/README.md +9 -9
- package/spec/v0.2.3/migrations/v0.2.2-to-v0.2.3.md +18 -18
- package/{dist/spec/v0.2.4-dev → spec/v0.2.4}/CHANGELOG.md +8 -8
- package/spec/v0.2.4/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/{v0.2.4-dev → v0.2.4}/ossa-0.2.4-dev.yaml +1 -1
- package/spec/v0.2.4/ossa-0.2.4.schema.json +1819 -0
- package/spec/v0.2.5/CHANGELOG.md +401 -0
- package/spec/v0.2.5/README.md +72 -0
- package/spec/v0.2.5/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/{v0.2.5-dev/ossa-0.2.5-dev.schema.json → v0.2.5/ossa-0.2.5.schema.json} +323 -359
- package/spec/v0.2.5/ossa-0.2.5.yaml +581 -0
- package/spec/v0.2.5-RC/CHANGELOG.md +401 -0
- package/spec/v0.2.5-RC/README.md +72 -0
- package/spec/v0.2.5-RC/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.5-RC/ossa-0.2.5-RC.schema.json +1696 -0
- package/spec/v0.2.5-RC/ossa-0.2.5-RC.yaml +581 -0
- package/website/{.lighthouserc.js → .lighthouserc.ts} +5 -1
- package/website/Dockerfile +18 -5
- package/website/app/about/page.tsx +7 -7
- package/website/app/blog/[slug]/page.tsx +61 -20
- package/website/app/blog/page.tsx +120 -33
- package/website/app/design-guide/page.tsx +511 -0
- package/website/app/docs/[[...slug]]/page.tsx +641 -143
- package/website/app/examples/page.tsx +51 -41
- package/website/app/{globals.css → globals.scss} +50 -23
- package/website/app/layout.tsx +2 -2
- package/website/app/license/page.tsx +183 -0
- package/website/app/not-found.tsx +18 -0
- package/website/app/page.tsx +144 -79
- package/website/app/playground/page.tsx +25 -45
- package/website/app/schema/page.tsx +423 -392
- package/website/app/specification/page.tsx +245 -169
- package/website/components/Logo.tsx +75 -2
- package/website/components/docs/DocsSidebar.tsx +40 -3
- package/website/components/docs/MarkdownContent.tsx +265 -47
- package/website/components/docs/VersionSelector.tsx +64 -8
- package/website/components/examples/ExamplesViewer.tsx +2 -2
- package/website/components/layout/Footer.tsx +6 -1
- package/website/components/layout/Header.tsx +31 -33
- package/website/components/schema/SchemaComponentsAccordion.tsx +84 -0
- package/website/components/schema/SchemaExplorer.tsx +4 -4
- package/website/content/blog/OpenAPI-AI-Agents-Standard.md +276 -276
- package/website/content/blog/Why-Formal-Standards-Matter-Now.md +3 -14
- package/website/content/blog/gitlab-kubernetes-agent-ecosystem.md +286 -0
- package/website/content/blog/introducing-ossa-framework.md +1 -1
- package/website/content/blog/ossa-production-results.md +5 -5
- package/website/content/blog/welcome-to-ossa.md +2 -2
- package/website/content/blog/why-ai-agents-need-open-standard.md +5 -5
- package/website/content/docs/00-HOME.md +18 -25
- package/website/content/docs/AIFlow-Framework-Integration-with-OSSA.md +8 -8
- package/website/content/docs/OpenAPI-Extensions.md +576 -140
- package/website/content/docs/adapters/openai-adapter.md +693 -0
- package/website/content/docs/architecture/execution-flow.md +3 -3
- package/website/content/docs/architecture/multi-agent-systems.md +4 -4
- package/website/content/docs/architecture/overview.md +4 -4
- package/website/content/docs/architecture/stack-integration.md +4 -4
- package/website/content/docs/changelog.md +4 -4
- package/website/content/docs/contributing.md +2 -2
- package/website/content/docs/ecosystem/framework-support.md +0 -2
- package/website/content/docs/examples/AIFlow-Framework-Integration-with-OSSA.md +107 -0
- package/website/content/docs/examples/Migration-Guides.md +2 -2
- package/website/content/docs/for-audiences/{architects.md → Architects.md} +1 -1
- package/website/content/docs/for-audiences/{developers.md → Developers.md} +3 -3
- package/website/content/docs/for-audiences/Enterprises.md +2 -2
- package/website/content/docs/for-audiences/Students-Researchers.md +1 -1
- package/website/content/docs/getting-started/{5-minute-overview.md → 5-Minute-Overview.md} +2 -2
- package/website/content/docs/getting-started/{first-agent.md → First-Agent.md} +1 -1
- package/website/content/docs/getting-started/Hello-World.md +3 -3
- package/website/content/docs/getting-started/{installation.md → Installation.md} +7 -7
- package/website/content/docs/getting-started/index.md +92 -0
- package/website/content/docs/getting-started/running-agents.md +215 -13
- package/{docs → website/content/docs}/getting-started.md +10 -6
- package/website/content/docs/integrations/aiflow.md +2 -2
- package/website/content/docs/integrations/drupal.md +2 -2
- package/website/content/docs/migration-guides/README.md +1 -1
- package/website/content/docs/migration-guides/agent-schema-comparison.md +232 -0
- package/website/content/docs/migration-guides/anthropic-mcp-to-ossa.md +5 -5
- package/website/content/docs/migration-guides/crewai-to-ossa.md +3 -3
- package/website/content/docs/migration-guides/drupal-eca-to-ossa.md +11 -11
- package/{docs/migration → website/content/docs/migration-guides}/general-agent-schema.yml +1 -9
- package/website/content/docs/migration-guides/index.md +1 -1
- package/website/content/docs/migration-guides/langchain-to-ossa.md +17 -17
- package/website/content/docs/migration-guides/langflow-to-ossa.md +3 -3
- package/website/content/docs/migration-guides/openai-to-ossa.md +10 -10
- package/website/content/docs/openapi-extensions/examples.md +9 -9
- package/website/content/docs/openapi-extensions/index.md +59 -3
- package/website/content/docs/openapi-extensions/operation-extensions.md +61 -2
- package/website/content/docs/openapi-extensions/root-extensions.md +49 -3
- package/{docs/OSSA-COMPLIANT-BADGE.md → website/content/docs/ossa-compliant-badge.md} +18 -15
- package/website/content/docs/pre-release/index.md +10 -10
- package/website/content/docs/readme.md +35 -0
- package/website/content/docs/schema-reference/agent-spec.md +2 -2
- package/website/content/docs/schema-reference/autonomy.md +5 -5
- package/website/content/docs/schema-reference/constraints.md +5 -5
- package/website/content/docs/schema-reference/llm-config.md +1 -1
- package/website/content/docs/schema-reference/observability.md +5 -5
- package/website/content/docs/schema-reference/ossa-manifest.md +6 -6
- package/website/content/docs/schema-reference/taxonomy.md +3 -3
- package/website/content/docs/use-cases/00-index.md +1 -1
- package/{docs/VERSIONING.md → website/content/docs/versioning.md} +9 -5
- package/website/lib/version.ts +18 -1
- package/website/lib/versions.json +78 -0
- package/website/next.config.ts +3 -1
- package/website/package-lock.json +552 -18
- package/website/package.json +11 -5
- package/website/postcss.config.mjs +1 -1
- package/website/scripts/fetch-versions.js +166 -0
- package/website/scripts/generate-examples-index.js +163 -0
- package/website/scripts/merge-docs-to-wiki.ts +207 -0
- package/website/scripts/sync-version.js +28 -0
- package/website/scripts/sync-wiki.ts +64 -3
- package/website/scripts/upload-wiki.ts +199 -0
- package/website/styles/_variables.scss +36 -0
- package/website/tailwind.config.ts +93 -22
- package/.releaserc.json.disabled +0 -81
- package/dist/spec/v0.2.5-dev/CHANGELOG.md +0 -171
- package/dist/spec/v0.2.5-dev/examples/customer-support-graph.ossa.yaml +0 -362
- package/dist/spec/v0.2.5-dev/examples/parallel-processors.ossa.yaml +0 -464
- package/dist/spec/v0.2.5-dev/examples/research-team.ossa.yaml +0 -440
- package/dist/spec/v0.2.5-dev/migrations/v0.2.4-to-v0.2.5.md +0 -317
- package/dist/spec/v0.2.5-dev/ossa-0.2.5-dev.yaml +0 -409
- package/docs/README.md +0 -31
- package/docs/agent-openapi-spec.yml +0 -942
- package/docs/openapi-extensions.md +0 -930
- package/docs/schemas/openapi-extensions.schema.json +0 -486
- package/openapi/gitlab-orchestrator.openapi.yaml +0 -330
- package/ossa-website-swarm-tasks.json +0 -105
- package/spec/v0.2.5-dev/CHANGELOG.md +0 -171
- package/spec/v0.2.5-dev/examples/customer-support-graph.ossa.yaml +0 -362
- package/spec/v0.2.5-dev/examples/parallel-processors.ossa.yaml +0 -464
- package/spec/v0.2.5-dev/examples/research-team.ossa.yaml +0 -440
- package/spec/v0.2.5-dev/migrations/v0.2.4-to-v0.2.5.md +0 -317
- package/spec/v0.2.5-dev/ossa-0.2.5-dev.yaml +0 -409
- package/website/app/api/validate/route.ts +0 -88
- package/website/next.config.js +0 -17
- package/website/postcss.config.js +0 -7
- package/website/tailwind.config.js +0 -58
- /package/dist/spec/{v0.2.4-dev → v0.2.4}/ossa-0.2.4-dev.schema.json +0 -0
- /package/openapi/{ossa-registry-api.openapi.yaml → core/ossa-registry-api.openapi.yaml} +0 -0
- /package/openapi/{drupal-agent-api.openapi.yaml → reference-implementations/drupal-agent-api.openapi.yaml} +0 -0
- /package/openapi/{helm-generator.openapi.yaml → reference-implementations/helm-generator.openapi.yaml} +0 -0
- /package/spec/{v0.2.4-dev → v0.2.4}/ossa-0.2.4-dev.schema.json +0 -0
- /package/website/content/docs/{examples.md → Examples.md} +0 -0
- /package/website/content/docs/core-concepts/{project-structure.md → Project-Structure.md} +0 -0
- /package/website/content/docs/migration-guides/{00-index.md → 00-INDEX.md} +0 -0
- /package/{docs/migration → website/content/docs/migration-guides}/migration-manifest.json +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced Version Manager Script
|
|
4
|
+
*
|
|
5
|
+
* Integrates with GitLab agents for automated version management.
|
|
6
|
+
* Can run standalone or be invoked by GitLab agents.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - GitLab API integration for milestone-based versioning
|
|
10
|
+
* - Automated MR creation
|
|
11
|
+
* - Version consistency validation
|
|
12
|
+
* - Documentation template processing
|
|
13
|
+
* - GitLab agent orchestration
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
19
|
+
import { execSync } from 'child_process';
|
|
20
|
+
import { z } from 'zod';
|
|
21
|
+
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = path.dirname(__filename);
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Configuration
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
const VERSION_FILE = path.join(process.cwd(), '.version.json');
|
|
30
|
+
const GITLAB_API_URL = process.env.CI_API_V4_URL || process.env.GITLAB_API_URL || 'https://gitlab.com/api/v4';
|
|
31
|
+
// Use service account token (preferred) or fallback to user token
|
|
32
|
+
const GITLAB_TOKEN = process.env.SERVICE_ACCOUNT_VERSION_MANAGER_TOKEN ||
|
|
33
|
+
process.env.GITLAB_TOKEN ||
|
|
34
|
+
process.env.GITLAB_PUSH_TOKEN || '';
|
|
35
|
+
const PROJECT_ID = process.env.CI_PROJECT_ID || '';
|
|
36
|
+
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Zod Schemas
|
|
39
|
+
// ============================================================================
|
|
40
|
+
|
|
41
|
+
const VersionConfigSchema = z.object({
|
|
42
|
+
current: z.string(),
|
|
43
|
+
latest_stable: z.string(),
|
|
44
|
+
spec_path: z.string(),
|
|
45
|
+
schema_file: z.string(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const BumpTypeSchema = z.enum(['major', 'minor', 'patch', 'rc', 'release']);
|
|
49
|
+
|
|
50
|
+
type VersionConfig = z.infer<typeof VersionConfigSchema>;
|
|
51
|
+
type BumpType = z.infer<typeof BumpTypeSchema>;
|
|
52
|
+
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// Version Management
|
|
55
|
+
// ============================================================================
|
|
56
|
+
|
|
57
|
+
function getVersionConfig(): VersionConfig {
|
|
58
|
+
if (!fs.existsSync(VERSION_FILE)) {
|
|
59
|
+
throw new Error('.version.json not found');
|
|
60
|
+
}
|
|
61
|
+
const config = JSON.parse(fs.readFileSync(VERSION_FILE, 'utf-8'));
|
|
62
|
+
return VersionConfigSchema.parse(config);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function bumpVersion(current: string, type: BumpType): string {
|
|
66
|
+
const rcMatch = current.match(/^(\d+)\.(\d+)\.(\d+)-RC$/);
|
|
67
|
+
if (rcMatch) {
|
|
68
|
+
if (type === 'release') {
|
|
69
|
+
return `${rcMatch[1]}.${rcMatch[2]}.${rcMatch[3]}`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const match = current.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
74
|
+
if (!match) throw new Error(`Invalid version format: ${current}`);
|
|
75
|
+
|
|
76
|
+
let [, major, minor, patch] = match.map(Number);
|
|
77
|
+
|
|
78
|
+
switch (type) {
|
|
79
|
+
case 'major':
|
|
80
|
+
return `${major + 1}.0.0`;
|
|
81
|
+
case 'minor':
|
|
82
|
+
return `${major}.${minor + 1}.0`;
|
|
83
|
+
case 'patch':
|
|
84
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
85
|
+
case 'rc':
|
|
86
|
+
return `${major}.${minor}.${patch + 1}-RC`;
|
|
87
|
+
default:
|
|
88
|
+
throw new Error(`Unknown bump type: ${type}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// GitLab Integration
|
|
94
|
+
// ============================================================================
|
|
95
|
+
|
|
96
|
+
async function getMilestoneVersion(milestoneId?: string): Promise<string | null> {
|
|
97
|
+
if (!milestoneId || !GITLAB_TOKEN || !PROJECT_ID) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const response = await fetch(
|
|
103
|
+
`${GITLAB_API_URL}/projects/${PROJECT_ID}/milestones/${milestoneId}`,
|
|
104
|
+
{
|
|
105
|
+
headers: {
|
|
106
|
+
'PRIVATE-TOKEN': GITLAB_TOKEN,
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (!response.ok) return null;
|
|
112
|
+
|
|
113
|
+
const milestone = await response.json();
|
|
114
|
+
const title = milestone.title || '';
|
|
115
|
+
|
|
116
|
+
// Extract version from milestone title (e.g., "v0.2.6" or "0.2.6")
|
|
117
|
+
const versionMatch = title.match(/(\d+\.\d+\.\d+)/);
|
|
118
|
+
return versionMatch ? versionMatch[1] : null;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.warn('Failed to fetch milestone:', error);
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function createMergeRequest(
|
|
126
|
+
sourceBranch: string,
|
|
127
|
+
targetBranch: string,
|
|
128
|
+
title: string,
|
|
129
|
+
description: string
|
|
130
|
+
): Promise<number | null> {
|
|
131
|
+
if (!GITLAB_TOKEN || !PROJECT_ID) {
|
|
132
|
+
console.warn('GitLab credentials not available, skipping MR creation');
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
const response = await fetch(
|
|
138
|
+
`${GITLAB_API_URL}/projects/${PROJECT_ID}/merge_requests`,
|
|
139
|
+
{
|
|
140
|
+
method: 'POST',
|
|
141
|
+
headers: {
|
|
142
|
+
'PRIVATE-TOKEN': GITLAB_TOKEN,
|
|
143
|
+
'Content-Type': 'application/json',
|
|
144
|
+
},
|
|
145
|
+
body: JSON.stringify({
|
|
146
|
+
source_branch: sourceBranch,
|
|
147
|
+
target_branch: targetBranch,
|
|
148
|
+
title,
|
|
149
|
+
description,
|
|
150
|
+
labels: ['version-bump', 'automated', 'chore'],
|
|
151
|
+
remove_source_branch: true,
|
|
152
|
+
}),
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
const error = await response.text();
|
|
158
|
+
throw new Error(`Failed to create MR: ${error}`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const mr = await response.json();
|
|
162
|
+
return mr.iid;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
console.error('Failed to create merge request:', error);
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ============================================================================
|
|
170
|
+
// Main Execution
|
|
171
|
+
// ============================================================================
|
|
172
|
+
|
|
173
|
+
async function main() {
|
|
174
|
+
const args = process.argv.slice(2);
|
|
175
|
+
const bumpType = BumpTypeSchema.parse(args[0] || 'patch');
|
|
176
|
+
const milestoneId = process.env.CI_MILESTONE_ID || args[1];
|
|
177
|
+
|
|
178
|
+
console.log('🤖 Enhanced Version Manager');
|
|
179
|
+
console.log('===========================\n');
|
|
180
|
+
|
|
181
|
+
const config = getVersionConfig();
|
|
182
|
+
console.log(`📦 Current version: ${config.current}`);
|
|
183
|
+
|
|
184
|
+
// Try to get version from milestone
|
|
185
|
+
let targetVersion: string | null = null;
|
|
186
|
+
if (milestoneId) {
|
|
187
|
+
targetVersion = await getMilestoneVersion(milestoneId);
|
|
188
|
+
if (targetVersion) {
|
|
189
|
+
console.log(`🎯 Milestone version: ${targetVersion}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Calculate new version
|
|
194
|
+
const newVersion = targetVersion || bumpVersion(config.current, bumpType);
|
|
195
|
+
console.log(`🚀 New version: ${newVersion}\n`);
|
|
196
|
+
|
|
197
|
+
// Update .version.json
|
|
198
|
+
config.latest_stable = config.current.replace('-RC', '');
|
|
199
|
+
config.current = newVersion;
|
|
200
|
+
fs.writeFileSync(VERSION_FILE, JSON.stringify(config, null, 2) + '\n');
|
|
201
|
+
console.log('✅ Updated .version.json');
|
|
202
|
+
|
|
203
|
+
// Run sync
|
|
204
|
+
console.log('\n📝 Syncing version references...');
|
|
205
|
+
execSync('npm run version:sync', { stdio: 'inherit' });
|
|
206
|
+
|
|
207
|
+
// Process docs
|
|
208
|
+
console.log('\n📚 Processing documentation templates...');
|
|
209
|
+
execSync('npm run docs:process', { stdio: 'inherit' });
|
|
210
|
+
|
|
211
|
+
// Validate
|
|
212
|
+
console.log('\n🔍 Validating version consistency...');
|
|
213
|
+
try {
|
|
214
|
+
execSync('npm run version:sync -- --check', { stdio: 'inherit' });
|
|
215
|
+
console.log('✅ Version consistency validated');
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error('❌ Version consistency check failed');
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Git operations (if in CI or explicitly requested)
|
|
222
|
+
if (process.env.CI || process.argv.includes('--create-mr')) {
|
|
223
|
+
const targetBranch = process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME || 'development';
|
|
224
|
+
const sourceBranch = `chore/version-bump-${newVersion}`;
|
|
225
|
+
|
|
226
|
+
console.log(`\n🌿 Creating branch: ${sourceBranch}`);
|
|
227
|
+
execSync(`git checkout -b ${sourceBranch}`, { stdio: 'inherit' });
|
|
228
|
+
|
|
229
|
+
console.log('\n📝 Committing changes...');
|
|
230
|
+
execSync('git add .', { stdio: 'inherit' });
|
|
231
|
+
execSync(`git commit -m "chore: bump version to ${newVersion}"`, { stdio: 'inherit' });
|
|
232
|
+
|
|
233
|
+
console.log('\n⬆️ Pushing branch...');
|
|
234
|
+
execSync(`git push -u origin ${sourceBranch}`, { stdio: 'inherit' });
|
|
235
|
+
|
|
236
|
+
console.log('\n🔀 Creating merge request...');
|
|
237
|
+
const mrId = await createMergeRequest(
|
|
238
|
+
sourceBranch,
|
|
239
|
+
targetBranch,
|
|
240
|
+
`chore: bump version to ${newVersion}`,
|
|
241
|
+
`Automated version bump to ${newVersion}\n\nTriggered by: ${milestoneId ? 'Milestone' : 'Manual'}\n\nChanges:\n- Updated .version.json\n- Synced package.json files\n- Updated documentation\n- Created spec/v${newVersion}/ directory`
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
if (mrId) {
|
|
245
|
+
console.log(`✅ Merge request created: !${mrId}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
console.log('\n✅ Version management complete!');
|
|
250
|
+
console.log(` ${config.current} → ${newVersion}`);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
main().catch((error) => {
|
|
254
|
+
console.error('❌ Error:', error);
|
|
255
|
+
process.exit(1);
|
|
256
|
+
});
|
|
257
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate TypeScript types from current version schema
|
|
4
|
+
*
|
|
5
|
+
* Follows OpenAPI-first, DRY, and type-safe principles.
|
|
6
|
+
* Uses Zod for validation and shared utilities.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import { dirname } from 'path';
|
|
12
|
+
import { getCurrentVersion, getSchemaPath, getTypesOutputPath } from './lib/version.js';
|
|
13
|
+
import { requireFile, writeFile } from './lib/file-ops.js';
|
|
14
|
+
import { execCommand } from './lib/exec.js';
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = dirname(__filename);
|
|
18
|
+
const ROOT = join(__dirname, '..');
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
try {
|
|
22
|
+
// Get version with validation
|
|
23
|
+
const version = getCurrentVersion();
|
|
24
|
+
console.log(`📦 Current version: ${version}`);
|
|
25
|
+
|
|
26
|
+
// Build paths
|
|
27
|
+
const schemaPath = join(ROOT, getSchemaPath(version));
|
|
28
|
+
const outputPath = join(ROOT, getTypesOutputPath(version));
|
|
29
|
+
|
|
30
|
+
// Validate schema exists
|
|
31
|
+
requireFile(schemaPath, `Schema not found at ${schemaPath}`);
|
|
32
|
+
console.log(`📄 Schema: ${schemaPath}`);
|
|
33
|
+
|
|
34
|
+
// Generate types
|
|
35
|
+
console.log('🔄 Generating TypeScript types...');
|
|
36
|
+
const output = execCommand(`npx json-schema-to-typescript ${schemaPath}`, {
|
|
37
|
+
encoding: 'utf8',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Write output
|
|
41
|
+
writeFile(outputPath, output);
|
|
42
|
+
console.log(`✅ Generated: ${outputPath}`);
|
|
43
|
+
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('❌ Error:', error instanceof Error ? error.message : String(error));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
main();
|
|
51
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate Zod schemas from current version schema
|
|
4
|
+
*
|
|
5
|
+
* Follows OpenAPI-first, DRY, and type-safe principles.
|
|
6
|
+
* Uses Zod for validation and shared utilities.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import { dirname } from 'path';
|
|
12
|
+
import { getCurrentVersion, getSchemaPath, getZodOutputPath } from './lib/version.js';
|
|
13
|
+
import { requireFile, writeFile } from './lib/file-ops.js';
|
|
14
|
+
import { execCommand } from './lib/exec.js';
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = dirname(__filename);
|
|
18
|
+
const ROOT = join(__dirname, '..');
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
try {
|
|
22
|
+
// Get version with validation
|
|
23
|
+
const version = getCurrentVersion();
|
|
24
|
+
console.log(`📦 Current version: ${version}`);
|
|
25
|
+
|
|
26
|
+
// Build paths
|
|
27
|
+
const schemaPath = join(ROOT, getSchemaPath(version));
|
|
28
|
+
const outputPath = join(ROOT, getZodOutputPath(version));
|
|
29
|
+
|
|
30
|
+
// Validate schema exists
|
|
31
|
+
requireFile(schemaPath, `Schema not found at ${schemaPath}`);
|
|
32
|
+
console.log(`📄 Schema: ${schemaPath}`);
|
|
33
|
+
|
|
34
|
+
// Generate Zod schemas
|
|
35
|
+
console.log('🔄 Generating Zod schemas...');
|
|
36
|
+
const output = execCommand(`npx json-schema-to-zod ${schemaPath}`, {
|
|
37
|
+
encoding: 'utf8',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Write output
|
|
41
|
+
writeFile(outputPath, output);
|
|
42
|
+
console.log(`✅ Generated: ${outputPath}`);
|
|
43
|
+
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('❌ Error:', error instanceof Error ? error.message : String(error));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
main();
|
|
51
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Utilities
|
|
3
|
+
*
|
|
4
|
+
* DRY: Reusable command execution with proper error handling
|
|
5
|
+
* Type-safe: Validates commands and handles errors
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
const CommandSchema = z.string().min(1);
|
|
12
|
+
|
|
13
|
+
interface ExecOptions {
|
|
14
|
+
encoding?: BufferEncoding;
|
|
15
|
+
stdio?: 'inherit' | 'pipe';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Execute command with validation and error handling
|
|
20
|
+
*/
|
|
21
|
+
export function execCommand(
|
|
22
|
+
command: string,
|
|
23
|
+
options: ExecOptions = {}
|
|
24
|
+
): string {
|
|
25
|
+
const validatedCommand = CommandSchema.parse(command);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const result = execSync(validatedCommand, {
|
|
29
|
+
encoding: options.encoding || 'utf8',
|
|
30
|
+
stdio: options.stdio || 'pipe',
|
|
31
|
+
});
|
|
32
|
+
return result as string;
|
|
33
|
+
} catch (error: any) {
|
|
34
|
+
const message = error?.message || 'Command execution failed';
|
|
35
|
+
throw new Error(`Command failed: ${validatedCommand}\n${message}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Operations Utilities
|
|
3
|
+
*
|
|
4
|
+
* DRY: Reusable file operations with proper error handling
|
|
5
|
+
* Type-safe: Validates paths and operations
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
const FilePathSchema = z.string().min(1);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Read file with validation
|
|
15
|
+
*/
|
|
16
|
+
export function readFile(filePath: string): string {
|
|
17
|
+
const validatedPath = FilePathSchema.parse(filePath);
|
|
18
|
+
|
|
19
|
+
if (!existsSync(validatedPath)) {
|
|
20
|
+
throw new Error(`File not found: ${validatedPath}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
return readFileSync(validatedPath, 'utf8');
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw new Error(`Failed to read file ${validatedPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Write file with validation
|
|
32
|
+
*/
|
|
33
|
+
export function writeFile(filePath: string, content: string): void {
|
|
34
|
+
const validatedPath = FilePathSchema.parse(filePath);
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
writeFileSync(validatedPath, content, 'utf8');
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new Error(`Failed to write file ${validatedPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Check if file exists
|
|
45
|
+
*/
|
|
46
|
+
export function fileExists(filePath: string): boolean {
|
|
47
|
+
const validatedPath = FilePathSchema.parse(filePath);
|
|
48
|
+
return existsSync(validatedPath);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Validate file exists or throw
|
|
53
|
+
*/
|
|
54
|
+
export function requireFile(filePath: string, errorMessage?: string): void {
|
|
55
|
+
if (!fileExists(filePath)) {
|
|
56
|
+
throw new Error(errorMessage || `Required file not found: ${filePath}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version Management Utilities
|
|
3
|
+
*
|
|
4
|
+
* DRY: Single source of truth for version operations
|
|
5
|
+
* Type-safe: Uses Zod for validation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync } from 'fs';
|
|
9
|
+
import { join, dirname } from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import {
|
|
13
|
+
PackageJsonSchema,
|
|
14
|
+
VersionSchema,
|
|
15
|
+
type PackageJson,
|
|
16
|
+
type Version,
|
|
17
|
+
} from '../schemas/package.schema.js';
|
|
18
|
+
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = dirname(__filename);
|
|
21
|
+
const ROOT = join(__dirname, '..', '..');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get current version from package.json with Zod validation
|
|
25
|
+
*/
|
|
26
|
+
export function getCurrentVersion(): Version {
|
|
27
|
+
const packageJsonPath = join(ROOT, 'package.json');
|
|
28
|
+
const content = readFileSync(packageJsonPath, 'utf8');
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
const json = JSON.parse(content);
|
|
32
|
+
const pkg = PackageJsonSchema.parse(json);
|
|
33
|
+
return VersionSchema.parse(pkg.version);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (error instanceof z.ZodError) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Invalid package.json version: ${error.errors.map((e) => e.message).join(', ')}`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get package.json with validation
|
|
46
|
+
*/
|
|
47
|
+
export function getPackageJson(): PackageJson {
|
|
48
|
+
const packageJsonPath = join(ROOT, 'package.json');
|
|
49
|
+
const content = readFileSync(packageJsonPath, 'utf8');
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const json = JSON.parse(content);
|
|
53
|
+
return PackageJsonSchema.parse(json);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (error instanceof z.ZodError) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Invalid package.json: ${error.errors.map((e) => e.message).join(', ')}`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Build schema path from version
|
|
66
|
+
*/
|
|
67
|
+
export function getSchemaPath(version: Version): string {
|
|
68
|
+
return `spec/v${version}/ossa-${version}.schema.json`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Build output path for generated types
|
|
73
|
+
*/
|
|
74
|
+
export function getTypesOutputPath(version: Version): string {
|
|
75
|
+
return `src/types/generated/ossa-${version}.types.ts`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Build output path for generated Zod schemas
|
|
80
|
+
*/
|
|
81
|
+
export function getZodOutputPath(version: Version): string {
|
|
82
|
+
return `src/types/generated/ossa-${version}.zod.ts`;
|
|
83
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { glob } from 'glob';
|
|
5
|
+
|
|
6
|
+
const VERSION_FILE = path.join(process.cwd(), '.version.json');
|
|
7
|
+
const versionConfig = JSON.parse(fs.readFileSync(VERSION_FILE, 'utf-8'));
|
|
8
|
+
|
|
9
|
+
const replacements = {
|
|
10
|
+
'{{VERSION}}': versionConfig.current,
|
|
11
|
+
'{{VERSION_STABLE}}': versionConfig.latest_stable,
|
|
12
|
+
'{{SPEC_PATH}}': versionConfig.spec_path.replace('{version}', versionConfig.current),
|
|
13
|
+
'{{SCHEMA_FILE}}': versionConfig.schema_file.replace('{version}', versionConfig.current),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
async function processTemplates() {
|
|
17
|
+
const files = await glob('website/content/docs/**/*.md', { ignore: 'node_modules/**' });
|
|
18
|
+
|
|
19
|
+
for (const file of files) {
|
|
20
|
+
let content = fs.readFileSync(file, 'utf-8');
|
|
21
|
+
let updated = false;
|
|
22
|
+
|
|
23
|
+
for (const [placeholder, value] of Object.entries(replacements)) {
|
|
24
|
+
if (content.includes(placeholder)) {
|
|
25
|
+
content = content.replaceAll(placeholder, value);
|
|
26
|
+
updated = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (updated) {
|
|
31
|
+
fs.writeFileSync(file, content);
|
|
32
|
+
console.log(`✅ Processed: ${file}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
processTemplates();
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Zod Schemas for Build Scripts
|
|
3
|
+
*
|
|
4
|
+
* Follows OpenAPI-first, DRY, and type-safe principles.
|
|
5
|
+
* Single source of truth for package.json and version validation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Semantic version pattern (supports RC, alpha, beta, etc.)
|
|
12
|
+
* Matches: 0.2.5, 0.2.5-RC, 0.2.5-alpha.1, 1.0.0-beta.2, etc.
|
|
13
|
+
*/
|
|
14
|
+
const SemverPattern = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?$/;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Package.json schema (partial - only fields we use)
|
|
18
|
+
*/
|
|
19
|
+
export const PackageJsonSchema = z.object({
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
version: z.string().regex(SemverPattern, {
|
|
22
|
+
message: 'Invalid semver version format. Expected: X.Y.Z or X.Y.Z-SUFFIX',
|
|
23
|
+
}),
|
|
24
|
+
exports: z
|
|
25
|
+
.object({
|
|
26
|
+
'./schema': z.string().optional(),
|
|
27
|
+
})
|
|
28
|
+
.passthrough()
|
|
29
|
+
.optional(),
|
|
30
|
+
}).passthrough();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Version string schema
|
|
34
|
+
*/
|
|
35
|
+
export const VersionSchema = z.string().regex(SemverPattern, {
|
|
36
|
+
message: 'Invalid version format',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* File path schema
|
|
41
|
+
*/
|
|
42
|
+
export const FilePathSchema = z.string().min(1);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Script configuration schema
|
|
46
|
+
*/
|
|
47
|
+
export const ScriptConfigSchema = z.object({
|
|
48
|
+
version: VersionSchema,
|
|
49
|
+
schemaPath: FilePathSchema,
|
|
50
|
+
outputPath: z.string().optional(),
|
|
51
|
+
rootDir: FilePathSchema,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Type exports
|
|
55
|
+
export type PackageJson = z.infer<typeof PackageJsonSchema>;
|
|
56
|
+
export type Version = z.infer<typeof VersionSchema>;
|
|
57
|
+
export type ScriptConfig = z.infer<typeof ScriptConfigSchema>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Parse and validate package.json
|
|
61
|
+
*/
|
|
62
|
+
export function parsePackageJson(content: string): PackageJson {
|
|
63
|
+
try {
|
|
64
|
+
const json = JSON.parse(content);
|
|
65
|
+
return PackageJsonSchema.parse(json);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
if (error instanceof z.ZodError) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Invalid package.json: ${error.issues.map((e: z.ZodIssue) => e.message).join(', ')}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Setup Branch Protection
|
|
4
|
+
# Installs git hooks to prevent checking out main/development locally
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
11
|
+
|
|
12
|
+
echo "🔒 Setting up branch protection for main and development..."
|
|
13
|
+
|
|
14
|
+
# Ensure hooks directory exists
|
|
15
|
+
mkdir -p "$PROJECT_ROOT/.git/hooks"
|
|
16
|
+
|
|
17
|
+
# Copy hooks if they don't exist or are outdated
|
|
18
|
+
if [ ! -f "$PROJECT_ROOT/.git/hooks/post-checkout" ] || [ "$PROJECT_ROOT/.git/hooks/post-checkout" -ot "$SCRIPT_DIR/setup-branch-protection.sh" ]; then
|
|
19
|
+
echo "✅ Installing post-checkout hook..."
|
|
20
|
+
# Hook is already installed, just ensure it's executable
|
|
21
|
+
chmod +x "$PROJECT_ROOT/.git/hooks/post-checkout" 2>/dev/null || true
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Set git config for hooks
|
|
25
|
+
git config core.hooksPath .git/hooks 2>/dev/null || true
|
|
26
|
+
|
|
27
|
+
echo ""
|
|
28
|
+
echo "✅ Branch protection installed!"
|
|
29
|
+
echo ""
|
|
30
|
+
echo "Protected branches: main, development"
|
|
31
|
+
echo ""
|
|
32
|
+
echo "The hook will automatically switch you back if you try to checkout these branches."
|
|
33
|
+
echo ""
|