@contractspec/bundle.workspace 4.3.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/contracts/operations/init.operation.d.ts +1 -1
  2. package/dist/index.js +1207 -641
  3. package/dist/node/index.js +1207 -641
  4. package/dist/services/adoption/catalog-core.d.ts +2 -0
  5. package/dist/services/adoption/catalog-entry.d.ts +2 -0
  6. package/dist/services/adoption/catalog-runtime.d.ts +2 -0
  7. package/dist/services/adoption/catalog-shared.d.ts +2 -0
  8. package/dist/services/adoption/catalog-solutions.d.ts +2 -0
  9. package/dist/services/adoption/catalog-ui.d.ts +2 -0
  10. package/dist/services/adoption/catalog.d.ts +3 -0
  11. package/dist/services/adoption/index.d.ts +6 -0
  12. package/dist/services/adoption/resolve.d.ts +6 -0
  13. package/dist/services/adoption/resolve.test.d.ts +1 -0
  14. package/dist/services/adoption/tokens.d.ts +6 -0
  15. package/dist/services/adoption/types.d.ts +99 -0
  16. package/dist/services/adoption/workspace-scan.d.ts +8 -0
  17. package/dist/services/adoption/workspace.d.ts +3 -0
  18. package/dist/services/build.d.ts +36 -1
  19. package/dist/services/connect/adoption.d.ts +10 -0
  20. package/dist/services/connect/init.d.ts +2 -6
  21. package/dist/services/connect/types.d.ts +11 -1
  22. package/dist/services/contractsrc-schema-ref.d.ts +4 -0
  23. package/dist/services/deps.d.ts +2 -0
  24. package/dist/services/discover.d.ts +15 -0
  25. package/dist/services/discover.test.d.ts +1 -0
  26. package/dist/services/doctor/checks/config.test.d.ts +1 -0
  27. package/dist/services/generate-artifacts.d.ts +4 -0
  28. package/dist/services/index.d.ts +6 -0
  29. package/dist/services/integrity.d.ts +2 -0
  30. package/dist/services/module-loader.d.ts +25 -0
  31. package/dist/services/module-loader.test.d.ts +1 -0
  32. package/dist/services/onboarding/catalog.d.ts +4 -0
  33. package/dist/services/onboarding/index.d.ts +4 -0
  34. package/dist/services/onboarding/journey.d.ts +11 -0
  35. package/dist/services/onboarding/render.d.ts +5 -0
  36. package/dist/services/onboarding/service.d.ts +5 -0
  37. package/dist/services/onboarding/service.test.d.ts +1 -0
  38. package/dist/services/onboarding/types.d.ts +71 -0
  39. package/dist/services/package-scaffold.d.ts +22 -0
  40. package/dist/services/setup/config-generators.d.ts +5 -1
  41. package/dist/services/setup/gitignore.d.ts +10 -0
  42. package/dist/services/setup/gitignore.test.d.ts +1 -0
  43. package/dist/services/setup/index.d.ts +5 -0
  44. package/dist/services/setup/managed-markdown.d.ts +8 -0
  45. package/dist/services/setup/presets.d.ts +16 -0
  46. package/dist/services/setup/targets/agents-md.d.ts +2 -0
  47. package/dist/services/setup/targets/cli-config.test.d.ts +1 -0
  48. package/dist/services/setup/targets/index.d.ts +1 -0
  49. package/dist/services/setup/targets/usage-md.d.ts +5 -0
  50. package/dist/services/setup/targets/usage-md.test.d.ts +1 -0
  51. package/dist/services/setup/types.d.ts +37 -3
  52. package/dist/services/update.test.d.ts +1 -0
  53. package/dist/services/validate/index.d.ts +1 -0
  54. package/dist/services/validate/module-loader-usage.test.d.ts +1 -0
  55. package/dist/services/validate/package-scaffold-validator.d.ts +8 -0
  56. package/dist/services/validate/package-scaffold-validator.test.d.ts +1 -0
  57. package/dist/services/validate/spec-validator.d.ts +6 -1
  58. package/dist/services/validate/spec-validator.test.d.ts +1 -0
  59. package/dist/services/versioning/index.d.ts +1 -0
  60. package/dist/services/versioning/release-authoring.d.ts +14 -0
  61. package/dist/services/versioning/release-authoring.test.d.ts +1 -0
  62. package/dist/services/versioning/release-files.d.ts +7 -0
  63. package/dist/services/versioning/release-service.types.d.ts +53 -1
  64. package/dist/services/vibe/definitions.test.d.ts +1 -0
  65. package/dist/templates/additional-contracts.template.d.ts +40 -0
  66. package/dist/templates/advanced-contracts.template.d.ts +39 -0
  67. package/dist/templates/data-view-renderer.template.d.ts +6 -0
  68. package/dist/templates/feature.template.d.ts +7 -6
  69. package/dist/templates/form.template.d.ts +16 -0
  70. package/dist/templates/form.template.test.d.ts +1 -0
  71. package/dist/templates/index.d.ts +6 -0
  72. package/dist/templates/theme.template.d.ts +12 -0
  73. package/dist/templates/theme.template.test.d.ts +1 -0
  74. package/dist/templates/workflow-devkit.template.d.ts +11 -0
  75. package/dist/types.d.ts +16 -11
  76. package/dist/utils/index.d.ts +0 -1
  77. package/package.json +10 -9
  78. package/dist/utils/module-loader.d.ts +0 -1
