@contractspec/bundle.workspace 1.45.1 → 1.45.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/services/doctor/checks/deps.js +7 -0
- package/dist/services/doctor/checks/deps.js.map +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +1 -0
- package/dist/services/sync.d.ts.map +1 -1
- package/dist/services/validate/blueprint-validator.js +1 -1
- package/dist/services/validate/blueprint-validator.js.map +1 -1
- package/dist/services/validate/tenant-validator.js +1 -1
- package/dist/services/validate/tenant-validator.js.map +1 -1
- package/dist/services/versioning/changelog-formatter.d.ts +24 -0
- package/dist/services/versioning/changelog-formatter.d.ts.map +1 -0
- package/dist/services/versioning/changelog-formatter.js +155 -0
- package/dist/services/versioning/changelog-formatter.js.map +1 -0
- package/dist/services/versioning/index.d.ts +11 -0
- package/dist/services/versioning/index.d.ts.map +1 -0
- package/dist/services/versioning/index.js +17 -0
- package/dist/services/versioning/index.js.map +1 -0
- package/dist/services/versioning/types.d.ts +133 -0
- package/dist/services/versioning/types.d.ts.map +1 -0
- package/dist/services/versioning/versioning-service.d.ts +32 -0
- package/dist/services/versioning/versioning-service.d.ts.map +1 -0
- package/dist/services/versioning/versioning-service.js +359 -0
- package/dist/services/versioning/versioning-service.js.map +1 -0
- package/dist/templates/app-config.template.js +7 -7
- package/dist/templates/app-config.template.js.map +1 -1
- package/dist/templates/experiment.template.js +4 -4
- package/dist/templates/experiment.template.js.map +1 -1
- package/dist/templates/integration.template.js +3 -3
- package/dist/templates/integration.template.js.map +1 -1
- package/dist/types.d.ts +20 -20
- package/package.json +7 -11
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ import { formatQuickstartPreview, isContractSpecInstalled, runQuickstart } from
|
|
|
89
89
|
import { DocsServiceOptions, DocsServiceResult, generateDocsFromSpecs } from "./services/docs/docs-service.js";
|
|
90
90
|
import { index_d_exports as index_d_exports$1 } from "./services/impact/index.js";
|
|
91
91
|
import { FormatterOptions, formatFiles } from "./services/formatter.js";
|
|
92
|
+
import { index_d_exports as index_d_exports$4 } from "./services/versioning/index.js";
|
|
92
93
|
import "./services/index.js";
|
|
93
94
|
import { index_d_exports } from "./formatters/index.js";
|
|
94
95
|
import { AIClient } from "./ai/client.js";
|
|
@@ -102,4 +103,4 @@ import { OpenAICodexAgent } from "./ai/agents/openai-codex-agent.js";
|
|
|
102
103
|
import { index_d_exports as index_d_exports$2 } from "./ai/prompts/index.js";
|
|
103
104
|
import "./ai/index.js";
|
|
104
105
|
import * as module from "@contractspec/module.workspace";
|
|
105
|
-
export { AIClient, AIGenerator, AIReviewResult, ALL_CHECK_CATEGORIES, ALL_CI_CHECK_CATEGORIES, ALL_SETUP_TARGETS, AgentAdapter, AgentConfig, AgentGuideConfig, AgentGuideService, type AgentMode, AgentOrchestrator, AgentProvider, AgentResult, AgentTask, AiAdapter, AiGenerateOptions, AiGenerateResult, AiGenerateStructuredOptions, type AiProvider, AiValidationResult, AnalyzeDepsOptions, AnalyzeDepsResult, BehaviorCheck, BlueprintValidationResult, BuildSpecOptions, BuildSpecResult, BuildTarget, BuildTargetResult, CHECK_CATEGORY_LABELS, CICheckCategory, CICheckCategorySummary, CICheckOptions, CICheckResult, CIFormatOptions, CIIssue, CIIssueSeverity, CIOutputFormat, CI_CHECK_CATEGORY_LABELS, CacheEntryMeta, CacheKeyString, CacheLookupResult, CacheMissReason, CacheStats, CacheStorageAdapter, CheckCategory, CheckContext, CheckResult, CheckStatus, ClaudeCodeAdapter, ClaudeCodeAgent, CleanOptions, CleanResult, CompareSpecsOptions, CompareSpecsResult, type Config, CoverageByType, CreateAdaptersOptions, CreateRegeneratorOptions, CursorAgent, CursorCLIAdapter, DEFAULT_CACHE_CONFIG, DiagramOptions, DiagramType, DiscoverOptions, DiscoveryOptions, DocsServiceOptions, DocsServiceResult, DoctorOptions, DoctorPromptCallbacks, DoctorResult, ExtendedWorkspaceInfo, FULL_DEPENDENCIES, FieldMapping, FieldMatchType, FileStat, FileSystemCacheStorage, FixAction, FixResult, FormatOptions, FormatterOptions, FsAdapter, GenericMCPAdapter, GitAdapter, GitCleanOptions, GuideOptions, GuideResult, ImplementationSource, ImplementationStatus, ImplementationValidationResult, ImplementationValidatorOptions, InMemoryCacheStorage, IntegrityAnalysisOptions, IntegrityAnalysisResult, IntegrityIssue, IntentAlignment, KeyValueStore, LayerDiscoveryOptions, LayerDiscoveryResult, LayerInventory, LayerLocation, OpenApiExportOptions as LegacyOpenApiExportOptions, OpenApiExportResult as LegacyOpenApiExportResult, ListSpecsOptions, LogLevel, LoggerAdapter, MINIMAL_DEPENDENCIES, MetaRepoInfo, MonorepoConfig, OpenAICodexAgent, OpenApiExportServiceOptions, OpenApiExportServiceResult, OpenApiImportServiceOptions, OpenApiImportServiceResult, OpenApiSyncServiceOptions, OpenApiSyncServiceResult, OpenApiValidateServiceOptions, OpenApiValidateServiceResult, PackageInstallResult, PackageManager, ProgressReporter, ProgressUpdate, QuickstartDependency, QuickstartMode, QuickstartOptions, QuickstartPromptCallbacks, QuickstartResult, RegistryClient, RegistryClientOptions, RepositoryType, ResolvedImplementation, ResolverOptions, RunTestsResult, SETUP_TARGET_LABELS, SemanticVerificationResult, SetupFileResult, SetupOptions, SetupPromptCallbacks, SetupResult, SetupScope, SetupTarget, SimpleAgent, SpecCreatorService, SpecImplementationResult, SpecInventory, SpecLocation, SpecReferenceMatch, StructureCheck, SubmoduleInfo, SyncBuildFn, SyncSpecsOptions, SyncSpecsResult, SyncSpecsRunResult, SyncValidateFn, TenantValidationContext, TenantValidationResult, TestServiceOptions, TestServiceResult, ValidateImplementationOptions, ValidateImplementationResult, ValidateSpecOptions, ValidateSpecResult, VerificationCacheConfig, VerificationCacheEntry, VerificationCacheKey, VerificationCacheService, VerificationIssue, VerifyConfig, VerifyInput, VerifyOptions, VerifyResult, VerifyService, WatchBuildFn, WatchEvent, WatchEventHandler, WatchEventType, WatchOptions, WatchSpecsOptions, WatchValidateFn, Watcher, WatcherAdapter, WorkspaceAdapters, WorkspaceConfigInfo, WorkspaceInfo, WorkspaceStateCacheStorage, addToRegistry, agentAdapters, agentGuideService, analyzeDeps, analyzeIntegrity, buildSpec, cacheKeyToString, claudeCodeAdapter, cleanArtifacts, compareSpecs, computeContentHash, createAgentGuideService, createConsoleLoggerAdapter, createEmptyLayerInventory, createFileSystemCacheStorage, createInMemoryCacheStorage, createNodeAdapters, createNodeAiAdapter, createNodeFsAdapter, createNodeGitAdapter, createNodeWatcherAdapter, createNoopLoggerAdapter, createQuickAIReview, createRegeneratorService, createSpecCreator, createVerificationCacheService, createVerifyService, createWorkspaceStateCacheStorage, cursorCLIAdapter, deepMergeOverwrite, deepMergePreserve, detectPackageManager, detectRepositoryType, discoverAllImplementations, discoverImplementationsForSpec, discoverLayers, exportGraphAsDot, exportOpenApi, exportSpecForLLM, extractSpecReferences, filterIssuesBySeverity, filterIssuesByType, findAllConfigFiles, findMetaRepoRoot, findPackageRoot, findWorkspaceRoot, formatCheckResult, formatDoctorSummary, formatFiles, formatJson, formatQuickstartPreview, formatVerificationReport, formatWorkspaceInfo, index_d_exports as formatters, generateAgentsMd, generateAppBlueprintSpec, generateClaudeMcpConfig, generateComponentTemplate, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateCursorRulesFromParsedSpec, generateDataViewSpec, generateDocsFromSpecs, generateEventSpec, generateExperimentSpec, generateFeatureContextMarkdown, generateGuideFromParsedSpec, generateHandlerTemplate, generateIntegrationSpec, generateKnowledgeSpaceSpec, generateMermaidDiagram, generateMigrationSpec, generateOperationSpec, generatePresentationSpec, generateTelemetrySpec, generateTestTemplate, generateVscodeSettings, generateWorkflowRunnerTemplate, generateWorkflowSpec, genericMCPAdapter, getAIProvider, getAgentAdapter, getAllLayerLocations, getAllSpecs, getApiKey, getClaudeDesktopConfigPath, getContractNode, getDependencies, getDevDependencies, getExecCommand, getExtendedWorkspaceInfo, getGraphStats, getImplementationSummary, getInstallCommand, getMetaRepoInfo, getPackageName, getProductionDependencies, getRecommendedModels, getRunCommand, getWorkspaceInfo, getWorkspacePackages, groupSpecsByType, index_d_exports$1 as impact, importFromOpenApiService, inferImplementationType, isContractSpecInstalled, isMonorepo, listAgentTypes, listFromRegistry, listSpecs, loadWorkspaceConfig, mergeMonorepoConfigs, module, parseGitModules, index_d_exports$2 as prompts, resolveAllImplementations, resolveImplementations, resolveRegistryUrl, runCIChecks, runDoctor, runQuickstart, runSetup, runTestSpecs, runTests, safeParseJson, searchRegistry, stringToCacheKey, syncSpecs, syncWithOpenApiService, index_d_exports$3 as templates, validateAgainstOpenApiService, validateBlueprint, validateImplementationFiles, validateImplementationWithAgent, validateProvider, validateSpec, validateSpecs, validateTenantConfig, verifyBehavior, verifyImplementationAgainstParsedSpec, verifySemanticFields, verifyService, verifyStructure, verifyWithAI, verifyWithAIEnhanced, watchSpecs };
|
|
106
|
+
export { AIClient, AIGenerator, AIReviewResult, ALL_CHECK_CATEGORIES, ALL_CI_CHECK_CATEGORIES, ALL_SETUP_TARGETS, AgentAdapter, AgentConfig, AgentGuideConfig, AgentGuideService, type AgentMode, AgentOrchestrator, AgentProvider, AgentResult, AgentTask, AiAdapter, AiGenerateOptions, AiGenerateResult, AiGenerateStructuredOptions, type AiProvider, AiValidationResult, AnalyzeDepsOptions, AnalyzeDepsResult, BehaviorCheck, BlueprintValidationResult, BuildSpecOptions, BuildSpecResult, BuildTarget, BuildTargetResult, CHECK_CATEGORY_LABELS, CICheckCategory, CICheckCategorySummary, CICheckOptions, CICheckResult, CIFormatOptions, CIIssue, CIIssueSeverity, CIOutputFormat, CI_CHECK_CATEGORY_LABELS, CacheEntryMeta, CacheKeyString, CacheLookupResult, CacheMissReason, CacheStats, CacheStorageAdapter, CheckCategory, CheckContext, CheckResult, CheckStatus, ClaudeCodeAdapter, ClaudeCodeAgent, CleanOptions, CleanResult, CompareSpecsOptions, CompareSpecsResult, type Config, CoverageByType, CreateAdaptersOptions, CreateRegeneratorOptions, CursorAgent, CursorCLIAdapter, DEFAULT_CACHE_CONFIG, DiagramOptions, DiagramType, DiscoverOptions, DiscoveryOptions, DocsServiceOptions, DocsServiceResult, DoctorOptions, DoctorPromptCallbacks, DoctorResult, ExtendedWorkspaceInfo, FULL_DEPENDENCIES, FieldMapping, FieldMatchType, FileStat, FileSystemCacheStorage, FixAction, FixResult, FormatOptions, FormatterOptions, FsAdapter, GenericMCPAdapter, GitAdapter, GitCleanOptions, GuideOptions, GuideResult, ImplementationSource, ImplementationStatus, ImplementationValidationResult, ImplementationValidatorOptions, InMemoryCacheStorage, IntegrityAnalysisOptions, IntegrityAnalysisResult, IntegrityIssue, IntentAlignment, KeyValueStore, LayerDiscoveryOptions, LayerDiscoveryResult, LayerInventory, LayerLocation, OpenApiExportOptions as LegacyOpenApiExportOptions, OpenApiExportResult as LegacyOpenApiExportResult, ListSpecsOptions, LogLevel, LoggerAdapter, MINIMAL_DEPENDENCIES, MetaRepoInfo, MonorepoConfig, OpenAICodexAgent, OpenApiExportServiceOptions, OpenApiExportServiceResult, OpenApiImportServiceOptions, OpenApiImportServiceResult, OpenApiSyncServiceOptions, OpenApiSyncServiceResult, OpenApiValidateServiceOptions, OpenApiValidateServiceResult, PackageInstallResult, PackageManager, ProgressReporter, ProgressUpdate, QuickstartDependency, QuickstartMode, QuickstartOptions, QuickstartPromptCallbacks, QuickstartResult, RegistryClient, RegistryClientOptions, RepositoryType, ResolvedImplementation, ResolverOptions, RunTestsResult, SETUP_TARGET_LABELS, SemanticVerificationResult, SetupFileResult, SetupOptions, SetupPromptCallbacks, SetupResult, SetupScope, SetupTarget, SimpleAgent, SpecCreatorService, SpecImplementationResult, SpecInventory, SpecLocation, SpecReferenceMatch, StructureCheck, SubmoduleInfo, SyncBuildFn, SyncSpecsOptions, SyncSpecsResult, SyncSpecsRunResult, SyncValidateFn, TenantValidationContext, TenantValidationResult, TestServiceOptions, TestServiceResult, ValidateImplementationOptions, ValidateImplementationResult, ValidateSpecOptions, ValidateSpecResult, VerificationCacheConfig, VerificationCacheEntry, VerificationCacheKey, VerificationCacheService, VerificationIssue, VerifyConfig, VerifyInput, VerifyOptions, VerifyResult, VerifyService, WatchBuildFn, WatchEvent, WatchEventHandler, WatchEventType, WatchOptions, WatchSpecsOptions, WatchValidateFn, Watcher, WatcherAdapter, WorkspaceAdapters, WorkspaceConfigInfo, WorkspaceInfo, WorkspaceStateCacheStorage, addToRegistry, agentAdapters, agentGuideService, analyzeDeps, analyzeIntegrity, buildSpec, cacheKeyToString, claudeCodeAdapter, cleanArtifacts, compareSpecs, computeContentHash, createAgentGuideService, createConsoleLoggerAdapter, createEmptyLayerInventory, createFileSystemCacheStorage, createInMemoryCacheStorage, createNodeAdapters, createNodeAiAdapter, createNodeFsAdapter, createNodeGitAdapter, createNodeWatcherAdapter, createNoopLoggerAdapter, createQuickAIReview, createRegeneratorService, createSpecCreator, createVerificationCacheService, createVerifyService, createWorkspaceStateCacheStorage, cursorCLIAdapter, deepMergeOverwrite, deepMergePreserve, detectPackageManager, detectRepositoryType, discoverAllImplementations, discoverImplementationsForSpec, discoverLayers, exportGraphAsDot, exportOpenApi, exportSpecForLLM, extractSpecReferences, filterIssuesBySeverity, filterIssuesByType, findAllConfigFiles, findMetaRepoRoot, findPackageRoot, findWorkspaceRoot, formatCheckResult, formatDoctorSummary, formatFiles, formatJson, formatQuickstartPreview, formatVerificationReport, formatWorkspaceInfo, index_d_exports as formatters, generateAgentsMd, generateAppBlueprintSpec, generateClaudeMcpConfig, generateComponentTemplate, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateCursorRulesFromParsedSpec, generateDataViewSpec, generateDocsFromSpecs, generateEventSpec, generateExperimentSpec, generateFeatureContextMarkdown, generateGuideFromParsedSpec, generateHandlerTemplate, generateIntegrationSpec, generateKnowledgeSpaceSpec, generateMermaidDiagram, generateMigrationSpec, generateOperationSpec, generatePresentationSpec, generateTelemetrySpec, generateTestTemplate, generateVscodeSettings, generateWorkflowRunnerTemplate, generateWorkflowSpec, genericMCPAdapter, getAIProvider, getAgentAdapter, getAllLayerLocations, getAllSpecs, getApiKey, getClaudeDesktopConfigPath, getContractNode, getDependencies, getDevDependencies, getExecCommand, getExtendedWorkspaceInfo, getGraphStats, getImplementationSummary, getInstallCommand, getMetaRepoInfo, getPackageName, getProductionDependencies, getRecommendedModels, getRunCommand, getWorkspaceInfo, getWorkspacePackages, groupSpecsByType, index_d_exports$1 as impact, importFromOpenApiService, inferImplementationType, isContractSpecInstalled, isMonorepo, listAgentTypes, listFromRegistry, listSpecs, loadWorkspaceConfig, mergeMonorepoConfigs, module, parseGitModules, index_d_exports$2 as prompts, resolveAllImplementations, resolveImplementations, resolveRegistryUrl, runCIChecks, runDoctor, runQuickstart, runSetup, runTestSpecs, runTests, safeParseJson, searchRegistry, stringToCacheKey, syncSpecs, syncWithOpenApiService, index_d_exports$3 as templates, validateAgainstOpenApiService, validateBlueprint, validateImplementationFiles, validateImplementationWithAgent, validateProvider, validateSpec, validateSpecs, validateTenantConfig, verifyBehavior, verifyImplementationAgainstParsedSpec, verifySemanticFields, verifyService, verifyStructure, verifyWithAI, verifyWithAIEnhanced, index_d_exports$4 as versioning, watchSpecs };
|
package/dist/index.js
CHANGED
|
@@ -83,6 +83,7 @@ import { formatQuickstartPreview, isContractSpecInstalled, runQuickstart } from
|
|
|
83
83
|
import { generateDocsFromSpecs } from "./services/docs/docs-service.js";
|
|
84
84
|
import { impact_exports } from "./services/impact/index.js";
|
|
85
85
|
import { formatFiles } from "./services/formatter.js";
|
|
86
|
+
import { versioning_exports } from "./services/versioning/index.js";
|
|
86
87
|
import "./services/index.js";
|
|
87
88
|
import { formatters_exports } from "./formatters/index.js";
|
|
88
89
|
import { AIClient } from "./ai/client.js";
|
|
@@ -90,4 +91,4 @@ import { prompts_exports } from "./ai/prompts/index.js";
|
|
|
90
91
|
import "./ai/index.js";
|
|
91
92
|
import * as module from "@contractspec/module.workspace";
|
|
92
93
|
|
|
93
|
-
export { AIClient, AIGenerator, ALL_CHECK_CATEGORIES, ALL_CI_CHECK_CATEGORIES, ALL_SETUP_TARGETS, AgentGuideService, AgentOrchestrator, CHECK_CATEGORY_LABELS, CI_CHECK_CATEGORY_LABELS, ClaudeCodeAdapter, ClaudeCodeAgent, CursorAgent, CursorCLIAdapter, DEFAULT_CACHE_CONFIG, FULL_DEPENDENCIES, FileSystemCacheStorage, GenericMCPAdapter, InMemoryCacheStorage, MINIMAL_DEPENDENCIES, OpenAICodexAgent, RegistryClient, SETUP_TARGET_LABELS, SimpleAgent, SpecCreatorService, VerificationCacheService, VerifyService, WorkspaceStateCacheStorage, addToRegistry, agentAdapters, agentGuideService, analyzeDeps, analyzeIntegrity, buildSpec, cacheKeyToString, claudeCodeAdapter, cleanArtifacts, compareSpecs, computeContentHash, createAgentGuideService, createConsoleLoggerAdapter, createEmptyLayerInventory, createFileSystemCacheStorage, createInMemoryCacheStorage, createNodeAdapters, createNodeAiAdapter, createNodeFsAdapter, createNodeGitAdapter, createNodeWatcherAdapter, createNoopLoggerAdapter, createQuickAIReview, createRegeneratorService, createSpecCreator, createVerificationCacheService, createVerifyService, createWorkspaceStateCacheStorage, cursorCLIAdapter, deepMergeOverwrite, deepMergePreserve, detectPackageManager, detectRepositoryType, discoverAllImplementations, discoverImplementationsForSpec, discoverLayers, exportGraphAsDot, exportOpenApi, exportSpecForLLM, extractSpecReferences, filterIssuesBySeverity, filterIssuesByType, findAllConfigFiles, findMetaRepoRoot, findPackageRoot, findWorkspaceRoot, formatCheckResult, formatDoctorSummary, formatFiles, formatJson, formatQuickstartPreview, formatVerificationReport, formatWorkspaceInfo, formatters_exports as formatters, generateAgentsMd, generateAppBlueprintSpec, generateClaudeMcpConfig, generateComponentTemplate, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateCursorRulesFromParsedSpec, generateDataViewSpec, generateDocsFromSpecs, generateEventSpec, generateExperimentSpec, generateFeatureContextMarkdown, generateGuideFromParsedSpec, generateHandlerTemplate, generateIntegrationSpec, generateKnowledgeSpaceSpec, generateMermaidDiagram, generateMigrationSpec, generateOperationSpec, generatePresentationSpec, generateTelemetrySpec, generateTestTemplate, generateVscodeSettings, generateWorkflowRunnerTemplate, generateWorkflowSpec, genericMCPAdapter, getAIProvider, getAgentAdapter, getAllLayerLocations, getAllSpecs, getApiKey, getClaudeDesktopConfigPath, getContractNode, getDependencies, getDevDependencies, getExecCommand, getExtendedWorkspaceInfo, getGraphStats, getImplementationSummary, getInstallCommand, getMetaRepoInfo, getPackageName, getProductionDependencies, getRecommendedModels, getRunCommand, getWorkspaceInfo, getWorkspacePackages, groupSpecsByType, impact_exports as impact, importFromOpenApiService, inferImplementationType, isContractSpecInstalled, isMonorepo, listAgentTypes, listFromRegistry, listSpecs, loadWorkspaceConfig, mergeMonorepoConfigs, module, parseGitModules, prompts_exports as prompts, resolveAllImplementations, resolveImplementations, resolveRegistryUrl, runCIChecks, runDoctor, runQuickstart, runSetup, runTestSpecs, runTests, safeParseJson, searchRegistry, stringToCacheKey, syncSpecs, syncWithOpenApiService, templates_exports as templates, validateAgainstOpenApiService, validateBlueprint, validateImplementationFiles, validateImplementationWithAgent, validateProvider, validateSpec, validateSpecs, validateTenantConfig, verifyBehavior, verifyImplementationAgainstParsedSpec, verifySemanticFields, verifyService, verifyStructure, verifyWithAI, verifyWithAIEnhanced, watchSpecs };
|
|
94
|
+
export { AIClient, AIGenerator, ALL_CHECK_CATEGORIES, ALL_CI_CHECK_CATEGORIES, ALL_SETUP_TARGETS, AgentGuideService, AgentOrchestrator, CHECK_CATEGORY_LABELS, CI_CHECK_CATEGORY_LABELS, ClaudeCodeAdapter, ClaudeCodeAgent, CursorAgent, CursorCLIAdapter, DEFAULT_CACHE_CONFIG, FULL_DEPENDENCIES, FileSystemCacheStorage, GenericMCPAdapter, InMemoryCacheStorage, MINIMAL_DEPENDENCIES, OpenAICodexAgent, RegistryClient, SETUP_TARGET_LABELS, SimpleAgent, SpecCreatorService, VerificationCacheService, VerifyService, WorkspaceStateCacheStorage, addToRegistry, agentAdapters, agentGuideService, analyzeDeps, analyzeIntegrity, buildSpec, cacheKeyToString, claudeCodeAdapter, cleanArtifacts, compareSpecs, computeContentHash, createAgentGuideService, createConsoleLoggerAdapter, createEmptyLayerInventory, createFileSystemCacheStorage, createInMemoryCacheStorage, createNodeAdapters, createNodeAiAdapter, createNodeFsAdapter, createNodeGitAdapter, createNodeWatcherAdapter, createNoopLoggerAdapter, createQuickAIReview, createRegeneratorService, createSpecCreator, createVerificationCacheService, createVerifyService, createWorkspaceStateCacheStorage, cursorCLIAdapter, deepMergeOverwrite, deepMergePreserve, detectPackageManager, detectRepositoryType, discoverAllImplementations, discoverImplementationsForSpec, discoverLayers, exportGraphAsDot, exportOpenApi, exportSpecForLLM, extractSpecReferences, filterIssuesBySeverity, filterIssuesByType, findAllConfigFiles, findMetaRepoRoot, findPackageRoot, findWorkspaceRoot, formatCheckResult, formatDoctorSummary, formatFiles, formatJson, formatQuickstartPreview, formatVerificationReport, formatWorkspaceInfo, formatters_exports as formatters, generateAgentsMd, generateAppBlueprintSpec, generateClaudeMcpConfig, generateComponentTemplate, generateContractsrcConfig, generateCursorMcpConfig, generateCursorRules, generateCursorRulesFromParsedSpec, generateDataViewSpec, generateDocsFromSpecs, generateEventSpec, generateExperimentSpec, generateFeatureContextMarkdown, generateGuideFromParsedSpec, generateHandlerTemplate, generateIntegrationSpec, generateKnowledgeSpaceSpec, generateMermaidDiagram, generateMigrationSpec, generateOperationSpec, generatePresentationSpec, generateTelemetrySpec, generateTestTemplate, generateVscodeSettings, generateWorkflowRunnerTemplate, generateWorkflowSpec, genericMCPAdapter, getAIProvider, getAgentAdapter, getAllLayerLocations, getAllSpecs, getApiKey, getClaudeDesktopConfigPath, getContractNode, getDependencies, getDevDependencies, getExecCommand, getExtendedWorkspaceInfo, getGraphStats, getImplementationSummary, getInstallCommand, getMetaRepoInfo, getPackageName, getProductionDependencies, getRecommendedModels, getRunCommand, getWorkspaceInfo, getWorkspacePackages, groupSpecsByType, impact_exports as impact, importFromOpenApiService, inferImplementationType, isContractSpecInstalled, isMonorepo, listAgentTypes, listFromRegistry, listSpecs, loadWorkspaceConfig, mergeMonorepoConfigs, module, parseGitModules, prompts_exports as prompts, resolveAllImplementations, resolveImplementations, resolveRegistryUrl, runCIChecks, runDoctor, runQuickstart, runSetup, runTestSpecs, runTests, safeParseJson, searchRegistry, stringToCacheKey, syncSpecs, syncWithOpenApiService, templates_exports as templates, validateAgainstOpenApiService, validateBlueprint, validateImplementationFiles, validateImplementationWithAgent, validateProvider, validateSpec, validateSpecs, validateTenantConfig, verifyBehavior, verifyImplementationAgainstParsedSpec, verifySemanticFields, verifyService, verifyStructure, verifyWithAI, verifyWithAIEnhanced, versioning_exports as versioning, watchSpecs };
|
|
@@ -194,6 +194,13 @@ async function checkContractsLibrary(fs, ctx) {
|
|
|
194
194
|
status: "pass",
|
|
195
195
|
message: `@contractspec/lib.contracts installed (${allDeps["@contractspec/lib.contracts"]})`
|
|
196
196
|
};
|
|
197
|
+
if (ctx.isMonorepo && ctx.packageRoot === ctx.workspaceRoot) return {
|
|
198
|
+
category: "deps",
|
|
199
|
+
name: "ContractSpec Library",
|
|
200
|
+
status: "pass",
|
|
201
|
+
message: "Monorepo root detected (library check skipped)",
|
|
202
|
+
details: "Run doctor in specific packages to verify dependencies"
|
|
203
|
+
};
|
|
197
204
|
return {
|
|
198
205
|
category: "deps",
|
|
199
206
|
name: "ContractSpec Library",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.js","names":["results: CheckResult[]","detectedManager: string | null"],"sources":["../../../../src/services/doctor/checks/deps.ts"],"sourcesContent":["/**\n * Dependencies health checks.\n */\n\nimport { exec } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport type { FsAdapter } from '../../../ports/fs';\nimport type { CheckResult, CheckContext } from '../types';\n\nconst execAsync = promisify(exec);\n\n/**\n * Run dependency-related health checks.\n */\nexport async function runDepsChecks(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult[]> {\n const results: CheckResult[] = [];\n\n // Check Node.js availability\n results.push(await checkNodeJs(ctx));\n\n // Check Bun availability\n results.push(await checkBun(ctx));\n\n // Check package manager\n results.push(await checkPackageManager(fs, ctx));\n\n // Check if node_modules exists\n results.push(await checkNodeModules(fs, ctx));\n\n // Check if @contractspec/lib.contracts is installed\n results.push(await checkContractsLibrary(fs, ctx));\n\n return results;\n}\n\n/**\n * Check if Node.js is available.\n */\nasync function checkNodeJs(ctx: CheckContext): Promise<CheckResult> {\n try {\n const { stdout } = await execAsync('node --version', {\n cwd: ctx.workspaceRoot,\n timeout: 5000,\n });\n\n const version = stdout.trim();\n\n return {\n category: 'deps',\n name: 'Node.js',\n status: 'pass',\n message: `Node.js ${version} available`,\n };\n } catch {\n return {\n category: 'deps',\n name: 'Node.js',\n status: 'fail',\n message: 'Node.js not found',\n details: 'Install Node.js from https://nodejs.org',\n };\n }\n}\n\n/**\n * Check if Bun is available.\n */\nasync function checkBun(ctx: CheckContext): Promise<CheckResult> {\n try {\n const { stdout } = await execAsync('bun --version', {\n cwd: ctx.workspaceRoot,\n timeout: 5000,\n });\n\n const version = stdout.trim();\n\n return {\n category: 'deps',\n name: 'Bun Runtime',\n status: 'pass',\n message: `Bun ${version} available`,\n };\n } catch {\n return {\n category: 'deps',\n name: 'Bun Runtime',\n status: 'warn',\n message: 'Bun not found (optional but recommended)',\n details: 'Install Bun from https://bun.sh for faster execution',\n };\n }\n}\n\n/**\n * Detect and check the package manager.\n */\nasync function checkPackageManager(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult> {\n // Check for lock files to determine package manager\n const lockFiles = [\n { file: 'bun.lockb', name: 'bun' },\n { file: 'pnpm-lock.yaml', name: 'pnpm' },\n { file: 'yarn.lock', name: 'yarn' },\n { file: 'package-lock.json', name: 'npm' },\n ];\n\n let detectedManager: string | null = null;\n\n for (const { file, name } of lockFiles) {\n const lockPath = fs.join(ctx.workspaceRoot, file);\n if (await fs.exists(lockPath)) {\n detectedManager = name;\n break;\n }\n }\n\n if (!detectedManager) {\n return {\n category: 'deps',\n name: 'Package Manager',\n status: 'warn',\n message: 'No lock file found',\n details: 'Run npm install, yarn, pnpm install, or bun install',\n };\n }\n\n // Verify the package manager is available\n try {\n await execAsync(`${detectedManager} --version`, {\n cwd: ctx.workspaceRoot,\n timeout: 5000,\n });\n\n return {\n category: 'deps',\n name: 'Package Manager',\n status: 'pass',\n message: `Using ${detectedManager}`,\n };\n } catch {\n return {\n category: 'deps',\n name: 'Package Manager',\n status: 'fail',\n message: `${detectedManager} detected but not available`,\n details: `Install ${detectedManager} or use a different package manager`,\n };\n }\n}\n\n/**\n * Check if node_modules exists.\n */\nasync function checkNodeModules(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult> {\n const nodeModulesPath = fs.join(ctx.workspaceRoot, 'node_modules');\n\n const exists = await fs.exists(nodeModulesPath);\n if (exists) {\n return {\n category: 'deps',\n name: 'Dependencies Installed',\n status: 'pass',\n message: 'node_modules directory exists',\n };\n }\n\n return {\n category: 'deps',\n name: 'Dependencies Installed',\n status: 'fail',\n message: 'node_modules not found',\n details: 'Run your package manager install command',\n fix: {\n description: 'Install dependencies',\n apply: async () => {\n try {\n // Try bun first, then npm\n try {\n await execAsync('bun install', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with bun' };\n } catch {\n await execAsync('npm install', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with npm' };\n }\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n return { success: false, message: `Failed: ${msg}` };\n }\n },\n },\n };\n}\n\n/**\n * Check if @contractspec/lib.contracts is installed.\n */\nasync function checkContractsLibrary(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult> {\n const packageJsonPath = fs.join(ctx.workspaceRoot, 'package.json');\n\n try {\n const content = await fs.readFile(packageJsonPath);\n const packageJson = JSON.parse(content) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n\n const allDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n if ('@contractspec/lib.contracts' in allDeps) {\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'pass',\n message: `@contractspec/lib.contracts installed (${allDeps['@contractspec/lib.contracts']})`,\n };\n }\n\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'fail',\n message: '@contractspec/lib.contracts not installed',\n details: 'Run \"contractspec quickstart\" to install required packages',\n fix: {\n description: 'Install @contractspec/lib.contracts and dependencies',\n apply: async () => {\n try {\n // Try bun first, then npm\n try {\n await execAsync('bun add @contractspec/lib.contracts zod', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with bun' };\n } catch {\n await execAsync('npm install @contractspec/lib.contracts zod', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with npm' };\n }\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n return { success: false, message: `Failed: ${msg}` };\n }\n },\n },\n };\n } catch {\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'skip',\n message: 'Could not read package.json',\n };\n }\n}\n"],"mappings":";;;;;;;AASA,MAAM,YAAY,UAAU,KAAK;;;;AAKjC,eAAsB,cACpB,IACA,KACwB;CACxB,MAAMA,UAAyB,EAAE;AAGjC,SAAQ,KAAK,MAAM,YAAY,IAAI,CAAC;AAGpC,SAAQ,KAAK,MAAM,SAAS,IAAI,CAAC;AAGjC,SAAQ,KAAK,MAAM,oBAAoB,IAAI,IAAI,CAAC;AAGhD,SAAQ,KAAK,MAAM,iBAAiB,IAAI,IAAI,CAAC;AAG7C,SAAQ,KAAK,MAAM,sBAAsB,IAAI,IAAI,CAAC;AAElD,QAAO;;;;;AAMT,eAAe,YAAY,KAAyC;AAClE,KAAI;EACF,MAAM,EAAE,WAAW,MAAM,UAAU,k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;QAAsB;cACjD;AACN,aAAM,UAAU,+CAA+C;QAC7D,KAAK,IAAI;QACT,SAAS;QACV,CAAC;AACF,cAAO;QAAE,SAAS;QAAM,SAAS;QAAsB;;cAElD,OAAO;AAEd,aAAO;OAAE,SAAS;OAAO,SAAS,WADtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;OACd;;;IAGzD;GACF;SACK;AACN,SAAO;GACL,UAAU;GACV,MAAM;GACN,QAAQ;GACR,SAAS;GACV"}
|
|
1
|
+
{"version":3,"file":"deps.js","names":["results: CheckResult[]","detectedManager: string | null"],"sources":["../../../../src/services/doctor/checks/deps.ts"],"sourcesContent":["/**\n * Dependencies health checks.\n */\n\nimport { exec } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport type { FsAdapter } from '../../../ports/fs';\nimport type { CheckResult, CheckContext } from '../types';\n\nconst execAsync = promisify(exec);\n\n/**\n * Run dependency-related health checks.\n */\nexport async function runDepsChecks(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult[]> {\n const results: CheckResult[] = [];\n\n // Check Node.js availability\n results.push(await checkNodeJs(ctx));\n\n // Check Bun availability\n results.push(await checkBun(ctx));\n\n // Check package manager\n results.push(await checkPackageManager(fs, ctx));\n\n // Check if node_modules exists\n results.push(await checkNodeModules(fs, ctx));\n\n // Check if @contractspec/lib.contracts is installed\n results.push(await checkContractsLibrary(fs, ctx));\n\n return results;\n}\n\n/**\n * Check if Node.js is available.\n */\nasync function checkNodeJs(ctx: CheckContext): Promise<CheckResult> {\n try {\n const { stdout } = await execAsync('node --version', {\n cwd: ctx.workspaceRoot,\n timeout: 5000,\n });\n\n const version = stdout.trim();\n\n return {\n category: 'deps',\n name: 'Node.js',\n status: 'pass',\n message: `Node.js ${version} available`,\n };\n } catch {\n return {\n category: 'deps',\n name: 'Node.js',\n status: 'fail',\n message: 'Node.js not found',\n details: 'Install Node.js from https://nodejs.org',\n };\n }\n}\n\n/**\n * Check if Bun is available.\n */\nasync function checkBun(ctx: CheckContext): Promise<CheckResult> {\n try {\n const { stdout } = await execAsync('bun --version', {\n cwd: ctx.workspaceRoot,\n timeout: 5000,\n });\n\n const version = stdout.trim();\n\n return {\n category: 'deps',\n name: 'Bun Runtime',\n status: 'pass',\n message: `Bun ${version} available`,\n };\n } catch {\n return {\n category: 'deps',\n name: 'Bun Runtime',\n status: 'warn',\n message: 'Bun not found (optional but recommended)',\n details: 'Install Bun from https://bun.sh for faster execution',\n };\n }\n}\n\n/**\n * Detect and check the package manager.\n */\nasync function checkPackageManager(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult> {\n // Check for lock files to determine package manager\n const lockFiles = [\n { file: 'bun.lockb', name: 'bun' },\n { file: 'pnpm-lock.yaml', name: 'pnpm' },\n { file: 'yarn.lock', name: 'yarn' },\n { file: 'package-lock.json', name: 'npm' },\n ];\n\n let detectedManager: string | null = null;\n\n for (const { file, name } of lockFiles) {\n const lockPath = fs.join(ctx.workspaceRoot, file);\n if (await fs.exists(lockPath)) {\n detectedManager = name;\n break;\n }\n }\n\n if (!detectedManager) {\n return {\n category: 'deps',\n name: 'Package Manager',\n status: 'warn',\n message: 'No lock file found',\n details: 'Run npm install, yarn, pnpm install, or bun install',\n };\n }\n\n // Verify the package manager is available\n try {\n await execAsync(`${detectedManager} --version`, {\n cwd: ctx.workspaceRoot,\n timeout: 5000,\n });\n\n return {\n category: 'deps',\n name: 'Package Manager',\n status: 'pass',\n message: `Using ${detectedManager}`,\n };\n } catch {\n return {\n category: 'deps',\n name: 'Package Manager',\n status: 'fail',\n message: `${detectedManager} detected but not available`,\n details: `Install ${detectedManager} or use a different package manager`,\n };\n }\n}\n\n/**\n * Check if node_modules exists.\n */\nasync function checkNodeModules(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult> {\n const nodeModulesPath = fs.join(ctx.workspaceRoot, 'node_modules');\n\n const exists = await fs.exists(nodeModulesPath);\n if (exists) {\n return {\n category: 'deps',\n name: 'Dependencies Installed',\n status: 'pass',\n message: 'node_modules directory exists',\n };\n }\n\n return {\n category: 'deps',\n name: 'Dependencies Installed',\n status: 'fail',\n message: 'node_modules not found',\n details: 'Run your package manager install command',\n fix: {\n description: 'Install dependencies',\n apply: async () => {\n try {\n // Try bun first, then npm\n try {\n await execAsync('bun install', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with bun' };\n } catch {\n await execAsync('npm install', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with npm' };\n }\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n return { success: false, message: `Failed: ${msg}` };\n }\n },\n },\n };\n}\n\n/**\n * Check if @contractspec/lib.contracts is installed.\n */\nasync function checkContractsLibrary(\n fs: FsAdapter,\n ctx: CheckContext\n): Promise<CheckResult> {\n const packageJsonPath = fs.join(ctx.workspaceRoot, 'package.json');\n\n try {\n const content = await fs.readFile(packageJsonPath);\n const packageJson = JSON.parse(content) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n };\n\n const allDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n if ('@contractspec/lib.contracts' in allDeps) {\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'pass',\n message: `@contractspec/lib.contracts installed (${allDeps['@contractspec/lib.contracts']})`,\n };\n }\n\n // In monorepo root, we don't expect the library to be installed directly\n if (ctx.isMonorepo && ctx.packageRoot === ctx.workspaceRoot) {\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'pass',\n message: 'Monorepo root detected (library check skipped)',\n details: 'Run doctor in specific packages to verify dependencies',\n };\n }\n\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'fail',\n message: '@contractspec/lib.contracts not installed',\n details: 'Run \"contractspec quickstart\" to install required packages',\n fix: {\n description: 'Install @contractspec/lib.contracts and dependencies',\n apply: async () => {\n try {\n // Try bun first, then npm\n try {\n await execAsync('bun add @contractspec/lib.contracts zod', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with bun' };\n } catch {\n await execAsync('npm install @contractspec/lib.contracts zod', {\n cwd: ctx.workspaceRoot,\n timeout: 120000,\n });\n return { success: true, message: 'Installed with npm' };\n }\n } catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n return { success: false, message: `Failed: ${msg}` };\n }\n },\n },\n };\n } catch {\n return {\n category: 'deps',\n name: 'ContractSpec Library',\n status: 'skip',\n message: 'Could not read package.json',\n };\n }\n}\n"],"mappings":";;;;;;;AASA,MAAM,YAAY,UAAU,KAAK;;;;AAKjC,eAAsB,cACpB,IACA,KACwB;CACxB,MAAMA,UAAyB,EAAE;AAGjC,SAAQ,KAAK,MAAM,YAAY,IAAI,CAAC;AAGpC,SAAQ,KAAK,MAAM,SAAS,IAAI,CAAC;AAGjC,SAAQ,KAAK,MAAM,oBAAoB,IAAI,IAAI,CAAC;AAGhD,SAAQ,KAAK,MAAM,iBAAiB,IAAI,IAAI,CAAC;AAG7C,SAAQ,KAAK,MAAM,sBAAsB,IAAI,IAAI,CAAC;AAElD,QAAO;;;;;AAMT,eAAe,YAAY,KAAyC;AAClE,KAAI;EACF,MAAM,EAAE,WAAW,MAAM,UAAU,kBAAkB;GACnD,KAAK,IAAI;GACT,SAAS;GACV,CAAC;AAIF,SAAO;GACL,UAAU;GACV,MAAM;GACN,QAAQ;GACR,SAAS,WANK,OAAO,MAAM,CAMC;GAC7B;SACK;AACN,SAAO;GACL,UAAU;GACV,MAAM;GACN,QAAQ;GACR,SAAS;GACT,SAAS;GACV;;;;;;AAOL,eAAe,SAAS,KAAyC;AAC/D,KAAI;EACF,MAAM,EAAE,WAAW,MAAM,UAAU,iBAAiB;GAClD,KAAK,IAAI;GACT,SAAS;GACV,CAAC;AAIF,SAAO;GACL,UAAU;GACV,MAAM;GACN,QAAQ;GACR,SAAS,OANK,OAAO,MAAM,CAMH;GACzB;SACK;AACN,SAAO;GACL,UAAU;GACV,M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-83,4 +83,5 @@ import { formatQuickstartPreview, isContractSpecInstalled, runQuickstart } from
|
|
|
83
83
|
import { DocsServiceOptions, DocsServiceResult, generateDocsFromSpecs } from "./docs/docs-service.js";
|
|
84
84
|
import "./docs/index.js";
|
|
85
85
|
import { index_d_exports } from "./impact/index.js";
|
|
86
|
-
import { FormatterOptions, formatFiles } from "./formatter.js";
|
|
86
|
+
import { FormatterOptions, formatFiles } from "./formatter.js";
|
|
87
|
+
import { index_d_exports as index_d_exports$1 } from "./versioning/index.js";
|
package/dist/services/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","names":[],"sources":["../../src/services/sync.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAqCY,UAxBK,gBAAA,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","names":[],"sources":["../../src/services/sync.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAqCY,UAxBK,gBAAA,CA2BZ;EAEO,OAAA,CAAA,EAAA,MAAA;EAEU,UAAA,CAAA,EAAS,CAAA,MAAA,GAAA,SAAA,CAAA,EAAA;EACb,QAAA,CAAA,EAAA,OAAA;EAAmB,YAAA,CAAA,EA5BpB,IA4BoB,CA5Bf,gBA4Be,EAAA,WAAA,CAAA;EAC3B,MAAA,CAAA,EAAA,OAAA;;AAGE,UA5BK,kBAAA,CA4BL;EACG,QAAA,EAAA,MAAA;EAEJ,SAAA,CAAA,EAAA,MAAA;EAAR,UAAA,CAAA,EA5BY,kBA4BZ;EAAO,KAAA,CAAA,EAAA,OAAA;;;;;;UApBO,eAAA;;QAET;;KAGI,sEAGP,QAAQ;KAED,cAAA,yBAAuC,QAAQ;iBAErC,SAAA;MACJ;UAAmB;WAC3B,2BACC;UAEC;aACG;IAEZ,QAAQ"}
|
|
@@ -42,7 +42,7 @@ function extractBlueprintSpec(mod) {
|
|
|
42
42
|
return candidates[0];
|
|
43
43
|
}
|
|
44
44
|
function isBlueprintSpec(value) {
|
|
45
|
-
return typeof value === "object" && value !== null && "meta" in value && typeof value.meta?.key === "string" && typeof value.meta?.version === "
|
|
45
|
+
return typeof value === "object" && value !== null && "meta" in value && typeof value.meta?.key === "string" && typeof value.meta?.version === "string";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint-validator.js","names":["validateBlueprint","validateBlueprintSpec"],"sources":["../../../src/services/validate/blueprint-validator.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { pathToFileURL } from 'url';\nimport {\n validateBlueprint as validateBlueprintSpec,\n type AppBlueprintSpec,\n} from '@contractspec/lib.contracts';\nimport type { FsAdapter } from '../../ports/fs';\n\n/**\n * Result of blueprint validation.\n */\nexport interface BlueprintValidationResult {\n spec?: AppBlueprintSpec;\n report?: ReturnType<typeof validateBlueprintSpec>;\n valid: boolean;\n errors: string[];\n}\n\n/**\n * Validate a blueprint spec file.\n */\nexport async function validateBlueprint(\n blueprintPath: string,\n adapters: { fs: FsAdapter }\n): Promise<BlueprintValidationResult> {\n const { fs } = adapters;\n const resolvedPath = resolve(process.cwd(), blueprintPath);\n\n if (!(await fs.exists(resolvedPath))) {\n return {\n valid: false,\n errors: [`Blueprint file not found: ${resolvedPath}`],\n };\n }\n\n try {\n const mod = await loadModule(resolvedPath);\n const spec = extractBlueprintSpec(mod);\n const report = validateBlueprintSpec(spec);\n\n return {\n spec,\n report,\n valid: report.valid,\n errors: report.errors.map((e) => `[${e.code}] ${e.path}: ${e.message}`),\n };\n } catch (error) {\n return {\n valid: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n}\n\nasync function loadModule(\n modulePath: string\n): Promise<Record<string, unknown>> {\n try {\n const url = pathToFileURL(modulePath).href;\n // Using native import which works with Bun and Node (if configured)\n const mod = await import(url);\n return mod;\n } catch (error) {\n throw new Error(`Failed to load module at ${modulePath}: ${error}`);\n }\n}\n\nfunction extractBlueprintSpec(mod: Record<string, unknown>): AppBlueprintSpec {\n const candidates = Object.values(mod).filter(isBlueprintSpec);\n if (candidates.length === 0) {\n throw new Error('Blueprint module does not export an AppBlueprintSpec.');\n }\n return candidates[0] as AppBlueprintSpec;\n}\n\nfunction isBlueprintSpec(value: unknown): value is AppBlueprintSpec {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as AppBlueprintSpec).meta?.key === 'string' &&\n typeof (value as AppBlueprintSpec).meta?.version === '
|
|
1
|
+
{"version":3,"file":"blueprint-validator.js","names":["validateBlueprint","validateBlueprintSpec"],"sources":["../../../src/services/validate/blueprint-validator.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { pathToFileURL } from 'url';\nimport {\n validateBlueprint as validateBlueprintSpec,\n type AppBlueprintSpec,\n} from '@contractspec/lib.contracts';\nimport type { FsAdapter } from '../../ports/fs';\n\n/**\n * Result of blueprint validation.\n */\nexport interface BlueprintValidationResult {\n spec?: AppBlueprintSpec;\n report?: ReturnType<typeof validateBlueprintSpec>;\n valid: boolean;\n errors: string[];\n}\n\n/**\n * Validate a blueprint spec file.\n */\nexport async function validateBlueprint(\n blueprintPath: string,\n adapters: { fs: FsAdapter }\n): Promise<BlueprintValidationResult> {\n const { fs } = adapters;\n const resolvedPath = resolve(process.cwd(), blueprintPath);\n\n if (!(await fs.exists(resolvedPath))) {\n return {\n valid: false,\n errors: [`Blueprint file not found: ${resolvedPath}`],\n };\n }\n\n try {\n const mod = await loadModule(resolvedPath);\n const spec = extractBlueprintSpec(mod);\n const report = validateBlueprintSpec(spec);\n\n return {\n spec,\n report,\n valid: report.valid,\n errors: report.errors.map((e) => `[${e.code}] ${e.path}: ${e.message}`),\n };\n } catch (error) {\n return {\n valid: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n}\n\nasync function loadModule(\n modulePath: string\n): Promise<Record<string, unknown>> {\n try {\n const url = pathToFileURL(modulePath).href;\n // Using native import which works with Bun and Node (if configured)\n const mod = await import(url);\n return mod;\n } catch (error) {\n throw new Error(`Failed to load module at ${modulePath}: ${error}`);\n }\n}\n\nfunction extractBlueprintSpec(mod: Record<string, unknown>): AppBlueprintSpec {\n const candidates = Object.values(mod).filter(isBlueprintSpec);\n if (candidates.length === 0) {\n throw new Error('Blueprint module does not export an AppBlueprintSpec.');\n }\n return candidates[0] as AppBlueprintSpec;\n}\n\nfunction isBlueprintSpec(value: unknown): value is AppBlueprintSpec {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as AppBlueprintSpec).meta?.key === 'string' &&\n typeof (value as AppBlueprintSpec).meta?.version === 'string'\n );\n}\n"],"mappings":";;;;;;;;AAqBA,eAAsBA,oBACpB,eACA,UACoC;CACpC,MAAM,EAAE,OAAO;CACf,MAAM,eAAe,QAAQ,QAAQ,KAAK,EAAE,cAAc;AAE1D,KAAI,CAAE,MAAM,GAAG,OAAO,aAAa,CACjC,QAAO;EACL,OAAO;EACP,QAAQ,CAAC,6BAA6B,eAAe;EACtD;AAGH,KAAI;EAEF,MAAM,OAAO,qBADD,MAAM,WAAW,aAAa,CACJ;EACtC,MAAM,SAASC,kBAAsB,KAAK;AAE1C,SAAO;GACL;GACA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,UAAU;GACxE;UACM,OAAO;AACd,SAAO;GACL,OAAO;GACP,QAAQ,CAAC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;GACjE;;;AAIL,eAAe,WACb,YACkC;AAClC,KAAI;AAIF,SADY,MAAM,OAFN,cAAc,WAAW,CAAC;UAI/B,OAAO;AACd,QAAM,IAAI,MAAM,4BAA4B,WAAW,IAAI,QAAQ;;;AAIvE,SAAS,qBAAqB,KAAgD;CAC5E,MAAM,aAAa,OAAO,OAAO,IAAI,CAAC,OAAO,gBAAgB;AAC7D,KAAI,WAAW,WAAW,EACxB,OAAM,IAAI,MAAM,wDAAwD;AAE1E,QAAO,WAAW;;AAGpB,SAAS,gBAAgB,OAA2C;AAClE,QACE,OAAO,UAAU,YACjB,UAAU,QACV,UAAU,SACV,OAAQ,MAA2B,MAAM,QAAQ,YACjD,OAAQ,MAA2B,MAAM,YAAY"}
|
|
@@ -115,7 +115,7 @@ async function loadTranslationCatalog(path, fs) {
|
|
|
115
115
|
return normaliseTranslationCatalog(catalogs[0]);
|
|
116
116
|
}
|
|
117
117
|
function isBlueprintTranslationCatalog(value) {
|
|
118
|
-
return typeof value === "object" && value !== null && "meta" in value && typeof value.meta?.key === "string" && typeof value.meta?.version === "
|
|
118
|
+
return typeof value === "object" && value !== null && "meta" in value && typeof value.meta?.key === "string" && typeof value.meta?.version === "string" && Array.isArray(value.entries);
|
|
119
119
|
}
|
|
120
120
|
function normaliseTranslationCatalog(catalog) {
|
|
121
121
|
const supportedLocales = catalog.supportedLocales && catalog.supportedLocales.length > 0 ? catalog.supportedLocales : [catalog.defaultLocale];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-validator.js","names":["context: Parameters<typeof validateTenantConfigSpecs>[2]","validateTenantConfigSpecs","results: IntegrationConnection[]"],"sources":["../../../src/services/validate/tenant-validator.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { readFile } from 'fs/promises';\nimport { pathToFileURL } from 'url';\nimport {\n validateConfig as validateTenantConfigSpecs,\n type AppBlueprintSpec,\n type TenantAppConfig,\n type IntegrationSpecRegistry,\n type BlueprintTranslationCatalog,\n type IntegrationConnection,\n} from '@contractspec/lib.contracts';\nimport type { FsAdapter } from '../../ports/fs';\n\nexport interface TenantValidationResult {\n config?: TenantAppConfig;\n report?: ReturnType<typeof validateTenantConfigSpecs>;\n valid: boolean;\n errors: string[];\n}\n\nexport interface TenantValidationContext {\n connections?: string[] | string;\n integrationRegistrars?: string[] | string;\n translationCatalog?: string;\n}\n\nexport async function validateTenantConfig(\n blueprint: AppBlueprintSpec,\n tenantPath: string,\n contextOptions: TenantValidationContext,\n adapters: { fs: FsAdapter }\n): Promise<TenantValidationResult> {\n const { fs } = adapters;\n const resolvedPath = resolve(process.cwd(), tenantPath);\n\n if (!(await fs.exists(resolvedPath))) {\n return {\n valid: false,\n errors: [`Tenant config file not found: ${resolvedPath}`],\n };\n }\n\n try {\n const tenant = await loadTenantConfig(resolvedPath);\n const connections = await loadIntegrationConnections(\n contextOptions.connections,\n fs\n );\n const catalog = await loadTranslationCatalog(\n contextOptions.translationCatalog,\n fs\n );\n const integrationSpecs = await loadIntegrationRegistrars(\n contextOptions.integrationRegistrars\n );\n\n const context: Parameters<typeof validateTenantConfigSpecs>[2] = {};\n if (connections.length > 0) {\n context.tenantConnections = connections;\n }\n if (catalog) {\n context.translationCatalogs = {\n blueprint: [catalog],\n platform: [],\n };\n }\n if (integrationSpecs) {\n context.integrationSpecs = integrationSpecs;\n }\n\n const report = validateTenantConfigSpecs(blueprint, tenant, context);\n\n return {\n config: tenant,\n report,\n valid: report.valid,\n errors: report.errors.map((e) => `[${e.code}] ${e.path}: ${e.message}`),\n };\n } catch (error) {\n return {\n valid: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n}\n\n// Helpers\n\nasync function loadTenantConfig(tenantPath: string): Promise<TenantAppConfig> {\n if (tenantPath.endsWith('.json')) {\n const raw = await readFile(tenantPath, 'utf-8');\n const json = JSON.parse(raw);\n if (!isTenantConfig(json)) {\n throw new Error(\n 'Tenant config JSON does not match the expected structure (missing meta).'\n );\n }\n return json;\n }\n\n const mod = await loadModule(tenantPath);\n const candidates = Object.values(mod).filter(isTenantConfig);\n if (candidates.length === 0) {\n throw new Error('Tenant config module does not export a TenantAppConfig.');\n }\n return candidates[0] as TenantAppConfig;\n}\n\nfunction isTenantConfig(value: unknown): value is TenantAppConfig {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as TenantAppConfig).meta?.tenantId === 'string'\n );\n}\n\n// Basic module loader\nasync function loadModule(\n modulePath: string\n): Promise<Record<string, unknown>> {\n try {\n const url = pathToFileURL(modulePath).href;\n const mod = await import(url);\n return mod;\n } catch (error) {\n throw new Error(`Failed to load module at ${modulePath}: ${error}`);\n }\n}\n\n// --- Connection Loaders ---\n\nfunction normalizePathOption(value?: string | string[]): string[] {\n if (!value) return [];\n const values = Array.isArray(value) ? value : value.split(',');\n return values.map((entry) => entry.trim()).filter(Boolean);\n}\n\nasync function loadIntegrationConnections(\n value: string | string[] | undefined,\n fs: FsAdapter\n): Promise<IntegrationConnection[]> {\n const paths = normalizePathOption(value);\n if (!paths.length) return [];\n\n const results: IntegrationConnection[] = [];\n for (const path of paths) {\n const resolved = resolve(process.cwd(), path);\n if (!(await fs.exists(resolved))) {\n console.warn(`Warning: Connection file not found: ${resolved}`);\n continue;\n }\n\n if (resolved.endsWith('.json')) {\n const raw = await readFile(resolved, 'utf-8');\n const parsed = JSON.parse(raw);\n results.push(...collectConnections(parsed));\n continue;\n }\n\n const mod = await loadModule(resolved);\n results.push(...collectConnections(mod));\n }\n return results;\n}\n\nfunction collectConnections(value: unknown): IntegrationConnection[] {\n if (Array.isArray(value)) {\n const connections = value.filter(isIntegrationConnection);\n if (connections.length) return connections;\n }\n if (isIntegrationConnection(value)) {\n return [value];\n }\n if (value && typeof value === 'object') {\n const entries = Object.values(value as Record<string, unknown>);\n const collected = entries.flatMap((entry) => collectConnections(entry));\n if (collected.length) return collected;\n }\n return [];\n}\n\nfunction isIntegrationConnection(\n value: unknown\n): value is IntegrationConnection {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as IntegrationConnection).meta?.id === 'string' &&\n typeof (value as IntegrationConnection).secretRef === 'string'\n );\n}\n\n// --- Translation Catalog Loaders ---\n\nasync function loadTranslationCatalog(\n path: string | undefined,\n fs: FsAdapter\n): Promise<BlueprintTranslationCatalog | undefined> {\n if (!path) return undefined;\n const resolved = resolve(process.cwd(), path);\n if (!(await fs.exists(resolved))) return undefined;\n\n if (resolved.endsWith('.json')) {\n const raw = await readFile(resolved, 'utf-8');\n const parsed = JSON.parse(raw);\n if (isBlueprintTranslationCatalog(parsed)) {\n return normaliseTranslationCatalog(parsed);\n }\n return undefined;\n }\n\n const mod = await loadModule(resolved);\n const catalogs = Object.values(mod).filter(isBlueprintTranslationCatalog);\n if (catalogs.length === 0) return undefined;\n return normaliseTranslationCatalog(\n catalogs[0] as BlueprintTranslationCatalog\n );\n}\n\nfunction isBlueprintTranslationCatalog(\n value: unknown\n): value is BlueprintTranslationCatalog {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as BlueprintTranslationCatalog).meta?.key === 'string' &&\n typeof (value as BlueprintTranslationCatalog).meta?.version === 'number' &&\n Array.isArray((value as BlueprintTranslationCatalog).entries)\n );\n}\n\nfunction normaliseTranslationCatalog(\n catalog: BlueprintTranslationCatalog\n): BlueprintTranslationCatalog {\n const supportedLocales =\n catalog.supportedLocales && catalog.supportedLocales.length > 0\n ? catalog.supportedLocales\n : [catalog.defaultLocale];\n return {\n ...catalog,\n supportedLocales,\n };\n}\n\n// --- Registrar Loaders ---\n// Important: This needs IntegrationSpecRegistry which is a Class.\n// We only import type in signature, but need constructor.\n// Imports fixed at top.\n\nasync function loadIntegrationRegistrars(\n value?: string | string[]\n): Promise<IntegrationSpecRegistry | undefined> {\n const entries = normalizePathOption(value);\n if (!entries.length) return undefined;\n\n // We need to import the Class dynamically or have it available.\n // It is imported from @contractspec/lib.contracts\n const { IntegrationSpecRegistry } =\n await import('@contractspec/lib.contracts');\n const registry = new IntegrationSpecRegistry();\n\n for (const entry of entries) {\n const { modulePath, exportName } = parseRegistrarEntry(entry);\n if (!modulePath) continue;\n const resolved = resolve(process.cwd(), modulePath);\n // Logic simplified for brevity, assume module exists or handled by catch in loadModule\n try {\n const mod = await loadModule(resolved);\n const registrar = pickRegistrar(mod, exportName);\n if (registrar) {\n await registrar(registry);\n }\n } catch (e) {\n console.warn(`Failed to load registrar from ${resolved}: ${e}`);\n }\n }\n return registry;\n}\n\nfunction parseRegistrarEntry(entry: string): {\n modulePath: string | null;\n exportName?: string;\n} {\n if (!entry) return { modulePath: null };\n const [modulePathRaw, exportNameRaw] = entry.split('#');\n const modulePath = modulePathRaw?.trim() ?? null;\n const exportName = exportNameRaw?.trim();\n return { modulePath, exportName };\n}\n\nfunction pickRegistrar(\n mod: Record<string, unknown>,\n exportName?: string\n): ((registry: IntegrationSpecRegistry) => void | Promise<void>) | undefined {\n if (exportName) {\n const candidate = mod[exportName];\n if (typeof candidate === 'function') {\n return candidate as (\n registry: IntegrationSpecRegistry\n ) => void | Promise<void>;\n }\n return undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof (mod as any).default === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (mod as any).default;\n }\n for (const value of Object.values(mod)) {\n if (typeof value === 'function') {\n return value as (\n registry: IntegrationSpecRegistry\n ) => void | Promise<void>;\n }\n }\n return undefined;\n}\n"],"mappings":";;;;;;AA0BA,eAAsB,qBACpB,WACA,YACA,gBACA,UACiC;CACjC,MAAM,EAAE,OAAO;CACf,MAAM,eAAe,QAAQ,QAAQ,KAAK,EAAE,WAAW;AAEvD,KAAI,CAAE,MAAM,GAAG,OAAO,aAAa,CACjC,QAAO;EACL,OAAO;EACP,QAAQ,CAAC,iCAAiC,eAAe;EAC1D;AAGH,KAAI;EACF,MAAM,SAAS,MAAM,iBAAiB,aAAa;EACnD,MAAM,cAAc,MAAM,2BACxB,eAAe,aACf,GACD;EACD,MAAM,UAAU,MAAM,uBACpB,eAAe,oBACf,GACD;EACD,MAAM,mBAAmB,MAAM,0BAC7B,eAAe,sBAChB;EAED,MAAMA,UAA2D,EAAE;AACnE,MAAI,YAAY,SAAS,EACvB,SAAQ,oBAAoB;AAE9B,MAAI,QACF,SAAQ,sBAAsB;GAC5B,WAAW,CAAC,QAAQ;GACpB,UAAU,EAAE;GACb;AAEH,MAAI,iBACF,SAAQ,mBAAmB;EAG7B,MAAM,SAASC,e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,cACP,KACA,YAC2E;AAC3E,KAAI,YAAY;EACd,MAAM,YAAY,IAAI;AACtB,MAAI,OAAO,cAAc,WACvB,QAAO;AAIT;;AAGF,KAAI,OAAQ,IAAY,YAAY,WAElC,QAAQ,IAAY;AAEtB,MAAK,MAAM,SAAS,OAAO,OAAO,IAAI,CACpC,KAAI,OAAO,UAAU,WACnB,QAAO"}
|
|
1
|
+
{"version":3,"file":"tenant-validator.js","names":["context: Parameters<typeof validateTenantConfigSpecs>[2]","validateTenantConfigSpecs","results: IntegrationConnection[]"],"sources":["../../../src/services/validate/tenant-validator.ts"],"sourcesContent":["import { resolve } from 'path';\nimport { readFile } from 'fs/promises';\nimport { pathToFileURL } from 'url';\nimport {\n validateConfig as validateTenantConfigSpecs,\n type AppBlueprintSpec,\n type TenantAppConfig,\n type IntegrationSpecRegistry,\n type BlueprintTranslationCatalog,\n type IntegrationConnection,\n} from '@contractspec/lib.contracts';\nimport type { FsAdapter } from '../../ports/fs';\n\nexport interface TenantValidationResult {\n config?: TenantAppConfig;\n report?: ReturnType<typeof validateTenantConfigSpecs>;\n valid: boolean;\n errors: string[];\n}\n\nexport interface TenantValidationContext {\n connections?: string[] | string;\n integrationRegistrars?: string[] | string;\n translationCatalog?: string;\n}\n\nexport async function validateTenantConfig(\n blueprint: AppBlueprintSpec,\n tenantPath: string,\n contextOptions: TenantValidationContext,\n adapters: { fs: FsAdapter }\n): Promise<TenantValidationResult> {\n const { fs } = adapters;\n const resolvedPath = resolve(process.cwd(), tenantPath);\n\n if (!(await fs.exists(resolvedPath))) {\n return {\n valid: false,\n errors: [`Tenant config file not found: ${resolvedPath}`],\n };\n }\n\n try {\n const tenant = await loadTenantConfig(resolvedPath);\n const connections = await loadIntegrationConnections(\n contextOptions.connections,\n fs\n );\n const catalog = await loadTranslationCatalog(\n contextOptions.translationCatalog,\n fs\n );\n const integrationSpecs = await loadIntegrationRegistrars(\n contextOptions.integrationRegistrars\n );\n\n const context: Parameters<typeof validateTenantConfigSpecs>[2] = {};\n if (connections.length > 0) {\n context.tenantConnections = connections;\n }\n if (catalog) {\n context.translationCatalogs = {\n blueprint: [catalog],\n platform: [],\n };\n }\n if (integrationSpecs) {\n context.integrationSpecs = integrationSpecs;\n }\n\n const report = validateTenantConfigSpecs(blueprint, tenant, context);\n\n return {\n config: tenant,\n report,\n valid: report.valid,\n errors: report.errors.map((e) => `[${e.code}] ${e.path}: ${e.message}`),\n };\n } catch (error) {\n return {\n valid: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n}\n\n// Helpers\n\nasync function loadTenantConfig(tenantPath: string): Promise<TenantAppConfig> {\n if (tenantPath.endsWith('.json')) {\n const raw = await readFile(tenantPath, 'utf-8');\n const json = JSON.parse(raw);\n if (!isTenantConfig(json)) {\n throw new Error(\n 'Tenant config JSON does not match the expected structure (missing meta).'\n );\n }\n return json;\n }\n\n const mod = await loadModule(tenantPath);\n const candidates = Object.values(mod).filter(isTenantConfig);\n if (candidates.length === 0) {\n throw new Error('Tenant config module does not export a TenantAppConfig.');\n }\n return candidates[0] as TenantAppConfig;\n}\n\nfunction isTenantConfig(value: unknown): value is TenantAppConfig {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as TenantAppConfig).meta?.tenantId === 'string'\n );\n}\n\n// Basic module loader\nasync function loadModule(\n modulePath: string\n): Promise<Record<string, unknown>> {\n try {\n const url = pathToFileURL(modulePath).href;\n const mod = await import(url);\n return mod;\n } catch (error) {\n throw new Error(`Failed to load module at ${modulePath}: ${error}`);\n }\n}\n\n// --- Connection Loaders ---\n\nfunction normalizePathOption(value?: string | string[]): string[] {\n if (!value) return [];\n const values = Array.isArray(value) ? value : value.split(',');\n return values.map((entry) => entry.trim()).filter(Boolean);\n}\n\nasync function loadIntegrationConnections(\n value: string | string[] | undefined,\n fs: FsAdapter\n): Promise<IntegrationConnection[]> {\n const paths = normalizePathOption(value);\n if (!paths.length) return [];\n\n const results: IntegrationConnection[] = [];\n for (const path of paths) {\n const resolved = resolve(process.cwd(), path);\n if (!(await fs.exists(resolved))) {\n console.warn(`Warning: Connection file not found: ${resolved}`);\n continue;\n }\n\n if (resolved.endsWith('.json')) {\n const raw = await readFile(resolved, 'utf-8');\n const parsed = JSON.parse(raw);\n results.push(...collectConnections(parsed));\n continue;\n }\n\n const mod = await loadModule(resolved);\n results.push(...collectConnections(mod));\n }\n return results;\n}\n\nfunction collectConnections(value: unknown): IntegrationConnection[] {\n if (Array.isArray(value)) {\n const connections = value.filter(isIntegrationConnection);\n if (connections.length) return connections;\n }\n if (isIntegrationConnection(value)) {\n return [value];\n }\n if (value && typeof value === 'object') {\n const entries = Object.values(value as Record<string, unknown>);\n const collected = entries.flatMap((entry) => collectConnections(entry));\n if (collected.length) return collected;\n }\n return [];\n}\n\nfunction isIntegrationConnection(\n value: unknown\n): value is IntegrationConnection {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as IntegrationConnection).meta?.id === 'string' &&\n typeof (value as IntegrationConnection).secretRef === 'string'\n );\n}\n\n// --- Translation Catalog Loaders ---\n\nasync function loadTranslationCatalog(\n path: string | undefined,\n fs: FsAdapter\n): Promise<BlueprintTranslationCatalog | undefined> {\n if (!path) return undefined;\n const resolved = resolve(process.cwd(), path);\n if (!(await fs.exists(resolved))) return undefined;\n\n if (resolved.endsWith('.json')) {\n const raw = await readFile(resolved, 'utf-8');\n const parsed = JSON.parse(raw);\n if (isBlueprintTranslationCatalog(parsed)) {\n return normaliseTranslationCatalog(parsed);\n }\n return undefined;\n }\n\n const mod = await loadModule(resolved);\n const catalogs = Object.values(mod).filter(isBlueprintTranslationCatalog);\n if (catalogs.length === 0) return undefined;\n return normaliseTranslationCatalog(\n catalogs[0] as BlueprintTranslationCatalog\n );\n}\n\nfunction isBlueprintTranslationCatalog(\n value: unknown\n): value is BlueprintTranslationCatalog {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'meta' in value &&\n typeof (value as BlueprintTranslationCatalog).meta?.key === 'string' &&\n typeof (value as BlueprintTranslationCatalog).meta?.version === 'string' &&\n Array.isArray((value as BlueprintTranslationCatalog).entries)\n );\n}\n\nfunction normaliseTranslationCatalog(\n catalog: BlueprintTranslationCatalog\n): BlueprintTranslationCatalog {\n const supportedLocales =\n catalog.supportedLocales && catalog.supportedLocales.length > 0\n ? catalog.supportedLocales\n : [catalog.defaultLocale];\n return {\n ...catalog,\n supportedLocales,\n };\n}\n\n// --- Registrar Loaders ---\n// Important: This needs IntegrationSpecRegistry which is a Class.\n// We only import type in signature, but need constructor.\n// Imports fixed at top.\n\nasync function loadIntegrationRegistrars(\n value?: string | string[]\n): Promise<IntegrationSpecRegistry | undefined> {\n const entries = normalizePathOption(value);\n if (!entries.length) return undefined;\n\n // We need to import the Class dynamically or have it available.\n // It is imported from @contractspec/lib.contracts\n const { IntegrationSpecRegistry } =\n await import('@contractspec/lib.contracts');\n const registry = new IntegrationSpecRegistry();\n\n for (const entry of entries) {\n const { modulePath, exportName } = parseRegistrarEntry(entry);\n if (!modulePath) continue;\n const resolved = resolve(process.cwd(), modulePath);\n // Logic simplified for brevity, assume module exists or handled by catch in loadModule\n try {\n const mod = await loadModule(resolved);\n const registrar = pickRegistrar(mod, exportName);\n if (registrar) {\n await registrar(registry);\n }\n } catch (e) {\n console.warn(`Failed to load registrar from ${resolved}: ${e}`);\n }\n }\n return registry;\n}\n\nfunction parseRegistrarEntry(entry: string): {\n modulePath: string | null;\n exportName?: string;\n} {\n if (!entry) return { modulePath: null };\n const [modulePathRaw, exportNameRaw] = entry.split('#');\n const modulePath = modulePathRaw?.trim() ?? null;\n const exportName = exportNameRaw?.trim();\n return { modulePath, exportName };\n}\n\nfunction pickRegistrar(\n mod: Record<string, unknown>,\n exportName?: string\n): ((registry: IntegrationSpecRegistry) => void | Promise<void>) | undefined {\n if (exportName) {\n const candidate = mod[exportName];\n if (typeof candidate === 'function') {\n return candidate as (\n registry: IntegrationSpecRegistry\n ) => void | Promise<void>;\n }\n return undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof (mod as any).default === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (mod as any).default;\n }\n for (const value of Object.values(mod)) {\n if (typeof value === 'function') {\n return value as (\n registry: IntegrationSpecRegistry\n ) => void | Promise<void>;\n }\n }\n return undefined;\n}\n"],"mappings":";;;;;;AA0BA,eAAsB,qBACpB,WACA,YACA,gBACA,UACiC;CACjC,MAAM,EAAE,OAAO;CACf,MAAM,eAAe,QAAQ,QAAQ,KAAK,EAAE,WAAW;AAEvD,KAAI,CAAE,MAAM,GAAG,OAAO,aAAa,CACjC,QAAO;EACL,OAAO;EACP,QAAQ,CAAC,iCAAiC,eAAe;EAC1D;AAGH,KAAI;EACF,MAAM,SAAS,MAAM,iBAAiB,aAAa;EACnD,MAAM,cAAc,MAAM,2BACxB,eAAe,aACf,GACD;EACD,MAAM,UAAU,MAAM,uBACpB,eAAe,oBACf,GACD;EACD,MAAM,mBAAmB,MAAM,0BAC7B,eAAe,sBAChB;EAED,MAAMA,UAA2D,EAAE;AACnE,MAAI,YAAY,SAAS,EACvB,SAAQ,oBAAoB;AAE9B,MAAI,QACF,SAAQ,sBAAsB;GAC5B,WAAW,CAAC,QAAQ;GACpB,UAAU,EAAE;GACb;AAEH,MAAI,iBACF,SAAQ,mBAAmB;EAG7B,MAAM,SAASC,eAA0B,WAAW,QAAQ,QAAQ;AAEpE,SAAO;GACL,QAAQ;GACR;GACA,OAAO,OAAO;GACd,QAAQ,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,UAAU;GACxE;UACM,OAAO;AACd,SAAO;GACL,OAAO;GACP,QAAQ,CAAC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;GACjE;;;AAML,eAAe,iBAAiB,YAA8C;AAC5E,KAAI,WAAW,SAAS,QAAQ,EAAE;EAChC,MAAM,MAAM,MAAM,SAAS,YAAY,QAAQ;E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#region src/services/versioning/changelog-formatter.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Format entries as Keep a Changelog markdown.
|
|
8
|
+
*
|
|
9
|
+
* @see https://keepachangelog.com/
|
|
10
|
+
*/
|
|
11
|
+
declare function formatKeepAChangelog(entries: ChangelogEntry[]): string;
|
|
12
|
+
/**
|
|
13
|
+
* Format entries as Conventional Changelog markdown.
|
|
14
|
+
*
|
|
15
|
+
* @see https://www.conventionalcommits.org/
|
|
16
|
+
*/
|
|
17
|
+
declare function formatConventionalChangelog(entries: ChangelogEntry[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format analysis result as JSON export.
|
|
20
|
+
*/
|
|
21
|
+
declare function formatChangelogJson(analysis: VersionAnalyzeResult, baseline?: string): ChangelogJsonExport;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { formatChangelogJson, formatConventionalChangelog, formatKeepAChangelog };
|
|
24
|
+
//# sourceMappingURL=changelog-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-formatter.d.ts","names":[],"sources":["../../../src/services/versioning/changelog-formatter.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;iBAmBgB,oBAAA,UAA8B;;;;;;iBA4G9B,2BAAA,UAAqC;;;;iBAmDrC,mBAAA,WACJ,0CAET"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
//#region src/services/versioning/changelog-formatter.ts
|
|
2
|
+
/**
|
|
3
|
+
* Format entries as Keep a Changelog markdown.
|
|
4
|
+
*
|
|
5
|
+
* @see https://keepachangelog.com/
|
|
6
|
+
*/
|
|
7
|
+
function formatKeepAChangelog(entries) {
|
|
8
|
+
const lines = [
|
|
9
|
+
"# Changelog",
|
|
10
|
+
"",
|
|
11
|
+
"All notable changes to this project will be documented in this file.",
|
|
12
|
+
"",
|
|
13
|
+
"The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),",
|
|
14
|
+
"and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).",
|
|
15
|
+
""
|
|
16
|
+
];
|
|
17
|
+
const sorted = [...entries].sort((a, b) => compareVersionsDescending(a.version, b.version));
|
|
18
|
+
for (const entry of sorted) {
|
|
19
|
+
lines.push(`## [${entry.version}] - ${entry.date}`);
|
|
20
|
+
lines.push("");
|
|
21
|
+
const added = entry.changes.filter((c) => c.type === "added");
|
|
22
|
+
const changed = entry.changes.filter((c) => c.type === "changed");
|
|
23
|
+
const deprecated = entry.changes.filter((c) => c.type === "deprecated");
|
|
24
|
+
const removed = entry.changes.filter((c) => c.type === "removed");
|
|
25
|
+
const fixed = entry.changes.filter((c) => c.type === "fixed");
|
|
26
|
+
const security = entry.changes.filter((c) => c.type === "security");
|
|
27
|
+
const breaking = entry.breakingChanges ?? entry.changes.filter((c) => c.type === "breaking");
|
|
28
|
+
if (breaking.length > 0) {
|
|
29
|
+
lines.push("### ⚠️ Breaking Changes");
|
|
30
|
+
breaking.forEach((c) => {
|
|
31
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
32
|
+
});
|
|
33
|
+
lines.push("");
|
|
34
|
+
}
|
|
35
|
+
if (added.length > 0) {
|
|
36
|
+
lines.push("### Added");
|
|
37
|
+
added.forEach((c) => {
|
|
38
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
39
|
+
});
|
|
40
|
+
lines.push("");
|
|
41
|
+
}
|
|
42
|
+
if (changed.length > 0) {
|
|
43
|
+
lines.push("### Changed");
|
|
44
|
+
changed.forEach((c) => {
|
|
45
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
46
|
+
});
|
|
47
|
+
lines.push("");
|
|
48
|
+
}
|
|
49
|
+
if (deprecated.length > 0) {
|
|
50
|
+
lines.push("### Deprecated");
|
|
51
|
+
deprecated.forEach((c) => {
|
|
52
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
53
|
+
});
|
|
54
|
+
lines.push("");
|
|
55
|
+
}
|
|
56
|
+
if (removed.length > 0) {
|
|
57
|
+
lines.push("### Removed");
|
|
58
|
+
removed.forEach((c) => {
|
|
59
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
60
|
+
});
|
|
61
|
+
lines.push("");
|
|
62
|
+
}
|
|
63
|
+
if (fixed.length > 0) {
|
|
64
|
+
lines.push("### Fixed");
|
|
65
|
+
fixed.forEach((c) => {
|
|
66
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
67
|
+
});
|
|
68
|
+
lines.push("");
|
|
69
|
+
}
|
|
70
|
+
if (security.length > 0) {
|
|
71
|
+
lines.push("### Security");
|
|
72
|
+
security.forEach((c) => {
|
|
73
|
+
lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ""}`);
|
|
74
|
+
});
|
|
75
|
+
lines.push("");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return lines.join("\n");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Format entries as Conventional Changelog markdown.
|
|
82
|
+
*
|
|
83
|
+
* @see https://www.conventionalcommits.org/
|
|
84
|
+
*/
|
|
85
|
+
function formatConventionalChangelog(entries) {
|
|
86
|
+
const lines = ["# Changelog", ""];
|
|
87
|
+
const sorted = [...entries].sort((a, b) => compareVersionsDescending(a.version, b.version));
|
|
88
|
+
for (const entry of sorted) {
|
|
89
|
+
const bumpLabel = entry.bumpType === "major" ? "💥 BREAKING RELEASE" : entry.bumpType === "minor" ? "🚀 Minor Release" : "🔧 Patch Release";
|
|
90
|
+
lines.push(`## ${entry.version} (${entry.date}) - ${bumpLabel}`);
|
|
91
|
+
lines.push("");
|
|
92
|
+
const typeMapping = {
|
|
93
|
+
added: "feat",
|
|
94
|
+
changed: "refactor",
|
|
95
|
+
fixed: "fix",
|
|
96
|
+
removed: "refactor",
|
|
97
|
+
deprecated: "deprecate",
|
|
98
|
+
breaking: "feat!",
|
|
99
|
+
security: "security"
|
|
100
|
+
};
|
|
101
|
+
for (const change of entry.changes) {
|
|
102
|
+
const type = typeMapping[change.type] ?? "chore";
|
|
103
|
+
const scope = change.path ? `(${change.path})` : "";
|
|
104
|
+
const breakingMarker = change.type === "breaking" ? "!" : "";
|
|
105
|
+
lines.push(`- **${type}${scope}${breakingMarker}**: ${change.description}`);
|
|
106
|
+
}
|
|
107
|
+
lines.push("");
|
|
108
|
+
}
|
|
109
|
+
return lines.join("\n");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Format analysis result as JSON export.
|
|
113
|
+
*/
|
|
114
|
+
function formatChangelogJson(analysis, baseline) {
|
|
115
|
+
const specsNeedingBump = analysis.analyses.filter((a) => a.needsBump);
|
|
116
|
+
const isoDateTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
117
|
+
const isoDate = isoDateTime.split("T")[0] ?? "";
|
|
118
|
+
return {
|
|
119
|
+
generatedAt: isoDateTime,
|
|
120
|
+
baseline,
|
|
121
|
+
specs: specsNeedingBump.map((spec) => ({
|
|
122
|
+
key: spec.specKey,
|
|
123
|
+
version: spec.suggestedVersion,
|
|
124
|
+
path: spec.specPath,
|
|
125
|
+
entries: [{
|
|
126
|
+
version: spec.suggestedVersion,
|
|
127
|
+
date: isoDate,
|
|
128
|
+
bumpType: spec.bumpType,
|
|
129
|
+
changes: spec.changes,
|
|
130
|
+
breakingChanges: spec.changes.filter((c) => c.type === "breaking")
|
|
131
|
+
}]
|
|
132
|
+
})),
|
|
133
|
+
libraries: []
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Compare versions in descending order (newest first).
|
|
138
|
+
*/
|
|
139
|
+
function compareVersionsDescending(a, b) {
|
|
140
|
+
const parseVer = (v) => {
|
|
141
|
+
return v.split(".").map((p) => parseInt(p, 10) || 0);
|
|
142
|
+
};
|
|
143
|
+
const aParts = parseVer(a);
|
|
144
|
+
const bParts = parseVer(b);
|
|
145
|
+
for (let i = 0; i < 3; i++) {
|
|
146
|
+
const aVal = aParts[i] ?? 0;
|
|
147
|
+
const bVal = bParts[i] ?? 0;
|
|
148
|
+
if (aVal !== bVal) return bVal - aVal;
|
|
149
|
+
}
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
export { formatChangelogJson, formatConventionalChangelog, formatKeepAChangelog };
|
|
155
|
+
//# sourceMappingURL=changelog-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-formatter.js","names":["lines: string[]","typeMapping: Record<string, string>"],"sources":["../../../src/services/versioning/changelog-formatter.ts"],"sourcesContent":["/**\n * Changelog formatters.\n *\n * Format changelog entries as Markdown (Keep a Changelog, Conventional)\n * or JSON for programmatic use.\n */\n\nimport type { ChangelogEntry, ChangeEntry } from '@contractspec/lib.contracts';\nimport type { VersionAnalyzeResult, ChangelogJsonExport } from './types';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Keep a Changelog Format\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Format entries as Keep a Changelog markdown.\n *\n * @see https://keepachangelog.com/\n */\nexport function formatKeepAChangelog(entries: ChangelogEntry[]): string {\n const lines: string[] = [\n '# Changelog',\n '',\n 'All notable changes to this project will be documented in this file.',\n '',\n 'The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),',\n 'and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).',\n '',\n ];\n\n // Sort entries by version (newest first)\n const sorted = [...entries].sort((a, b) =>\n compareVersionsDescending(a.version, b.version)\n );\n\n for (const entry of sorted) {\n lines.push(`## [${entry.version}] - ${entry.date}`);\n lines.push('');\n\n // Group changes by type\n const added = entry.changes.filter((c: ChangeEntry) => c.type === 'added');\n const changed = entry.changes.filter(\n (c: ChangeEntry) => c.type === 'changed'\n );\n const deprecated = entry.changes.filter(\n (c: ChangeEntry) => c.type === 'deprecated'\n );\n const removed = entry.changes.filter(\n (c: ChangeEntry) => c.type === 'removed'\n );\n const fixed = entry.changes.filter((c: ChangeEntry) => c.type === 'fixed');\n const security = entry.changes.filter(\n (c: ChangeEntry) => c.type === 'security'\n );\n const breaking =\n entry.breakingChanges ??\n entry.changes.filter((c: ChangeEntry) => c.type === 'breaking');\n\n if (breaking.length > 0) {\n lines.push('### ⚠️ Breaking Changes');\n breaking.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n\n if (added.length > 0) {\n lines.push('### Added');\n added.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n\n if (changed.length > 0) {\n lines.push('### Changed');\n changed.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n\n if (deprecated.length > 0) {\n lines.push('### Deprecated');\n deprecated.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n\n if (removed.length > 0) {\n lines.push('### Removed');\n removed.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n\n if (fixed.length > 0) {\n lines.push('### Fixed');\n fixed.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n\n if (security.length > 0) {\n lines.push('### Security');\n security.forEach((c: ChangeEntry) => {\n lines.push(`- ${c.description}${c.path ? ` (${c.path})` : ''}`);\n });\n lines.push('');\n }\n }\n\n return lines.join('\\n');\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Conventional Changelog Format\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Format entries as Conventional Changelog markdown.\n *\n * @see https://www.conventionalcommits.org/\n */\nexport function formatConventionalChangelog(entries: ChangelogEntry[]): string {\n const lines: string[] = ['# Changelog', ''];\n\n // Sort entries by version (newest first)\n const sorted = [...entries].sort((a, b) =>\n compareVersionsDescending(a.version, b.version)\n );\n\n for (const entry of sorted) {\n const bumpLabel =\n entry.bumpType === 'major'\n ? '💥 BREAKING RELEASE'\n : entry.bumpType === 'minor'\n ? '🚀 Minor Release'\n : '🔧 Patch Release';\n\n lines.push(`## ${entry.version} (${entry.date}) - ${bumpLabel}`);\n lines.push('');\n\n // Map change types to conventional commit types\n const typeMapping: Record<string, string> = {\n added: 'feat',\n changed: 'refactor',\n fixed: 'fix',\n removed: 'refactor',\n deprecated: 'deprecate',\n breaking: 'feat!',\n security: 'security',\n };\n\n for (const change of entry.changes) {\n const type = typeMapping[change.type] ?? 'chore';\n const scope = change.path ? `(${change.path})` : '';\n const breakingMarker = change.type === 'breaking' ? '!' : '';\n lines.push(\n `- **${type}${scope}${breakingMarker}**: ${change.description}`\n );\n }\n lines.push('');\n }\n\n return lines.join('\\n');\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// JSON Format\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Format analysis result as JSON export.\n */\nexport function formatChangelogJson(\n analysis: VersionAnalyzeResult,\n baseline?: string\n): ChangelogJsonExport {\n const specsNeedingBump = analysis.analyses.filter((a) => a.needsBump);\n\n const isoDateTime = new Date().toISOString();\n const isoDate = isoDateTime.split('T')[0] ?? '';\n\n return {\n generatedAt: isoDateTime,\n baseline,\n specs: specsNeedingBump.map((spec) => ({\n key: spec.specKey,\n version: spec.suggestedVersion,\n path: spec.specPath,\n entries: [\n {\n version: spec.suggestedVersion,\n date: isoDate,\n bumpType: spec.bumpType,\n changes: spec.changes,\n breakingChanges: spec.changes.filter((c) => c.type === 'breaking'),\n },\n ],\n })),\n libraries: [], // TODO: Group by library\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Helpers\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Compare versions in descending order (newest first).\n */\nfunction compareVersionsDescending(a: string, b: string): number {\n const parseVer = (v: string): number[] => {\n const parts = v.split('.').map((p) => parseInt(p, 10) || 0);\n return parts;\n };\n\n const aParts = parseVer(a);\n const bParts = parseVer(b);\n\n for (let i = 0; i < 3; i++) {\n const aVal = aParts[i] ?? 0;\n const bVal = bParts[i] ?? 0;\n if (aVal !== bVal) {\n return bVal - aVal; // Descending\n }\n }\n\n return 0;\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,qBAAqB,SAAmC;CACtE,MAAMA,QAAkB;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CAGD,MAAM,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,MACnC,0BAA0B,EAAE,SAAS,EAAE,QAAQ,CAChD;AAED,MAAK,MAAM,SAAS,QAAQ;AAC1B,QAAM,KAAK,OAAO,MAAM,QAAQ,MAAM,MAAM,OAAO;AACnD,QAAM,KAAK,GAAG;EAGd,MAAM,QAAQ,MAAM,QAAQ,QAAQ,MAAmB,EAAE,SAAS,QAAQ;EAC1E,MAAM,UAAU,MAAM,QAAQ,QAC3B,MAAmB,EAAE,SAAS,UAChC;EACD,MAAM,aAAa,MAAM,QAAQ,QAC9B,MAAmB,EAAE,SAAS,aAChC;EACD,MAAM,UAAU,MAAM,QAAQ,QAC3B,MAAmB,EAAE,SAAS,UAChC;EACD,MAAM,QAAQ,MAAM,QAAQ,QAAQ,MAAmB,EAAE,SAAS,QAAQ;EAC1E,MAAM,WAAW,MAAM,QAAQ,QAC5B,MAAmB,EAAE,SAAS,WAChC;EACD,MAAM,WACJ,MAAM,mBACN,MAAM,QAAQ,QAAQ,MAAmB,EAAE,SAAS,WAAW;AAEjE,MAAI,SAAS,SAAS,GAAG;AACvB,SAAM,KAAK,0BAA0B;AACrC,YAAS,SAAS,MAAmB;AACnC,UAAM,KAAK,KAAK,EAAE,cAAc,EAAE,OAAO,KAAK,EAAE,KAAK,KAAK,KAAK;KAC/D;AACF,SAAM,KAAK,GAAG;;AAG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AAM,YAAY,MAAwB;AAExC,SADc,EAAE,MAAM,IAAI,CAAC,KAAK,MAAM,SAAS,GAAG,GAAG,IAAI,EAAE;;CAI7D,MAAM,SAAS,SAAS,EAAE;CAC1B,MAAM,SAAS,SAAS,EAAE;AAE1B,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,MAAM,OAAO,OAAO,MAAM;EAC1B,MAAM,OAAO,OAAO,MAAM;AAC1B,MAAI,SAAS,KACX,QAAO,OAAO;;AAIlB,QAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEntry, ChangelogDocBlock, ChangelogEntry, ChangelogGenerateOptions, ChangelogGenerateResult, ChangelogJsonExport, ChangelogTier, LibraryChangelogJson, SpecChangelogJson, SpecVersionAnalysis, VersionAnalyzeOptions, VersionAnalyzeResult, VersionBumpOptions, VersionBumpResult, VersionBumpType } from "./types.js";
|
|
2
|
+
import { analyzeVersions, applyVersionBump, generateChangelogs } from "./versioning-service.js";
|
|
3
|
+
import { formatChangelogJson, formatConventionalChangelog, formatKeepAChangelog } from "./changelog-formatter.js";
|
|
4
|
+
|
|
5
|
+
//#region src/services/versioning/index.d.ts
|
|
6
|
+
declare namespace index_d_exports {
|
|
7
|
+
export { ChangeEntry, ChangelogDocBlock, ChangelogEntry, ChangelogGenerateOptions, ChangelogGenerateResult, ChangelogJsonExport, ChangelogTier, LibraryChangelogJson, SpecChangelogJson, SpecVersionAnalysis, VersionAnalyzeOptions, VersionAnalyzeResult, VersionBumpOptions, VersionBumpResult, VersionBumpType, analyzeVersions, applyVersionBump, formatChangelogJson, formatConventionalChangelog, formatKeepAChangelog, generateChangelogs };
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { index_d_exports };
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/services/versioning/index.ts"],"sourcesContent":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { formatChangelogJson, formatConventionalChangelog, formatKeepAChangelog } from "./changelog-formatter.js";
|
|
3
|
+
import { analyzeVersions, applyVersionBump, generateChangelogs } from "./versioning-service.js";
|
|
4
|
+
|
|
5
|
+
//#region src/services/versioning/index.ts
|
|
6
|
+
var versioning_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
analyzeVersions: () => analyzeVersions,
|
|
8
|
+
applyVersionBump: () => applyVersionBump,
|
|
9
|
+
formatChangelogJson: () => formatChangelogJson,
|
|
10
|
+
formatConventionalChangelog: () => formatConventionalChangelog,
|
|
11
|
+
formatKeepAChangelog: () => formatKeepAChangelog,
|
|
12
|
+
generateChangelogs: () => generateChangelogs
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { versioning_exports };
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/services/versioning/index.ts"],"sourcesContent":["/**\n * Versioning service module exports.\n *\n * Provides version analysis, version bumping, and changelog generation.\n */\n\nexport * from './types';\nexport {\n analyzeVersions,\n applyVersionBump,\n generateChangelogs,\n} from './versioning-service';\nexport {\n formatKeepAChangelog,\n formatConventionalChangelog,\n formatChangelogJson,\n} from './changelog-formatter';\n"],"mappings":""}
|