Skip to content

Commit 0822214

Browse files
drowaudioclaude
andcommitted
Regenerate CLI docs and update architecture notes
- docs/Command line options.md regenerated from magic_args --help output - CLAUDE.md: document the JSON-merge settings pipeline, new source files, magic_args + nlohmann/json deps, C++23, and the macOS 13.3 deployment target Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ed9cba2 commit 0822214

2 files changed

Lines changed: 73 additions & 81 deletions

File tree

‎CLAUDE.md‎

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- **Version**: 1.0.4 (see `VERSION` file)
88
- **License**: GPLv3
99
- **Framework**: Built on JUCE (v8.0.x)
10-
- **Language**: C++20
10+
- **Language**: C++23
1111

1212
### Key Features
1313
- Tests VST/VST2/VST3/AU/LV2/LADSPA plugins
@@ -80,7 +80,10 @@ pluginval/
8080
│ ├── MainComponent.cpp/h # GUI main window component
8181
│ ├── Validator.cpp/h # Core validation orchestration
8282
│ ├── PluginTests.cpp/h # Test framework and base classes
83-
│ ├── CommandLine.cpp/h # CLI argument parsing
83+
│ ├── CommandLine.cpp/h # Thin CLI adapter (delegates to SettingsParser)
84+
│ ├── PluginvalSettings.h # Unified settings struct + JSON mapping + toPluginTestOptions()
85+
│ ├── SettingsParser.cpp/h # CLI/env/config -> merged JSON -> settings; child-process handoff
86+
│ ├── SettingsSerializer.cpp/h # JSON load/save + value coercions (comma lists, hex seed)
8487
│ ├── CrashHandler.cpp/h # Crash reporting utilities
8588
│ ├── TestUtilities.cpp/h # Helper functions for tests
8689
│ ├── RTCheck.h # Real-time safety checking macros
@@ -122,7 +125,7 @@ pluginval/
122125

123126
### Prerequisites
124127
- CMake 3.15+
125-
- C++20 compatible compiler
128+
- C++23 compatible compiler
126129
- Git (for submodules)
127130

