From 5d22dabc23b8bd9a450a108b73602d0629c3237a Mon Sep 17 00:00:00 2001 From: Ron Cohen Date: Wed, 26 Mar 2025 19:15:29 +0100 Subject: [PATCH 1/2] minor MCP updates --- packages/cli/mcp/tools.ts | 20 +++++++++++--------- packages/cli/services/companies.ts | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/cli/mcp/tools.ts b/packages/cli/mcp/tools.ts index 152343e9..63de23b4 100644 --- a/packages/cli/mcp/tools.ts +++ b/packages/cli/mcp/tools.ts @@ -121,7 +121,7 @@ ${JSON.stringify(data, null, 2)}`, content: [ { type: "text", - text: `Feature created successfully. See it [on Bucket here](${featureLink}). Before moving on we need to generate the refreshed types to avoid linting errors. Run the Bucket CLI in a terminal: + text: `Feature created successfully. Show this link to the feature Bucket: ${featureLink}. Now run the Bucket CLI in a terminal: \`shell $ npx bucket features types \` @@ -131,7 +131,7 @@ After that we can feature flag some code. Use the following pattern for React: \`\`\`typescript import { useFeature } from "@bucketco/react-sdk"; function MyComponent() { - const { isEnabled } = useFeatureFlag("${feature.key}"); + const { isEnabled } = useFeature("${feature.key}"); if (!isEnabled) { // feature is disabled return null; @@ -140,18 +140,20 @@ function MyComponent() { } \`\`\` -To track feature usage, call the \`track\` method on usage: +For Node.js, the pattern is similar: +\`\`\` +// import the initialized bucket client +import { bucketClient } from "./bucket"; -\`\`\`typescript -import { useFeature } from "@bucketco/react-sdk"; +function myFunction() { + const { isEnabled } = bucketClient.getFeature("${feature.key}"); -function MyComponent() { - const { isEnabled } = useFeatureFlag("${feature.key}"); if (!isEnabled) { // feature is disabled - return null; + return; } - return ; + + console.log("Feature is enabled!") } \`\`\` `, diff --git a/packages/cli/services/companies.ts b/packages/cli/services/companies.ts index 47ffe827..dfd2e6e1 100644 --- a/packages/cli/services/companies.ts +++ b/packages/cli/services/companies.ts @@ -81,7 +81,7 @@ export async function listCompanies( } export const CompanyFeatureAccessSchema = EnvironmentQuerySchema.extend({ - companyId: z.string().length(14).describe("Company ID"), + companyId: z.string().describe("Company ID"), featureKey: z.string().describe("Feature key"), isEnabled: booleanish.describe( "Set feature to enabled or disabled for the company.", From a0bddff591c79c61e8d3f520145b3ac5fe90aa6f Mon Sep 17 00:00:00 2001 From: Ron Cohen Date: Wed, 26 Mar 2025 19:16:00 +0100 Subject: [PATCH 2/2] bump CLI version --- packages/cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 0fb78100..07b67f22 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@bucketco/cli", - "version": "0.4.0", + "version": "0.4.1", "packageManager": "yarn@4.1.1", "description": "CLI for Bucket service", "main": "./dist/index.js",