@livestore/cli 0.4.0 → 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.
Files changed (120) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/__tests__/fixtures/mock-config.d.ts +7 -9
  3. package/dist/__tests__/fixtures/mock-config.d.ts.map +1 -1
  4. package/dist/__tests__/fixtures/mock-config.js +6 -6
  5. package/dist/__tests__/fixtures/mock-config.js.map +1 -1
  6. package/dist/__tests__/sync-operations.test.js +20 -20
  7. package/dist/__tests__/sync-operations.test.js.map +1 -1
  8. package/dist/bin.js +6 -5
  9. package/dist/bin.js.map +1 -1
  10. package/dist/cli.d.ts +2 -23
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +1 -1
  13. package/dist/cli.js.map +1 -1
  14. package/dist/commands/__fixtures__/mcp-protocol-server.d.ts +2 -0
  15. package/dist/commands/__fixtures__/mcp-protocol-server.d.ts.map +1 -0
  16. package/dist/commands/__fixtures__/mcp-protocol-server.js +10 -0
  17. package/dist/commands/__fixtures__/mcp-protocol-server.js.map +1 -0
  18. package/dist/commands/import-export.d.ts +5 -19
  19. package/dist/commands/import-export.d.ts.map +1 -1
  20. package/dist/commands/import-export.js +12 -12
  21. package/dist/commands/import-export.js.map +1 -1
  22. package/dist/commands/mcp-coach.d.ts +8 -7
  23. package/dist/commands/mcp-coach.d.ts.map +1 -1
  24. package/dist/commands/mcp-coach.js +10 -10
  25. package/dist/commands/mcp-coach.js.map +1 -1
  26. package/dist/commands/mcp-protocols.d.ts +7 -0
  27. package/dist/commands/mcp-protocols.d.ts.map +1 -0
  28. package/dist/commands/mcp-protocols.js +12 -0
  29. package/dist/commands/mcp-protocols.js.map +1 -0
  30. package/dist/commands/mcp-protocols.test.d.ts +2 -0
  31. package/dist/commands/mcp-protocols.test.d.ts.map +1 -0
  32. package/dist/commands/mcp-protocols.test.js +60 -0
  33. package/dist/commands/mcp-protocols.test.js.map +1 -0
  34. package/dist/commands/mcp-stdio.test.d.ts +2 -0
  35. package/dist/commands/mcp-stdio.test.d.ts.map +1 -0
  36. package/dist/commands/mcp-stdio.test.js +79 -0
  37. package/dist/commands/mcp-stdio.test.js.map +1 -0
  38. package/dist/commands/mcp-tool-handlers.d.ts +1 -1
  39. package/dist/commands/mcp-tool-handlers.d.ts.map +1 -1
  40. package/dist/commands/mcp-tool-handlers.js +1 -0
  41. package/dist/commands/mcp-tool-handlers.js.map +1 -1
  42. package/dist/commands/mcp-tools-defs.d.ts +65 -64
  43. package/dist/commands/mcp-tools-defs.d.ts.map +1 -1
  44. package/dist/commands/mcp-tools-defs.js +59 -52
  45. package/dist/commands/mcp-tools-defs.js.map +1 -1
  46. package/dist/commands/mcp-tools-defs.test.d.ts +2 -0
  47. package/dist/commands/mcp-tools-defs.test.d.ts.map +1 -0
  48. package/dist/commands/mcp-tools-defs.test.js +11 -0
  49. package/dist/commands/mcp-tools-defs.test.js.map +1 -0
  50. package/dist/commands/mcp.d.ts +1 -3
  51. package/dist/commands/mcp.d.ts.map +1 -1
  52. package/dist/commands/mcp.js +5 -4
  53. package/dist/commands/mcp.js.map +1 -1
  54. package/dist/commands/new-project.d.ts +19 -27
  55. package/dist/commands/new-project.d.ts.map +1 -1
  56. package/dist/commands/new-project.js +17 -16
  57. package/dist/commands/new-project.js.map +1 -1
  58. package/dist/mcp-content/architecture.d.ts +1 -1
  59. package/dist/mcp-content/architecture.d.ts.map +1 -1
  60. package/dist/mcp-content/architecture.js +3 -3
  61. package/dist/mcp-content/features.d.ts +1 -1
  62. package/dist/mcp-content/features.d.ts.map +1 -1
  63. package/dist/mcp-content/features.js +1 -1
  64. package/dist/mcp-content/getting-started.d.ts +1 -1
  65. package/dist/mcp-content/getting-started.d.ts.map +1 -1
  66. package/dist/mcp-content/getting-started.js +37 -37
  67. package/dist/mcp-content/overview.d.ts +1 -1
  68. package/dist/mcp-content/overview.d.ts.map +1 -1
  69. package/dist/mcp-content/overview.js +6 -6
  70. package/dist/mcp-content/schemas/blog.d.ts +1 -1
  71. package/dist/mcp-content/schemas/blog.d.ts.map +1 -1
  72. package/dist/mcp-content/schemas/blog.js +25 -25
  73. package/dist/mcp-content/schemas/ecommerce.d.ts +1 -1
  74. package/dist/mcp-content/schemas/ecommerce.d.ts.map +1 -1
  75. package/dist/mcp-content/schemas/ecommerce.js +67 -67
  76. package/dist/mcp-content/schemas/social.d.ts +1 -1
  77. package/dist/mcp-content/schemas/social.d.ts.map +1 -1
  78. package/dist/mcp-content/schemas/social.js +48 -48
  79. package/dist/mcp-content/schemas/todo.d.ts +1 -1
  80. package/dist/mcp-content/schemas/todo.d.ts.map +1 -1
  81. package/dist/mcp-content/schemas/todo.js +35 -35
  82. package/dist/mcp-runtime/runtime.d.ts +2 -2
  83. package/dist/mcp-runtime/runtime.d.ts.map +1 -1
  84. package/dist/mcp-runtime/runtime.js +4 -4
  85. package/dist/mcp-runtime/runtime.js.map +1 -1
  86. package/dist/module-loader.d.ts +2 -2
  87. package/dist/module-loader.d.ts.map +1 -1
  88. package/dist/module-loader.js +6 -6
  89. package/dist/module-loader.js.map +1 -1
  90. package/dist/sync-operations.d.ts +24 -30
  91. package/dist/sync-operations.d.ts.map +1 -1
  92. package/dist/sync-operations.js +10 -12
  93. package/dist/sync-operations.js.map +1 -1
  94. package/package.json +30 -44
  95. package/src/__tests__/fixtures/mock-config.ts +8 -8
  96. package/src/__tests__/sync-operations.test.ts +21 -35
  97. package/src/bin.ts +7 -6
  98. package/src/cli.ts +1 -1
  99. package/src/commands/__fixtures__/mcp-protocol-server.ts +12 -0
  100. package/src/commands/import-export.ts +29 -29
  101. package/src/commands/mcp-coach.ts +12 -11
  102. package/src/commands/mcp-protocols.test.ts +76 -0
  103. package/src/commands/mcp-protocols.ts +12 -0
  104. package/src/commands/mcp-stdio.test.ts +93 -0
  105. package/src/commands/mcp-tool-handlers.ts +11 -8
  106. package/src/commands/mcp-tools-defs.test.ts +13 -0
  107. package/src/commands/mcp-tools-defs.ts +53 -51
  108. package/src/commands/mcp.ts +7 -4
  109. package/src/commands/new-project.ts +49 -36
  110. package/src/mcp-content/architecture.ts +3 -3
  111. package/src/mcp-content/features.ts +1 -1
  112. package/src/mcp-content/getting-started.ts +37 -37
  113. package/src/mcp-content/overview.ts +6 -6
  114. package/src/mcp-content/schemas/blog.ts +25 -25
  115. package/src/mcp-content/schemas/ecommerce.ts +67 -67
  116. package/src/mcp-content/schemas/social.ts +48 -48
  117. package/src/mcp-content/schemas/todo.ts +35 -35
  118. package/src/mcp-runtime/runtime.ts +7 -7
  119. package/src/module-loader.ts +10 -10
  120. package/src/sync-operations.ts +16 -16