128131
### Building
@@ -156,7 +159,7 @@ VST2_SDK_DIR=/path/to/vst2sdk cmake -B Builds/Debug .
156159
```
157160

158161
### Target Platforms
159-
- **macOS**: 10.11+ (deployment target), supports Apple Silicon via universal binary
162+
- **macOS**: 13.3+ (deployment target — required by std::format used in magic_args), supports Apple Silicon via universal binary
160163
- **Windows**: MSVC with static runtime linking
161164
- **Linux**: Ubuntu 22.04+, statically links libstdc++
162165

@@ -188,6 +191,29 @@ VST2_SDK_DIR=/path/to/vst2sdk cmake -B Builds/Debug .
188191
- Auto-registers via static instance pattern
189192
- Defines requirements (thread, GUI needs)
190193

194+
### CLI Settings Pipeline
195+
196+
Command-line parsing is a layered JSON-merge pipeline rather than a bespoke
197+
parser. The flow (in `SettingsParser`):
198+
199+
1. **preprocess** the raw command line — rewrite the deprecated `strictnessLevel`,
200+
strip the macOS `-NSDocumentRevisionsDebugMode YES` flag, and insert an
201+
implicit `--validate` when the last argument is a bare plugin path.
202+
2. Build a **sparse `nlohmann::json` per layer**: `--config` file, environment
203+
variables, and the CLI options (parsed with **magic_args** into a struct of
204+
`std::optional` fields, then coerced — comma lists → arrays, hex/int seed →
205+
number, etc. via `SettingsSerializer`).
206+
3. **Merge** with `merge_patch` in precedence order (defaults < config < env <
207+
CLI; **CLI wins**), then deserialise into `PluginvalSettings`
208+
(`NLOHMANN_DEFINE_TYPE..._WITH_DEFAULT` fills missing keys from defaults).
209+
4. `PluginvalSettings::toPluginTestOptions()` converts to the JUCE-flavoured
210+
`PluginTests::Options` at the boundary.
211+
212+
The child validation process receives a fully-resolved, **authoritative**
213+
settings set via a base64-encoded JSON argument (`--config-base64`), avoiding
214+
per-flag re-serialisation and command-line quoting hazards. `--help`/`--version`
215+
are handled by magic_args (auto usage + an appended env-var trailer).
216+
191217
### Test Framework
192218

193219
Tests are self-registering. To find all tests, look for static instances:
@@ -327,6 +353,7 @@ Basic usage:
327353

328354
Key options:
329355
- `--validate [path]` - Validate plugin at path
356+
- `--config [file.json]` - Load a full settings set from JSON (overridden by env vars and CLI options)
330357
- `--strictness-level [1-10]` - Test thoroughness (default: 5)
331358
- `--skip-gui-tests` - Skip GUI tests (for headless CI)
332359
- `--validate-in-process` - Don't use child process (for debugging)
@@ -374,6 +401,8 @@ add_pluginval_tests(MyPluginTarget
374401
### External
375402
- **JUCE** (v8.0.x) - Audio application framework (git submodule)
376403
- **magic_enum** (v0.9.7) - Enum reflection (fetched via CPM)
404+
- **magic_args** (v0.2.1) - C++23 CLI argument parsing, header-only (fetched via CPM); requires macOS 13.3+ due to std::format
405+
- **nlohmann/json** (3.12.0) - JSON settings layering/serialisation (fetched via CPM)
377406
- **rtcheck** (optional, macOS) - Real-time safety checking (fetched via CPM)
378407
- **VST3 SDK** (v3.7.x) - Steinberg VST3 SDK for embedded validator (fetched via CPM, optional)
379408

‎docs/Command line options.md‎

Lines changed: 40 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,48 @@
1-
Hello rtcheck!
2-
//==============================================================================
3-
pluginval
4-
JUCE v8.0.10
5-
6-
Description:
7-
Validate plugins to test compatibility with hosts and verify plugin API conformance
8-
9-
Usage:
10-
--version
11-
Print pluginval version.
12-
--validate [pathToPlugin]
13-
Validates the plugin at the given path.
14-
N.B. the "--validate" flag is optional if the path is the last argument.
15-
This enables you to validate a plugin with simply "pluginval path_to_plugin".
16-
17-
--sample-rates [list of comma separated sample rates]
18-
If specified, sets the list of sample rates at which tests will be executed
19-
(default=44100,48000,96000)
20-
--block-sizes [list of comma separated block sizes]
21-
If specified, sets the list of block sizes at which tests will be executed
22-
(default=64,128,256,512,1024)
23-
--random-seed [hex or int]
24-
Sets the random seed to use for the tests. Useful for replicating test
25-
environments.
26-
--data-file [pathToFile]
27-
If specified, sets a path to a data file which can be used by tests to
28-
configure themselves. This can be useful for things like known audio output.
29-
30-
--strictness-level [1-10]
31-
Sets the strictness level to use. A minimum level of 5 (also the default)
32-
is recomended for compatibility.
33-
Higher levels include longer, more thorough tests such as fuzzing.
34-
--timeout-ms [numMilliseconds]
35-
Sets a timout which will stop validation with an error if no output from any
36-
test has happened for this number of ms.
37-
By default this is 30s but can be set to "-1" (must be quoted) to never timeout.
38-
--rtcheck [empty, disabled, enabled or relaxed]
39-
Turns on real-time saftey checks using rtcheck (macOS and Linux only).
40-
relaxed mode doesn't run the checks for the first processing block as a lot of plugins
41-
use this to allocate or initialise thread-locals (which can allocate)
42-
43-
--repeat [num repeats]
44-
If specified repeats the tests a given number of times. Note that this does
45-
not delete and re-instantiate the plugin for each repeat.
46-
--randomise
47-
If specified, the tests are run in a random order per repeat.
48-
49-
--skip-gui-tests
50-
If specified, avoids tests that create GUI windows, which can cause problems
51-
on headless CI systems.
52-
--disabled-tests [pathToFile]
53-
If specified, sets a path to a file that should have the names of disabled
54-
tests on each row.
55-
--vst3validator [pathToValidator]
56-
If specified, this will run the VST3 validator as part of the test process.
57-
58-
--output-dir [pathToDir]
59-
If specified, sets a directory to store the log files. This can be useful
60-
for continuous integration.
61-
--output-filename [filename]
62-
If specified, sets a filename for the log files (within 'output-dir' or
63-
(lacking that) the current directory.
64-
By default, the name is constructed from the plugin metainformation
65-
--verbose
66-
If specified, outputs additional logging information. It can be useful to
67-
turn this off when building with CI to avoid huge log files.
68-
69-
Exit code:
1+
Usage: pluginval [OPTIONS...]
2+
Validate plugins to test compatibility with hosts and verify plugin API conformance
3+
4+
Examples:
5+
6+
pluginval --strictness-level 5 --validate path/to/plugin
7+
pluginval path/to/plugin
8+
pluginval --config settings.json --validate path/to/plugin
9+
10+
Options:
11+
12+
--validate=VALUE Validates the plugin at the given path (or AU id). Optional if the path is the last argument.
13+
--strictness-level=VALUE
14+
Strictness level 1-10 (default 5, minimum 5 recommended).
15+
--random-seed=VALUE Random seed (hex 0x.. or int) for replicable test runs.
16+
--timeout-ms=VALUE Test timeout in ms (default 30000, -1 to never timeout).
17+
--repeat=VALUE Number of times to repeat the tests.
18+
--randomise Run the tests in a random order per repeat.
19+
--verbose Output additional logging information.
20+
--skip-gui-tests Avoid tests that create GUI windows (for headless CI).
21+
--sample-rates=VALUE Comma-separated sample rates (default 44100,48000,96000).
22+
--block-sizes=VALUE Comma-separated block sizes (default 64,128,256,512,1024).
23+
--data-file=VALUE Path to a data file tests can use to configure themselves.
24+
--output-dir=VALUE Directory in which to write the log files.
25+
--output-filename=VALUE Filename to write logs into.
26+
--disabled-tests=VALUE Comma-separated test names, or a path to a file listing them.
27+
--rtcheck=VALUE Real-time safety checks: disabled, enabled or relaxed.
28+
--config=VALUE Path to a JSON file of settings (overridden by env vars and CLI options).
29+
30+
-?, --help show this message
31+
--version print program version
32+
33+
Other commands:
34+
--version Print the pluginval version.
35+
--run-tests Run the internal unit tests.
36+
--strictness-help [level] List all tests that run at the given strictness level.
37+
38+
Exit code:
7039
0 if all tests complete successfully
7140
1 if there are any errors
7241

7342
Additionally, you can specify any of the command line options as environment
7443
variables by removing prefix dashes, converting internal dashes to underscores
75-
and capitalising all letters, a.g.
44+
and capitalising all letters, e.g.
7645
"--skip-gui-tests" > "SKIP_GUI_TESTS=1"
7746
"--timeout-ms 30000" > "TIMEOUT_MS=30000"
78-
Specifying specific command-line options will override any environment variables
79-
set for that option.
80-
81-
pluginval --version Prints the current version number
82-
pluginval --help|-h Prints the list of commands
83-
pluginval --validate [pathToPlugin] Validates the file (or IDs for AUs).
84-
pluginval --run-tests Runs the internal unit tests.
47+
Precedence is command-line options > environment variables > --config file.
8548

0 commit comments

Comments
 (0)