Skip to main content

Assess, plan, evolve.

Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.

7 packages

Sort by
C
openFeature/replace-feature-flag

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); ```

openFeaturefeature-flag
v1.0.2
Codemod
19
a year ago
Mmkhuzaima avatar
remove-statsig-feature-flag

Remove a stale Statsig feature flag and its now-dead code (constant propagation + dead-branch elimination)

statsigfeature-flag+3
v1.0.5
mkhuzaima
133
2 months ago
C
netlify/replace-feature-flag

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; ```

netlifyfeature-flag
v1.0.5
Codemod
192
a year ago
C
devcycle/replace-feature-flag

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"); } ```

devcyclefeature-flag
v1.0.4
Codemod
20
a year ago
C
remove-unused-feature-flags

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} />; ```

migration
v1.0.1
Codemod
14
a year ago
C
remove-unused-feature-flags-2

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; } ```

cleanup
v1.0.2
Codemod
0
a year ago
C
statsig/replace-gate

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, }); ```

statsigfeature-flag
v1.0.4
Codemod
12
a year ago

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.