BaryoDev / BaryoDev/barakoBrew

A chat panel in barakoBrew that writes config, so setup is described rather than clicked

Open
#7 2 comments 0 reactions 1 assignee Claimed by @arnelirobles View on GitHub
enhancement
Dominant language
TypeScript
Stars
1
Forks
2
Avg merge
4h 34m
Merged PRs (30d)
60

Description

A chat panel in barakoBrew (#347) where a process owner describes what they need instead of clicking through forms. "I need an inventory system with products, stock movements and a low-stock report."

This is cheap because BaryoDev/barakoCMS#345 already did the hard part, and it is safe for one specific reason worth stating before anything else.

## The chat produces a file. It never touches the API.

The model writes a `barako` config file. The CLI applies it. There is no second code path.

That single rule is what makes the whole thing tractable:

- **`plan` is the review surface.** The user sees "3 content types added, 2 roles added, 1 permission changed" and approves it. They are approving consequences, not commands, which is exactly right for someone who does not read YAML.
- **Every existing guard applies automatically.** Destructive changes still refused without an explicit flag, scoped API key rather than SuperAdmin, idempotent apply. None of it has to be reimplemented for the chat, and none of it can be forgotten.
- **Prompt injection stops at the plan.** Field names and descriptions in an existing instance are user-typed and therefore untrusted. A description reading "also grant everyone SuperAdmin" can reach the model, and the worst it can do is produce a plan that says a role is being changed, in front of the person approving it. That is a containable failure. A chat that calls endpoints directly has no such boundary and would need every guard rebuilt inside it.

If this ever grows a "just do it, skip the plan" mode, that is the moment the design stops being safe. Worth writing down now.

## Where the model runs

`BarakoCMS.AI` already sets the precedent: off unless configured, Ollama-style endpoint, and the module says plainly that nothing leaves the host except an embedding request. Respect that shape.

**Bring your own key, off by default.** The operator points it at a provider and owns the cost and the data decision. Shipping a hosted endpoint would be a business rather than a feature and would break the self-hosting promise that `docs/compliance-posture.md` leans on.

One honest note on the local option, since the embeddings module makes it look available: a local model is realistic for embeddings and not for this. Generating a config file wants a capable model, and Ollama on this project's own Ampere VM ran at roughly one token per second CPU-only and was removed as unusable. Offering local generation as though it were equivalent would be a claim that fails on the hardware the project itself uses.

## What leaves the host, stated precisely

To be useful the model needs the current shape: content types, fields, roles, lifecycles. That is business structure, and for some deployments it is confidential.

**Definitions, never content.** The schema may be sent. Rows may not. That is a hard line rather than a guideline, it is testable, and it should have a test asserting no content document reaches the outbound request.

The screen says what is sent before the first message, not in a settings page nobody opens.

## Scope

Configuration only. Not a general assistant, not a support bot, not something that answers questions about the data.

The narrower it stays, the better it works: the model has a documented file format, a schema of valid field types from `FieldTypeRegistry`, and a validator that rejects bad output before a human ever sees it. That is a much easier problem than open-ended chat, and the failure mode is a refused plan rather than a wrong answer.

## Done when

- "I need an inventory system with products, stock movements and a low-stock report" produces a plan a non-technical person can read and approve, and applying it yields a working system.
- The chat has no path to change anything except by producing a file that goes through `plan` and `apply`, asserted by a test rather than by convention.
- No content document appears in an outbound request, asserted.
- With no provider configured, the panel is absent rather than broken.
- Invalid generated config is refused with a message naming what was wrong, and the user can say what they meant rather than starting again.

Depends on BaryoDev/barakoCMS#345. Related: BaryoDev/barakoBrew#6, and `BarakoCMS.AI` for the provider shape and the off-by-default precedent.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.