Skip to content

divide 0.11.0

Choose a tag to compare

@github-actions github-actions released this 01 Dec 08:57

divide 0.11.0 lets a template take its data from a provider: a PHP script of your project that prints the data as JSON, the way your generator really builds it, so the template renders, traces and completes with that data instead of a hand-written file. It also remembers the data file you choose for a template, and divide's MCP server uses that choice.

Platforms: Linux and Windows are supported; macOS is experimental. This release has no macOS binaries and the Homebrew tap stays at 0.10.0. See Platforms below.

A provider is real PHP with real effects on your computer: it is not a sandbox. divide runs it only when you ask (Run > Refresh template data) and only after you trust it, and the trust question starts on Cancel.

Data from a provider

Set it in the project's .div/data-files.json, in place of the template's data file:

{"templates": {"templates/dto.tpl": {"provider": {"php": "tools/template-data.php", "args": ["model/package_info.json"], "timeout_seconds": 10}}}}
  • php is a script of the project; one that leads outside the project is not run. args and timeout_seconds (1 to 60, 10 by default) are optional.
  • divide runs php SCRIPT ARGS in the project folder, with nothing on its input and DIVIDE_TEMPLATE and DIVIDE_DATA_PROVIDER=1 in its environment. It must exit with 0 and print one JSON object, strict JSON (NaN and Infinity are refused).
  • examples/generator has one: tools/template-data.php.

It runs only when you ask. Run > Refresh template data runs the active template's provider once, under a progress box; Esc stops it and ends PHP. Nothing else runs it: not opening the project or the template, typing, completion, Run > Check, the render trace, nor the MCP server. It has no key of its own.

  • Trust. The first refresh names the script, its arguments, the folder and the limits, and asks. The answer is kept in your own settings, never in the project, for that project and that script with those arguments: another script or other arguments ask again. Trusting Run, a Flow or a Mock Simulation does not trust a provider.
  • The snapshot. What the provider printed is kept in .div/data-snapshots/, out of git, and Ctrl+F9, the render trace (F7) and completion use it. A snapshot made by another script or other arguments is never used.
  • No snapshot, no data. A template whose provider has no valid snapshot, or whose provider entry is not valid, is not rendered with Div's convention or another file instead: divide says so and offers Refresh now.
  • The script that runs is the one you saw. divide reads it again just before starting PHP, and runs nothing if it changed; if it changes while PHP runs, the output is not kept. When the script changes, the snapshot is stale: it is still used, with a warning, and the next refresh first shows what changed.
  • When a refresh fails (an exit code other than 0, output that is not one JSON object, the time limit, more than 5 MB of output, Esc, PHP that cannot be started, a snapshot that cannot be written), Messages says why, with PHP's errors at their place, and Output shows its standard error, which is never kept on disk. The last valid data is kept.
  • Run > Template data provider shows the provider, its trust and its snapshot, and can Withdraw trust or Remove snapshot. Run > Edit data opens the script; Run > Data file replaces the provider with a data file.

The data file you choose is remembered

  • Run > Data file keeps the choice in the project's .div/data-files.json (two paths relative to the project), so it holds when you open the project again; the dialog's Default button goes back to Div's convention (page.tpl takes page.json). A template or data file outside the project is chosen for the session only.
  • The choice, and a provider's script, follow renames in the project window.
  • divide's MCP server renders and traces a template with the chosen data file when the request names none and gives no data, or with its provider's snapshot (data_file_from says which, and stale whether the script changed since). The server never runs a provider: with no valid snapshot it refuses the request.

Fixed

  • Closing divide just as it starts a process (such as the php -l check after typing) no longer leaves it waiting forever on Python 3.11 and 3.12 (#30).
  • A line trace's time limit stops it on Python 3.11 too (#30).
  • Project window: a folder read again during Ctrl+R's reload no longer starts a second reload that folds what was just unfolded (#16).
  • Functions window: its narrow layout no longer waits for a resize (#33); the Mock Simulation playback is never shown empty before its first refresh (#33).
  • Mock Simulation progress box: its Output row is the Function's output, not the PHP process's whole output (#39).

Also

  • The help (English and Spanish) has the new section Data from a provider (Rendering), and the MCP Server and Project Window pages say what changed. The Spanish interface covers all of it.
  • Acceptance tests of whole user journeys, in Pilot and in a real terminal, run in CI on Linux, and keep the screen at meaningful moments as evidence whether they pass or fail.

Platforms

  • Linux and Windows are supported: every change is tested on them (Linux with Python 3.11 and 3.12, the acceptance journeys and the real terminal; Windows with Python 3.12), and this release has their binaries and packages.
  • macOS is experimental, for now, because its UI tests fail intermittently on CI. It is still tested, in a workflow of its own whose result does not hold back a change or a release. This release has no macOS binaries, and the Homebrew tap stays at 0.10.0 (its formula needs the macOS archives). Earlier releases keep their macOS files. On macOS, divide 0.11.0 runs from the source code (tools/install.sh or pipx, with Python 3.11 or newer).
  • macOS comes back as supported after ten consecutive macOS CI runs pass with no manual rerun, the recurring UI failures are investigated, the Intel and Apple silicon packages build, and a smoke test of the packaged binary starts, edits, saves and exits cleanly.

Known limits

  • Not a sandbox. A provider is your project's own trusted code. Files it includes or reads are not checked when its script is.
  • PHP only. A provider is a PHP script run with the PHP divide uses.

Install

Ready to run, with nothing else to install:

  • Windows: scoop install https://github.com/divengine/divide/releases/latest/download/divide.json, or the .msi below
  • Linux: the .deb, .rpm, .apk and Arch packages, the AppImage or the binary alone, below
  • macOS (experimental): from the source code, pipx install git+https://github.com/divengine/divide.git@v0.11.0

Requirements:

  • Rendering and checking includes: PHP 8 and Div (composer require divengine/div).
  • Template data providers: PHP 8.
  • Runner Flows: Runner (composer require divengine/runner, 0.3 or newer to simulate a Flow).
  • Mock Simulation: PHP 8.1 or newer, and Xdebug for the line trace.
  • The Git menu: git.

divide is free software under the GPL, version 3 or later. The binaries are not signed yet: see Installation.