@@ -0,0 +1,2 @@
1
+ import type { AdoptionCatalogEntry } from './types';
2
+ export declare const CORE_CATALOG_ENTRIES: AdoptionCatalogEntry[];
@@ -0,0 +1,2 @@
1
+ import type { AdoptionCatalogEntry, AdoptionFamily, AdoptionPackageKind } from './types';
2
+ export declare function createCatalogEntry(id: string, packageRef: string, family: AdoptionFamily, packageKind: AdoptionPackageKind, resolutionPriority: number, capabilityTags: string[], preferredUseCases: string[], description: string, options?: Partial<Pick<AdoptionCatalogEntry, 'avoidWhen' | 'platforms' | 'replacementImportHints' | 'runtimes' | 'title'>>): AdoptionCatalogEntry;
@@ -0,0 +1,2 @@
1
+ import type { AdoptionCatalogEntry } from './types';
2
+ export declare const RUNTIME_CATALOG_ENTRIES: AdoptionCatalogEntry[];
@@ -0,0 +1,2 @@
1
+ import type { AdoptionCatalogEntry } from './types';
2
+ export declare const SHARED_CATALOG_ENTRIES: AdoptionCatalogEntry[];
@@ -0,0 +1,2 @@
1
+ import type { AdoptionCatalogEntry } from './types';
2
+ export declare const SOLUTION_CATALOG_ENTRIES: AdoptionCatalogEntry[];
@@ -0,0 +1,2 @@
1
+ import type { AdoptionCatalogEntry } from './types';
2
+ export declare const UI_CATALOG_ENTRIES: AdoptionCatalogEntry[];
@@ -0,0 +1,3 @@
1
+ import type { AdoptionCatalogDocument, AdoptionCatalogEntry } from './types';
2
+ export declare function getContractSpecAdoptionCatalog(): AdoptionCatalogEntry[];
3
+ export declare function createAdoptionCatalogDocument(now?: Date): AdoptionCatalogDocument;
@@ -0,0 +1,6 @@
1
+ export * from './catalog';
2
+ export * from './resolve';
3
+ export * from './tokens';
4
+ export * from './types';
5
+ export * from './workspace';
6
+ export * from './workspace-scan';
@@ -0,0 +1,6 @@
1
+ import type { AdoptionResolution, AdoptionResolveInput, AdoptionResolverRuntime, AdoptionSyncInput } from './types';
2
+ export declare function resolveAdoption(runtime: AdoptionResolverRuntime, input: AdoptionResolveInput): Promise<AdoptionResolution>;
3
+ export declare function syncAdoptionCatalog(runtime: AdoptionResolverRuntime, input?: AdoptionSyncInput): Promise<{
4
+ catalog: import("./types").AdoptionCatalogDocument;
5
+ catalogPath: string;
6
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { AdoptionCandidate } from './types';
2
+ export declare function normalizeText(value: string): string;
3
+ export declare function tokenize(value: string): string[];
4
+ export declare function uniqueTokens(values: string[]): string[];
5
+ export declare function candidateTokens(candidate: AdoptionCandidate): string[];
6
+ export declare function overlap(left: string[], right: string[]): number;
@@ -0,0 +1,99 @@
1
+ import type { ConnectAdoptionConfig, ConnectAdoptionFamily, ConnectVerdict, ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec/workspace-config';
2
+ import type { FsAdapter } from '../../ports/fs';
3
+ export type AdoptionFamily = ConnectAdoptionFamily;
4
+ export type AdoptionVerdict = ConnectVerdict;
5
+ export type AdoptionSource = 'workspace' | 'contractspec' | 'ecosystem';
6
+ export type AdoptionPackageKind = 'primitive' | 'adapter' | 'module' | 'bundle' | 'app' | 'example';
7
+ export interface AdoptionImportHint {
8
+ from: string;
9
+ to: string;
10
+ note?: string;
11
+ }
12
+ export interface AdoptionCatalogEntry {
13
+ id: string;
14
+ source: Exclude<AdoptionSource, 'workspace'>;
15
+ packageRef: string;
16
+ family: AdoptionFamily;
17
+ packageKind: AdoptionPackageKind;
18
+ title: string;
19
+ description: string;
20
+ capabilityTags: string[];
21
+ preferredUseCases: string[];
22
+ avoidWhen?: string[];
23
+ platforms?: string[];
24
+ runtimes?: string[];
25
+ replacementImportHints?: AdoptionImportHint[];
26
+ resolutionPriority: number;
27
+ }
28
+ export interface AdoptionWorkspaceCandidate {
29
+ id: string;
30
+ source: 'workspace';
31
+ family: AdoptionFamily;
32
+ title: string;
33
+ description: string;
34
+ filePath?: string;
35
+ packageRef?: string;
36
+ packageKind?: AdoptionPackageKind;
37
+ capabilityTags: string[];
38
+ preferredUseCases: string[];
39
+ resolutionPriority: number;
40
+ }
41
+ export type AdoptionCandidate = AdoptionCatalogEntry | AdoptionWorkspaceCandidate;
42
+ export interface AdoptionCatalogDocument {
43
+ version: 1;
44
+ generatedAt: string;
45
+ entries: AdoptionCatalogEntry[];
46
+ }
47
+ export interface AdoptionWorkspaceIndex {
48
+ packageCandidates: AdoptionWorkspaceCandidate[];
49
+ fileCandidates: AdoptionWorkspaceCandidate[];
50
+ }
51
+ export interface AdoptionResolveInput {
52
+ family: AdoptionFamily;
53
+ query?: string;
54
+ symbol?: string;
55
+ paths?: string[];
56
+ platform?: string;
57
+ runtime?: string;
58
+ currentTarget?: string;
59
+ config?: ResolvedContractsrcConfig;
60
+ cwd?: string;
61
+ workspaceRoot?: string;
62
+ packageRoot?: string;
63
+ }
64
+ export interface AdoptionResolutionCandidate {
65
+ candidate: AdoptionCandidate;
66
+ score: number;
67
+ matchReasons: string[];
68
+ }
69
+ export interface AdoptionResolution {
70
+ family: AdoptionFamily;
71
+ verdict: AdoptionVerdict;
72
+ selected: AdoptionResolutionCandidate | null;
73
+ candidates: AdoptionResolutionCandidate[];
74
+ ambiguous: boolean;
75
+ exhausted: boolean;
76
+ reason: string;
77
+ currentTarget?: string;
78
+ query: string;
79
+ }
80
+ export interface AdoptionSyncInput {
81
+ config?: ResolvedContractsrcConfig;
82
+ cwd?: string;
83
+ workspaceRoot?: string;
84
+ packageRoot?: string;
85
+ }
86
+ export interface AdoptionSyncResult {
87
+ catalogPath: string;
88
+ catalog: AdoptionCatalogDocument;
89
+ }
90
+ export interface AdoptionResolvedWorkspace {
91
+ cwd: string;
92
+ workspaceRoot: string;
93
+ packageRoot: string;
94
+ config: ResolvedContractsrcConfig;
95
+ adoption: NonNullable<ConnectAdoptionConfig>;
96
+ }
97
+ export interface AdoptionResolverRuntime {
98
+ fs: FsAdapter;
99
+ }
@@ -0,0 +1,8 @@
1
+ import type { FsAdapter } from '../../ports/fs';
2
+ import type { AdoptionFamily, AdoptionResolvedWorkspace, AdoptionWorkspaceCandidate } from './types';
3
+ export declare function scanWorkspaceAdoptionCandidates(fs: FsAdapter, workspace: AdoptionResolvedWorkspace): Promise<{
4
+ fileCandidates: AdoptionWorkspaceCandidate[];
5
+ packageCandidates: AdoptionWorkspaceCandidate[];
6
+ }>;
7
+ export declare function hasLocalShadcnRegistry(fs: FsAdapter, workspace: AdoptionResolvedWorkspace): Promise<boolean>;
8
+ export declare function inferFamilyFromPath(path: string): AdoptionFamily | null;
@@ -0,0 +1,3 @@
1
+ import type { FsAdapter } from '../../ports/fs';
2
+ import type { AdoptionResolvedWorkspace, AdoptionSyncInput } from './types';
3
+ export declare function resolveAdoptionWorkspace(fs: FsAdapter, input?: AdoptionSyncInput): Promise<AdoptionResolvedWorkspace>;
@@ -11,7 +11,7 @@ import type { LoggerAdapter } from '../ports/logger';
11
11
  /**
12
12
  * Build target types.
13
13
  */
14
- export type BuildTarget = 'handler' | 'component' | 'test';
14
+ export type BuildTarget = 'handler' | 'component' | 'test' | 'form' | 'workflow-runner' | 'data-view-renderer' | 'package-scaffold';
15
15
  /**
16
16
  * Options for building from a spec.
17
17
  */
@@ -32,6 +32,33 @@ export interface BuildSpecOptions {
32
32
  * Skip writing files (dry run).
33
33
  */
34
34
  dryRun?: boolean;
35
+ /**
36
+ * Include target-specific test artifacts in the default build plan.
37
+ */
38
+ includeTests?: boolean;
39
+ /**
40
+ * Optional runtime generation strategy supplied by higher-level callers.
41
+ */
42
+ runtimeGeneration?: RuntimeGenerationStrategy;
43
+ }
44
+ export type RuntimeArtifactKind = 'handler' | 'component' | 'form';
45
+ export type RuntimeTestKind = 'handler' | 'component';
46
+ export interface RuntimeArtifactGenerationInput {
47
+ kind: RuntimeArtifactKind;
48
+ specCode: string;
49
+ outputPath: string;
50
+ fallbackCode: string;
51
+ }
52
+ export interface RuntimeTestGenerationInput {
53
+ kind: RuntimeTestKind;
54
+ specCode: string;
55
+ outputPath: string;
56
+ existingCode: string;
57
+ fallbackCode: string;
58
+ }
59
+ export interface RuntimeGenerationStrategy {
60
+ generateArtifact?: (input: RuntimeArtifactGenerationInput) => Promise<string | null | undefined>;
61
+ generateTest?: (input: RuntimeTestGenerationInput) => Promise<string | null | undefined>;
35
62
  }
36
63
  /**
37
64
  * Result of a single build target.
@@ -42,6 +69,7 @@ export interface BuildTargetResult {
42
69
  success: boolean;
43
70
  skipped?: boolean;
44
71
  error?: string;
72
+ generatedCode?: string;
45
73
  }
46
74
  /**
47
75
  * Result of building from a spec.
@@ -49,6 +77,7 @@ export interface BuildTargetResult {
49
77
  export interface BuildSpecResult {
50
78
  specPath: string;
51
79
  specInfo: SpecScanResult;
80
+ targetId: string;
52
81
  results: BuildTargetResult[];
53
82
  }
54
83
  /**
@@ -59,3 +88,9 @@ export declare function buildSpec(specPath: string, adapters: {
59
88
  logger: LoggerAdapter;
60
89
  workspace?: typeof import('@contractspec/module.workspace');
61
90
  }, config: ResolvedContractsrcConfig, options?: BuildSpecOptions): Promise<BuildSpecResult>;
91
+ /**
92
+ * Detect default targets based on spec type.
93
+ */
94
+ export declare function resolveDefaultBuildTargets(targetId: string, options: {
95
+ includeTests: boolean;
96
+ }): BuildTarget[];
@@ -0,0 +1,10 @@
1
+ import type { WorkspaceAdapters } from '../../ports/logger';
2
+ import * as adoption from '../adoption/index';
3
+ import type { ConnectPatchVerdict, ConnectVerdict, ConnectVerifyInput } from './types';
4
+ export declare function evaluateConnectAdoption(adapters: Pick<WorkspaceAdapters, 'fs'>, input: ConnectVerifyInput): Promise<{
5
+ check?: ConnectPatchVerdict['checks'][number];
6
+ reason?: string;
7
+ remediation?: string[];
8
+ resolution?: Awaited<ReturnType<typeof adoption.resolveAdoption>>;
9
+ verdict?: ConnectVerdict;
10
+ }>;
@@ -1,7 +1,3 @@
1
1
  import type { FsAdapter } from '../../ports/fs';
2
- import type { ConnectInitInput } from './types';
3
- export declare function initConnectWorkspace(fs: FsAdapter, input?: ConnectInitInput): Promise<{
4
- configPath: string;
5
- targetRoot: string;
6
- action: 'created' | 'merged';
7
- }>;
2
+ import type { ConnectInitInput, ConnectInitResult } from './types';
3
+ export declare function initConnectWorkspace(fs: FsAdapter, input?: ConnectInitInput): Promise<ConnectInitResult>;
@@ -1,8 +1,9 @@
1
1
  import type { ConnectVerdict, ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec/workspace-config';
2
+ import type { SetupFileResult, SetupGitignoreBehavior, SetupPromptCallbacks } from '../setup/types';
2
3
  export type { ConnectVerdict };
3
4
  export type ConnectActorType = 'human' | 'agent' | 'service' | 'tool';
4
5
  export type ConnectApprovalStatus = 'not_required' | 'pending' | 'approved' | 'rejected' | 'expired';
5
- export type ConnectSurface = 'agent' | 'audit' | 'cli' | 'contract' | 'harness' | 'knowledge' | 'mcp' | 'runtime';
6
+ export type ConnectSurface = 'agent' | 'audit' | 'cli' | 'contract' | 'harness' | 'integration' | 'knowledge' | 'library' | 'mcp' | 'runtime' | 'solution' | 'ui';
6
7
  export type ConnectContractKind = 'command' | 'query' | 'event' | 'policy' | 'capability';
7
8
  export interface ConnectActorRef {
8
9
  id: string;
@@ -33,6 +34,15 @@ export interface ConnectWorkspaceInput {
33
34
  }
34
35
  export interface ConnectInitInput extends ConnectWorkspaceInput {
35
36
  scope?: 'workspace' | 'package';
37
+ interactive?: boolean;
38
+ gitignoreBehavior?: SetupGitignoreBehavior;
39
+ prompts?: Pick<SetupPromptCallbacks, 'confirm'>;
40
+ }
41
+ export interface ConnectInitResult {
42
+ configPath: string;
43
+ targetRoot: string;
44
+ action: 'created' | 'merged';
45
+ gitignore: SetupFileResult;
36
46
  }
37
47
  export interface ConnectTaskInput extends ConnectWorkspaceInput {
38
48
  taskId: string;
@@ -0,0 +1,4 @@
1
+ export declare function getBundledContractsrcSchemaRef(options: {
2
+ configRoot: string;
3
+ workspaceRoot: string;
4
+ }): string;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Dependency analysis service.
3
3
  */
4
+ import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
4
5
  import { type ContractGraph, type ContractNode } from '@contractspec/module.workspace';
5
6
  import type { FsAdapter } from '../ports/fs';
6
7
  /**
@@ -11,6 +12,7 @@ export interface AnalyzeDepsOptions {
11
12
  * File pattern to search.
12
13
  */
13
14
  pattern?: string;
15
+ config?: ResolvedContractsrcConfig;
14
16
  }
15
17
  /**
16
18
  * Result of dependency analysis.
@@ -0,0 +1,15 @@
1
+ import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
2
+ import type { MaybeArray } from '@contractspec/lib.utils-typescript';
3
+ import { type SpecScanResult } from '@contractspec/module.workspace';
4
+ import type { FsAdapter } from '../ports/fs';
5
+ export interface DiscoverSpecsOptions {
6
+ pattern?: string;
7
+ paths?: string[];
8
+ cwd?: string;
9
+ type?: MaybeArray<string>;
10
+ config?: ResolvedContractsrcConfig;
11
+ }
12
+ export declare function discoverSpecFiles(fs: FsAdapter, options?: DiscoverSpecsOptions): Promise<string[]>;
13
+ export declare function discoverSpecs(adapters: {
14
+ fs: FsAdapter;
15
+ }, options?: DiscoverSpecsOptions): Promise<SpecScanResult[]>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,11 +1,15 @@
1
+ import { type ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
1
2
  import type { WorkspaceAdapters } from '../ports/logger';
2
3
  export interface GenerateArtifactsResult {
3
4
  specsCount: number;
4
5
  docsCount: number;
6
+ materializedCount: number;
5
7
  }
6
8
  export interface GenerateArtifactsOptions {
7
9
  scanAllSpecs?: boolean;
8
10
  specPattern?: string;
9
11
  specSearchRoot?: string;
12
+ config?: ResolvedContractsrcConfig;
13
+ includeRuntimeTests?: boolean;
10
14
  }
11
15
  export declare function generateArtifacts(adapters: WorkspaceAdapters, contractsDir: string, generatedDir: string, rootPath?: string, options?: GenerateArtifactsOptions): Promise<GenerateArtifactsResult>;
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export * from './action-drift/index';
5
5
  export * from './action-pr';
6
+ export * as adoption from './adoption/index';
6
7
  export * from './agent-guide/index';
7
8
  export * from './build';
8
9
  export * from './ci-check/index';
@@ -13,6 +14,7 @@ export * from './create/index';
13
14
  export * from './delete';
14
15
  export * from './deps';
15
16
  export * from './diff';
17
+ export * from './discover';
16
18
  export * from './docs/index';
17
19
  export * from './doctor/index';
18
20
  export * from './extract';
@@ -30,7 +32,10 @@ export * from './integrity-diagram';
30
32
  export * from './layer-discovery';
31
33
  export * from './list';
32
34
  export * from './llm/index';
35
+ export * from './module-loader';
36
+ export * as onboarding from './onboarding/index';
33
37
  export * from './openapi/index';
38
+ export * from './package-scaffold';
34
39
  export * from './quickstart/index';
35
40
  export * from './regenerator';
36
41
  export * from './registry';
@@ -44,6 +49,7 @@ export * from './validate/index';
44
49
  export * from './verification-cache/index';
45
50
  export * from './verify/index';
46
51
  export * as versioning from './versioning/index';
52
+ export type { ReleaseAuthoringDraft, ReleaseAuthoringResult, ReleaseCapsuleReadIssue, SaveReleaseDraftOptions, SaveReleaseDraftResult, } from './versioning/release-service.types';
47
53
  export type { SpecVersionAnalysis } from './versioning/types';
48
54
  export * as vibe from './vibe/index';
49
55
  export * from './view/index';
@@ -6,6 +6,7 @@
6
6
  * - Unresolved references (broken event/op/presentation refs)
7
7
  * - Feature coverage metrics
8
8
  */
9
+ import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec';
9
10
  import { type AnalyzedSpecType, type FeatureScanResult, type RefInfo } from '@contractspec/module.workspace';
10
11
  import type { FsAdapter } from '../ports/fs';
11
12
  import type { LoggerAdapter } from '../ports/logger';
@@ -34,6 +35,7 @@ export interface IntegrityAnalysisOptions {
34
35
  * Filter by spec type.
35
36
  */
36
37
  specType?: AnalyzedSpecType;
38
+ config?: ResolvedContractsrcConfig;
37
39
  /**
38
40
  * Require tests for specific spec types.
39
41
  */
@@ -0,0 +1,25 @@
1
+ import type { FsAdapter } from '../ports/fs';
2
+ export interface LoadedAuthoredModule {
3
+ modulePath: string;
4
+ exports: Record<string, unknown>;
5
+ }
6
+ export interface LoadAuthoredModuleValueOptions<T> {
7
+ description: string;
8
+ isValue: (value: unknown) => value is T;
9
+ instanceKeys?: string[];
10
+ factoryKeys?: string[];
11
+ }
12
+ export declare function loadAuthoredModule(modulePath: string, options?: {
13
+ runtime?: 'bun' | 'node';
14
+ }): Promise<LoadedAuthoredModule>;
15
+ export declare function loadAuthoredModuleIfExists(modulePath: string, fs: FsAdapter): Promise<LoadedAuthoredModule | null>;
16
+ export declare function loadAuthoredModuleExports(modulePath: string, options?: {
17
+ runtime?: 'bun' | 'node';
18
+ }): Promise<Record<string, unknown>>;
19
+ export declare function loadAuthoredModuleValue<T>(modulePath: string, options: LoadAuthoredModuleValueOptions<T>): Promise<T>;
20
+ export declare function formatModuleLoadError(modulePath: string, error: unknown): string;
21
+ export declare function resolveAuthoredModuleValue<T>(exports: Record<string, unknown>, modulePath: string, options: LoadAuthoredModuleValueOptions<T>): Promise<T>;
22
+ export declare const __moduleLoaderInternals: {
23
+ formatModuleLoadError: typeof formatModuleLoadError;
24
+ resolveAuthoredModuleValue: typeof resolveAuthoredModuleValue;
25
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { OnboardingTrackDefinition } from './types';
2
+ export declare const ONBOARDING_TRACKS: readonly OnboardingTrackDefinition[];
3
+ export declare function listOnboardingTracks(): readonly OnboardingTrackDefinition[];
4
+ export declare function getOnboardingTrack(trackId: string): OnboardingTrackDefinition | undefined;
@@ -0,0 +1,4 @@
1
+ export * from './catalog';
2
+ export * from './render';
3
+ export * from './service';
4
+ export * from './types';
@@ -0,0 +1,11 @@
1
+ import type { ConnectSurface } from '../connect/types';
2
+ import type { BuildOnboardingPlanInput, OnboardingBuilderMode, OnboardingPlan, OnboardingTrackDefinition, OnboardingTrackRecommendation } from './types';
3
+ export declare function createOnboardingJourneyPlan(primaryTrack: OnboardingTrackDefinition, tracks: readonly OnboardingTrackDefinition[], workspaceRoot: string, packageRoot: string): Promise<{
4
+ journeyContext: import("@contractspec/lib.surface-runtime/spec").BundleContext;
5
+ journeyPlan: import("@contractspec/lib.surface-runtime/runtime/resolve-bundle").ResolvedSurfacePlan;
6
+ }>;
7
+ export declare function resolveRequestedTracks(selectedTracks: BuildOnboardingPlanInput['selectedTracks']): OnboardingTrackDefinition[];
8
+ export declare function resolveBuilderMode(config: OnboardingPlan['config']): OnboardingBuilderMode;
9
+ export declare function buildBuilderNextSteps(builderMode: OnboardingBuilderMode): string[];
10
+ export declare function resolveSelectedExample(primaryTrack: OnboardingTrackDefinition, forcedExampleKey: string | undefined): import("./types").OnboardingExampleRef | undefined;
11
+ export declare function enrichConnectSurfaces(current: readonly ConnectSurface[], recommendations: readonly OnboardingTrackRecommendation[]): ConnectSurface[];
@@ -0,0 +1,5 @@
1
+ import type { OnboardingPlan } from './types';
2
+ export declare function renderOnboardingGuides(plan: Omit<OnboardingPlan, 'guides'>): {
3
+ agentGuide: string;
4
+ humanGuide: string;
5
+ };
@@ -0,0 +1,5 @@
1
+ import type { WorkspaceAdapters } from '../../ports/logger';
2
+ import { type AdoptionResolverRuntime } from '../adoption';
3
+ import type { BuildOnboardingPlanInput, OnboardingConnectArtifacts, OnboardingPlan } from './types';
4
+ export declare function buildOnboardingPlan(runtime: AdoptionResolverRuntime, input?: BuildOnboardingPlanInput): Promise<OnboardingPlan>;
5
+ export declare function createOnboardingConnectArtifacts(adapters: Pick<WorkspaceAdapters, 'fs' | 'git'>, plan: OnboardingPlan): Promise<OnboardingConnectArtifacts | undefined>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ import type { ResolvedContractsrcConfig } from '@contractspec/lib.contracts-spec/workspace-config';
2
+ import type { ResolvedSurfacePlan } from '@contractspec/lib.surface-runtime/runtime/resolve-bundle';
3
+ import type { BundleContext } from '@contractspec/lib.surface-runtime/spec/types';
4
+ import type { AdoptionFamily, AdoptionResolution } from '../adoption/types';
5
+ import type { ConnectContextPack, ConnectPlanPacket, ConnectSurface } from '../connect/types';
6
+ export type OnboardingTrackId = 'contracts' | 'ui-design' | 'knowledge' | 'ai-agents' | 'learning-journey';
7
+ export type OnboardingBuilderMode = 'none' | 'managed' | 'local' | 'hybrid';
8
+ export interface OnboardingExampleRef {
9
+ key: string;
10
+ packageRef: string;
11
+ title: string;
12
+ summary: string;
13
+ }
14
+ export interface OnboardingTrackDefinition {
15
+ id: OnboardingTrackId;
16
+ title: string;
17
+ summary: string;
18
+ description: string;
19
+ reuseFamily: AdoptionFamily;
20
+ adoptionQuery: string;
21
+ adoptionPlatform?: string;
22
+ primaryDocsRoute: string;
23
+ secondaryDocsRoutes: string[];
24
+ packages: string[];
25
+ recommendedCommands: string[];
26
+ starterExample: OnboardingExampleRef;
27
+ advancedExample?: OnboardingExampleRef;
28
+ connectSurfaces: ConnectSurface[];
29
+ }
30
+ export interface OnboardingTrackRecommendation {
31
+ track: OnboardingTrackDefinition;
32
+ selected: boolean;
33
+ score: number;
34
+ reason: string;
35
+ resolution: AdoptionResolution;
36
+ }
37
+ export interface OnboardingGuideRenderResult {
38
+ agentGuide: string;
39
+ humanGuide: string;
40
+ }
41
+ export interface BuildOnboardingPlanInput {
42
+ cwd?: string;
43
+ workspaceRoot?: string;
44
+ packageRoot?: string;
45
+ config?: ResolvedContractsrcConfig;
46
+ selectedTracks?: OnboardingTrackId[];
47
+ forcedExampleKey?: string;
48
+ agentGuidePath?: string;
49
+ humanGuidePath?: string;
50
+ }
51
+ export interface OnboardingPlan {
52
+ cwd: string;
53
+ workspaceRoot: string;
54
+ packageRoot: string;
55
+ config: ResolvedContractsrcConfig;
56
+ builderMode: OnboardingBuilderMode;
57
+ primaryTrack: OnboardingTrackDefinition;
58
+ recommendations: OnboardingTrackRecommendation[];
59
+ journeyContext: BundleContext;
60
+ journeyPlan: ResolvedSurfacePlan;
61
+ guides: OnboardingGuideRenderResult;
62
+ agentGuidePath: string;
63
+ humanGuidePath: string;
64
+ selectedExample: OnboardingExampleRef;
65
+ nextCommands: string[];
66
+ builderNextSteps: string[];
67
+ }
68
+ export interface OnboardingConnectArtifacts {
69
+ contextPack: ConnectContextPack;
70
+ planPacket: ConnectPlanPacket;
71
+ }
@@ -0,0 +1,22 @@
1
+ import type { AuthoringTargetId } from '@contractspec/module.workspace';
2
+ import type { FsAdapter } from '../ports/fs';
3
+ export interface PackageScaffoldOptions {
4
+ target: Extract<AuthoringTargetId, 'module-bundle' | 'builder-spec' | 'provider-spec'>;
5
+ specPath: string;
6
+ specCode: string;
7
+ overwrite?: boolean;
8
+ }
9
+ export interface PackageScaffoldResult {
10
+ packageRoot: string;
11
+ files: string[];
12
+ created: string[];
13
+ skipped: string[];
14
+ }
15
+ export declare function ensurePackageScaffold(fs: FsAdapter, options: PackageScaffoldOptions): Promise<PackageScaffoldResult>;
16
+ export declare function createPackageTargetSpecSource(input: {
17
+ target: PackageScaffoldOptions['target'];
18
+ key: string;
19
+ title: string;
20
+ description: string;
21
+ exportName: string;
22
+ }): string;
@@ -13,7 +13,7 @@ export declare function generateContractsrcConfig(options: SetupOptions): object
13
13
  /**
14
14
  * Generate .vscode/settings.json ContractSpec settings.
15
15
  */
16
- export declare function generateVscodeSettings(): object;
16
+ export declare function generateVscodeSettings(options: SetupOptions): object;
17
17
  /**
18
18
  * Generate .cursor/mcp.json content.
19
19
  */
@@ -33,6 +33,10 @@ export declare function generateCursorRules(options: SetupOptions): string;
33
33
  * Generate AGENTS.md content.
34
34
  */
35
35
  export declare function generateAgentsGuide(options: SetupOptions): string;
36
+ /**
37
+ * Generate USAGE.md content.
38
+ */
39
+ export declare function generateUsageGuide(options: SetupOptions): string;
36
40
  /**
37
41
  * Get the file path for Claude Desktop config based on platform.
38
42
  */
@@ -0,0 +1,10 @@
1
+ import type { FsAdapter } from '../../ports/fs';
2
+ import type { SetupFileResult, SetupGitignoreBehavior, SetupPromptCallbacks } from './types';
3
+ export declare function setupGitignore(fs: FsAdapter, input: {
4
+ interactive: boolean;
5
+ patterns: string[];
6
+ root: string;
7
+ behavior?: SetupGitignoreBehavior;
8
+ prompts?: Pick<SetupPromptCallbacks, 'confirm'>;
9
+ }): Promise<SetupFileResult>;
10
+ export declare function mergeGitignoreContent(existingContent: string, patterns: string[]): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -5,5 +5,10 @@
5
5
  */
6
6
  export * from './config-generators';
7
7
  export * from './file-merger';
8
+ export * from './gitignore';
9
+ export * from './managed-markdown';
10
+ export * from './presets';
8
11
  export * from './setup-service';
12
+ export * from './targets/agents-md';
13
+ export * from './targets/usage-md';
9
14
  export * from './types';
@@ -0,0 +1,8 @@
1
+ export interface ManagedMarkdownSectionConfig {
2
+ startMarker: string;
3
+ endMarker: string;
4
+ note: string;
5
+ }
6
+ export declare function mergeManagedMarkdown(existingContent: string, managedContent: string, config: ManagedMarkdownSectionConfig, legacyContent?: string): string;
7
+ export declare function renderManagedMarkdownBlock(managedContent: string, config: ManagedMarkdownSectionConfig): string;
8
+ export declare function normalizeMarkdownContent(content: string): string;