Files
ask-form/examples/examples.go
gabrielvidalandClaude Opus 5.5 d880ab257f feat(form): YAML form files — sections keyed by title, fields by key, options by value
`ask-form create form.yaml` takes the whole form in one file: title,
description, lang and sections (each a page, keyed by its title), with
fields keyed by their key, options by their value and a table's columns by
their key, in the order written. A section takes an intro (markdown under
its title) and a showIf for the whole page. Plain lists of option texts and
the old lists (`key:` fields, `value:` options) are read too, and the flat
JSON field array still works byte for byte (--fields-file spec.json).

- internal/form/yaml.go: a strict YAML 1.2 subset reader, stdlib only.
  Ordered mappings (*form.Map), block and flow collections, | and >
  scalars, quotes, comments; refuses anchors, tags, ? keys, several
  documents, tab indentation and duplicate keys, with the line. Only
  true/false are booleans; a number keeps its text (json.Number).
- internal/form/doc.go: ParseDoc compiles a form file (YAML, or JSON of the
  same shape) into the flat field array: section title -> group, intro ->
  a markdown block, section showIf AND-ed into its fields'. The CLI does it
  before POST /v1/forms, so server, relay, store and MCP are unchanged and
  a new CLI works with an older serve.
- examples: spec.yaml + spec.fr.yaml replace the JSON specs (converted,
  each checked to normalise to the same fields); /spec.json still answers
  with the form compiled to JSON.
- SKILL.md, the claude.ai sandbox skill, agent-install, README and
  CLAUDE.md teach the YAML form file; a test keeps SKILL.md's YAML valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 11:52:10 +01:00

11 lines
376 B
Go

// Package examples embeds the demo forms shown at /examples: one directory
// per example, a spec.yaml (the form file `ask-form create` takes — title,
// description, sections — plus an example's summary, order and multi), its
// French twin spec.fr.yaml, and the images it references as {{asset:<file>}}.
package examples
import "embed"
//go:embed */*
var FS embed.FS