Files
rdbms-playground/website/src/grammars/rdbms.mjs
T
claude@clouddev1 6b4c4dcea4
ci / gate (push) Failing after 35s
ci / manifests (push) Successful in 3s
website / deploy (push) Successful in 35s
feat(types)!: drop the blob column type (ADR-0005 Amendment 2)
blob was a dead-end: declarable but never fillable (no literal in either
mode, seed-unsupported), so a blob column could only ever hold NULL. Remove
Type::Blob + Value/CellValue::Blob + the base64 CSV path + the grammar slot
+ completion/render/type-change/seed handling + the binder refusal (whose
message also carried a user-facing "DSL" copy-rule bug). The vocabulary is
now nine types; base64 stays (clipboard OSC-52).

Backward compat is the ADR-0015 migration framework's first real use: a
v1->v2 format bump (CURRENT_SCHEMA_VERSION across serializer/parser/skeleton)
with a migrator that rewrites `type: blob` -> `type: text`, and a forced .db
rebuild from the migrated text when a blob column was actually converted
(the stale .db keeps a STRICT BLOB engine column). Conversion to text is
non-destructive and CSV-free. Covered by a full-stack integration test and a
Tier-4 PTY test that opens a real legacy v1-blob project.

Also sweeps the nine-type vocabulary through CLAUDE.md, requirements.md, the
website (type reference, seed doc, highlight grammar), and the ADR-0030/0033/
0035 cross-references; CHANGELOG Removed entry; handoff-79.

BREAKING CHANGE: the `blob` column type is removed. Existing projects that
declared a blob column are migrated on first open (the column becomes text;
the original project.yaml is kept as a .v1.bak).
2026-06-22 21:25:38 +00:00

77 lines
2.5 KiB
JavaScript

// Minimal Shiki / TextMate grammar for the RDBMS Playground *simple-mode*
// command language, so docs code blocks fenced as ```rdbms get syntax
// highlighting. Advanced-mode examples use the built-in `sql` grammar.
//
// Keyword/clause vocabulary is taken from the in-app help/usage strings
// (`src/friendly/strings/en-US.yaml`) and the command grammar. Matching is
// case-insensitive (keywords are case-insensitive in the app; identifiers
// are case-preserving and intentionally left unscoped so they read as plain
// text against the coloured keywords).
//
// Two language ids share one grammar:
// - `rdbms` — real commands; gets a decorative `> ` prompt via CSS.
// - `rdbms-syntax` — abstract syntax templates (with <placeholders>); same
// highlighting, but a distinct `data-language` so the
// prompt (scoped to data-language='rdbms') is NOT added.
const patterns = [
{ include: '#comment' },
{ include: '#string' },
{ include: '#flag' },
{ include: '#number' },
{ include: '#constant' },
{ include: '#type' },
{ include: '#keyword' },
];
const repository = {
comment: {
match: '#.*$',
name: 'comment.line.number-sign.rdbms',
},
string: {
name: 'string.quoted.single.rdbms',
begin: "'",
end: "'",
patterns: [{ match: "''", name: 'constant.character.escape.rdbms' }],
},
flag: {
match: '--[A-Za-z][A-Za-z-]*',
name: 'keyword.operator.flag.rdbms',
},
number: {
match: '\\b[0-9]+(?:\\.[0-9]+)?\\b',
name: 'constant.numeric.rdbms',
},
constant: {
match: '(?i)\\b(true|false|null)\\b',
name: 'constant.language.rdbms',
},
type: {
match: '(?i)\\b(text|int|real|decimal|bool|date|datetime|serial|shortid)\\b',
name: 'support.type.rdbms',
},
keyword: {
match:
'(?i)\\b(create|table|tables|drop|add|column|with|pk|to|from|into|values|insert|update|seed|set|where|delete|show|data|rename|change|alter|relationship|relationships|index|indexes|on|as|references|constraint|not|unique|default|check|primary|key|cascade|restrict|and|or|in|between|like|is|explain|replay|undo|redo|save|new|load|rebuild|export|import|copy|mode|help|hint|quit|messages|all|last|types|simple|advanced)\\b',
name: 'keyword.control.rdbms',
},
};
/** Real simple-mode commands — gets the `> ` prompt (via CSS). */
export default {
name: 'rdbms',
scopeName: 'source.rdbms',
aliases: ['rdbms-playground'],
patterns,
repository,
};
/** Abstract syntax templates — same highlighting, no prompt. */
export const rdbmsSyntax = {
name: 'rdbms-syntax',
scopeName: 'source.rdbms-syntax',
patterns,
repository,
};