calabasas 0.19.0 → 0.19.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.
Files changed (2) hide show
  1. package/dist/index.js +57 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7103,6 +7103,62 @@ Add this as CALABASAS_SECRET in your Convex environment.`, "Platform Secret");
7103
7103
  }
7104
7104
  p11.outro("Platform created successfully!");
7105
7105
  }
7106
+ async function platformConnect() {
7107
+ if (!isAuthenticated()) {
7108
+ console.log("Not logged in. Run `calabasas login` first.");
7109
+ return;
7110
+ }
7111
+ p11.intro("calabasas platform connect");
7112
+ const s = p11.spinner();
7113
+ s.start("Fetching platforms...");
7114
+ const { ok, data, status } = await apiRequest2("GET", "/api/cli/platforms");
7115
+ if (!ok) {
7116
+ s.stop("Failed to fetch platforms");
7117
+ p11.cancel(`${data.error || `HTTP ${status}`}`);
7118
+ return;
7119
+ }
7120
+ const { platforms } = data;
7121
+ s.stop("Fetched platforms");
7122
+ if (platforms.length === 0) {
7123
+ p11.cancel("No platforms found. Run `calabasas platform create` to create one.");
7124
+ return;
7125
+ }
7126
+ let selectedPlatform;
7127
+ if (platforms.length === 1) {
7128
+ selectedPlatform = platforms[0];
7129
+ p11.log.info(`Using platform: ${pc2.bold(selectedPlatform.name)}`);
7130
+ } else {
7131
+ const choice = await p11.select({
7132
+ message: "Select a platform to connect to",
7133
+ options: platforms.map((platform) => ({
7134
+ value: platform._id,
7135
+ label: platform.name,
7136
+ hint: platform.convexProject ?? undefined
7137
+ }))
7138
+ });
7139
+ if (p11.isCancel(choice)) {
7140
+ p11.cancel("Cancelled.");
7141
+ return;
7142
+ }
7143
+ selectedPlatform = platforms.find((pl) => pl._id === choice);
7144
+ }
7145
+ const keySpinner = p11.spinner();
7146
+ keySpinner.start("Generating API key...");
7147
+ const { ok: rotateOk, data: rotateData, status: rotateStatus } = await apiRequest2("PATCH", "/api/cli/platform", { platformId: selectedPlatform._id, rotateApiKey: true });
7148
+ if (!rotateOk) {
7149
+ keySpinner.stop("Failed to generate API key");
7150
+ p11.cancel(`${rotateData.error || `HTTP ${rotateStatus}`}`);
7151
+ return;
7152
+ }
7153
+ keySpinner.stop("API key generated");
7154
+ const { platformApiKey } = rotateData;
7155
+ if (selectedPlatform.hasApiKey) {
7156
+ p11.log.warn("This replaces the previous API key for this platform.");
7157
+ }
7158
+ appendToEnvLocal({ CALABASAS_PLATFORM_API_KEY: platformApiKey });
7159
+ p11.note(`CALABASAS_PLATFORM_API_KEY=${platformApiKey}`, "Saved to .env.local");
7160
+ p11.outro(`Connected to ${pc2.bold(selectedPlatform.name)}!`);
7161
+ }
7106
7162
  async function platformList() {
7107
7163
  if (!isAuthenticated()) {
7108
7164
  console.log("Not logged in. Run `calabasas login` first.");
@@ -7653,6 +7709,7 @@ bot.command("remove <botId>").alias("rm").description("Remove a Discord bot").op
7653
7709
  bot.command("edit <botId>").description("Edit a Discord bot").option("-n, --name <name>", "New bot name").option("-t, --token <token>", "New bot token").option("-i, --intents <intents>", "New intents value").action(botEdit);
7654
7710
  var platformCmd = program2.command("platform").description("Manage your Calabasas platform");
7655
7711
  platformCmd.command("create").description("Create a new platform with Convex project configuration").option("-n, --name <name>", "Platform name").option("-p, --project <project>", "Convex project name (e.g. diligent-swordfish-752)").action(platformCreate);
7712
+ platformCmd.command("connect").description("Connect this project to an existing platform (saves API key to .env.local)").action(platformConnect);
7656
7713
  platformCmd.command("list").alias("ls").description("List all your platforms").action(platformList);
7657
7714
  platformCmd.command("info").description("Show platform info (secret, URL, API key status)").action(platformInfo);
7658
7715
  platformCmd.command("set-url").description("Set Convex URL for your platform").action(platformSetUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calabasas",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "CLI for Calabasas - Discord Gateway as a Service for Convex",
5
5
  "type": "module",
6
6
  "bin": {