Skip to content

Commit

Permalink
Deprecate constellation commands and add a warning when using the con…
Browse files Browse the repository at this point in the history
…stellation binding (#4632)

* Deprecate and hide constellation commands

* Add changelog

* Fix tests
  • Loading branch information
G4brym authored Dec 19, 2023
1 parent 421cd58 commit a6a4e8a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-hotels-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": minor
---

Deprecate constellation commands and add a warning when using the constellation binding
4 changes: 0 additions & 4 deletions packages/wrangler/src/__tests__/constellation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ describe("constellation help", () => {
expect(std.out).toMatchInlineSnapshot(`
"wrangler constellation
🤖 Interact with Constellation models
Commands:
wrangler constellation project Manage your projects
wrangler constellation model Manage your models
Expand Down Expand Up @@ -51,8 +49,6 @@ describe("constellation help", () => {
"
wrangler constellation
🤖 Interact with Constellation models
Commands:
wrangler constellation project Manage your projects
wrangler constellation model Manage your models
Expand Down
2 changes: 0 additions & 2 deletions packages/wrangler/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ describe("wrangler", () => {
wrangler d1 🗄 Interact with a D1 database
wrangler hyperdrive 🚀 Configure Hyperdrive databases
wrangler ai 🤖 Interact with AI models
wrangler constellation 🤖 Interact with Constellation models
wrangler vectorize 🧮 Interact with Vectorize indexes
wrangler pubsub 📮 Interact and manage Pub/Sub Brokers
wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections
Expand Down Expand Up @@ -106,7 +105,6 @@ describe("wrangler", () => {
wrangler d1 🗄 Interact with a D1 database
wrangler hyperdrive 🚀 Configure Hyperdrive databases
wrangler ai 🤖 Interact with AI models
wrangler constellation 🤖 Interact with Constellation models
wrangler vectorize 🧮 Interact with Vectorize indexes
wrangler pubsub 📮 Interact and manage Pub/Sub Brokers
wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections
Expand Down
4 changes: 4 additions & 0 deletions packages/wrangler/src/constellation/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { logger } from "../logger";
import * as CreateProject from "./createProject";
import * as DeleteProject from "./deleteProject";
import * as DeleteProjectModel from "./deleteProjectModel";
Expand All @@ -9,6 +10,9 @@ import * as UploadModel from "./uploadModel";
import type { CommonYargsArgv } from "../yargs-types";

export function constellation(yargs: CommonYargsArgv) {
logger.warn(
"`wrangler constellation` is deprecated and will be removed in the next major version.\nPlease migrate to Workers AI, learn more here https://developers.cloudflare.com/workers-ai/."
);
return yargs
.command("project", "Manage your projects", (constProjYargs) => {
return constProjYargs
Expand Down
6 changes: 6 additions & 0 deletions packages/wrangler/src/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -970,5 +970,11 @@ function getBindings(
}),
};

if (bindings.constellation && bindings.constellation.length > 0) {
logger.warn(
"`constellation` is deprecated and will be removed in the next major version.\nPlease migrate to Workers AI, learn more here https://developers.cloudflare.com/workers-ai/."
);
}

return bindings;
}
12 changes: 4 additions & 8 deletions packages/wrangler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,10 @@ export function createCLIParser(argv: string[]) {
return ai(aiYargs.command(subHelp));
});

// constellation
wrangler.command(
"constellation",
"🤖 Interact with Constellation models",
(aiYargs) => {
return constellation(aiYargs.command(subHelp));
}
);
// [DEPRECATED] constellation
wrangler.command("constellation", false, (aiYargs) => {
return constellation(aiYargs.command(subHelp));
});

// vectorize
wrangler.command(
Expand Down

0 comments on commit a6a4e8a

Please sign in to comment.