.opencode/commands/autogate.md
Look up autogate: $ARGUMENTS
If no argument is provided (empty or blank), list all autogates:
Read the AutogateKey enum in src/workerd/util/autogate.h.
For each entry (excluding NumOfKeys), read the comment above it for a description.
Read the string mapping in src/workerd/util/autogate.c++ to get the config string for each.
Output a summary table:
| Autogate | Config string | Description |
|---|---|---|
ENUM_NAME | "string-key" | Brief description from comment |
Include the total count of active autogates.
If an argument is provided, look up that specific autogate:
Find the enum entry. Search src/workerd/util/autogate.h for the autogate name. The argument may be the enum name (e.g., SOME_FEATURE), the string key, or a partial match.
Find the string mapping. Search src/workerd/util/autogate.c++ for the corresponding entry in the string-to-enum mapping. Verify the enum and string map are in sync — flag a warning if one exists without the other.
Find usage sites. Search for where the autogate is checked:
grep -rn 'AutogateKey::<name>\|isAutoGateEnabled.*<name>' src/ --include='*.h' --include='*.c++'
Find tests. Search for the autogate name in test files:
grep -rn '<name>' src/ --include='*.wd-test' --include='*-test.js' --include='*-test.ts' --include='*-test.c++'
Also check if any tests use the @all-autogates variant to exercise this gate.
Output:
AutogateKey::<name> (file:line)