@bluefly/openstandardagents 0.2.5-RC → 0.2.8
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/.devfile.yaml +1 -1
- package/.env.example +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.yml +63 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +40 -0
- package/.github/workflows/dependabot-comment.yml +34 -0
- package/.github/workflows/pr-comment.yml +33 -0
- package/.husky/pre-commit +5 -0
- package/.kiro/config.json +21 -0
- package/.kiro/settings/mcp.json +61 -0
- package/.kiro/specs/scripts-migration-api-first/design.md +883 -0
- package/.kiro/specs/scripts-migration-api-first/requirements.md +165 -0
- package/.kiro/specs/scripts-migration-api-first/tasks.md +539 -0
- package/.kiro/specs/{website-design-audit → website-brand-identity}/design.md +381 -0
- package/.kiro/specs/{website-design-audit → website-brand-identity}/requirements.md +88 -0
- package/.kiro/specs/website-brand-identity/tasks.md +981 -0
- package/.version.json +2 -2
- package/.wiki-config.json +24 -0
- package/CHANGELOG.md +34 -18
- package/CODEOWNERS +75 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +176 -239
- package/bin/ossa-dev +42 -0
- package/bin/ossa-export +32 -0
- package/bin/ossa-generate +60 -0
- package/bin/ossa-health +40 -0
- package/bin/ossa-init +26 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/repositories/schema.repository.d.ts +6 -1
- package/dist/repositories/schema.repository.d.ts.map +1 -1
- package/dist/repositories/schema.repository.js +63 -36
- package/dist/repositories/schema.repository.js.map +1 -1
- package/dist/services/github-sync/github-client.d.ts +14 -0
- package/dist/services/github-sync/github-client.d.ts.map +1 -0
- package/dist/services/github-sync/github-client.js +41 -0
- package/dist/services/github-sync/github-client.js.map +1 -0
- package/dist/services/github-sync/gitlab-client.d.ts +17 -0
- package/dist/services/github-sync/gitlab-client.d.ts.map +1 -0
- package/dist/services/github-sync/gitlab-client.js +42 -0
- package/dist/services/github-sync/gitlab-client.js.map +1 -0
- package/dist/services/github-sync/schemas.d.ts +46 -0
- package/dist/services/github-sync/schemas.d.ts.map +1 -0
- package/dist/services/github-sync/schemas.js +36 -0
- package/dist/services/github-sync/schemas.js.map +1 -0
- package/dist/services/github-sync/sync.service.d.ts +27 -0
- package/dist/services/github-sync/sync.service.d.ts.map +1 -0
- package/dist/services/github-sync/sync.service.js +99 -0
- package/dist/services/github-sync/sync.service.js.map +1 -0
- package/dist/services/migration.service.d.ts +4 -3
- package/dist/services/migration.service.d.ts.map +1 -1
- package/dist/services/migration.service.js +11 -10
- package/dist/services/migration.service.js.map +1 -1
- package/dist/services/release-automation/release.service.js +1 -1
- package/dist/services/release-automation/release.service.js.map +1 -1
- package/dist/services/release-automation/schemas/release.schema.js +1 -1
- package/dist/services/runtime/claude/capability-mapper.d.ts +84 -0
- package/dist/services/runtime/claude/capability-mapper.d.ts.map +1 -0
- package/dist/services/runtime/claude/capability-mapper.js +245 -0
- package/dist/services/runtime/claude/capability-mapper.js.map +1 -0
- package/dist/services/runtime/claude/claude-adapter.d.ts +80 -0
- package/dist/services/runtime/claude/claude-adapter.d.ts.map +1 -0
- package/dist/services/runtime/claude/claude-adapter.js +287 -0
- package/dist/services/runtime/claude/claude-adapter.js.map +1 -0
- package/dist/services/runtime/claude/manifest-parser.d.ts +77 -0
- package/dist/services/runtime/claude/manifest-parser.d.ts.map +1 -0
- package/dist/services/runtime/claude/manifest-parser.js +169 -0
- package/dist/services/runtime/claude/manifest-parser.js.map +1 -0
- package/dist/services/runtime/claude/types.d.ts +115 -0
- package/dist/services/runtime/claude/types.d.ts.map +1 -0
- package/dist/services/runtime/claude/types.js +6 -0
- package/dist/services/runtime/claude/types.js.map +1 -0
- package/dist/services/validation.service.d.ts.map +1 -1
- package/dist/services/validation.service.js +12 -1
- package/dist/services/validation.service.js.map +1 -1
- package/dist/spec/v0.2.4/ossa-0.2.4.schema.json +85 -208
- package/dist/spec/v0.2.6/CHANGELOG.md +401 -0
- package/dist/spec/v0.2.6/README.md +72 -0
- package/dist/spec/v0.2.6/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/v0.2.6/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/dist/spec/{v0.2.4/ossa-0.2.4-dev.schema.json → v0.2.6/ossa-0.2.6.schema.json} +128 -38
- package/dist/spec/v0.2.6/ossa-0.2.6.yaml +581 -0
- package/dist/spec/v0.2.6-dev/CHANGELOG.md +164 -0
- package/dist/spec/v0.2.6-dev/README.md +75 -0
- package/dist/spec/v0.2.6-dev/migrations/v0.2.2-to-v0.2.3.md +343 -0
- package/dist/spec/v0.2.6-dev/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/v0.2.6-dev/ossa-0.2.5.yaml +581 -0
- package/dist/spec/v0.2.6-dev/ossa-0.2.6-dev.yaml +448 -0
- package/dist/spec/v0.2.7/core/agentgraph.md +324 -0
- package/dist/spec/v0.2.7/resources/agentgraph.yaml +135 -0
- package/dist/spec/v0.2.8/CHANGELOG.md +401 -0
- package/dist/spec/v0.2.8/README.md +72 -0
- package/dist/spec/v0.2.8/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/dist/spec/v0.2.8/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/dist/spec/v0.2.8/migrations/v0.2.6-to-v0.2.8.md +81 -0
- package/dist/spec/v0.2.8/ossa-0.2.8.schema.json +3153 -0
- package/dist/spec/v0.2.8/ossa-0.2.8.yaml +581 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/version.d.ts +68 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +156 -0
- package/dist/utils/version.js.map +1 -0
- package/docs/brand-guide/01-brand-overview.md +37 -0
- package/docs/brand-guide/02-logo-usage.md +43 -0
- package/docs/brand-guide/03-color-palette.md +70 -0
- package/docs/brand-guide/04-typography.md +82 -0
- package/docs/brand-guide/05-voice-and-tone.md +108 -0
- package/docs/brand-guide/06-visual-elements.md +137 -0
- package/docs/brand-guide/07-application-examples.md +153 -0
- package/docs/brand-guide/OssaLogo/OssA_Logo.svg +21 -0
- package/docs/brand-guide/OssaLogo/brand.af +0 -0
- package/docs/brand-guide/README.md +107 -0
- package/docs/comparison.md +315 -0
- package/docs/operations/automation-roadmap.md +245 -0
- package/docs/operations/github-sync-strategy.md +357 -0
- package/eslint-report.json +1 -0
- package/examples/adk-integration/code-review-workflow.yml +1 -1
- package/examples/adk-integration/customer-support.yml +1 -1
- package/examples/adk-integration/data-pipeline.yml +1 -1
- package/examples/advanced/workflows/hybrid-model-strategy.yaml +1 -1
- package/examples/agent-manifests/critics/critic-agent.yaml +1 -1
- package/examples/agent-manifests/governors/governor-agent.yaml +1 -1
- package/examples/agent-manifests/integrators/integrator-agent.yaml +1 -1
- package/examples/agent-manifests/judges/judge-agent.yaml +1 -1
- package/examples/agent-manifests/monitors/monitor-agent.yaml +1 -1
- package/examples/agent-manifests/orchestrators/orchestrator-agent.yaml +1 -1
- package/examples/agent-manifests/sample-compliant-agent.yaml +1 -1
- package/examples/agent-manifests/workers/worker-agent.yaml +1 -1
- package/examples/anthropic/claude-assistant.ossa.json +5 -4
- package/examples/autogen/multi-agent.ossa.json +6 -4
- package/examples/claude-code/code-reviewer.ossa.yaml +78 -0
- package/examples/claude-code/ossa-validator.ossa.yaml +80 -0
- package/examples/common_npm/agent-router.ossa.yaml +1 -0
- package/examples/common_npm/agent-router.v0.2.2.ossa.yaml +1 -1
- package/examples/crewai/research-team.ossa.json +14 -5
- package/examples/cursor/code-review-agent.ossa.json +21 -6
- package/examples/drupal/gitlab-ml-recommender.ossa.yaml +1 -0
- package/examples/drupal/gitlab-ml-recommender.v0.2.2.ossa.yaml +1 -1
- package/examples/extensions/drupal-v1.yml +1 -1
- package/examples/extensions/kagent-v1.yml +1 -1
- package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
- package/examples/integration-patterns/agent-to-agent-orchestration.ossa.yaml +4 -4
- package/examples/kagent/compliance-validator.ossa.yaml +1 -1
- package/examples/kagent/cost-optimizer.ossa.yaml +1 -1
- package/examples/kagent/documentation-agent.ossa.yaml +1 -1
- package/examples/kagent/k8s-troubleshooter-v1.ossa.yaml +1 -0
- package/examples/kagent/k8s-troubleshooter-v1.v0.2.2.ossa.yaml +1 -1
- package/examples/kagent/k8s-troubleshooter.ossa.yaml +1 -1
- package/examples/kagent/security-scanner.ossa.yaml +1 -1
- package/examples/langchain/chain-agent.ossa.json +21 -5
- package/examples/langflow/workflow-agent.ossa.json +2 -3
- package/examples/langgraph/state-machine-agent.ossa.json +2 -3
- package/examples/llamaindex/rag-agent.ossa.json +2 -3
- package/examples/migration-guides/from-langchain-to-ossa.yaml +4 -4
- package/examples/multi-agent/README.md +74 -0
- package/examples/multi-agent/conditional-router.ossa.yaml +42 -0
- package/examples/multi-agent/parallel-execution.ossa.yaml +54 -0
- package/examples/multi-agent/sequential-pipeline.ossa.yaml +45 -0
- package/examples/openai/basic-agent.ossa.yaml +1 -1
- package/examples/openai/multi-tool-agent.ossa.json +33 -10
- package/examples/openai/swarm-agent.ossa.json +18 -5
- package/examples/production/document-analyzer-openai.yml +1 -1
- package/examples/quickstart/support-agent.ossa.yaml +1 -1
- package/examples/spec-examples/audit-agent.yml +1 -1
- package/examples/spec-examples/chat-agent.yml +1 -1
- package/examples/spec-examples/compliance-agent.yml +1 -1
- package/examples/spec-examples/monitoring-agent.yml +1 -1
- package/examples/spec-examples/workflow-agent.yml +1 -1
- package/examples/templates/ossa-compliance.yaml +1 -1
- package/examples/vercel/edge-agent.ossa.json +5 -4
- package/gl-code-quality-report.json +62 -0
- package/llms-ctx-full.txt +39 -0
- package/llms-ctx.txt +39 -0
- package/llms.txt +47 -0
- package/openapi/github-sync.yaml +115 -0
- package/package.json +26 -4
- package/scripts/README.md +103 -0
- package/scripts/auto-rebase-mrs.ts +106 -0
- package/scripts/batch-dependabot.sh +57 -0
- package/scripts/configure-gitlab-branch-protection.ts +95 -0
- package/scripts/create-issue-helper.ts +238 -0
- package/scripts/create-milestone-issue.ts +73 -0
- package/scripts/eslint-to-codequality.cjs +34 -0
- package/scripts/fix-schema-formats.js +82 -0
- package/scripts/generate-agents-catalog.ts +77 -0
- package/scripts/generate-api-docs.ts +218 -0
- package/scripts/generate-cli-docs.ts +410 -0
- package/scripts/generate-config-docs.ts +109 -0
- package/scripts/generate-errors-docs.ts +76 -0
- package/scripts/generate-examples-docs.ts +99 -0
- package/scripts/generate-llms-ctx.sh +17 -0
- package/scripts/generate-schema-docs.ts +317 -0
- package/scripts/generate-types-docs.ts +48 -0
- package/scripts/lowercase-docs.ts +43 -0
- package/scripts/manage-milestone-mrs.ts +279 -0
- package/scripts/rebase-all-mrs.sh +75 -0
- package/scripts/sync-github-pr.sh +48 -0
- package/scripts/sync-version.js +32 -0
- package/scripts/sync-wiki.sh +50 -0
- package/scripts/validate-all.js +127 -0
- package/scripts/validate-schema.ts +2 -1
- package/spec/v0.2.4/ossa-0.2.4.schema.json +85 -208
- package/spec/v0.2.6/CHANGELOG.md +401 -0
- package/spec/v0.2.6/README.md +72 -0
- package/spec/v0.2.6/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.6/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/spec/{v0.2.4/ossa-0.2.4-dev.schema.json → v0.2.6/ossa-0.2.6.schema.json} +128 -38
- package/spec/v0.2.6/ossa-0.2.6.yaml +581 -0
- package/spec/v0.2.6-dev/CHANGELOG.md +164 -0
- package/spec/v0.2.6-dev/README.md +75 -0
- package/spec/v0.2.6-dev/migrations/v0.2.2-to-v0.2.3.md +343 -0
- package/spec/v0.2.6-dev/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.6-dev/ossa-0.2.5.yaml +581 -0
- package/spec/v0.2.6-dev/ossa-0.2.6-dev.yaml +448 -0
- package/spec/v0.2.7/core/agentgraph.md +324 -0
- package/spec/v0.2.7/resources/agentgraph.yaml +135 -0
- package/spec/v0.2.8/CHANGELOG.md +401 -0
- package/spec/v0.2.8/README.md +72 -0
- package/spec/v0.2.8/migrations/v0.2.3-to-v0.2.4.md +599 -0
- package/spec/v0.2.8/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
- package/spec/v0.2.8/migrations/v0.2.6-to-v0.2.8.md +81 -0
- package/spec/v0.2.8/ossa-0.2.8.schema.json +3153 -0
- package/spec/v0.2.8/ossa-0.2.8.yaml +581 -0
- package/test-results/junit.xml +299 -0
- package/.kiro/specs/agent-buildkit-templates/design.md +0 -495
- package/.kiro/specs/agent-buildkit-templates/requirements.md +0 -165
- package/.kiro/specs/kiro-ide-supercharger/README.md +0 -202
- package/.kiro/specs/kiro-ide-supercharger/design.md +0 -1005
- package/.kiro/specs/kiro-ide-supercharger/requirements.md +0 -141
- package/.kiro/specs/kiro-ide-supercharger/tasks.md +0 -507
- package/bin/validate-ossa-0.2.5-RC.ts +0 -244
- package/docs/issue-19-completion-summary.md +0 -648
- package/docs/issue-19-validation.md +0 -351
- package/scripts/lib/exec.ts +0 -37
- package/scripts/lib/file-ops.ts +0 -58
- package/scripts/lib/version.ts +0 -83
- package/website/.lighthouserc.ts +0 -24
- package/website/.prettierrc +0 -10
- package/website/Dockerfile +0 -30
- package/website/app/about/page.tsx +0 -295
- package/website/app/blog/[slug]/page.tsx +0 -208
- package/website/app/blog/page.tsx +0 -249
- package/website/app/design-guide/page.tsx +0 -511
- package/website/app/docs/[[...slug]]/page.tsx +0 -847
- package/website/app/docs/core-concepts/project-structure/page.tsx +0 -349
- package/website/app/ecosystem/page.tsx +0 -375
- package/website/app/examples/page.tsx +0 -133
- package/website/app/globals.scss +0 -135
- package/website/app/layout.tsx +0 -106
- package/website/app/license/page.tsx +0 -183
- package/website/app/not-found.tsx +0 -18
- package/website/app/page.tsx +0 -474
- package/website/app/playground/page.tsx +0 -487
- package/website/app/robots.ts +0 -19
- package/website/app/rss.xml/route.ts +0 -74
- package/website/app/schema/page.tsx +0 -1001
- package/website/app/sitemap.ts +0 -56
- package/website/app/specification/page.tsx +0 -287
- package/website/components/InstallCommand.tsx +0 -96
- package/website/components/Logo.tsx +0 -97
- package/website/components/StructuredData.tsx +0 -65
- package/website/components/docs/DocsSearch.tsx +0 -104
- package/website/components/docs/DocsSidebar.tsx +0 -155
- package/website/components/docs/MarkdownContent.tsx +0 -401
- package/website/components/docs/VersionSelector.tsx +0 -105
- package/website/components/examples/ExamplesViewer.tsx +0 -293
- package/website/components/layout/Footer.tsx +0 -116
- package/website/components/layout/Header.tsx +0 -168
- package/website/components/schema/SchemaComponentsAccordion.tsx +0 -84
- package/website/components/schema/SchemaExplorer.tsx +0 -213
- package/website/content/blog/OpenAPI-AI-Agents-Standard.md +0 -285
- package/website/content/blog/Why-Formal-Standards-Matter-Now.md +0 -198
- package/website/content/blog/gitlab-kubernetes-agent-ecosystem.md +0 -286
- package/website/content/blog/introducing-ossa-framework.md +0 -328
- package/website/content/blog/ossa-production-results.md +0 -279
- package/website/content/blog/welcome-to-ossa.md +0 -43
- package/website/content/blog/why-ai-agents-need-open-standard.md +0 -98
- package/website/content/docs/00-HOME.md +0 -153
- package/website/content/docs/AIFlow-Framework-Integration-with-OSSA.md +0 -107
- package/website/content/docs/Examples.md +0 -71
- package/website/content/docs/OpenAPI-Extensions.md +0 -934
- package/website/content/docs/adapters/openai-adapter.md +0 -693
- package/website/content/docs/architecture/execution-flow.md +0 -335
- package/website/content/docs/architecture/multi-agent-systems.md +0 -737
- package/website/content/docs/architecture/overview.md +0 -121
- package/website/content/docs/architecture/stack-integration.md +0 -461
- package/website/content/docs/changelog.md +0 -246
- package/website/content/docs/contributing.md +0 -599
- package/website/content/docs/core-concepts/Project-Structure.md +0 -348
- package/website/content/docs/ecosystem/framework-support.md +0 -819
- package/website/content/docs/ecosystem/overview.md +0 -366
- package/website/content/docs/examples/AIFlow-Framework-Integration-with-OSSA.md +0 -107
- package/website/content/docs/examples/Migration-Guides.md +0 -214
- package/website/content/docs/for-audiences/Architects.md +0 -224
- package/website/content/docs/for-audiences/Developers.md +0 -220
- package/website/content/docs/for-audiences/Enterprises.md +0 -256
- package/website/content/docs/for-audiences/Students-Researchers.md +0 -122
- package/website/content/docs/getting-started/5-Minute-Overview.md +0 -85
- package/website/content/docs/getting-started/First-Agent.md +0 -196
- package/website/content/docs/getting-started/Hello-World.md +0 -184
- package/website/content/docs/getting-started/Installation.md +0 -155
- package/website/content/docs/getting-started/index.md +0 -92
- package/website/content/docs/getting-started/running-agents.md +0 -309
- package/website/content/docs/getting-started.md +0 -91
- package/website/content/docs/integrations/aiflow.md +0 -104
- package/website/content/docs/integrations/drupal.md +0 -105
- package/website/content/docs/migration-guides/00-INDEX.md +0 -76
- package/website/content/docs/migration-guides/README.md +0 -133
- package/website/content/docs/migration-guides/agent-schema-comparison.md +0 -232
- package/website/content/docs/migration-guides/anthropic-mcp-to-ossa.md +0 -1750
- package/website/content/docs/migration-guides/crewai-to-ossa.md +0 -274
- package/website/content/docs/migration-guides/drupal-eca-to-ossa.md +0 -2017
- package/website/content/docs/migration-guides/general-agent-schema.yml +0 -247
- package/website/content/docs/migration-guides/index.md +0 -133
- package/website/content/docs/migration-guides/langchain-to-ossa.md +0 -1714
- package/website/content/docs/migration-guides/langflow-to-ossa.md +0 -2075
- package/website/content/docs/migration-guides/migration-manifest.json +0 -64
- package/website/content/docs/migration-guides/openai-to-ossa.md +0 -1202
- package/website/content/docs/openapi-extensions/examples.md +0 -550
- package/website/content/docs/openapi-extensions/index.md +0 -551
- package/website/content/docs/openapi-extensions/operation-extensions.md +0 -457
- package/website/content/docs/openapi-extensions/root-extensions.md +0 -410
- package/website/content/docs/ossa-compliant-badge.md +0 -251
- package/website/content/docs/pre-release/index.md +0 -175
- package/website/content/docs/quick-reference.md +0 -17
- package/website/content/docs/readme.md +0 -35
- package/website/content/docs/schema-reference/agent-spec.md +0 -406
- package/website/content/docs/schema-reference/autonomy.md +0 -568
- package/website/content/docs/schema-reference/constraints.md +0 -543
- package/website/content/docs/schema-reference/index.md +0 -176
- package/website/content/docs/schema-reference/llm-config.md +0 -445
- package/website/content/docs/schema-reference/observability.md +0 -654
- package/website/content/docs/schema-reference/ossa-manifest.md +0 -309
- package/website/content/docs/schema-reference/taxonomy.md +0 -509
- package/website/content/docs/schema-reference/tools.md +0 -628
- package/website/content/docs/templates/blog-post.md +0 -43
- package/website/content/docs/use-cases/00-index.md +0 -395
- package/website/content/docs/use-cases/cicd-code-review.md +0 -1236
- package/website/content/docs/use-cases/customer-support.md +0 -1234
- package/website/content/docs/use-cases/enterprise-compliance.md +0 -1208
- package/website/content/docs/use-cases/research-multi-agent.md +0 -1161
- package/website/content/docs/versioning.md +0 -288
- package/website/lib/version.ts +0 -35
- package/website/lib/versions.json +0 -78
- package/website/next.config.ts +0 -18
- package/website/nginx.conf +0 -32
- package/website/package-lock.json +0 -9679
- package/website/package.json +0 -59
- package/website/postcss.config.mjs +0 -9
- package/website/scripts/fetch-versions.js +0 -166
- package/website/scripts/generate-examples-index.js +0 -163
- package/website/scripts/merge-docs-to-wiki.ts +0 -207
- package/website/scripts/sync-version.js +0 -72
- package/website/scripts/sync-wiki.ts +0 -322
- package/website/scripts/upload-wiki.ts +0 -199
- package/website/styles/_variables.scss +0 -36
- package/website/tailwind.config.ts +0 -136
- /package/dist/spec/v0.2.4/{ossa-0.2.4-dev.yaml → ossa-0.2.4.yaml} +0 -0
- /package/spec/v0.2.4/{ossa-0.2.4-dev.yaml → ossa-0.2.4.yaml} +0 -0
|
@@ -0,0 +1,883 @@
|
|
|
1
|
+
# Design Document
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This design document outlines the architecture for migrating the `/scripts` directory into `/src` following API-first, DRY, CRUD, Zod validation, and OpenAPI principles. The migration transforms 30+ standalone scripts into a cohesive service-oriented architecture with proper separation of concerns, comprehensive validation, and formal API contracts.
|
|
6
|
+
|
|
7
|
+
### Goals
|
|
8
|
+
|
|
9
|
+
- **API-First**: Define OpenAPI specifications before implementation
|
|
10
|
+
- **DRY**: Eliminate code duplication through shared services and utilities
|
|
11
|
+
- **CRUD**: Implement repository pattern for all data access
|
|
12
|
+
- **Type Safety**: Use Zod for runtime validation matching TypeScript types
|
|
13
|
+
- **Testability**: Achieve 80%+ code coverage with unit and property-based tests
|
|
14
|
+
- **Incremental Migration**: Maintain backward compatibility throughout transition
|
|
15
|
+
|
|
16
|
+
### Non-Goals
|
|
17
|
+
|
|
18
|
+
- Changing the functionality of existing scripts
|
|
19
|
+
- Adding new features beyond consolidation
|
|
20
|
+
- Migrating CLI commands to HTTP APIs (remains CLI-focused)
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
### High-Level Architecture
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
28
|
+
│ CLI Layer │
|
|
29
|
+
│ (src/cli/commands/) - Commander.js commands │
|
|
30
|
+
│ - Argument validation with Zod │
|
|
31
|
+
│ - Service resolution from DI container │
|
|
32
|
+
│ - Error formatting and user feedback │
|
|
33
|
+
└────────────────┬────────────────────────────────────────────┘
|
|
34
|
+
│
|
|
35
|
+
▼
|
|
36
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
37
|
+
│ Service Layer │
|
|
38
|
+
│ (src/services/) - Business logic and orchestration │
|
|
39
|
+
│ - VersionService: Version management operations │
|
|
40
|
+
│ - DocumentationService: Doc generation operations │
|
|
41
|
+
│ - GitLabService: GitLab API operations │
|
|
42
|
+
│ - SchemaService: Schema validation and generation │
|
|
43
|
+
│ - Input/output validation with Zod │
|
|
44
|
+
│ - Dependency injection │
|
|
45
|
+
└────────────────┬────────────────────────────────────────────┘
|
|
46
|
+
│
|
|
47
|
+
▼
|
|
48
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
49
|
+
│ Repository Layer │
|
|
50
|
+
│ (src/repositories/) - Data access with CRUD operations │
|
|
51
|
+
│ - VersionRepository: .version.json, package.json │
|
|
52
|
+
│ - DocumentationRepository: Markdown files │
|
|
53
|
+
│ - SchemaRepository: JSON schemas (existing) │
|
|
54
|
+
│ - ManifestRepository: OSSA manifests (existing) │
|
|
55
|
+
│ - Data validation with Zod │
|
|
56
|
+
│ - Typed domain objects │
|
|
57
|
+
└────────────────┬────────────────────────────────────────────┘
|
|
58
|
+
│
|
|
59
|
+
▼
|
|
60
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
61
|
+
│ Utility Layer │
|
|
62
|
+
│ (src/utils/) - Shared utilities │
|
|
63
|
+
│ - file-ops: File system operations │
|
|
64
|
+
│ - exec: Command execution │
|
|
65
|
+
│ - markdown-builder: Markdown generation │
|
|
66
|
+
│ - openapi-parser: OpenAPI spec parsing │
|
|
67
|
+
│ - retry: Retry logic with backoff │
|
|
68
|
+
└─────────────────────────────────────────────────────────────┘
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Directory Structure
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
src/
|
|
75
|
+
├── cli/
|
|
76
|
+
│ └── commands/
|
|
77
|
+
│ ├── version.command.ts # Version management commands
|
|
78
|
+
│ ├── docs.command.ts # Documentation generation commands
|
|
79
|
+
│ ├── gitlab.command.ts # GitLab operations commands
|
|
80
|
+
│ └── schema.command.ts # Schema operations commands
|
|
81
|
+
├── services/
|
|
82
|
+
│ ├── version.service.ts # Version management service
|
|
83
|
+
│ ├── documentation.service.ts # Documentation generation service
|
|
84
|
+
│ ├── gitlab.service.ts # GitLab operations service
|
|
85
|
+
│ ├── schema.service.ts # Schema operations service (extends existing)
|
|
86
|
+
│ ├── validation.service.ts # Existing validation service
|
|
87
|
+
│ ├── generation.service.ts # Existing generation service
|
|
88
|
+
│ └── migration.service.ts # Existing migration service
|
|
89
|
+
├── repositories/
|
|
90
|
+
│ ├── base.repository.ts # Base repository interface
|
|
91
|
+
│ ├── version.repository.ts # Version data repository
|
|
92
|
+
│ ├── documentation.repository.ts # Documentation file repository
|
|
93
|
+
│ ├── schema.repository.ts # Existing schema repository
|
|
94
|
+
│ └── manifest.repository.ts # Existing manifest repository
|
|
95
|
+
├── utils/
|
|
96
|
+
│ ├── file-ops.ts # File system operations (from scripts/lib)
|
|
97
|
+
│ ├── exec.ts # Command execution (from scripts/lib)
|
|
98
|
+
│ ├── markdown-builder.ts # Markdown generation utility
|
|
99
|
+
│ ├── openapi-parser.ts # OpenAPI spec parser
|
|
100
|
+
│ ├── retry.ts # Retry logic with exponential backoff
|
|
101
|
+
│ └── errors.ts # Typed domain errors
|
|
102
|
+
├── schemas/
|
|
103
|
+
│ ├── version.schemas.ts # Version-related Zod schemas
|
|
104
|
+
│ ├── documentation.schemas.ts # Documentation-related Zod schemas
|
|
105
|
+
│ ├── gitlab.schemas.ts # GitLab-related Zod schemas
|
|
106
|
+
│ └── schema.schemas.ts # Schema operation Zod schemas
|
|
107
|
+
└── types/
|
|
108
|
+
├── version.types.ts # Version domain types
|
|
109
|
+
├── documentation.types.ts # Documentation domain types
|
|
110
|
+
└── gitlab.types.ts # GitLab domain types
|
|
111
|
+
|
|
112
|
+
openapi/
|
|
113
|
+
└── services/
|
|
114
|
+
├── version-service.openapi.yaml # Version service API contract
|
|
115
|
+
├── documentation-service.openapi.yaml # Documentation service API contract
|
|
116
|
+
├── gitlab-service.openapi.yaml # GitLab service API contract
|
|
117
|
+
└── schema-service.openapi.yaml # Schema service API contract
|
|
118
|
+
|
|
119
|
+
scripts/
|
|
120
|
+
└── (deprecated wrappers that delegate to services)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Components and Interfaces
|
|
124
|
+
|
|
125
|
+
### Base Repository Interface
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// src/repositories/base.repository.ts
|
|
129
|
+
export interface IRepository<T, ID = string> {
|
|
130
|
+
create(data: T): Promise<T>;
|
|
131
|
+
read(id: ID): Promise<T | null>;
|
|
132
|
+
update(id: ID, data: Partial<T>): Promise<T>;
|
|
133
|
+
delete(id: ID): Promise<void>;
|
|
134
|
+
list(): Promise<T[]>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface IFileRepository<T> extends IRepository<T, string> {
|
|
138
|
+
exists(path: string): Promise<boolean>;
|
|
139
|
+
readRaw(path: string): Promise<string>;
|
|
140
|
+
writeRaw(path: string, content: string): Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Version Service
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// src/services/version.service.ts
|
|
148
|
+
export interface IVersionService {
|
|
149
|
+
getCurrentVersion(): Promise<VersionInfo>;
|
|
150
|
+
bumpVersion(type: BumpType): Promise<VersionInfo>;
|
|
151
|
+
syncVersions(): Promise<SyncResult>;
|
|
152
|
+
validateVersion(version: string): boolean;
|
|
153
|
+
getSchemaPath(version: string): string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export type BumpType = 'major' | 'minor' | 'patch' | 'rc' | 'release';
|
|
157
|
+
|
|
158
|
+
export interface VersionInfo {
|
|
159
|
+
current: string;
|
|
160
|
+
latest_stable: string;
|
|
161
|
+
previous: string[];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface SyncResult {
|
|
165
|
+
updated: string[];
|
|
166
|
+
skipped: string[];
|
|
167
|
+
errors: Array<{ file: string; error: string }>;
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Documentation Service
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
// src/services/documentation.service.ts
|
|
175
|
+
export interface IDocumentationService {
|
|
176
|
+
generateApiDocs(options: ApiDocsOptions): Promise<GenerationResult>;
|
|
177
|
+
generateCliDocs(options: CliDocsOptions): Promise<GenerationResult>;
|
|
178
|
+
generateSchemaDocs(options: SchemaDocsOptions): Promise<GenerationResult>;
|
|
179
|
+
generateExamplesDocs(options: ExamplesDocsOptions): Promise<GenerationResult>;
|
|
180
|
+
generateAllDocs(): Promise<GenerationResult[]>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface ApiDocsOptions {
|
|
184
|
+
specPath: string;
|
|
185
|
+
outputPath: string;
|
|
186
|
+
format?: 'markdown' | 'html';
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface GenerationResult {
|
|
190
|
+
success: boolean;
|
|
191
|
+
filesGenerated: string[];
|
|
192
|
+
errors: string[];
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### GitLab Service
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// src/services/gitlab.service.ts
|
|
200
|
+
export interface IGitLabService {
|
|
201
|
+
rebaseMergeRequests(projectId: number, options: RebaseOptions): Promise<RebaseResult>;
|
|
202
|
+
configureBranchProtection(projectId: number, config: BranchProtectionConfig): Promise<void>;
|
|
203
|
+
createIssue(projectId: number, issue: IssueData): Promise<Issue>;
|
|
204
|
+
createMilestoneIssue(projectId: number, milestone: MilestoneData): Promise<Issue>;
|
|
205
|
+
manageMilestoneM Rs(projectId: number, milestoneId: number, action: MRAction): Promise<MRResult>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface RebaseOptions {
|
|
209
|
+
targetBranch?: string;
|
|
210
|
+
dryRun?: boolean;
|
|
211
|
+
maxRetries?: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface RebaseResult {
|
|
215
|
+
rebased: number[];
|
|
216
|
+
failed: Array<{ mrId: number; error: string }>;
|
|
217
|
+
skipped: number[];
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Schema Service
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
// src/services/schema.service.ts
|
|
225
|
+
export interface ISchemaService {
|
|
226
|
+
validateSchema(
|
|
227
|
+
schemaPath: string,
|
|
228
|
+
options?: ValidationOptions
|
|
229
|
+
): Promise<ValidationResult>;
|
|
230
|
+
fixSchemaFormats(schemaPath: string): Promise<FixResult>;
|
|
231
|
+
generateTypes(
|
|
232
|
+
schemaPath: string,
|
|
233
|
+
outputPath: string
|
|
234
|
+
): Promise<GenerationResult>;
|
|
235
|
+
generateZodSchemas(
|
|
236
|
+
schemaPath: string,
|
|
237
|
+
outputPath: string
|
|
238
|
+
): Promise<GenerationResult>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface ValidationOptions {
|
|
242
|
+
strict?: boolean;
|
|
243
|
+
formats?: string[];
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface FixResult {
|
|
247
|
+
fixed: boolean;
|
|
248
|
+
removedFormats: string[];
|
|
249
|
+
outputPath: string;
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Data Models
|
|
254
|
+
|
|
255
|
+
### Version Domain Models
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
// src/types/version.types.ts
|
|
259
|
+
export interface VersionConfig {
|
|
260
|
+
current: string;
|
|
261
|
+
latest_stable: string;
|
|
262
|
+
previous: string[];
|
|
263
|
+
deprecated?: string[];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface PackageJson {
|
|
267
|
+
name: string;
|
|
268
|
+
version: string;
|
|
269
|
+
[key: string]: any;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface VersionBump {
|
|
273
|
+
from: string;
|
|
274
|
+
to: string;
|
|
275
|
+
type: BumpType;
|
|
276
|
+
timestamp: Date;
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Documentation Domain Models
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
// src/types/documentation.types.ts
|
|
284
|
+
export interface OpenAPISpec {
|
|
285
|
+
openapi: string;
|
|
286
|
+
info: OpenAPIInfo;
|
|
287
|
+
servers?: OpenAPIServer[];
|
|
288
|
+
paths: Record<string, PathItem>;
|
|
289
|
+
components?: Components;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface DocumentationMetadata {
|
|
293
|
+
title: string;
|
|
294
|
+
version: string;
|
|
295
|
+
generatedAt: Date;
|
|
296
|
+
sourceFile: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface MarkdownSection {
|
|
300
|
+
heading: string;
|
|
301
|
+
level: number;
|
|
302
|
+
content: string;
|
|
303
|
+
subsections?: MarkdownSection[];
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### GitLab Domain Models
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
// src/types/gitlab.types.ts
|
|
311
|
+
export interface MergeRequest {
|
|
312
|
+
id: number;
|
|
313
|
+
iid: number;
|
|
314
|
+
title: string;
|
|
315
|
+
source_branch: string;
|
|
316
|
+
target_branch: string;
|
|
317
|
+
state: MRState;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export type MRState = 'opened' | 'closed' | 'merged' | 'locked';
|
|
321
|
+
|
|
322
|
+
export interface Issue {
|
|
323
|
+
id: number;
|
|
324
|
+
iid: number;
|
|
325
|
+
title: string;
|
|
326
|
+
description: string;
|
|
327
|
+
labels: string[];
|
|
328
|
+
milestone?: Milestone;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export interface Milestone {
|
|
332
|
+
id: number;
|
|
333
|
+
title: string;
|
|
334
|
+
description: string;
|
|
335
|
+
due_date?: string;
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Correctness Properties
|
|
340
|
+
|
|
341
|
+
_A property is a characteristic or behavior that should hold true across all valid executions of a system-essentially, a formal statement about what the system should do. Properties serve as the bridge between human-readable specifications and machine-verifiable correctness guarantees._
|
|
342
|
+
|
|
343
|
+
### Property 1: Input Validation Universality
|
|
344
|
+
|
|
345
|
+
_For any_ service method that accepts input parameters, when invalid data is provided, the system should reject the input with a ZodError before executing business logic.
|
|
346
|
+
|
|
347
|
+
**Validates: Requirements 1.4, 7.1, 7.3**
|
|
348
|
+
|
|
349
|
+
### Property 2: Version String Validation
|
|
350
|
+
|
|
351
|
+
_For any_ string that does not match semver format (major.minor.patch or major.minor.patch-RC), the VersionService should reject it with a validation error.
|
|
352
|
+
|
|
353
|
+
**Validates: Requirements 2.2**
|
|
354
|
+
|
|
355
|
+
### Property 3: Version Bump Correctness
|
|
356
|
+
|
|
357
|
+
_For any_ valid semver version and bump type (major, minor, patch, rc), the resulting version should follow semver rules: major increments reset minor and patch to 0, minor increments reset patch to 0, patch increments only patch, rc appends -RC suffix.
|
|
358
|
+
|
|
359
|
+
**Validates: Requirements 2.4**
|
|
360
|
+
|
|
361
|
+
### Property 4: Version Sync Consistency
|
|
362
|
+
|
|
363
|
+
_For any_ version sync operation, after completion, the version in package.json, .version.json current field, and the latest spec directory name should all match.
|
|
364
|
+
|
|
365
|
+
**Validates: Requirements 2.5**
|
|
366
|
+
|
|
367
|
+
### Property 5: Documentation Input Validation
|
|
368
|
+
|
|
369
|
+
_For any_ documentation generation operation with invalid input specifications (malformed OpenAPI, missing required fields), the DocumentationService should reject the input with a validation error before attempting generation.
|
|
370
|
+
|
|
371
|
+
**Validates: Requirements 3.2**
|
|
372
|
+
|
|
373
|
+
### Property 6: GitLab Input Validation
|
|
374
|
+
|
|
375
|
+
_For any_ GitLab operation with invalid inputs (negative project IDs, invalid MR IDs, malformed issue data), the GitLabService should reject the input with a validation error before making API calls.
|
|
376
|
+
|
|
377
|
+
**Validates: Requirements 4.3**
|
|
378
|
+
|
|
379
|
+
### Property 7: GitLab Retry Behavior
|
|
380
|
+
|
|
381
|
+
_For any_ GitLab API operation that receives a rate limit error (429 status), the system should retry the operation with exponential backoff, waiting progressively longer between attempts (e.g., 1s, 2s, 4s, 8s).
|
|
382
|
+
|
|
383
|
+
**Validates: Requirements 4.4**
|
|
384
|
+
|
|
385
|
+
### Property 8: GitLab Authentication Validation
|
|
386
|
+
|
|
387
|
+
_For any_ GitLab operation requiring authentication, when an invalid or missing API token is provided, the system should reject the operation with an authentication error before making API calls.
|
|
388
|
+
|
|
389
|
+
**Validates: Requirements 4.5**
|
|
390
|
+
|
|
391
|
+
### Property 9: TypeScript Generation Validity
|
|
392
|
+
|
|
393
|
+
_For any_ valid JSON schema, the generated TypeScript types should compile without errors when checked with the TypeScript compiler.
|
|
394
|
+
|
|
395
|
+
**Validates: Requirements 5.3**
|
|
396
|
+
|
|
397
|
+
### Property 10: Zod Schema Generation Validity
|
|
398
|
+
|
|
399
|
+
_For any_ valid JSON schema, the generated Zod schema should successfully validate data that conforms to the original JSON schema.
|
|
400
|
+
|
|
401
|
+
**Validates: Requirements 5.4**
|
|
402
|
+
|
|
403
|
+
### Property 11: Schema Format Fix Preservation
|
|
404
|
+
|
|
405
|
+
_For any_ JSON schema with unsupported format constraints, after fixing, the modified schema should validate the same set of valid inputs as the original schema (semantic equivalence).
|
|
406
|
+
|
|
407
|
+
**Validates: Requirements 5.5**
|
|
408
|
+
|
|
409
|
+
### Property 12: Repository Data Validation
|
|
410
|
+
|
|
411
|
+
_For any_ repository write operation (create, update), when invalid data is provided, the repository should reject the operation with a validation error before persisting to storage.
|
|
412
|
+
|
|
413
|
+
**Validates: Requirements 6.2**
|
|
414
|
+
|
|
415
|
+
### Property 13: Repository Type Safety
|
|
416
|
+
|
|
417
|
+
_For any_ repository read operation, the returned value should be either null (if not found) or a properly typed domain object that passes Zod schema validation.
|
|
418
|
+
|
|
419
|
+
**Validates: Requirements 6.3**
|
|
420
|
+
|
|
421
|
+
### Property 14: Repository Error Types
|
|
422
|
+
|
|
423
|
+
_For any_ repository operation that encounters an error (file not found, permission denied, invalid data), the thrown error should be a typed domain error (not generic Error) with an appropriate error code.
|
|
424
|
+
|
|
425
|
+
**Validates: Requirements 6.4**
|
|
426
|
+
|
|
427
|
+
### Property 15: Service Output Validation
|
|
428
|
+
|
|
429
|
+
_For any_ service method that returns data, the output should pass Zod schema validation before being returned to the caller.
|
|
430
|
+
|
|
431
|
+
**Validates: Requirements 7.2**
|
|
432
|
+
|
|
433
|
+
### Property 16: Validation Error Detail
|
|
434
|
+
|
|
435
|
+
_For any_ validation failure, the thrown ZodError should contain detailed error messages indicating which fields failed validation and why.
|
|
436
|
+
|
|
437
|
+
**Validates: Requirements 7.3**
|
|
438
|
+
|
|
439
|
+
### Property 17: OpenAPI Specification Validity
|
|
440
|
+
|
|
441
|
+
_For any_ OpenAPI specification created for a service, the spec should pass Redocly CLI validation without errors.
|
|
442
|
+
|
|
443
|
+
**Validates: Requirements 8.4**
|
|
444
|
+
|
|
445
|
+
### Property 18: CLI Service Resolution
|
|
446
|
+
|
|
447
|
+
_For any_ CLI command execution, services should be successfully resolved from the DI container before business logic executes.
|
|
448
|
+
|
|
449
|
+
**Validates: Requirements 9.2**
|
|
450
|
+
|
|
451
|
+
### Property 19: CLI Argument Validation
|
|
452
|
+
|
|
453
|
+
_For any_ CLI command with arguments, invalid arguments should be rejected with a validation error and user-friendly message before the command executes.
|
|
454
|
+
|
|
455
|
+
**Validates: Requirements 9.3**
|
|
456
|
+
|
|
457
|
+
### Property 20: CLI Error Formatting
|
|
458
|
+
|
|
459
|
+
_For any_ service error thrown during CLI command execution, the CLI should catch the error and format it as a user-friendly message (not a stack trace) before exiting.
|
|
460
|
+
|
|
461
|
+
**Validates: Requirements 9.4**
|
|
462
|
+
|
|
463
|
+
### Property 21: Migration Backward Compatibility
|
|
464
|
+
|
|
465
|
+
_For any_ migrated script, when executed with the same inputs, the wrapper script should produce the same output and exit code as the original script behavior.
|
|
466
|
+
|
|
467
|
+
**Validates: Requirements 11.1**
|
|
468
|
+
|
|
469
|
+
### Property 22: Deprecation Warning Presence
|
|
470
|
+
|
|
471
|
+
_For any_ deprecated script wrapper, when executed, a deprecation warning with migration instructions should be displayed to the user before delegating to the service.
|
|
472
|
+
|
|
473
|
+
**Validates: Requirements 11.4**
|
|
474
|
+
|
|
475
|
+
### Property 23: Utility Configuration Validation
|
|
476
|
+
|
|
477
|
+
_For any_ utility that accepts configuration, invalid configuration should be rejected with a validation error before the utility executes.
|
|
478
|
+
|
|
479
|
+
**Validates: Requirements 12.4**
|
|
480
|
+
|
|
481
|
+
### Property 24: Utility Error Types
|
|
482
|
+
|
|
483
|
+
_For any_ utility operation that encounters an error, the thrown error should be a typed domain error with an appropriate error code (not generic Error).
|
|
484
|
+
|
|
485
|
+
**Validates: Requirements 12.5**
|
|
486
|
+
|
|
487
|
+
## Error Handling
|
|
488
|
+
|
|
489
|
+
### Error Hierarchy
|
|
490
|
+
|
|
491
|
+
```typescript
|
|
492
|
+
// src/utils/errors.ts
|
|
493
|
+
export class DomainError extends Error {
|
|
494
|
+
constructor(
|
|
495
|
+
message: string,
|
|
496
|
+
public code: string,
|
|
497
|
+
public details?: Record<string, any>
|
|
498
|
+
) {
|
|
499
|
+
super(message);
|
|
500
|
+
this.name = this.constructor.name;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export class ValidationError extends DomainError {
|
|
505
|
+
constructor(message: string, details?: Record<string, any>) {
|
|
506
|
+
super(message, 'VALIDATION_ERROR', details);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export class NotFoundError extends DomainError {
|
|
511
|
+
constructor(resource: string, id: string) {
|
|
512
|
+
super(`${resource} not found: ${id}`, 'NOT_FOUND', { resource, id });
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export class GitLabError extends DomainError {
|
|
517
|
+
constructor(
|
|
518
|
+
message: string,
|
|
519
|
+
public statusCode?: number
|
|
520
|
+
) {
|
|
521
|
+
super(message, 'GITLAB_ERROR', { statusCode });
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export class SchemaError extends DomainError {
|
|
526
|
+
constructor(
|
|
527
|
+
message: string,
|
|
528
|
+
public schemaPath?: string
|
|
529
|
+
) {
|
|
530
|
+
super(message, 'SCHEMA_ERROR', { schemaPath });
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### Error Handling Patterns
|
|
536
|
+
|
|
537
|
+
1. **Service Layer**: Catch repository errors, add context, rethrow as domain errors
|
|
538
|
+
2. **Repository Layer**: Catch file system errors, validate data, throw typed errors
|
|
539
|
+
3. **CLI Layer**: Catch all errors, format user-friendly messages, exit with appropriate codes
|
|
540
|
+
4. **Utility Layer**: Throw typed errors with detailed context
|
|
541
|
+
|
|
542
|
+
### Error Response Format
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
interface ErrorResponse {
|
|
546
|
+
error: string; // Error code
|
|
547
|
+
message: string; // Human-readable message
|
|
548
|
+
details?: Record<string, any>; // Additional context
|
|
549
|
+
stack?: string; // Stack trace (development only)
|
|
550
|
+
}
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
## Testing Strategy
|
|
554
|
+
|
|
555
|
+
### Unit Testing
|
|
556
|
+
|
|
557
|
+
**Framework**: Jest with TypeScript support
|
|
558
|
+
|
|
559
|
+
**Coverage Target**: Minimum 80% code coverage
|
|
560
|
+
|
|
561
|
+
**Approach**:
|
|
562
|
+
|
|
563
|
+
- Mock repository dependencies using Jest mocks
|
|
564
|
+
- Test each service method in isolation
|
|
565
|
+
- Test error conditions and edge cases
|
|
566
|
+
- Test validation logic with invalid inputs
|
|
567
|
+
|
|
568
|
+
**Example**:
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
describe('VersionService', () => {
|
|
572
|
+
let service: VersionService;
|
|
573
|
+
let mockRepository: jest.Mocked<IVersionRepository>;
|
|
574
|
+
|
|
575
|
+
beforeEach(() => {
|
|
576
|
+
mockRepository = {
|
|
577
|
+
read: jest.fn(),
|
|
578
|
+
update: jest.fn(),
|
|
579
|
+
// ... other methods
|
|
580
|
+
} as any;
|
|
581
|
+
service = new VersionService(mockRepository);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
it('should bump patch version correctly', async () => {
|
|
585
|
+
mockRepository.read.mockResolvedValue({
|
|
586
|
+
current: '1.2.3',
|
|
587
|
+
latest_stable: '1.2.3',
|
|
588
|
+
previous: [],
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
const result = await service.bumpVersion('patch');
|
|
592
|
+
|
|
593
|
+
expect(result.current).toBe('1.2.4');
|
|
594
|
+
expect(mockRepository.update).toHaveBeenCalled();
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### Property-Based Testing
|
|
600
|
+
|
|
601
|
+
**Framework**: fast-check
|
|
602
|
+
|
|
603
|
+
**Configuration**: Minimum 100 iterations per property
|
|
604
|
+
|
|
605
|
+
**Approach**:
|
|
606
|
+
|
|
607
|
+
- Generate random valid and invalid inputs
|
|
608
|
+
- Verify universal properties hold across all inputs
|
|
609
|
+
- Test invariants and round-trip properties
|
|
610
|
+
- Focus on validation, transformation, and consistency properties
|
|
611
|
+
|
|
612
|
+
**Example**:
|
|
613
|
+
|
|
614
|
+
```typescript
|
|
615
|
+
import * as fc from 'fast-check';
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Feature: scripts-migration-api-first, Property 3: Version Bump Correctness
|
|
619
|
+
* Validates: Requirements 2.4
|
|
620
|
+
*/
|
|
621
|
+
describe('Property: Version Bump Correctness', () => {
|
|
622
|
+
it('should follow semver rules for all bump types', () => {
|
|
623
|
+
fc.assert(
|
|
624
|
+
fc.property(
|
|
625
|
+
fc.record({
|
|
626
|
+
major: fc.nat(100),
|
|
627
|
+
minor: fc.nat(100),
|
|
628
|
+
patch: fc.nat(100),
|
|
629
|
+
}),
|
|
630
|
+
fc.constantFrom('major', 'minor', 'patch'),
|
|
631
|
+
(version, bumpType) => {
|
|
632
|
+
const versionString = `${version.major}.${version.minor}.${version.patch}`;
|
|
633
|
+
const service = new VersionService(mockRepository);
|
|
634
|
+
const result = service.bumpVersionString(versionString, bumpType);
|
|
635
|
+
|
|
636
|
+
const [newMajor, newMinor, newPatch] = result.split('.').map(Number);
|
|
637
|
+
|
|
638
|
+
if (bumpType === 'major') {
|
|
639
|
+
return (
|
|
640
|
+
newMajor === version.major + 1 && newMinor === 0 && newPatch === 0
|
|
641
|
+
);
|
|
642
|
+
} else if (bumpType === 'minor') {
|
|
643
|
+
return (
|
|
644
|
+
newMajor === version.major &&
|
|
645
|
+
newMinor === version.minor + 1 &&
|
|
646
|
+
newPatch === 0
|
|
647
|
+
);
|
|
648
|
+
} else {
|
|
649
|
+
return (
|
|
650
|
+
newMajor === version.major &&
|
|
651
|
+
newMinor === version.minor &&
|
|
652
|
+
newPatch === version.patch + 1
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
{ numRuns: 100 }
|
|
658
|
+
);
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### Integration Testing
|
|
664
|
+
|
|
665
|
+
**Approach**:
|
|
666
|
+
|
|
667
|
+
- Test service + repository integration with real file system
|
|
668
|
+
- Use temporary directories for file operations
|
|
669
|
+
- Test CLI commands end-to-end
|
|
670
|
+
- Verify OpenAPI spec generation and validation
|
|
671
|
+
|
|
672
|
+
**Example**:
|
|
673
|
+
|
|
674
|
+
```typescript
|
|
675
|
+
describe('VersionService Integration', () => {
|
|
676
|
+
let tempDir: string;
|
|
677
|
+
let service: VersionService;
|
|
678
|
+
|
|
679
|
+
beforeEach(async () => {
|
|
680
|
+
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'version-test-'));
|
|
681
|
+
const repository = new VersionRepository(tempDir);
|
|
682
|
+
service = new VersionService(repository);
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
afterEach(async () => {
|
|
686
|
+
await fs.rm(tempDir, { recursive: true });
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
it('should sync versions across all files', async () => {
|
|
690
|
+
// Create test files
|
|
691
|
+
await fs.writeFile(
|
|
692
|
+
path.join(tempDir, 'package.json'),
|
|
693
|
+
JSON.stringify({ version: '1.0.0' })
|
|
694
|
+
);
|
|
695
|
+
await fs.writeFile(
|
|
696
|
+
path.join(tempDir, '.version.json'),
|
|
697
|
+
JSON.stringify({ current: '1.0.0' })
|
|
698
|
+
);
|
|
699
|
+
|
|
700
|
+
await service.syncVersions();
|
|
701
|
+
|
|
702
|
+
// Verify all files updated
|
|
703
|
+
const pkg = JSON.parse(
|
|
704
|
+
await fs.readFile(path.join(tempDir, 'package.json'), 'utf8')
|
|
705
|
+
);
|
|
706
|
+
const ver = JSON.parse(
|
|
707
|
+
await fs.readFile(path.join(tempDir, '.version.json'), 'utf8')
|
|
708
|
+
);
|
|
709
|
+
|
|
710
|
+
expect(pkg.version).toBe(ver.current);
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
### Test Organization
|
|
716
|
+
|
|
717
|
+
```
|
|
718
|
+
tests/
|
|
719
|
+
├── unit/
|
|
720
|
+
│ ├── services/
|
|
721
|
+
│ │ ├── version.service.test.ts
|
|
722
|
+
│ │ ├── documentation.service.test.ts
|
|
723
|
+
│ │ ├── gitlab.service.test.ts
|
|
724
|
+
│ │ └── schema.service.test.ts
|
|
725
|
+
│ ├── repositories/
|
|
726
|
+
│ │ ├── version.repository.test.ts
|
|
727
|
+
│ │ └── documentation.repository.test.ts
|
|
728
|
+
│ └── utils/
|
|
729
|
+
│ ├── markdown-builder.test.ts
|
|
730
|
+
│ └── retry.test.ts
|
|
731
|
+
├── properties/
|
|
732
|
+
│ ├── version-properties.test.ts
|
|
733
|
+
│ ├── validation-properties.test.ts
|
|
734
|
+
│ └── repository-properties.test.ts
|
|
735
|
+
├── integration/
|
|
736
|
+
│ ├── version-integration.test.ts
|
|
737
|
+
│ ├── documentation-integration.test.ts
|
|
738
|
+
│ └── cli-integration.test.ts
|
|
739
|
+
└── fixtures/
|
|
740
|
+
├── openapi-specs/
|
|
741
|
+
├── json-schemas/
|
|
742
|
+
└── version-configs/
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
## Migration Strategy
|
|
746
|
+
|
|
747
|
+
### Phase 1: Foundation (Week 1)
|
|
748
|
+
|
|
749
|
+
1. Create base repository interface and utilities
|
|
750
|
+
2. Move `scripts/lib/*` to `src/utils/`
|
|
751
|
+
3. Create error hierarchy
|
|
752
|
+
4. Set up Zod schema directory structure
|
|
753
|
+
5. Create OpenAPI spec templates
|
|
754
|
+
|
|
755
|
+
### Phase 2: Version Service (Week 2)
|
|
756
|
+
|
|
757
|
+
1. Define OpenAPI spec for VersionService
|
|
758
|
+
2. Implement VersionRepository with CRUD operations
|
|
759
|
+
3. Implement VersionService with all version operations
|
|
760
|
+
4. Create CLI commands for version operations
|
|
761
|
+
5. Write unit and property-based tests
|
|
762
|
+
6. Create wrapper scripts that delegate to service
|
|
763
|
+
|
|
764
|
+
### Phase 3: Documentation Service (Week 3)
|
|
765
|
+
|
|
766
|
+
1. Define OpenAPI spec for DocumentationService
|
|
767
|
+
2. Implement DocumentationRepository
|
|
768
|
+
3. Implement MarkdownBuilder utility
|
|
769
|
+
4. Implement OpenAPIParser utility
|
|
770
|
+
5. Implement DocumentationService
|
|
771
|
+
6. Create CLI commands for documentation operations
|
|
772
|
+
7. Write unit and property-based tests
|
|
773
|
+
8. Create wrapper scripts
|
|
774
|
+
|
|
775
|
+
### Phase 4: GitLab Service (Week 4)
|
|
776
|
+
|
|
777
|
+
1. Define OpenAPI spec for GitLabService
|
|
778
|
+
2. Implement retry utility with exponential backoff
|
|
779
|
+
3. Implement GitLabService with all GitLab operations
|
|
780
|
+
4. Create CLI commands for GitLab operations
|
|
781
|
+
5. Write unit and property-based tests
|
|
782
|
+
6. Create wrapper scripts
|
|
783
|
+
|
|
784
|
+
### Phase 5: Schema Service (Week 5)
|
|
785
|
+
|
|
786
|
+
1. Define OpenAPI spec for SchemaService
|
|
787
|
+
2. Extend existing SchemaRepository
|
|
788
|
+
3. Implement SchemaService extending existing validation service
|
|
789
|
+
4. Create CLI commands for schema operations
|
|
790
|
+
5. Write unit and property-based tests
|
|
791
|
+
6. Create wrapper scripts
|
|
792
|
+
|
|
793
|
+
### Phase 6: Cleanup and Documentation (Week 6)
|
|
794
|
+
|
|
795
|
+
1. Verify all wrapper scripts work correctly
|
|
796
|
+
2. Add deprecation warnings to wrapper scripts
|
|
797
|
+
3. Update all documentation
|
|
798
|
+
4. Run full test suite
|
|
799
|
+
5. Verify 80%+ code coverage
|
|
800
|
+
6. Create migration guide for users
|
|
801
|
+
|
|
802
|
+
### Backward Compatibility Strategy
|
|
803
|
+
|
|
804
|
+
Each migrated script will be replaced with a thin wrapper that:
|
|
805
|
+
|
|
806
|
+
1. Displays a deprecation warning
|
|
807
|
+
2. Resolves the appropriate service from DI container
|
|
808
|
+
3. Validates arguments using Zod
|
|
809
|
+
4. Delegates to the service method
|
|
810
|
+
5. Formats output to match original script behavior
|
|
811
|
+
6. Exits with the same exit codes
|
|
812
|
+
|
|
813
|
+
Example wrapper:
|
|
814
|
+
|
|
815
|
+
```typescript
|
|
816
|
+
#!/usr/bin/env tsx
|
|
817
|
+
// scripts/bump-version.ts (deprecated wrapper)
|
|
818
|
+
|
|
819
|
+
import { container } from '../src/di-container.js';
|
|
820
|
+
import { IVersionService } from '../src/services/version.service.js';
|
|
821
|
+
import chalk from 'chalk';
|
|
822
|
+
|
|
823
|
+
console.warn(
|
|
824
|
+
chalk.yellow('⚠️ This script is deprecated. Use: ossa version bump <type>')
|
|
825
|
+
);
|
|
826
|
+
console.warn(
|
|
827
|
+
chalk.yellow(' Migration guide: https://docs.ossa.dev/migration/scripts\n')
|
|
828
|
+
);
|
|
829
|
+
|
|
830
|
+
const service = container.get<IVersionService>('VersionService');
|
|
831
|
+
const bumpType = process.argv[2] || 'patch';
|
|
832
|
+
|
|
833
|
+
try {
|
|
834
|
+
const result = await service.bumpVersion(bumpType as any);
|
|
835
|
+
console.log(`✅ Bumped version to ${result.current}`);
|
|
836
|
+
process.exit(0);
|
|
837
|
+
} catch (error) {
|
|
838
|
+
console.error(chalk.red('❌ Error:'), error.message);
|
|
839
|
+
process.exit(1);
|
|
840
|
+
}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
## Dependencies
|
|
844
|
+
|
|
845
|
+
### New Dependencies
|
|
846
|
+
|
|
847
|
+
- `fast-check`: Property-based testing framework
|
|
848
|
+
- None (all other dependencies already exist in package.json)
|
|
849
|
+
|
|
850
|
+
### Existing Dependencies
|
|
851
|
+
|
|
852
|
+
- `zod`: Runtime validation (already installed)
|
|
853
|
+
- `commander`: CLI framework (already installed)
|
|
854
|
+
- `inversify`: Dependency injection (already installed)
|
|
855
|
+
- `@gitbeaker/node`: GitLab API client (already installed)
|
|
856
|
+
- `json-schema-to-typescript`: Type generation (already installed)
|
|
857
|
+
- `json-schema-to-zod`: Zod schema generation (already installed)
|
|
858
|
+
- `yaml`: YAML parsing (already installed)
|
|
859
|
+
- `jest`: Testing framework (already installed)
|
|
860
|
+
|
|
861
|
+
## Performance Considerations
|
|
862
|
+
|
|
863
|
+
1. **Lazy Loading**: Services should be lazily instantiated from DI container
|
|
864
|
+
2. **Caching**: Version information should be cached to avoid repeated file reads
|
|
865
|
+
3. **Parallel Operations**: Documentation generation should process multiple specs in parallel
|
|
866
|
+
4. **Streaming**: Large file operations should use streams when possible
|
|
867
|
+
5. **Retry Limits**: GitLab operations should have configurable retry limits to prevent infinite loops
|
|
868
|
+
|
|
869
|
+
## Security Considerations
|
|
870
|
+
|
|
871
|
+
1. **API Token Storage**: GitLab tokens should be read from environment variables, never hardcoded
|
|
872
|
+
2. **Path Validation**: All file paths should be validated to prevent directory traversal
|
|
873
|
+
3. **Command Injection**: Command execution should use parameterized commands, not string concatenation
|
|
874
|
+
4. **Schema Validation**: All external inputs should be validated before processing
|
|
875
|
+
5. **Error Messages**: Error messages should not leak sensitive information (paths, tokens)
|
|
876
|
+
|
|
877
|
+
## Monitoring and Observability
|
|
878
|
+
|
|
879
|
+
1. **Logging**: Use structured logging with log levels (debug, info, warn, error)
|
|
880
|
+
2. **Metrics**: Track operation counts, durations, and error rates
|
|
881
|
+
3. **Tracing**: Add correlation IDs for tracking operations across services
|
|
882
|
+
4. **Health Checks**: Implement health check endpoints for service status
|
|
883
|
+
5. **Audit Trail**: Log all version bumps and GitLab operations for audit purposes
|