Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 4.17 KB

AGENTS.md

File metadata and controls

39 lines (33 loc) · 4.17 KB

Agent Instructions

Ecosystem rules — read before any change

docs/PLAN.md is the spec: no design judgment; anything unclear is a question in the PR, not a guess.

  • Public API: typed (no any/interface{}), explicit, sequential, minimal; no generics ([T any]) or reflect without benchmarked allocation/performance justification and owner approval; never export a symbol only a test uses.
  • One intent, one path: the old path is deleted in the same change. No silent fallback, TODO, commented code or stub.
  • Fail at compile time, else a loud diagnostic — never silently. Zero values deny.
  • A defect in a dependency is reported, never wrapped or patched here.
  • No string literals in logic: named constants. The same logic never lives in two repos: import the package the plan names; if you find an existing one the plan does not name that already does what you are about to write, say so in the PR instead of writing it.
  • cmd/*/main.go: parse flags, inject, print/exit only. stdout = data, stderr = logs, exit codes are the contract.
  • WASM code: webtyp/fmt, webtyp/time, webtyp/json instead of stdlib (imported without alias as fmt, time, json — never tinytime); no map; dom.Element embedded by value.
  • css.go, svg.go, js.go, html.go carry //go:build !wasm; no ssr.go, no front.go.
  • Build tags: wasm/!wasm only when the API does not exist on that platform; browser/!browser when an app's file belongs to another binary; a library carries no destination tag (the linker drops what a binary never calls). One main per folder, no destination tag: web/browser/main.go → web/public/browser.wasm, web/server/main.go → web/server/server, web/edge/main.go → web/edge/edge.wasm.
  • Code and keys in English; UI text is lang.Text, translations live in lang.json. Comments and docs: English in webtyp/*; in veltylabs/* every README, docs/* file, diagram and code comment is in Spanish, written for a reader with little technical background, and each exported symbol's comment shows a short usage example.
  • A translation key is reused, never duplicated as a near-identical phrase ("not a valid integer" + "not a valid decimal number" repeats "not a valid" three ways instead of composing it once) — every library ships to WASM/TinyGo, so each unreused phrase is dictionary rows AND binary bytes, in every consumer, forever. A token that doesn't need translating (a kind/type name like int) is passed as data (a variable), never as a string literal — a literal becomes a dictionary key whether or not it needed one.
  • Tests cover behaviour and domain rules, never the look (CSS, colours, markup order, class strings). In tests/ (external package), real stack with fakes only at the edge; run gotest.
  • Docs (README.md, docs/*) updated with the API; permanent docs never link docs/PLAN.md.
  • Before the PR: git diff --stat main lists every file of the plan's stages, and nothing the plan did not order is deleted.

This repo

Coding Standards

  • No repeated string literals: Do not repeat long string literals or character blocks. Use constants or package-level variables instead to improve maintainability.
  • No standard library for core functions: Always use webtyp equivalents instead of the Go standard library where available:
    • webtyp.com/fmt instead of fmt
    • webtyp.com/json instead of encoding/json
    • webtyp.com/model
    • webtyp.com/orm
    • webtyp.com/mcp
  • JSON in tests: For JSON operations in tests, use only webtyp/json.

MCP and sqlmcp specifics

  • JSON Schema: Generating JSON Schema is NOT the responsibility of sqlmcp. This is handled by webtyp/mcp via Tool.Args (which must implement model.Fielder).
  • No JSON Schema logic: Do not include encodeSchema functions or manual InputSchema JSON strings in tool definitions.
  • SQL Validation: When defining models for SQL input, use model.Text() and provide an explicit Permitted whitelist that includes necessary SQL symbols (quotes, operators, etc.), as the default Text kind blocks them for XSS protection.