@liquidmetal-ai/raindrop 0.7.0 → 0.8.1
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 +408 -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 +14 -1
- 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 +17 -3
- package/dist/codegen.test.js +44 -0
- package/dist/commands/build/checkout.d.ts.map +1 -1
- package/dist/commands/build/checkout.js +4 -0
- package/dist/commands/build/delete.d.ts.map +1 -1
- package/dist/commands/build/delete.js +6 -3
- 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 +0 -2
- package/dist/commands/mcp/install-gemini.d.ts.map +1 -1
- package/dist/commands/mcp/install-gemini.js +0 -2
- package/dist/commands/mcp/install-goose.d.ts.map +1 -1
- package/dist/commands/mcp/install-goose.js +0 -2
- 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 +4 -0
- package/oclif.manifest.json +4544 -2466
- package/package.json +8 -5
- package/templates/claude-code/debug-raindrop-app.md +89 -0
- package/templates/claude-code/new-raindrop-app.md +10 -6
- 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 +9 -5
- 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 +12 -7
- package/templates/goose/reattach-raindrop-session.yaml +11 -4
- package/templates/goose/update-raindrop-app.yaml +57 -5
- 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,160 @@
|
|
|
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/deploy.ts
|
|
23
|
+
init_cjs_shims();
|
|
24
|
+
var import_core = __toESM(require_lib(), 1);
|
|
25
|
+
|
|
26
|
+
// src/utils/directory-validation.ts
|
|
27
|
+
init_cjs_shims();
|
|
28
|
+
import * as fs from "node:fs/promises";
|
|
29
|
+
import * as path from "node:path";
|
|
30
|
+
var DirectoryValidationError = class extends Error {
|
|
31
|
+
constructor(message, suggestedActions = []) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.suggestedActions = suggestedActions;
|
|
34
|
+
this.name = "DirectoryValidationError";
|
|
35
|
+
}
|
|
36
|
+
isDirectoryValidationError = true;
|
|
37
|
+
};
|
|
38
|
+
async function validateRaindropDirectory(root, manifest = "raindrop.manifest") {
|
|
39
|
+
const manifestPath = path.isAbsolute(manifest) ? manifest : path.join(root, manifest);
|
|
40
|
+
try {
|
|
41
|
+
await fs.access(manifestPath, fs.constants.F_OK);
|
|
42
|
+
} catch (_error) {
|
|
43
|
+
const relativePath = path.relative(process.cwd(), root);
|
|
44
|
+
const displayPath = relativePath === "" ? "current directory" : relativePath;
|
|
45
|
+
throw new DirectoryValidationError(
|
|
46
|
+
`Error: Not in a raindrop directory. No raindrop.manifest found in ${displayPath}.`,
|
|
47
|
+
[
|
|
48
|
+
"Check if you are in the correct directory",
|
|
49
|
+
"Navigate to a raindrop project directory using: cd <project-directory>",
|
|
50
|
+
"Initialize a new raindrop project using: raindrop build init"
|
|
51
|
+
]
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function isDirectoryValidationError(error) {
|
|
56
|
+
return error instanceof DirectoryValidationError;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/commands/build/deploy.ts
|
|
60
|
+
var Deploy = class extends BaseCommand {
|
|
61
|
+
static args = {};
|
|
62
|
+
static description = "deploy a Raindrop application";
|
|
63
|
+
static examples = [
|
|
64
|
+
`<%= config.bin %> <%= command.id %> .
|
|
65
|
+
Deploy a Raindrop application version.
|
|
66
|
+
`
|
|
67
|
+
];
|
|
68
|
+
static flags = {
|
|
69
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
70
|
+
root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
|
|
71
|
+
manifest: import_core.Flags.string({
|
|
72
|
+
char: "M",
|
|
73
|
+
description: "project manifest",
|
|
74
|
+
required: false,
|
|
75
|
+
default: "raindrop.manifest"
|
|
76
|
+
}),
|
|
77
|
+
output: import_core.Flags.string({ char: "o", description: "output directory", required: false, default: "dist" }),
|
|
78
|
+
versionId: import_core.Flags.string({
|
|
79
|
+
char: "v",
|
|
80
|
+
aliases: ["version"],
|
|
81
|
+
description: "version ID",
|
|
82
|
+
required: false
|
|
83
|
+
}),
|
|
84
|
+
impersonate: import_core.Flags.string({
|
|
85
|
+
char: "i",
|
|
86
|
+
description: "impersonate organization",
|
|
87
|
+
required: false,
|
|
88
|
+
hidden: true
|
|
89
|
+
}),
|
|
90
|
+
start: import_core.Flags.boolean({
|
|
91
|
+
char: "s",
|
|
92
|
+
description: "start the application after deploying",
|
|
93
|
+
required: false,
|
|
94
|
+
default: false
|
|
95
|
+
}),
|
|
96
|
+
"no-watch": import_core.Flags.boolean({
|
|
97
|
+
description: "skip watching deployment status after deploy",
|
|
98
|
+
required: false,
|
|
99
|
+
default: false
|
|
100
|
+
}),
|
|
101
|
+
lock: import_core.Flags.string({
|
|
102
|
+
description: "override lock ID to resume deployment",
|
|
103
|
+
required: false
|
|
104
|
+
}),
|
|
105
|
+
amend: import_core.Flags.boolean({ char: "a", description: "amend an existing application", required: false, default: false })
|
|
106
|
+
};
|
|
107
|
+
async run() {
|
|
108
|
+
try {
|
|
109
|
+
await validateRaindropDirectory(this.flags.root, this.flags.manifest);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
if (isDirectoryValidationError(error)) {
|
|
112
|
+
this.error(
|
|
113
|
+
error.message + "\n\nSuggested actions:\n" + error.suggestedActions?.map((action) => ` \u2022 ${action}`).join("\n"),
|
|
114
|
+
{ exit: 1 }
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
const config = await this.loadConfig();
|
|
120
|
+
const versionId = this.flags.versionId ?? config.versionId;
|
|
121
|
+
const unlock = this.flags.lock ?? config.lock ?? "user";
|
|
122
|
+
const amend = config.sandbox || this.flags.amend;
|
|
123
|
+
if (config.sandbox) {
|
|
124
|
+
this.log(`\u{1F514} Application is in Sandbox mode, running deploy in amend mode`);
|
|
125
|
+
}
|
|
126
|
+
await deploy({
|
|
127
|
+
command: this,
|
|
128
|
+
root: this.flags.root,
|
|
129
|
+
manifest: this.flags.manifest,
|
|
130
|
+
output: this.flags.output,
|
|
131
|
+
versionId,
|
|
132
|
+
currentVersionId: amend ? versionId : void 0,
|
|
133
|
+
previousVersionId: amend ? void 0 : versionId,
|
|
134
|
+
amend,
|
|
135
|
+
lock: unlock,
|
|
136
|
+
start: this.flags.start,
|
|
137
|
+
impersonate: this.flags.impersonate
|
|
138
|
+
});
|
|
139
|
+
if (!amend) {
|
|
140
|
+
this.log(`\u{1F514} You deployed a full version update and are now in Sandbox mode, future deploys will amend`);
|
|
141
|
+
await sandbox({
|
|
142
|
+
command: this,
|
|
143
|
+
isSandboxed: true
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (!this.flags["no-watch"]) {
|
|
147
|
+
this.log("\n\u{1F4CA} Watching deployment status...\n");
|
|
148
|
+
await watchStatus({
|
|
149
|
+
command: this,
|
|
150
|
+
root: this.flags.root,
|
|
151
|
+
manifest: this.flags.manifest,
|
|
152
|
+
output: "watch",
|
|
153
|
+
impersonate: this.flags.impersonate
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
Deploy as default
|
|
160
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
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/env/get.ts
|
|
12
|
+
init_cjs_shims();
|
|
13
|
+
var import_core = __toESM(require_lib(), 1);
|
|
14
|
+
var Get = class extends BaseCommand {
|
|
15
|
+
static args = {
|
|
16
|
+
var: import_core.Args.string({ char: "v", description: "env var/secret name", required: true })
|
|
17
|
+
};
|
|
18
|
+
static description = "get an env var/secret";
|
|
19
|
+
static examples = [
|
|
20
|
+
`<%= config.bin %> <%= command.id %> my-app:env:MY_VAR
|
|
21
|
+
sets an env var/secret.
|
|
22
|
+
`
|
|
23
|
+
];
|
|
24
|
+
static flags = {
|
|
25
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
26
|
+
output: import_core.Flags.string({ char: "o", description: "output format", default: "table" }),
|
|
27
|
+
manifest: import_core.Flags.string({
|
|
28
|
+
char: "M",
|
|
29
|
+
description: "project manifest",
|
|
30
|
+
required: false,
|
|
31
|
+
default: "raindrop.manifest"
|
|
32
|
+
}),
|
|
33
|
+
versionId: import_core.Flags.string({
|
|
34
|
+
char: "v",
|
|
35
|
+
aliases: ["version"],
|
|
36
|
+
description: "version ID",
|
|
37
|
+
required: false
|
|
38
|
+
}),
|
|
39
|
+
application: import_core.Flags.string({
|
|
40
|
+
char: "a",
|
|
41
|
+
description: "application",
|
|
42
|
+
required: false
|
|
43
|
+
}),
|
|
44
|
+
impersonate: import_core.Flags.string({
|
|
45
|
+
char: "i",
|
|
46
|
+
description: "impersonate organization",
|
|
47
|
+
required: false,
|
|
48
|
+
hidden: true
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
async run() {
|
|
52
|
+
const apps = await this.loadManifest();
|
|
53
|
+
const app = apps.find((app2) => valueOf(app2.name) === this.flags.application) || apps[0];
|
|
54
|
+
if (app === void 0) {
|
|
55
|
+
this.error(`application ${this.flags.application} not found in manifest`, { exit: 1 });
|
|
56
|
+
}
|
|
57
|
+
let isSecret = false;
|
|
58
|
+
const path = this.args.var.split(":");
|
|
59
|
+
const envVarName = path.pop();
|
|
60
|
+
if (envVarName === void 0) {
|
|
61
|
+
this.error("variable name not specified", { exit: 1 });
|
|
62
|
+
}
|
|
63
|
+
if (path.length == 1) {
|
|
64
|
+
const envStanza = app.env.find((env) => valueOf(env.name) === envVarName);
|
|
65
|
+
if (envStanza === void 0) {
|
|
66
|
+
this.error(`variable ${envVarName} not found in manifest`, { exit: 1 });
|
|
67
|
+
}
|
|
68
|
+
isSecret = envStanza.secret && valueOf(envStanza.secret) || false;
|
|
69
|
+
} else if (path.length > 1) {
|
|
70
|
+
const scriptModules = app.handlers();
|
|
71
|
+
const scriptModule = scriptModules.find((module) => valueOf(module.name) === path[0]);
|
|
72
|
+
if (scriptModule === void 0) {
|
|
73
|
+
this.error(`script module ${path[0]} not found in manifest`, { exit: 1 });
|
|
74
|
+
}
|
|
75
|
+
const envStanza = scriptModule.env.find((env) => valueOf(env.name) === envVarName);
|
|
76
|
+
if (envStanza === void 0) {
|
|
77
|
+
this.error(`variable ${envVarName} not found in manifest`, { exit: 1 });
|
|
78
|
+
}
|
|
79
|
+
isSecret = envStanza.secret && valueOf(envStanza.secret) || false;
|
|
80
|
+
} else {
|
|
81
|
+
this.error("variable must be an env variable or secret", { exit: 1 });
|
|
82
|
+
}
|
|
83
|
+
const config = await this.loadConfig();
|
|
84
|
+
const { client: catalogService, userId, organizationId } = await this.catalogService();
|
|
85
|
+
const resp = await catalogService.getEnvs({
|
|
86
|
+
userId,
|
|
87
|
+
organizationId: this.flags.impersonate ?? organizationId,
|
|
88
|
+
envs: [
|
|
89
|
+
{
|
|
90
|
+
applicationName: valueOf(app.name),
|
|
91
|
+
currentVersionId: this.flags.versionId || config.versionId || "",
|
|
92
|
+
key: this.args.var
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
if (isSecret) {
|
|
97
|
+
console.log(`${this.args.var}=[hash: ${resp.envs[0]?.value}]`);
|
|
98
|
+
} else {
|
|
99
|
+
console.log(`${this.args.var}=${resp.envs[0]?.value}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
Get as default
|
|
105
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
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/env/set.ts
|
|
12
|
+
init_cjs_shims();
|
|
13
|
+
var import_core = __toESM(require_lib(), 1);
|
|
14
|
+
var Set = class extends BaseCommand {
|
|
15
|
+
static args = {
|
|
16
|
+
var: import_core.Args.string({ char: "v", description: "env var/secret name", required: true }),
|
|
17
|
+
value: import_core.Args.string({ char: "V", description: "env var/secret value", required: false })
|
|
18
|
+
};
|
|
19
|
+
static description = "set an env var/secret";
|
|
20
|
+
static examples = [
|
|
21
|
+
`<%= config.bin %> <%= command.id %> .
|
|
22
|
+
sets an env var/secret.
|
|
23
|
+
`
|
|
24
|
+
];
|
|
25
|
+
static flags = {
|
|
26
|
+
...BaseCommand.HIDDEN_FLAGS,
|
|
27
|
+
root: import_core.Flags.string({ char: "r", description: "root directory", required: false, default: process.cwd() }),
|
|
28
|
+
manifest: import_core.Flags.string({
|
|
29
|
+
char: "M",
|
|
30
|
+
description: "project manifest",
|
|
31
|
+
required: false,
|
|
32
|
+
default: "raindrop.manifest"
|
|
33
|
+
}),
|
|
34
|
+
output: import_core.Flags.string({ char: "o", description: "output format", default: "table" }),
|
|
35
|
+
versionId: import_core.Flags.string({
|
|
36
|
+
char: "v",
|
|
37
|
+
aliases: ["version"],
|
|
38
|
+
description: "version ID",
|
|
39
|
+
required: false
|
|
40
|
+
}),
|
|
41
|
+
application: import_core.Flags.string({
|
|
42
|
+
char: "a",
|
|
43
|
+
description: "application to start",
|
|
44
|
+
required: false
|
|
45
|
+
}),
|
|
46
|
+
impersonate: import_core.Flags.string({
|
|
47
|
+
char: "i",
|
|
48
|
+
description: "impersonate organization",
|
|
49
|
+
required: false,
|
|
50
|
+
hidden: true
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
async run() {
|
|
54
|
+
const apps = await this.loadManifest();
|
|
55
|
+
const app = apps.find((app2) => valueOf(app2.name) === this.flags.application) || apps[0];
|
|
56
|
+
if (app === void 0) {
|
|
57
|
+
this.error(`application ${this.flags.application} not found in manifest`, { exit: 1 });
|
|
58
|
+
}
|
|
59
|
+
const { client: catalogService, organizationId: defaultOrganizationId, userId } = await this.catalogService();
|
|
60
|
+
const organizationId = this.flags.impersonate ?? defaultOrganizationId;
|
|
61
|
+
let isSecret = false;
|
|
62
|
+
const path = this.args.var.split(":");
|
|
63
|
+
const envVarName = path.pop();
|
|
64
|
+
if (envVarName === void 0) {
|
|
65
|
+
this.error("variable name not specified", { exit: 1 });
|
|
66
|
+
}
|
|
67
|
+
if (path.length == 1) {
|
|
68
|
+
const envStanza = app.env.find((env) => valueOf(env.name) === envVarName);
|
|
69
|
+
if (envStanza === void 0) {
|
|
70
|
+
this.error(`variable ${envVarName} not found in manifest`, { exit: 1 });
|
|
71
|
+
}
|
|
72
|
+
isSecret = envStanza.secret && valueOf(envStanza.secret) || false;
|
|
73
|
+
} else if (path.length > 1) {
|
|
74
|
+
const scriptModules = app.handlers();
|
|
75
|
+
const scriptModule = scriptModules.find((module) => valueOf(module.name) === path[0]);
|
|
76
|
+
if (scriptModule === void 0) {
|
|
77
|
+
this.error(`script module ${path[0]} not found in manifest`, { exit: 1 });
|
|
78
|
+
}
|
|
79
|
+
const envStanza = scriptModule.env.find((env) => valueOf(env.name) === envVarName);
|
|
80
|
+
if (envStanza === void 0) {
|
|
81
|
+
this.error(`variable ${envVarName} not found in manifest`, { exit: 1 });
|
|
82
|
+
}
|
|
83
|
+
isSecret = envStanza.secret && valueOf(envStanza.secret) || false;
|
|
84
|
+
} else {
|
|
85
|
+
this.error("variable must be an env variable or secret", { exit: 1 });
|
|
86
|
+
}
|
|
87
|
+
let secretValue = this.args.value;
|
|
88
|
+
if (secretValue === "-") {
|
|
89
|
+
this.log("reading stdin (ctrl+D to finish)...");
|
|
90
|
+
const chunks = [];
|
|
91
|
+
for await (const chunk of process.stdin) {
|
|
92
|
+
chunks.push(chunk);
|
|
93
|
+
}
|
|
94
|
+
secretValue = Buffer.concat(chunks).toString("utf8");
|
|
95
|
+
}
|
|
96
|
+
const config = await this.loadConfig();
|
|
97
|
+
await catalogService.setEnvs({
|
|
98
|
+
userId,
|
|
99
|
+
organizationId,
|
|
100
|
+
envs: [
|
|
101
|
+
{
|
|
102
|
+
applicationName: valueOf(app.name),
|
|
103
|
+
currentVersionId: this.flags.versionId || config.versionId || "",
|
|
104
|
+
key: this.args.var,
|
|
105
|
+
value: secretValue || "",
|
|
106
|
+
isSecret
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
console.log(`set ${this.args.var}`);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
Set as default
|
|
115
|
+
};
|