Synopsis
Requirements
crucihil analyze requires the analyze optional extra:
tree-sitter, tree-sitter-c, and tree-sitter-cpp.
What it does
Real firmware components never reference DBC signal names directly. Instead, they go through shim layers:crucihil analyze bridges this gap using a three-step pipeline:
- Parse — tree-sitter walks every
.c,.cpp,.h,.hppfile in the source directory and collects all identifiers (functions, variables, macros, type names). - Corpus — DBC files from
[rig.definitions]in the rig TOML (or from--dbc) are parsed with cantools. EveryMessageName.SignalNamepair becomes a corpus entry, tagged with its interface type (CAN,ETH, etc.). - Match — An AI (Claude, GPT-4o, or Gemini) receives the filtered identifier list and the full signal corpus. It returns JSON: which identifiers map to which signals, whether each is an input or output, and a confidence score.
Options
Path to the SWC source directory or a single
.c/.cpp/.h file. All .c, .cpp, .cc, .cxx, .h, .hpp files under this path are included. Short form: -s.Label for this component in the output (e.g.
BrakeController, EngineManagement). Short form: -c.Path to a rig TOML config. CruciHiL reads
[rig.definitions] and auto-discovers DBC files. Interface type is inferred from the key name: can_dbc → CAN, eth_dbc → ETH. Can be combined with --dbc.Path to a DBC file. Repeatable — pass multiple DBC files for multi-bus components. Interface type defaults to
unknown unless inferred from key name in TOML. Example: --dbc defs/powertrain.dbc --dbc defs/chassis.dbc.Path to a shim header directory or another SWC path to parse alongside the primary source. Repeatable. Use this to include RTE headers, COM module headers, or any other files where signal-related identifiers are defined. See Dependency resolution below.
AI provider override. One of
anthropic, openai, gemini. If omitted, auto-detected from environment variables in this order: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY. Short form: -p.Output format.
pretty prints a human-readable summary. json prints the raw result as JSON.API key setup
Set one of these environment variables before running:Example
Example output
JSON output
Confidence scores
Every signal match comes with a confidence score:| Range | Label | Meaning | review_required |
|---|---|---|---|
| 0.85 – 1.00 | High | Clear match — use in tests | false |
| 0.60 – 0.84 | Medium | Plausible match — verify before using | true |
| Below 0.60 | Omitted | Not included in output |
Dependency resolution
The--dep option is the most powerful knob for improving result quality.
In many AUTOSAR projects, the SWC source file contains calls like Rte_Read_BC_BrakeDemandVal(...) but the actual identifier definition lives in rte/Rte_BrakeController.h. Without that header, the AI sees the call but not the type information that makes the semantic match clearer.
Pass only the shim headers for the SWC you are analyzing:
Without an AI key
If no API key is found,crucihil analyze returns the extracted identifiers and corpus size for manual inspection:
identifiers_extracted (list) and signal_corpus_size so you can perform the matching manually or with a separate tool.
Tips for best results
How to use the output
The JSON output fromcrucihil analyze can be fed directly into generate_test_suite as context_items: