@contractspec/lib.contracts 0.0.0-canary-20260119224949 → 0.0.0-canary-20260128200020
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/app-config/contracts.d.ts +51 -51
- package/dist/app-config/events.d.ts +27 -27
- package/dist/app-config/lifecycle-contracts.d.ts +55 -55
- package/dist/app-config/runtime.d.ts +1 -1
- package/dist/app-config/spec.d.ts +2 -2
- package/dist/capabilities/capabilities.d.ts +64 -5
- package/dist/capabilities/capabilities.js +125 -0
- package/dist/capabilities/context.d.ts +88 -0
- package/dist/capabilities/context.js +87 -0
- package/dist/capabilities/docs/capabilities.docblock.js +191 -2
- package/dist/capabilities/guards.d.ts +110 -0
- package/dist/capabilities/guards.js +146 -0
- package/dist/capabilities/index.d.ts +4 -1
- package/dist/capabilities/index.js +4 -1
- package/dist/capabilities/validation.d.ts +76 -0
- package/dist/capabilities/validation.js +141 -0
- package/dist/client/react/feature-render.d.ts +2 -2
- package/dist/contract-registry/schemas.d.ts +2 -2
- package/dist/data-views/data-views.d.ts +2 -1
- package/dist/data-views/index.d.ts +2 -1
- package/dist/data-views/registry.d.ts +1 -1
- package/dist/data-views/runtime.d.ts +1 -1
- package/dist/data-views/spec.d.ts +2 -8
- package/dist/data-views/types.d.ts +1 -1
- package/dist/docs/capabilities/documentationSystem.capability.d.ts +7 -0
- package/dist/docs/capabilities/documentationSystem.capability.js +71 -0
- package/dist/docs/capabilities/index.d.ts +2 -0
- package/dist/docs/capabilities/index.js +3 -0
- package/dist/docs/commands/docsGenerate.command.d.ts +95 -0
- package/dist/docs/commands/docsGenerate.command.js +139 -0
- package/dist/docs/commands/docsPublish.command.d.ts +64 -0
- package/dist/docs/commands/docsPublish.command.js +104 -0
- package/dist/docs/commands/index.d.ts +3 -0
- package/dist/docs/commands/index.js +4 -0
- package/dist/docs/constants.d.ts +15 -0
- package/dist/docs/constants.js +18 -0
- package/dist/docs/contracts.d.ts +442 -0
- package/dist/docs/contracts.js +58 -0
- package/dist/docs/ensure-docblocks.d.ts +1 -0
- package/dist/docs/ensure-docblocks.js +1 -0
- package/dist/docs/events/docsGenerated.event.d.ts +62 -0
- package/dist/docs/events/docsGenerated.event.js +53 -0
- package/dist/docs/events/docsPublished.event.d.ts +70 -0
- package/dist/docs/events/docsPublished.event.js +57 -0
- package/dist/docs/events/index.d.ts +3 -0
- package/dist/docs/events/index.js +4 -0
- package/dist/docs/forms/docsSearch.form.d.ts +22 -0
- package/dist/docs/forms/docsSearch.form.js +113 -0
- package/dist/docs/forms/index.d.ts +2 -0
- package/dist/docs/forms/index.js +3 -0
- package/dist/docs/index.d.ts +23 -1
- package/dist/docs/index.js +24 -1
- package/dist/docs/presentations/docsLayout.presentation.d.ts +7 -0
- package/dist/docs/presentations/docsLayout.presentation.js +32 -0
- package/dist/docs/presentations/docsReferencePage.presentation.d.ts +7 -0
- package/dist/docs/presentations/docsReferencePage.presentation.js +32 -0
- package/dist/docs/presentations/index.d.ts +3 -0
- package/dist/docs/presentations/index.js +4 -0
- package/dist/docs/queries/contractReference.query.d.ts +217 -0
- package/dist/docs/queries/contractReference.query.js +122 -0
- package/dist/docs/queries/docsIndex.query.d.ts +272 -0
- package/dist/docs/queries/docsIndex.query.js +130 -0
- package/dist/docs/queries/index.d.ts +3 -0
- package/dist/docs/queries/index.js +4 -0
- package/dist/docs/tech/cli.docblock.js +10 -0
- package/dist/docs/tech/docs-system.docblock.d.ts +1 -0
- package/dist/docs/tech/docs-system.docblock.js +128 -0
- package/dist/docs/views/contractReference.dataView.d.ts +7 -0
- package/dist/docs/views/contractReference.dataView.js +80 -0
- package/dist/docs/views/docsIndex.dataView.d.ts +7 -0
- package/dist/docs/views/docsIndex.dataView.js +136 -0
- package/dist/docs/views/exampleCatalog.dataView.d.ts +7 -0
- package/dist/docs/views/exampleCatalog.dataView.js +91 -0
- package/dist/docs/views/index.d.ts +4 -0
- package/dist/docs/views/index.js +5 -0
- package/dist/events.d.ts +80 -14
- package/dist/events.js +33 -3
- package/dist/examples/schema.d.ts +9 -9
- package/dist/examples/types.d.ts +1 -1
- package/dist/experiments/spec.d.ts +9 -6
- package/dist/features/index.d.ts +2 -2
- package/dist/features/install.d.ts +4 -4
- package/dist/features/types.d.ts +28 -32
- package/dist/forms/forms.d.ts +1 -1
- package/dist/index.d.ts +54 -27
- package/dist/index.js +28 -3
- package/dist/install.d.ts +1 -1
- package/dist/integrations/openbanking/contracts/accounts.d.ts +67 -67
- package/dist/integrations/openbanking/contracts/balances.d.ts +35 -35
- package/dist/integrations/openbanking/contracts/transactions.d.ts +49 -49
- package/dist/integrations/openbanking/models.d.ts +55 -55
- package/dist/integrations/operations.d.ts +103 -103
- package/dist/integrations/spec.d.ts +2 -2
- package/dist/jsonschema.d.ts +1 -1
- package/dist/knowledge/operations.d.ts +67 -67
- package/dist/knowledge/spec.d.ts +1 -1
- package/dist/llm/exporters.d.ts +4 -4
- package/dist/llm/types.d.ts +1 -1
- package/dist/markdown.d.ts +2 -2
- package/dist/onboarding-base.d.ts +29 -29
- package/dist/operations/operation.d.ts +8 -2
- package/dist/operations/registry.d.ts +2 -2
- package/dist/ownership.d.ts +133 -8
- package/dist/ownership.js +25 -0
- package/dist/policy/context.d.ts +237 -0
- package/dist/policy/context.js +227 -0
- package/dist/policy/guards.d.ts +145 -0
- package/dist/policy/guards.js +254 -0
- package/dist/policy/index.d.ts +12 -1
- package/dist/policy/index.js +11 -1
- package/dist/policy/spec.d.ts +7 -4
- package/dist/policy/validation.d.ts +67 -0
- package/dist/policy/validation.js +307 -0
- package/dist/presentations/presentations.d.ts +6 -0
- package/dist/presentations/registry.d.ts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/serialization/index.d.ts +3 -0
- package/dist/serialization/index.js +3 -0
- package/dist/serialization/serializers.d.ts +40 -0
- package/dist/serialization/serializers.js +148 -0
- package/dist/serialization/types.d.ts +103 -0
- package/dist/serialization/types.js +0 -0
- package/dist/server/rest-elysia.d.ts +1 -1
- package/dist/server/rest-express.d.ts +1 -1
- package/dist/server/rest-generic.d.ts +1 -1
- package/dist/server/rest-next-app.d.ts +1 -1
- package/dist/server/rest-next-mcp.d.ts +1 -1
- package/dist/server/rest-next-pages.d.ts +1 -1
- package/dist/telemetry/spec.d.ts +1 -1
- package/dist/tests/runner.d.ts +1 -1
- package/dist/tests/spec.d.ts +17 -12
- package/dist/themes.d.ts +8 -5
- package/dist/translations/index.d.ts +6 -0
- package/dist/translations/index.js +5 -0
- package/dist/translations/registry.d.ts +144 -0
- package/dist/translations/registry.js +223 -0
- package/dist/translations/spec.d.ts +126 -0
- package/dist/translations/spec.js +31 -0
- package/dist/translations/validation.d.ts +85 -0
- package/dist/translations/validation.js +328 -0
- package/dist/types.d.ts +140 -14
- package/dist/versioning/index.d.ts +2 -1
- package/dist/versioning/index.js +2 -1
- package/dist/versioning/refs.d.ts +179 -0
- package/dist/versioning/refs.js +161 -0
- package/dist/workflow/context.d.ts +191 -0
- package/dist/workflow/context.js +227 -0
- package/dist/workflow/index.d.ts +6 -3
- package/dist/workflow/index.js +4 -2
- package/dist/workflow/spec.d.ts +4 -11
- package/dist/workflow/validation.d.ts +64 -2
- package/dist/workflow/validation.js +194 -1
- package/dist/workspace-config/contractsrc-schema.js +1 -0
- package/dist/workspace-config/contractsrc-types.d.ts +3 -3
- package/package.json +47 -8
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//#region src/capabilities/validation.ts
|
|
2
|
+
/**
|
|
3
|
+
* Validates bidirectional consistency between capabilities and their surfaces.
|
|
4
|
+
*
|
|
5
|
+
* Checks:
|
|
6
|
+
* 1. Forward validation: Every surface ref in capability `provides` exists
|
|
7
|
+
* 2. Reverse validation: Every spec with `capability` field is in that capability's `provides`
|
|
8
|
+
*
|
|
9
|
+
* @param deps - Registries to validate against
|
|
10
|
+
* @returns Validation result with errors and warnings
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const result = validateCapabilityConsistency({
|
|
15
|
+
* capabilities: capabilityRegistry,
|
|
16
|
+
* operations: operationRegistry,
|
|
17
|
+
* events: eventRegistry,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* if (!result.valid) {
|
|
21
|
+
* console.error('Capability validation failed:', result.errors);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
function validateCapabilityConsistency(deps) {
|
|
26
|
+
const errors = [];
|
|
27
|
+
const warnings = [];
|
|
28
|
+
for (const capability of deps.capabilities.list()) {
|
|
29
|
+
const capKey = `${capability.meta.key}.v${capability.meta.version}`;
|
|
30
|
+
for (const surface of capability.provides ?? []) if (!checkSurfaceExists(deps, surface.surface, surface.key)) errors.push({
|
|
31
|
+
type: "missing_surface_spec",
|
|
32
|
+
message: `Capability "${capKey}" provides ${surface.surface} "${surface.key}" but spec not found`,
|
|
33
|
+
capabilityKey: capKey,
|
|
34
|
+
surface: surface.surface,
|
|
35
|
+
specKey: surface.key
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (deps.operations) {
|
|
39
|
+
for (const op of deps.operations.list()) if (op.capability) {
|
|
40
|
+
const capSpec = deps.capabilities.get(op.capability.key, op.capability.version);
|
|
41
|
+
if (!capSpec) errors.push({
|
|
42
|
+
type: "capability_not_found",
|
|
43
|
+
message: `Operation "${op.meta.key}" references capability "${op.capability.key}.v${op.capability.version}" but capability not found`,
|
|
44
|
+
specKey: op.meta.key,
|
|
45
|
+
capabilityKey: `${op.capability.key}.v${op.capability.version}`,
|
|
46
|
+
surface: "operation"
|
|
47
|
+
});
|
|
48
|
+
else if (!capSpec.provides?.some((p) => p.surface === "operation" && p.key === op.meta.key)) errors.push({
|
|
49
|
+
type: "surface_not_in_provides",
|
|
50
|
+
message: `Operation "${op.meta.key}" claims capability "${op.capability.key}.v${op.capability.version}" but not in capability's provides`,
|
|
51
|
+
specKey: op.meta.key,
|
|
52
|
+
capabilityKey: `${op.capability.key}.v${op.capability.version}`,
|
|
53
|
+
surface: "operation"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (deps.events) {
|
|
58
|
+
for (const event of deps.events.list()) if (event.capability) {
|
|
59
|
+
const capSpec = deps.capabilities.get(event.capability.key, event.capability.version);
|
|
60
|
+
if (!capSpec) errors.push({
|
|
61
|
+
type: "capability_not_found",
|
|
62
|
+
message: `Event "${event.meta.key}" references capability "${event.capability.key}.v${event.capability.version}" but capability not found`,
|
|
63
|
+
specKey: event.meta.key,
|
|
64
|
+
capabilityKey: `${event.capability.key}.v${event.capability.version}`,
|
|
65
|
+
surface: "event"
|
|
66
|
+
});
|
|
67
|
+
else if (!capSpec.provides?.some((p) => p.surface === "event" && p.key === event.meta.key)) errors.push({
|
|
68
|
+
type: "surface_not_in_provides",
|
|
69
|
+
message: `Event "${event.meta.key}" claims capability "${event.capability.key}.v${event.capability.version}" but not in capability's provides`,
|
|
70
|
+
specKey: event.meta.key,
|
|
71
|
+
capabilityKey: `${event.capability.key}.v${event.capability.version}`,
|
|
72
|
+
surface: "event"
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (deps.presentations) {
|
|
77
|
+
for (const pres of deps.presentations.list()) if (pres.capability) {
|
|
78
|
+
const capSpec = deps.capabilities.get(pres.capability.key, pres.capability.version);
|
|
79
|
+
if (!capSpec) errors.push({
|
|
80
|
+
type: "capability_not_found",
|
|
81
|
+
message: `Presentation "${pres.meta.key}" references capability "${pres.capability.key}.v${pres.capability.version}" but capability not found`,
|
|
82
|
+
specKey: pres.meta.key,
|
|
83
|
+
capabilityKey: `${pres.capability.key}.v${pres.capability.version}`,
|
|
84
|
+
surface: "presentation"
|
|
85
|
+
});
|
|
86
|
+
else if (!capSpec.provides?.some((p) => p.surface === "presentation" && p.key === pres.meta.key)) errors.push({
|
|
87
|
+
type: "surface_not_in_provides",
|
|
88
|
+
message: `Presentation "${pres.meta.key}" claims capability "${pres.capability.key}.v${pres.capability.version}" but not in capability's provides`,
|
|
89
|
+
specKey: pres.meta.key,
|
|
90
|
+
capabilityKey: `${pres.capability.key}.v${pres.capability.version}`,
|
|
91
|
+
surface: "presentation"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
valid: errors.length === 0,
|
|
97
|
+
errors,
|
|
98
|
+
warnings
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check if a spec exists for a given surface type and key.
|
|
103
|
+
*/
|
|
104
|
+
function checkSurfaceExists(deps, surface, key) {
|
|
105
|
+
switch (surface) {
|
|
106
|
+
case "operation": return deps.operations?.has(key) ?? true;
|
|
107
|
+
case "event": return deps.events?.has(key) ?? true;
|
|
108
|
+
case "presentation": return deps.presentations?.has(key) ?? true;
|
|
109
|
+
case "workflow":
|
|
110
|
+
case "resource": return true;
|
|
111
|
+
default: return true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Finds specs that have no capability assignment (orphan specs).
|
|
116
|
+
* This is informational - orphan specs are allowed but may indicate
|
|
117
|
+
* incomplete capability modeling.
|
|
118
|
+
*
|
|
119
|
+
* @param deps - Registries to check
|
|
120
|
+
* @returns List of spec keys without capability assignment
|
|
121
|
+
*/
|
|
122
|
+
function findOrphanSpecs(deps) {
|
|
123
|
+
const result = {
|
|
124
|
+
operations: [],
|
|
125
|
+
events: [],
|
|
126
|
+
presentations: []
|
|
127
|
+
};
|
|
128
|
+
if (deps.operations) {
|
|
129
|
+
for (const op of deps.operations.list()) if (!op.capability) result.operations.push(op.meta.key);
|
|
130
|
+
}
|
|
131
|
+
if (deps.events) {
|
|
132
|
+
for (const event of deps.events.list()) if (!event.capability) result.events.push(event.meta.key);
|
|
133
|
+
}
|
|
134
|
+
if (deps.presentations) {
|
|
135
|
+
for (const pres of deps.presentations.list()) if (!pres.capability) result.presentations.push(pres.meta.key);
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
export { findOrphanSpecs, validateCapabilityConsistency };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PresentationSpec, PresentationTarget } from "../../presentations/presentations.js";
|
|
2
|
-
import { FeatureModuleSpec } from "../../features/types.js";
|
|
3
|
-
import { FeatureRegistry } from "../../features/registry.js";
|
|
4
2
|
import { ComponentMap, TransformEngine } from "../../presentations/transform-engine.js";
|
|
5
3
|
import "../../presentations/index.js";
|
|
4
|
+
import { FeatureModuleSpec } from "../../features/types.js";
|
|
5
|
+
import { FeatureRegistry } from "../../features/registry.js";
|
|
6
6
|
import "../../features/index.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { BlockConfig } from "@blocknote/core";
|
|
@@ -46,12 +46,12 @@ declare const ContractRegistryItemSchema: z.ZodObject<{
|
|
|
46
46
|
description: z.ZodString;
|
|
47
47
|
meta: z.ZodObject<{
|
|
48
48
|
stability: z.ZodEnum<{
|
|
49
|
-
deprecated: "deprecated";
|
|
50
49
|
idea: "idea";
|
|
51
50
|
in_creation: "in_creation";
|
|
52
51
|
experimental: "experimental";
|
|
53
52
|
beta: "beta";
|
|
54
53
|
stable: "stable";
|
|
54
|
+
deprecated: "deprecated";
|
|
55
55
|
}>;
|
|
56
56
|
owners: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
57
57
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -95,12 +95,12 @@ declare const ContractRegistryManifestSchema: z.ZodObject<{
|
|
|
95
95
|
description: z.ZodString;
|
|
96
96
|
meta: z.ZodObject<{
|
|
97
97
|
stability: z.ZodEnum<{
|
|
98
|
-
deprecated: "deprecated";
|
|
99
98
|
idea: "idea";
|
|
100
99
|
in_creation: "in_creation";
|
|
101
100
|
experimental: "experimental";
|
|
102
101
|
beta: "beta";
|
|
103
102
|
stable: "stable";
|
|
103
|
+
deprecated: "deprecated";
|
|
104
104
|
}>;
|
|
105
105
|
owners: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
106
106
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DataViewRef } from "../features/types.js";
|
|
1
2
|
import { DataViewAction, DataViewBaseConfig, DataViewConfig, DataViewDetailConfig, DataViewField, DataViewFieldFormat, DataViewFilter, DataViewGridConfig, DataViewKind, DataViewListConfig, DataViewMeta, DataViewSections, DataViewSource, DataViewStates, DataViewTableColumn, DataViewTableConfig } from "./types.js";
|
|
2
|
-
import {
|
|
3
|
+
import { DataViewSpec, defineDataView } from "./spec.js";
|
|
3
4
|
import { DataViewRegistry, dataViewKey } from "./registry.js";
|
|
4
5
|
import "./index.js";
|
|
5
6
|
export { DataViewAction, DataViewBaseConfig, DataViewConfig, DataViewDetailConfig, DataViewField, DataViewFieldFormat, DataViewFilter, DataViewGridConfig, DataViewKind, DataViewListConfig, DataViewMeta, DataViewRef, DataViewRegistry, DataViewSections, DataViewSource, DataViewSpec, DataViewStates, DataViewTableColumn, DataViewTableConfig, dataViewKey, defineDataView };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { DataViewRef } from "../features/types.js";
|
|
1
2
|
import { DataViewAction, DataViewBaseConfig, DataViewConfig, DataViewDetailConfig, DataViewField, DataViewFieldFormat, DataViewFilter, DataViewGridConfig, DataViewKind, DataViewListConfig, DataViewMeta, DataViewSections, DataViewSource, DataViewStates, DataViewTableColumn, DataViewTableConfig } from "./types.js";
|
|
2
|
-
import {
|
|
3
|
+
import { DataViewSpec, defineDataView } from "./spec.js";
|
|
3
4
|
import { DataViewRegistry, dataViewKey } from "./registry.js";
|
|
4
5
|
export { type DataViewAction, type DataViewBaseConfig, type DataViewConfig, type DataViewDetailConfig, type DataViewField, type DataViewFieldFormat, type DataViewFilter, type DataViewGridConfig, type DataViewKind, type DataViewListConfig, type DataViewMeta, type DataViewRef, DataViewRegistry, type DataViewSections, type DataViewSource, type DataViewSpec, type DataViewStates, type DataViewTableColumn, type DataViewTableConfig, dataViewKey, defineDataView };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OperationSpecRegistry } from "../operations/registry.js";
|
|
2
1
|
import "../operations/index.js";
|
|
3
2
|
import { DataViewSpec } from "./spec.js";
|
|
4
3
|
import { DataViewRegistry } from "./registry.js";
|
|
5
4
|
import "./index.js";
|
|
6
5
|
import { HandlerCtx } from "../types.js";
|
|
6
|
+
import { OperationSpecRegistry } from "../operations/registry.js";
|
|
7
7
|
|
|
8
8
|
//#region src/data-views/runtime.d.ts
|
|
9
9
|
interface DataViewRuntimeConfig {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExperimentRef } from "../experiments/spec.js";
|
|
2
|
+
import { DataViewRef } from "../features/types.js";
|
|
2
3
|
import { DataViewConfig, DataViewMeta, DataViewSource, DataViewStates } from "./types.js";
|
|
3
4
|
|
|
4
5
|
//#region src/data-views/spec.d.ts
|
|
@@ -17,16 +18,9 @@ interface DataViewSpec {
|
|
|
17
18
|
};
|
|
18
19
|
experiments?: ExperimentRef[];
|
|
19
20
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Reference to a data view spec.
|
|
22
|
-
*/
|
|
23
|
-
interface DataViewRef {
|
|
24
|
-
key: string;
|
|
25
|
-
version: string;
|
|
26
|
-
}
|
|
27
21
|
/**
|
|
28
22
|
* Helper to define a data view spec with type safety.
|
|
29
23
|
*/
|
|
30
24
|
declare function defineDataView(spec: DataViewSpec): DataViewSpec;
|
|
31
25
|
//#endregion
|
|
32
|
-
export { DataViewRef, DataViewSpec, defineDataView };
|
|
26
|
+
export { type DataViewRef, DataViewSpec, defineDataView };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CapabilitySpec } from "../../capabilities/capabilities.js";
|
|
2
|
+
import "../../index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/docs/capabilities/documentationSystem.capability.d.ts
|
|
5
|
+
declare const DocumentationSystemCapability: CapabilitySpec;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { DocumentationSystemCapability };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineCapability } from "../../capabilities/capabilities.js";
|
|
2
|
+
import "../../capabilities/index.js";
|
|
3
|
+
import { DOCS_CAPABILITY_KEY, DOCS_CAPABILITY_VERSION, DOCS_DOMAIN, DOCS_LAYOUT_PRESENTATION_KEY, DOCS_OWNERS, DOCS_REFERENCE_PRESENTATION_KEY, DOCS_STABILITY, DOCS_TAGS } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
//#region src/docs/capabilities/documentationSystem.capability.ts
|
|
6
|
+
const DocumentationSystemCapability = defineCapability({
|
|
7
|
+
meta: {
|
|
8
|
+
key: DOCS_CAPABILITY_KEY,
|
|
9
|
+
version: DOCS_CAPABILITY_VERSION,
|
|
10
|
+
kind: "ui",
|
|
11
|
+
title: "Documentation System",
|
|
12
|
+
description: "End-to-end docs generation, indexing, and presentation.",
|
|
13
|
+
domain: DOCS_DOMAIN,
|
|
14
|
+
owners: DOCS_OWNERS,
|
|
15
|
+
tags: [...DOCS_TAGS, "system"],
|
|
16
|
+
stability: DOCS_STABILITY
|
|
17
|
+
},
|
|
18
|
+
provides: [
|
|
19
|
+
{
|
|
20
|
+
surface: "operation",
|
|
21
|
+
key: "docs.generate",
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
description: "Generate documentation artifacts."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
surface: "operation",
|
|
27
|
+
key: "docs.publish",
|
|
28
|
+
version: "1.0.0",
|
|
29
|
+
description: "Publish documentation artifacts."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
surface: "operation",
|
|
33
|
+
key: "docs.search",
|
|
34
|
+
version: "1.0.0",
|
|
35
|
+
description: "Index and search DocBlocks."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
surface: "operation",
|
|
39
|
+
key: "docs.contract.reference",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
description: "Resolve contract references for docs."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
surface: "event",
|
|
45
|
+
key: "docs.generated",
|
|
46
|
+
version: "1.0.0",
|
|
47
|
+
description: "Docs generation completed."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
surface: "event",
|
|
51
|
+
key: "docs.published",
|
|
52
|
+
version: "1.0.0",
|
|
53
|
+
description: "Docs publish completed."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
surface: "presentation",
|
|
57
|
+
key: DOCS_LAYOUT_PRESENTATION_KEY,
|
|
58
|
+
version: "1.0.0",
|
|
59
|
+
description: "Docs layout presentation."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
surface: "presentation",
|
|
63
|
+
key: DOCS_REFERENCE_PRESENTATION_KEY,
|
|
64
|
+
version: "1.0.0",
|
|
65
|
+
description: "Docs reference page presentation."
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { DocumentationSystemCapability };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { OperationSpec } from "../../operations/operation.js";
|
|
2
|
+
import { EventSpecMeta } from "../../events.js";
|
|
3
|
+
import "../../index.js";
|
|
4
|
+
import * as _contractspec_lib_schema267 from "@contractspec/lib.schema";
|
|
5
|
+
import { SchemaModel } from "@contractspec/lib.schema";
|
|
6
|
+
|
|
7
|
+
//#region src/docs/commands/docsGenerate.command.d.ts
|
|
8
|
+
declare const DocsGenerateCommand: OperationSpec<SchemaModel<{
|
|
9
|
+
workspaceRoot: {
|
|
10
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
11
|
+
isOptional: true;
|
|
12
|
+
};
|
|
13
|
+
outputDir: {
|
|
14
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
15
|
+
isOptional: true;
|
|
16
|
+
};
|
|
17
|
+
version: {
|
|
18
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
19
|
+
isOptional: true;
|
|
20
|
+
};
|
|
21
|
+
formats: {
|
|
22
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
23
|
+
isOptional: true;
|
|
24
|
+
isArray: true;
|
|
25
|
+
};
|
|
26
|
+
includeInternal: {
|
|
27
|
+
type: _contractspec_lib_schema267.FieldType<boolean, boolean>;
|
|
28
|
+
isOptional: true;
|
|
29
|
+
};
|
|
30
|
+
includeExperimental: {
|
|
31
|
+
type: _contractspec_lib_schema267.FieldType<boolean, boolean>;
|
|
32
|
+
isOptional: true;
|
|
33
|
+
};
|
|
34
|
+
contractFilter: {
|
|
35
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
36
|
+
isOptional: true;
|
|
37
|
+
};
|
|
38
|
+
docblockFilter: {
|
|
39
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
40
|
+
isOptional: true;
|
|
41
|
+
};
|
|
42
|
+
dryRun: {
|
|
43
|
+
type: _contractspec_lib_schema267.FieldType<boolean, boolean>;
|
|
44
|
+
isOptional: true;
|
|
45
|
+
};
|
|
46
|
+
}>, SchemaModel<{
|
|
47
|
+
buildId: {
|
|
48
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
49
|
+
isOptional: false;
|
|
50
|
+
};
|
|
51
|
+
version: {
|
|
52
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
53
|
+
isOptional: true;
|
|
54
|
+
};
|
|
55
|
+
generatedAt: {
|
|
56
|
+
type: _contractspec_lib_schema267.FieldType<Date, string>;
|
|
57
|
+
isOptional: false;
|
|
58
|
+
};
|
|
59
|
+
outputDir: {
|
|
60
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
61
|
+
isOptional: true;
|
|
62
|
+
};
|
|
63
|
+
artifacts: {
|
|
64
|
+
type: SchemaModel<{
|
|
65
|
+
path: {
|
|
66
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
67
|
+
isOptional: false;
|
|
68
|
+
};
|
|
69
|
+
format: {
|
|
70
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
71
|
+
isOptional: true;
|
|
72
|
+
};
|
|
73
|
+
bytes: {
|
|
74
|
+
type: _contractspec_lib_schema267.FieldType<number, number>;
|
|
75
|
+
isOptional: true;
|
|
76
|
+
};
|
|
77
|
+
kind: {
|
|
78
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
79
|
+
isOptional: true;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
82
|
+
isOptional: true;
|
|
83
|
+
isArray: true;
|
|
84
|
+
};
|
|
85
|
+
warnings: {
|
|
86
|
+
type: _contractspec_lib_schema267.FieldType<string, string>;
|
|
87
|
+
isOptional: true;
|
|
88
|
+
isArray: true;
|
|
89
|
+
};
|
|
90
|
+
}>, {
|
|
91
|
+
ref: EventSpecMeta;
|
|
92
|
+
when: string;
|
|
93
|
+
}[]>;
|
|
94
|
+
//#endregion
|
|
95
|
+
export { DocsGenerateCommand };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { defineCommand } from "../../operations/operation.js";
|
|
2
|
+
import "../../operations/index.js";
|
|
3
|
+
import { DOCS_CAPABILITY_REF, DOCS_DOMAIN, DOCS_OWNERS, DOCS_STABILITY, DOCS_TAGS } from "../constants.js";
|
|
4
|
+
import { docId } from "../registry.js";
|
|
5
|
+
import "../ensure-docblocks.js";
|
|
6
|
+
import { DocsGeneratedEvent } from "../events/docsGenerated.event.js";
|
|
7
|
+
import { ScalarTypeEnum, SchemaModel } from "@contractspec/lib.schema";
|
|
8
|
+
|
|
9
|
+
//#region src/docs/commands/docsGenerate.command.ts
|
|
10
|
+
const DocsArtifactModel = new SchemaModel({
|
|
11
|
+
name: "DocsArtifact",
|
|
12
|
+
fields: {
|
|
13
|
+
path: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
format: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: true
|
|
20
|
+
},
|
|
21
|
+
bytes: {
|
|
22
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
23
|
+
isOptional: true
|
|
24
|
+
},
|
|
25
|
+
kind: {
|
|
26
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
+
isOptional: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const DocsGenerateInput = new SchemaModel({
|
|
32
|
+
name: "DocsGenerateInput",
|
|
33
|
+
fields: {
|
|
34
|
+
workspaceRoot: {
|
|
35
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
36
|
+
isOptional: true
|
|
37
|
+
},
|
|
38
|
+
outputDir: {
|
|
39
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
+
isOptional: true
|
|
41
|
+
},
|
|
42
|
+
version: {
|
|
43
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
44
|
+
isOptional: true
|
|
45
|
+
},
|
|
46
|
+
formats: {
|
|
47
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
48
|
+
isOptional: true,
|
|
49
|
+
isArray: true
|
|
50
|
+
},
|
|
51
|
+
includeInternal: {
|
|
52
|
+
type: ScalarTypeEnum.Boolean(),
|
|
53
|
+
isOptional: true
|
|
54
|
+
},
|
|
55
|
+
includeExperimental: {
|
|
56
|
+
type: ScalarTypeEnum.Boolean(),
|
|
57
|
+
isOptional: true
|
|
58
|
+
},
|
|
59
|
+
contractFilter: {
|
|
60
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
61
|
+
isOptional: true
|
|
62
|
+
},
|
|
63
|
+
docblockFilter: {
|
|
64
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
65
|
+
isOptional: true
|
|
66
|
+
},
|
|
67
|
+
dryRun: {
|
|
68
|
+
type: ScalarTypeEnum.Boolean(),
|
|
69
|
+
isOptional: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const DocsGenerateOutput = new SchemaModel({
|
|
74
|
+
name: "DocsGenerateOutput",
|
|
75
|
+
fields: {
|
|
76
|
+
buildId: {
|
|
77
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
78
|
+
isOptional: false
|
|
79
|
+
},
|
|
80
|
+
version: {
|
|
81
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
82
|
+
isOptional: true
|
|
83
|
+
},
|
|
84
|
+
generatedAt: {
|
|
85
|
+
type: ScalarTypeEnum.DateTime(),
|
|
86
|
+
isOptional: false
|
|
87
|
+
},
|
|
88
|
+
outputDir: {
|
|
89
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
90
|
+
isOptional: true
|
|
91
|
+
},
|
|
92
|
+
artifacts: {
|
|
93
|
+
type: DocsArtifactModel,
|
|
94
|
+
isOptional: true,
|
|
95
|
+
isArray: true
|
|
96
|
+
},
|
|
97
|
+
warnings: {
|
|
98
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
99
|
+
isOptional: true,
|
|
100
|
+
isArray: true
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const DocsGenerateCommand = defineCommand({
|
|
105
|
+
meta: {
|
|
106
|
+
key: "docs.generate",
|
|
107
|
+
title: "Generate Documentation",
|
|
108
|
+
version: "1.0.0",
|
|
109
|
+
description: "Generate documentation artifacts from ContractSpecs.",
|
|
110
|
+
goal: "Produce up-to-date reference docs and guides from specs and DocBlocks.",
|
|
111
|
+
context: "Used by CLI and CI to keep docs in sync with contract definitions.",
|
|
112
|
+
domain: DOCS_DOMAIN,
|
|
113
|
+
owners: DOCS_OWNERS,
|
|
114
|
+
tags: [...DOCS_TAGS, "generation"],
|
|
115
|
+
stability: DOCS_STABILITY,
|
|
116
|
+
docId: [docId("docs.tech.docs-generator")]
|
|
117
|
+
},
|
|
118
|
+
capability: DOCS_CAPABILITY_REF,
|
|
119
|
+
io: {
|
|
120
|
+
input: DocsGenerateInput,
|
|
121
|
+
output: DocsGenerateOutput,
|
|
122
|
+
errors: { OUTPUT_WRITE_FAILED: {
|
|
123
|
+
description: "Failed to write generated docs output.",
|
|
124
|
+
http: 500,
|
|
125
|
+
when: "The generator cannot persist artifacts to the output path."
|
|
126
|
+
} }
|
|
127
|
+
},
|
|
128
|
+
policy: {
|
|
129
|
+
auth: "admin",
|
|
130
|
+
pii: []
|
|
131
|
+
},
|
|
132
|
+
sideEffects: { emits: [{
|
|
133
|
+
ref: DocsGeneratedEvent.meta,
|
|
134
|
+
when: "Docs generation completes successfully."
|
|
135
|
+
}] }
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { DocsGenerateCommand };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { OperationSpec } from "../../operations/operation.js";
|
|
2
|
+
import { EventSpecMeta } from "../../events.js";
|
|
3
|
+
import "../../index.js";
|
|
4
|
+
import * as _contractspec_lib_schema285 from "@contractspec/lib.schema";
|
|
5
|
+
import { SchemaModel } from "@contractspec/lib.schema";
|
|
6
|
+
|
|
7
|
+
//#region src/docs/commands/docsPublish.command.d.ts
|
|
8
|
+
declare const DocsPublishCommand: OperationSpec<SchemaModel<{
|
|
9
|
+
buildId: {
|
|
10
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
11
|
+
isOptional: false;
|
|
12
|
+
};
|
|
13
|
+
version: {
|
|
14
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
15
|
+
isOptional: true;
|
|
16
|
+
};
|
|
17
|
+
environment: {
|
|
18
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
19
|
+
isOptional: true;
|
|
20
|
+
};
|
|
21
|
+
deployTarget: {
|
|
22
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
23
|
+
isOptional: true;
|
|
24
|
+
};
|
|
25
|
+
artifactPath: {
|
|
26
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
27
|
+
isOptional: true;
|
|
28
|
+
};
|
|
29
|
+
dryRun: {
|
|
30
|
+
type: _contractspec_lib_schema285.FieldType<boolean, boolean>;
|
|
31
|
+
isOptional: true;
|
|
32
|
+
};
|
|
33
|
+
notes: {
|
|
34
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
35
|
+
isOptional: true;
|
|
36
|
+
};
|
|
37
|
+
}>, SchemaModel<{
|
|
38
|
+
publishId: {
|
|
39
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
40
|
+
isOptional: false;
|
|
41
|
+
};
|
|
42
|
+
publishedAt: {
|
|
43
|
+
type: _contractspec_lib_schema285.FieldType<Date, string>;
|
|
44
|
+
isOptional: false;
|
|
45
|
+
};
|
|
46
|
+
url: {
|
|
47
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
48
|
+
isOptional: true;
|
|
49
|
+
};
|
|
50
|
+
status: {
|
|
51
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
52
|
+
isOptional: true;
|
|
53
|
+
};
|
|
54
|
+
warnings: {
|
|
55
|
+
type: _contractspec_lib_schema285.FieldType<string, string>;
|
|
56
|
+
isOptional: true;
|
|
57
|
+
isArray: true;
|
|
58
|
+
};
|
|
59
|
+
}>, {
|
|
60
|
+
ref: EventSpecMeta;
|
|
61
|
+
when: string;
|
|
62
|
+
}[]>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { DocsPublishCommand };
|