Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions packages/cli/mcp/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
\`
Expand All @@ -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;
Expand All @@ -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 <button onClick={track}>Start my feature!.</button>;

console.log("Feature is enabled!")
}
\`\`\`
`,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/services/companies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down