feat(templates): agent-provided data schema (no human note) + paste-able reuse prompt#184
Merged
Conversation
…"note"
User feedback: don't make the human write a "Note for your agent" when saving a
template. Instead, a board arrives already decomposed — the agent attaches a data
SCHEMA (the data fields + descriptions) when it pushes — and "save as template"
captures that automatically.
- core: `TemplateSchema` type + `validateTemplateSchema` (optional, lightweight:
{ summary?, fields:[{name, description, type?, example?}] }).
- server: `asPayload` carries an optional `schema`; the push handler 400s a
malformed one; "save template" captures `board.schema` (not a request field).
- state/template-store: `Payload.schema`, `Template.schema`; `create()` takes the
schema (drops the `hints` param); legacy `hints` still read for back-compat.
- CLI: `push --schema <file>`; `template get` prints the SCHEMA (fields) before
the example; `save` no longer takes `--hints`.
- UI: the Save-as-template popover removes the note textarea entirely — it shows
"✓ Data schema captured (N fields)" (or a hint to push with --schema), and the
library row's action is "Schema" (renders the fields, or a legacy note).
- docs: SKILL + diagram-remote — attach `--schema` at push; reuse = read schema,
author a conforming diagram, push. (Removes the WHAT/DATA-SLOTS human scaffold.)
Backward compatible: schema optional everywhere; legacy templates + plain pushes
still work. Reuse stays agent-authored (no server-side merge).
Tests: core validateTemplateSchema; store/server carry + round-trip schema +
read legacy hints; CLI save(no hints)/get(schema); template.e2e (no note field,
schema captured + returned). viewer 458, CLI 172, e2e template 16/16.
Answer two user questions in the UI itself: - "how do I make an agent reuse this?" — after saving, the result now shows a ready-to-paste instruction (copied to the clipboard): "Reuse termchart template <id> (a <type>): run `termchart template get <id>` … build a new diagram with my data that fits the schema and push it." Each library row gets a "Copy reuse prompt" action with the same. - "where's my library?" — the Saved-templates list (in the Templates popover) now has a sub-label: "your library — paste a template's reuse prompt to an agent to rebuild it with new data." e2e: assert the paste-able prompt on save + the row affordance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two pieces of user feedback:
What
Schema on push (no human note):
core:TemplateSchema+validateTemplateSchema— lightweight, optional:{ summary?, fields:[{name, description, type?, example?}] }.server:asPayloadcarries optionalschema; push 400s a malformed one; save capturesboard.schema(not a request field).state/template-store:Payload.schema,Template.schema;create()takes the schema (dropshints); legacyhintsstill read.CLI:push --schema <file>;template getprints the SCHEMA (fields) before the example;savedrops--hints.UI (the Templates popover):
--schema).<id>(a<type>): runtermchart template get <id>… build a new diagram with my data that fits the schema and push it."Docs: SKILL + diagram-remote — attach
--schemaat push; reuse = read schema, author a conforming diagram, push.Compatibility
Schema is optional everywhere; legacy templates (free-text
hints) and plain pushes still work. Reuse stays agent-authored (no server-side merge).Verification
validateTemplateSchema; store/server round-trip schema + read legacy hints; CLI save(no hints)/get(schema)).Rebased on #183 (responsive). Supersedes the note flow from #182.