rmb32 / barnark-gui
A web GUI for browsing a Barnark workspace, switching template profiles, and viewing conformance checks
Requires
- php: ^8.5
- ext-ds: ^2.0
- rmb32/barnark: ^2.0
- rmb32/barncept: ^1.0
- rmb32/barnscaff: ^1.0
- symfony/console: ^7.0
- symfony/process: ^7.0
Requires (Dev)
- infection/infection: ^0.35.4
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.3
- rector/rector: ^2.6
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-07 18:34:24 UTC
README
Part of BarnSuite.
A browser UI for Barnark: manage a workspace of many template-tracked folders, browse each folder's tree, create implementations, run conformance checks, and switch a folder to another architecture template.
Folders can be scaffolded from a template or picked up from disk, and removed again either by forgetting them (files untouched) or by deleting them outright.
In Browse, wherever the template says a concept can go, the tree offers a button for it — on the directory's own row, and inside the directory once it is open. Click, for example, Create New Context, give the instance a name, and the template's whole structure for it is scaffolded underneath. The folder panel on the left is dragged to whatever width you like (double-click the divider to put it back).
In Switch template, pick the template to switch to and Plan switch.
Every piece of content beyond the old template's skeleton gets a row: move it
under one of the new template's concepts (keeping its name or giving it a new
one, and choosing a role where the concept offers several), leave it where it
is, or decide later. A mapping's suggestion is one Accept away, and Do
the same for the other 2 Contexts decides the rest alike. Each change is
saved at once to .barnark/switch-plans/<folder>.json, the same file
barnark template:switch works on, so a switch started in the terminal can be
finished here and the other way round. Run switch unlocks once nothing is
left to decide; it lists the moves, runs them, and shows what moved, what was
left in place and what needs follow-up. Run composer dump-autoload
afterwards.
Requirements
- PHP 8.5+
- Node.js (only if you want to develop the frontend)
Installation
Install it alongside Barnark CLI, which then offers barnark gui:
composer require --dev rmb32/barnark-cli rmb32/barnark-gui
Run it
If the barnark CLI is installed in the same project, just run:
barnark gui # http://localhost:8081, opens your browser
barnark gui --port=9000 --no-open
It serves the workspace at the project root (the nearest parent directory with a
barnark-workspace.json) and picks the next free port if the default is taken.
Or serve it by hand:
BARNARK_GUI_WORKSPACE_ROOT=/path/to/workspace php -S localhost:8080 -t public
Open http://localhost:8080. BARNARK_GUI_WORKSPACE_ROOT defaults to the
current directory; folders you add are tracked in its barnark-workspace.json.
To work on the frontend with hot reload:
cd frontend
npm install
npm run dev # proxies /api to localhost:8080, serves on :5173
npm test # Vitest + Testing Library
The served bundle in dist/ is rebuilt with composer build-frontend.
JSON API
| Method | Path | Behaviour |
|---|---|---|
| GET | /api/workspace/folders | List workspace folders |
| POST | /api/workspace/folders | Create a folder ({ name, baseDir, template }) |
| POST | /api/workspace/tracked-folders | Track an existing folder ({ path, template }) |
| DELETE | /api/workspace/folders/{path} | Stop tracking a folder; ?deleteFiles=1 deletes its files too |
| GET | /api/workspace/folders/{path}/tree?path= | Browse a folder's tree |
| DELETE | /api/workspace/folders/{path}/tree?path= | Delete a path in the tree |
| POST | /api/workspace/folders/{path}/implementations | Create an implementation ({ parentPath, roleKey, name }) |
| GET | /api/workspace/folders/{path}/check | Run a conformance check |
| GET | /api/templates | List bundled templates |
| GET | /api/workspace/folders/{path}/switch/plan | The folder's switch plan, brought up to date with the disk: each unit's choice, target path and problems, the choices the editor offers, and the templates it can switch to |
| POST | /api/workspace/folders/{path}/switch/plan | Plan a switch ({ to }), or carry on with the plan to that template; 409 while a plan to another is saved |
| PUT | /api/workspace/folders/{path}/switch/plan/root-namespace | Set the root namespace moved code is rewritten under ({ rootNamespace }, null to clear) |
| PUT | /api/workspace/folders/{path}/switch/plan/unit | Decide one unit ({ path, choice: "move" \| "leave" \| "undecided", targetConcept?, name?, role?, alike? }); alike: true gives the other undecided units under the same old concept the same choice |
| PUT | /api/workspace/folders/{path}/switch/plan/leftovers | Decide the old folders the new template has no place for ({ choice: "remove" \| "keep" }) |
| DELETE | /api/workspace/folders/{path}/switch/plan | Discard the plan |
| POST | /api/workspace/folders/{path}/switch/apply | Run a complete plan; 422 with the remaining problems otherwise |
A {path} or {name} containing / must be URL-encoded as %2F. Folder paths are
canonical: rooted, with a single leading slash (/Widgets).
Related packages
- Barnark — the core library and template catalogue.
- Barnark CLI — the same operations from a terminal.
- Barncept GUI and Barnspec GUI — sibling browser tools.
More docs
Internals · History · Known issues
License
Proprietary. See LICENSE. Copyright (c) Roger Barnfather.