@contractspec/module.examples 1.44.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/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/builtins.d.ts +7 -0
- package/dist/builtins.d.ts.map +1 -0
- package/dist/builtins.js +76 -0
- package/dist/builtins.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/registry.d.ts +10 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +20 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/validate.d.ts +19 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +90 -0
- package/dist/validate.js.map +1 -0
- package/package.json +87 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chaman Ventures, SASU
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @contractspec/module.examples
|
|
2
|
+
|
|
3
|
+
Website: https://contractspec.io/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Pure, deterministic types and registries for ContractSpec Examples.
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
This module defines the canonical “Example” shape (metadata + entrypoints) and exposes:
|
|
11
|
+
|
|
12
|
+
- A registry API to list/search examples
|
|
13
|
+
- Pure validators to enforce minimum required metadata across examples
|
|
14
|
+
|
|
15
|
+
## Design principles
|
|
16
|
+
|
|
17
|
+
- No I/O (no filesystem, no network)
|
|
18
|
+
- Deterministic outputs from explicit inputs
|
|
19
|
+
- Strong typing (no `any`)
|
|
20
|
+
|
|
21
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","names":[],"sources":["../src/builtins.ts"],"sourcesContent":[],"mappings":";;;cAsCa,2BAA2B"}
|
package/dist/builtins.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import AgentConsole from "@contractspec/example.agent-console/example";
|
|
2
|
+
import AiSupportBot from "@contractspec/example.ai-support-bot/example";
|
|
3
|
+
import AnalyticsDashboard from "@contractspec/example.analytics-dashboard/example";
|
|
4
|
+
import ContentGeneration from "@contractspec/example.content-generation/example";
|
|
5
|
+
import CrmPipeline from "@contractspec/example.crm-pipeline/example";
|
|
6
|
+
import IntegrationHub from "@contractspec/example.integration-hub/example";
|
|
7
|
+
import IntegrationStripe from "@contractspec/example.integration-stripe/example";
|
|
8
|
+
import KbUpdatePipeline from "@contractspec/example.kb-update-pipeline/example";
|
|
9
|
+
import KnowledgeCanon from "@contractspec/example.knowledge-canon/example";
|
|
10
|
+
import LearningPatterns from "@contractspec/example.learning-patterns/example";
|
|
11
|
+
import LearningJourneyAmbientCoach from "@contractspec/example.learning-journey-ambient-coach/example";
|
|
12
|
+
import LearningJourneyCrmOnboarding from "@contractspec/example.learning-journey-crm-onboarding/example";
|
|
13
|
+
import LearningJourneyDuoDrills from "@contractspec/example.learning-journey-duo-drills/example";
|
|
14
|
+
import LearningJourneyPlatformTour from "@contractspec/example.learning-journey-platform-tour/example";
|
|
15
|
+
import LearningJourneyQuestChallenges from "@contractspec/example.learning-journey-quest-challenges/example";
|
|
16
|
+
import LearningJourneyRegistry from "@contractspec/example.learning-journey-registry/example";
|
|
17
|
+
import LearningJourneyStudioOnboarding from "@contractspec/example.learning-journey-studio-onboarding/example";
|
|
18
|
+
import LearningJourneyUiCoaching from "@contractspec/example.learning-journey-ui-coaching/example";
|
|
19
|
+
import LearningJourneyUiGamified from "@contractspec/example.learning-journey-ui-gamified/example";
|
|
20
|
+
import LearningJourneyUiOnboarding from "@contractspec/example.learning-journey-ui-onboarding/example";
|
|
21
|
+
import LearningJourneyUiShared from "@contractspec/example.learning-journey-ui-shared/example";
|
|
22
|
+
import LifecycleCli from "@contractspec/example.lifecycle-cli/example";
|
|
23
|
+
import LifecycleDashboard from "@contractspec/example.lifecycle-dashboard/example";
|
|
24
|
+
import LocaleJurisdictionGate from "@contractspec/example.locale-jurisdiction-gate/example";
|
|
25
|
+
import Marketplace from "@contractspec/example.marketplace/example";
|
|
26
|
+
import OpenbankingPowens from "@contractspec/example.openbanking-powens/example";
|
|
27
|
+
import Personalization from "@contractspec/example.personalization/example";
|
|
28
|
+
import PolicySafeKnowledgeAssistant from "@contractspec/example.policy-safe-knowledge-assistant/example";
|
|
29
|
+
import SaasBoilerplate from "@contractspec/example.saas-boilerplate/example";
|
|
30
|
+
import ServiceBusinessOs from "@contractspec/example.service-business-os/example";
|
|
31
|
+
import TeamHub from "@contractspec/example.team-hub/example";
|
|
32
|
+
import VersionedKnowledgeBase from "@contractspec/example.versioned-knowledge-base/example";
|
|
33
|
+
import WealthSnapshot from "@contractspec/example.wealth-snapshot/example";
|
|
34
|
+
import WorkflowSystem from "@contractspec/example.workflow-system/example";
|
|
35
|
+
|
|
36
|
+
//#region src/builtins.ts
|
|
37
|
+
const EXAMPLE_REGISTRY = [
|
|
38
|
+
AgentConsole,
|
|
39
|
+
AiSupportBot,
|
|
40
|
+
AnalyticsDashboard,
|
|
41
|
+
ContentGeneration,
|
|
42
|
+
CrmPipeline,
|
|
43
|
+
IntegrationHub,
|
|
44
|
+
IntegrationStripe,
|
|
45
|
+
KbUpdatePipeline,
|
|
46
|
+
KnowledgeCanon,
|
|
47
|
+
LearningPatterns,
|
|
48
|
+
LearningJourneyAmbientCoach,
|
|
49
|
+
LearningJourneyCrmOnboarding,
|
|
50
|
+
LearningJourneyDuoDrills,
|
|
51
|
+
LearningJourneyPlatformTour,
|
|
52
|
+
LearningJourneyQuestChallenges,
|
|
53
|
+
LearningJourneyRegistry,
|
|
54
|
+
LearningJourneyStudioOnboarding,
|
|
55
|
+
LearningJourneyUiCoaching,
|
|
56
|
+
LearningJourneyUiGamified,
|
|
57
|
+
LearningJourneyUiOnboarding,
|
|
58
|
+
LearningJourneyUiShared,
|
|
59
|
+
LifecycleCli,
|
|
60
|
+
LifecycleDashboard,
|
|
61
|
+
LocaleJurisdictionGate,
|
|
62
|
+
Marketplace,
|
|
63
|
+
OpenbankingPowens,
|
|
64
|
+
Personalization,
|
|
65
|
+
PolicySafeKnowledgeAssistant,
|
|
66
|
+
SaasBoilerplate,
|
|
67
|
+
ServiceBusinessOs,
|
|
68
|
+
TeamHub,
|
|
69
|
+
VersionedKnowledgeBase,
|
|
70
|
+
WealthSnapshot,
|
|
71
|
+
WorkflowSystem
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { EXAMPLE_REGISTRY };
|
|
76
|
+
//# sourceMappingURL=builtins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.js","names":["EXAMPLE_REGISTRY: readonly ExampleDefinition[]"],"sources":["../src/builtins.ts"],"sourcesContent":["import type { ExampleDefinition } from './types';\n\n// Import manifests ONLY via the side-effect-free `/example` entrypoints.\nimport AgentConsole from '@contractspec/example.agent-console/example';\nimport AiSupportBot from '@contractspec/example.ai-support-bot/example';\nimport AnalyticsDashboard from '@contractspec/example.analytics-dashboard/example';\nimport ContentGeneration from '@contractspec/example.content-generation/example';\nimport CrmPipeline from '@contractspec/example.crm-pipeline/example';\nimport IntegrationHub from '@contractspec/example.integration-hub/example';\nimport IntegrationStripe from '@contractspec/example.integration-stripe/example';\nimport KbUpdatePipeline from '@contractspec/example.kb-update-pipeline/example';\nimport KnowledgeCanon from '@contractspec/example.knowledge-canon/example';\nimport LearningPatterns from '@contractspec/example.learning-patterns/example';\nimport LearningJourneyAmbientCoach from '@contractspec/example.learning-journey-ambient-coach/example';\nimport LearningJourneyCrmOnboarding from '@contractspec/example.learning-journey-crm-onboarding/example';\nimport LearningJourneyDuoDrills from '@contractspec/example.learning-journey-duo-drills/example';\nimport LearningJourneyPlatformTour from '@contractspec/example.learning-journey-platform-tour/example';\nimport LearningJourneyQuestChallenges from '@contractspec/example.learning-journey-quest-challenges/example';\nimport LearningJourneyRegistry from '@contractspec/example.learning-journey-registry/example';\nimport LearningJourneyStudioOnboarding from '@contractspec/example.learning-journey-studio-onboarding/example';\nimport LearningJourneyUiCoaching from '@contractspec/example.learning-journey-ui-coaching/example';\nimport LearningJourneyUiGamified from '@contractspec/example.learning-journey-ui-gamified/example';\nimport LearningJourneyUiOnboarding from '@contractspec/example.learning-journey-ui-onboarding/example';\nimport LearningJourneyUiShared from '@contractspec/example.learning-journey-ui-shared/example';\nimport LifecycleCli from '@contractspec/example.lifecycle-cli/example';\nimport LifecycleDashboard from '@contractspec/example.lifecycle-dashboard/example';\nimport LocaleJurisdictionGate from '@contractspec/example.locale-jurisdiction-gate/example';\nimport Marketplace from '@contractspec/example.marketplace/example';\nimport OpenbankingPowens from '@contractspec/example.openbanking-powens/example';\nimport Personalization from '@contractspec/example.personalization/example';\nimport PolicySafeKnowledgeAssistant from '@contractspec/example.policy-safe-knowledge-assistant/example';\nimport SaasBoilerplate from '@contractspec/example.saas-boilerplate/example';\nimport ServiceBusinessOs from '@contractspec/example.service-business-os/example';\nimport TeamHub from '@contractspec/example.team-hub/example';\nimport VersionedKnowledgeBase from '@contractspec/example.versioned-knowledge-base/example';\nimport WealthSnapshot from '@contractspec/example.wealth-snapshot/example';\nimport WorkflowSystem from '@contractspec/example.workflow-system/example';\n\nexport const EXAMPLE_REGISTRY: readonly ExampleDefinition[] = [\n AgentConsole,\n AiSupportBot,\n AnalyticsDashboard,\n ContentGeneration,\n CrmPipeline,\n IntegrationHub,\n IntegrationStripe,\n KbUpdatePipeline,\n KnowledgeCanon,\n LearningPatterns,\n LearningJourneyAmbientCoach,\n LearningJourneyCrmOnboarding,\n LearningJourneyDuoDrills,\n LearningJourneyPlatformTour,\n LearningJourneyQuestChallenges,\n LearningJourneyRegistry,\n LearningJourneyStudioOnboarding,\n LearningJourneyUiCoaching,\n LearningJourneyUiGamified,\n LearningJourneyUiOnboarding,\n LearningJourneyUiShared,\n LifecycleCli,\n LifecycleDashboard,\n LocaleJurisdictionGate,\n Marketplace,\n OpenbankingPowens,\n Personalization,\n PolicySafeKnowledgeAssistant,\n SaasBoilerplate,\n ServiceBusinessOs,\n TeamHub,\n VersionedKnowledgeBase,\n WealthSnapshot,\n WorkflowSystem,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAaA,mBAAiD;CAC5D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ExampleDefinition, ExampleDocRefs, ExampleEntrypoints, ExampleId, ExampleKind, ExampleSandboxMode, ExampleSurfacesSupport, ExampleVisibility } from "./types.js";
|
|
2
|
+
import { EXAMPLE_REGISTRY } from "./builtins.js";
|
|
3
|
+
import { getExample, listExamples, searchExamples } from "./registry.js";
|
|
4
|
+
import { ExampleValidationError, ValidateExamplesResult, validateExamples } from "./validate.js";
|
|
5
|
+
export { EXAMPLE_REGISTRY, ExampleDefinition, ExampleDocRefs, ExampleEntrypoints, ExampleId, ExampleKind, ExampleSandboxMode, ExampleSurfacesSupport, ExampleValidationError, ExampleVisibility, ValidateExamplesResult, getExample, listExamples, searchExamples, validateExamples };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExampleDefinition, ExampleId } from "./types.js";
|
|
2
|
+
import { EXAMPLE_REGISTRY } from "./builtins.js";
|
|
3
|
+
|
|
4
|
+
//#region src/registry.d.ts
|
|
5
|
+
declare function listExamples(): readonly ExampleDefinition[];
|
|
6
|
+
declare function getExample(id: ExampleId): ExampleDefinition | undefined;
|
|
7
|
+
declare function searchExamples(query: string): ExampleDefinition[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getExample, listExamples, searchExamples };
|
|
10
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","names":[],"sources":["../src/registry.ts"],"sourcesContent":[],"mappings":";;;;iBAKgB,YAAA,CAAA,YAAyB;AAAzB,iBAIA,UAAA,CAJyB,EAAA,EAIV,SAJU,CAAiB,EAIf,iBAJe,GAAA,SAAA;AAI1C,iBAIA,cAAA,CAJe,KAAY,EAAA,MAAA,CAAA,EAII,iBAJa,EAAA"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EXAMPLE_REGISTRY } from "./builtins.js";
|
|
2
|
+
|
|
3
|
+
//#region src/registry.ts
|
|
4
|
+
function listExamples() {
|
|
5
|
+
return EXAMPLE_REGISTRY.slice().sort((a, b) => a.id.localeCompare(b.id));
|
|
6
|
+
}
|
|
7
|
+
function getExample(id) {
|
|
8
|
+
return EXAMPLE_REGISTRY.find((ex) => ex.id === id);
|
|
9
|
+
}
|
|
10
|
+
function searchExamples(query) {
|
|
11
|
+
const q = query.toLowerCase().trim();
|
|
12
|
+
if (!q) return [...listExamples()];
|
|
13
|
+
return listExamples().filter((ex) => {
|
|
14
|
+
return `${ex.id} ${ex.title} ${ex.summary} ${ex.tags.join(" ")}`.toLowerCase().includes(q);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getExample, listExamples, searchExamples };
|
|
20
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","names":[],"sources":["../src/registry.ts"],"sourcesContent":["import type { ExampleDefinition, ExampleId } from './types';\nimport { EXAMPLE_REGISTRY } from './builtins';\n\nexport { EXAMPLE_REGISTRY };\n\nexport function listExamples(): readonly ExampleDefinition[] {\n return EXAMPLE_REGISTRY.slice().sort((a, b) => a.id.localeCompare(b.id));\n}\n\nexport function getExample(id: ExampleId): ExampleDefinition | undefined {\n return EXAMPLE_REGISTRY.find((ex) => ex.id === id);\n}\n\nexport function searchExamples(query: string): ExampleDefinition[] {\n const q = query.toLowerCase().trim();\n if (!q) return [...listExamples()];\n return listExamples().filter((ex) => {\n const hay =\n `${ex.id} ${ex.title} ${ex.summary} ${ex.tags.join(' ')}`.toLowerCase();\n return hay.includes(q);\n });\n}\n"],"mappings":";;;AAKA,SAAgB,eAA6C;AAC3D,QAAO,iBAAiB,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,CAAC;;AAG1E,SAAgB,WAAW,IAA8C;AACvE,QAAO,iBAAiB,MAAM,OAAO,GAAG,OAAO,GAAG;;AAGpD,SAAgB,eAAe,OAAoC;CACjE,MAAM,IAAI,MAAM,aAAa,CAAC,MAAM;AACpC,KAAI,CAAC,EAAG,QAAO,CAAC,GAAG,cAAc,CAAC;AAClC,QAAO,cAAc,CAAC,QAAQ,OAAO;AAGnC,SADE,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,QAAQ,GAAG,GAAG,KAAK,KAAK,IAAI,GAAG,aAAa,CAC9D,SAAS,EAAE;GACtB"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type ExampleId = string;
|
|
3
|
+
type ExampleKind = 'template' | 'workflow' | 'integration' | 'knowledge' | 'blueprint' | 'ui' | 'script' | 'library';
|
|
4
|
+
type ExampleVisibility = 'public' | 'internal' | 'mixed';
|
|
5
|
+
type ExampleSandboxMode = 'playground' | 'specs' | 'builder' | 'markdown' | 'evolution';
|
|
6
|
+
interface ExampleDocRefs {
|
|
7
|
+
/** Canonical doc route id(s) in DocBlocks registry */
|
|
8
|
+
rootDocId?: string;
|
|
9
|
+
goalDocId?: string;
|
|
10
|
+
usageDocId?: string;
|
|
11
|
+
referenceDocId?: string;
|
|
12
|
+
constraintsDocId?: string;
|
|
13
|
+
}
|
|
14
|
+
interface ExampleSurfacesSupport {
|
|
15
|
+
templates: boolean;
|
|
16
|
+
sandbox: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
modes: readonly ExampleSandboxMode[];
|
|
19
|
+
};
|
|
20
|
+
studio: {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
/** If true, Studio can create a real project from this example via API. */
|
|
23
|
+
installable: boolean;
|
|
24
|
+
};
|
|
25
|
+
mcp: {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface ExampleEntrypoints {
|
|
30
|
+
/** Package name in the monorepo (workspace) */
|
|
31
|
+
packageName: string;
|
|
32
|
+
/** Optional exports from the example package (strings are subpath exports). */
|
|
33
|
+
feature?: string;
|
|
34
|
+
presentations?: string;
|
|
35
|
+
contracts?: string;
|
|
36
|
+
handlers?: string;
|
|
37
|
+
ui?: string;
|
|
38
|
+
docs?: string;
|
|
39
|
+
}
|
|
40
|
+
interface ExampleDefinition {
|
|
41
|
+
id: ExampleId;
|
|
42
|
+
title: string;
|
|
43
|
+
summary: string;
|
|
44
|
+
tags: readonly string[];
|
|
45
|
+
kind: ExampleKind;
|
|
46
|
+
visibility: ExampleVisibility;
|
|
47
|
+
docs?: ExampleDocRefs;
|
|
48
|
+
entrypoints: ExampleEntrypoints;
|
|
49
|
+
surfaces: ExampleSurfacesSupport;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { ExampleDefinition, ExampleDocRefs, ExampleEntrypoints, ExampleId, ExampleKind, ExampleSandboxMode, ExampleSurfacesSupport, ExampleVisibility };
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";KAAY,SAAA;AAAA,KAEA,WAAA,GAFS,UAAA,GAAA,UAAA,GAAA,aAAA,GAAA,WAAA,GAAA,WAAA,GAAA,IAAA,GAAA,QAAA,GAAA,SAAA;AAET,KAUA,iBAAA,GAVW,QAAA,GAAA,UAAA,GAAA,OAAA;AAUX,KAEA,kBAAA,GAFiB,YAAA,GAAA,OAAA,GAAA,SAAA,GAAA,UAAA,GAAA,WAAA;AAEjB,UAOK,cAAA,CAPa;EAOb;EASA,SAAA,CAAA,EAAA,MAAA;EAgBA,SAAA,CAAA,EAAA,MAAA;EAYA,UAAA,CAAA,EAAA,MAAA;EACX,cAAA,CAAA,EAAA,MAAA;EAIE,gBAAA,CAAA,EAAA,MAAA;;AAEC,UAnCQ,sBAAA,CAmCR;EACM,SAAA,EAAA,OAAA;EACH,OAAA,EAAA;IAAsB,OAAA,EAAA,OAAA;oBAjCd;;;;;;;;;;;UAYH,kBAAA;;;;;;;;;;;UAYA,iBAAA;MACX;;;;QAIE;cACM;SACL;eACM;YACH"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExampleDefinition } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/validate.d.ts
|
|
4
|
+
interface ExampleValidationError {
|
|
5
|
+
exampleId?: string;
|
|
6
|
+
message: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
}
|
|
9
|
+
type ValidateExamplesResult = {
|
|
10
|
+
ok: true;
|
|
11
|
+
examples: ExampleDefinition[];
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
errors: ExampleValidationError[];
|
|
15
|
+
};
|
|
16
|
+
declare function validateExamples(examples: ExampleDefinition[]): ValidateExamplesResult;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ExampleValidationError, ValidateExamplesResult, validateExamples };
|
|
19
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","names":[],"sources":["../src/validate.ts"],"sourcesContent":[],"mappings":";;;UAuDiB,sBAAA;;EAAA,OAAA,EAAA,MAAA;EAML,IAAA,CAAA,EAAA,MAAA;AAIZ;KAJY,sBAAA;;YACc;;;UACD;;iBAET,gBAAA,WACJ,sBACT"}
|
package/dist/validate.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/validate.ts
|
|
4
|
+
const ExampleDefinitionSchema = z.object({
|
|
5
|
+
id: z.string().min(1),
|
|
6
|
+
title: z.string().min(1),
|
|
7
|
+
summary: z.string().min(1),
|
|
8
|
+
tags: z.array(z.string()).default([]),
|
|
9
|
+
kind: z.enum([
|
|
10
|
+
"template",
|
|
11
|
+
"workflow",
|
|
12
|
+
"integration",
|
|
13
|
+
"knowledge",
|
|
14
|
+
"blueprint",
|
|
15
|
+
"ui",
|
|
16
|
+
"script",
|
|
17
|
+
"library"
|
|
18
|
+
]),
|
|
19
|
+
visibility: z.enum([
|
|
20
|
+
"public",
|
|
21
|
+
"internal",
|
|
22
|
+
"mixed"
|
|
23
|
+
]),
|
|
24
|
+
docs: z.object({
|
|
25
|
+
rootDocId: z.string().optional(),
|
|
26
|
+
goalDocId: z.string().optional(),
|
|
27
|
+
usageDocId: z.string().optional(),
|
|
28
|
+
referenceDocId: z.string().optional(),
|
|
29
|
+
constraintsDocId: z.string().optional()
|
|
30
|
+
}).optional(),
|
|
31
|
+
entrypoints: z.object({
|
|
32
|
+
packageName: z.string().min(1),
|
|
33
|
+
feature: z.string().optional(),
|
|
34
|
+
presentations: z.string().optional(),
|
|
35
|
+
contracts: z.string().optional(),
|
|
36
|
+
handlers: z.string().optional(),
|
|
37
|
+
ui: z.string().optional(),
|
|
38
|
+
docs: z.string().optional()
|
|
39
|
+
}),
|
|
40
|
+
surfaces: z.object({
|
|
41
|
+
templates: z.boolean(),
|
|
42
|
+
sandbox: z.object({
|
|
43
|
+
enabled: z.boolean(),
|
|
44
|
+
modes: z.array(z.enum([
|
|
45
|
+
"playground",
|
|
46
|
+
"specs",
|
|
47
|
+
"builder",
|
|
48
|
+
"markdown",
|
|
49
|
+
"evolution"
|
|
50
|
+
]))
|
|
51
|
+
}),
|
|
52
|
+
studio: z.object({
|
|
53
|
+
enabled: z.boolean(),
|
|
54
|
+
installable: z.boolean()
|
|
55
|
+
}),
|
|
56
|
+
mcp: z.object({ enabled: z.boolean() })
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
function validateExamples(examples) {
|
|
60
|
+
const errors = [];
|
|
61
|
+
const seen = /* @__PURE__ */ new Set();
|
|
62
|
+
for (const example of examples) {
|
|
63
|
+
if (seen.has(example.id)) {
|
|
64
|
+
errors.push({
|
|
65
|
+
exampleId: example.id,
|
|
66
|
+
message: `Duplicate example id: ${example.id}`
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
seen.add(example.id);
|
|
71
|
+
const parsed = ExampleDefinitionSchema.safeParse(example);
|
|
72
|
+
if (!parsed.success) for (const issue of parsed.error.issues) errors.push({
|
|
73
|
+
exampleId: example.id,
|
|
74
|
+
message: issue.message,
|
|
75
|
+
path: issue.path.join(".")
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (errors.length) return {
|
|
79
|
+
ok: false,
|
|
80
|
+
errors
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
ok: true,
|
|
84
|
+
examples
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { validateExamples };
|
|
90
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","names":["errors: ExampleValidationError[]"],"sources":["../src/validate.ts"],"sourcesContent":["import { z } from 'zod';\nimport type { ExampleDefinition } from './types';\n\nconst ExampleDefinitionSchema = z.object({\n id: z.string().min(1),\n title: z.string().min(1),\n summary: z.string().min(1),\n tags: z.array(z.string()).default([]),\n kind: z.enum([\n 'template',\n 'workflow',\n 'integration',\n 'knowledge',\n 'blueprint',\n 'ui',\n 'script',\n 'library',\n ]),\n visibility: z.enum(['public', 'internal', 'mixed']),\n docs: z\n .object({\n rootDocId: z.string().optional(),\n goalDocId: z.string().optional(),\n usageDocId: z.string().optional(),\n referenceDocId: z.string().optional(),\n constraintsDocId: z.string().optional(),\n })\n .optional(),\n entrypoints: z.object({\n packageName: z.string().min(1),\n feature: z.string().optional(),\n presentations: z.string().optional(),\n contracts: z.string().optional(),\n handlers: z.string().optional(),\n ui: z.string().optional(),\n docs: z.string().optional(),\n }),\n surfaces: z.object({\n templates: z.boolean(),\n sandbox: z.object({\n enabled: z.boolean(),\n modes: z.array(\n z.enum(['playground', 'specs', 'builder', 'markdown', 'evolution'])\n ),\n }),\n studio: z.object({\n enabled: z.boolean(),\n installable: z.boolean(),\n }),\n mcp: z.object({\n enabled: z.boolean(),\n }),\n }),\n});\n\nexport interface ExampleValidationError {\n exampleId?: string;\n message: string;\n path?: string;\n}\n\nexport type ValidateExamplesResult =\n | { ok: true; examples: ExampleDefinition[] }\n | { ok: false; errors: ExampleValidationError[] };\n\nexport function validateExamples(\n examples: ExampleDefinition[]\n): ValidateExamplesResult {\n const errors: ExampleValidationError[] = [];\n\n const seen = new Set<string>();\n for (const example of examples) {\n if (seen.has(example.id)) {\n errors.push({\n exampleId: example.id,\n message: `Duplicate example id: ${example.id}`,\n });\n continue;\n }\n seen.add(example.id);\n\n const parsed = ExampleDefinitionSchema.safeParse(example);\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n errors.push({\n exampleId: example.id,\n message: issue.message,\n path: issue.path.join('.'),\n });\n }\n }\n }\n\n if (errors.length) return { ok: false, errors };\n return { ok: true, examples };\n}\n"],"mappings":";;;AAGA,MAAM,0BAA0B,EAAE,OAAO;CACvC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE;CACrB,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE;CACxB,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE;CAC1B,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;CACrC,MAAM,EAAE,KAAK;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,YAAY,EAAE,KAAK;EAAC;EAAU;EAAY;EAAQ,CAAC;CACnD,MAAM,EACH,OAAO;EACN,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,YAAY,EAAE,QAAQ,CAAC,UAAU;EACjC,gBAAgB,EAAE,QAAQ,CAAC,UAAU;EACrC,kBAAkB,EAAE,QAAQ,CAAC,UAAU;EACxC,CAAC,CACD,UAAU;CACb,aAAa,EAAE,OAAO;EACpB,aAAa,EAAE,QAAQ,CAAC,IAAI,EAAE;EAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC9B,eAAe,EAAE,QAAQ,CAAC,UAAU;EACpC,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,UAAU,EAAE,QAAQ,CAAC,UAAU;EAC/B,IAAI,EAAE,QAAQ,CAAC,UAAU;EACzB,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC5B,CAAC;CACF,UAAU,EAAE,OAAO;EACjB,WAAW,EAAE,SAAS;EACtB,SAAS,EAAE,OAAO;GAChB,SAAS,EAAE,SAAS;GACpB,OAAO,EAAE,MACP,EAAE,KAAK;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY,CAAC,CACpE;GACF,CAAC;EACF,QAAQ,EAAE,OAAO;GACf,SAAS,EAAE,SAAS;GACpB,aAAa,EAAE,SAAS;GACzB,CAAC;EACF,KAAK,EAAE,OAAO,EACZ,SAAS,EAAE,SAAS,EACrB,CAAC;EACH,CAAC;CACH,CAAC;AAYF,SAAgB,iBACd,UACwB;CACxB,MAAMA,SAAmC,EAAE;CAE3C,MAAM,uBAAO,IAAI,KAAa;AAC9B,MAAK,MAAM,WAAW,UAAU;AAC9B,MAAI,KAAK,IAAI,QAAQ,GAAG,EAAE;AACxB,UAAO,KAAK;IACV,WAAW,QAAQ;IACnB,SAAS,yBAAyB,QAAQ;IAC3C,CAAC;AACF;;AAEF,OAAK,IAAI,QAAQ,GAAG;EAEpB,MAAM,SAAS,wBAAwB,UAAU,QAAQ;AACzD,MAAI,CAAC,OAAO,QACV,MAAK,MAAM,SAAS,OAAO,MAAM,OAC/B,QAAO,KAAK;GACV,WAAW,QAAQ;GACnB,SAAS,MAAM;GACf,MAAM,MAAM,KAAK,KAAK,IAAI;GAC3B,CAAC;;AAKR,KAAI,OAAO,OAAQ,QAAO;EAAE,IAAI;EAAO;EAAQ;AAC/C,QAAO;EAAE,IAAI;EAAM;EAAU"}
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contractspec/module.examples",
|
|
3
|
+
"version": "1.44.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
14
|
+
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
15
|
+
"build": "bun build:types && bun build:bundle",
|
|
16
|
+
"build:bundle": "tsdown",
|
|
17
|
+
"build:types": "tsc --noEmit",
|
|
18
|
+
"dev": "bun build:bundle --watch",
|
|
19
|
+
"clean": "rimraf dist .turbo",
|
|
20
|
+
"lint": "bun lint:fix",
|
|
21
|
+
"lint:fix": "eslint src --fix",
|
|
22
|
+
"lint:check": "eslint src",
|
|
23
|
+
"test": "bun run"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@contractspec/example.agent-console": "1.44.0",
|
|
27
|
+
"@contractspec/example.ai-support-bot": "1.44.0",
|
|
28
|
+
"@contractspec/example.analytics-dashboard": "1.44.0",
|
|
29
|
+
"@contractspec/example.content-generation": "1.44.0",
|
|
30
|
+
"@contractspec/example.crm-pipeline": "1.44.0",
|
|
31
|
+
"@contractspec/example.integration-hub": "1.44.0",
|
|
32
|
+
"@contractspec/example.integration-stripe": "1.44.0",
|
|
33
|
+
"@contractspec/example.kb-update-pipeline": "1.44.0",
|
|
34
|
+
"@contractspec/example.knowledge-canon": "1.44.0",
|
|
35
|
+
"@contractspec/example.learning-patterns": "1.44.0",
|
|
36
|
+
"@contractspec/example.learning-journey-ambient-coach": "1.44.0",
|
|
37
|
+
"@contractspec/example.learning-journey-crm-onboarding": "1.44.0",
|
|
38
|
+
"@contractspec/example.learning-journey-duo-drills": "1.44.0",
|
|
39
|
+
"@contractspec/example.learning-journey-platform-tour": "1.44.0",
|
|
40
|
+
"@contractspec/example.learning-journey-quest-challenges": "1.44.0",
|
|
41
|
+
"@contractspec/example.learning-journey-registry": "1.44.0",
|
|
42
|
+
"@contractspec/example.learning-journey-studio-onboarding": "1.44.0",
|
|
43
|
+
"@contractspec/example.learning-journey-ui-coaching": "1.44.0",
|
|
44
|
+
"@contractspec/example.learning-journey-ui-gamified": "1.44.0",
|
|
45
|
+
"@contractspec/example.learning-journey-ui-onboarding": "1.44.0",
|
|
46
|
+
"@contractspec/example.learning-journey-ui-shared": "1.44.0",
|
|
47
|
+
"@contractspec/example.lifecycle-cli": "1.44.0",
|
|
48
|
+
"@contractspec/example.lifecycle-dashboard": "1.44.0",
|
|
49
|
+
"@contractspec/example.locale-jurisdiction-gate": "1.44.0",
|
|
50
|
+
"@contractspec/example.marketplace": "1.44.0",
|
|
51
|
+
"@contractspec/example.openbanking-powens": "1.44.0",
|
|
52
|
+
"@contractspec/example.personalization": "1.44.0",
|
|
53
|
+
"@contractspec/example.policy-safe-knowledge-assistant": "1.44.0",
|
|
54
|
+
"@contractspec/example.saas-boilerplate": "1.44.0",
|
|
55
|
+
"@contractspec/example.service-business-os": "1.44.0",
|
|
56
|
+
"@contractspec/example.versioned-knowledge-base": "1.44.0",
|
|
57
|
+
"@contractspec/example.team-hub": "1.44.0",
|
|
58
|
+
"@contractspec/example.wealth-snapshot": "1.44.0",
|
|
59
|
+
"@contractspec/example.workflow-system": "1.44.0",
|
|
60
|
+
"zod": "^4.1.13"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@contractspec/tool.tsdown": "1.44.0",
|
|
64
|
+
"@contractspec/tool.typescript": "1.44.0",
|
|
65
|
+
"tsdown": "^0.18.3",
|
|
66
|
+
"typescript": "^5.9.3"
|
|
67
|
+
},
|
|
68
|
+
"exports": {
|
|
69
|
+
".": "./dist/index.js",
|
|
70
|
+
"./*": "./*"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public",
|
|
74
|
+
"exports": {
|
|
75
|
+
".": "./dist/index.js",
|
|
76
|
+
"./*": "./*"
|
|
77
|
+
},
|
|
78
|
+
"registry": "https://registry.npmjs.org/"
|
|
79
|
+
},
|
|
80
|
+
"license": "MIT",
|
|
81
|
+
"repository": {
|
|
82
|
+
"type": "git",
|
|
83
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
84
|
+
"directory": "packages/modules/contractspec-examples"
|
|
85
|
+
},
|
|
86
|
+
"homepage": "https://contractspec.io"
|
|
87
|
+
}
|