@hasna/cloud 0.1.28 → 0.1.30

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/index.js CHANGED
@@ -10975,7 +10975,7 @@ init_zod();
10975
10975
  init_config();
10976
10976
  init_dotfile();
10977
10977
  init_adapter();
10978
- function registerCloudTools(server, serviceName) {
10978
+ function registerCloudTools(server, serviceName, opts = {}) {
10979
10979
  server.tool(`${serviceName}_cloud_status`, "Show cloud configuration and connection health", {}, async () => {
10980
10980
  const config = getCloudConfig();
10981
10981
  const lines = [
@@ -11008,8 +11008,13 @@ function registerCloudTools(server, serviceName) {
11008
11008
  isError: true
11009
11009
  };
11010
11010
  }
11011
- const local = new SqliteAdapter(getDbPath(serviceName));
11011
+ const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
11012
11012
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
11013
+ if (opts.migrations?.length) {
11014
+ for (const sql of opts.migrations) {
11015
+ await cloud.run(sql);
11016
+ }
11017
+ }
11013
11018
  const tableList = tablesStr ? tablesStr.split(",").map((t) => t.trim()) : listSqliteTables(local);
11014
11019
  const results = await syncPush(local, cloud, { tables: tableList });
11015
11020
  local.close();
@@ -11031,7 +11036,7 @@ function registerCloudTools(server, serviceName) {
11031
11036
  isError: true
11032
11037
  };
11033
11038
  }
11034
- const local = new SqliteAdapter(getDbPath(serviceName));
11039
+ const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
11035
11040
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
11036
11041
  let tableList;
11037
11042
  if (tablesStr) {
@@ -3,14 +3,20 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  * Register cloud-related MCP tools onto an existing MCP server.
4
4
  * Services call this to embed cloud sync/feedback tools into their own MCP server.
5
5
  *
6
+ * @param migrations - Optional list of SQL statements to run against PG before pushing.
7
+ * Use this to ensure the cloud schema exists (CREATE TABLE IF NOT EXISTS ...).
8
+ *
6
9
  * @example
7
10
  * ```ts
8
11
  * import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
12
  * import { registerCloudTools } from "@hasna/cloud";
10
13
  *
11
14
  * const server = new McpServer({ name: "my-service", version: "0.1.0" });
12
- * registerCloudTools(server, "my-service");
15
+ * registerCloudTools(server, "my-service", { migrations: PG_MIGRATIONS });
13
16
  * ```
14
17
  */
15
- export declare function registerCloudTools(server: McpServer, serviceName: string): void;
18
+ export declare function registerCloudTools(server: McpServer, serviceName: string, opts?: {
19
+ migrations?: string[];
20
+ dbPath?: string;
21
+ }): void;
16
22
  //# sourceMappingURL=mcp-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-helpers.d.ts","sourceRoot":"","sources":["../src/mcp-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,GAClB,IAAI,CAoJN"}
1
+ {"version":3,"file":"mcp-helpers.d.ts","sourceRoot":"","sources":["../src/mcp-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,IAAI,CA2JN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/cloud",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Shared cloud infrastructure — database adapter (SQLite + PostgreSQL), sync engine, feedback system, unified dotfile config",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",