.opencode/commands/compat-flag.md
Look up compatibility flag: $ARGUMENTS
If no argument is provided (empty or blank), list all compatibility flags:
Use the compat-date-at tool (no arguments) to get the full list of flags with their enable dates, categories, and annotations. This is faster and more accurate than manually reading the capnp file.
For each flag, also extract a one-line summary from the comment in src/workerd/io/compatibility-date.capnp.
Output a summary table grouped by category (streams, nodejs, containers, general, etc.):
| Flag | Enable date | Description |
|---|---|---|
flag_name | 2025-01-15 | Brief description |
Include the total count of compatibility flags.
If an argument is provided, look up that specific flag:
Use the compat-date-at tool with flag: "<argument>" to get the flag's metadata (enable/disable names, enable date, annotations). Then read the capnp source for the comment.
Extract flag metadata from the tool output and capnp definition:
$compatEnableFlag name$compatDisableFlag name (if present)$compatEnableDate (if set)$experimental annotationFind C++ usage sites. Search for the getter (e.g., getTextDecoderReplaceSurrogates()) across the codebase:
grep -rn "getTextDecoderReplaceSurrogates\|text_decoder_replace_surrogates" src/
Find tests. Search for the snake_case flag name in .wd-test and test .js files:
grep -rn "text_decoder_replace_surrogates" src/ --include='*.wd-test' --include='*-test.js' --include='*-test.ts'
Output: