digital-products 2.0.1
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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +9 -0
- package/README.md +535 -0
- package/dist/api.d.ts +99 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +129 -0
- package/dist/api.js.map +1 -0
- package/dist/app.d.ts +79 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +107 -0
- package/dist/app.js.map +1 -0
- package/dist/content.d.ts +58 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +78 -0
- package/dist/content.js.map +1 -0
- package/dist/data.d.ts +67 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +107 -0
- package/dist/data.js.map +1 -0
- package/dist/dataset.d.ts +32 -0
- package/dist/dataset.d.ts.map +1 -0
- package/dist/dataset.js +50 -0
- package/dist/dataset.js.map +1 -0
- package/dist/entities/ai.d.ts +53 -0
- package/dist/entities/ai.d.ts.map +1 -0
- package/dist/entities/ai.js +859 -0
- package/dist/entities/ai.js.map +1 -0
- package/dist/entities/content.d.ts +52 -0
- package/dist/entities/content.d.ts.map +1 -0
- package/dist/entities/content.js +784 -0
- package/dist/entities/content.js.map +1 -0
- package/dist/entities/index.d.ts +112 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +89 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/interfaces.d.ts +67 -0
- package/dist/entities/interfaces.d.ts.map +1 -0
- package/dist/entities/interfaces.js +930 -0
- package/dist/entities/interfaces.js.map +1 -0
- package/dist/entities/lifecycle.d.ts +51 -0
- package/dist/entities/lifecycle.d.ts.map +1 -0
- package/dist/entities/lifecycle.js +804 -0
- package/dist/entities/lifecycle.js.map +1 -0
- package/dist/entities/products.d.ts +53 -0
- package/dist/entities/products.d.ts.map +1 -0
- package/dist/entities/products.js +798 -0
- package/dist/entities/products.js.map +1 -0
- package/dist/entities/web.d.ts +44 -0
- package/dist/entities/web.d.ts.map +1 -0
- package/dist/entities/web.js +658 -0
- package/dist/entities/web.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +101 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +140 -0
- package/dist/mcp.js.map +1 -0
- package/dist/product.d.ts +37 -0
- package/dist/product.d.ts.map +1 -0
- package/dist/product.js +54 -0
- package/dist/product.js.map +1 -0
- package/dist/registry.d.ts +9 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +32 -0
- package/dist/registry.js.map +1 -0
- package/dist/sdk.d.ts +99 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +128 -0
- package/dist/sdk.js.map +1 -0
- package/dist/site.d.ts +85 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +113 -0
- package/dist/site.js.map +1 -0
- package/dist/types.d.ts +528 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/example.ts +236 -0
- package/package.json +35 -0
- package/src/api.ts +140 -0
- package/src/app.ts +117 -0
- package/src/content.ts +82 -0
- package/src/data.ts +129 -0
- package/src/dataset.ts +53 -0
- package/src/entities/ai.ts +932 -0
- package/src/entities/content.ts +851 -0
- package/src/entities/index.ts +156 -0
- package/src/entities/interfaces.ts +1017 -0
- package/src/entities/lifecycle.ts +872 -0
- package/src/entities/products.ts +867 -0
- package/src/entities/web.ts +719 -0
- package/src/index.ts +55 -0
- package/src/mcp.ts +163 -0
- package/src/product.ts +59 -0
- package/src/registry.ts +41 -0
- package/src/sdk.ts +148 -0
- package/src/site.ts +127 -0
- package/src/types.ts +558 -0
- package/test/api.test.ts +247 -0
- package/test/app.test.ts +220 -0
- package/test/content.test.ts +171 -0
- package/test/data.test.ts +201 -0
- package/test/dataset.test.ts +181 -0
- package/test/mcp.test.ts +230 -0
- package/test/product.test.ts +200 -0
- package/test/sdk.test.ts +236 -0
- package/test/site.test.ts +245 -0
- package/tsconfig.json +9 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* digital-products - Primitives for defining and building digital products
|
|
3
|
+
*
|
|
4
|
+
* This package provides primitives for defining digital products:
|
|
5
|
+
* - Apps: Interactive user-facing applications
|
|
6
|
+
* - APIs: Programmatic interfaces
|
|
7
|
+
* - Content: Text/media content with schemas
|
|
8
|
+
* - Data: Structured data definitions
|
|
9
|
+
* - Datasets: Curated data collections
|
|
10
|
+
* - Sites: Websites and documentation
|
|
11
|
+
* - MCPs: Model Context Protocol servers
|
|
12
|
+
* - SDKs: Software development kits
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
export * from './types.js';
|
|
17
|
+
export * as Nouns from './entities/index.js';
|
|
18
|
+
export { AllDigitalProductEntities, DigitalProductEntityCategories, Entities, ProductEntities, ProductCategories, InterfaceEntities, InterfaceCategories, ContentEntities, ContentCategories, WebEntities, WebCategories, AIEntities, AICategories, LifecycleEntities, LifecycleCategories, } from './entities/index.js';
|
|
19
|
+
export { registry } from './registry.js';
|
|
20
|
+
export { Product, createProduct, registerProduct } from './product.js';
|
|
21
|
+
export { App, Route, State, Auth } from './app.js';
|
|
22
|
+
export { API, Endpoint, APIAuth, RateLimit } from './api.js';
|
|
23
|
+
export { Content, Workflow } from './content.js';
|
|
24
|
+
export { Data, Index, Relationship, Validate } from './data.js';
|
|
25
|
+
export { Dataset } from './dataset.js';
|
|
26
|
+
export { Site, Nav, SEO, Analytics } from './site.js';
|
|
27
|
+
export { MCP, Tool, Resource, Prompt, MCPConfig } from './mcp.js';
|
|
28
|
+
export { SDK, Export, Example } from './sdk.js';
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,YAAY,CAAA;AAG1B,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAA;AAG5C,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,QAAQ,EAER,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* digital-products - Primitives for defining and building digital products
|
|
3
|
+
*
|
|
4
|
+
* This package provides primitives for defining digital products:
|
|
5
|
+
* - Apps: Interactive user-facing applications
|
|
6
|
+
* - APIs: Programmatic interfaces
|
|
7
|
+
* - Content: Text/media content with schemas
|
|
8
|
+
* - Data: Structured data definitions
|
|
9
|
+
* - Datasets: Curated data collections
|
|
10
|
+
* - Sites: Websites and documentation
|
|
11
|
+
* - MCPs: Model Context Protocol servers
|
|
12
|
+
* - SDKs: Software development kits
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
// Export all types
|
|
17
|
+
export * from './types.js';
|
|
18
|
+
// Export entity definitions (Nouns) as namespace to avoid conflicts with types
|
|
19
|
+
export * as Nouns from './entities/index.js';
|
|
20
|
+
// Also export individual entity collections for convenience
|
|
21
|
+
export { AllDigitalProductEntities, DigitalProductEntityCategories, Entities,
|
|
22
|
+
// Category exports
|
|
23
|
+
ProductEntities, ProductCategories, InterfaceEntities, InterfaceCategories, ContentEntities, ContentCategories, WebEntities, WebCategories, AIEntities, AICategories, LifecycleEntities, LifecycleCategories, } from './entities/index.js';
|
|
24
|
+
// Export registry
|
|
25
|
+
export { registry } from './registry.js';
|
|
26
|
+
// Export product constructors
|
|
27
|
+
export { Product, createProduct, registerProduct } from './product.js';
|
|
28
|
+
export { App, Route, State, Auth } from './app.js';
|
|
29
|
+
export { API, Endpoint, APIAuth, RateLimit } from './api.js';
|
|
30
|
+
export { Content, Workflow } from './content.js';
|
|
31
|
+
export { Data, Index, Relationship, Validate } from './data.js';
|
|
32
|
+
export { Dataset } from './dataset.js';
|
|
33
|
+
export { Site, Nav, SEO, Analytics } from './site.js';
|
|
34
|
+
export { MCP, Tool, Resource, Prompt, MCPConfig } from './mcp.js';
|
|
35
|
+
export { SDK, Export, Example } from './sdk.js';
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mBAAmB;AACnB,cAAc,YAAY,CAAA;AAE1B,+EAA+E;AAC/E,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAA;AAE5C,4DAA4D;AAC5D,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,QAAQ;AACR,mBAAmB;AACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAE5B,kBAAkB;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,8BAA8B;AAC9B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP() - Define a Model Context Protocol server
|
|
3
|
+
*/
|
|
4
|
+
import type { MCPDefinition, MCPTool, MCPResource, MCPPrompt, MCPConfig } from './types.js';
|
|
5
|
+
import type { SimpleSchema } from 'ai-functions';
|
|
6
|
+
/**
|
|
7
|
+
* Create an MCP server definition
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const mcpServer = MCP({
|
|
12
|
+
* id: 'my-mcp',
|
|
13
|
+
* name: 'My MCP Server',
|
|
14
|
+
* description: 'Custom MCP server for AI tools',
|
|
15
|
+
* version: '1.0.0',
|
|
16
|
+
* transport: 'stdio',
|
|
17
|
+
* tools: [
|
|
18
|
+
* Tool('searchFiles', 'Search for files in the project', {
|
|
19
|
+
* query: 'Search query',
|
|
20
|
+
* path: 'Directory to search in',
|
|
21
|
+
* }),
|
|
22
|
+
* Tool('readFile', 'Read file contents', {
|
|
23
|
+
* path: 'File path to read',
|
|
24
|
+
* }),
|
|
25
|
+
* ],
|
|
26
|
+
* resources: [
|
|
27
|
+
* Resource('file://', 'Project Files', 'Access to project files'),
|
|
28
|
+
* ],
|
|
29
|
+
* prompts: [
|
|
30
|
+
* Prompt('codeReview', 'Review code for best practices',
|
|
31
|
+
* 'Review the following code:\n\n{{code}}'),
|
|
32
|
+
* ],
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function MCP(config: Omit<MCPDefinition, 'type'>): MCPDefinition;
|
|
37
|
+
/**
|
|
38
|
+
* Helper to create an MCP tool
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const tool = Tool(
|
|
43
|
+
* 'searchCode',
|
|
44
|
+
* 'Search code using regex',
|
|
45
|
+
* {
|
|
46
|
+
* pattern: 'Regex pattern to search for',
|
|
47
|
+
* path: 'Directory to search in',
|
|
48
|
+
* },
|
|
49
|
+
* async (input) => {
|
|
50
|
+
* // Tool implementation
|
|
51
|
+
* return { matches: [] }
|
|
52
|
+
* }
|
|
53
|
+
* )
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function Tool(name: string, description: string, inputSchema: SimpleSchema, handler?: (input: unknown) => Promise<unknown>): MCPTool;
|
|
57
|
+
/**
|
|
58
|
+
* Helper to create an MCP resource
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const resource = Resource(
|
|
63
|
+
* 'file://project',
|
|
64
|
+
* 'Project Files',
|
|
65
|
+
* 'Access to all project files',
|
|
66
|
+
* 'application/json'
|
|
67
|
+
* )
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function Resource(uri: string, name: string, description: string, mimeType?: string): MCPResource;
|
|
71
|
+
/**
|
|
72
|
+
* Helper to create an MCP prompt
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const prompt = Prompt(
|
|
77
|
+
* 'summarize',
|
|
78
|
+
* 'Summarize text',
|
|
79
|
+
* 'Summarize the following:\n\n{{text}}',
|
|
80
|
+
* { text: 'Text to summarize' }
|
|
81
|
+
* )
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function Prompt(name: string, description: string, template: string, args?: SimpleSchema): MCPPrompt;
|
|
85
|
+
/**
|
|
86
|
+
* Helper to configure MCP server
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const config = MCPConfig({
|
|
91
|
+
* port: 3000,
|
|
92
|
+
* host: 'localhost',
|
|
93
|
+
* auth: {
|
|
94
|
+
* type: 'bearer',
|
|
95
|
+
* token: process.env.MCP_TOKEN,
|
|
96
|
+
* },
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function MCPConfig(config: MCPConfig): MCPConfig;
|
|
101
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,aAAa,CAkBtE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,YAAY,EACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAC7C,OAAO,CAOT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,WAAW,CAOb;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,YAAY,GAClB,SAAS,CAOX;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAEtD"}
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP() - Define a Model Context Protocol server
|
|
3
|
+
*/
|
|
4
|
+
import { registerProduct } from './product.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create an MCP server definition
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const mcpServer = MCP({
|
|
11
|
+
* id: 'my-mcp',
|
|
12
|
+
* name: 'My MCP Server',
|
|
13
|
+
* description: 'Custom MCP server for AI tools',
|
|
14
|
+
* version: '1.0.0',
|
|
15
|
+
* transport: 'stdio',
|
|
16
|
+
* tools: [
|
|
17
|
+
* Tool('searchFiles', 'Search for files in the project', {
|
|
18
|
+
* query: 'Search query',
|
|
19
|
+
* path: 'Directory to search in',
|
|
20
|
+
* }),
|
|
21
|
+
* Tool('readFile', 'Read file contents', {
|
|
22
|
+
* path: 'File path to read',
|
|
23
|
+
* }),
|
|
24
|
+
* ],
|
|
25
|
+
* resources: [
|
|
26
|
+
* Resource('file://', 'Project Files', 'Access to project files'),
|
|
27
|
+
* ],
|
|
28
|
+
* prompts: [
|
|
29
|
+
* Prompt('codeReview', 'Review code for best practices',
|
|
30
|
+
* 'Review the following code:\n\n{{code}}'),
|
|
31
|
+
* ],
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function MCP(config) {
|
|
36
|
+
const mcp = {
|
|
37
|
+
type: 'mcp',
|
|
38
|
+
id: config.id,
|
|
39
|
+
name: config.name,
|
|
40
|
+
description: config.description,
|
|
41
|
+
version: config.version,
|
|
42
|
+
transport: config.transport,
|
|
43
|
+
tools: config.tools,
|
|
44
|
+
resources: config.resources,
|
|
45
|
+
prompts: config.prompts,
|
|
46
|
+
config: config.config,
|
|
47
|
+
metadata: config.metadata,
|
|
48
|
+
tags: config.tags,
|
|
49
|
+
status: config.status || 'active',
|
|
50
|
+
};
|
|
51
|
+
return registerProduct(mcp);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Helper to create an MCP tool
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const tool = Tool(
|
|
59
|
+
* 'searchCode',
|
|
60
|
+
* 'Search code using regex',
|
|
61
|
+
* {
|
|
62
|
+
* pattern: 'Regex pattern to search for',
|
|
63
|
+
* path: 'Directory to search in',
|
|
64
|
+
* },
|
|
65
|
+
* async (input) => {
|
|
66
|
+
* // Tool implementation
|
|
67
|
+
* return { matches: [] }
|
|
68
|
+
* }
|
|
69
|
+
* )
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export function Tool(name, description, inputSchema, handler) {
|
|
73
|
+
return {
|
|
74
|
+
name,
|
|
75
|
+
description,
|
|
76
|
+
inputSchema,
|
|
77
|
+
handler,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Helper to create an MCP resource
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const resource = Resource(
|
|
86
|
+
* 'file://project',
|
|
87
|
+
* 'Project Files',
|
|
88
|
+
* 'Access to all project files',
|
|
89
|
+
* 'application/json'
|
|
90
|
+
* )
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function Resource(uri, name, description, mimeType) {
|
|
94
|
+
return {
|
|
95
|
+
uri,
|
|
96
|
+
name,
|
|
97
|
+
description,
|
|
98
|
+
mimeType,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Helper to create an MCP prompt
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const prompt = Prompt(
|
|
107
|
+
* 'summarize',
|
|
108
|
+
* 'Summarize text',
|
|
109
|
+
* 'Summarize the following:\n\n{{text}}',
|
|
110
|
+
* { text: 'Text to summarize' }
|
|
111
|
+
* )
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export function Prompt(name, description, template, args) {
|
|
115
|
+
return {
|
|
116
|
+
name,
|
|
117
|
+
description,
|
|
118
|
+
template,
|
|
119
|
+
arguments: args,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Helper to configure MCP server
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const config = MCPConfig({
|
|
128
|
+
* port: 3000,
|
|
129
|
+
* host: 'localhost',
|
|
130
|
+
* auth: {
|
|
131
|
+
* type: 'bearer',
|
|
132
|
+
* token: process.env.MCP_TOKEN,
|
|
133
|
+
* },
|
|
134
|
+
* })
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export function MCPConfig(config) {
|
|
138
|
+
return config;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,GAAG,CAAC,MAAmC;IACrD,MAAM,GAAG,GAAkB;QACzB,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;KAClC,CAAA;IAED,OAAO,eAAe,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,IAAI,CAClB,IAAY,EACZ,WAAmB,EACnB,WAAyB,EACzB,OAA8C;IAE9C,OAAO;QACL,IAAI;QACJ,WAAW;QACX,WAAW;QACX,OAAO;KACR,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAW,EACX,IAAY,EACZ,WAAmB,EACnB,QAAiB;IAEjB,OAAO;QACL,GAAG;QACH,IAAI;QACJ,WAAW;QACX,QAAQ;KACT,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,MAAM,CACpB,IAAY,EACZ,WAAmB,EACnB,QAAgB,EAChB,IAAmB;IAEnB,OAAO;QACL,IAAI;QACJ,WAAW;QACX,QAAQ;QACR,SAAS,EAAE,IAAI;KAChB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS,CAAC,MAAiB;IACzC,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Product() constructor
|
|
3
|
+
*/
|
|
4
|
+
import type { DigitalProduct, ProductDefinition } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create a generic digital product definition
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const product = Product({
|
|
11
|
+
* id: 'my-product',
|
|
12
|
+
* name: 'My Product',
|
|
13
|
+
* description: 'A digital product',
|
|
14
|
+
* version: '1.0.0',
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function Product(config: Omit<DigitalProduct, 'type'>): DigitalProduct;
|
|
19
|
+
/**
|
|
20
|
+
* Create and register a product in one step
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const product = createProduct({
|
|
25
|
+
* id: 'my-product',
|
|
26
|
+
* name: 'My Product',
|
|
27
|
+
* description: 'A digital product',
|
|
28
|
+
* version: '1.0.0',
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function createProduct(config: Omit<DigitalProduct, 'type'>): DigitalProduct;
|
|
33
|
+
/**
|
|
34
|
+
* Create and register any product definition
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerProduct<T extends ProductDefinition>(product: T): T;
|
|
37
|
+
//# sourceMappingURL=product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAGnE;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,cAAc,CAY5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,cAAc,CAGlF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,iBAAiB,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAG1E"}
|
package/dist/product.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Product() constructor
|
|
3
|
+
*/
|
|
4
|
+
import { registry } from './registry.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create a generic digital product definition
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const product = Product({
|
|
11
|
+
* id: 'my-product',
|
|
12
|
+
* name: 'My Product',
|
|
13
|
+
* description: 'A digital product',
|
|
14
|
+
* version: '1.0.0',
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function Product(config) {
|
|
19
|
+
const product = {
|
|
20
|
+
id: config.id,
|
|
21
|
+
name: config.name,
|
|
22
|
+
description: config.description,
|
|
23
|
+
version: config.version,
|
|
24
|
+
metadata: config.metadata,
|
|
25
|
+
tags: config.tags,
|
|
26
|
+
status: config.status || 'active',
|
|
27
|
+
};
|
|
28
|
+
return product;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create and register a product in one step
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const product = createProduct({
|
|
36
|
+
* id: 'my-product',
|
|
37
|
+
* name: 'My Product',
|
|
38
|
+
* description: 'A digital product',
|
|
39
|
+
* version: '1.0.0',
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function createProduct(config) {
|
|
44
|
+
const product = Product(config);
|
|
45
|
+
return product;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create and register any product definition
|
|
49
|
+
*/
|
|
50
|
+
export function registerProduct(product) {
|
|
51
|
+
registry.register(product);
|
|
52
|
+
return product;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../src/product.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,OAAO,CAAC,MAAoC;IAC1D,MAAM,OAAO,GAAmB;QAC9B,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;KAClC,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoC;IAChE,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,OAAO,CAAA;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAA8B,OAAU;IACrE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1B,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAqB,eAAe,EAAE,MAAM,YAAY,CAAA;AAiCpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,eAA+C,CAAA"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product registry implementation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* In-memory product registry
|
|
6
|
+
*/
|
|
7
|
+
class InMemoryProductRegistry {
|
|
8
|
+
products = new Map();
|
|
9
|
+
register(product) {
|
|
10
|
+
this.products.set(product.id, product);
|
|
11
|
+
}
|
|
12
|
+
get(id) {
|
|
13
|
+
return this.products.get(id);
|
|
14
|
+
}
|
|
15
|
+
list() {
|
|
16
|
+
return Array.from(this.products.values());
|
|
17
|
+
}
|
|
18
|
+
listByType(type) {
|
|
19
|
+
return this.list().filter((p) => p.type === type);
|
|
20
|
+
}
|
|
21
|
+
remove(id) {
|
|
22
|
+
return this.products.delete(id);
|
|
23
|
+
}
|
|
24
|
+
clear() {
|
|
25
|
+
this.products.clear();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Global product registry instance
|
|
30
|
+
*/
|
|
31
|
+
export const registry = new InMemoryProductRegistry();
|
|
32
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,uBAAuB;IACnB,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAA;IAEvD,QAAQ,CAAC,OAA0B;QACjC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACxC,CAAC;IAED,GAAG,CAAC,EAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED,UAAU,CAAsC,IAAO;QACrD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAA8C,CAAA;IAChG,CAAC;IAED,MAAM,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACjC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAoB,IAAI,uBAAuB,EAAE,CAAA"}
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK() - Define a software development kit
|
|
3
|
+
*/
|
|
4
|
+
import type { SDKDefinition, SDKExport, SDKExample } from './types.js';
|
|
5
|
+
import type { SimpleSchema } from 'ai-functions';
|
|
6
|
+
/**
|
|
7
|
+
* Create an SDK definition
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const mySDK = SDK({
|
|
12
|
+
* id: 'my-sdk',
|
|
13
|
+
* name: 'My SDK',
|
|
14
|
+
* description: 'JavaScript SDK for My API',
|
|
15
|
+
* version: '1.0.0',
|
|
16
|
+
* language: 'typescript',
|
|
17
|
+
* api: 'my-api',
|
|
18
|
+
* exports: [
|
|
19
|
+
* Export('function', 'createClient', 'Create an API client', {
|
|
20
|
+
* parameters: {
|
|
21
|
+
* apiKey: 'API key for authentication',
|
|
22
|
+
* baseUrl: 'Optional base URL',
|
|
23
|
+
* },
|
|
24
|
+
* returns: 'API client instance',
|
|
25
|
+
* }),
|
|
26
|
+
* Export('class', 'APIClient', 'Main API client', {
|
|
27
|
+
* methods: [
|
|
28
|
+
* Export('function', 'get', 'GET request', {
|
|
29
|
+
* parameters: { path: 'Request path' },
|
|
30
|
+
* returns: 'Response data',
|
|
31
|
+
* }),
|
|
32
|
+
* Export('function', 'post', 'POST request', {
|
|
33
|
+
* parameters: { path: 'Request path', data: 'Request body' },
|
|
34
|
+
* returns: 'Response data',
|
|
35
|
+
* }),
|
|
36
|
+
* ],
|
|
37
|
+
* }),
|
|
38
|
+
* ],
|
|
39
|
+
* install: 'npm install my-sdk',
|
|
40
|
+
* examples: [
|
|
41
|
+
* Example(
|
|
42
|
+
* 'Basic Usage',
|
|
43
|
+
* 'Create a client and make a request',
|
|
44
|
+
* `import { createClient } from 'my-sdk'
|
|
45
|
+
*
|
|
46
|
+
* const client = createClient({ apiKey: 'YOUR_API_KEY' })
|
|
47
|
+
* const users = await client.get('/users')
|
|
48
|
+
* console.log(users)`
|
|
49
|
+
* ),
|
|
50
|
+
* ],
|
|
51
|
+
* })
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function SDK(config: Omit<SDKDefinition, 'type'>): SDKDefinition;
|
|
55
|
+
/**
|
|
56
|
+
* Helper to create an SDK export
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const fn = Export('function', 'calculateTotal', 'Calculate order total', {
|
|
61
|
+
* parameters: {
|
|
62
|
+
* items: ['Array of order items'],
|
|
63
|
+
* taxRate: 'Tax rate (number)',
|
|
64
|
+
* },
|
|
65
|
+
* returns: 'Total amount (number)',
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* const cls = Export('class', 'OrderManager', 'Manage orders', {
|
|
69
|
+
* methods: [
|
|
70
|
+
* Export('function', 'create', 'Create order', {
|
|
71
|
+
* parameters: { order: 'Order data' },
|
|
72
|
+
* returns: 'Created order',
|
|
73
|
+
* }),
|
|
74
|
+
* ],
|
|
75
|
+
* })
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function Export(type: SDKExport['type'], name: string, description: string, options?: {
|
|
79
|
+
parameters?: SimpleSchema;
|
|
80
|
+
returns?: SimpleSchema;
|
|
81
|
+
methods?: SDKExport[];
|
|
82
|
+
}): SDKExport;
|
|
83
|
+
/**
|
|
84
|
+
* Helper to create an SDK example
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const example = Example(
|
|
89
|
+
* 'Authentication',
|
|
90
|
+
* 'How to authenticate with the API',
|
|
91
|
+
* `const client = createClient({
|
|
92
|
+
* apiKey: process.env.API_KEY,
|
|
93
|
+
* })`,
|
|
94
|
+
* '{ authenticated: true }'
|
|
95
|
+
* )
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function Example(title: string, description: string, code: string, output?: string): SDKExample;
|
|
99
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,aAAa,CAmBtE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EACvB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;CACtB,GACA,SAAS,CASX;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,GACd,UAAU,CAOZ"}
|