<commit_before>---
short-description: Automatic modification of the build system files
...

# Meson file rewriter

Since version 0.50.0, meson has the functionality to perform some basic
modification on the `meson.build` files from the command line. The currently
supported operations are:

- For build targets:
  - Add/Remove source files
  - Add/Remove targets
  - Modify a select set of kwargs
  - Print some JSON information
- For dependencies:
  - Modify a select set of kwargs
- For the project function:
  - Modify a select set of kwargs
  - Modify the default options list

The rewriter has both, a normal command line interface and a "script mode". The
normal CLI is mostly designed for everyday use. The "script mode", on the
other hand, is meant to be used by external programs (IDEs, graphical
frontends, etc.)

## Using the rewriter

All rewriter functions are accessed via `meson rewrite`. The meson rewriter
assumes that it is run inside the project root directory. If this isn't the
case, use `--sourcedir` to specify the actual project source directory.

### Adding and removing sources
<commit_msg>rewriter: Mark the CLI as experimental<commit_after>---
short-description: Automatic modification of the build system files
...

# Meson file rewriter

Since version 0.50.0, meson has the functionality to perform some basic
modification on the `meson.build` files from the command line. The currently
supported operations are:

- For build targets:
  - Add/Remove source files
  - Add/Remove targets
  - Modify a select set of kwargs
  - Print some JSON information
- For dependencies:
  - Modify a select set of kwargs
- For the project function:
  - Modify a select set of kwargs
  - Modify the default options list

The rewriter has both, a normal command line interface and a "script mode". The
normal CLI is mostly designed for everyday use. The "script mode", on the
other hand, is meant to be used by external programs (IDEs, graphical
frontends, etc.)

The rewriter itself is considered stable, however the user interface and the
"script mode" API might change in the future. These changes may also break
backwards comaptibility to older releases.

We are also open to suggestions for API improvements.

## Using the rewriter

All rewriter functions are accessed via `meson rewrite`. The meson rewriter
assumes that it is run inside the project root directory. If this isn't the
case, use `--sourcedir` to specify the actual project source directory.

### Adding and removing sources

{'fraction_non_alphanumeric': 0.054625199362041466, 'fraction_numerical': 0.003189792663476874, 'mean_word_length': 3.9781746031746033, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5292320', 'n_tokens_mistral': 650, 'n_tokens_neox': 632, 'n_words': 366}