@contractspec/module.workspace 1.62.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/code-generation.d.ts +0 -1
- package/dist/ai/index.d.ts +0 -1
- package/dist/ai/prompts/code-generation.d.ts +0 -1
- package/dist/ai/prompts/index.d.ts +0 -1
- package/dist/ai/prompts/spec-creation.d.ts +1 -2
- package/dist/ai/spec-creation.d.ts +1 -2
- package/dist/analysis/deps/graph.d.ts +0 -1
- package/dist/analysis/deps/index.d.ts +0 -1
- package/dist/analysis/deps/parse-imports.d.ts +0 -1
- package/dist/analysis/diff/deep-diff.d.ts +0 -1
- package/dist/analysis/diff/deep-diff.test.d.ts +0 -1
- package/dist/analysis/diff/index.d.ts +0 -1
- package/dist/analysis/diff/semantic.d.ts +0 -1
- package/dist/analysis/example-scan.d.ts +0 -1
- package/dist/analysis/example-scan.test.d.ts +0 -1
- package/dist/analysis/feature-extractor.d.ts +0 -1
- package/dist/analysis/feature-scan.d.ts +0 -1
- package/dist/analysis/feature-scan.test.d.ts +0 -1
- package/dist/analysis/grouping.d.ts +0 -1
- package/dist/analysis/impact/classifier.d.ts +0 -1
- package/dist/analysis/impact/classifier.test.d.ts +0 -1
- package/dist/analysis/impact/index.d.ts +0 -1
- package/dist/analysis/impact/rules.d.ts +0 -1
- package/dist/analysis/impact/types.d.ts +0 -1
- package/dist/analysis/index.d.ts +0 -1
- package/dist/analysis/snapshot/index.d.ts +0 -1
- package/dist/analysis/snapshot/normalizer.d.ts +0 -1
- package/dist/analysis/snapshot/snapshot.d.ts +0 -1
- package/dist/analysis/snapshot/snapshot.test.d.ts +0 -1
- package/dist/analysis/snapshot/types.d.ts +1 -2
- package/dist/analysis/spec-parser.d.ts +0 -1
- package/dist/analysis/spec-parsing-utils.d.ts +0 -1
- package/dist/analysis/spec-scan.d.ts +0 -1
- package/dist/analysis/spec-scan.test.d.ts +0 -1
- package/dist/analysis/utils/matchers.d.ts +0 -1
- package/dist/analysis/utils/variables.d.ts +0 -1
- package/dist/analysis/validate/index.d.ts +0 -1
- package/dist/analysis/validate/spec-structure.d.ts +0 -1
- package/dist/analysis/validate/spec-structure.test.d.ts +0 -1
- package/dist/formatter.d.ts +1 -2
- package/dist/formatters/index.d.ts +0 -1
- package/dist/formatters/spec-markdown.d.ts +0 -1
- package/dist/formatters/spec-markdown.test.d.ts +0 -1
- package/dist/formatters/spec-to-docblock.d.ts +1 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +20 -19
- package/dist/node/index.js +20 -19
- package/dist/templates/app-config.d.ts +0 -1
- package/dist/templates/app-config.test.d.ts +0 -1
- package/dist/templates/data-view.d.ts +0 -1
- package/dist/templates/data-view.test.d.ts +0 -1
- package/dist/templates/event.d.ts +0 -1
- package/dist/templates/event.test.d.ts +0 -1
- package/dist/templates/experiment.d.ts +0 -1
- package/dist/templates/experiment.test.d.ts +0 -1
- package/dist/templates/handler.d.ts +0 -1
- package/dist/templates/handler.test.d.ts +0 -1
- package/dist/templates/index.d.ts +0 -1
- package/dist/templates/integration-utils.d.ts +0 -1
- package/dist/templates/integration-utils.test.d.ts +0 -1
- package/dist/templates/integration.d.ts +0 -1
- package/dist/templates/integration.test.d.ts +0 -1
- package/dist/templates/knowledge.d.ts +0 -1
- package/dist/templates/knowledge.test.d.ts +0 -1
- package/dist/templates/migration.d.ts +0 -1
- package/dist/templates/migration.test.d.ts +0 -1
- package/dist/templates/operation.d.ts +0 -1
- package/dist/templates/operation.test.d.ts +0 -1
- package/dist/templates/presentation.d.ts +0 -1
- package/dist/templates/presentation.test.d.ts +0 -1
- package/dist/templates/telemetry.d.ts +0 -1
- package/dist/templates/telemetry.test.d.ts +0 -1
- package/dist/templates/utils.d.ts +0 -1
- package/dist/templates/utils.test.d.ts +0 -1
- package/dist/templates/workflow-runner.d.ts +0 -1
- package/dist/templates/workflow-runner.test.d.ts +0 -1
- package/dist/templates/workflow.d.ts +0 -1
- package/dist/templates/workflow.test.d.ts +0 -1
- package/dist/types/analysis-types.d.ts +3 -4
- package/dist/types/generation-types.d.ts +1 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/llm-types.d.ts +0 -1
- package/dist/types/rulesync-types.d.ts +1 -2
- package/dist/types/spec-types.d.ts +1 -2
- package/package.json +7 -6
- package/dist/ai/code-generation.d.ts.map +0 -1
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/prompts/code-generation.d.ts.map +0 -1
- package/dist/ai/prompts/index.d.ts.map +0 -1
- package/dist/ai/prompts/spec-creation.d.ts.map +0 -1
- package/dist/ai/spec-creation.d.ts.map +0 -1
- package/dist/analysis/deps/graph.d.ts.map +0 -1
- package/dist/analysis/deps/index.d.ts.map +0 -1
- package/dist/analysis/deps/parse-imports.d.ts.map +0 -1
- package/dist/analysis/diff/deep-diff.d.ts.map +0 -1
- package/dist/analysis/diff/deep-diff.test.d.ts.map +0 -1
- package/dist/analysis/diff/index.d.ts.map +0 -1
- package/dist/analysis/diff/semantic.d.ts.map +0 -1
- package/dist/analysis/example-scan.d.ts.map +0 -1
- package/dist/analysis/example-scan.test.d.ts.map +0 -1
- package/dist/analysis/feature-extractor.d.ts.map +0 -1
- package/dist/analysis/feature-scan.d.ts.map +0 -1
- package/dist/analysis/feature-scan.test.d.ts.map +0 -1
- package/dist/analysis/grouping.d.ts.map +0 -1
- package/dist/analysis/impact/classifier.d.ts.map +0 -1
- package/dist/analysis/impact/classifier.test.d.ts.map +0 -1
- package/dist/analysis/impact/index.d.ts.map +0 -1
- package/dist/analysis/impact/rules.d.ts.map +0 -1
- package/dist/analysis/impact/types.d.ts.map +0 -1
- package/dist/analysis/index.d.ts.map +0 -1
- package/dist/analysis/snapshot/index.d.ts.map +0 -1
- package/dist/analysis/snapshot/normalizer.d.ts.map +0 -1
- package/dist/analysis/snapshot/snapshot.d.ts.map +0 -1
- package/dist/analysis/snapshot/snapshot.test.d.ts.map +0 -1
- package/dist/analysis/snapshot/types.d.ts.map +0 -1
- package/dist/analysis/spec-parser.d.ts.map +0 -1
- package/dist/analysis/spec-parsing-utils.d.ts.map +0 -1
- package/dist/analysis/spec-scan.d.ts.map +0 -1
- package/dist/analysis/spec-scan.test.d.ts.map +0 -1
- package/dist/analysis/utils/matchers.d.ts.map +0 -1
- package/dist/analysis/utils/variables.d.ts.map +0 -1
- package/dist/analysis/validate/index.d.ts.map +0 -1
- package/dist/analysis/validate/spec-structure.d.ts.map +0 -1
- package/dist/analysis/validate/spec-structure.test.d.ts.map +0 -1
- package/dist/formatter.d.ts.map +0 -1
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/spec-markdown.d.ts.map +0 -1
- package/dist/formatters/spec-markdown.test.d.ts.map +0 -1
- package/dist/formatters/spec-to-docblock.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/templates/app-config.d.ts.map +0 -1
- package/dist/templates/app-config.test.d.ts.map +0 -1
- package/dist/templates/data-view.d.ts.map +0 -1
- package/dist/templates/data-view.test.d.ts.map +0 -1
- package/dist/templates/event.d.ts.map +0 -1
- package/dist/templates/event.test.d.ts.map +0 -1
- package/dist/templates/experiment.d.ts.map +0 -1
- package/dist/templates/experiment.test.d.ts.map +0 -1
- package/dist/templates/handler.d.ts.map +0 -1
- package/dist/templates/handler.test.d.ts.map +0 -1
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/integration-utils.d.ts.map +0 -1
- package/dist/templates/integration-utils.test.d.ts.map +0 -1
- package/dist/templates/integration.d.ts.map +0 -1
- package/dist/templates/integration.test.d.ts.map +0 -1
- package/dist/templates/knowledge.d.ts.map +0 -1
- package/dist/templates/knowledge.test.d.ts.map +0 -1
- package/dist/templates/migration.d.ts.map +0 -1
- package/dist/templates/migration.test.d.ts.map +0 -1
- package/dist/templates/operation.d.ts.map +0 -1
- package/dist/templates/operation.test.d.ts.map +0 -1
- package/dist/templates/presentation.d.ts.map +0 -1
- package/dist/templates/presentation.test.d.ts.map +0 -1
- package/dist/templates/telemetry.d.ts.map +0 -1
- package/dist/templates/telemetry.test.d.ts.map +0 -1
- package/dist/templates/utils.d.ts.map +0 -1
- package/dist/templates/utils.test.d.ts.map +0 -1
- package/dist/templates/workflow-runner.d.ts.map +0 -1
- package/dist/templates/workflow-runner.test.d.ts.map +0 -1
- package/dist/templates/workflow.d.ts.map +0 -1
- package/dist/templates/workflow.test.d.ts.map +0 -1
- package/dist/types/analysis-types.d.ts.map +0 -1
- package/dist/types/generation-types.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/llm-types.d.ts.map +0 -1
- package/dist/types/rulesync-types.d.ts.map +0 -1
- package/dist/types/spec-types.d.ts.map +0 -1
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OpKind } from '@contractspec/lib.contracts';
|
|
1
|
+
import type { OpKind } from '@contractspec/lib.contracts-spec';
|
|
2
2
|
import type { PresentationKind } from '../../types/spec-types';
|
|
3
3
|
/**
|
|
4
4
|
* Build prompt for creating operation spec from description
|
|
@@ -20,4 +20,3 @@ export declare function getSystemPrompt(): string;
|
|
|
20
20
|
* Create example-based prompt for better results
|
|
21
21
|
*/
|
|
22
22
|
export declare function addExampleContext(basePrompt: string, examples: string[]): string;
|
|
23
|
-
//# sourceMappingURL=spec-creation.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* AI prompts for spec creation.
|
|
3
3
|
* Extracted from cli-contractspec/src/ai/prompts/spec-creation.ts
|
|
4
4
|
*/
|
|
5
|
-
import type { OpKind } from '@contractspec/lib.contracts';
|
|
5
|
+
import type { OpKind } from '@contractspec/lib.contracts-spec';
|
|
6
6
|
import type { PresentationKind } from '../types/spec-types';
|
|
7
7
|
/**
|
|
8
8
|
* Build prompt for creating operation spec from description.
|
|
@@ -24,4 +24,3 @@ export declare function getSystemPrompt(): string;
|
|
|
24
24
|
* Create example-based prompt for better results.
|
|
25
25
|
*/
|
|
26
26
|
export declare function addExampleContext(basePrompt: string, examples: string[]): string;
|
|
27
|
-
//# sourceMappingURL=spec-creation.d.ts.map
|
|
@@ -31,4 +31,3 @@ export declare function computeFieldDiff(base: FieldSnapshot, head: FieldSnapsho
|
|
|
31
31
|
* Classify a diff as breaking based on context.
|
|
32
32
|
*/
|
|
33
33
|
export declare function isBreakingChange(diff: SemanticDiffItem, context: 'input' | 'output'): boolean;
|
|
34
|
-
//# sourceMappingURL=deep-diff.d.ts.map
|
|
@@ -7,4 +7,3 @@ import type { SemanticDiffItem, SemanticDiffOptions } from '../../types/analysis
|
|
|
7
7
|
* Compute semantic differences between two spec sources.
|
|
8
8
|
*/
|
|
9
9
|
export declare function computeSemanticDiff(aCode: string, aPath: string, bCode: string, bPath: string, options?: SemanticDiffOptions): SemanticDiffItem[];
|
|
10
|
-
//# sourceMappingURL=semantic.d.ts.map
|
|
@@ -75,4 +75,3 @@ export declare function getUniqueSpecDomains(specs: SpecScanResult[]): string[];
|
|
|
75
75
|
* Filter features by criteria.
|
|
76
76
|
*/
|
|
77
77
|
export declare function filterFeatures(features: FeatureScanResult[], filter: SpecFilter): FeatureScanResult[];
|
|
78
|
-
//# sourceMappingURL=grouping.d.ts.map
|
|
@@ -16,4 +16,3 @@ import type { ClassifyOptions, ImpactResult } from './types';
|
|
|
16
16
|
* @returns Classified impact result
|
|
17
17
|
*/
|
|
18
18
|
export declare function classifyImpact(baseSpecs: SpecSnapshot[], headSpecs: SpecSnapshot[], diffs: SemanticDiffItem[], options?: ClassifyOptions): ImpactResult;
|
|
19
|
-
//# sourceMappingURL=classifier.d.ts.map
|
package/dist/analysis/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* These types define the normalized, deterministic representation
|
|
5
5
|
* of contracts for comparison and impact detection.
|
|
6
6
|
*/
|
|
7
|
-
import type { EventRef } from '@contractspec/lib.contracts';
|
|
7
|
+
import type { EventRef } from '@contractspec/lib.contracts-spec';
|
|
8
8
|
/** Field type in a schema */
|
|
9
9
|
export type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'enum' | 'union' | 'literal' | 'date' | 'unknown';
|
|
10
10
|
/** Schema field definition */
|
|
@@ -72,4 +72,3 @@ export interface SnapshotOptions {
|
|
|
72
72
|
/** Include only specific spec types */
|
|
73
73
|
types?: ('operation' | 'event')[];
|
|
74
74
|
}
|
|
75
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -21,4 +21,3 @@ export declare function scanSpecSource(code: string, filePath: string): SpecScan
|
|
|
21
21
|
* Infer spec type from file path convention.
|
|
22
22
|
*/
|
|
23
23
|
export declare function inferSpecTypeFromFilePath(filePath: string): SpecScanResult['specType'] | 'feature' | 'unknown';
|
|
24
|
-
//# sourceMappingURL=spec-scan.d.ts.map
|
|
@@ -36,4 +36,3 @@ export declare function findMatchingDelimiter(code: string, startIndex: number,
|
|
|
36
36
|
* Returns the index of the closing brace or -1 if not found.
|
|
37
37
|
*/
|
|
38
38
|
export declare function findMatchingBrace(code: string, startIndex: number): number;
|
|
39
|
-
//# sourceMappingURL=matchers.d.ts.map
|
|
@@ -12,4 +12,3 @@ export declare function extractArrayConstants(code: string): Map<string, string>
|
|
|
12
12
|
* Example: owners: [...OWNERS] -> owners: ['alice', 'bob']
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveVariablesInBlock(block: string, variables: Map<string, string>): string;
|
|
15
|
-
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -26,4 +26,3 @@ export interface RulesConfig {
|
|
|
26
26
|
* Validate spec structure based on source code and filename.
|
|
27
27
|
*/
|
|
28
28
|
export declare function validateSpecStructure(specFile: Pick<SpecScanResult, 'filePath' | 'sourceBlock' | 'specType'>, rulesConfig?: RulesConfig): ValidationResult;
|
|
29
|
-
//# sourceMappingURL=spec-structure.d.ts.map
|
package/dist/formatter.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Detects and runs code formatters on generated files.
|
|
5
5
|
*/
|
|
6
|
-
import type { FormatterConfig, FormatterType } from '@contractspec/lib.contracts';
|
|
6
|
+
import type { FormatterConfig, FormatterType } from '@contractspec/lib.contracts-spec';
|
|
7
7
|
export interface FormatterOptions {
|
|
8
8
|
/** Override formatter type from config */
|
|
9
9
|
type?: FormatterType;
|
|
@@ -39,4 +39,3 @@ export declare function formatFiles(files: string | string[], config?: Formatter
|
|
|
39
39
|
* Format files in batch, grouping by directory for efficiency.
|
|
40
40
|
*/
|
|
41
41
|
export declare function formatFilesBatch(files: string[], config?: FormatterConfig, options?: FormatterOptions, logger?: FormatLogger): Promise<FormatResult>;
|
|
42
|
-
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -29,4 +29,3 @@ export declare function generateSpecsSummaryHeader(specs: ParsedSpec[], format:
|
|
|
29
29
|
* Combine multiple spec markdowns into a single document.
|
|
30
30
|
*/
|
|
31
31
|
export declare function combineSpecMarkdowns(specs: ParsedSpec[], format: LLMExportFormat): string;
|
|
32
|
-
//# sourceMappingURL=spec-markdown.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ParsedSpec } from '../types/llm-types';
|
|
2
|
-
import type { DocBlock } from '@contractspec/lib.contracts/docs';
|
|
2
|
+
import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
|
|
3
3
|
/**
|
|
4
4
|
* Convert a parsed spec to a DocBlock for documentation generation.
|
|
5
5
|
*/
|
|
6
6
|
export declare function convertSpecToDocBlock(spec: ParsedSpec, options?: {
|
|
7
7
|
rootPath?: string;
|
|
8
8
|
}): DocBlock;
|
|
9
|
-
//# sourceMappingURL=spec-to-docblock.d.ts.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1628,7 +1628,7 @@ function validateMigrationSpec(sourceFile, errors, warnings, rulesConfig) {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
function validateCommonFields(sourceFile, fileName, errors, warnings, rulesConfig) {
|
|
1630
1630
|
const code = sourceFile.getFullText();
|
|
1631
|
-
const isInternalLib = fileName.includes("/libs/contracts/") || fileName.includes("/libs/contracts-transformers/") || fileName.includes("/libs/schema/");
|
|
1631
|
+
const isInternalLib = fileName.includes("/libs/contracts/") || fileName.includes("/libs/contracts-spec/") || fileName.includes("/libs/contracts-integrations/") || fileName.includes("/libs/contracts-runtime-") || fileName.includes("/libs/contracts-transformers/") || fileName.includes("/libs/schema/");
|
|
1632
1632
|
if (code.includes("SchemaModel") && !isInternalLib) {
|
|
1633
1633
|
const imports = sourceFile.getImportDeclarations();
|
|
1634
1634
|
const hasSchemaImport = imports.some((i) => i.getModuleSpecifierValue().includes("@contractspec/lib.schema"));
|
|
@@ -1639,9 +1639,9 @@ function validateCommonFields(sourceFile, fileName, errors, warnings, rulesConfi
|
|
|
1639
1639
|
const usesSpecTypes = code.includes("OperationSpec") || code.includes("PresentationSpec") || code.includes("EventSpec") || code.includes("FeatureSpec") || code.includes("WorkflowSpec") || code.includes("DataViewSpec") || code.includes("MigrationSpec") || code.includes("TelemetrySpec") || code.includes("ExperimentSpec") || code.includes("AppBlueprintSpec") || code.includes("defineCommand") || code.includes("defineQuery") || code.includes("defineEvent") || code.includes("definePresentation") || code.includes("defineWorkflow") || code.includes("defineDataView") || code.includes("defineAppConfig") || code.includes("defineFeature") || code.includes("defineExperiment") || code.includes("defineTelemetry") || code.includes("defineMigration");
|
|
1640
1640
|
if (usesSpecTypes && !isInternalLib) {
|
|
1641
1641
|
const imports = sourceFile.getImportDeclarations();
|
|
1642
|
-
const hasContractsImport = imports.some((i) => i.getModuleSpecifierValue().includes("@contractspec/lib.contracts"));
|
|
1642
|
+
const hasContractsImport = imports.some((i) => i.getModuleSpecifierValue().includes("@contractspec/lib.contracts-spec"));
|
|
1643
1643
|
if (!hasContractsImport) {
|
|
1644
|
-
errors.push("Missing import from @contractspec/lib.contracts");
|
|
1644
|
+
errors.push("Missing import from @contractspec/lib.contracts-spec");
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
1647
|
const specObject = findMainExportedObject(sourceFile);
|
|
@@ -2352,7 +2352,7 @@ function generateOperationSpec(data) {
|
|
|
2352
2352
|
const specVarName = toPascalCase(name.split(".").pop() ?? "Unknown") + "Spec";
|
|
2353
2353
|
const inputSchemaName = specVarName.replace("Spec", "Input");
|
|
2354
2354
|
const outputSchemaName = specVarName.replace("Spec", "Output");
|
|
2355
|
-
return `import { define${capitalize(kind)} } from '@contractspec/lib.contracts';
|
|
2355
|
+
return `import { define${capitalize(kind)} } from '@contractspec/lib.contracts-spec';
|
|
2356
2356
|
import { ScalarTypeEnum, SchemaModel } from '@contractspec/lib.schema';
|
|
2357
2357
|
|
|
2358
2358
|
// TODO: Define input schema
|
|
@@ -2446,7 +2446,7 @@ function generateEventSpec(data) {
|
|
|
2446
2446
|
const { name, version, description, stability, owners, tags, piiFields } = data;
|
|
2447
2447
|
const eventVarName = toPascalCase(name.replace(/\./g, "_")) + "V" + version;
|
|
2448
2448
|
const payloadSchemaName = eventVarName + "Payload";
|
|
2449
|
-
return `import { defineEvent } from '@contractspec/lib.contracts';
|
|
2449
|
+
return `import { defineEvent } from '@contractspec/lib.contracts-spec';
|
|
2450
2450
|
import { ScalarTypeEnum, SchemaModel } from '@contractspec/lib.schema';
|
|
2451
2451
|
|
|
2452
2452
|
// TODO: Define event payload schema
|
|
@@ -2529,7 +2529,7 @@ TODO: Add markdown content here
|
|
|
2529
2529
|
},`;
|
|
2530
2530
|
break;
|
|
2531
2531
|
}
|
|
2532
|
-
return `import type { PresentationSpec } from '@contractspec/lib.contracts/presentations';
|
|
2532
|
+
return `import type { PresentationSpec } from '@contractspec/lib.contracts-spec/presentations';
|
|
2533
2533
|
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
2534
2534
|
|
|
2535
2535
|
export const ${varName}: PresentationSpec = {
|
|
@@ -2562,7 +2562,7 @@ function generateWorkflowSpec(data) {
|
|
|
2562
2562
|
${transition.condition ? ` condition: '${escapeString(transition.condition)}',` : ""}
|
|
2563
2563
|
}`).join(`,
|
|
2564
2564
|
`);
|
|
2565
|
-
return `import type { WorkflowSpec } from '@contractspec/lib.contracts/workflow';
|
|
2565
|
+
return `import type { WorkflowSpec } from '@contractspec/lib.contracts-spec/workflow';
|
|
2566
2566
|
|
|
2567
2567
|
/**
|
|
2568
2568
|
* Workflow generated via contractspec CLI.
|
|
@@ -2633,7 +2633,7 @@ function generateWorkflowRunnerTemplate({
|
|
|
2633
2633
|
InMemoryStateStore,
|
|
2634
2634
|
WorkflowRegistry,
|
|
2635
2635
|
WorkflowRunner,
|
|
2636
|
-
} from '@contractspec/lib.contracts/workflow';
|
|
2636
|
+
} from '@contractspec/lib.contracts-spec/workflow';
|
|
2637
2637
|
import { ${exportName} } from '${specImportPath}';
|
|
2638
2638
|
|
|
2639
2639
|
/**
|
|
@@ -2686,7 +2686,7 @@ function generateDataViewSpec(data) {
|
|
|
2686
2686
|
`);
|
|
2687
2687
|
const secondaryFields = data.secondaryFields?.length ? `secondaryFields: [${data.secondaryFields.map((key) => `'${escapeString(key)}'`).join(", ")}],` : "";
|
|
2688
2688
|
const itemOperation = data.itemOperation ? `item: { name: '${escapeString(data.itemOperation.name)}', version: ${data.itemOperation.version} },` : "";
|
|
2689
|
-
return `import type { DataViewSpec } from '@contractspec/lib.contracts/data-views';
|
|
2689
|
+
return `import type { DataViewSpec } from '@contractspec/lib.contracts-spec/data-views';
|
|
2690
2690
|
|
|
2691
2691
|
export const ${viewVarName}: DataViewSpec = {
|
|
2692
2692
|
meta: {
|
|
@@ -2790,7 +2790,7 @@ ${anomalyRules}
|
|
|
2790
2790
|
}`;
|
|
2791
2791
|
}).join(`,
|
|
2792
2792
|
`);
|
|
2793
|
-
return `import type { TelemetrySpec } from '@contractspec/lib.contracts/telemetry';
|
|
2793
|
+
return `import type { TelemetrySpec } from '@contractspec/lib.contracts-spec/telemetry';
|
|
2794
2794
|
|
|
2795
2795
|
export const ${specVar}: TelemetrySpec = {
|
|
2796
2796
|
meta: {
|
|
@@ -2858,7 +2858,7 @@ ${data.successMetrics.map((metric) => ` {
|
|
|
2858
2858
|
}`).join(`,
|
|
2859
2859
|
`)}
|
|
2860
2860
|
],` : "";
|
|
2861
|
-
return `import type { ExperimentSpec } from '@contractspec/lib.contracts/experiments';
|
|
2861
|
+
return `import type { ExperimentSpec } from '@contractspec/lib.contracts-spec/experiments';
|
|
2862
2862
|
|
|
2863
2863
|
export const ${specVar}: ExperimentSpec = {
|
|
2864
2864
|
meta: {
|
|
@@ -2932,7 +2932,7 @@ function generateAppBlueprintSpec(data) {
|
|
|
2932
2932
|
const routesSection = buildRoutesSection(data);
|
|
2933
2933
|
const notesSection = data.notes ? ` notes: '${escapeString4(data.notes)}',
|
|
2934
2934
|
` : "";
|
|
2935
|
-
return `import type { AppBlueprintSpec } from '@contractspec/lib.contracts/app-config';
|
|
2935
|
+
return `import type { AppBlueprintSpec } from '@contractspec/lib.contracts-spec/app-config';
|
|
2936
2936
|
|
|
2937
2937
|
export const ${exportName}: AppBlueprintSpec = {
|
|
2938
2938
|
meta: {
|
|
@@ -3084,7 +3084,7 @@ function generateMigrationSpec(data) {
|
|
|
3084
3084
|
const specName = toPascalCase(data.name.split(".").pop() ?? "Migration");
|
|
3085
3085
|
const migrationVar = `${specName}Migration`;
|
|
3086
3086
|
const dependencies = data.dependencies.length > 0 ? `dependencies: [${data.dependencies.map((dep) => `'${escapeString(dep)}'`).join(", ")}],` : "";
|
|
3087
|
-
return `import type { MigrationSpec } from '@contractspec/lib.contracts/migrations';
|
|
3087
|
+
return `import type { MigrationSpec } from '@contractspec/lib.contracts-spec/migrations';
|
|
3088
3088
|
|
|
3089
3089
|
export const ${migrationVar}: MigrationSpec = {
|
|
3090
3090
|
meta: {
|
|
@@ -3297,8 +3297,9 @@ function generateIntegrationSpec(data) {
|
|
|
3297
3297
|
` : "";
|
|
3298
3298
|
const constraints = renderConstraints(data.rateLimitRpm, data.rateLimitRph);
|
|
3299
3299
|
const byokSetup = renderByokSetup(supportedModes, data.byokSetupInstructions, data.byokRequiredScopes);
|
|
3300
|
-
return `import { StabilityEnum
|
|
3301
|
-
import
|
|
3300
|
+
return `import { StabilityEnum } from '@contractspec/lib.contracts-spec/ownership';
|
|
3301
|
+
import { defineIntegration } from '@contractspec/lib.contracts-integrations';
|
|
3302
|
+
import type { IntegrationSpecRegistry } from '@contractspec/lib.contracts-integrations';
|
|
3302
3303
|
|
|
3303
3304
|
export const ${varName} = defineIntegration({
|
|
3304
3305
|
meta: {
|
|
@@ -3346,9 +3347,9 @@ function generateKnowledgeSpaceSpec(data) {
|
|
|
3346
3347
|
const access = renderAccess(data);
|
|
3347
3348
|
const indexing = renderIndexing(data);
|
|
3348
3349
|
const policyComment = data.policyName && !data.policyVersion ? ` // defaults to latest version` : "";
|
|
3349
|
-
return `import { StabilityEnum } from '@contractspec/lib.contracts/ownership';
|
|
3350
|
-
import type { KnowledgeSpaceSpec } from '@contractspec/lib.contracts/knowledge/spec';
|
|
3351
|
-
import type { KnowledgeSpaceRegistry } from '@contractspec/lib.contracts/knowledge/spec';
|
|
3350
|
+
return `import { StabilityEnum } from '@contractspec/lib.contracts-spec/ownership';
|
|
3351
|
+
import type { KnowledgeSpaceSpec } from '@contractspec/lib.contracts-spec/knowledge/spec';
|
|
3352
|
+
import type { KnowledgeSpaceRegistry } from '@contractspec/lib.contracts-spec/knowledge/spec';
|
|
3352
3353
|
|
|
3353
3354
|
export const ${varName}: KnowledgeSpaceSpec = {
|
|
3354
3355
|
meta: {
|
|
@@ -3427,7 +3428,7 @@ function escape4(value) {
|
|
|
3427
3428
|
function generateHandlerTemplate(specName, kind) {
|
|
3428
3429
|
const handlerName = toCamelCase(specName.split(".").pop() ?? "unknown") + "Handler";
|
|
3429
3430
|
const specVarName = toPascalCase(specName.split(".").pop() ?? "Unknown") + "Spec";
|
|
3430
|
-
return `import type { ContractHandler } from '@contractspec/lib.contracts';
|
|
3431
|
+
return `import type { ContractHandler } from '@contractspec/lib.contracts-spec';
|
|
3431
3432
|
import { ${specVarName} } from '../contracts/${toKebabCase(specName)}.contracts';
|
|
3432
3433
|
|
|
3433
3434
|
/**
|
package/dist/node/index.js
CHANGED
|
@@ -1627,7 +1627,7 @@ function validateMigrationSpec(sourceFile, errors, warnings, rulesConfig) {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
function validateCommonFields(sourceFile, fileName, errors, warnings, rulesConfig) {
|
|
1629
1629
|
const code = sourceFile.getFullText();
|
|
1630
|
-
const isInternalLib = fileName.includes("/libs/contracts/") || fileName.includes("/libs/contracts-transformers/") || fileName.includes("/libs/schema/");
|
|
1630
|
+
const isInternalLib = fileName.includes("/libs/contracts/") || fileName.includes("/libs/contracts-spec/") || fileName.includes("/libs/contracts-integrations/") || fileName.includes("/libs/contracts-runtime-") || fileName.includes("/libs/contracts-transformers/") || fileName.includes("/libs/schema/");
|
|
1631
1631
|
if (code.includes("SchemaModel") && !isInternalLib) {
|
|
1632
1632
|
const imports = sourceFile.getImportDeclarations();
|
|
1633
1633
|
const hasSchemaImport = imports.some((i) => i.getModuleSpecifierValue().includes("@contractspec/lib.schema"));
|
|
@@ -1638,9 +1638,9 @@ function validateCommonFields(sourceFile, fileName, errors, warnings, rulesConfi
|
|
|
1638
1638
|
const usesSpecTypes = code.includes("OperationSpec") || code.includes("PresentationSpec") || code.includes("EventSpec") || code.includes("FeatureSpec") || code.includes("WorkflowSpec") || code.includes("DataViewSpec") || code.includes("MigrationSpec") || code.includes("TelemetrySpec") || code.includes("ExperimentSpec") || code.includes("AppBlueprintSpec") || code.includes("defineCommand") || code.includes("defineQuery") || code.includes("defineEvent") || code.includes("definePresentation") || code.includes("defineWorkflow") || code.includes("defineDataView") || code.includes("defineAppConfig") || code.includes("defineFeature") || code.includes("defineExperiment") || code.includes("defineTelemetry") || code.includes("defineMigration");
|
|
1639
1639
|
if (usesSpecTypes && !isInternalLib) {
|
|
1640
1640
|
const imports = sourceFile.getImportDeclarations();
|
|
1641
|
-
const hasContractsImport = imports.some((i) => i.getModuleSpecifierValue().includes("@contractspec/lib.contracts"));
|
|
1641
|
+
const hasContractsImport = imports.some((i) => i.getModuleSpecifierValue().includes("@contractspec/lib.contracts-spec"));
|
|
1642
1642
|
if (!hasContractsImport) {
|
|
1643
|
-
errors.push("Missing import from @contractspec/lib.contracts");
|
|
1643
|
+
errors.push("Missing import from @contractspec/lib.contracts-spec");
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
1646
|
const specObject = findMainExportedObject(sourceFile);
|
|
@@ -2351,7 +2351,7 @@ function generateOperationSpec(data) {
|
|
|
2351
2351
|
const specVarName = toPascalCase(name.split(".").pop() ?? "Unknown") + "Spec";
|
|
2352
2352
|
const inputSchemaName = specVarName.replace("Spec", "Input");
|
|
2353
2353
|
const outputSchemaName = specVarName.replace("Spec", "Output");
|
|
2354
|
-
return `import { define${capitalize(kind)} } from '@contractspec/lib.contracts';
|
|
2354
|
+
return `import { define${capitalize(kind)} } from '@contractspec/lib.contracts-spec';
|
|
2355
2355
|
import { ScalarTypeEnum, SchemaModel } from '@contractspec/lib.schema';
|
|
2356
2356
|
|
|
2357
2357
|
// TODO: Define input schema
|
|
@@ -2445,7 +2445,7 @@ function generateEventSpec(data) {
|
|
|
2445
2445
|
const { name, version, description, stability, owners, tags, piiFields } = data;
|
|
2446
2446
|
const eventVarName = toPascalCase(name.replace(/\./g, "_")) + "V" + version;
|
|
2447
2447
|
const payloadSchemaName = eventVarName + "Payload";
|
|
2448
|
-
return `import { defineEvent } from '@contractspec/lib.contracts';
|
|
2448
|
+
return `import { defineEvent } from '@contractspec/lib.contracts-spec';
|
|
2449
2449
|
import { ScalarTypeEnum, SchemaModel } from '@contractspec/lib.schema';
|
|
2450
2450
|
|
|
2451
2451
|
// TODO: Define event payload schema
|
|
@@ -2528,7 +2528,7 @@ TODO: Add markdown content here
|
|
|
2528
2528
|
},`;
|
|
2529
2529
|
break;
|
|
2530
2530
|
}
|
|
2531
|
-
return `import type { PresentationSpec } from '@contractspec/lib.contracts/presentations';
|
|
2531
|
+
return `import type { PresentationSpec } from '@contractspec/lib.contracts-spec/presentations';
|
|
2532
2532
|
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
2533
2533
|
|
|
2534
2534
|
export const ${varName}: PresentationSpec = {
|
|
@@ -2561,7 +2561,7 @@ function generateWorkflowSpec(data) {
|
|
|
2561
2561
|
${transition.condition ? ` condition: '${escapeString(transition.condition)}',` : ""}
|
|
2562
2562
|
}`).join(`,
|
|
2563
2563
|
`);
|
|
2564
|
-
return `import type { WorkflowSpec } from '@contractspec/lib.contracts/workflow';
|
|
2564
|
+
return `import type { WorkflowSpec } from '@contractspec/lib.contracts-spec/workflow';
|
|
2565
2565
|
|
|
2566
2566
|
/**
|
|
2567
2567
|
* Workflow generated via contractspec CLI.
|
|
@@ -2632,7 +2632,7 @@ function generateWorkflowRunnerTemplate({
|
|
|
2632
2632
|
InMemoryStateStore,
|
|
2633
2633
|
WorkflowRegistry,
|
|
2634
2634
|
WorkflowRunner,
|
|
2635
|
-
} from '@contractspec/lib.contracts/workflow';
|
|
2635
|
+
} from '@contractspec/lib.contracts-spec/workflow';
|
|
2636
2636
|
import { ${exportName} } from '${specImportPath}';
|
|
2637
2637
|
|
|
2638
2638
|
/**
|
|
@@ -2685,7 +2685,7 @@ function generateDataViewSpec(data) {
|
|
|
2685
2685
|
`);
|
|
2686
2686
|
const secondaryFields = data.secondaryFields?.length ? `secondaryFields: [${data.secondaryFields.map((key) => `'${escapeString(key)}'`).join(", ")}],` : "";
|
|
2687
2687
|
const itemOperation = data.itemOperation ? `item: { name: '${escapeString(data.itemOperation.name)}', version: ${data.itemOperation.version} },` : "";
|
|
2688
|
-
return `import type { DataViewSpec } from '@contractspec/lib.contracts/data-views';
|
|
2688
|
+
return `import type { DataViewSpec } from '@contractspec/lib.contracts-spec/data-views';
|
|
2689
2689
|
|
|
2690
2690
|
export const ${viewVarName}: DataViewSpec = {
|
|
2691
2691
|
meta: {
|
|
@@ -2789,7 +2789,7 @@ ${anomalyRules}
|
|
|
2789
2789
|
}`;
|
|
2790
2790
|
}).join(`,
|
|
2791
2791
|
`);
|
|
2792
|
-
return `import type { TelemetrySpec } from '@contractspec/lib.contracts/telemetry';
|
|
2792
|
+
return `import type { TelemetrySpec } from '@contractspec/lib.contracts-spec/telemetry';
|
|
2793
2793
|
|
|
2794
2794
|
export const ${specVar}: TelemetrySpec = {
|
|
2795
2795
|
meta: {
|
|
@@ -2857,7 +2857,7 @@ ${data.successMetrics.map((metric) => ` {
|
|
|
2857
2857
|
}`).join(`,
|
|
2858
2858
|
`)}
|
|
2859
2859
|
],` : "";
|
|
2860
|
-
return `import type { ExperimentSpec } from '@contractspec/lib.contracts/experiments';
|
|
2860
|
+
return `import type { ExperimentSpec } from '@contractspec/lib.contracts-spec/experiments';
|
|
2861
2861
|
|
|
2862
2862
|
export const ${specVar}: ExperimentSpec = {
|
|
2863
2863
|
meta: {
|
|
@@ -2931,7 +2931,7 @@ function generateAppBlueprintSpec(data) {
|
|
|
2931
2931
|
const routesSection = buildRoutesSection(data);
|
|
2932
2932
|
const notesSection = data.notes ? ` notes: '${escapeString4(data.notes)}',
|
|
2933
2933
|
` : "";
|
|
2934
|
-
return `import type { AppBlueprintSpec } from '@contractspec/lib.contracts/app-config';
|
|
2934
|
+
return `import type { AppBlueprintSpec } from '@contractspec/lib.contracts-spec/app-config';
|
|
2935
2935
|
|
|
2936
2936
|
export const ${exportName}: AppBlueprintSpec = {
|
|
2937
2937
|
meta: {
|
|
@@ -3083,7 +3083,7 @@ function generateMigrationSpec(data) {
|
|
|
3083
3083
|
const specName = toPascalCase(data.name.split(".").pop() ?? "Migration");
|
|
3084
3084
|
const migrationVar = `${specName}Migration`;
|
|
3085
3085
|
const dependencies = data.dependencies.length > 0 ? `dependencies: [${data.dependencies.map((dep) => `'${escapeString(dep)}'`).join(", ")}],` : "";
|
|
3086
|
-
return `import type { MigrationSpec } from '@contractspec/lib.contracts/migrations';
|
|
3086
|
+
return `import type { MigrationSpec } from '@contractspec/lib.contracts-spec/migrations';
|
|
3087
3087
|
|
|
3088
3088
|
export const ${migrationVar}: MigrationSpec = {
|
|
3089
3089
|
meta: {
|
|
@@ -3296,8 +3296,9 @@ function generateIntegrationSpec(data) {
|
|
|
3296
3296
|
` : "";
|
|
3297
3297
|
const constraints = renderConstraints(data.rateLimitRpm, data.rateLimitRph);
|
|
3298
3298
|
const byokSetup = renderByokSetup(supportedModes, data.byokSetupInstructions, data.byokRequiredScopes);
|
|
3299
|
-
return `import { StabilityEnum
|
|
3300
|
-
import
|
|
3299
|
+
return `import { StabilityEnum } from '@contractspec/lib.contracts-spec/ownership';
|
|
3300
|
+
import { defineIntegration } from '@contractspec/lib.contracts-integrations';
|
|
3301
|
+
import type { IntegrationSpecRegistry } from '@contractspec/lib.contracts-integrations';
|
|
3301
3302
|
|
|
3302
3303
|
export const ${varName} = defineIntegration({
|
|
3303
3304
|
meta: {
|
|
@@ -3345,9 +3346,9 @@ function generateKnowledgeSpaceSpec(data) {
|
|
|
3345
3346
|
const access = renderAccess(data);
|
|
3346
3347
|
const indexing = renderIndexing(data);
|
|
3347
3348
|
const policyComment = data.policyName && !data.policyVersion ? ` // defaults to latest version` : "";
|
|
3348
|
-
return `import { StabilityEnum } from '@contractspec/lib.contracts/ownership';
|
|
3349
|
-
import type { KnowledgeSpaceSpec } from '@contractspec/lib.contracts/knowledge/spec';
|
|
3350
|
-
import type { KnowledgeSpaceRegistry } from '@contractspec/lib.contracts/knowledge/spec';
|
|
3349
|
+
return `import { StabilityEnum } from '@contractspec/lib.contracts-spec/ownership';
|
|
3350
|
+
import type { KnowledgeSpaceSpec } from '@contractspec/lib.contracts-spec/knowledge/spec';
|
|
3351
|
+
import type { KnowledgeSpaceRegistry } from '@contractspec/lib.contracts-spec/knowledge/spec';
|
|
3351
3352
|
|
|
3352
3353
|
export const ${varName}: KnowledgeSpaceSpec = {
|
|
3353
3354
|
meta: {
|
|
@@ -3426,7 +3427,7 @@ function escape4(value) {
|
|
|
3426
3427
|
function generateHandlerTemplate(specName, kind) {
|
|
3427
3428
|
const handlerName = toCamelCase(specName.split(".").pop() ?? "unknown") + "Handler";
|
|
3428
3429
|
const specVarName = toPascalCase(specName.split(".").pop() ?? "Unknown") + "Spec";
|
|
3429
|
-
return `import type { ContractHandler } from '@contractspec/lib.contracts';
|
|
3430
|
+
return `import type { ContractHandler } from '@contractspec/lib.contracts-spec';
|
|
3430
3431
|
import { ${specVarName} } from '../contracts/${toKebabCase(specName)}.contracts';
|
|
3431
3432
|
|
|
3432
3433
|
/**
|