@livestore/cli 0.4.0-dev.7 → 0.4.0-dev.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/cli",
3
- "version": "0.4.0-dev.7",
3
+ "version": "0.4.0-dev.8",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -10,14 +10,13 @@
10
10
  "livestore": "./dist/bin.js"
11
11
  },
12
12
  "dependencies": {
13
- "@effect/ai-openai": "0.29.0",
14
- "@livestore/common": "0.4.0-dev.7",
15
- "@livestore/utils": "0.4.0-dev.7",
16
- "@livestore/utils-dev": "0.4.0-dev.7"
13
+ "@effect/ai-openai": "0.30.1",
14
+ "@livestore/common": "0.4.0-dev.8",
15
+ "@livestore/utils": "0.4.0-dev.8"
17
16
  },
18
17
  "devDependencies": {
19
18
  "@types/node": "24.2.0",
20
- "typescript": "^5.9.2"
19
+ "typescript": "5.9.2"
21
20
  },
22
21
  "files": [
23
22
  "package.json",
@@ -1,17 +1,18 @@
1
1
  import { OpenAiClient, OpenAiLanguageModel } from '@effect/ai-openai'
2
2
  import {
3
3
  AiError,
4
- AiLanguageModel,
5
- AiTool,
6
4
  Config,
7
5
  Effect,
8
6
  FetchHttpClient,
7
+ LanguageModel,
9
8
  Layer,
9
+ Prompt,
10
10
  Schema,
11
+ Tool,
11
12
  } from '@livestore/utils/effect'
12
13
 
13
14
  // Define the coach tool that analyzes LiveStore usage
14
- export const coachTool = AiTool.make('livestore_coach', {
15
+ export const coachTool = Tool.make('livestore_coach', {
15
16
  description:
16
17
  'Analyze LiveStore code (schemas, queries, mutations, etc.) and provide AI-powered feedback on best practices, performance, and improvements.',
17
18
  parameters: {
@@ -58,7 +59,10 @@ export const coachToolHandler = Effect.fnUntraced(
58
59
  // Build the analysis prompt
59
60
  const codeTypeContext = codeType ? `This is ${codeType} code using LiveStore. ` : 'This is LiveStore code. '
60
61
 
61
- const prompt = `${codeTypeContext}Please review the following code and provide helpful feedback focusing on:
62
+ const prompt = Prompt.makeMessage('user', {
63
+ content: [
64
+ Prompt.makePart('text', {
65
+ text: `${codeTypeContext}Please review the following code and provide helpful feedback focusing on:
62
66
 
63
67
  1. LiveStore best practices and conventions
64
68
  2. Schema design and relationships (if applicable)
@@ -79,13 +83,18 @@ Please provide:
79
83
  3. Best practice recommendations
80
84
  4. Any potential issues or concerns
81
85
 
82
- Format your response as constructive feedback that helps developers improve their LiveStore usage.`
86
+ Format your response as constructive feedback that helps developers improve their LiveStore usage.`,
87
+ }),
88
+ ],
89
+ })
83
90
 
84
- const systemPrompt = `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.`
91
+ const systemPrompt = Prompt.makeMessage('system', {
92
+ 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.`,
93
+ })
85
94
 
86
95
  // Get OpenAI client and call the API
87
- const llm = yield* AiLanguageModel.AiLanguageModel
88
- const completion = yield* llm.generateText({ prompt, system: systemPrompt })
96
+ const llm = yield* LanguageModel.LanguageModel
97
+ const completion = yield* llm.generateText({ prompt: Prompt.fromMessages([systemPrompt, prompt]) })
89
98
 
90
99
  const feedback = completion.text ?? 'Unable to generate feedback'
91
100
 
@@ -1,4 +1,4 @@
1
- import { AiTool, AiToolkit, Effect, Schema } from '@livestore/utils/effect'
1
+ import { Effect, Schema, Tool, Toolkit } from '@livestore/utils/effect'
2
2
  import { blogSchemaContent } from '../mcp-content/schemas/blog.ts'
3
3
  import { ecommerceSchemaContent } from '../mcp-content/schemas/ecommerce.ts'
4
4
  import { socialSchemaContent } from '../mcp-content/schemas/social.ts'
@@ -6,10 +6,10 @@ import { todoSchemaContent } from '../mcp-content/schemas/todo.ts'
6
6
  import { coachTool, coachToolHandler } from './mcp-coach.ts'
7
7
 
8
8
  // Create toolkit with tools and handlers following Tim Smart's pattern
9
- export const livestoreToolkit = AiToolkit.make(
9
+ export const livestoreToolkit = Toolkit.make(
10
10
  coachTool,
11
11
 
12
- AiTool.make('livestore_generate_schema', {
12
+ Tool.make('livestore_generate_schema', {
13
13
  description:
14
14
  '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.',
15
15
  parameters: {
@@ -33,7 +33,7 @@ export const livestoreToolkit = AiToolkit.make(
33
33
  }),
34
34
  }),
35
35
 
36
- AiTool.make('livestore_get_example_schema', {
36
+ Tool.make('livestore_get_example_schema', {
37
37
  description:
38
38
  'Get a complete example LiveStore schema with TypeScript code. Returns ready-to-use schema definitions for common application types.',
39
39
  parameters: {
@@ -50,8 +50,8 @@ export const livestoreToolkit = AiToolkit.make(
50
50
  }),
51
51
  }),
52
52
  })
53
- .annotate(AiTool.Readonly, true)
54
- .annotate(AiTool.Destructive, false),
53
+ .annotate(Tool.Readonly, true)
54
+ .annotate(Tool.Destructive, false),
55
55
  )
56
56
 
57
57
  // Tool handlers using Tim Smart's pattern