@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.
- package/README.md +440 -73
- package/bin/cjs-shims.js +7 -0
- package/bin/run.js +20 -2
- package/bundle/chunk-5GH4FS6C.js +12148 -0
- package/bundle/chunk-6B4I2CKP.js +231 -0
- package/bundle/chunk-6UE75KX2.js +4481 -0
- package/bundle/chunk-AU3EGGJP.js +44 -0
- package/bundle/chunk-CDQRD3JA.js +75 -0
- package/bundle/chunk-CMCEP64V.js +380 -0
- package/bundle/chunk-CW5ZHVPX.js +292 -0
- package/bundle/chunk-G6NE675D.js +238720 -0
- package/bundle/chunk-GLIYVKQA.js +48 -0
- package/bundle/chunk-KXEV6E63.js +133 -0
- package/bundle/chunk-MCRKUPJY.js +4515 -0
- package/bundle/chunk-MGM2L2T3.js +805 -0
- package/bundle/chunk-MVQYQJHI.js +502 -0
- package/bundle/chunk-NG7CZTTE.js +147 -0
- package/bundle/chunk-PU4RCSXF.js +22452 -0
- package/bundle/chunk-VXAZKB3J.js +292 -0
- package/bundle/chunk-W2L3MYN6.js +4480 -0
- package/bundle/chunk-XYJACVNA.js +231 -0
- package/bundle/commands/annotation/get.js +153 -0
- package/bundle/commands/annotation/list.js +226 -0
- package/bundle/commands/annotation/put.js +177 -0
- package/bundle/commands/auth/list.js +75 -0
- package/bundle/commands/auth/login.js +1654 -0
- package/bundle/commands/auth/logout.js +27 -0
- package/bundle/commands/auth/select.js +53 -0
- package/bundle/commands/bucket/create-credential.js +173 -0
- package/bundle/commands/bucket/delete-credential.js +140 -0
- package/bundle/commands/bucket/get-credential.js +151 -0
- package/bundle/commands/bucket/list-credentials.js +148 -0
- package/bundle/commands/build/branch.js +126 -0
- package/bundle/commands/build/checkout.js +198 -0
- package/bundle/commands/build/clone.js +153 -0
- package/bundle/commands/build/delete.js +227 -0
- package/bundle/commands/build/deploy.js +160 -0
- package/bundle/commands/build/env/get.js +105 -0
- package/bundle/commands/build/env/set.js +115 -0
- package/bundle/commands/build/find.js +333 -0
- package/bundle/commands/build/generate.js +75 -0
- package/bundle/commands/build/init.js +76 -0
- package/bundle/commands/build/list.js +11 -0
- package/bundle/commands/build/sandbox.js +65 -0
- package/bundle/commands/build/start.js +84 -0
- package/bundle/commands/build/status.js +1839 -0
- package/bundle/commands/build/stop.js +84 -0
- package/bundle/commands/build/tools/check.js +32 -0
- package/bundle/commands/build/tools/fmt.js +49 -0
- package/bundle/commands/build/unsandbox.js +65 -0
- package/bundle/commands/build/upload.js +83 -0
- package/bundle/commands/build/validate.js +71 -0
- package/bundle/commands/build/workos/delete.js +86 -0
- package/bundle/commands/build/workos/env/attach.js +134 -0
- package/bundle/commands/build/workos/env/create.js +176 -0
- package/bundle/commands/build/workos/env/delete.js +84 -0
- package/bundle/commands/build/workos/env/detach.js +115 -0
- package/bundle/commands/build/workos/env/get.js +117 -0
- package/bundle/commands/build/workos/env/list.js +139 -0
- package/bundle/commands/build/workos/env/set.js +138 -0
- package/bundle/commands/build/workos/invite.js +91 -0
- package/bundle/commands/build/workos/setup.js +124 -0
- package/bundle/commands/build/workos/status.js +93 -0
- package/bundle/commands/dns/create.js +128 -0
- package/bundle/commands/dns/delete.js +80 -0
- package/bundle/commands/dns/get.js +167 -0
- package/bundle/commands/dns/list.js +193 -0
- package/bundle/commands/dns/records/create.js +150 -0
- package/bundle/commands/dns/records/delete.js +76 -0
- package/bundle/commands/dns/records/get.js +118 -0
- package/bundle/commands/dns/records/list.js +153 -0
- package/bundle/commands/dns/records/update.js +146 -0
- package/bundle/commands/logs/query.js +237 -0
- package/bundle/commands/logs/tail.js +155 -0
- package/bundle/commands/mcp/install-claude.js +220 -0
- package/bundle/commands/mcp/install-gemini.js +220 -0
- package/bundle/commands/mcp/install-goose.js +232 -0
- package/bundle/commands/mcp/status.js +153 -0
- package/bundle/commands/object/delete.js +180 -0
- package/bundle/commands/object/get.js +209 -0
- package/bundle/commands/object/list.js +206 -0
- package/bundle/commands/object/put.js +211 -0
- package/bundle/commands/query/chunk-search.js +123 -0
- package/bundle/commands/query/document.js +126 -0
- package/bundle/commands/query/events.js +98 -0
- package/bundle/commands/query/reindex.js +147 -0
- package/bundle/commands/query/search.js +169 -0
- package/bundle/commands/tail.js +31 -0
- package/bundle/index.js +51 -0
- package/dist/base-command.d.ts +6 -0
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +21 -8
- package/dist/build.d.ts +2 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +169 -51
- package/dist/codegen.d.ts +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +20 -3
- package/dist/codegen.test.js +59 -1
- package/dist/commands/build/checkout.d.ts +17 -0
- package/dist/commands/build/checkout.d.ts.map +1 -1
- package/dist/commands/build/checkout.js +144 -7
- package/dist/commands/build/delete.d.ts +15 -0
- package/dist/commands/build/delete.d.ts.map +1 -1
- package/dist/commands/build/delete.js +133 -0
- package/dist/commands/build/deploy.d.ts.map +1 -1
- package/dist/commands/build/deploy.js +10 -2
- package/dist/commands/build/find.d.ts +1 -0
- package/dist/commands/build/find.d.ts.map +1 -1
- package/dist/commands/build/find.js +33 -2
- package/dist/commands/build/validate.d.ts.map +1 -1
- package/dist/commands/build/validate.js +0 -1
- package/dist/commands/build/workos/delete.d.ts +18 -0
- package/dist/commands/build/workos/delete.d.ts.map +1 -0
- package/dist/commands/build/workos/delete.js +72 -0
- package/dist/commands/build/workos/env/attach.d.ts +24 -0
- package/dist/commands/build/workos/env/attach.d.ts.map +1 -0
- package/dist/commands/build/workos/env/attach.js +111 -0
- package/dist/commands/build/workos/env/create.d.ts +26 -0
- package/dist/commands/build/workos/env/create.d.ts.map +1 -0
- package/dist/commands/build/workos/env/create.js +156 -0
- package/dist/commands/build/workos/env/delete.d.ts +20 -0
- package/dist/commands/build/workos/env/delete.d.ts.map +1 -0
- package/dist/commands/build/workos/env/delete.js +61 -0
- package/dist/commands/build/workos/env/detach.d.ts +21 -0
- package/dist/commands/build/workos/env/detach.d.ts.map +1 -0
- package/dist/commands/build/workos/env/detach.js +94 -0
- package/dist/commands/build/workos/env/get.d.ts +20 -0
- package/dist/commands/build/workos/env/get.d.ts.map +1 -0
- package/dist/commands/build/workos/env/get.js +94 -0
- package/dist/commands/build/workos/env/list.d.ts +18 -0
- package/dist/commands/build/workos/env/list.d.ts.map +1 -0
- package/dist/commands/build/workos/env/list.js +114 -0
- package/dist/commands/build/workos/env/set.d.ts +27 -0
- package/dist/commands/build/workos/env/set.d.ts.map +1 -0
- package/dist/commands/build/workos/env/set.js +115 -0
- package/dist/commands/build/workos/invite.d.ts +21 -0
- package/dist/commands/build/workos/invite.d.ts.map +1 -0
- package/dist/commands/build/workos/invite.js +68 -0
- package/dist/commands/build/workos/setup.d.ts +20 -0
- package/dist/commands/build/workos/setup.d.ts.map +1 -0
- package/dist/commands/build/workos/setup.js +106 -0
- package/dist/commands/build/workos/status.d.ts +18 -0
- package/dist/commands/build/workos/status.d.ts.map +1 -0
- package/dist/commands/build/workos/status.js +70 -0
- package/dist/commands/mcp/install-claude.d.ts.map +1 -1
- package/dist/commands/mcp/install-claude.js +2 -2
- package/dist/commands/mcp/install-gemini.d.ts.map +1 -1
- package/dist/commands/mcp/install-gemini.js +2 -2
- package/dist/commands/mcp/install-goose.d.ts +22 -0
- package/dist/commands/mcp/install-goose.d.ts.map +1 -0
- package/dist/commands/mcp/install-goose.js +252 -0
- package/dist/commands/object/delete.d.ts.map +1 -1
- package/dist/commands/object/delete.js +20 -12
- package/dist/commands/object/get.d.ts.map +1 -1
- package/dist/commands/object/get.js +20 -12
- package/dist/commands/object/list.d.ts.map +1 -1
- package/dist/commands/object/list.js +20 -12
- package/dist/commands/object/put.d.ts.map +1 -1
- package/dist/commands/object/put.js +20 -12
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -4
- package/dist/index.test.js +54 -2
- package/oclif.manifest.json +4533 -2284
- package/package.json +8 -5
- package/templates/claude-code/debug-raindrop-app.md +89 -0
- package/templates/claude-code/new-raindrop-app.md +12 -4
- package/templates/claude-code/reattach-raindrop-session.md +50 -12
- package/templates/claude-code/update-raindrop-app.md +61 -9
- package/templates/db/node_modules/.bin/prisma +2 -2
- package/templates/db/node_modules/.bin/prisma-kysely +2 -2
- package/templates/db/node_modules/.bin/tsc +2 -2
- package/templates/db/node_modules/.bin/tsserver +2 -2
- package/templates/db/node_modules/.bin/zx +2 -2
- package/templates/gemini-code/debug-raindrop-app.toml +86 -0
- package/templates/gemini-code/new-raindrop-app.toml +10 -3
- package/templates/gemini-code/reattach-raindrop-session.toml +9 -11
- package/templates/gemini-code/update-raindrop-app.toml +55 -10
- package/templates/goose/debug-raindrop-app.yaml +91 -0
- package/templates/goose/new-raindrop-app.yaml +21 -0
- package/templates/goose/reattach-raindrop-session.yaml +20 -0
- package/templates/goose/update-raindrop-app.yaml +65 -0
- package/templates/init/src/_app/auth.ts +18 -0
- package/templates/init/src/_app/cors.ts +64 -0
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/templates/claude-code/raindrop-guidelines.md +0 -322
- package/templates/gemini-code/raindrop-guidelines.md +0 -322
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
watchStatus
|
|
3
|
+
} from "../../chunk-NG7CZTTE.js";
|
|
4
|
+
import {
|
|
5
|
+
deploy,
|
|
6
|
+
sandbox
|
|
7
|
+
} from "../../chunk-XYJACVNA.js";
|
|
8
|
+
import "../../chunk-MGM2L2T3.js";
|
|
9
|
+
import "../../chunk-VXAZKB3J.js";
|
|
10
|
+
import "../../chunk-W2L3MYN6.js";
|
|
11
|
+
import "../../chunk-MVQYQJHI.js";
|
|
12
|
+
import "../../chunk-PU4RCSXF.js";
|
|
13
|
+
import {
|
|
14
|
+
BaseCommand
|
|
15
|
+
} from "../../chunk-MCRKUPJY.js";
|
|
16
|
+
import {
|
|
17
|
+
__toESM,
|
|
18
|
+
init_cjs_shims,
|
|
19
|
+
require_lib
|
|
20
|
+
} from "../../chunk-G6NE675D.js";
|
|
21
|
+
|
|
22
|
+
// src/commands/build/branch.ts
|
|
23
|
+
init_cjs_shims();
|
|
24
|
+
var import_core = __toESM(require_lib(), 1);
|
|
25
|
+
var Branch = class extends BaseCommand {
|
|
26
|
+
static args = {
|
|
27
|
+
branch: import_core.Args.string({ description: "branch name", required: true })
|
|
28
|
+
};
|
|
29
|
+
static description = "branch a Raindrop application";
|
|
30
|
+
static examples = [
|
|
31
|
+
`<%= config.bin %> <%= command.id %> .
|
|
32
|
+
Branch a Raindrop application.
|
|
33
|
+
`
|
|
34
|
+
];
|
|
35
|
+
static flags = {
|
|
36
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
37
|
+
root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
|
|
38
|
+
manifest: import_core.Flags.string({
|
|
39
|
+
char: "M",
|
|
40
|
+
description: "project manifest",
|
|
41
|
+
required: false,
|
|
42
|
+
default: "raindrop.manifest"
|
|
43
|
+
}),
|
|
44
|
+
output: import_core.Flags.string({ char: "o", description: "output directory", required: false, default: "dist" }),
|
|
45
|
+
versionId: import_core.Flags.string({
|
|
46
|
+
char: "p",
|
|
47
|
+
aliases: ["version"],
|
|
48
|
+
description: "branch from this version",
|
|
49
|
+
required: false
|
|
50
|
+
}),
|
|
51
|
+
impersonate: import_core.Flags.string({
|
|
52
|
+
char: "i",
|
|
53
|
+
description: "impersonate organization",
|
|
54
|
+
required: false,
|
|
55
|
+
hidden: true
|
|
56
|
+
}),
|
|
57
|
+
start: import_core.Flags.boolean({
|
|
58
|
+
description: "start the application after deploying",
|
|
59
|
+
default: false,
|
|
60
|
+
required: false
|
|
61
|
+
}),
|
|
62
|
+
"no-watch": import_core.Flags.boolean({
|
|
63
|
+
description: "skip watching deployment status after branch",
|
|
64
|
+
required: false,
|
|
65
|
+
default: false
|
|
66
|
+
}),
|
|
67
|
+
show: import_core.Flags.boolean({ description: "show the current branch", required: false })
|
|
68
|
+
};
|
|
69
|
+
async run() {
|
|
70
|
+
const config = await this.loadConfig();
|
|
71
|
+
if (config.lock) {
|
|
72
|
+
this.error("Operation not allowed: application is in a locked state");
|
|
73
|
+
}
|
|
74
|
+
if (config.sandbox) {
|
|
75
|
+
this.error("Branching is not allowed in sandbox mode");
|
|
76
|
+
}
|
|
77
|
+
if (this.flags.show) {
|
|
78
|
+
console.log(`Current versionId: ${config.versionId}`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const versionId = this.flags.versionId || config.versionId;
|
|
82
|
+
await deploy({
|
|
83
|
+
command: this,
|
|
84
|
+
root: this.flags.root,
|
|
85
|
+
manifest: this.flags.manifest,
|
|
86
|
+
output: this.flags.output,
|
|
87
|
+
previousVersionId: versionId,
|
|
88
|
+
branch: this.args.branch,
|
|
89
|
+
amend: false,
|
|
90
|
+
start: this.flags.start,
|
|
91
|
+
impersonate: this.flags.impersonate
|
|
92
|
+
});
|
|
93
|
+
const updatedConfig = await this.loadConfig();
|
|
94
|
+
if (!updatedConfig.versionId) {
|
|
95
|
+
this.error("VersionId is not set in the config file");
|
|
96
|
+
}
|
|
97
|
+
this.log("Branching complete, sandboxing the new branch");
|
|
98
|
+
try {
|
|
99
|
+
await sandbox({
|
|
100
|
+
command: this,
|
|
101
|
+
isSandboxed: true,
|
|
102
|
+
impersonate: this.flags.impersonate,
|
|
103
|
+
versionId
|
|
104
|
+
});
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (error instanceof Error) {
|
|
107
|
+
this.error(error.message);
|
|
108
|
+
}
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
this.log(`\u{1F514} Branch is in Sandbox mode`);
|
|
112
|
+
if (!this.flags["no-watch"]) {
|
|
113
|
+
this.log("\n\u{1F4CA} Watching deployment status...\n");
|
|
114
|
+
await watchStatus({
|
|
115
|
+
command: this,
|
|
116
|
+
root: this.flags.root,
|
|
117
|
+
manifest: this.flags.manifest,
|
|
118
|
+
output: "watch",
|
|
119
|
+
impersonate: this.flags.impersonate
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
Branch as default
|
|
126
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import {
|
|
2
|
+
statusString
|
|
3
|
+
} from "../../chunk-CMCEP64V.js";
|
|
4
|
+
import {
|
|
5
|
+
source_default
|
|
6
|
+
} from "../../chunk-MVQYQJHI.js";
|
|
7
|
+
import {
|
|
8
|
+
esm_default2 as esm_default
|
|
9
|
+
} from "../../chunk-5GH4FS6C.js";
|
|
10
|
+
import {
|
|
11
|
+
BaseCommand
|
|
12
|
+
} from "../../chunk-MCRKUPJY.js";
|
|
13
|
+
import {
|
|
14
|
+
EPOCH_TS,
|
|
15
|
+
UnitState,
|
|
16
|
+
__toESM,
|
|
17
|
+
init_cjs_shims,
|
|
18
|
+
require_lib,
|
|
19
|
+
timestampDate,
|
|
20
|
+
valueOf
|
|
21
|
+
} from "../../chunk-G6NE675D.js";
|
|
22
|
+
|
|
23
|
+
// src/commands/build/checkout.ts
|
|
24
|
+
init_cjs_shims();
|
|
25
|
+
var import_core = __toESM(require_lib(), 1);
|
|
26
|
+
var Branch = class extends BaseCommand {
|
|
27
|
+
static args = {
|
|
28
|
+
version: import_core.Args.string({ description: "version id", required: false })
|
|
29
|
+
};
|
|
30
|
+
static description = "switch the current context to a specific version";
|
|
31
|
+
static examples = [
|
|
32
|
+
`<%= config.bin %> <%= command.id %>
|
|
33
|
+
Currently on version: 01jac6p20m4gahn1kaa2mhm2js
|
|
34
|
+
|
|
35
|
+
<%= config.bin %> <%= command.id %> 01jux6z20m4gbhn5kaa4mcm2jr
|
|
36
|
+
Switched to version: 01jux6z20m4gbhn5kaa4mcm2jr
|
|
37
|
+
`
|
|
38
|
+
];
|
|
39
|
+
static flags = {
|
|
40
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
41
|
+
output: import_core.Flags.string({ char: "o", description: "output format", required: false, default: "text" }),
|
|
42
|
+
manifest: import_core.Flags.string({
|
|
43
|
+
char: "M",
|
|
44
|
+
description: "project manifest",
|
|
45
|
+
required: false,
|
|
46
|
+
default: "raindrop.manifest"
|
|
47
|
+
}),
|
|
48
|
+
impersonate: import_core.Flags.string({
|
|
49
|
+
char: "i",
|
|
50
|
+
description: "impersonate organization",
|
|
51
|
+
required: false,
|
|
52
|
+
hidden: true
|
|
53
|
+
})
|
|
54
|
+
};
|
|
55
|
+
// Build a version tree from applications
|
|
56
|
+
buildVersionTree(applications) {
|
|
57
|
+
const nodesMap = /* @__PURE__ */ new Map();
|
|
58
|
+
const rootNodes = [];
|
|
59
|
+
applications.forEach((app) => {
|
|
60
|
+
const node = {
|
|
61
|
+
versionId: app.versionId,
|
|
62
|
+
previousVersionId: app.previousVersionId || null,
|
|
63
|
+
application: app,
|
|
64
|
+
children: [],
|
|
65
|
+
branch: app.branch
|
|
66
|
+
};
|
|
67
|
+
nodesMap.set(app.versionId, node);
|
|
68
|
+
});
|
|
69
|
+
for (const node of nodesMap.values()) {
|
|
70
|
+
if (node.previousVersionId && nodesMap.has(node.previousVersionId)) {
|
|
71
|
+
nodesMap.get(node.previousVersionId).children.push(node);
|
|
72
|
+
} else {
|
|
73
|
+
rootNodes.push(node);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { rootNodes, nodesMap };
|
|
77
|
+
}
|
|
78
|
+
// Fetch all versions of the application
|
|
79
|
+
async fetchApplicationVersions(applicationName, userId, organizationId) {
|
|
80
|
+
const { client: catalogService } = await this.catalogService();
|
|
81
|
+
const resp = await catalogService.applications({
|
|
82
|
+
userId,
|
|
83
|
+
organizationId,
|
|
84
|
+
showDeleted: true
|
|
85
|
+
});
|
|
86
|
+
return resp.applications.filter((app) => app.name === applicationName);
|
|
87
|
+
}
|
|
88
|
+
// Prompt user to select a version from the tree
|
|
89
|
+
async promptVersionSelection(versions) {
|
|
90
|
+
const { rootNodes } = this.buildVersionTree(versions);
|
|
91
|
+
const choices = [];
|
|
92
|
+
const buildChoices = (node, prefix = "", isLast = true) => {
|
|
93
|
+
const app = node.application;
|
|
94
|
+
const date = timestampDate(app.createdAt || EPOCH_TS).toLocaleDateString();
|
|
95
|
+
const branch = app.branch ? source_default.cyan(` (${app.branch})`) : "";
|
|
96
|
+
let status;
|
|
97
|
+
if (app.state === UnitState.RUNNING) {
|
|
98
|
+
status = source_default.green(statusString[app.state]);
|
|
99
|
+
} else if (app.state === UnitState.DELETING) {
|
|
100
|
+
status = source_default.yellow(statusString[app.state]);
|
|
101
|
+
} else if (app.state === UnitState.DELETED) {
|
|
102
|
+
status = source_default.red(statusString[app.state]);
|
|
103
|
+
} else {
|
|
104
|
+
status = source_default.gray(statusString[app.state]);
|
|
105
|
+
}
|
|
106
|
+
const connector = isLast ? "\u2514\u2500" : "\u251C\u2500";
|
|
107
|
+
const shortId = app.versionId.substring(0, 8);
|
|
108
|
+
const displayName = `${prefix}${connector} ${shortId}...${branch} - ${status} - ${source_default.dim(date)}`;
|
|
109
|
+
choices.push({
|
|
110
|
+
name: displayName,
|
|
111
|
+
value: app.versionId
|
|
112
|
+
});
|
|
113
|
+
const childPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
114
|
+
node.children.forEach((child, index) => {
|
|
115
|
+
buildChoices(child, childPrefix, index === node.children.length - 1);
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
rootNodes.forEach((root, index) => {
|
|
119
|
+
buildChoices(root, "", index === rootNodes.length - 1);
|
|
120
|
+
});
|
|
121
|
+
choices.push({
|
|
122
|
+
name: source_default.dim("(None - clear version)"),
|
|
123
|
+
value: "__NONE__"
|
|
124
|
+
});
|
|
125
|
+
const selectedVersion = await esm_default({
|
|
126
|
+
message: "Select a version to checkout:",
|
|
127
|
+
choices
|
|
128
|
+
});
|
|
129
|
+
return selectedVersion === "__NONE__" ? void 0 : selectedVersion;
|
|
130
|
+
}
|
|
131
|
+
async run() {
|
|
132
|
+
const config = await this.loadConfig();
|
|
133
|
+
if (config.lock) {
|
|
134
|
+
this.error("Operation not allowed: application is in a locked state");
|
|
135
|
+
}
|
|
136
|
+
if (["text", "json"].indexOf(this.flags.output) === -1) {
|
|
137
|
+
this.error(`unsupported output format: ${this.flags.output}`, { exit: 1 });
|
|
138
|
+
}
|
|
139
|
+
if (!this.args.version) {
|
|
140
|
+
if (this.flags.output === "json") {
|
|
141
|
+
console.log(JSON.stringify({ versionId: config.versionId }, null, 2));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (!config.versionId) {
|
|
145
|
+
console.log("No version currently set.\n");
|
|
146
|
+
} else {
|
|
147
|
+
console.log(`Currently on version: ${config.versionId}
|
|
148
|
+
`);
|
|
149
|
+
}
|
|
150
|
+
const apps = await this.loadManifest();
|
|
151
|
+
const app = apps[0];
|
|
152
|
+
if (app === void 0) {
|
|
153
|
+
this.error("No application found in manifest", { exit: 1 });
|
|
154
|
+
}
|
|
155
|
+
const applicationName = valueOf(app.name);
|
|
156
|
+
const { userId, organizationId } = await this.catalogService();
|
|
157
|
+
console.log("Fetching versions...");
|
|
158
|
+
const allVersions = await this.fetchApplicationVersions(
|
|
159
|
+
applicationName,
|
|
160
|
+
userId,
|
|
161
|
+
this.flags.impersonate ?? organizationId
|
|
162
|
+
);
|
|
163
|
+
const activeVersions = allVersions.filter(
|
|
164
|
+
(app2) => !app2.deletedAt
|
|
165
|
+
);
|
|
166
|
+
if (activeVersions.length === 0) {
|
|
167
|
+
config.sandbox = false;
|
|
168
|
+
await this.saveConfig(config);
|
|
169
|
+
console.log("No versions found.");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
console.log(`
|
|
173
|
+
Found ${activeVersions.length} version${activeVersions.length !== 1 ? "s" : ""}:`);
|
|
174
|
+
const selectedVersion = await this.promptVersionSelection(activeVersions);
|
|
175
|
+
const activeApp = activeVersions.find((a) => a.versionId === selectedVersion);
|
|
176
|
+
config.versionId = selectedVersion;
|
|
177
|
+
config.sandbox = activeApp?.isSandboxed === true;
|
|
178
|
+
await this.saveConfig(config);
|
|
179
|
+
if (selectedVersion) {
|
|
180
|
+
console.log(`
|
|
181
|
+
Switched to version: ${selectedVersion}`);
|
|
182
|
+
} else {
|
|
183
|
+
console.log("\nCleared version from config.");
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
config.versionId = this.args.version;
|
|
188
|
+
await this.saveConfig(config);
|
|
189
|
+
if (this.flags.output === "json") {
|
|
190
|
+
console.log(JSON.stringify({ versionId: config.versionId }, null, 2));
|
|
191
|
+
} else {
|
|
192
|
+
console.log(`Switched to version ${config.versionId}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
export {
|
|
197
|
+
Branch as default
|
|
198
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenPlan,
|
|
3
|
+
fileExists,
|
|
4
|
+
renderCodegenPlan
|
|
5
|
+
} from "../../chunk-W2L3MYN6.js";
|
|
6
|
+
import {
|
|
7
|
+
$,
|
|
8
|
+
spinner
|
|
9
|
+
} from "../../chunk-PU4RCSXF.js";
|
|
10
|
+
import {
|
|
11
|
+
esm_default
|
|
12
|
+
} from "../../chunk-5GH4FS6C.js";
|
|
13
|
+
import {
|
|
14
|
+
BaseCommand
|
|
15
|
+
} from "../../chunk-MCRKUPJY.js";
|
|
16
|
+
import {
|
|
17
|
+
__toESM,
|
|
18
|
+
getCurrentVersion,
|
|
19
|
+
init_cjs_shims,
|
|
20
|
+
mustManifestFromString,
|
|
21
|
+
readState,
|
|
22
|
+
require_lib
|
|
23
|
+
} from "../../chunk-G6NE675D.js";
|
|
24
|
+
|
|
25
|
+
// src/commands/build/clone.ts
|
|
26
|
+
init_cjs_shims();
|
|
27
|
+
var import_core = __toESM(require_lib(), 1);
|
|
28
|
+
import fs from "node:fs/promises";
|
|
29
|
+
import * as path from "node:path";
|
|
30
|
+
async function getSelectedOrganizationName(configDir) {
|
|
31
|
+
const state = await readState(configDir);
|
|
32
|
+
if (!state.currentOrganizationId) {
|
|
33
|
+
throw new Error("Not logged in. Run `raindrop auth login` before deploying.");
|
|
34
|
+
}
|
|
35
|
+
const token = state.organizationIdToBearerToken[state.currentOrganizationId];
|
|
36
|
+
if (!token) {
|
|
37
|
+
throw new Error("No credentials found for current organization. Run `raindrop auth login` again.");
|
|
38
|
+
}
|
|
39
|
+
return token.organizationName;
|
|
40
|
+
}
|
|
41
|
+
var Clone = class extends BaseCommand {
|
|
42
|
+
static args = {
|
|
43
|
+
id: import_core.Args.string({ description: "liquidmetal project ID to clone (e.g., liquidmetal/smartbucket)", required: true }),
|
|
44
|
+
path: import_core.Args.directory({ default: ".", description: "Path to initialize the project in", required: false })
|
|
45
|
+
};
|
|
46
|
+
static description = "clone a LiquidMetal.AI project";
|
|
47
|
+
static examples = [
|
|
48
|
+
`<%= config.bin %> <%= command.id %> .
|
|
49
|
+
Clone a project in the current directory.
|
|
50
|
+
`,
|
|
51
|
+
`<%= config.bin %> <%= command.id %> <%= config.path %>
|
|
52
|
+
Clone a project in the specified directory.
|
|
53
|
+
`
|
|
54
|
+
];
|
|
55
|
+
static flags = {
|
|
56
|
+
overwrite: import_core.Flags.boolean({ description: "Overwrite existing files", default: false })
|
|
57
|
+
};
|
|
58
|
+
async run() {
|
|
59
|
+
this.log(`path: ${this.args.path}`);
|
|
60
|
+
if (!await fileExists(this.args.path)) {
|
|
61
|
+
try {
|
|
62
|
+
await fs.mkdir(this.args.path, { recursive: true });
|
|
63
|
+
} catch {
|
|
64
|
+
this.error(`Could not create directory ${this.args.path}`, { exit: 1 });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const pathStat = await fs.lstat(this.args.path);
|
|
68
|
+
if (!pathStat.isDirectory()) {
|
|
69
|
+
this.error(`${this.args.path} is not a directory.`, { exit: 1 });
|
|
70
|
+
}
|
|
71
|
+
if (!this.flags.overwrite && await fileExists(path.join(this.args.path, "package.json"))) {
|
|
72
|
+
this.error(`A project ${this.args.path} has already been initialized.`, { exit: 1 });
|
|
73
|
+
}
|
|
74
|
+
if (this.args.id !== "liquidmetal/smartbucket") {
|
|
75
|
+
this.error(`Unsupported project ID: ${this.args.id}`, { exit: 1 });
|
|
76
|
+
}
|
|
77
|
+
await this.initSmartbucketTemplate();
|
|
78
|
+
}
|
|
79
|
+
async initSmartbucketTemplate() {
|
|
80
|
+
this.log("Initializing liquidmetal/smartbucket project...");
|
|
81
|
+
const apps = await mustManifestFromString('application "hello-world" {}');
|
|
82
|
+
const plan = codegenPlan(apps);
|
|
83
|
+
try {
|
|
84
|
+
await renderCodegenPlan(
|
|
85
|
+
plan,
|
|
86
|
+
this.args.path,
|
|
87
|
+
{
|
|
88
|
+
renderScaffoldingCode: false,
|
|
89
|
+
renderUserModifiableCode: true,
|
|
90
|
+
renderNonUserModifiableCode: true,
|
|
91
|
+
overwrite: false
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
applicationName: path.basename(this.args.path),
|
|
95
|
+
raindropFrameworkVersion: await getCurrentVersion()
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
this.error(`Could not initialize project at ${this.args.path}: ${error}`, { exit: 1 });
|
|
100
|
+
}
|
|
101
|
+
const projectName = path.basename(this.args.path);
|
|
102
|
+
const sanitizedProjectName = projectName.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_]/g, "").toLowerCase();
|
|
103
|
+
const manifest = `application "${sanitizedProjectName}" {
|
|
104
|
+
service "${sanitizedProjectName}-service" {}
|
|
105
|
+
smartbucket "${sanitizedProjectName}-smartbucket" {}
|
|
106
|
+
}
|
|
107
|
+
`;
|
|
108
|
+
await fs.writeFile(path.join(this.args.path, "raindrop.manifest"), manifest);
|
|
109
|
+
await spinner("Installing dependencies...", async () => {
|
|
110
|
+
const $1 = $({ cwd: this.args.path, verbose: true });
|
|
111
|
+
await $1`npm install`;
|
|
112
|
+
});
|
|
113
|
+
await spinner("Generating code...", async () => {
|
|
114
|
+
const $1 = $({ cwd: this.args.path, verbose: true });
|
|
115
|
+
await $1`raindrop build generate`;
|
|
116
|
+
});
|
|
117
|
+
await spinner("Validating code...", async () => {
|
|
118
|
+
const $1 = $({ cwd: this.args.path, verbose: true });
|
|
119
|
+
await $1`raindrop build validate`;
|
|
120
|
+
});
|
|
121
|
+
let orgReady = false;
|
|
122
|
+
while (!orgReady) {
|
|
123
|
+
try {
|
|
124
|
+
const orgName = await getSelectedOrganizationName(this.config.configDir);
|
|
125
|
+
const confirmed = await esm_default({
|
|
126
|
+
message: `Using organization: ${orgName}. Is this correct?`
|
|
127
|
+
});
|
|
128
|
+
if (confirmed) {
|
|
129
|
+
orgReady = true;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
} catch (_) {
|
|
133
|
+
}
|
|
134
|
+
await spinner("Logging in...", async () => {
|
|
135
|
+
const $1 = $({ cwd: this.args.path, verbose: true });
|
|
136
|
+
await $1`raindrop auth login`;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
await spinner("Branching...", async () => {
|
|
140
|
+
const $1 = $({ cwd: this.args.path, verbose: true });
|
|
141
|
+
await $1`raindrop build branch main`;
|
|
142
|
+
await new Promise((resolve) => setTimeout(resolve, 5e3));
|
|
143
|
+
});
|
|
144
|
+
this.log(`Initialized Smartbucket project "${sanitizedProjectName}" in ${this.args.path}`);
|
|
145
|
+
this.log(`To view your application, run:
|
|
146
|
+
cd ${this.args.path}
|
|
147
|
+
raindrop build list`);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
export {
|
|
151
|
+
Clone as default,
|
|
152
|
+
getSelectedOrganizationName
|
|
153
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import {
|
|
2
|
+
statusString
|
|
3
|
+
} from "../../chunk-CMCEP64V.js";
|
|
4
|
+
import {
|
|
5
|
+
source_default
|
|
6
|
+
} from "../../chunk-MVQYQJHI.js";
|
|
7
|
+
import {
|
|
8
|
+
esm_default2 as esm_default
|
|
9
|
+
} from "../../chunk-5GH4FS6C.js";
|
|
10
|
+
import {
|
|
11
|
+
BaseCommand
|
|
12
|
+
} from "../../chunk-MCRKUPJY.js";
|
|
13
|
+
import {
|
|
14
|
+
EPOCH_TS,
|
|
15
|
+
UnitState,
|
|
16
|
+
__toESM,
|
|
17
|
+
init_cjs_shims,
|
|
18
|
+
require_lib,
|
|
19
|
+
timestampDate,
|
|
20
|
+
valueOf
|
|
21
|
+
} from "../../chunk-G6NE675D.js";
|
|
22
|
+
|
|
23
|
+
// src/commands/build/delete.ts
|
|
24
|
+
init_cjs_shims();
|
|
25
|
+
var import_core = __toESM(require_lib(), 1);
|
|
26
|
+
var Delete = class extends BaseCommand {
|
|
27
|
+
static args = {
|
|
28
|
+
application: import_core.Args.string({ char: "a", description: "application name", required: false })
|
|
29
|
+
};
|
|
30
|
+
static description = "delete Raindrop applications";
|
|
31
|
+
static examples = [
|
|
32
|
+
`<%= config.bin %> <%= command.id %> .
|
|
33
|
+
Deleted (application) at version (version)
|
|
34
|
+
`
|
|
35
|
+
];
|
|
36
|
+
static flags = {
|
|
37
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
38
|
+
root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
|
|
39
|
+
manifest: import_core.Flags.string({
|
|
40
|
+
char: "M",
|
|
41
|
+
description: "project manifest",
|
|
42
|
+
required: false,
|
|
43
|
+
default: "raindrop.manifest"
|
|
44
|
+
}),
|
|
45
|
+
output: import_core.Flags.string({
|
|
46
|
+
char: "o",
|
|
47
|
+
description: "output format",
|
|
48
|
+
default: "table",
|
|
49
|
+
options: ["text", "table", "json"]
|
|
50
|
+
}),
|
|
51
|
+
version: import_core.Flags.string({
|
|
52
|
+
char: "v",
|
|
53
|
+
description: "application version to delete",
|
|
54
|
+
required: false,
|
|
55
|
+
exclusive: ["all"]
|
|
56
|
+
}),
|
|
57
|
+
all: import_core.Flags.boolean({
|
|
58
|
+
char: "a",
|
|
59
|
+
description: "delete all application versions",
|
|
60
|
+
required: false,
|
|
61
|
+
exclusive: ["version"]
|
|
62
|
+
}),
|
|
63
|
+
impersonate: import_core.Flags.string({
|
|
64
|
+
char: "i",
|
|
65
|
+
description: "impersonate organization",
|
|
66
|
+
required: false,
|
|
67
|
+
hidden: true
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
// Build a version tree from applications (reused from list.ts)
|
|
71
|
+
buildVersionTree(applications) {
|
|
72
|
+
const nodesMap = /* @__PURE__ */ new Map();
|
|
73
|
+
const rootNodes = [];
|
|
74
|
+
applications.forEach((app) => {
|
|
75
|
+
const node = {
|
|
76
|
+
versionId: app.versionId,
|
|
77
|
+
previousVersionId: app.previousVersionId || null,
|
|
78
|
+
application: app,
|
|
79
|
+
children: [],
|
|
80
|
+
branch: app.branch
|
|
81
|
+
};
|
|
82
|
+
nodesMap.set(app.versionId, node);
|
|
83
|
+
});
|
|
84
|
+
for (const node of nodesMap.values()) {
|
|
85
|
+
if (node.previousVersionId && nodesMap.has(node.previousVersionId)) {
|
|
86
|
+
nodesMap.get(node.previousVersionId).children.push(node);
|
|
87
|
+
} else {
|
|
88
|
+
rootNodes.push(node);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return { rootNodes, nodesMap };
|
|
92
|
+
}
|
|
93
|
+
// Fetch all versions of the application
|
|
94
|
+
async fetchApplicationVersions(applicationName, userId, organizationId) {
|
|
95
|
+
const { client: catalogService } = await this.catalogService();
|
|
96
|
+
const resp = await catalogService.applications({
|
|
97
|
+
userId,
|
|
98
|
+
organizationId,
|
|
99
|
+
showDeleted: true
|
|
100
|
+
});
|
|
101
|
+
return resp.applications.filter((app) => app.name === applicationName);
|
|
102
|
+
}
|
|
103
|
+
// Prompt user to select a version from the tree
|
|
104
|
+
async promptVersionSelection(versions, defaultVersion) {
|
|
105
|
+
const { rootNodes } = this.buildVersionTree(versions);
|
|
106
|
+
const choices = [];
|
|
107
|
+
const buildChoices = (node, prefix = "", isLast = true) => {
|
|
108
|
+
const app = node.application;
|
|
109
|
+
const date = timestampDate(app.createdAt || EPOCH_TS).toLocaleDateString();
|
|
110
|
+
const branch = app.branch ? source_default.cyan(` (${app.branch})`) : "";
|
|
111
|
+
let status;
|
|
112
|
+
if (app.state === UnitState.RUNNING) {
|
|
113
|
+
status = source_default.green(statusString[app.state]);
|
|
114
|
+
} else if (app.state === UnitState.DELETING) {
|
|
115
|
+
status = source_default.yellow(statusString[app.state]);
|
|
116
|
+
} else if (app.state === UnitState.DELETED) {
|
|
117
|
+
status = source_default.red(statusString[app.state]);
|
|
118
|
+
} else {
|
|
119
|
+
status = source_default.gray(statusString[app.state]);
|
|
120
|
+
}
|
|
121
|
+
const connector = isLast ? "\u2514\u2500" : "\u251C\u2500";
|
|
122
|
+
const shortId = app.versionId.substring(0, 8);
|
|
123
|
+
const isDefault = defaultVersion === app.versionId;
|
|
124
|
+
const defaultMarker = isDefault ? source_default.bold.green(" (parent - default)") : "";
|
|
125
|
+
const displayName = `${prefix}${connector} ${shortId}...${branch} - ${status} - ${source_default.dim(date)}${defaultMarker}`;
|
|
126
|
+
choices.push({
|
|
127
|
+
name: displayName,
|
|
128
|
+
value: app.versionId
|
|
129
|
+
});
|
|
130
|
+
const childPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
131
|
+
node.children.forEach((child, index) => {
|
|
132
|
+
buildChoices(child, childPrefix, index === node.children.length - 1);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
rootNodes.forEach((root, index) => {
|
|
136
|
+
buildChoices(root, "", index === rootNodes.length - 1);
|
|
137
|
+
});
|
|
138
|
+
choices.push({
|
|
139
|
+
name: source_default.dim("(None - clear version)"),
|
|
140
|
+
value: "__NONE__"
|
|
141
|
+
});
|
|
142
|
+
const selectedVersion = await esm_default({
|
|
143
|
+
message: "Select a version to checkout:",
|
|
144
|
+
choices,
|
|
145
|
+
default: defaultVersion
|
|
146
|
+
});
|
|
147
|
+
return selectedVersion === "__NONE__" ? void 0 : selectedVersion;
|
|
148
|
+
}
|
|
149
|
+
async run() {
|
|
150
|
+
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
151
|
+
let versionId = this.flags.version;
|
|
152
|
+
if (this.flags.all) {
|
|
153
|
+
versionId = void 0;
|
|
154
|
+
} else if (this.flags.version === void 0) {
|
|
155
|
+
const config2 = await this.loadConfig();
|
|
156
|
+
versionId = config2.versionId;
|
|
157
|
+
}
|
|
158
|
+
if (this.args.application === void 0) {
|
|
159
|
+
const apps = await this.loadManifest();
|
|
160
|
+
const app = apps[0];
|
|
161
|
+
if (app === void 0) {
|
|
162
|
+
this.error("No application found in manifest and no application name specified", { exit: 1 });
|
|
163
|
+
}
|
|
164
|
+
this.args.application = valueOf(app.name);
|
|
165
|
+
}
|
|
166
|
+
let parentVersionId;
|
|
167
|
+
if (versionId) {
|
|
168
|
+
const allVersionsBeforeDelete = await this.fetchApplicationVersions(
|
|
169
|
+
this.args.application,
|
|
170
|
+
userId,
|
|
171
|
+
this.flags.impersonate ?? organizationId
|
|
172
|
+
);
|
|
173
|
+
const versionToDelete = allVersionsBeforeDelete.find((v) => v.versionId === versionId);
|
|
174
|
+
parentVersionId = versionToDelete?.previousVersionId || void 0;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
await catalogService.delete({
|
|
178
|
+
userId,
|
|
179
|
+
organizationId: this.flags.impersonate ?? organizationId,
|
|
180
|
+
// Omitting versionId will delete all versions of the application
|
|
181
|
+
applications: [{ applicationName: this.args.application, currentVersionId: versionId || "" }]
|
|
182
|
+
});
|
|
183
|
+
} catch (e) {
|
|
184
|
+
if (e instanceof Error) {
|
|
185
|
+
this.error(`Failed to delete application ${this.args.application}: ${e.message}`, { exit: 1 });
|
|
186
|
+
}
|
|
187
|
+
throw e;
|
|
188
|
+
}
|
|
189
|
+
if (this.flags.all) {
|
|
190
|
+
console.log(`Deleted all versions of ${this.args.application}`);
|
|
191
|
+
} else {
|
|
192
|
+
console.log(`Deleted ${this.args.application} at version ${versionId}`);
|
|
193
|
+
}
|
|
194
|
+
console.log("\nFetching remaining versions...");
|
|
195
|
+
const allVersions = await this.fetchApplicationVersions(
|
|
196
|
+
this.args.application,
|
|
197
|
+
userId,
|
|
198
|
+
this.flags.impersonate ?? organizationId
|
|
199
|
+
);
|
|
200
|
+
const activeVersions = allVersions.filter((app) => !app.deletedAt);
|
|
201
|
+
const config = await this.loadConfig();
|
|
202
|
+
if (activeVersions.length === 0) {
|
|
203
|
+
console.log("No undeleted versions remaining.");
|
|
204
|
+
config.versionId = void 0;
|
|
205
|
+
config.sandbox = false;
|
|
206
|
+
await this.saveConfig(config);
|
|
207
|
+
console.log("Cleared version from config.");
|
|
208
|
+
} else {
|
|
209
|
+
console.log(`
|
|
210
|
+
Found ${activeVersions.length} undeleted version${activeVersions.length !== 1 ? "s" : ""}:`);
|
|
211
|
+
const selectedVersion = await this.promptVersionSelection(activeVersions, parentVersionId);
|
|
212
|
+
const activeApp = activeVersions.find((a) => a.versionId === selectedVersion);
|
|
213
|
+
config.versionId = selectedVersion;
|
|
214
|
+
config.sandbox = activeApp?.isSandboxed === true;
|
|
215
|
+
await this.saveConfig(config);
|
|
216
|
+
if (selectedVersion) {
|
|
217
|
+
console.log(`
|
|
218
|
+
Checked out version: ${selectedVersion}`);
|
|
219
|
+
} else {
|
|
220
|
+
console.log("\nCleared version from config.");
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
export {
|
|
226
|
+
Delete as default
|
|
227
|
+
};
|