Search by

rmb32 / barnark-gui

rogerbarnfather

A web GUI for cloning a template into a project and making its folder, creating what the template offers, and viewing conformance checks

Package info

bitbucket.org/rmb32/barnark-gui/

Homepage

pkg:composer/rmb32/barnark-gui

Statistics

Installs: 132

Dependents: 2

Suggesters: 1

v4.0.0 2026-10-29 12:06 UTC

This package is auto-updated.

Last update: 2026-10-29 12:07:30 UTC


README

Part of Barn.

A browser UI for Barnark: clone a template into a project under a name you give and make its folder, browse the folder's tree, fill the slots its template offers, run conformance checks, and keep templates of your own.

The Barnark GUI: three tracked folders, each following a template of its own, and a new project's tree with Create New Aggregate and Create New Context buttons where its template allows them.

The side panel has two headings. Project holds the project's one bound folder and its template. Templates holds your own templates first, then the shipped ones, marked Shipped, which are read-only. Click a shipped template to see its tree; click one of your own to see its History.

Clone into the project makes the project's template and its folder together. You pick a template, and beside the choice is the shape a folder following it takes: the folders every clone has, ‹named›/ placeholders for the member types you add to yourself, and the members a template of your own already has. Point at any part to see what it is for. You also name the project's template: it is a copy of the one you picked, and changing one never changes the other. A project has one template, so once it has one, cloning is turned off.

Copy makes a new template of your own from any template, shipped, yours or the bound one, members included. Delete removes one of your own templates, and only git brings it back. The project's template and its folder have no Remove: ending a template's life is not built yet.

In Browse, the tree shows a folder's folders (never its files), and wherever the template has a slot for a folder you name, it 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 new folder 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).

A member is part of the template, so adding or deleting one makes a new revision, with a reason Barnark writes, such as "Added Context/Billing.". Before a member goes, the delete dialog says so. The History tab lists the template's revisions and shows each as a read-only tree of its fixed folders, member types and members.

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 project at its root (the nearest parent directory holding a .barnark/ folder, or Barnark 5's barnark-workspace.json, which it then refuses, giving its path) and picks the next free port if the default is taken. Inside a barn (a project whose root holds .barn/barn.json) it serves the barn's root, and keeps Barnark's records in .barn/barnark/.

Or serve it by hand:

BARNARK_GUI_PROJECT_ROOT=/path/to/project php -S localhost:8080 -t public

Open http://localhost:8080. BARNARK_GUI_PROJECT_ROOT defaults to the current directory; folders you add are tracked in its .barnark/tracked-folders.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.

Serving it from your own front controller

BarnarkGuiApp::serve($mountPath, $projectRoot) serves the GUI under a path prefix, for example /architecture, from any PHP router script:

Rmb32\BarnarkGui\BarnarkGuiApp::serve('/architecture', '/path/to/project');

The JSON API below then lives under the prefix too (/architecture/api/...).

JSON API

MethodPathBehaviour
GET/api/foldersList the bound folder, with its template
POST/api/foldersClone a template into the project and make its folder ({ name, baseDir, from, template }, where template names the copy); a refused template name is a 400
GET/api/folders/{path}/tree?path=Browse a folder's tree, with the offers (slots that can be filled) at each level and directory
DELETE/api/folders/{path}/tree?path=Delete a member or a folder the template doesn't know
POST/api/folders/{path}/membersAdd a named member ({ collectionPath, memberType, name })
GET/api/folders/{path}/checkRun a conformance check against the folder's template
GET/api/templatesList every template: the bound one, your own and the shipped ones, each with its description, folder and shipped
POST/api/templatesCopy a template into a new one of your own ({ from, name })
DELETE/api/templates/{name}Delete one of your own; a shipped one is a 422
GET/api/templates/{name}/shapeA template's tree: nested nodes (fixed, memberType or member), each with its meaning
GET/api/templates/{name}/revisionsList the template's revisions, with reasons, timestamps and the current marker
GET/api/templates/{name}/revisions/currentRead the current template tree
GET/api/templates/{name}/revisions/{revisionId}Read a historical template tree (read-only)

The JSON API is the bundled frontend's contract with its server, and changes with the frontend in any release. A {path} or {name} containing / must be URL-encoded as %2F. Folder paths are canonical: rooted, with a single leading slash (/Widgets).

Related packages

More docs

Internals · History · Known issues

License

Proprietary. See LICENSE. Copyright (c) Roger Barnfather.