Assess, plan, evolve.
Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.
7 packages
This codemod replaces openFeature compatible feature flags with a static value provided by the user. Codemod replaces following SDK calls: `getBooleanValue`, `getStringValue`, `getNumberValue`, `getObjectValue`. The codemod accepts the following arguments: - `key`: The key of the feature flag to be replaced. - `value`: The value to replace the feature flag with. ## Example ### Before ```ts const theValue = getBooleanValue("the-key", true).value; console.log(getBooleanValue("the-key", false)); if (theValue === true) { const someVar = useGate("other-gate1"); const templateVar = `Hello, ${someVar}`; const concatVar = "Goodbye, " + someVar; } if (theValue) { console.log("theValue is truthy"); } if (theValue === 3) { console.log("value var === 3"); } const x = theValue ? 1 : 0; if (getBooleanValue("the-key", true).value === true) { console.log("obj.value === true"); } if (getBooleanValue("the-key", true).value) { console.log("obj.value is truthy"); } console.log(getBooleanValue("the-key", true).value); ``` ### After ```ts console.log(true); const someVar = useGate("other-gate1"); const templateVar = `Hello, ${someVar}`; const concatVar = "Goodbye, " + someVar; console.log("theValue is truthy"); const x = 1; console.log("obj.value === true"); console.log("obj.value is truthy"); console.log(true); ```
Remove a stale Statsig feature flag and its now-dead code (constant propagation + dead-branch elimination)
This codemod replaces feature flags with a static value provided by the user. Codemod replaces `useFlag` hook calls. The codemod accepts the following arguments: - `key`: The key of the feature flag to be replaced. - `value`: The value to replace the feature flag with. - `type`: The type to which the provided value should be cast. ## Example ### Before ```ts const theValue = useFlag("the-gate").value; if (theValue) { // Simple Case is true console.log("theValue is truthy"); } if (theValue === 3) { console.log("value var === 3"); } const x = theValue ? 1 : 0; ``` ### After ```ts // Simple Case is true console.log("theValue is truthy"); const x = 1; ```
This codemod replaces DevCycle feature flags with a static value provided by the user. It replaces following SDK method calls: `variable`, `variableValue`, `useVariable`, `useDVCVariable`, `useVariableValue`. The codemod accepts the following arguments: - `key`: The key of the feature flag to be replaced. - `value`: The value to replace the feature flag with. - `type`: The type to which the provided value should be cast. ## Example ### Before ```ts const simpleCaseValue = dvcClient.variable(user, "simple-case", true).value; const simpleCase = dvcClient.variable(user, "simple-case", true); const isDefaulted = dvcClient.variable(user, "simple-case", true).isDefaulted; console.log("isDefaulted: " + isDefaulted); console.log(dvcClient.variable(user, "simple-case", true)); if (simpleCaseValue === true) { const someVar = dvcClient.variable(user, "some-var", "stringy"); const templateVar = `Hello, ${someVar}`; const concatVar = "Goodbye, " + someVar; } if (simpleCase.value) { // Simple Case is true console.log("obj var .value is truthy"); } if (simpleCaseValue === 3) { console.log("value var === 3"); } const x = simpleCaseValue ? 1 : 0; if (dvcClient.variable(user, "simple-case", true).value === true) { console.log("obj.value === true"); } if (dvcClient.variable(user, "simple-case", true).value) { console.log("obj.value is truthy"); } console.log(dvcClient.variable(user, SIMPLE_CASE, true).value); console.log(useVariableValue("simple-case", true)); function hello() { console.log("HELLO"); dvcClient.variable(user, "simple-case", true).onUpdate((value) => { heroText.innerHTML = value; }); } ``` ### After ```ts console.log("isDefaulted: " + true); console.log({ key: "simple-case", value: true, defaultValue: true, isDefaulted: true, }); const someVar = dvcClient.variable(user, "some-var", "stringy"); const templateVar = `Hello, ${someVar}`; const concatVar = "Goodbye, " + someVar; // Simple Case is true console.log("obj var .value is truthy"); const x = 1; console.log("obj.value === true"); console.log("obj.value is truthy"); console.log(dvcClient.variable(user, SIMPLE_CASE, true).value); console.log(true); function hello() { console.log("HELLO"); } ```
This experimental codemod replaces function calls in a for of `await functionName(featureFlagName)`, where: - `functionName` is the target function name (default: `isFlagEnabled`), - `featureFlagName` is the target feature flag name. You need to pass these arguments using the Codemod Arguments' settings or using the Codemod CLI. ## Example ### Before: ```tsx const [a, b] = await Promise.all([ Promise.resolve("a"), isFlagEnabled("featureFlag"), ]); const x = b && c; const y = <A b={b} />; ``` ### After: ```tsx const a = await Promise.resolve("a"); const x = c; const y = <A b={true} />; ```
This experimental codemod replaces function calls in a form of `await functionName()`, based on the following arguments: - `fileMarker` is the marker of files that contain feature flag builders, - `functionName` is the name of the feature flag builder function, - `featureFlagName` is the target feature flag name. You need to pass these arguments using the Codemod Arguments' settings or using the Codemod CLI. ## Example ### Before: ```tsx export async function Component() { const a = await featureFlagObject(); } ``` ### After: ```tsx export async function Component() { const a = true; } ```
This codemod replaces Statsig gates with a static value provided by the user. Codemod replaces following SDK calls `checkGate`, `useGate`; The codemod accepts the following arguments: - `key`: The key of the feature flag to be replaced. - `value`: The value to replace the feature flag with. - `type`: The type to which the provided value should be cast. ## Example ### Before ```ts const theValue = useGate("the-gate").value; const theGate = useGate("the-gate"); const isLoading = useGate("the-gate").isLoading; console.log("isLoading: " + isLoading); console.log(useGate("the-gate")); if (theValue === true) { const someVar = useGate("other-gate1"); const templateVar = `Hello, ${someVar}`; const concatVar = "Goodbye, " + someVar; } if (theGate.value) { // Simple Case is true console.log("obj var .value is truthy"); } if (theValue === 3) { console.log("value var === 3"); } const x = theValue ? 1 : 0; if (useGate("the-gate").value === true) { console.log("obj.value === true"); } if (useGate("the-gate").value) { console.log("obj.value is truthy"); } console.log(useGate("the-gate").value); console.log(useGate("the-gate")); ``` ### After ```ts console.log("isLoading: " + false); console.log({ isLoading: false, value: true, }); const someVar = useGate("other-gate1"); const templateVar = `Hello, ${someVar}`; const concatVar = "Goodbye, " + someVar; // Simple Case is true console.log("obj var .value is truthy"); const x = 1; console.log("obj.value === true"); console.log("obj.value is truthy"); console.log(true); console.log({ isLoading: false, value: true, }); ```
Build your own codemod!
Describe the migration you need and Wish will create a codemod for you.
Ready to evolve your codebase?
Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.