@livestore/cli 0.4.0-dev.9 → 0.4.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 +65 -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.map +1 -1
- package/dist/cli.d.ts +16 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/import-export.d.ts +34 -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 +13 -5
- package/dist/commands/mcp-coach.d.ts.map +1 -1
- package/dist/commands/mcp-coach.js +41 -45
- package/dist/commands/mcp-coach.js.map +1 -1
- 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} +79 -45
- package/dist/commands/mcp-tool-handlers.js.map +1 -0
- package/dist/commands/mcp-tools-defs.d.ts +133 -0
- package/dist/commands/mcp-tools-defs.d.ts.map +1 -0
- package/dist/commands/mcp-tools-defs.js +278 -0
- package/dist/commands/mcp-tools-defs.js.map +1 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +2 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/new-project.d.ts +9 -2
- package/dist/commands/new-project.d.ts.map +1 -1
- package/dist/commands/new-project.js +72 -32
- package/dist/commands/new-project.js.map +1 -1
- 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 +121 -0
- package/dist/sync-operations.d.ts.map +1 -0
- package/dist/sync-operations.js +180 -0
- package/dist/sync-operations.js.map +1 -0
- package/package.json +71 -15
- package/src/__tests__/fixtures/mock-config.ts +112 -0
- package/src/__tests__/sync-operations.test.ts +232 -0
- package/src/bin.ts +1 -0
- package/src/cli.ts +4 -5
- package/src/commands/import-export.ts +283 -0
- package/src/commands/mcp-coach.ts +67 -67
- package/src/commands/{mcp-tools.ts → mcp-tool-handlers.ts} +93 -57
- package/src/commands/mcp-tools-defs.ts +318 -0
- package/src/commands/mcp.ts +3 -2
- package/src/commands/new-project.ts +90 -36
- 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
|
@@ -10,10 +10,18 @@ export declare const coachTool: Tool.Tool<"livestore_coach", {
|
|
|
10
10
|
suggestions: Schema.Array$<Schema.SchemaClass<string, string, never>>;
|
|
11
11
|
}>;
|
|
12
12
|
readonly failure: Schema.Union<[typeof AiError.HttpRequestError, typeof AiError.HttpResponseError, typeof AiError.MalformedInput, typeof AiError.MalformedOutput, typeof AiError.UnknownError]>;
|
|
13
|
+
readonly failureMode: "error";
|
|
13
14
|
}, never>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
type CoachToolHandlerInput = {
|
|
16
|
+
readonly code: string;
|
|
17
|
+
readonly codeType?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
type CoachToolResult = {
|
|
20
|
+
readonly feedback: string;
|
|
21
|
+
readonly score: number | undefined;
|
|
22
|
+
readonly suggestions: string[];
|
|
23
|
+
};
|
|
24
|
+
/** Coach tool handler that uses OpenAI for analysis */
|
|
25
|
+
export declare const coachToolHandler: (input: CoachToolHandlerInput) => Effect.Effect<CoachToolResult, AiError.AiError>;
|
|
26
|
+
export {};
|
|
19
27
|
//# sourceMappingURL=mcp-coach.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-coach.d.ts","sourceRoot":"","sources":["../../src/commands/mcp-coach.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp-coach.d.ts","sourceRoot":"","sources":["../../src/commands/mcp-coach.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAU,MAAM,EAAkC,MAAM,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAG/G,eAAO,MAAM,SAAS;;;;;;;;;;;;SA+BpB,CAAA;AAQF,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAC/B,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO,CAwE3G,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { LanguageModel } from '@effect/ai';
|
|
1
2
|
import { OpenAiClient, OpenAiLanguageModel } from '@effect/ai-openai';
|
|
2
|
-
import { AiError, Config, Effect, FetchHttpClient,
|
|
3
|
+
import { AiError, Config, Effect, FetchHttpClient, Layer, Prompt, Schema, Tool } from '@livestore/utils/effect';
|
|
3
4
|
// Define the coach tool that analyzes LiveStore usage
|
|
4
5
|
export const coachTool = Tool.make('livestore_coach', {
|
|
5
6
|
description: 'Analyze LiveStore code (schemas, queries, mutations, etc.) and provide AI-powered feedback on best practices, performance, and improvements.',
|
|
@@ -26,20 +27,16 @@ export const coachTool = Tool.make('livestore_coach', {
|
|
|
26
27
|
}),
|
|
27
28
|
failure: AiError.AiError,
|
|
28
29
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const prompt = Prompt.makeMessage('user', {
|
|
40
|
-
content: [
|
|
41
|
-
Prompt.makePart('text', {
|
|
42
|
-
text: `${codeTypeContext}Please review the following code and provide helpful feedback focusing on:
|
|
30
|
+
/** Composed layer: HttpClient → OpenAiClient → LanguageModel */
|
|
31
|
+
const LanguageModelLayer = OpenAiLanguageModel.layer({ model: 'gpt-4o-mini' }).pipe(Layer.provide(OpenAiClient.layerConfig({ apiKey: Config.redacted('OPENAI_API_KEY') })), Layer.provide(FetchHttpClient.layer));
|
|
32
|
+
/** Coach tool handler that uses OpenAI for analysis */
|
|
33
|
+
export const coachToolHandler = Effect.fn('mcp-coach-handler')(({ code, codeType }) => {
|
|
34
|
+
const effect = Effect.gen(function* () {
|
|
35
|
+
const codeTypeContext = codeType !== undefined ? `This is ${codeType} code using LiveStore. ` : 'This is LiveStore code. ';
|
|
36
|
+
const prompt = Prompt.makeMessage('user', {
|
|
37
|
+
content: [
|
|
38
|
+
Prompt.makePart('text', {
|
|
39
|
+
text: `${codeTypeContext}Please review the following code and provide helpful feedback focusing on:
|
|
43
40
|
|
|
44
41
|
1. LiveStore best practices and conventions
|
|
45
42
|
2. Schema design and relationships (if applicable)
|
|
@@ -61,35 +58,34 @@ Please provide:
|
|
|
61
58
|
4. Any potential issues or concerns
|
|
62
59
|
|
|
63
60
|
Format your response as constructive feedback that helps developers improve their LiveStore usage.`,
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
const systemPrompt = Prompt.makeMessage('system', {
|
|
65
|
+
content: `You are an expert LiveStore developer and code reviewer. Provide constructive, specific, and actionable feedback on LiveStore code. Focus on best practices, performance, and maintainability.`,
|
|
66
|
+
});
|
|
67
|
+
const llm = yield* LanguageModel.LanguageModel;
|
|
68
|
+
const completion = yield* llm.generateText({ prompt: Prompt.fromMessages([systemPrompt, prompt]) });
|
|
69
|
+
const feedback = completion.text ?? 'Unable to generate feedback';
|
|
70
|
+
const suggestions = feedback
|
|
71
|
+
.split('\n')
|
|
72
|
+
.filter((line) => line.trim().startsWith('-') ||
|
|
73
|
+
line.trim().startsWith('*') ||
|
|
74
|
+
line.trim().startsWith('•') ||
|
|
75
|
+
line.toLowerCase().includes('recommend') ||
|
|
76
|
+
line.toLowerCase().includes('consider') ||
|
|
77
|
+
line.toLowerCase().includes('improve'))
|
|
78
|
+
.map((line) => line.replace(/^[-*•]\s*/, '').trim())
|
|
79
|
+
.filter((suggestion) => suggestion.length > 10)
|
|
80
|
+
.slice(0, 5);
|
|
81
|
+
const scoreMatch = feedback.match(/(?:score|rating|quality).*?(\d+(?:\.\d+)?)/i);
|
|
82
|
+
const score = scoreMatch !== null ? Number.parseFloat(scoreMatch[1] ?? '0') : undefined;
|
|
83
|
+
return {
|
|
84
|
+
feedback,
|
|
85
|
+
score: score !== undefined && score >= 1 && score <= 10 ? score : undefined,
|
|
86
|
+
suggestions,
|
|
87
|
+
};
|
|
66
88
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
// Get OpenAI client and call the API
|
|
71
|
-
const llm = yield* LanguageModel.LanguageModel;
|
|
72
|
-
const completion = yield* llm.generateText({ prompt: Prompt.fromMessages([systemPrompt, prompt]) });
|
|
73
|
-
const feedback = completion.text ?? 'Unable to generate feedback';
|
|
74
|
-
// Extract suggestions from the feedback (simple approach)
|
|
75
|
-
const suggestions = feedback
|
|
76
|
-
.split('\n')
|
|
77
|
-
.filter((line) => line.trim().startsWith('-') ||
|
|
78
|
-
line.trim().startsWith('*') ||
|
|
79
|
-
line.trim().startsWith('•') ||
|
|
80
|
-
line.toLowerCase().includes('recommend') ||
|
|
81
|
-
line.toLowerCase().includes('consider') ||
|
|
82
|
-
line.toLowerCase().includes('improve'))
|
|
83
|
-
.map((line) => line.replace(/^[-*•]\s*/, '').trim())
|
|
84
|
-
.filter((suggestion) => suggestion.length > 10)
|
|
85
|
-
.slice(0, 5); // Limit to 5 suggestions
|
|
86
|
-
// Try to extract a score (simple regex approach)
|
|
87
|
-
const scoreMatch = feedback.match(/(?:score|rating|quality).*?(\d+(?:\.\d+)?)/i);
|
|
88
|
-
const score = scoreMatch ? Number.parseFloat(scoreMatch[1] ?? '0') : undefined;
|
|
89
|
-
return {
|
|
90
|
-
feedback,
|
|
91
|
-
score: score && score >= 1 && score <= 10 ? score : undefined,
|
|
92
|
-
suggestions,
|
|
93
|
-
};
|
|
94
|
-
}, Effect.provide(Layer.provideMerge(OpenAiModel, OpenAiClientLayer)), Effect.provide(FetchHttpClient.layer), Effect.catchTag('ConfigError', (e) => Effect.die(e)));
|
|
89
|
+
return effect.pipe(Effect.provide(LanguageModelLayer), Effect.catchTag('ConfigError', (e) => Effect.die(e)));
|
|
90
|
+
});
|
|
95
91
|
//# sourceMappingURL=mcp-coach.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-coach.js","sourceRoot":"","sources":["../../src/commands/mcp-coach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-coach.js","sourceRoot":"","sources":["../../src/commands/mcp-coach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAE/G,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;IACpD,WAAW,EACT,8IAA8I;IAChJ,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YAC9B,WAAW,EAAE,uDAAuD;SACrE,CAAC;QACF,QAAQ,EAAE,MAAM,CAAC,QAAQ,CACvB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YACxB,WAAW,EAAE,uFAAuF;SACrG,CAAC,CACH;KACF;IACD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YAClC,WAAW,EAAE,wDAAwD;SACtE,CAAC;QACF,KAAK,EAAE,MAAM,CAAC,QAAQ,CACpB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;YACxB,WAAW,EAAE,yCAAyC;SACvD,CAAC,CACH;QACD,WAAW,E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OAAO;YACL,QAAQ;YACR,KAAK,EAAE,KAAK,KAAK,SAAS,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YAC3E,WAAW;SACZ,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,IAAI,CAChB,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAClC,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACrD,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Toolkit } from '@livestore/utils/effect';
|
|
2
|
+
import { livestoreToolkit } from './mcp-tools-defs.ts';
|
|
3
|
+
type LivestoreToolHandlers = Toolkit.HandlersFrom<Toolkit.Tools<typeof livestoreToolkit>>;
|
|
4
|
+
export declare const toolHandlers: LivestoreToolHandlers;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=mcp-tool-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-handlers.d.ts","sourceRoot":"","sources":["../../src/commands/mcp-tool-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAUtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAKtD,KAAK,qBAAqB,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAA;AAEzF,eAAO,MAAM,YAAY,EAAE,qBA2LzB,CAAA"}
|
|
@@ -1,47 +1,15 @@
|
|
|
1
|
-
import { Effect,
|
|
1
|
+
import { Effect, FetchHttpClient, Layer } from '@livestore/utils/effect';
|
|
2
|
+
import { PlatformNode } from '@livestore/utils/node';
|
|
2
3
|
import { blogSchemaContent } from "../mcp-content/schemas/blog.js";
|
|
3
4
|
import { ecommerceSchemaContent } from "../mcp-content/schemas/ecommerce.js";
|
|
4
5
|
import { socialSchemaContent } from "../mcp-content/schemas/social.js";
|
|
5
6
|
import { todoSchemaContent } from "../mcp-content/schemas/todo.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
description: "Schema type: 'todo', 'blog', 'social', 'ecommerce', or 'custom'",
|
|
13
|
-
}),
|
|
14
|
-
customDescription: Schema.optional(Schema.String.annotations({
|
|
15
|
-
description: "For custom schemas: describe your data model needs (e.g., 'user management system with roles and permissions')",
|
|
16
|
-
})),
|
|
17
|
-
},
|
|
18
|
-
success: Schema.Struct({
|
|
19
|
-
schemaCode: Schema.String.annotations({
|
|
20
|
-
description: 'The generated LiveStore schema TypeScript code',
|
|
21
|
-
}),
|
|
22
|
-
explanation: Schema.String.annotations({
|
|
23
|
-
description: 'Brief explanation of the schema structure',
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
26
|
-
}), Tool.make('livestore_get_example_schema', {
|
|
27
|
-
description: 'Get a complete example LiveStore schema with TypeScript code. Returns ready-to-use schema definitions for common application types.',
|
|
28
|
-
parameters: {
|
|
29
|
-
type: Schema.String.annotations({
|
|
30
|
-
description: "Example type: 'todo', 'blog', 'social', or 'ecommerce'",
|
|
31
|
-
}),
|
|
32
|
-
},
|
|
33
|
-
success: Schema.Struct({
|
|
34
|
-
schemaCode: Schema.String.annotations({
|
|
35
|
-
description: 'The complete LiveStore schema code',
|
|
36
|
-
}),
|
|
37
|
-
description: Schema.String.annotations({
|
|
38
|
-
description: 'Description of what this schema models',
|
|
39
|
-
}),
|
|
40
|
-
}),
|
|
41
|
-
})
|
|
42
|
-
.annotate(Tool.Readonly, true)
|
|
43
|
-
.annotate(Tool.Destructive, false));
|
|
44
|
-
// Tool handlers using Tim Smart's pattern
|
|
7
|
+
import * as Runtime from "../mcp-runtime/runtime.js";
|
|
8
|
+
import * as SyncOps from "../sync-operations.js";
|
|
9
|
+
import { coachToolHandler } from "./mcp-coach.js";
|
|
10
|
+
import { livestoreToolkit } from "./mcp-tools-defs.js";
|
|
11
|
+
/** Layer providing FileSystem and HttpClient for sync operations */
|
|
12
|
+
const SyncOpsLayer = Layer.mergeAll(PlatformNode.NodeFileSystem.layer, FetchHttpClient.layer);
|
|
45
13
|
export const toolHandlers = livestoreToolkit.of({
|
|
46
14
|
livestore_coach: coachToolHandler,
|
|
47
15
|
livestore_generate_schema: Effect.fnUntraced(function* ({ schemaType, customDescription }) {
|
|
@@ -65,7 +33,7 @@ export const toolHandlers = livestoreToolkit.of({
|
|
|
65
33
|
explanation = 'E-commerce schema with products, categories, orders, and inventory';
|
|
66
34
|
break;
|
|
67
35
|
case 'custom': {
|
|
68
|
-
if (
|
|
36
|
+
if (customDescription == null) {
|
|
69
37
|
schemaCode = `// Custom schema requested but no description provided
|
|
70
38
|
import { Schema } from '@livestore/livestore'
|
|
71
39
|
|
|
@@ -83,11 +51,11 @@ export const schema = Schema.create({
|
|
|
83
51
|
break;
|
|
84
52
|
}
|
|
85
53
|
// Generate a basic custom schema based on description
|
|
86
|
-
const tableName = customDescription.toLowerCase().includes('user')
|
|
54
|
+
const tableName = customDescription.toLowerCase().includes('user') === true
|
|
87
55
|
? 'users'
|
|
88
|
-
: customDescription.toLowerCase().includes('product')
|
|
56
|
+
: customDescription.toLowerCase().includes('product') === true
|
|
89
57
|
? 'products'
|
|
90
|
-
: customDescription.toLowerCase().includes('post')
|
|
58
|
+
: customDescription.toLowerCase().includes('post') === true
|
|
91
59
|
? 'posts'
|
|
92
60
|
: 'items';
|
|
93
61
|
schemaCode = `// Custom schema based on: ${customDescription}
|
|
@@ -144,5 +112,71 @@ export const schema = Schema.create({
|
|
|
144
112
|
}
|
|
145
113
|
return { schemaCode, description };
|
|
146
114
|
}),
|
|
115
|
+
// Connect the single in-process LiveStore instance from user module
|
|
116
|
+
livestore_instance_connect: Effect.fnUntraced(function* ({ configPath, storeId, clientId, sessionId }) {
|
|
117
|
+
const store = yield* Runtime.init({
|
|
118
|
+
configPath,
|
|
119
|
+
storeId,
|
|
120
|
+
...(clientId !== undefined ? { clientId } : {}),
|
|
121
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
122
|
+
}).pipe(Effect.orDie);
|
|
123
|
+
const eventNames = Array.from(store.schema.eventsDefsMap.keys());
|
|
124
|
+
const tableNames = Array.from(store.schema.state.sqlite.tables.keys());
|
|
125
|
+
return {
|
|
126
|
+
storeId: store.storeId,
|
|
127
|
+
clientId: store.clientId,
|
|
128
|
+
sessionId: store.sessionId,
|
|
129
|
+
schemaInfo: {
|
|
130
|
+
tableNames,
|
|
131
|
+
eventNames,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}),
|
|
135
|
+
// Execute a raw SQL query against the local client DB
|
|
136
|
+
livestore_instance_query: Effect.fnUntraced(function* ({ sql, bindValues }) {
|
|
137
|
+
return yield* Runtime.query({ sql, bindValues });
|
|
138
|
+
}),
|
|
139
|
+
// Validate and commit events
|
|
140
|
+
livestore_instance_commit_events: Effect.fnUntraced(function* ({ events }) {
|
|
141
|
+
return yield* Runtime.commit({ events });
|
|
142
|
+
}),
|
|
143
|
+
// Status
|
|
144
|
+
livestore_instance_status: Effect.fnUntraced(function* () {
|
|
145
|
+
return yield* Runtime.status;
|
|
146
|
+
}),
|
|
147
|
+
// Disconnect
|
|
148
|
+
livestore_instance_disconnect: Effect.fnUntraced(function* () {
|
|
149
|
+
return yield* Runtime.disconnect;
|
|
150
|
+
}),
|
|
151
|
+
// Sync export - pull all events from sync backend
|
|
152
|
+
livestore_sync_export: Effect.fnUntraced(function* ({ configPath, storeId, clientId }) {
|
|
153
|
+
const result = yield* SyncOps.pullEventsFromSyncBackend({
|
|
154
|
+
configPath,
|
|
155
|
+
storeId,
|
|
156
|
+
clientId: clientId ?? 'mcp-export',
|
|
157
|
+
}).pipe(Effect.scoped, Effect.provide(SyncOpsLayer), Effect.orDie);
|
|
158
|
+
return {
|
|
159
|
+
storeId: result.storeId,
|
|
160
|
+
eventCount: result.eventCount,
|
|
161
|
+
exportedAt: result.exportedAt,
|
|
162
|
+
data: result.data,
|
|
163
|
+
};
|
|
164
|
+
}),
|
|
165
|
+
// Sync import - push events to sync backend
|
|
166
|
+
livestore_sync_import: Effect.fnUntraced(function* ({ configPath, storeId, clientId, data, force, dryRun }) {
|
|
167
|
+
const result = yield* SyncOps.pushEventsToSyncBackend({
|
|
168
|
+
configPath,
|
|
169
|
+
storeId,
|
|
170
|
+
clientId: clientId ?? 'mcp-import',
|
|
171
|
+
data,
|
|
172
|
+
force: force ?? false,
|
|
173
|
+
dryRun: dryRun ?? false,
|
|
174
|
+
}).pipe(Effect.scoped, Effect.provide(SyncOpsLayer), Effect.orDie);
|
|
175
|
+
return {
|
|
176
|
+
storeId: result.storeId,
|
|
177
|
+
eventCount: result.eventCount,
|
|
178
|
+
dryRun: result.dryRun,
|
|
179
|
+
};
|
|
180
|
+
}),
|
|
147
181
|
});
|
|
148
|
-
//# sourceMappingURL=mcp-
|
|
182
|
+
//# sourceMappingURL=mcp-tool-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-handlers.js","sourceRoot":"","sources":["../../src/commands/mcp-tool-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAgB,MAAM,yBAAyB,CAAA;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACl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U,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAA;IACH,CAAC,CAAC;IAEF,4CAA4C;IAC5C,qBAAqB,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;QACxG,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC;YACpD,UAAU;YACV,OAAO;YACP,QAAQ,EAAE,QAAQ,IAAI,YAAY;YAClC,IAAI;YACJ,KAAK,EAAE,KAAK,IAAI,KAAK;YACrB,MAAM,EAAE,MAAM,IAAI,KAAK;SACxB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;QAElE,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAA;IACH,CAAC,CAAC;CACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Schema, Tool, Toolkit } from '@livestore/utils/effect';
|
|
2
|
+
export declare const livestoreToolkit: Toolkit.Toolkit<{
|
|
3
|
+
readonly livestore_coach: Tool.Tool<"livestore_coach", {
|
|
4
|
+
readonly parameters: Schema.Struct<{
|
|
5
|
+
code: Schema.SchemaClass<string, string, never>;
|
|
6
|
+
codeType: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
7
|
+
}>;
|
|
8
|
+
readonly success: Schema.Struct<{
|
|
9
|
+
feedback: Schema.SchemaClass<string, string, never>;
|
|
10
|
+
score: Schema.optional<Schema.SchemaClass<number, number, never>>;
|
|
11
|
+
suggestions: Schema.Array$<Schema.SchemaClass<string, string, never>>;
|
|
12
|
+
}>;
|
|
13
|
+
readonly failure: Schema.Union<[typeof import("@effect/ai/AiError").HttpRequestError, typeof import("@effect/ai/AiError").HttpResponseError, typeof import("@effect/ai/AiError").MalformedInput, typeof import("@effect/ai/AiError").MalformedOutput, typeof import("@effect/ai/AiError").UnknownError]>;
|
|
14
|
+
readonly failureMode: "error";
|
|
15
|
+
}, never>;
|
|
16
|
+
readonly livestore_generate_schema: Tool.Tool<"livestore_generate_schema", {
|
|
17
|
+
readonly parameters: Schema.Struct<{
|
|
18
|
+
schemaType: Schema.SchemaClass<string, string, never>;
|
|
19
|
+
customDescription: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
20
|
+
}>;
|
|
21
|
+
readonly success: Schema.Struct<{
|
|
22
|
+
schemaCode: Schema.SchemaClass<string, string, never>;
|
|
23
|
+
explanation: Schema.SchemaClass<string, string, never>;
|
|
24
|
+
}>;
|
|
25
|
+
readonly failure: typeof Schema.Never;
|
|
26
|
+
readonly failureMode: "error";
|
|
27
|
+
}, never>;
|
|
28
|
+
readonly livestore_get_example_schema: Tool.Tool<"livestore_get_example_schema", {
|
|
29
|
+
readonly parameters: Schema.Struct<{
|
|
30
|
+
type: Schema.SchemaClass<string, string, never>;
|
|
31
|
+
}>;
|
|
32
|
+
readonly success: Schema.Struct<{
|
|
33
|
+
schemaCode: Schema.SchemaClass<string, string, never>;
|
|
34
|
+
description: Schema.SchemaClass<string, string, never>;
|
|
35
|
+
}>;
|
|
36
|
+
readonly failure: typeof Schema.Never;
|
|
37
|
+
readonly failureMode: "error";
|
|
38
|
+
}, never>;
|
|
39
|
+
readonly livestore_instance_connect: Tool.Tool<"livestore_instance_connect", {
|
|
40
|
+
readonly parameters: Schema.Struct<{
|
|
41
|
+
configPath: Schema.SchemaClass<string, string, never>;
|
|
42
|
+
storeId: Schema.SchemaClass<string, string, never>;
|
|
43
|
+
clientId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
44
|
+
sessionId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
45
|
+
}>;
|
|
46
|
+
readonly success: Schema.Struct<{
|
|
47
|
+
storeId: typeof Schema.String;
|
|
48
|
+
clientId: typeof Schema.String;
|
|
49
|
+
sessionId: typeof Schema.String;
|
|
50
|
+
schemaInfo: Schema.Struct<{
|
|
51
|
+
tableNames: Schema.Array$<typeof Schema.String>;
|
|
52
|
+
eventNames: Schema.Array$<typeof Schema.String>;
|
|
53
|
+
}>;
|
|
54
|
+
}>;
|
|
55
|
+
readonly failure: typeof Schema.Never;
|
|
56
|
+
readonly failureMode: "error";
|
|
57
|
+
}, never>;
|
|
58
|
+
readonly livestore_instance_query: Tool.Tool<"livestore_instance_query", {
|
|
59
|
+
readonly parameters: Schema.Struct<{
|
|
60
|
+
sql: Schema.SchemaClass<string, string, never>;
|
|
61
|
+
bindValues: Schema.Union<[Schema.Array$<Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>>, Schema.Record$<typeof Schema.String, Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>>]>;
|
|
62
|
+
}>;
|
|
63
|
+
readonly success: Schema.Struct<{
|
|
64
|
+
rows: Schema.Array$<Schema.Record$<typeof Schema.String, Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>>>;
|
|
65
|
+
rowCount: typeof Schema.Number;
|
|
66
|
+
}>;
|
|
67
|
+
readonly failure: typeof Schema.Never;
|
|
68
|
+
readonly failureMode: "error";
|
|
69
|
+
}, never>;
|
|
70
|
+
readonly livestore_instance_commit_events: Tool.Tool<"livestore_instance_commit_events", {
|
|
71
|
+
readonly parameters: Schema.Struct<{
|
|
72
|
+
events: Schema.Array$<Schema.Struct<{
|
|
73
|
+
name: Schema.SchemaClass<string, string, never>;
|
|
74
|
+
args: Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>;
|
|
75
|
+
}>>;
|
|
76
|
+
}>;
|
|
77
|
+
readonly success: Schema.Struct<{
|
|
78
|
+
committed: typeof Schema.Number;
|
|
79
|
+
}>;
|
|
80
|
+
readonly failure: typeof Schema.Never;
|
|
81
|
+
readonly failureMode: "error";
|
|
82
|
+
}, never>;
|
|
83
|
+
readonly livestore_instance_status: Tool.Tool<"livestore_instance_status", {
|
|
84
|
+
readonly parameters: Schema.Struct<{}>;
|
|
85
|
+
readonly success: Schema.Union<[Schema.TaggedStruct<"connected", {
|
|
86
|
+
storeId: typeof Schema.String;
|
|
87
|
+
clientId: typeof Schema.String;
|
|
88
|
+
sessionId: typeof Schema.String;
|
|
89
|
+
tableCounts: Schema.Record$<typeof Schema.String, typeof Schema.Number>;
|
|
90
|
+
}>, Schema.TaggedStruct<"disconnected", {}>]>;
|
|
91
|
+
readonly failure: typeof Schema.Never;
|
|
92
|
+
readonly failureMode: "error";
|
|
93
|
+
}, never>;
|
|
94
|
+
readonly livestore_instance_disconnect: Tool.Tool<"livestore_instance_disconnect", {
|
|
95
|
+
readonly parameters: Schema.Struct<{}>;
|
|
96
|
+
readonly success: Schema.TaggedStruct<"disconnected", {}>;
|
|
97
|
+
readonly failure: typeof Schema.Never;
|
|
98
|
+
readonly failureMode: "error";
|
|
99
|
+
}, never>;
|
|
100
|
+
readonly livestore_sync_export: Tool.Tool<"livestore_sync_export", {
|
|
101
|
+
readonly parameters: Schema.Struct<{
|
|
102
|
+
configPath: Schema.SchemaClass<string, string, never>;
|
|
103
|
+
storeId: Schema.SchemaClass<string, string, never>;
|
|
104
|
+
clientId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
105
|
+
}>;
|
|
106
|
+
readonly success: Schema.Struct<{
|
|
107
|
+
storeId: typeof Schema.String;
|
|
108
|
+
eventCount: typeof Schema.Number;
|
|
109
|
+
exportedAt: typeof Schema.String;
|
|
110
|
+
data: Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>;
|
|
111
|
+
}>;
|
|
112
|
+
readonly failure: typeof Schema.Never;
|
|
113
|
+
readonly failureMode: "error";
|
|
114
|
+
}, never>;
|
|
115
|
+
readonly livestore_sync_import: Tool.Tool<"livestore_sync_import", {
|
|
116
|
+
readonly parameters: Schema.Struct<{
|
|
117
|
+
configPath: Schema.SchemaClass<string, string, never>;
|
|
118
|
+
storeId: Schema.SchemaClass<string, string, never>;
|
|
119
|
+
clientId: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
120
|
+
data: Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>;
|
|
121
|
+
force: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
122
|
+
dryRun: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
123
|
+
}>;
|
|
124
|
+
readonly success: Schema.Struct<{
|
|
125
|
+
storeId: typeof Schema.String;
|
|
126
|
+
eventCount: typeof Schema.Number;
|
|
127
|
+
dryRun: typeof Schema.Boolean;
|
|
128
|
+
}>;
|
|
129
|
+
readonly failure: typeof Schema.Never;
|
|
130
|
+
readonly failureMode: "error";
|
|
131
|
+
}, never>;
|
|
132
|
+
}>;
|
|
133
|
+
//# 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,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAI/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyT5B,CAAA"}
|