@@ -4,53 +4,47 @@
4
4
  */
5
5
  import type { SyncBackend } from '@livestore/common';
6
6
  import { UnknownError } from '@livestore/common';
7
- import { Effect, type FileSystem, type HttpClient, Schema, type Scope } from '@livestore/utils/effect';
7
+ import { Cause, Effect, type FileSystem, type HttpClient, Schema, type Scope } from '@livestore/utils/effect';
8
8
  /**
9
9
  * Schema for the export file format.
10
10
  * Contains metadata about the export and an array of events in global encoded format.
11
11
  */
12
12
  export declare const ExportFileSchema: Schema.Struct<{
13
13
  /** Format version for future compatibility */
14
- version: Schema.Literal<[1]>;
14
+ readonly version: Schema.Literal<1>;
15
15
  /** Store identifier */
16
- storeId: typeof Schema.String;
16
+ readonly storeId: Schema.String;
17
17
  /** ISO timestamp of when the export was created */
18
- exportedAt: typeof Schema.String;
18
+ readonly exportedAt: Schema.String;
19
19
  /** Total number of events in the export */
20
- eventCount: typeof Schema.Number;
20
+ readonly eventCount: Schema.Number;
21
21
  /** Array of events in global encoded format */
22
- events: Schema.Array$<Schema.Struct<{
23
- name: typeof Schema.String;
24
- args: typeof Schema.Any;
25
- seqNum: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
26
- parentSeqNum: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">, number, never>;
27
- clientId: typeof Schema.String;
28
- sessionId: typeof Schema.String;
22
+ readonly events: Schema.$Array<Schema.Struct<{
23
+ readonly name: Schema.String;
24
+ readonly args: Schema.Any;
25
+ readonly seqNum: Schema.brand<Schema.Int, "GlobalEventSequenceNumber">;
26
+ readonly parentSeqNum: Schema.brand<Schema.Int, "GlobalEventSequenceNumber">;
27
+ readonly clientId: Schema.String;
28
+ readonly sessionId: Schema.String;
29
29
  }>>;
30
30
  }>;
31
31
  export type ExportFile = typeof ExportFileSchema.Type;
32
- declare const ConnectionError_base: Schema.TaggedErrorClass<ConnectionError, "ConnectionError", {
33
- readonly _tag: Schema.tag<"ConnectionError">;
34
- } & {
35
- cause: typeof Schema.Defect;
36
- note: typeof Schema.String;
37
- }>;
32
+ declare const ConnectionError_base: Schema.Class<ConnectionError, Schema.TaggedStruct<"ConnectionError", {
33
+ readonly cause: Schema.Defect;
34
+ readonly note: Schema.String;
35
+ }>, Cause.YieldableError>;
38
36
  export declare class ConnectionError extends ConnectionError_base {
39
37
  }
40
- declare const ExportError_base: Schema.TaggedErrorClass<ExportError, "ExportError", {
41
- readonly _tag: Schema.tag<"ExportError">;
42
- } & {
43
- cause: typeof Schema.Defect;
44
- note: typeof Schema.String;
45
- }>;
38
+ declare const ExportError_base: Schema.Class<ExportError, Schema.TaggedStruct<"ExportError", {
39
+ readonly cause: Schema.Defect;
40
+ readonly note: Schema.String;
41
+ }>, Cause.YieldableError>;
46
42
  export declare class ExportError extends ExportError_base {
47
43
  }
48
- declare const ImportError_base: Schema.TaggedErrorClass<ImportError, "ImportError", {
49
- readonly _tag: Schema.tag<"ImportError">;
50
- } & {
51
- cause: typeof Schema.Defect;
52
- note: typeof Schema.String;
53
- }>;
44
+ declare const ImportError_base: Schema.Class<ImportError, Schema.TaggedStruct<"ImportError", {
45
+ readonly cause: Schema.Defect;
46
+ readonly note: Schema.String;
47
+ }>, Cause.YieldableError>;
54
48
  export declare class ImportError extends ImportError_base {
55
49
  }
56
50
  /**
@@ -1 +1 @@
1
- {"version":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AAA;CACpE,KAAG,MAAM,CAAC,MAAM,CACf,YAAY,EACZ,WAAW,GAAG,YAAY,GAAG,eAAe,EAC5C,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,GAAG,KAAK,CAAC,KAAK,CA2FjB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { UnknownError } from '@livestore/common';
2
2
  import { LiveStoreEvent } from '@livestore/common/schema';
3
- import { Cause, Chunk, Effect, KeyValueStore, Option, Schema, Stream, SubscriptionRef, } from '@livestore/utils/effect';
3
+ import { Cause, Effect, KeyValueStore, Option, Schema, Stream, SubscriptionRef, } from '@livestore/utils/effect';
4
4
  import { loadModuleConfig } from "./module-loader.js";
5
5
  /** Connection timeout for sync backend ping (5 seconds) */
6
6
  const CONNECTION_TIMEOUT_MS = 5000;
@@ -21,17 +21,17 @@ export const ExportFileSchema = Schema.Struct({
21
21
  events: Schema.Array(LiveStoreEvent.Global.Encoded),
22
22
  });
23
23
  export class ConnectionError extends Schema.TaggedError('~@livestore/cli/ConnectionError')('ConnectionError', {
24
- cause: Schema.Defect,
24
+ cause: Schema.Defect(),
25
25
  note: Schema.String,
26
26
  }) {
27
27
  }
28
28
  export class ExportError extends Schema.TaggedError('~@livestore/cli/ExportError')('ExportError', {
29
- cause: Schema.Defect,
29
+ cause: Schema.Defect(),
30
30
  note: Schema.String,
31
31
  }) {
32
32
  }
33
33
  export class ImportError extends Schema.TaggedError('~@livestore/cli/ImportError')('ImportError', {
34
- cause: Schema.Defect,
34
+ cause: Schema.Defect(),
35
35
  note: Schema.String,
36
36
  }) {
37
37
  }
@@ -53,8 +53,8 @@ export const makeSyncBackend = ({ configPath, storeId, clientId, }) => Effect.ge
53
53
  note: `Failed to connect to sync backend: ${cause._tag === 'IsOfflineError' ? 'Backend is offline or unreachable' : String(cause)}`,
54
54
  })));
