@shing.wong/sure-factor 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/skills/sure-factor/SKILL.md +167 -0
- package/README.md +25 -0
- package/dist/match.d.ts +14 -1
- package/dist/match.d.ts.map +1 -1
- package/dist/match.js +43 -4
- package/dist/match.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sure-factor
|
|
3
|
+
description: Use when generating or changing UI from a database schema with @shing.wong/sure-factor — adding a form or table view, matching a column to a type, adding a field or validation rule, or regenerating generated components. Covers scoping the schema, the catalog, the three-tier presets, and why you edit the spec and regenerate rather than editing generated code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# sure-factor
|
|
7
|
+
|
|
8
|
+
Turns a database schema into UI: it matches columns to types in a catalog, then
|
|
9
|
+
generates forms, tables and stores. This skill is the non-obvious part — what to
|
|
10
|
+
read, what to skip, and what not to edit.
|
|
11
|
+
|
|
12
|
+
## The pipeline
|
|
13
|
+
|
|
14
|
+
Five composable calls. Each step's output is the next step's input.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {
|
|
18
|
+
introspectSchemaFromDdl, // DDL string -> SchemaInfo
|
|
19
|
+
loadAllTypesSync, // -> CatalogType[] (the catalog)
|
|
20
|
+
matchColumnToTypeSync, // ColumnInfo -> TypeMatchResult | null
|
|
21
|
+
generateClientComponent, // SchemaInfo -> { module, fields, cssClasses }
|
|
22
|
+
generateStore, // SchemaInfo -> store module
|
|
23
|
+
} from "@shing.wong/sure-factor"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`introspectSchema` is the same thing against a live database. Everything else is
|
|
27
|
+
synchronous and needs no connection.
|
|
28
|
+
|
|
29
|
+
## Scope the schema before you introspect it
|
|
30
|
+
|
|
31
|
+
`introspectSchemaFromDdl` takes a **DDL string**, not a database handle. Pass the
|
|
32
|
+
one `CREATE TABLE` you care about rather than the whole file.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// Don't: 25 tables when you need one. 5,043 tokens on the management schema.
|
|
36
|
+
const all = introspectSchemaFromDdl(allDdl)
|
|
37
|
+
|
|
38
|
+
// Do: slice first. 282 tokens, identical columns.
|
|
39
|
+
const ddl = /CREATE TABLE IF NOT EXISTS tickets \([^;]*\);/i.exec(allDdl)![0]
|
|
40
|
+
const schema = introspectSchemaFromDdl(ddl)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Measured on `positronic/management` (25 tables): 5,043 → 282 tokens, a 94%
|
|
44
|
+
reduction. This is a caller-side slice, not a library option — there is no
|
|
45
|
+
filter parameter and you do not need one.
|
|
46
|
+
|
|
47
|
+
The pattern is literal, so keep the `IF NOT EXISTS` when your DDL has it — a
|
|
48
|
+
migration-style schema will not match `CREATE TABLE tickets` on its own. Either
|
|
49
|
+
form parses; it is the regex that has to match your file. If it returns `null`,
|
|
50
|
+
your DDL spells the clause differently than the pattern does.
|
|
51
|
+
|
|
52
|
+
## Take columns out of the schema, never build one
|
|
53
|
+
|
|
54
|
+
`matchColumnToTypeSync` takes a column name, or a `ColumnInfo`. Taking it from
|
|
55
|
+
the schema is the right default, because the `dataType` is what lets the catalog
|
|
56
|
+
apply its `data_type` rules.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
// Fine — name only, matched on the name rules.
|
|
60
|
+
matchColumnToTypeSync("email", types)!.type.name // "email"
|
|
61
|
+
|
|
62
|
+
// Better — carries dataType, so data_type rules can also fire.
|
|
63
|
+
const col = schema.tables[0].columns.find(c => c.columnName === "subject")!
|
|
64
|
+
matchColumnToTypeSync(col, types) // -> text (no type claims it)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
A name alone will not match a type whose only rule is on `data_type`; the result
|
|
68
|
+
is `null` rather than a guess. If you expect a match and get `null`, you passed a
|
|
69
|
+
bare string for a column that needs its data type.
|
|
70
|
+
|
|
71
|
+
Do not construct a partial `ColumnInfo` by hand to get the data type — the rules
|
|
72
|
+
read `maxLength` too, and a hand-built object is a bug waiting to happen. Take the
|
|
73
|
+
column from the schema.
|
|
74
|
+
|
|
75
|
+
`null` also means "no type claims this column", which is normal: `subject`,
|
|
76
|
+
`status` and `quantity` have no catalog type and fall back to `text`. To give a
|
|
77
|
+
column a type, rename it to something the catalog recognises, or add a type to
|
|
78
|
+
`catalog/types/`.
|
|
79
|
+
|
|
80
|
+
## Read the catalog, do not dump it
|
|
81
|
+
|
|
82
|
+
`loadAllTypesSync()` returns all 16 types — 7,532 tokens as JSON. The catalog is
|
|
83
|
+
YAML on disk, one type per file, and one type is the unit you want.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
cat node_modules/@shing.wong/sure-factor/catalog/types/email.yaml # 2.3 KB
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Read the file for the type you care about. Use the loader when you need to match
|
|
90
|
+
many columns at once.
|
|
91
|
+
|
|
92
|
+
A type carries `match` (how a column is recognised), `validation`, `sanitize`
|
|
93
|
+
(input and output), `hints` per locale, and `tiers`.
|
|
94
|
+
|
|
95
|
+
## Pick a tier, and know what it costs
|
|
96
|
+
|
|
97
|
+
`vibe`, `prototype`, `production` are presets, not quality settings. They trade
|
|
98
|
+
validation strictness for less code.
|
|
99
|
+
|
|
100
|
+
| tier | email type size | what you get |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `vibe` | 147 B | a loose regex |
|
|
103
|
+
| `prototype` | 414 B | a real regex, no extras |
|
|
104
|
+
| `production` | 499 B | full recipe plus sanitisation |
|
|
105
|
+
|
|
106
|
+
Use `vibe` for a throwaway, `production` for anything that stores a value. The
|
|
107
|
+
default is `production`; pass the tier explicitly when you mean something else.
|
|
108
|
+
|
|
109
|
+
## Edit the spec, regenerate; never edit generated code
|
|
110
|
+
|
|
111
|
+
Generated modules are large because they are complete: a 7-field form is 16,856
|
|
112
|
+
chars, and each extra field adds roughly 700. The 25-table module is ~100,000
|
|
113
|
+
chars — **16,856 of that is fixed boilerplate that does not change when a field
|
|
114
|
+
does.**
|
|
115
|
+
|
|
116
|
+
To change one field, change the input and regenerate. Do not read a generated
|
|
117
|
+
module to find the field, and do not edit the module to change the field.
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
// Change the source of truth, then regenerate.
|
|
121
|
+
const result = generateClientComponent(schema, {
|
|
122
|
+
tier: "production",
|
|
123
|
+
component: "form", // or "data-table"
|
|
124
|
+
exportName: "TicketsForm",
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`component` picks a template from `catalog/components/`: `form`, `data-table`,
|
|
129
|
+
`form-modal`, `crud-resource`, `search-filter`, `dialog`, and the auth ones.
|
|
130
|
+
A `data-table` component renders a `<table>`, not a form.
|
|
131
|
+
|
|
132
|
+
The result carries `module` (TypeScript source), `fields`, and `cssClasses`.
|
|
133
|
+
The class names are a contract between the generator and `sure-ui` — pass them
|
|
134
|
+
through, do not hardcode `sure-form__field` in a consumer.
|
|
135
|
+
|
|
136
|
+
## Check the output parses, then check what it does
|
|
137
|
+
|
|
138
|
+
`tsc --noEmit` on the emitted module. It is TypeScript and declares its own
|
|
139
|
+
spec interfaces, so a `new Function` probe fails on the interfaces rather than
|
|
140
|
+
on a real defect.
|
|
141
|
+
|
|
142
|
+
Then exercise the functions the module exports — `validateForm`, `sanitizeForm`
|
|
143
|
+
if it is a form. Reading the source tells you a function exists; calling it
|
|
144
|
+
tells you it works. A generated sanitiser that compiles and does nothing is
|
|
145
|
+
exactly the defect worth testing for.
|
|
146
|
+
|
|
147
|
+
Commit the generated module. It is the artefact the application builds, and a
|
|
148
|
+
suite that compiles a committed module without regenerating can be green
|
|
149
|
+
against a module no generator would produce.
|
|
150
|
+
|
|
151
|
+
## What this skill does not cover
|
|
152
|
+
|
|
153
|
+
- **Server targets.** `generateForTier` emits Handlebars + htmx + express.
|
|
154
|
+
`generateClientComponent` emits plain DOM with no framework or dependencies.
|
|
155
|
+
Pick by what the application is.
|
|
156
|
+
- **Runtime UI styling.** `sure-ui` owns the class names; a consumer should not
|
|
157
|
+
restyle them, and a hardcoded colour in a consumer's stylesheet wins over the
|
|
158
|
+
theme and pins the page to one palette.
|
|
159
|
+
- **Sanitisation is not a security boundary.** It is a UX convenience. The
|
|
160
|
+
server re-validates every argument; treat the client copy as presentation.
|
|
161
|
+
|
|
162
|
+
## Where the machine-readable version lives
|
|
163
|
+
|
|
164
|
+
`tsc` emits `.d.ts` for every export into `dist/` on each build — signatures,
|
|
165
|
+
argument shapes and tier unions, always current. Read those rather than trusting
|
|
166
|
+
this file for shapes. What no declaration carries is *which* call to make, which
|
|
167
|
+
is what the rest of this document is for.
|
package/README.md
CHANGED
|
@@ -331,6 +331,31 @@ const formatted = await formatGeneratedOutput(output)
|
|
|
331
331
|
| Audio | `catalog/assets/audio/` | Error bell, success chime, voice help (JS audio generators) |
|
|
332
332
|
| Themes | `catalog/assets/themes/{nord,forest,dracula}.css` | Production CSS themes |
|
|
333
333
|
| Lookup data | `catalog/assets/data/{icd10-codes,us-zip-codes}.json` | Validation datasets |
|
|
334
|
+
| Agent skill | `.opencode/skills/sure-factor/SKILL.md` | How an agent should drive this package |
|
|
335
|
+
|
|
336
|
+
## Agent skill
|
|
337
|
+
|
|
338
|
+
The package ships an [OpenCode](https://opencode.ai) skill covering the parts of
|
|
339
|
+
this API that are not obvious from the signatures — scoping the DDL before
|
|
340
|
+
introspecting it, taking columns out of the schema rather than constructing
|
|
341
|
+
them, reading the catalog YAML instead of dumping the loader, and editing the
|
|
342
|
+
spec rather than the generated output.
|
|
343
|
+
|
|
344
|
+
Point OpenCode at it from your `opencode.json`:
|
|
345
|
+
|
|
346
|
+
```jsonc
|
|
347
|
+
{
|
|
348
|
+
"$schema": "https://opencode.ai/config.json",
|
|
349
|
+
"skills": ["./node_modules/@shing.wong/sure-factor/.opencode/skills"]
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Only the skill's name and description are loaded up front; the body is read when
|
|
354
|
+
the agent decides the skill applies. Its claims are executed by this package's
|
|
355
|
+
test suite, so it cannot drift from the code without a test failing.
|
|
356
|
+
|
|
357
|
+
It is plain Markdown — copy it anywhere you prefer to keep instructions, or
|
|
358
|
+
point the `skills` array at any local directory or HTTP catalog.
|
|
334
359
|
|
|
335
360
|
## Related Projects
|
|
336
361
|
|
package/dist/match.d.ts
CHANGED
|
@@ -6,5 +6,18 @@ export interface TypeMatchResult {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function matchColumnToType(column: ColumnInfo, tier?: 'vibe' | 'prototype' | 'production'): Promise<TypeMatchResult | null>;
|
|
8
8
|
export declare function loadAllTypesSync(): CatalogType[];
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Find the catalog type that best describes a column.
|
|
11
|
+
*
|
|
12
|
+
* `column` accepts a bare name as a convenience, because "which type is this
|
|
13
|
+
* column?" is the whole question this answers and passing a string is the
|
|
14
|
+
* obvious thing to try. A string carries no data type, so it is matched on name
|
|
15
|
+
* alone — if the catalog has a rule keyed on `data_type` and the caller's column
|
|
16
|
+
* name does not identify a type on its own, the answer is `null` rather than a
|
|
17
|
+
* guess. Pass a `ColumnInfo` when you have one.
|
|
18
|
+
*
|
|
19
|
+
* Throws a named error rather than failing inside the matcher: a `TypeError` on
|
|
20
|
+
* `column.columnName` told an agent nothing about what was expected.
|
|
21
|
+
*/
|
|
22
|
+
export declare function matchColumnToTypeSync(column: ColumnInfo | string, types: CatalogType[], tier?: 'vibe' | 'prototype' | 'production'): TypeMatchResult | null;
|
|
10
23
|
//# sourceMappingURL=match.d.ts.map
|
package/dist/match.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../src/match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB;AA0BD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,MAAM,GAAG,WAAW,GAAG,YAA2B,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAyDrJ;AAED,wBAAgB,gBAAgB,IAAI,WAAW,EAAE,CAWhD;AAED,wBAAgB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../src/match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAG7C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB;AA0BD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,GAAE,MAAM,GAAG,WAAW,GAAG,YAA2B,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAyDrJ;AAED,wBAAgB,gBAAgB,IAAI,WAAW,EAAE,CAWhD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,GAAG,MAAM,EAC3B,KAAK,EAAE,WAAW,EAAE,EACpB,IAAI,GAAE,MAAM,GAAG,WAAW,GAAG,YAA2B,GACvD,eAAe,GAAG,IAAI,CAsFxB"}
|
package/dist/match.js
CHANGED
|
@@ -89,7 +89,43 @@ export function loadAllTypesSync() {
|
|
|
89
89
|
}
|
|
90
90
|
return types;
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Find the catalog type that best describes a column.
|
|
94
|
+
*
|
|
95
|
+
* `column` accepts a bare name as a convenience, because "which type is this
|
|
96
|
+
* column?" is the whole question this answers and passing a string is the
|
|
97
|
+
* obvious thing to try. A string carries no data type, so it is matched on name
|
|
98
|
+
* alone — if the catalog has a rule keyed on `data_type` and the caller's column
|
|
99
|
+
* name does not identify a type on its own, the answer is `null` rather than a
|
|
100
|
+
* guess. Pass a `ColumnInfo` when you have one.
|
|
101
|
+
*
|
|
102
|
+
* Throws a named error rather than failing inside the matcher: a `TypeError` on
|
|
103
|
+
* `column.columnName` told an agent nothing about what was expected.
|
|
104
|
+
*/
|
|
92
105
|
export function matchColumnToTypeSync(column, types, tier = 'production') {
|
|
106
|
+
let info = typeof column === 'string'
|
|
107
|
+
? {
|
|
108
|
+
columnName: column,
|
|
109
|
+
// No data type is available from a bare name, and an empty one is how
|
|
110
|
+
// the data_type rules below are told to stand down.
|
|
111
|
+
dataType: '',
|
|
112
|
+
isNullable: true,
|
|
113
|
+
maxLength: null,
|
|
114
|
+
defaultValue: null,
|
|
115
|
+
isPrimaryKey: false,
|
|
116
|
+
foreignKey: null,
|
|
117
|
+
}
|
|
118
|
+
: column;
|
|
119
|
+
if (!info || typeof info.columnName !== 'string' || info.columnName === '') {
|
|
120
|
+
throw new TypeError('matchColumnToTypeSync needs a column: a name, or a ColumnInfo from the schema. ' +
|
|
121
|
+
'Take it from the schema rather than building one: ' +
|
|
122
|
+
"schema.tables[0].columns.find(c => c.columnName === 'email').");
|
|
123
|
+
}
|
|
124
|
+
// A partial ColumnInfo is a plausible thing to construct by hand, and the
|
|
125
|
+
// rules below read dataType and maxLength without checking. Fill the gaps
|
|
126
|
+
// rather than failing on `undefined.toLowerCase()` deep in a scoring loop.
|
|
127
|
+
if (typeof info.dataType !== 'string')
|
|
128
|
+
info = { ...info, dataType: '' };
|
|
93
129
|
const scored = [];
|
|
94
130
|
for (const type of types) {
|
|
95
131
|
let score = 0;
|
|
@@ -100,14 +136,17 @@ export function matchColumnToTypeSync(column, types, tier = 'production') {
|
|
|
100
136
|
const likeMatch = pattern.match(/LIKE\s+'%([^']+)%'/i);
|
|
101
137
|
if (likeMatch) {
|
|
102
138
|
const keyword = likeMatch[1].toLowerCase();
|
|
103
|
-
if (
|
|
139
|
+
if (info.columnName.toLowerCase().includes(keyword)) {
|
|
104
140
|
score += keyword.length * 3;
|
|
105
141
|
}
|
|
106
142
|
}
|
|
107
143
|
const typeMatch = pattern.match(/data_type\s+IN\s+\(([^)]+)\)/i);
|
|
108
144
|
if (typeMatch && !likeMatch) {
|
|
109
145
|
const matchedTypes = typeMatch[1].split(',').map(s => s.trim().replace(/'/g, '').toLowerCase());
|
|
110
|
-
|
|
146
|
+
// A bare string carries no data type, so a data_type rule must not fire
|
|
147
|
+
// on it — otherwise every type with such a rule would match whatever
|
|
148
|
+
// name the caller passed.
|
|
149
|
+
if (info.dataType !== '' && matchedTypes.includes(info.dataType.toLowerCase())) {
|
|
111
150
|
score += 3;
|
|
112
151
|
}
|
|
113
152
|
}
|
|
@@ -117,8 +156,8 @@ export function matchColumnToTypeSync(column, types, tier = 'production') {
|
|
|
117
156
|
// short enough to fit: `plan VARCHAR(40)` matched `email` (maxLength 254)
|
|
118
157
|
// even though email's rule requires an email-ish name, and five types tied
|
|
119
158
|
// on that bonus so the winner depended on array order.
|
|
120
|
-
if (score > 0 && type.match?.maxLength != null && type.match.maxLength > 0 &&
|
|
121
|
-
if (
|
|
159
|
+
if (score > 0 && type.match?.maxLength != null && type.match.maxLength > 0 && info.maxLength != null) {
|
|
160
|
+
if (info.maxLength <= type.match.maxLength) {
|
|
122
161
|
score += 5;
|
|
123
162
|
}
|
|
124
163
|
}
|
package/dist/match.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.js","sourceRoot":"","sources":["../src/match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAO3C,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,IAAI,CAAC;QACH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CAAC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IAEjE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,CAAA;AACxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shing.wong/sure-factor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Database schema to production-grade UI \u2014 type catalog, validation, sanitization, i18n, audio, and tiered code generation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"files": [
|
|
53
53
|
"dist",
|
|
54
54
|
"catalog",
|
|
55
|
+
".opencode/skills",
|
|
55
56
|
"CHANGELOG.md",
|
|
56
57
|
"!dist/**/*.test.*"
|
|
57
58
|
],
|