@liquidmetal-ai/raindrop 0.6.4 → 0.8.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 (190) hide show
  1. package/README.md +440 -73
  2. package/bin/cjs-shims.js +7 -0
  3. package/bin/run.js +20 -2
  4. package/bundle/chunk-5GH4FS6C.js +12148 -0
  5. package/bundle/chunk-6B4I2CKP.js +231 -0
  6. package/bundle/chunk-6UE75KX2.js +4481 -0
  7. package/bundle/chunk-AU3EGGJP.js +44 -0
  8. package/bundle/chunk-CDQRD3JA.js +75 -0
  9. package/bundle/chunk-CMCEP64V.js +380 -0
  10. package/bundle/chunk-CW5ZHVPX.js +292 -0
  11. package/bundle/chunk-G6NE675D.js +238720 -0
  12. package/bundle/chunk-GLIYVKQA.js +48 -0
  13. package/bundle/chunk-KXEV6E63.js +133 -0
  14. package/bundle/chunk-MCRKUPJY.js +4515 -0
  15. package/bundle/chunk-MGM2L2T3.js +805 -0
  16. package/bundle/chunk-MVQYQJHI.js +502 -0
  17. package/bundle/chunk-NG7CZTTE.js +147 -0
  18. package/bundle/chunk-PU4RCSXF.js +22452 -0
  19. package/bundle/chunk-VXAZKB3J.js +292 -0
  20. package/bundle/chunk-W2L3MYN6.js +4480 -0
  21. package/bundle/chunk-XYJACVNA.js +231 -0
  22. package/bundle/commands/annotation/get.js +153 -0
  23. package/bundle/commands/annotation/list.js +226 -0
  24. package/bundle/commands/annotation/put.js +177 -0
  25. package/bundle/commands/auth/list.js +75 -0
  26. package/bundle/commands/auth/login.js +1654 -0
  27. package/bundle/commands/auth/logout.js +27 -0
  28. package/bundle/commands/auth/select.js +53 -0
  29. package/bundle/commands/bucket/create-credential.js +173 -0
  30. package/bundle/commands/bucket/delete-credential.js +140 -0
  31. package/bundle/commands/bucket/get-credential.js +151 -0
  32. package/bundle/commands/bucket/list-credentials.js +148 -0
  33. package/bundle/commands/build/branch.js +126 -0
  34. package/bundle/commands/build/checkout.js +198 -0
  35. package/bundle/commands/build/clone.js +153 -0
  36. package/bundle/commands/build/delete.js +227 -0
  37. package/bundle/commands/build/deploy.js +160 -0
  38. package/bundle/commands/build/env/get.js +105 -0
  39. package/bundle/commands/build/env/set.js +115 -0
  40. package/bundle/commands/build/find.js +333 -0
  41. package/bundle/commands/build/generate.js +75 -0
  42. package/bundle/commands/build/init.js +76 -0
  43. package/bundle/commands/build/list.js +11 -0
  44. package/bundle/commands/build/sandbox.js +65 -0
  45. package/bundle/commands/build/start.js +84 -0
  46. package/bundle/commands/build/status.js +1839 -0
  47. package/bundle/commands/build/stop.js +84 -0
  48. package/bundle/commands/build/tools/check.js +32 -0
  49. package/bundle/commands/build/tools/fmt.js +49 -0
  50. package/bundle/commands/build/unsandbox.js +65 -0
  51. package/bundle/commands/build/upload.js +83 -0
  52. package/bundle/commands/build/validate.js +71 -0
  53. package/bundle/commands/build/workos/delete.js +86 -0
  54. package/bundle/commands/build/workos/env/attach.js +134 -0
  55. package/bundle/commands/build/workos/env/create.js +176 -0
  56. package/bundle/commands/build/workos/env/delete.js +84 -0
  57. package/bundle/commands/build/workos/env/detach.js +115 -0
  58. package/bundle/commands/build/workos/env/get.js +117 -0
  59. package/bundle/commands/build/workos/env/list.js +139 -0
  60. package/bundle/commands/build/workos/env/set.js +138 -0
  61. package/bundle/commands/build/workos/invite.js +91 -0
  62. package/bundle/commands/build/workos/setup.js +124 -0
  63. package/bundle/commands/build/workos/status.js +93 -0
  64. package/bundle/commands/dns/create.js +128 -0
  65. package/bundle/commands/dns/delete.js +80 -0
  66. package/bundle/commands/dns/get.js +167 -0
  67. package/bundle/commands/dns/list.js +193 -0
  68. package/bundle/commands/dns/records/create.js +150 -0
  69. package/bundle/commands/dns/records/delete.js +76 -0
  70. package/bundle/commands/dns/records/get.js +118 -0
  71. package/bundle/commands/dns/records/list.js +153 -0
  72. package/bundle/commands/dns/records/update.js +146 -0
  73. package/bundle/commands/logs/query.js +237 -0
  74. package/bundle/commands/logs/tail.js +155 -0
  75. package/bundle/commands/mcp/install-claude.js +220 -0
  76. package/bundle/commands/mcp/install-gemini.js +220 -0
  77. package/bundle/commands/mcp/install-goose.js +232 -0
  78. package/bundle/commands/mcp/status.js +153 -0
  79. package/bundle/commands/object/delete.js +180 -0
  80. package/bundle/commands/object/get.js +209 -0
  81. package/bundle/commands/object/list.js +206 -0
  82. package/bundle/commands/object/put.js +211 -0
  83. package/bundle/commands/query/chunk-search.js +123 -0
  84. package/bundle/commands/query/document.js +126 -0
  85. package/bundle/commands/query/events.js +98 -0
  86. package/bundle/commands/query/reindex.js +147 -0
  87. package/bundle/commands/query/search.js +169 -0
  88. package/bundle/commands/tail.js +31 -0
  89. package/bundle/index.js +51 -0
  90. package/dist/base-command.d.ts +6 -0
  91. package/dist/base-command.d.ts.map +1 -1
  92. package/dist/base-command.js +21 -8
  93. package/dist/build.d.ts +2 -1
  94. package/dist/build.d.ts.map +1 -1
  95. package/dist/build.js +169 -51
  96. package/dist/codegen.d.ts +1 -1
  97. package/dist/codegen.d.ts.map +1 -1
  98. package/dist/codegen.js +20 -3
  99. package/dist/codegen.test.js +59 -1
  100. package/dist/commands/build/checkout.d.ts +17 -0
  101. package/dist/commands/build/checkout.d.ts.map +1 -1
  102. package/dist/commands/build/checkout.js +144 -7
  103. package/dist/commands/build/delete.d.ts +15 -0
  104. package/dist/commands/build/delete.d.ts.map +1 -1
  105. package/dist/commands/build/delete.js +133 -0
  106. package/dist/commands/build/deploy.d.ts.map +1 -1
  107. package/dist/commands/build/deploy.js +10 -2
  108. package/dist/commands/build/find.d.ts +1 -0
  109. package/dist/commands/build/find.d.ts.map +1 -1
  110. package/dist/commands/build/find.js +33 -2
  111. package/dist/commands/build/validate.d.ts.map +1 -1
  112. package/dist/commands/build/validate.js +0 -1
  113. package/dist/commands/build/workos/delete.d.ts +18 -0
  114. package/dist/commands/build/workos/delete.d.ts.map +1 -0
  115. package/dist/commands/build/workos/delete.js +72 -0
  116. package/dist/commands/build/workos/env/attach.d.ts +24 -0
  117. package/dist/commands/build/workos/env/attach.d.ts.map +1 -0
  118. package/dist/commands/build/workos/env/attach.js +111 -0
  119. package/dist/commands/build/workos/env/create.d.ts +26 -0
  120. package/dist/commands/build/workos/env/create.d.ts.map +1 -0
  121. package/dist/commands/build/workos/env/create.js +156 -0
  122. package/dist/commands/build/workos/env/delete.d.ts +20 -0
  123. package/dist/commands/build/workos/env/delete.d.ts.map +1 -0
  124. package/dist/commands/build/workos/env/delete.js +61 -0
  125. package/dist/commands/build/workos/env/detach.d.ts +21 -0
  126. package/dist/commands/build/workos/env/detach.d.ts.map +1 -0
  127. package/dist/commands/build/workos/env/detach.js +94 -0
  128. package/dist/commands/build/workos/env/get.d.ts +20 -0
  129. package/dist/commands/build/workos/env/get.d.ts.map +1 -0
  130. package/dist/commands/build/workos/env/get.js +94 -0
  131. package/dist/commands/build/workos/env/list.d.ts +18 -0
  132. package/dist/commands/build/workos/env/list.d.ts.map +1 -0
  133. package/dist/commands/build/workos/env/list.js +114 -0
  134. package/dist/commands/build/workos/env/set.d.ts +27 -0
  135. package/dist/commands/build/workos/env/set.d.ts.map +1 -0
  136. package/dist/commands/build/workos/env/set.js +115 -0
  137. package/dist/commands/build/workos/invite.d.ts +21 -0
  138. package/dist/commands/build/workos/invite.d.ts.map +1 -0
  139. package/dist/commands/build/workos/invite.js +68 -0
  140. package/dist/commands/build/workos/setup.d.ts +20 -0
  141. package/dist/commands/build/workos/setup.d.ts.map +1 -0
  142. package/dist/commands/build/workos/setup.js +106 -0
  143. package/dist/commands/build/workos/status.d.ts +18 -0
  144. package/dist/commands/build/workos/status.d.ts.map +1 -0
  145. package/dist/commands/build/workos/status.js +70 -0
  146. package/dist/commands/mcp/install-claude.d.ts.map +1 -1
  147. package/dist/commands/mcp/install-claude.js +2 -2
  148. package/dist/commands/mcp/install-gemini.d.ts.map +1 -1
  149. package/dist/commands/mcp/install-gemini.js +2 -2
  150. package/dist/commands/mcp/install-goose.d.ts +22 -0
  151. package/dist/commands/mcp/install-goose.d.ts.map +1 -0
  152. package/dist/commands/mcp/install-goose.js +252 -0
  153. package/dist/commands/object/delete.d.ts.map +1 -1
  154. package/dist/commands/object/delete.js +20 -12
  155. package/dist/commands/object/get.d.ts.map +1 -1
  156. package/dist/commands/object/get.js +20 -12
  157. package/dist/commands/object/list.d.ts.map +1 -1
  158. package/dist/commands/object/list.js +20 -12
  159. package/dist/commands/object/put.d.ts.map +1 -1
  160. package/dist/commands/object/put.js +20 -12
  161. package/dist/deploy.d.ts.map +1 -1
  162. package/dist/deploy.js +2 -2
  163. package/dist/index.d.ts +2 -0
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/index.js +37 -4
  166. package/dist/index.test.js +54 -2
  167. package/oclif.manifest.json +4533 -2284
  168. package/package.json +8 -5
  169. package/templates/claude-code/debug-raindrop-app.md +89 -0
  170. package/templates/claude-code/new-raindrop-app.md +12 -4
  171. package/templates/claude-code/reattach-raindrop-session.md +50 -12
  172. package/templates/claude-code/update-raindrop-app.md +61 -9
  173. package/templates/db/node_modules/.bin/prisma +2 -2
  174. package/templates/db/node_modules/.bin/prisma-kysely +2 -2
  175. package/templates/db/node_modules/.bin/tsc +2 -2
  176. package/templates/db/node_modules/.bin/tsserver +2 -2
  177. package/templates/db/node_modules/.bin/zx +2 -2
  178. package/templates/gemini-code/debug-raindrop-app.toml +86 -0
  179. package/templates/gemini-code/new-raindrop-app.toml +10 -3
  180. package/templates/gemini-code/reattach-raindrop-session.toml +9 -11
  181. package/templates/gemini-code/update-raindrop-app.toml +55 -10
  182. package/templates/goose/debug-raindrop-app.yaml +91 -0
  183. package/templates/goose/new-raindrop-app.yaml +21 -0
  184. package/templates/goose/reattach-raindrop-session.yaml +20 -0
  185. package/templates/goose/update-raindrop-app.yaml +65 -0
  186. package/templates/init/src/_app/auth.ts +18 -0
  187. package/templates/init/src/_app/cors.ts +64 -0
  188. package/dist/tsconfig.tsbuildinfo +0 -1
  189. package/templates/claude-code/raindrop-guidelines.md +0 -322
  190. package/templates/gemini-code/raindrop-guidelines.md +0 -322
