@livestore/cli 0.4.0-dev.9 → 0.5.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/fixtures/mock-config.d.ts +63 -0
- package/dist/__tests__/fixtures/mock-config.d.ts.map +1 -0
- package/dist/__tests__/fixtures/mock-config.js +94 -0
- package/dist/__tests__/fixtures/mock-config.js.map +1 -0
- package/dist/__tests__/sync-operations.test.d.ts +2 -0
- package/dist/__tests__/sync-operations.test.d.ts.map +1 -0
- package/dist/__tests__/sync-operations.test.js +167 -0
- package/dist/__tests__/sync-operations.test.js.map +1 -0
- package/dist/bin.js +6 -5
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +2 -9
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/__fixtures__/mcp-protocol-server.d.ts +2 -0
- package/dist/commands/__fixtures__/mcp-protocol-server.d.ts.map +1 -0
- package/dist/commands/__fixtures__/mcp-protocol-server.js +10 -0
- package/dist/commands/__fixtures__/mcp-protocol-server.js.map +1 -0
- package/dist/commands/import-export.d.ts +20 -0
- package/dist/commands/import-export.d.ts.map +1 -0
- package/dist/commands/import-export.js +135 -0
- package/dist/commands/import-export.js.map +1 -0
- package/dist/commands/mcp-coach.d.ts +21 -12
- package/dist/commands/mcp-coach.d.ts.map +1 -1
- package/dist/commands/mcp-coach.js +49 -53
- package/dist/commands/mcp-coach.js.map +1 -1
- package/dist/commands/mcp-protocols.d.ts +7 -0
- package/dist/commands/mcp-protocols.d.ts.map +1 -0
- package/dist/commands/mcp-protocols.js +12 -0
- package/dist/commands/mcp-protocols.js.map +1 -0
- package/dist/commands/mcp-protocols.test.d.ts +2 -0
- package/dist/commands/mcp-protocols.test.d.ts.map +1 -0
- package/dist/commands/mcp-protocols.test.js +60 -0
- package/dist/commands/mcp-protocols.test.js.map +1 -0
- package/dist/commands/mcp-stdio.test.d.ts +2 -0
- package/dist/commands/mcp-stdio.test.d.ts.map +1 -0
- package/dist/commands/mcp-stdio.test.js +79 -0
- package/dist/commands/mcp-stdio.test.js.map +1 -0
- package/dist/commands/mcp-tool-handlers.d.ts +6 -0
- package/dist/commands/mcp-tool-handlers.d.ts.map +1 -0
- package/dist/commands/{mcp-tools.js → mcp-tool-handlers.js} +80 -45
- package/dist/commands/mcp-tool-handlers.js.map +1 -0
- package/dist/commands/mcp-tools-defs.d.ts +134 -0
- package/dist/commands/mcp-tools-defs.d.ts.map +1 -0
- package/dist/commands/mcp-tools-defs.js +285 -0
- package/dist/commands/mcp-tools-defs.js.map +1 -0
- package/dist/commands/mcp-tools-defs.test.d.ts +2 -0
- package/dist/commands/mcp-tools-defs.test.d.ts.map +1 -0
- package/dist/commands/mcp-tools-defs.test.js +11 -0
- package/dist/commands/mcp-tools-defs.test.js.map +1 -0
- package/dist/commands/mcp.d.ts +1 -3
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +7 -5
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/new-project.d.ts +22 -23
- package/dist/commands/new-project.d.ts.map +1 -1
- package/dist/commands/new-project.js +85 -44
- package/dist/commands/new-project.js.map +1 -1
- package/dist/mcp-content/architecture.d.ts +1 -1
- package/dist/mcp-content/architecture.d.ts.map +1 -1
- package/dist/mcp-content/architecture.js +3 -3
- package/dist/mcp-content/features.d.ts +1 -1
- package/dist/mcp-content/features.d.ts.map +1 -1
- package/dist/mcp-content/features.js +1 -1
- package/dist/mcp-content/getting-started.d.ts +1 -1
- package/dist/mcp-content/getting-started.d.ts.map +1 -1
- package/dist/mcp-content/getting-started.js +37 -37
- package/dist/mcp-content/overview.d.ts +1 -1
- package/dist/mcp-content/overview.d.ts.map +1 -1
- package/dist/mcp-content/overview.js +6 -6
- package/dist/mcp-content/schemas/blog.d.ts +1 -1
- package/dist/mcp-content/schemas/blog.d.ts.map +1 -1
- package/dist/mcp-content/schemas/blog.js +25 -25
- package/dist/mcp-content/schemas/ecommerce.d.ts +1 -1
- package/dist/mcp-content/schemas/ecommerce.d.ts.map +1 -1
- package/dist/mcp-content/schemas/ecommerce.js +67 -67
- package/dist/mcp-content/schemas/social.d.ts +1 -1
- package/dist/mcp-content/schemas/social.d.ts.map +1 -1
- package/dist/mcp-content/schemas/social.js +48 -48
- package/dist/mcp-content/schemas/todo.d.ts +1 -1
- package/dist/mcp-content/schemas/todo.d.ts.map +1 -1
- package/dist/mcp-content/schemas/todo.js +35 -35
- package/dist/mcp-runtime/runtime.d.ts +48 -0
- package/dist/mcp-runtime/runtime.d.ts.map +1 -0
- package/dist/mcp-runtime/runtime.js +107 -0
- package/dist/mcp-runtime/runtime.js.map +1 -0
- package/dist/module-loader.d.ts +22 -0
- package/dist/module-loader.d.ts.map +1 -0
- package/dist/module-loader.js +75 -0
- package/dist/module-loader.js.map +1 -0
- package/dist/package-manager.d.ts +38 -0
- package/dist/package-manager.d.ts.map +1 -0
- package/dist/package-manager.js +33 -0
- package/dist/package-manager.js.map +1 -0
- package/dist/package-manager.test.d.ts +2 -0
- package/dist/package-manager.test.d.ts.map +1 -0
- package/dist/package-manager.test.js +57 -0
- package/dist/package-manager.test.js.map +1 -0
- package/dist/sync-operations.d.ts +115 -0
- package/dist/sync-operations.d.ts.map +1 -0
- package/dist/sync-operations.js +178 -0
- package/dist/sync-operations.js.map +1 -0
- package/package.json +57 -15
- package/src/__tests__/fixtures/mock-config.ts +112 -0
- package/src/__tests__/sync-operations.test.ts +218 -0
- package/src/bin.ts +8 -6
- package/src/cli.ts +5 -6
- package/src/commands/__fixtures__/mcp-protocol-server.ts +12 -0
- package/src/commands/import-export.ts +283 -0
- package/src/commands/mcp-coach.ts +76 -75
- package/src/commands/mcp-protocols.test.ts +76 -0
- package/src/commands/mcp-protocols.ts +12 -0
- package/src/commands/mcp-stdio.test.ts +93 -0
- package/src/commands/{mcp-tools.ts → mcp-tool-handlers.ts} +100 -61
- package/src/commands/mcp-tools-defs.test.ts +13 -0
- package/src/commands/mcp-tools-defs.ts +320 -0
- package/src/commands/mcp.ts +10 -6
- package/src/commands/new-project.ts +124 -57
- package/src/mcp-content/architecture.ts +3 -3
- package/src/mcp-content/features.ts +1 -1
- package/src/mcp-content/getting-started.ts +37 -37
- package/src/mcp-content/overview.ts +6 -6
- package/src/mcp-content/schemas/blog.ts +25 -25
- package/src/mcp-content/schemas/ecommerce.ts +67 -67
- package/src/mcp-content/schemas/social.ts +48 -48
- package/src/mcp-content/schemas/todo.ts +35 -35
- package/src/mcp-runtime/runtime.ts +147 -0
- package/src/module-loader.ts +94 -0
- package/src/package-manager.test.ts +66 -0
- package/src/package-manager.ts +44 -0
- package/src/sync-operations.ts +360 -0
- package/dist/commands/mcp-tools.d.ts +0 -58
- package/dist/commands/mcp-tools.d.ts.map +0 -1
- package/dist/commands/mcp-tools.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Tool, Toolkit } from 'effect/unstable/ai';
|
|
2
|
+
import { Schema } from '@livestore/utils/effect';
|
|
3
|
+
export declare const livestoreToolkit: Toolkit.Toolkit<{
|
|
4
|
+
readonly livestore_coach: Tool.Tool<"livestore_coach", {
|
|
5
|
+
readonly parameters: Schema.Struct<{
|
|
6
|
+
readonly code: Schema.String;
|
|
7
|
+
readonly codeType: Schema.optional<Schema.String>;
|
|
8
|
+
}>;
|
|
9
|
+
readonly success: Schema.Struct<{
|
|
10
|
+
readonly feedback: Schema.String;
|
|
11
|
+
readonly score: Schema.optional<Schema.Number>;
|
|
12
|
+
readonly suggestions: Schema.$Array<Schema.String>;
|
|
13
|
+
}>;
|
|
14
|
+
readonly failure: typeof import("effect/unstable/ai/AiError").AiError;
|
|
15
|
+
readonly failureMode: "error";
|
|
16
|
+
}, never>;
|
|
17
|
+
readonly livestore_generate_schema: Tool.Tool<"livestore_generate_schema", {
|
|
18
|
+
readonly parameters: Schema.Struct<{
|
|
19
|
+
readonly schemaType: Schema.String;
|
|
20
|
+
readonly customDescription: Schema.optional<Schema.String>;
|
|
21
|
+
}>;
|
|
22
|
+
readonly success: Schema.Struct<{
|
|
23
|
+
readonly schemaCode: Schema.String;
|
|
24
|
+
readonly explanation: Schema.String;
|
|
25
|
+
}>;
|
|
26
|
+
readonly failure: Schema.Never;
|
|
27
|
+
readonly failureMode: "error";
|
|
28
|
+
}, never>;
|
|
29
|
+
readonly livestore_get_example_schema: Tool.Tool<"livestore_get_example_schema", {
|
|
30
|
+
readonly parameters: Schema.Struct<{
|
|
31
|
+
readonly type: Schema.String;
|
|
32
|
+
}>;
|
|
33
|
+
readonly success: Schema.Struct<{
|
|
34
|
+
readonly schemaCode: Schema.String;
|
|
35
|
+
readonly description: Schema.String;
|
|
36
|
+
}>;
|
|
37
|
+
readonly failure: Schema.Never;
|
|
38
|
+
readonly failureMode: "error";
|
|
39
|
+
}, never>;
|
|
40
|
+
readonly livestore_instance_connect: Tool.Tool<"livestore_instance_connect", {
|
|
41
|
+
readonly parameters: Schema.Struct<{
|
|
42
|
+
readonly configPath: Schema.String;
|
|
43
|
+
readonly storeId: Schema.String;
|
|
44
|
+
readonly clientId: Schema.optional<Schema.String>;
|
|
45
|
+
readonly sessionId: Schema.optional<Schema.String>;
|
|
46
|
+
}>;
|
|
47
|
+
readonly success: Schema.Struct<{
|
|
48
|
+
readonly storeId: Schema.String;
|
|
49
|
+
readonly clientId: Schema.String;
|
|
50
|
+
readonly sessionId: Schema.String;
|
|
51
|
+
readonly schemaInfo: Schema.Struct<{
|
|
52
|
+
readonly tableNames: Schema.$Array<Schema.String>;
|
|
53
|
+
readonly eventNames: Schema.$Array<Schema.String>;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
readonly failure: Schema.Never;
|
|
57
|
+
readonly failureMode: "error";
|
|
58
|
+
}, never>;
|
|
59
|
+
readonly livestore_instance_query: Tool.Tool<"livestore_instance_query", {
|
|
60
|
+
readonly parameters: Schema.Struct<{
|
|
61
|
+
readonly sql: Schema.String;
|
|
62
|
+
readonly bindValues: Schema.Union<readonly [Schema.$Array<Schema.Codec<Schema.Json, Schema.Json, never, never>>, Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
|
|
63
|
+
}>;
|
|
64
|
+
readonly success: Schema.Struct<{
|
|
65
|
+
readonly rows: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
66
|
+
readonly rowCount: Schema.Number;
|
|
67
|
+
}>;
|
|
68
|
+
readonly failure: Schema.Never;
|
|
69
|
+
readonly failureMode: "error";
|
|
70
|
+
}, never>;
|
|
71
|
+
readonly livestore_instance_commit_events: Tool.Tool<"livestore_instance_commit_events", {
|
|
72
|
+
readonly parameters: Schema.Struct<{
|
|
73
|
+
readonly events: Schema.$Array<Schema.Struct<{
|
|
74
|
+
readonly name: Schema.String;
|
|
75
|
+
readonly args: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
76
|
+
}>>;
|
|
77
|
+
}>;
|
|
78
|
+
readonly success: Schema.Struct<{
|
|
79
|
+
readonly committed: Schema.Number;
|
|
80
|
+
}>;
|
|
81
|
+
readonly failure: Schema.Never;
|
|
82
|
+
readonly failureMode: "error";
|
|
83
|
+
}, never>;
|
|
84
|
+
readonly livestore_instance_status: Tool.Tool<"livestore_instance_status", {
|
|
85
|
+
readonly parameters: Tool.EmptyParams;
|
|
86
|
+
readonly success: Schema.Union<readonly [Schema.TaggedStruct<"connected", {
|
|
87
|
+
readonly storeId: Schema.String;
|
|
88
|
+
readonly clientId: Schema.String;
|
|
89
|
+
readonly sessionId: Schema.String;
|
|
90
|
+
readonly tableCounts: Schema.$Record<Schema.String, Schema.Number>;
|
|
91
|
+
}>, Schema.TaggedStruct<"disconnected", {}>]>;
|
|
92
|
+
readonly failure: Schema.Never;
|
|
93
|
+
readonly failureMode: "error";
|
|
94
|
+
}, never>;
|
|
95
|
+
readonly livestore_instance_disconnect: Tool.Tool<"livestore_instance_disconnect", {
|
|
96
|
+
readonly parameters: Tool.EmptyParams;
|
|
97
|
+
readonly success: Schema.TaggedStruct<"disconnected", {}>;
|
|
98
|
+
readonly failure: Schema.Never;
|
|
99
|
+
readonly failureMode: "error";
|
|
100
|
+
}, never>;
|
|
101
|
+
readonly livestore_sync_export: Tool.Tool<"livestore_sync_export", {
|
|
102
|
+
readonly parameters: Schema.Struct<{
|
|
103
|
+
readonly configPath: Schema.String;
|
|
104
|
+
readonly storeId: Schema.String;
|
|
105
|
+
readonly clientId: Schema.optional<Schema.String>;
|
|
106
|
+
}>;
|
|
107
|
+
readonly success: Schema.Struct<{
|
|
108
|
+
readonly storeId: Schema.String;
|
|
109
|
+
readonly eventCount: Schema.Number;
|
|
110
|
+
readonly exportedAt: Schema.String;
|
|
111
|
+
readonly data: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
112
|
+
}>;
|
|
113
|
+
readonly failure: Schema.Never;
|
|
114
|
+
readonly failureMode: "error";
|
|
115
|
+
}, never>;
|
|
116
|
+
readonly livestore_sync_import: Tool.Tool<"livestore_sync_import", {
|
|
117
|
+
readonly parameters: Schema.Struct<{
|
|
118
|
+
readonly configPath: Schema.String;
|
|
119
|
+
readonly storeId: Schema.String;
|
|
120
|
+
readonly clientId: Schema.optional<Schema.String>;
|
|
121
|
+
readonly data: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
122
|
+
readonly force: Schema.optional<Schema.Boolean>;
|
|
123
|
+
readonly dryRun: Schema.optional<Schema.Boolean>;
|
|
124
|
+
}>;
|
|
125
|
+
readonly success: Schema.Struct<{
|
|
126
|
+
readonly storeId: Schema.String;
|
|
127
|
+
readonly eventCount: Schema.Number;
|
|
128
|
+
readonly dryRun: Schema.Boolean;
|
|
129
|
+
}>;
|
|
130
|
+
readonly failure: Schema.Never;
|
|
131
|
+
readonly failureMode: "error";
|
|
132
|
+
}, never>;
|
|
133
|
+
}>;
|
|
134
|
+
//# sourceMappingURL=mcp-tools-defs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools-defs.d.ts","sourceRoot":"","sources":["../../src/commands/mcp-tools-defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAIhD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyT5B,CAAA"}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { Tool, Toolkit } from 'effect/unstable/ai';
|
|
2
|
+
import { Schema } from '@livestore/utils/effect';
|
|
3
|
+
import { coachTool } from "./mcp-coach.js";
|
|
4
|
+
export const livestoreToolkit = Toolkit.make(coachTool, Tool.make('livestore_generate_schema', {
|
|
5
|
+
description: 'Generate a LiveStore schema for a specific use case. Choose from predefined types (todo, blog, social, ecommerce) or request a custom schema by providing a description.',
|
|
6
|
+
parameters: Schema.Struct({
|
|
7
|
+
schemaType: Schema.String.annotate({
|
|
8
|
+
description: "Schema type: 'todo', 'blog', 'social', 'ecommerce', or 'custom'",
|
|
9
|
+
}),
|
|
10
|
+
customDescription: Schema.optional(Schema.String.annotate({
|
|
11
|
+
description: "For custom schemas: describe your data model needs (e.g., 'user management system with roles and permissions')",
|
|
12
|
+
})),
|
|
13
|
+
}),
|
|
14
|
+
success: Schema.Struct({
|
|
15
|
+
schemaCode: Schema.String.annotate({ description: 'The generated LiveStore schema TypeScript code' }),
|
|
16
|
+
explanation: Schema.String.annotate({ description: 'Brief explanation of the schema structure' }),
|
|
17
|
+
}),
|
|
18
|
+
}), Tool.make('livestore_get_example_schema', {
|
|
19
|
+
description: 'Get a complete example LiveStore schema with TypeScript code. Returns ready-to-use schema definitions for common application types.',
|
|
20
|
+
parameters: Schema.Struct({
|
|
21
|
+
type: Schema.String.annotate({ description: "Example type: 'todo', 'blog', 'social', or 'ecommerce'" }),
|
|
22
|
+
}),
|
|
23
|
+
success: Schema.Struct({
|
|
24
|
+
schemaCode: Schema.String.annotate({ description: 'The complete LiveStore schema code' }),
|
|
25
|
+
description: Schema.String.annotate({ description: 'Description of what this schema models' }),
|
|
26
|
+
}),
|
|
27
|
+
})
|
|
28
|
+
.annotate(Tool.Readonly, true)
|
|
29
|
+
.annotate(Tool.Destructive, false), Tool.make('livestore_instance_connect', {
|
|
30
|
+
description: `Connect a LiveStore instance (one active per MCP session) by dynamically importing a user module that exports a LiveStore \`schema\` and a \`syncBackend\` factory (and optionally \`syncPayload\`).
|
|
31
|
+
Notes:
|
|
32
|
+
- Only one instance can be active at a time; calling connect again shuts down and replaces the previous instance.
|
|
33
|
+
- Reconnecting creates a fresh, in-memory client database. The state visible to queries is populated by your backend's initial sync behavior; depending on configuration, you may briefly observe empty or partial data until sync completes.
|
|
34
|
+
- \`configPath\` is resolved relative to the current working directory.
|
|
35
|
+
- \`syncBackend\` must be a function (factory) that returns a backend; \`syncPayload\` must be JSON-serializable.
|
|
36
|
+
|
|
37
|
+
Module contract (generic example):
|
|
38
|
+
\`\`\`ts
|
|
39
|
+
// Choose any supported sync provider for your deployment
|
|
40
|
+
import { makeWsSync } from '@livestore/sync-cf/client' // or your own provider
|
|
41
|
+
|
|
42
|
+
// Export your app's schema
|
|
43
|
+
export { schema } from './src/livestore/schema.ts'
|
|
44
|
+
|
|
45
|
+
// Provide a sync backend (e.g., WebSocket). Configure via env in practice.
|
|
46
|
+
export const syncBackend = makeWsSync({ url: process.env.LIVESTORE_SYNC_URL ?? 'ws://localhost:8787' })
|
|
47
|
+
|
|
48
|
+
// Optionally, pass an auth payload for your backend (must be JSON-serializable)
|
|
49
|
+
export const syncPayload = { authToken: process.env.LIVESTORE_SYNC_AUTH_TOKEN ?? 'insecure-token-change-me' }
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
Connect parameters:
|
|
53
|
+
{
|
|
54
|
+
"configPath": "livestore-cli.config.ts",
|
|
55
|
+
"storeId": "<store-id>"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Optional identifiers to group client state on the server:
|
|
59
|
+
{
|
|
60
|
+
"configPath": "livestore-cli.config.ts",
|
|
61
|
+
"storeId": "<store-id>",
|
|
62
|
+
"clientId": "<client-id>",
|
|
63
|
+
"sessionId": "<session-id>"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Returns on success:
|
|
67
|
+
{
|
|
68
|
+
"storeId": "<store-id>",
|
|
69
|
+
"clientId": "<client-id>",
|
|
70
|
+
"sessionId": "<session-id>",
|
|
71
|
+
"schemaInfo": {
|
|
72
|
+
"tableNames": ["<table-1>", "<table-2>", "..."],
|
|
73
|
+
"eventNames": ["<event-name-1>", "<event-name-2>", "..."]
|
|
74
|
+
}
|
|
75
|
+
}`,
|
|
76
|
+
parameters: Schema.Struct({
|
|
77
|
+
configPath: Schema.String.annotate({
|
|
78
|
+
description: 'Path to a module that exports named variables: schema and syncBackend',
|
|
79
|
+
}),
|
|
80
|
+
storeId: Schema.String.annotate({ description: 'Required store id for the LiveStore instance.' }),
|
|
81
|
+
clientId: Schema.optional(Schema.String.annotate({ description: 'Optional client id for the LiveStore instance.' })),
|
|
82
|
+
sessionId: Schema.optional(Schema.String.annotate({ description: 'Optional session id for the LiveStore instance.' })),
|
|
83
|
+
}),
|
|
84
|
+
success: Schema.Struct({
|
|
85
|
+
storeId: Schema.String,
|
|
86
|
+
clientId: Schema.String,
|
|
87
|
+
sessionId: Schema.String,
|
|
88
|
+
schemaInfo: Schema.Struct({
|
|
89
|
+
tableNames: Schema.Array(Schema.String).annotate({
|
|
90
|
+
description: 'Non-system table names in the connected schema',
|
|
91
|
+
}),
|
|
92
|
+
eventNames: Schema.Array(Schema.String).annotate({
|
|
93
|
+
description: 'Canonical event names defined by the connected schema',
|
|
94
|
+
}),
|
|
95
|
+
}),
|
|
96
|
+
}),
|
|
97
|
+
}), Tool.make('livestore_instance_query', {
|
|
98
|
+
description: `Execute a raw SQL query against the connected client's local database (read-only).
|
|
99
|
+
Notes:
|
|
100
|
+
- The client store runs SQLite under the hood; use valid SQLite syntax.
|
|
101
|
+
- Inspect your exported \`schema\` to learn table/column names.
|
|
102
|
+
- \`bindValues\` must be an array (positional "?") or a record (named "$key"); do not pass a stringified JSON value.
|
|
103
|
+
|
|
104
|
+
Examples (positional binds):
|
|
105
|
+
{
|
|
106
|
+
"sql": "SELECT * FROM my_table WHERE userId = ? LIMIT 5",
|
|
107
|
+
"bindValues": ["u1"]
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
Examples (named binds):
|
|
111
|
+
{
|
|
112
|
+
"sql": "SELECT * FROM my_table WHERE userId = $userId LIMIT 5",
|
|
113
|
+
"bindValues": { "userId": "u1" }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
Returns on success:
|
|
117
|
+
{
|
|
118
|
+
"rows": [{ "col": "value" }],
|
|
119
|
+
"rowCount": 1
|
|
120
|
+
}`,
|
|
121
|
+
parameters: Schema.Struct({
|
|
122
|
+
sql: Schema.String.annotate({ description: 'The SQL query to execute' }),
|
|
123
|
+
bindValues: Schema.Union([
|
|
124
|
+
Schema.Array(Schema.Json),
|
|
125
|
+
Schema.Record(Schema.String, Schema.Json),
|
|
126
|
+
]).annotate({
|
|
127
|
+
description: 'Bind values for the SQL query (array or record). Record keys must not start with $.',
|
|
128
|
+
}),
|
|
129
|
+
}),
|
|
130
|
+
success: Schema.Struct({
|
|
131
|
+
rows: Schema.Array(Schema.Record(Schema.String, Schema.Json)),
|
|
132
|
+
rowCount: Schema.Number,
|
|
133
|
+
}),
|
|
134
|
+
}).annotate(Tool.Destructive, false), Tool.make('livestore_instance_commit_events', {
|
|
135
|
+
description: `Commit one or more events defined by your connected LiveStore schema.
|
|
136
|
+
Notes:
|
|
137
|
+
- The \`name\` must match the event's canonical name declared in your schema (e.g., "v1.UserRegistered").
|
|
138
|
+
- \`args\` must be a JSON object matching the event schema; do not pass a stringified JSON.
|
|
139
|
+
- Use your app's own event names and fields; the example below is generic.
|
|
140
|
+
- Date fields typically accept ISO 8601 strings (e.g., "2024-01-01T00:00:00.000Z").
|
|
141
|
+
|
|
142
|
+
Example parameters:
|
|
143
|
+
{
|
|
144
|
+
"events": [
|
|
145
|
+
{
|
|
146
|
+
"name": "v1.EntityCreated",
|
|
147
|
+
"args": {
|
|
148
|
+
"id": "e1",
|
|
149
|
+
"title": "Hello World",
|
|
150
|
+
"createdAt": "2024-01-01T00:00:00.000Z"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
Returns on success:
|
|
157
|
+
{ "committed": 1 }`,
|
|
158
|
+
parameters: Schema.Struct({
|
|
159
|
+
events: Schema.Array(Schema.Struct({
|
|
160
|
+
name: Schema.String.annotate({ description: 'The name of the event' }),
|
|
161
|
+
args: Schema.Json.annotate({
|
|
162
|
+
description: 'The arguments for the event as a non-stringified JSON value',
|
|
163
|
+
}),
|
|
164
|
+
})),
|
|
165
|
+
}),
|
|
166
|
+
success: Schema.Struct({ committed: Schema.Number }),
|
|
167
|
+
}).annotate(Tool.Destructive, true), Tool.make('livestore_instance_status', {
|
|
168
|
+
description: `Report the LiveStore runtime status for the current MCP session.
|
|
169
|
+
|
|
170
|
+
Returns when connected:
|
|
171
|
+
{
|
|
172
|
+
"_tag": "connected",
|
|
173
|
+
"storeId": "<store-id>",
|
|
174
|
+
"clientId": "<client-id>",
|
|
175
|
+
"sessionId": "<session-id>",
|
|
176
|
+
"tableCounts": { "<table>": 123 }
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Returns when not connected:
|
|
180
|
+
{
|
|
181
|
+
"_tag": "disconnected"
|
|
182
|
+
}`,
|
|
183
|
+
parameters: Tool.EmptyParams,
|
|
184
|
+
success: Schema.Union([
|
|
185
|
+
Schema.TaggedStruct('connected', {
|
|
186
|
+
storeId: Schema.String,
|
|
187
|
+
clientId: Schema.String,
|
|
188
|
+
sessionId: Schema.String,
|
|
189
|
+
tableCounts: Schema.Record(Schema.String, Schema.Number).annotate({
|
|
190
|
+
description: 'Tables in the LiveStore instance with their row count',
|
|
191
|
+
}),
|
|
192
|
+
}),
|
|
193
|
+
Schema.TaggedStruct('disconnected', {}),
|
|
194
|
+
]),
|
|
195
|
+
}).annotate(Tool.Readonly, true), Tool.make('livestore_instance_disconnect', {
|
|
196
|
+
description: `Disconnect the current LiveStore instance and release resources.
|
|
197
|
+
|
|
198
|
+
Example success:
|
|
199
|
+
{ "_tag": "disconnected" }`,
|
|
200
|
+
parameters: Tool.EmptyParams,
|
|
201
|
+
success: Schema.TaggedStruct('disconnected', {}),
|
|
202
|
+
}), Tool.make('livestore_sync_export', {
|
|
203
|
+
description: `Export all events from a sync backend to JSON data.
|
|
204
|
+
|
|
205
|
+
This tool connects directly to the sync backend (without creating a full LiveStore instance) and pulls all events. Useful for backup, migration, and debugging.
|
|
206
|
+
|
|
207
|
+
Module contract (same as livestore_instance_connect):
|
|
208
|
+
\`\`\`ts
|
|
209
|
+
export { schema } from './src/livestore/schema.ts'
|
|
210
|
+
export const syncBackend = makeWsSync({ url: process.env.LIVESTORE_SYNC_URL ?? 'ws://localhost:8787' })
|
|
211
|
+
export const syncPayload = { authToken: process.env.LIVESTORE_SYNC_AUTH_TOKEN }
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
Example parameters:
|
|
215
|
+
{
|
|
216
|
+
"configPath": "livestore-cli.config.ts",
|
|
217
|
+
"storeId": "my-store"
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
Returns on success:
|
|
221
|
+
{
|
|
222
|
+
"storeId": "my-store",
|
|
223
|
+
"eventCount": 127,
|
|
224
|
+
"exportedAt": "2024-01-15T10:30:00.000Z",
|
|
225
|
+
"data": { "version": 1, "storeId": "my-store", ... }
|
|
226
|
+
}`,
|
|
227
|
+
parameters: Schema.Struct({
|
|
228
|
+
configPath: Schema.String.annotate({
|
|
229
|
+
description: 'Path to a module that exports schema and syncBackend',
|
|
230
|
+
}),
|
|
231
|
+
storeId: Schema.String.annotate({ description: 'Store identifier' }),
|
|
232
|
+
clientId: Schema.optional(Schema.String.annotate({ description: 'Client identifier (default: mcp-export)' })),
|
|
233
|
+
}),
|
|
234
|
+
success: Schema.Struct({
|
|
235
|
+
storeId: Schema.String,
|
|
236
|
+
eventCount: Schema.Number,
|
|
237
|
+
exportedAt: Schema.String,
|
|
238
|
+
data: Schema.Json.annotate({ description: 'The export file data (can be saved or passed to import)' }),
|
|
239
|
+
}),
|
|
240
|
+
}).annotate(Tool.Readonly, true), Tool.make('livestore_sync_import', {
|
|
241
|
+
description: `Import events from export data to a sync backend.
|
|
242
|
+
|
|
243
|
+
This tool connects directly to the sync backend and pushes events. The sync backend must be empty.
|
|
244
|
+
|
|
245
|
+
Example parameters:
|
|
246
|
+
{
|
|
247
|
+
"configPath": "livestore-cli.config.ts",
|
|
248
|
+
"storeId": "my-store",
|
|
249
|
+
"data": { "version": 1, "storeId": "my-store", "events": [...] }
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
With options:
|
|
253
|
+
{
|
|
254
|
+
"configPath": "livestore-cli.config.ts",
|
|
255
|
+
"storeId": "my-store",
|
|
256
|
+
"data": { ... },
|
|
257
|
+
"force": true, // Import even if store ID doesn't match
|
|
258
|
+
"dryRun": true // Validate without importing
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
Returns on success:
|
|
262
|
+
{
|
|
263
|
+
"storeId": "my-store",
|
|
264
|
+
"eventCount": 127,
|
|
265
|
+
"dryRun": false
|
|
266
|
+
}`,
|
|
267
|
+
parameters: Schema.Struct({
|
|
268
|
+
configPath: Schema.String.annotate({
|
|
269
|
+
description: 'Path to a module that exports schema and syncBackend',
|
|
270
|
+
}),
|
|
271
|
+
storeId: Schema.String.annotate({ description: 'Store identifier' }),
|
|
272
|
+
clientId: Schema.optional(Schema.String.annotate({ description: 'Client identifier (default: mcp-import)' })),
|
|
273
|
+
data: Schema.Json.annotate({
|
|
274
|
+
description: 'The export data to import (from livestore_sync_export or a file)',
|
|
275
|
+
}),
|
|
276
|
+
force: Schema.optional(Schema.Boolean.annotate({ description: 'Force import even if store ID does not match' })),
|
|
277
|
+
dryRun: Schema.optional(Schema.Boolean.annotate({ description: 'Validate without actually importing' })),
|
|
278
|
+
}),
|
|
279
|
+
success: Schema.Struct({
|
|
280
|
+
storeId: Schema.String,
|
|
281
|
+
eventCount: Schema.Number,
|
|
282
|
+
dryRun: Schema.Boolean,
|
|
283
|
+
}),
|
|
284
|
+
}).annotate(Tool.Destructive, true));
|
|
285
|
+
//# sourceMappingURL=mcp-tools-defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools-defs.js","sourceRoot":"","sources":["../../src/commands/mcp-tools-defs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAC1C,SAAS,EAET,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE;IACrC,WAAW,EACT,0KAA0K;IAC5K,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,iEAAiE;SAC/E,CAAC;QACF,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAChC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YACrB,WAAW,EACT,gHAAgH;SACnH,CAAC,CACH;KACF,C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;;;;;;;;;;;;;;;;;;EAyBf;IACE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,sDAAsD;SACpE,CAAC;QACF,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;QACpE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC,CAAC;QAC7G,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,kEAAkE;SAChF,CAAC;QACF,KAAK,EAAE,MAAM,CAAC,QAAQ,CACpB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC,CACzF;QACD,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC,CAAC;KACzG,CAAC;IACF,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC,MAAM;QACtB,UAAU,EAAE,MAAM,CAAC,MAAM;QACzB,MAAM,EAAE,MAAM,CAAC,OAAO;KACvB,CAAC;CACH,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CACpC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools-defs.test.d.ts","sourceRoot":"","sources":["../../src/commands/mcp-tools-defs.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tool } from 'effect/unstable/ai';
|
|
2
|
+
import { Vitest } from '@livestore/utils-dev/node-vitest';
|
|
3
|
+
import { livestoreToolkit } from "./mcp-tools-defs.js";
|
|
4
|
+
Vitest.describe('livestoreToolkit', () => {
|
|
5
|
+
Vitest.it('exposes MCP-compatible object parameter schemas', () => {
|
|
6
|
+
for (const tool of Object.values(livestoreToolkit.tools)) {
|
|
7
|
+
Vitest.expect(Tool.getJsonSchema(tool), tool.name).toMatchObject({ type: 'object' });
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=mcp-tools-defs.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools-defs.test.js","sourceRoot":"","sources":["../../src/commands/mcp-tools-defs.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACvC,MAAM,CAAC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAChE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YACzD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;QACtF,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { Cli } from '@livestore/utils/node';
|
|
2
|
-
export declare const mcpCommand: Cli.Command.Command<"mcp",
|
|
3
|
-
readonly subcommand: import("effect/Option").Option<{}>;
|
|
4
|
-
}>;
|
|
2
|
+
export declare const mcpCommand: Cli.Command.Command<"mcp", {}, {}, import("effect/Cause").IllegalArgumentError, never>;
|
|
5
3
|
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAgB,MAAM,uBAAuB,CAAA;AAiGzD,eAAO,MAAM,UAAU,wFAAgF,CAAA"}
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { McpServer } from 'effect/unstable/ai';
|
|
2
|
+
import { Effect, Layer, Logger } from '@livestore/utils/effect';
|
|
2
3
|
import { Cli, PlatformNode } from '@livestore/utils/node';
|
|
3
4
|
import { architectureContent } from "../mcp-content/architecture.js";
|
|
4
5
|
import { featuresContent } from "../mcp-content/features.js";
|
|
@@ -9,8 +10,10 @@ import { blogSchemaContent } from "../mcp-content/schemas/blog.js";
|
|
|
9
10
|
import { ecommerceSchemaContent } from "../mcp-content/schemas/ecommerce.js";
|
|
10
11
|
import { socialSchemaContent } from "../mcp-content/schemas/social.js";
|
|
11
12
|
import { todoSchemaContent } from "../mcp-content/schemas/todo.js";
|
|
13
|
+
import { toolHandlers } from "./mcp-tool-handlers.js";
|
|
14
|
+
import { supportedMcpProtocols } from "./mcp-protocols.js";
|
|
12
15
|
// Tools imports
|
|
13
|
-
import { livestoreToolkit
|
|
16
|
+
import { livestoreToolkit } from "./mcp-tools-defs.js";
|
|
14
17
|
const LivestoreResources = Layer.mergeAll(McpServer.resource({
|
|
15
18
|
uri: 'livestore://overview',
|
|
16
19
|
name: 'LiveStore Overview',
|
|
@@ -59,9 +62,8 @@ const mcpServerCommand = Cli.Command.make('server', {}, Effect.fn(function* () {
|
|
|
59
62
|
return yield* McpServer.layerStdio({
|
|
60
63
|
name: 'livestore-mcp',
|
|
61
64
|
version: '0.1.0',
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}).pipe(Layer.provide(LivestoreResources), Layer.provide(LivestoreTools), Layer.provide(Logger.add(Logger.prettyLogger({ stderr: true }))), Layer.launch);
|
|
65
|
+
protocols: supportedMcpProtocols,
|
|
66
|
+
}).pipe(Layer.provide(LivestoreResources), Layer.provide(LivestoreTools), Layer.provide(Logger.layer([Logger.consolePretty({ stderr: true })])), Layer.provide(PlatformNode.NodeStdio.layer), Layer.launch);
|
|
65
67
|
}));
|
|
66
68
|
export const mcpCommand = Cli.Command.make('mcp').pipe(Cli.Command.withSubcommands([mcpServerCommand]));
|
|
67
69
|
//# sourceMappingURL=mcp.js.map
|
package/dist/commands/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AACzE,kBAAkB;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,E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,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EACrE,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,EAC3C,KAAK,CAAC,MAAM,CACb,CAAA;AACH,CAAC,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { HttpClient, Option, Schema } from '@livestore/utils/effect';
|
|
1
|
+
import { ChildProcessSpawner, HttpClient, Option, Schema } from '@livestore/utils/effect';
|
|
2
2
|
import { Cli } from '@livestore/utils/node';
|
|
3
|
-
declare const ExampleNotFoundError_base: Schema.
|
|
4
|
-
readonly
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
message: typeof Schema.String;
|
|
9
|
-
}>;
|
|
3
|
+
declare const ExampleNotFoundError_base: Schema.Class<ExampleNotFoundError, Schema.TaggedStruct<"ExampleNotFoundError", {
|
|
4
|
+
readonly exampleName: Schema.String;
|
|
5
|
+
readonly availableExamples: Schema.$Array<Schema.String>;
|
|
6
|
+
readonly message: Schema.String;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
10
8
|
export declare class ExampleNotFoundError extends ExampleNotFoundError_base {
|
|
11
9
|
}
|
|
12
|
-
declare const NetworkError_base: Schema.
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
message: typeof Schema.String;
|
|
17
|
-
}>;
|
|
10
|
+
declare const NetworkError_base: Schema.Class<NetworkError, Schema.TaggedStruct<"NetworkError", {
|
|
11
|
+
readonly cause: Schema.Unknown;
|
|
12
|
+
readonly message: Schema.String;
|
|
13
|
+
}>, import("effect/Cause").YieldableError>;
|
|
18
14
|
export declare class NetworkError extends NetworkError_base {
|
|
19
15
|
}
|
|
20
|
-
declare const DirectoryExistsError_base: Schema.
|
|
21
|
-
readonly
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
message: typeof Schema.String;
|
|
25
|
-
}>;
|
|
16
|
+
declare const DirectoryExistsError_base: Schema.Class<DirectoryExistsError, Schema.TaggedStruct<"DirectoryExistsError", {
|
|
17
|
+
readonly path: Schema.String;
|
|
18
|
+
readonly message: Schema.String;
|
|
19
|
+
}>, import("effect/Cause").YieldableError>;
|
|
26
20
|
export declare class DirectoryExistsError extends DirectoryExistsError_base {
|
|
27
21
|
}
|
|
28
|
-
|
|
22
|
+
declare const NoExamplesError_base: Schema.Class<NoExamplesError, Schema.TaggedStruct<"NoExamplesError", {
|
|
23
|
+
readonly message: Schema.String;
|
|
24
|
+
}>, import("effect/Cause").YieldableError>;
|
|
25
|
+
export declare class NoExamplesError extends NoExamplesError_base {
|
|
26
|
+
}
|
|
27
|
+
export declare const createCommand: Cli.Command.Command<"create", {
|
|
29
28
|
readonly example: Option.Option<string>;
|
|
30
|
-
readonly
|
|
29
|
+
readonly ref: string;
|
|
31
30
|
readonly path: Option.Option<string>;
|
|
32
|
-
}>;
|
|
31
|
+
}, {}, import("effect/unstable/http/HttpClientError").HttpClientError | ExampleNotFoundError | NetworkError | NoExamplesError | import("effect/Terminal").QuitError | import("effect/PlatformError").PlatformError, HttpClient.HttpClient | ChildProcessSpawner.ChildProcessSpawner | Cli.Prompt.Environment>;
|
|
33
32
|
export {};
|
|
34
33
|
//# sourceMappingURL=new-project.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-project.d.ts","sourceRoot":"","sources":["../../src/commands/new-project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"new-project.d.ts","sourceRoot":"","sources":["../../src/commands/new-project.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,mBAAmB,EAInB,UAAU,EAEV,MAAM,EACN,MAAM,EACP,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;;;;;;AA0B3C,qBAAa,oBAAqB,SAAQ,yBAMxC;CAAG;;;;;AAEL,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;AAEL,qBAAa,oBAAqB,SAAQ,yBAKxC;CAAG;;;;AAEL,qBAAa,eAAgB,SAAQ,oBAKpC;CAAG;AA6JJ,eAAO,MAAM,aAAa;;;;6SA0GzB,CAAA"}
|