55
55
  /** Verify connectivity with a ping (with timeout) */
56
- yield* syncBackend.ping.pipe(Effect.timeout(CONNECTION_TIMEOUT_MS), Effect.catchAll((cause) => {
57
- if (Cause.isTimeoutException(cause) === true) {
56
+ yield* syncBackend.ping.pipe(Effect.timeout(CONNECTION_TIMEOUT_MS), Effect.catch((cause) => {
57
+ if (Cause.isTimeoutError(cause) === true) {
58
58
  return Effect.fail(new ConnectionError({
59
59
  cause,
60
60
  note: `Connection timeout: Sync backend did not respond within ${CONNECTION_TIMEOUT_MS}ms`,
@@ -70,7 +70,7 @@ export const makeSyncBackend = ({ configPath, storeId, clientId, }) => Effect.ge
70
70
  const releaseSyncBackend = (syncBackend) => {
71
71
  const maybeDisconnect = syncBackend.disconnect;
72
72
  const releaseEffect = maybeDisconnect ?? SubscriptionRef.set(syncBackend.isConnected, false);
73
- return releaseEffect.pipe(Effect.orElse(() => Effect.void));
73
+ return releaseEffect.pipe(Effect.catch(() => Effect.void));
74
74
  };
75
75
  /**
76
76
  * Core export operation - pulls all events from sync backend.
@@ -82,9 +82,7 @@ export const pullEventsFromSyncBackend = ({ configPath, storeId, clientId, }) =>
82
82
  cause,
83
83
  note: `Failed to pull events from sync backend: ${String(cause)}`,
84
84
  })));
85
- const events = Chunk.toReadonlyArray(batchesChunk)
86
- .flatMap((item) => item.batch)
87
- .map((item) => item.eventEncoded);
85
+ const events = batchesChunk.flatMap((item) => item.batch).map((item) => item.eventEncoded);
88
86
  const exportedAt = new Date().toISOString();
89
87
  const exportData = {
90
88
  version: 1,
@@ -106,7 +104,7 @@ export const pullEventsFromSyncBackend = ({ configPath, storeId, clientId, }) =>
106
104
  * Returns validation info without actually importing.
107
105
  */
108
106
  export const validateExportData = ({ data, targetStoreId, }) => Effect.gen(function* () {
109
- const exportData = yield* Schema.decodeUnknown(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
107
+ const exportData = yield* Schema.decodeUnknownEffect(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
110
108
  cause: new Error(`Invalid export file format: ${String(cause)}`),
111
109
  note: `Invalid export file format: ${String(cause)}`,
112
110
  })));
@@ -122,7 +120,7 @@ export const validateExportData = ({ data, targetStoreId, }) => Effect.gen(funct
122
120
  * Validates that the backend is empty before importing.
123
121
  */
124
122
  export const pushEventsToSyncBackend = ({ configPath, storeId, clientId, data, force, dryRun, onProgress, }) => Effect.acquireUseRelease(makeSyncBackend({ configPath, storeId, clientId }), (syncBackend) => Effect.gen(function* () {
125
- const exportData = yield* Schema.decodeUnknown(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
123
+ const exportData = yield* Schema.decodeUnknownEffect(ExportFileSchema)(data).pipe(Effect.mapError((cause) => new ImportError({
126
124
  cause: new Error(`Invalid export file format: ${String(cause)}`),
127
125
  note: `Invalid export file format: ${String(cause)}`,
128
126
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"sync-operations.js","sourceRoot":"","sources":["../src/sync-operations.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EACL,KAAK,EACL,KAAK,EACL,MAAM,EAGN,aAAa,EACb,MAAM,EACN,MAAM,EAEN,MAAM,EACN,eAAe,GAChB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,2DAA2D;AAC3D,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAA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EAAE,KAAK;QACb,WAAW;KACZ,CAAA;AACH,CAAC,CAAC,EACJ,kBAAkB,CACnB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@livestore/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0-dev.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/livestorejs/livestore.git"
7
+ "url": "git+https://github.com/livestorejs/livestore-contrib.git"
8
8
  },
9
9
  "bin": {
10
10
  "livestore": "./dist/bin.js"
@@ -23,63 +23,49 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@effect/ai": "0.35.0",
27
- "@effect/ai-openai": "0.39.0",
28
- "@effect/experimental": "0.60.0",
29
- "@effect/opentelemetry": "0.63.0",
30
- "@effect/platform": "0.96.1",
31
- "@effect/rpc": "0.75.1",
32
- "effect": "3.21.2",
33
- "@livestore/common": "^0.4.0",
34
- "@livestore/adapter-node": "^0.4.0",
35
- "@livestore/peer-deps": "^0.4.0",
36
- "@livestore/utils": "^0.4.0",
37
- "@livestore/livestore": "^0.4.0"
26
+ "@effect/ai-openai": "4.0.0-rc.111",
27
+ "@effect/opentelemetry": "4.0.0-rc.111",
28
+ "@livestore/adapter-node": "0.5.0-dev.0",
29
+ "@livestore/common": "0.5.0-dev.0",
30
+ "@livestore/livestore": "0.5.0-dev.0",
31
+ "@livestore/peer-deps": "0.5.0-dev.0",
32
+ "@livestore/utils": "0.5.0-dev.0",
33
+ "effect": "4.0.0-rc.111"
38
34
  },
39
35
  "devDependencies": {
36
+ "@livestore/utils-dev": "0.5.0-dev.0",
40
37
  "@types/node": "25.3.3",
41
- "typescript": "5.9.3",
42
- "vitest": "3.2.4",
43
- "@livestore/utils-dev": "^0.4.0"
38
+ "typescript": "6.0.3",
39
+ "vitest": "4.1.9"
44
40
  },
45
41
  "peerDependencies": {
46
- "@effect/ai": "^0.35.0",
47
- "@effect/cli": "^0.75.1",
48
- "@effect/cluster": "^0.58.2",
49
- "@effect/experimental": "^0.60.0",
50
- "@effect/opentelemetry": "^0.63.0",
51
- "@effect/platform": "^0.96.1",
52
- "@effect/platform-browser": "^0.76.0",
53
- "@effect/platform-bun": "^0.89.0",
54
- "@effect/platform-node": "^0.106.0",
55
- "@effect/printer": "^0.49.0",
56
- "@effect/printer-ansi": "^0.49.0",
57
- "@effect/rpc": "^0.75.1",
58
- "@effect/sql": "^0.51.1",
59
- "@effect/typeclass": "^0.40.0",
60
- "@effect/vitest": "^0.29.0",
42
+ "@effect/opentelemetry": "^4.0.0-rc.111",
43
+ "@effect/platform-browser": "^4.0.0-rc.111",
44
+ "@effect/platform-bun": "^4.0.0-rc.111",
45
+ "@effect/platform-node": "^4.0.0-rc.111",
46
+ "@effect/platform-node-shared": "^4.0.0-rc.111",
47
+ "@effect/vitest": "^4.0.0-rc.111",
61
48
  "@opentelemetry/api": "^1.9.0",
62
49
  "@opentelemetry/resources": "^2.2.0",
63
50
  "@standard-schema/spec": "^1.1.0",
64
- "effect": "^3.21.2"
51
+ "effect": "^4.0.0-rc.111"
65
52
  },
66
53
  "$genie": {
67
54
  "source": "package.json.genie.ts",
68
55
  "warning": "DO NOT EDIT - changes will be overwritten",
69
56
  "workspaceClosureDirs": [
70
57
  "packages/@livestore/adapter-node",
71
- "packages/@livestore/adapter-web",
72
58
  "packages/@livestore/cli",
73
- "packages/@livestore/common",
74
- "packages/@livestore/common-cf",
75
- "packages/@livestore/devtools-web-common",
76
- "packages/@livestore/livestore",
77
- "packages/@livestore/peer-deps",
78
- "packages/@livestore/sqlite-wasm",
79
- "packages/@livestore/utils",
80
- "packages/@livestore/utils-dev",
81
- "packages/@livestore/wa-sqlite",
82
- "packages/@livestore/webmesh"
59
+ "repos/livestore/packages/@livestore/adapter-web",
60
+ "repos/livestore/packages/@livestore/common",
61
+ "repos/livestore/packages/@livestore/common-cf",
62
+ "repos/livestore/packages/@livestore/livestore",
63
+ "repos/livestore/packages/@livestore/peer-deps",
64
+ "repos/livestore/packages/@livestore/sqlite-wasm",
65
+ "repos/livestore/packages/@livestore/utils",
66
+ "repos/livestore/packages/@livestore/utils-dev",
67
+ "repos/livestore/packages/@livestore/wa-sqlite",
68
+ "repos/livestore/packages/@livestore/webmesh"
83
69
  ]
84
70
  },
85
71
  "scripts": {
@@ -4,12 +4,12 @@ import { fileURLToPath, pathToFileURL } from 'node:url'
4
4
  import { Events, makeSchema, State } from '@livestore/common/schema'
5
5
  import type { MockSyncBackend } from '@livestore/common/sync'
6
6
  import { EventFactory } from '@livestore/common/testing'
7
- import { Effect, FileSystem, type Mailbox, Schema } from '@livestore/utils/effect'
7
+ import { Effect, FileSystem, type Queue, Schema } from '@livestore/utils/effect'
8
8
 
9
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url))
10
10
 
11
11
  class DynamicImportError extends Schema.TaggedError<DynamicImportError>()('DynamicImportError', {
12
- cause: Schema.Defect,
12
+ cause: Schema.Defect(),
13
13
  path: Schema.String,
14
14
  }) {}
15
15
 
@@ -49,21 +49,21 @@ const makeTempConfig = () => {
49
49
  const moduleSource = `
50
50
  import { schema } from ${JSON.stringify(schemaModuleUrl)}
51
51
  import { makeMockSyncBackend } from '@livestore/common/sync'
52
- import { Effect, Mailbox } from '@livestore/utils/effect'
52
+ import { Effect, Queue } from '@livestore/utils/effect'
53
53
 
54
54
  export const mockBackend = await Effect.runPromise(Effect.scoped(makeMockSyncBackend({ startConnected: true })))
55
- export const connectionEvents = await Effect.runPromise(Mailbox.make<'connect' | 'disconnect'>())
55
+ export const connectionEvents = await Effect.runPromise(Queue.make<'connect' | 'disconnect'>())
56
56
 
57
57
  export { schema }
58
58
 
59
59
  export const syncBackend = (_args) =>
60
60
  mockBackend.makeSyncBackend.pipe(
61
- Effect.tap(() => connectionEvents.offer('connect')),
61
+ Effect.tap(() => Queue.offer(connectionEvents, 'connect')),
62
62
  Effect.map((backend) => {
63
63
  const disconnect = backend.disconnect ?? Effect.void
64
64
  return {
65
65
  ...backend,
66
- disconnect: disconnect.pipe(Effect.tap(() => connectionEvents.offer('disconnect'))),
66
+ disconnect: disconnect.pipe(Effect.tap(() => Queue.offer(connectionEvents, 'disconnect'))),
67
67
  }
68
68
  }),
69
69
  )
@@ -92,7 +92,7 @@ export const useMockConfig = Effect.acquireRelease(
92
92
  catch: (cause) => new DynamicImportError({ cause, path: tempPath }),
93
93
  })) as {
94
94
  mockBackend: MockSyncBackend
95
- connectionEvents: Mailbox.Mailbox<'connect' | 'disconnect'>
95
+ connectionEvents: Queue.Queue<'connect' | 'disconnect'>
96
96
  }
97
97
 
98
98
  return { configPath: tempPath, mockBackend: mod.mockBackend, connectionEvents: mod.connectionEvents }
@@ -100,7 +100,7 @@ export const useMockConfig = Effect.acquireRelease(
100
100
  ({ configPath }) =>
101
101
  Effect.gen(function* () {
102
102
  const fs = yield* FileSystem.FileSystem
103
- yield* fs.remove(configPath, { recursive: false }).pipe(Effect.catchAll(() => Effect.void))
103
+ yield* fs.remove(configPath, { recursive: false }).pipe(Effect.catch(() => Effect.void))
104
104
  }),
105
105
  )
106
106
 
@@ -1,9 +1,7 @@
1
- import { expect } from 'vitest'
2
-
3
- import type { LiveStoreEvent } from '@livestore/common/schema'
4
- import { Vitest } from '@livestore/utils-dev/node-vitest'
5
- import { Chunk, Effect, FetchHttpClient, Layer, Mailbox, Stream } from '@livestore/utils/effect'
1
+ import { Effect, FetchHttpClient, Layer, Queue, Stream } from '@livestore/utils/effect'
6
2
  import { PlatformNode } from '@livestore/utils/node'
3
+ import { Vitest } from '@livestore/utils-dev/node-vitest'
4
+ import { expect } from 'vitest'
7
5
 
8
6
  import { pullEventsFromSyncBackend, pushEventsToSyncBackend } from '../sync-operations.ts'
9
7
  import { makeEventFactory, useMockConfig } from './fixtures/mock-config.ts'
@@ -18,15 +16,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
18
16
 
19
17
  /** Collects the connect + disconnect lifecycle emitted by the mock sync backend. */
20
18
  const expectConnectLifecycle = (
21
- mailbox: Mailbox.Mailbox<'connect' | 'disconnect'>,
19
+ mailbox: Queue.Queue<'connect' | 'disconnect'>,
22
20
  ): Effect.Effect<ReadonlyArray<'connect' | 'disconnect'>> =>
23
- Mailbox.toStream(mailbox).pipe(
24
- Stream.take(2),
25
- Stream.runCollect,
26
- Effect.map((chunk) => Chunk.toReadonlyArray(chunk)),
27
- )
21
+ Stream.fromQueue(mailbox).pipe(Stream.take(2), Stream.runCollect)
28
22
 
29
- Vitest.scopedLive('exports events and releases the backend connection', (test: Vitest.TestContext) =>
23
+ Vitest.live('exports events and releases the backend connection', (test: Vitest.TestContext) =>
30
24
  Effect.gen(function* () {
31
25
  const { mockBackend, connectionEvents, configPath } = yield* useMockConfig
32
26
  const factory = makeEventFactory()
@@ -52,7 +46,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
52
46
  }).pipe(withTestCtx(test)),
53
47
  )
54
48
 
55
- Vitest.scopedLive('fails import when backend is not empty', (test: Vitest.TestContext) =>
49
+ Vitest.live('fails import when backend is not empty', (test: Vitest.TestContext) =>
56
50
  Effect.gen(function* () {
57
51
  const { mockBackend, connectionEvents, configPath } = yield* useMockConfig
58
52
  const factory = makeEventFactory()
@@ -77,11 +71,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
77
71
  },
78
72
  force: false,
79
73
  dryRun: false,
80
- }).pipe(Effect.either)
74
+ }).pipe(Effect.result)
81
75
 
82
- expect(result._tag).toBe('Left')
83
- if (result._tag === 'Left') {
84
- expect(result.left._tag).toBe('ImportError')
76
+ expect(result._tag).toBe('Failure')
77
+ if (result._tag === 'Failure') {
78
+ expect(result.failure._tag).toBe('ImportError')
85
79
  }
86
80
 
87
81
  const lifecycle = yield* expectConnectLifecycle(connectionEvents)
@@ -89,7 +83,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
89
83
  }).pipe(withTestCtx(test)),
90
84
  )
91
85
 
92
- Vitest.scopedLive('supports dry-run import and releases backend', (test: Vitest.TestContext) =>
86
+ Vitest.live('supports dry-run import and releases backend', (test: Vitest.TestContext) =>
93
87
  Effect.gen(function* () {
94
88
  const { configPath, connectionEvents } = yield* useMockConfig
95
89
  const factory = makeEventFactory()
@@ -118,7 +112,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
118
112
  }).pipe(withTestCtx(test)),
119
113
  )
120
114
 
121
- Vitest.scopedLive('imports events into empty backend with progress and batching', (test: Vitest.TestContext) =>
115
+ Vitest.live('imports events into empty backend with progress and batching', (test: Vitest.TestContext) =>
122
116
  Effect.gen(function* () {
123
117
  const { mockBackend, configPath, connectionEvents } = yield* useMockConfig
124
118
  const factory = makeEventFactory()
@@ -151,11 +145,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
151
145
  { pushed: 120, total: 120 },
152
146
  ])
153
147
 
154
- const pushedEvents = yield* mockBackend.pushedEvents.pipe(
155
- Stream.take(importBatch.length),
156
- Stream.runCollect,
157
- Effect.map((chunk: Chunk.Chunk<LiveStoreEvent.Global.Encoded>) => Chunk.toReadonlyArray(chunk)),
158
- )
148
+ const pushedEvents = yield* mockBackend.pushedEvents.pipe(Stream.take(importBatch.length), Stream.runCollect)
159
149
  expect(pushedEvents.map((event) => event.seqNum)).toHaveLength(importBatch.length)
160
150
 
161
151
  const lifecycle = yield* expectConnectLifecycle(connectionEvents)
@@ -163,7 +153,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
163
153
  }).pipe(withTestCtx(test)),
164
154
  )
165
155
 
166
- Vitest.scopedLive('allows force import on store ID mismatch', (test: Vitest.TestContext) =>
156
+ Vitest.live('allows force import on store ID mismatch', (test: Vitest.TestContext) =>
167
157
  Effect.gen(function* () {
168
158
  const { mockBackend, configPath, connectionEvents } = yield* useMockConfig
169
159
  const factory = makeEventFactory()
@@ -187,11 +177,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
187
177
  expect(result.dryRun).toBe(false)
188
178
  expect(result.eventCount).toBe(importBatch.length)
189
179
 
190
- const pushedEvents = yield* mockBackend.pushedEvents.pipe(
191
- Stream.take(1),
192
- Stream.runCollect,
193
- Effect.map((chunk: Chunk.Chunk<LiveStoreEvent.Global.Encoded>) => Chunk.toReadonlyArray(chunk)),
194
- )
180
+ const pushedEvents = yield* mockBackend.pushedEvents.pipe(Stream.take(1), Stream.runCollect)
195
181
  expect(pushedEvents).toHaveLength(1)
196
182
 
197
183
  const lifecycle = yield* expectConnectLifecycle(connectionEvents)
@@ -199,7 +185,7 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
199
185
  }).pipe(withTestCtx(test)),
200
186
  )
201
187
 
202
- Vitest.scopedLive('rejects store ID mismatch without force', (test: Vitest.TestContext) =>
188
+ Vitest.live('rejects store ID mismatch without force', (test: Vitest.TestContext) =>
203
189
  Effect.gen(function* () {
204
190
  const { configPath, connectionEvents } = yield* useMockConfig
205
191
  const factory = makeEventFactory()
@@ -218,11 +204,11 @@ Vitest.describe('sync-operations', { timeout: 10_000 }, () => {
218
204
  },
219
205
  force: false,
220
206
  dryRun: false,
221
- }).pipe(Effect.either)
207
+ }).pipe(Effect.result)
222
208
 
223
- expect(result._tag).toBe('Left')
224
- if (result._tag === 'Left') {
225
- expect(result.left._tag).toBe('ImportError')
209
+ expect(result._tag).toBe('Failure')
210
+ if (result._tag === 'Failure') {
211
+ expect(result.failure._tag).toBe('ImportError')
226
212
  }
227
213
 
228
214
  const lifecycle = yield* expectConnectLifecycle(connectionEvents)
package/src/bin.ts CHANGED
@@ -1,25 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { liveStoreVersion } from '@livestore/common'
4
- import { Console, Effect, FetchHttpClient, Layer, Logger, LogLevel } from '@livestore/utils/effect'
4
+ import { Console, Effect, FetchHttpClient, Layer, Logger, References } from '@livestore/utils/effect'
5
5
  import { Cli, PlatformNode } from '@livestore/utils/node'
6
6
 
7
7
  import { command } from './cli.ts'
8
8
 
9
9
  const cli = Cli.Command.run(command, {
10
- name: 'livestore',
11
10
  version: liveStoreVersion,
12
11
  })
13
12
 
14
- const showExperimentalWarning = Console.log('⚠️ Warning: LiveStore CLI is experimental and under active development')
13
+ const showExperimentalWarning = Console.error('⚠️ Warning: LiveStore CLI is experimental and under active development')
15
14
 
16
15
  const layer = Layer.mergeAll(
17
- PlatformNode.NodeContext.layer,
16
+ PlatformNode.NodeServices.layer,
18
17
  FetchHttpClient.layer,
19
- Logger.minimumLogLevel(LogLevel.Info),
18
+ Layer.succeed(References.MinimumLogLevel, 'Info'),
19
+ // Keep stdout available for command data and protocol transports such as MCP stdio.
20
+ Layer.succeed(Logger.LogToStderr, true),
20
21
  )
21
22
 
22
23
  Effect.gen(function* () {
23
24
  yield* showExperimentalWarning
24
- return yield* cli(process.argv)
25
+ return yield* cli
25
26
  }).pipe(Effect.provide(layer), PlatformNode.NodeRuntime.runMain)
package/src/cli.ts CHANGED
@@ -5,5 +5,5 @@ import { mcpCommand } from './commands/mcp.ts'
5
5
  import { createCommand } from './commands/new-project.ts'
6
6
 
7
7
  export const command = Cli.Command.make('livestore', {
8
- verbose: Cli.Options.boolean('verbose').pipe(Cli.Options.withDefault(false)),
8
+ verbose: Cli.Flag.boolean('verbose').pipe(Cli.Flag.withDefault(false)),
9
9
  }).pipe(Cli.Command.withSubcommands([mcpCommand, createCommand, syncCommand]))
@@ -0,0 +1,12 @@
1
+ import { McpServer } from 'effect/unstable/ai'
2
+
3
+ import { Effect, Layer } from '@livestore/utils/effect'
4
+ import { PlatformNode } from '@livestore/utils/node'
5
+
6
+ import { supportedMcpProtocols } from '../mcp-protocols.ts'
7
+
8
+ McpServer.layerStdio({
9
+ name: 'livestore-mcp-protocol-test',
10
+ version: '0.0.0',
11
+ protocols: supportedMcpProtocols,
12
+ }).pipe(Layer.provide(PlatformNode.NodeStdio.layer), Layer.launch, Effect.scoped, PlatformNode.NodeRuntime.runMain)