{"slug": "flap-v2-5-1-released", "title": "FLAP v2.5.1 released", "summary": "FLAP, Stefano Zaghi's Fortran command-line argument parser, reached v2.7.0, building on v2.6.0 to let programs expose machine-readable interfaces for workflow managers, Python scripts and AI agents. The opt-in features include a --schema flag that describes a single command, a --check flag that validates a command line, JSON-formatted errors via init(error_format='json'), distinct exit statuses (2 for a bad command line, 3 for a bad file or variable, 4 for a program fault), a --dry-run mode, a save_provenance JSON manifest with no date, host or directory so identical inputs give identical bytes, sensitive=.true. masking of tokens as ***, and save_skill output of a SKILL.md file. In a six-run test on a two-command program, a small model averaged 5.0 calls with the generated skill versus 5.7 without, with no failed calls either way; FLAP stays pure Fortran with no MCP server in the library, and the release also turns previously silent Fortran list-directed read cases such as '--n 2*5' and integer overflow into errors.", "body_md": "[FLAP](https://szaghi.github.io/FLAP/), the Fortran command line arguments parser, has reached v2.7.0. With v2.6.0 from earlier, this release makes a FLAP program easy for other programs to call: workflow managers, Python scripts and AI agents. You describe the command line once, as before, and FLAP now answers in a form a machine can parse: what the program accepts, whether a command line is valid, and what to change when a call fails.\n\nEverything new is opt-in. A program that uses none of it keeps its help, its errors and its exit statuses (`--check` is the one exception, below).\n\nFor anyone new to FLAP, here is a whole program’s session: its help, some values, a typo and an out-of-range value.\n\n**See it run:** a program answering another program. It prints its JSON description, rejects a command line with `--check`, writes a JSON error and an exit status, and does a dry run:\n\nThe same session is on the [home page](https://szaghi.github.io/FLAP/#ready-for-other-programs), and [chapter 10 of the tutorial](https://szaghi.github.io/FLAP/manual/tutorial/10-agents) builds it step by step.\n\n`val_type='I4P'` (or `R8P`, `logical`, …), `parse` checks a value, its choices and its range before the program starts, whatever its source: command line, environment or configuration file. Without it, a bad value surfaces only at `get`, possibly hours into a run.`--schema`.` prog cmd --schema` describes a single command, so an agent need not read the whole program.`--check`.` init(error_format='json')`, or an environment variable you choose, writes each error as one line: code, message, option at fault, suggestions (“did you mean”), and a class.`stop cli%exit_status()` ends with 2 when the command line is wrong (fix and retry), 3 when a file or variable is wrong, and 4 when the program itself is wrong (do not retry). Status 1 stays yours.`--dry-run`.` cli%is_dry_run()`; skipping the side effects is your program’s job, and the docs say so plainly.`save_provenance` writes the command line and every value with its source as JSON. It contains no date, host or directory, so the same inputs give the same bytes.`sensitive=.true.` masks a token as `***` in the manifest, the help, the description and the error messages.`save_skill` writes a `SKILL.md` (\nOn the skill, a measurement rather than a promise. I gave a small model the same task six times on a two-command program, three times with the generated skill and three without: 5.0 calls on average with it, 5.7 without, no failed call either way, and about the same tokens. Six runs prove nothing, but they suggest a program with a good `--help` already serves an agent that knows about it. The skill’s real case is an agent that has not yet heard of your program. The first version of the file did worse than none: every failed call was `prog cmd --check`, which is why that spelling now works. The numbers are in [the guide](https://szaghi.github.io/FLAP/guide/machine#agent-skill).\n\nFLAP itself stays pure Fortran: everything above is plain text on standard output and standard error, which any caller can read in any language. The documentation shows one such caller, a [short Python script](https://github.com/szaghi/FLAP/blob/master/docs/examples/files/flap_tool.py) on the other side of the pipe. It is an example of a caller, not part of the library. There is no MCP server in the library either, on purpose: a well-described CLI is (generally) cheaper for an agent and has fewer moving parts. Integrating an MCP server is currently out of my scope, but it could be done in opt-in mode if someone needs it.\n\n`--n /`, `--n 2*5` and `--n 3 abc` were taken by Fortran’s list-directed read: no error, and a wrong or unassigned value.`2.5` was read into an integer as 2, and an integer overflow wrapped silently. Both are now errors.`set_mutually_exclusive_groups` reports an undefined command instead of ignoring it.`heat` solver, and the `get_varying` and `add_group`, which was wrong for a positional call, along with five other statements the code contradicted.`reset_parse`.\nThe details are on [the upgrade page](https://szaghi.github.io/FLAP/guide/migration).\n\nFLAP is pure Fortran 2018. The suite passes with gfortran 13 to 16 and with nvfortran 26.9, and FLAP builds with FoBiS, fpm, CMake or Make. It is multi-licensed: GPL v3, or BSD 2/3-Clause or MIT for closed-source and commercial use.\n\nFeedback is welcome, especially from anyone already driving Fortran code from scripts or agents.\n\nKind regards,\n\nStefano\n\nI’ll reword the licensing system to make it clearer.", "url": "https://wpnews.pro/news/flap-v2-5-1-released", "canonical_source": "https://fortran-lang.discourse.group/t/flap-v2-5-1-released/11148#post_4", "published_at": "2026-11-02 10:54:34+00:00", "updated_at": "2026-11-02 11:20:44.871142+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-tools"], "entities": ["FLAP", "Stefano Zaghi", "Fortran", "MCP"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/flap-v2-5-1-released", "markdown": "https://wpnews.pro/news/flap-v2-5-1-released.md", "text": "https://wpnews.pro/news/flap-v2-5-1-released.txt", "jsonld": "https://wpnews.pro/news/flap-v2-5-1-released.jsonld"}}