suppa-mcp-2 1.3.2 → 1.4.0
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/dist/server.js +1 -1
- package/package.json +1 -1
- package/skills/suppa-entity-code/SKILL.md +48 -7
- package/skills/suppa-entity-code/scripts/validate-suppa-schema.mjs +1527 -1284
- package/skills/suppa-entity-code/templates/entity.template.ts +29 -1
- package/skills/suppa-entity-code/templates/tabular-part.template.ts +99 -94
package/dist/server.js
CHANGED
|
@@ -297,7 +297,7 @@ export function buildServer() {
|
|
|
297
297
|
// Reset so repeated buildServer() calls (e.g. in tests) do not double-count.
|
|
298
298
|
TOOL_NAMES.length = 0;
|
|
299
299
|
PROMPT_NAMES.length = 0;
|
|
300
|
-
const server = new McpServer({ name: "suppa-2.0", version: "1.
|
|
300
|
+
const server = new McpServer({ name: "suppa-2.0", version: "1.4.0" }, { instructions: INSTRUCTIONS });
|
|
301
301
|
const reg = (name, cfg, handler) => {
|
|
302
302
|
server.registerTool(name, {
|
|
303
303
|
description: cfg.description,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suppa-mcp-2",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -52,7 +52,11 @@ Confirm all 5 before writing anything:
|
|
|
52
52
|
11. Renames need `key` set on `@Entity()`/`@Column()` BEFORE the rename ships — otherwise it's a drop-and-create, not a rename.
|
|
53
53
|
12. `subType` refines `type` and means three unrelated things depending on the base type — `Timestamp` → `'date' | 'time' | 'timestamp'`, `Text` → `'encrypted'`, `Enum`/`MultiEnum` → the enum's global name. Never pass `subType` by hand on an `@Enum`/`@MultiEnum` field: the decorator fills it from its first argument (or derives `<ClassName>.<propertyName>`), and a hand-written one either duplicates that or silently disagrees with the value that resolves `{ value: 'active' }` on insert. Any other `(type, subType)` pair does not exist.
|
|
54
54
|
13. `subType` is **immutable after creation**, with one exception: toggling `'encrypted'` on or off. The Builder API answers `Field subType cannot be changed.` to anything else — so choosing `Timestamp` where you needed `subType: 'date'` is not a conversion you can ship later, it is a NEW field plus a removal of the old one (see `references/registration.md` for what removal leaves behind). Get date-vs-timestamp right the first time. To CLEAR a subtype you must write `subType: null` explicitly — deleting the line does nothing, because an omitted key is dropped from the sync payload and the stored subtype survives.
|
|
55
|
-
14.
|
|
55
|
+
14. **Every relation property carries its TypeScript type, and the type says what the decorator says.** `@ManyToOne` holds ONE row — `owner: ProductMatrixEntity;` — while `@ManyToMany`, `@OneToMany` and `@ManyToManyBackRef` hold many — `envs: ApplicationEnvsEntity[];`. Type it optional (`owner?: Target`) unless the relation is `nullable: false`. An untyped relation property is `any` to every consumer of the entity. E114/E115/W610.
|
|
56
|
+
15. **Enum member keys are PascalCase** — `NotFilled = 'Not filled'`. The key is the identifier the code reads; the string on the right is what the platform stores, and the two need not match. W611.
|
|
57
|
+
16. **Never write an option that already holds its default value.** The platform applies `canGroup: true`, `canSort: true`, `showInTable: true`, `editFromTable: true`, `canFilter: true`, `readOnly: false`, `searchable: false` on its own. Declare one of these ONLY where the field departs from it; repeating defaults on every field buries the one option that actually differs. W612.
|
|
58
|
+
17. **`@Enum`/`@MultiEnum` take the global name only when the enum is global.** Default is local: `@Enum(StageStatusEnum, StageStatus, { nullable: false })` — the decorator derives `<ClassName>.<propertyName>`. Pass the name as the FIRST argument only when the value set is shared across entities or referenced from a seed: `@Enum('StageWorkflows.status', StageStatusEnum, StageStatus, { … })`. W613.
|
|
59
|
+
18. Repeating rows owned by one parent record are a **tabular part**, never a plain entity: `type: 'tabular-part'` + `relationEntityName` (the parent's `@Entity()` name) + a `@ManyToOne` field named exactly `owner` pointing at the parent class — all three required, the platform infers none of them. Put `owner` FIRST in `importKeyFields` — it scopes the business key to the parent, or rows collide across different parents.
|
|
56
60
|
|
|
57
61
|
## Decorator decision table
|
|
58
62
|
|
|
@@ -64,17 +68,47 @@ Confirm all 5 before writing anything:
|
|
|
64
68
|
| Time-only column | `@Column({ type: FieldTypeEnum.Timestamp, subType: 'time' })` — there is **no** `FieldTypeEnum.Time` |
|
|
65
69
|
| Date **and** time | `@Column({ type: FieldTypeEnum.Timestamp })` — omitted `subType` already means `timestamp` |
|
|
66
70
|
| Text encrypted at rest | `@Column({ type: FieldTypeEnum.Text, subType: 'encrypted' })` — Text only; see rule 13 for what it costs |
|
|
67
|
-
| Fixed single-select value set | `@Enum(
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| Reverse side of a `@
|
|
71
|
+
| Fixed single-select value set, used by this field only | `@Enum(<Field>Enum, <Field>Titles?, options?)` → `field: <Field>Enum;` |
|
|
72
|
+
| …the same, but shared across entities or referenced from a seed | `@Enum('<Entity>.<field>', <Field>Enum, <Field>Titles?, options?)` |
|
|
73
|
+
| Fixed multi-select value set | `@MultiEnum(...)` — same signatures as `@Enum` |
|
|
74
|
+
| Foreign key on this entity | `@ManyToOne(() => Target, options?)` → `prop: Target;` — **no inverse** |
|
|
75
|
+
| Pivot table between two entities | `@ManyToMany(() => Target, options?)` → `prop: Target[];` — **no inverse** |
|
|
76
|
+
| Reverse side of a `@ManyToMany` | `@ManyToManyBackRef(() => Target, (t) => t.<thisRelationProp>, options?)` → `prop: Target[];` |
|
|
77
|
+
| Reverse side of a `@ManyToOne` | `@OneToMany(() => Target, (t) => t.<thisRelationProp>, options?)` → `prop: Target[];` |
|
|
73
78
|
| Single attachment | `@File({ title })` |
|
|
74
79
|
| Multiple attachments | `@MultiFile({ title })` |
|
|
75
80
|
|
|
76
81
|
`target` is always a thunk, `() => Target`. The `inverse` selector is REQUIRED on `@OneToMany`/`@ManyToManyBackRef` and OPTIONAL on `@ManyToOne`/`@ManyToMany` — omit it there by default. When you do write one, it must select the property on the TARGET class that holds the other side of this relation (e.g. `(task) => task.project`) — never `.id`, never a scalar column.
|
|
77
82
|
|
|
83
|
+
**Typing the property (rule 14).** The decorator declares the relation; the TypeScript type declares its shape, and the two must agree:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
@ManyToOne(() => ProductMatrixEntity, {
|
|
87
|
+
name: 'owner',
|
|
88
|
+
key: 'ProductMatrixItem.owner',
|
|
89
|
+
nullable: false,
|
|
90
|
+
title: { en: 'Owner' },
|
|
91
|
+
})
|
|
92
|
+
owner: ProductMatrixEntity; // ONE row; no '?' because nullable: false
|
|
93
|
+
|
|
94
|
+
@ManyToMany(() => ProductMatrixEntity, { name: 'peers', title: { en: 'Peers' } })
|
|
95
|
+
peers: ProductMatrixEntity[]; // MANY rows
|
|
96
|
+
|
|
97
|
+
@OneToMany(() => ApplicationEnvsEntity, (entity) => entity.owner, {
|
|
98
|
+
title: getFieldTitle(EntityNamesEnum.Applications, 'envs'),
|
|
99
|
+
})
|
|
100
|
+
envs: ApplicationEnvsEntity[]; // MANY rows, inverse REQUIRED
|
|
101
|
+
|
|
102
|
+
@ManyToManyBackRef(() => ApplicationEnvsEntity, (entity) => entity.owner, {
|
|
103
|
+
title: getFieldTitle(EntityNamesEnum.Applications, 'envs'),
|
|
104
|
+
})
|
|
105
|
+
envs: ApplicationEnvsEntity[]; // MANY rows, inverse REQUIRED
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A `@ManyToOne` without `nullable: false` is written `owner?: ProductMatrixEntity` — the column may be empty and callers must handle it.
|
|
109
|
+
|
|
110
|
+
**Field options (rule 16).** `canGroup`, `canSort`, `showInTable`, `editFromTable` and `canFilter` default to `true`; `readOnly` and `searchable` default to `false`. Write one only to depart from that — `searchable: true` on the field users actually search, and nothing on the rest.
|
|
111
|
+
|
|
78
112
|
**What `subType: 'encrypted'` costs.** The platform forces the column's `unique`, `searchable`, `canFilter`, `canSort` and `canGroup` to `false` and clears `maxLength`, `minLength` and `mask`, whatever you declared — the ciphertext envelope can't satisfy a plaintext constraint or be read by an index. So an encrypted column cannot be searched, filtered, sorted or grouped: if users need any of that, split the field and keep the searchable part in a separate plaintext column. It is also rejected inside a `MultiType` field and on any non-Text type.
|
|
79
113
|
|
|
80
114
|
## Naming conventions
|
|
@@ -85,6 +119,7 @@ Confirm all 5 before writing anything:
|
|
|
85
119
|
| Entity class | PascalCase, plural = `@Entity()`'s `name` | `StageWorkflows` |
|
|
86
120
|
| Seed export | camelCase plural + `Seed` | `stageWorkflowsSeed` |
|
|
87
121
|
| Enum | PascalCase + `Enum` | `StageStatusEnum` |
|
|
122
|
+
| Enum member key | PascalCase — the stored value is the string on the right and need not match | `NotFilled = 'Not filled'` |
|
|
88
123
|
| Titles map | PascalCase + `Titles` suffix — this doc's own worked examples drop the suffix (`StageStatus`); either is acceptable if used consistently within a repo | `StageStatusTitles` (or `StageStatus`) |
|
|
89
124
|
| Enum global name | `'<EntityName>.<field>'` | `'StageWorkflows.status'` |
|
|
90
125
|
| Index name | `idx_<table>_<cols>` | `idx_tasks_project` |
|
|
@@ -173,6 +208,12 @@ The validator parses with the TypeScript compiler API, read from the app repo yo
|
|
|
173
208
|
| A renamed entity or field appears as a new one | No `key` option was set | W602 |
|
|
174
209
|
| `default` value is rejected | A JavaScript value was passed instead of a SQL expression string | E103 |
|
|
175
210
|
| Generated relation has an inverse selector that fails to typecheck | An `inverse` was passed to `@ManyToOne`/`@ManyToMany`, where it's optional and usually omitted | W609/E111 — drop the selector, write `@ManyToOne(() => Target, { … })` |
|
|
211
|
+
| A relation reads as `any`; nothing catches using it as the wrong shape | The property has no TypeScript type | E114 — write `owner: Target;` (`Target[]` for the to-many decorators) |
|
|
212
|
+
| A to-many relation is used as a single record (or the reverse) | The property's type contradicts the decorator's arity, or names a different class than the thunk | E115 — `@ManyToOne` → `Target`; `@ManyToMany`/`@OneToMany`/`@ManyToManyBackRef` → `Target[]` |
|
|
213
|
+
| Callers never null-check a relation that can be empty | A nullable `@ManyToOne` is typed as always present (or a `nullable: false` one as optional) | W610 — `owner?: Target` when nullable, `owner: Target` when `nullable: false` |
|
|
214
|
+
| Enum members read as data rather than identifiers | Member keys are not PascalCase | W611 — `NotFilled = 'Not filled'` |
|
|
215
|
+
| Every field repeats the same five option lines | Options were written at their default values | W612 — delete them; declare an option only where it departs from the default |
|
|
216
|
+
| An enum name is invented for a field nothing else references | The optional global name was passed to `@Enum`/`@MultiEnum` when the enum is local | W613 — omit the first argument; the decorator derives `<ClassName>.<propertyName>` |
|
|
176
217
|
| Migration rejects the column, or a date field ships as a full `timestamp` | The `(type, subType)` pair isn't one the doc allows — `Timestamp` takes `'date'`/`'time'`/`'timestamp'`, `Text` takes `'encrypted'`, nothing else | E112 |
|
|
177
218
|
| `Encrypted subtype is only allowed on text fields` | `subType: 'encrypted'` on a non-Text column | E112 |
|
|
178
219
|
| An enum field resolves to the wrong enum, or its values fail to insert | `subType` was written by hand on `@Enum`/`@MultiEnum` instead of being left to the decorator | E113 |
|