@@ -0,0 +1,333 @@
1
+ import {
2
+ source_default
3
+ } from "../../chunk-MVQYQJHI.js";
4
+ import {
5
+ BaseCommand
6
+ } from "../../chunk-MCRKUPJY.js";
7
+ import {
8
+ EPOCH_TS,
9
+ QueryModulesResponseSchema,
10
+ QueryResourcesResponseSchema,
11
+ __toESM,
12
+ init_cjs_shims,
13
+ require_lib,
14
+ timestampDate,
15
+ toJsonString,
16
+ valueOf
17
+ } from "../../chunk-G6NE675D.js";
18
+
19
+ // src/commands/build/find.ts
20
+ init_cjs_shims();
21
+ var import_core = __toESM(require_lib(), 1);
22
+ var Find = class extends BaseCommand {
23
+ static args = {};
24
+ static description = "find resources in Raindrop";
25
+ static examples = [
26
+ `<%= config.bin %> <%= command.id %>
27
+ Find all modules with full details (default).
28
+
29
+ <%= config.bin %> <%= command.id %> -o compact
30
+ Find all modules in compact view.
31
+
32
+ <%= config.bin %> <%= command.id %> --moduleType service
33
+ Find only service modules with their routes.
34
+
35
+ <%= config.bin %> <%= command.id %> --moduleType actor
36
+ Find only actor modules with their routes.
37
+
38
+ <%= config.bin %> <%= command.id %> --moduleType smartbucket
39
+ Find only smartbucket modules.
40
+
41
+ <%= config.bin %> <%= command.id %> -a myapp -v 1.0.0
42
+ Find modules for a specific application and version.
43
+ `
44
+ ];
45
+ static flags = {
46
+ ...BaseCommand.HIDDEN_FLAGS,
47
+ root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
48
+ manifest: import_core.Flags.string({
49
+ char: "M",
50
+ description: "project manifest",
51
+ required: false,
52
+ default: "raindrop.manifest"
53
+ }),
54
+ application: import_core.Flags.string({
55
+ char: "a",
56
+ description: "application",
57
+ required: false
58
+ }),
59
+ version: import_core.Flags.string({
60
+ char: "v",
61
+ description: "application version",
62
+ required: false
63
+ }),
64
+ moduleType: import_core.Flags.string({
65
+ description: "filter by module type (e.g. smartbucket)",
66
+ required: false
67
+ }),
68
+ output: import_core.Flags.string({
69
+ char: "o",
70
+ description: "output format",
71
+ default: "full",
72
+ options: ["text", "full", "json", "compact"]
73
+ }),
74
+ sudo: import_core.Flags.boolean({
75
+ char: "s",
76
+ default: false,
77
+ description: "superuser mode",
78
+ required: false,
79
+ hidden: true
80
+ }),
81
+ impersonate: import_core.Flags.string({
82
+ char: "i",
83
+ description: "impersonate organization",
84
+ required: false,
85
+ hidden: true
86
+ }),
87
+ all: import_core.Flags.boolean({
88
+ description: "query modules for all applications"
89
+ })
90
+ };
91
+ // Helper method to fetch WorkOS environment name for an application version
92
+ async getWorkOSEnvironment(catalogService, userId, organizationId, applicationName, versionId) {
93
+ try {
94
+ const envResp = await catalogService.getEnvs({
95
+ userId,
96
+ organizationId,
97
+ envs: [
98
+ {
99
+ applicationName,
100
+ currentVersionId: versionId,
101
+ key: "env:WORKOS_ENVIRONMENT"
102
+ }
103
+ ]
104
+ });
105
+ const workosEnv = envResp.envs.find((e) => e.key === "env:WORKOS_ENVIRONMENT");
106
+ return workosEnv?.value;
107
+ } catch {
108
+ return void 0;
109
+ }
110
+ }
111
+ async queryModules(flags) {
112
+ let applicationName;
113
+ let applicationVersionId;
114
+ if (!flags.all) {
115
+ if (!flags.version) {
116
+ const config = await this.loadConfig();
117
+ applicationVersionId = config.versionId;
118
+ }
119
+ if (!flags.application) {
120
+ const apps = await this.loadManifest();
121
+ const app = apps[0];
122
+ if (app === void 0) {
123
+ this.error("No application provided or found in manifest", { exit: 1 });
124
+ }
125
+ applicationName = valueOf(app.name);
126
+ }
127
+ }
128
+ const { client: catalogService, userId, organizationId: defaultOrganizationId } = await this.catalogService();
129
+ const organizationId = this.flags.impersonate ?? defaultOrganizationId;
130
+ const resp = await catalogService.queryModules({
131
+ userId,
132
+ applicationName: applicationName || "",
133
+ applicationVersionId: applicationVersionId || "",
134
+ organizationId,
135
+ moduleType: flags.moduleType || ""
136
+ });
137
+ if (flags.output === "compact") {
138
+ const modulesByApp = resp.modules.reduce((acc, module) => {
139
+ const appKey = `${module.applicationName}@${module.applicationVersionId}`;
140
+ if (!acc[appKey]) {
141
+ acc[appKey] = [];
142
+ }
143
+ acc[appKey].push(module);
144
+ return acc;
145
+ }, {});
146
+ for (const [appKey, modules] of Object.entries(modulesByApp)) {
147
+ const firstModule = modules[0];
148
+ const workosEnv = firstModule ? await this.getWorkOSEnvironment(
149
+ catalogService,
150
+ userId,
151
+ organizationId,
152
+ firstModule.applicationName,
153
+ firstModule.applicationVersionId
154
+ ) : void 0;
155
+ const workosInfo = workosEnv ? ` ${source_default.magenta(`[WorkOS: ${workosEnv}]`)}` : "";
156
+ console.log(`
157
+ ${source_default.bold(appKey)}${workosInfo} ${source_default.dim(`(${modules.length} module${modules.length !== 1 ? "s" : ""})`)}`);
158
+ for (const module of modules) {
159
+ const convergedStatus = module.convergedAt ? source_default.green("converged") : source_default.yellow("pending");
160
+ const date = module.convergedAt ? timestampDate(module.convergedAt).toLocaleDateString() : "N/A";
161
+ const routeCount = module.service?.routes?.length || module.actor?.routes?.length || 0;
162
+ const routeInfo = routeCount > 0 ? ` - ${source_default.green(`${routeCount} route${routeCount !== 1 ? "s" : ""}`)}` : "";
163
+ console.log(` \u2514\u2500 ${source_default.cyan(module.name)} ${source_default.dim(`(${module.moduleId.substring(0, 8)}...)`)} ${source_default.yellow(module.type)}${routeInfo} - ${convergedStatus} - ${source_default.dim(date)}`);
164
+ }
165
+ }
166
+ const totalApps = Object.keys(modulesByApp).length;
167
+ const totalModules = resp.modules.length;
168
+ const convergedModules = resp.modules.filter((m) => m.convergedAt).length;
169
+ console.log("");
170
+ console.log(source_default.dim("\u2500".repeat(50)));
171
+ console.log(source_default.dim(`Total: ${totalApps} application${totalApps !== 1 ? "s" : ""}, ${totalModules} modules (${convergedModules} converged)`));
172
+ } else if (flags.output === "full") {
173
+ const modulesByApp = resp.modules.reduce((acc, module) => {
174
+ const appKey = `${module.applicationName}@${module.applicationVersionId}`;
175
+ if (!acc[appKey]) {
176
+ acc[appKey] = [];
177
+ }
178
+ acc[appKey].push(module);
179
+ return acc;
180
+ }, {});
181
+ for (const [appKey, modules] of Object.entries(modulesByApp)) {
182
+ const firstModule = modules[0];
183
+ const workosEnv = firstModule ? await this.getWorkOSEnvironment(
184
+ catalogService,
185
+ userId,
186
+ organizationId,
187
+ firstModule.applicationName,
188
+ firstModule.applicationVersionId
189
+ ) : void 0;
190
+ const workosInfo = workosEnv ? ` ${source_default.magenta(`[WorkOS: ${workosEnv}]`)}` : "";
191
+ console.log(`
192
+ ${source_default.bold(appKey)}${workosInfo} ${source_default.dim(`(${modules.length} module${modules.length !== 1 ? "s" : ""})`)}`);
193
+ for (const module of modules) {
194
+ const convergedStatus = module.convergedAt ? source_default.green("converged") : source_default.yellow("pending");
195
+ const date = module.convergedAt ? timestampDate(module.convergedAt).toISOString() : "N/A";
196
+ console.log(` \u2514\u2500 ${source_default.cyan(module.name)} ${source_default.dim(`(${module.moduleId})`)} ${source_default.yellow(module.type)}`);
197
+ console.log(` Status: ${convergedStatus} at ${source_default.dim(date)}`);
198
+ if (module.service || module.actor || module.mcpService) {
199
+ const moduleData = module.service || module.actor || module.mcpService;
200
+ if (moduleData?.routes && moduleData.routes.length > 0) {
201
+ console.log(` ${source_default.bold("Routes:")}`);
202
+ for (const route of moduleData.routes) {
203
+ const routeInfo = route.id ? `${source_default.green(route.domain)} ${source_default.cyan(`[${route.id}]`)}` : source_default.green(route.domain);
204
+ console.log(` \u2192 ${routeInfo}`);
205
+ }
206
+ }
207
+ }
208
+ const attrs = this.extractModuleAttributes(module);
209
+ const filteredAttrs = Object.entries(attrs).filter(([key]) => !key.startsWith("routes"));
210
+ if (filteredAttrs.length > 0) {
211
+ console.log(` ${source_default.bold("Attributes:")}`);
212
+ for (const [key, value] of filteredAttrs) {
213
+ console.log(` ${key}: ${source_default.yellow(String(value))}`);
214
+ }
215
+ }
216
+ }
217
+ }
218
+ const totalApps = Object.keys(modulesByApp).length;
219
+ const totalModules = resp.modules.length;
220
+ const convergedModules = resp.modules.filter((m) => m.convergedAt).length;
221
+ console.log("");
222
+ console.log(source_default.dim("\u2500".repeat(50)));
223
+ console.log(source_default.dim(`Total: ${totalApps} application${totalApps !== 1 ? "s" : ""}, ${totalModules} modules (${convergedModules} converged)`));
224
+ } else if (flags.output === "json") {
225
+ console.log(toJsonString(QueryModulesResponseSchema, resp, { prettySpaces: 2 }));
226
+ } else {
227
+ for (const m of resp.modules) {
228
+ let details = `${m.name} ${m.moduleId} ${m.type}`;
229
+ const attrs = this.extractModuleAttributes(m);
230
+ const attrString = Object.entries(attrs).map(([k, v]) => `${k}=${v}`).join(" ");
231
+ if (attrString) {
232
+ details += ` ${attrString}`;
233
+ }
234
+ if (m.convergedAt) {
235
+ details += ` converged=${timestampDate(m.convergedAt).toISOString()}`;
236
+ }
237
+ console.log(details);
238
+ }
239
+ }
240
+ }
241
+ extractModuleAttributes(module) {
242
+ if (module.smartBucket) return this.flattenObject(module.smartBucket);
243
+ if (module.bucket) return this.flattenObject(module.bucket);
244
+ if (module.service) return this.flattenObject(module.service);
245
+ if (module.observer) return this.flattenObject(module.observer);
246
+ if (module.task) return this.flattenObject(module.task);
247
+ if (module.sqlDatabase) return this.flattenObject(module.sqlDatabase);
248
+ if (module.vectorIndex) return this.flattenObject(module.vectorIndex);
249
+ if (module.queue) return this.flattenObject(module.queue);
250
+ if (module.kvCache) return this.flattenObject(module.kvCache);
251
+ if (module.smartMemory) return this.flattenObject(module.smartMemory);
252
+ if (module.actor) return this.flattenObject(module.actor);
253
+ return {};
254
+ }
255
+ flattenObject(obj, parentKey = "") {
256
+ const result = {};
257
+ for (const [key, value] of Object.entries(obj)) {
258
+ if (value === null || value === void 0) continue;
259
+ if (key === "$typeName" || key === "$unknown") continue;
260
+ const newKey = parentKey ? `${parentKey}.${key}` : key;
261
+ if (Array.isArray(value)) {
262
+ if (value.length > 0 && typeof value[0] === "object") {
263
+ value.forEach((item, index) => {
264
+ const itemKey = `${newKey}[${index}]`;
265
+ Object.assign(result, this.flattenObject(item, itemKey));
266
+ });
267
+ } else {
268
+ result[newKey] = value.join(", ");
269
+ }
270
+ } else if (typeof value === "object") {
271
+ Object.assign(result, this.flattenObject(value, newKey));
272
+ } else {
273
+ result[newKey] = value;
274
+ }
275
+ }
276
+ return result;
277
+ }
278
+ async queryResources(flags) {
279
+ if (!flags.version) {
280
+ const config = await this.loadConfig();
281
+ flags.version = config.versionId;
282
+ }
283
+ if (!flags.application) {
284
+ const apps = await this.loadManifest();
285
+ const app = apps[0];
286
+ if (app === void 0) {
287
+ this.error("No application provided or found in manifest", { exit: 1 });
288
+ }
289
+ flags.application = valueOf(app.name);
290
+ }
291
+ const { client: catalogService, userId, organizationId: defaultOrganizationId } = await this.catalogService();
292
+ const organizationId = this.flags.impersonate ?? defaultOrganizationId;
293
+ const resp = await catalogService.queryResources({
294
+ userId,
295
+ applicationName: flags.application,
296
+ applicationVersionId: flags.version || "",
297
+ organizationId
298
+ });
299
+ if (flags.output === "table") {
300
+ console.table(
301
+ resp.resources.reduce(
302
+ (acc, v) => {
303
+ acc[v.name] = {
304
+ ...v
305
+ };
306
+ return acc;
307
+ },
308
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
309
+ {}
310
+ ),
311
+ ["name", "resourceId", "applicationName", "applicationVersionId", "type"]
312
+ );
313
+ } else if (flags.output === "json") {
314
+ console.log(toJsonString(QueryResourcesResponseSchema, resp, { prettySpaces: 2 }));
315
+ } else {
316
+ for (const r of resp.resources) {
317
+ console.log(
318
+ `${r.name} ${r.resourceId} ${r.applicationName} ${r.applicationVersionId} ${r.type} ${timestampDate(r.createdAt || EPOCH_TS).toISOString()} ${timestampDate(r.updatedAt || EPOCH_TS).toISOString()} ${JSON.stringify(r.attributes)}`
319
+ );
320
+ }
321
+ }
322
+ }
323
+ async run() {
324
+ if (this.flags.sudo) {
325
+ await this.queryResources(this.flags);
326
+ } else {
327
+ await this.queryModules(this.flags);
328
+ }
329
+ }
330
+ };
331
+ export {
332
+ Find as default
333
+ };
@@ -0,0 +1,75 @@
1
+ import {
2
+ HANDLERS_DIR,
3
+ RAINDROP_TYPES_FILENAME,
4
+ codegenPlan,
5
+ gatherEnvForHandler,
6
+ renderCodegenPlan
7
+ } from "../../chunk-W2L3MYN6.js";
8
+ import {
9
+ BaseCommand
10
+ } from "../../chunk-MCRKUPJY.js";
11
+ import {
12
+ __toESM,
13
+ getCurrentVersion,
14
+ init_cjs_shims,
15
+ require_lib,
16
+ valueOf
17
+ } from "../../chunk-G6NE675D.js";
18
+
19
+ // src/commands/build/generate.ts
20
+ init_cjs_shims();
21
+ var import_core = __toESM(require_lib(), 1);
22
+ import * as fs from "node:fs/promises";
23
+ import * as path from "node:path";
24
+ var Generate = class extends BaseCommand {
25
+ static args = {};
26
+ static description = "(re)generate all code for a LiquidMetal.AI project";
27
+ static examples = ["<%= config.bin %> <%= command.id %>"];
28
+ static flags = {
29
+ root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
30
+ manifest: import_core.Flags.string({
31
+ char: "M",
32
+ description: "project manifest",
33
+ required: false,
34
+ default: "raindrop.manifest"
35
+ }),
36
+ config: import_core.Flags.string({
37
+ char: "c",
38
+ description: "config file",
39
+ required: false,
40
+ hidden: true,
41
+ default: ".raindrop/config.json"
42
+ }),
43
+ output: import_core.Flags.string({ char: "o", description: "output directory", default: "dist" })
44
+ };
45
+ async run() {
46
+ const apps = await this.loadManifest();
47
+ const plan = codegenPlan(apps);
48
+ const app = apps[0];
49
+ const templateContext = {
50
+ applicationName: valueOf(app.name),
51
+ raindropFrameworkVersion: await getCurrentVersion()
52
+ };
53
+ await renderCodegenPlan(
54
+ plan,
55
+ this.flags.root,
56
+ {
57
+ renderScaffoldingCode: false,
58
+ renderUserModifiableCode: true,
59
+ renderNonUserModifiableCode: true,
60
+ overwrite: false,
61
+ mergePackageJson: true
62
+ },
63
+ templateContext
64
+ );
65
+ const handlers = app.handlers();
66
+ for (const handler of handlers) {
67
+ const dest = path.join(this.flags.root, HANDLERS_DIR, valueOf(handler.name), RAINDROP_TYPES_FILENAME);
68
+ await fs.mkdir(path.dirname(dest), { recursive: true });
69
+ await fs.writeFile(dest, gatherEnvForHandler(handler, app));
70
+ }
71
+ }
72
+ };
73
+ export {
74
+ Generate as default
75
+ };
@@ -0,0 +1,76 @@
1
+ import {
2
+ codegenPlan,
3
+ fileExists,
4
+ renderCodegenPlan
5
+ } from "../../chunk-W2L3MYN6.js";
6
+ import {
7
+ BaseCommand
8
+ } from "../../chunk-MCRKUPJY.js";
9
+ import {
10
+ __toESM,
11
+ getCurrentVersion,
12
+ init_cjs_shims,
13
+ mustManifestFromString,
14
+ require_lib
15
+ } from "../../chunk-G6NE675D.js";
16
+
17
+ // src/commands/build/init.ts
18
+ init_cjs_shims();
19
+ var import_core = __toESM(require_lib(), 1);
20
+ import fs from "node:fs/promises";
21
+ import * as path from "node:path";
22
+ var Init = class extends BaseCommand {
23
+ static args = {
24
+ path: import_core.Args.directory({ default: ".", description: "Path to initialize the project in", required: false })
25
+ };
26
+ static description = "start a new LiquidMetal.AI project";
27
+ static examples = [
28
+ `<%= config.bin %> <%= command.id %> .
29
+ Initialize a project in the current directory.
30
+ `
31
+ ];
32
+ static flags = {
33
+ overwrite: import_core.Flags.boolean({ description: "Overwrite existing files", default: false })
34
+ };
35
+ async run() {
36
+ this.log(`path: ${this.args.path}`);
37
+ if (!await fileExists(this.args.path)) {
38
+ try {
39
+ await fs.mkdir(this.args.path, { recursive: true });
40
+ } catch {
41
+ this.error(`Could not create directory ${this.args.path}`, { exit: 1 });
42
+ }
43
+ }
44
+ const pathStat = await fs.lstat(this.args.path);
45
+ if (!pathStat.isDirectory()) {
46
+ this.error(`${this.args.path} is not a directory.`, { exit: 1 });
47
+ }
48
+ if (!this.flags.overwrite && await fileExists(path.join(this.args.path, "package.json"))) {
49
+ this.error(`A project ${this.args.path} has already been initialized.`, { exit: 1 });
50
+ }
51
+ const apps = await mustManifestFromString('application "hello-world" {}');
52
+ const plan = codegenPlan(apps);
53
+ try {
54
+ await renderCodegenPlan(
55
+ plan,
56
+ this.args.path,
57
+ {
58
+ renderScaffoldingCode: false,
59
+ renderUserModifiableCode: true,
60
+ renderNonUserModifiableCode: true,
61
+ overwrite: false
62
+ },
63
+ {
64
+ applicationName: path.basename(this.args.path),
65
+ raindropFrameworkVersion: await getCurrentVersion()
66
+ }
67
+ );
68
+ } catch (error) {
69
+ this.error(`Could not initialize project at ${this.args.path}: ${error}`, { exit: 1 });
70
+ }
71
+ console.log(`Initialized LiquidMetal.AI in ${this.args.path}`);
72
+ }
73
+ };
74
+ export {
75
+ Init as default
76
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ List,
3
+ statusString
4
+ } from "../../chunk-CMCEP64V.js";
5
+ import "../../chunk-MVQYQJHI.js";
6
+ import "../../chunk-MCRKUPJY.js";
7
+ import "../../chunk-G6NE675D.js";
8
+ export {
9
+ List as default,
10
+ statusString
11
+ };
@@ -0,0 +1,65 @@
1
+ import {
2
+ sandbox
3
+ } from "../../chunk-XYJACVNA.js";
4
+ import "../../chunk-MGM2L2T3.js";
5
+ import "../../chunk-VXAZKB3J.js";
6
+ import "../../chunk-W2L3MYN6.js";
7
+ import "../../chunk-PU4RCSXF.js";
8
+ import {
9
+ BaseCommand
10
+ } from "../../chunk-MCRKUPJY.js";
11
+ import {
12
+ __toESM,
13
+ init_cjs_shims,
14
+ require_lib
15
+ } from "../../chunk-G6NE675D.js";
16
+
17
+ // src/commands/build/sandbox.ts
18
+ init_cjs_shims();
19
+ var import_core = __toESM(require_lib(), 1);
20
+ var Sandbox = class extends BaseCommand {
21
+ static args = {};
22
+ static description = "mark a version as sandboxed in the Raindrop catalog";
23
+ static examples = [
24
+ `<%= config.bin %> <%= command.id %>
25
+ `
26
+ ];
27
+ static flags = {
28
+ ...BaseCommand.HIDDEN_FLAGS,
29
+ impersonate: import_core.Flags.string({
30
+ char: "i",
31
+ description: "impersonate organization",
32
+ required: false,
33
+ hidden: true
34
+ }),
35
+ manifest: import_core.Flags.string({ default: "raindrop.manifest", description: "project manifest" }),
36
+ version: import_core.Flags.string({
37
+ char: "v",
38
+ description: "application version to sandbox",
39
+ required: false
40
+ })
41
+ };
42
+ async run() {
43
+ let applications;
44
+ try {
45
+ applications = await sandbox({
46
+ command: this,
47
+ isSandboxed: true,
48
+ impersonate: this.flags.impersonate,
49
+ versionId: this.flags.version
50
+ });
51
+ } catch (error) {
52
+ if (error instanceof Error) {
53
+ this.error(error.message);
54
+ }
55
+ throw error;
56
+ }
57
+ for (const app of applications) {
58
+ const { applicationName, currentVersionId } = app;
59
+ this.log(`Set ${applicationName}@${currentVersionId} as sandboxed.`);
60
+ }
61
+ }
62
+ };
63
+ export {
64
+ Sandbox as default
65
+ };
@@ -0,0 +1,84 @@
1
+ import {
2
+ BaseCommand
3
+ } from "../../chunk-MCRKUPJY.js";
4
+ import {
5
+ __toESM,
6
+ init_cjs_shims,
7
+ require_lib,
8
+ valueOf
9
+ } from "../../chunk-G6NE675D.js";
10
+
11
+ // src/commands/build/start.ts
12
+ init_cjs_shims();
13
+ var import_core = __toESM(require_lib(), 1);
14
+ var Start = class extends BaseCommand {
15
+ static args = {};
16
+ static description = "start a Raindrop application";
17
+ static examples = [
18
+ `<%= config.bin %> <%= command.id %> .
19
+ Start a Raindrop application.
20
+ `
21
+ ];
22
+ static flags = {
23
+ ...BaseCommand.HIDDEN_FLAGS,
24
+ root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
25
+ manifest: import_core.Flags.string({
26
+ char: "M",
27
+ description: "project manifest",
28
+ required: false,
29
+ default: "raindrop.manifest"
30
+ }),
31
+ application: import_core.Flags.string({
32
+ char: "a",
33
+ description: "application to start",
34
+ required: false
35
+ }),
36
+ version: import_core.Flags.string({
37
+ char: "v",
38
+ description: "application version to start",
39
+ required: false
40
+ }),
41
+ impersonate: import_core.Flags.string({
42
+ char: "i",
43
+ description: "impersonate organization",
44
+ required: false,
45
+ hidden: true
46
+ })
47
+ };
48
+ async run() {
49
+ const config = await this.loadConfig();
50
+ if (config.lock) {
51
+ this.error("Operation not allowed: application is in a locked state");
52
+ }
53
+ const { client: catalogService, userId, organizationId: defaultOrganizationId } = await this.catalogService();
54
+ const organizationId = this.flags.impersonate ?? defaultOrganizationId;
55
+ let applicationName = this.flags.application;
56
+ if (!applicationName) {
57
+ const apps = await this.loadManifest();
58
+ const app = apps[0];
59
+ if (!app) {
60
+ this.error("No application found");
61
+ }
62
+ applicationName = valueOf(app.name);
63
+ }
64
+ const currentVersionId = this.flags.version ?? config.versionId;
65
+ if (!currentVersionId) {
66
+ this.error("Expected a --version flag to be provided when a version is not currently set");
67
+ }
68
+ await catalogService.setActive({
69
+ userId,
70
+ organizationId,
71
+ applications: [
72
+ {
73
+ applicationName,
74
+ currentVersionId,
75
+ isActive: true
76
+ }
77
+ ]
78
+ });
79
+ console.log(`Set ${applicationName}@${currentVersionId} as active.`);
80
+ }
81
+ };
82
+ export {
83
+ Start as default
84
+ };