suppa-mcp-2 1.4.0 → 1.4.1
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
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.4.
|
|
300
|
+
const server = new McpServer({ name: "suppa-2.0", version: "1.4.1" }, { 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.4.
|
|
3
|
+
"version": "1.4.1",
|
|
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": {
|
|
@@ -46,7 +46,7 @@ Confirm all 5 before writing anything:
|
|
|
46
46
|
5. Relation targets are thunks — `() => Target`, never the class itself — or circular imports break.
|
|
47
47
|
6. Do not pass the optional `inverse` selector to `@ManyToOne`/`@ManyToMany` — write `@ManyToOne(() => Target, { … })`. Add one only when the target class declares the paired back-reference and you are deliberately linking the two sides. An `inverse` must select a RELATION property on the target (`(task) => task.project`); `(e) => e.id` is always wrong — `id` is a system column, not a back-reference.
|
|
48
48
|
7. If an option isn't in the reference tables (`references/entities.md`, `references/seeds.md`, `references/registration.md`), it doesn't exist — stop and ask, don't guess.
|
|
49
|
-
8. Every entity class must appear in
|
|
49
|
+
8. Every entity class must appear in the class array passed as `forFeature()`'s FIRST argument (there is no `entities` option — rule 19); every seed in the options object's `seeds` array, dependencies first — `workflowsSeed` before `stageWorkflowsSeed`.
|
|
50
50
|
9. Seeds: every record carries all `importKeyFields` (or `$key`); relations are referenced by the target's import-key object, never a numeric id; no system columns; no `$readAccess`/`$updateAccess`/`$instanceAccess`; no reverse `@OneToMany` field, even as `[]`.
|
|
51
51
|
10. Autoload paths (`entitiesPath`/`seedsPath`) point at `dist/`, never `src/` — autoloading reads compiled output.
|
|
52
52
|
11. Renames need `key` set on `@Entity()`/`@Column()` BEFORE the rename ships — otherwise it's a drop-and-create, not a rename.
|
|
@@ -57,6 +57,7 @@ Confirm all 5 before writing anything:
|
|
|
57
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
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
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.
|
|
60
|
+
19. **`EntityModule.forFeature()` has exactly two shapes** (`references/registration.md`): `forFeature([A, B], { seeds: [...] })` — classes FIRST, options second — or `forFeature({ entitiesPath, seedsPath })` for autoloading. The options object accepts only `seeds`, `entitiesPath` and `seedsPath`. `forFeature({ entities: [...] })` looks reasonable and registers NOTHING: the classes are dropped with the unknown option and no table is created for any of them. E306.
|
|
60
61
|
|
|
61
62
|
## Decorator decision table
|
|
62
63
|
|
|
@@ -129,7 +130,7 @@ A `@ManyToOne` without `nullable: false` is written `owner?: ProductMatrixEntity
|
|
|
129
130
|
|
|
130
131
|
1. Pre-flight (above) — confirm repo, SDK version, tsconfig, layout.
|
|
131
132
|
2. Blocking questions (above) — get answers before writing any file.
|
|
132
|
-
3. Write the entity AND wire it in (one step, both files): write `*.entity.ts` from `templates/entity.template.ts` per `references/entities.md`, then immediately export it from the entities barrel and add it to `EntityModule.forFeature()`'s
|
|
133
|
+
3. Write the entity AND wire it in (one step, both files): write `*.entity.ts` from `templates/entity.template.ts` per `references/entities.md`, then immediately export it from the entities barrel and add it to the class array passed as `EntityModule.forFeature()`'s first argument — see "Wiring a new entity in" below. The class does not exist to the platform until this is done.
|
|
133
134
|
4. Need default rows? Same deal for the seed: write it from `templates/seed.template.ts` per `references/seeds.md`, export it from the seeds barrel, and add it to the `seeds` array (dependencies first) in the same step. The seed is not done until it is in the `seeds` array.
|
|
134
135
|
5. Run the close-out gate (below) — do not report "done" before all 4 steps pass.
|
|
135
136
|
|
|
@@ -156,7 +157,7 @@ Four edits, every time:
|
|
|
156
157
|
|
|
157
158
|
1. Export the class from the entities barrel — `src/common/database/entities/index.ts`.
|
|
158
159
|
2. Export the seed from the seeds barrel — `src/common/database/seeds/index.ts`.
|
|
159
|
-
3. Import the class in the module and add it to the `
|
|
160
|
+
3. Import the class in the module and add it to the class array — `forFeature()`'s FIRST argument.
|
|
160
161
|
4. Add the seed to the `seeds` array, positioned AFTER the seeds of everything it references.
|
|
161
162
|
|
|
162
163
|
```ts
|
|
@@ -172,6 +173,16 @@ EntityModule.forFeature([Workflows, MyNewEntity], {
|
|
|
172
173
|
});
|
|
173
174
|
```
|
|
174
175
|
|
|
176
|
+
**The shape is not negotiable.** There are exactly two (`references/registration.md`): the classes as the FIRST argument with an options object second, or an options object alone that autoloads from `entitiesPath`/`seedsPath`. The options object accepts only `seeds`, `entitiesPath` and `seedsPath` — there is no `entities` option:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
EntityModule.forFeature([A, B], { seeds: [aSeed] }); // correct
|
|
180
|
+
EntityModule.forFeature({ entitiesPath: 'dist/…/entities' }); // correct
|
|
181
|
+
EntityModule.forFeature({ entities: [A, B], seeds: [aSeed] }); // WRONG — E306
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The third form looks reasonable and registers nothing: the classes are dropped with the unknown option, and no table is created for any of them.
|
|
185
|
+
|
|
175
186
|
Self-check, no tooling required:
|
|
176
187
|
|
|
177
188
|
```
|
|
@@ -201,6 +212,8 @@ The validator parses with the TypeScript compiler API, read from the app repo yo
|
|
|
201
212
|
| Symptom | Cause | Validator code |
|
|
202
213
|
|---|---|---|
|
|
203
214
|
| No table is created for an entity | The class was not passed to `EntityModule.forFeature()` | E301 |
|
|
215
|
+
| No table is created for ANY entity, and the registration looks right | `forFeature({ entities: [...] })` — an invented shape; the classes go in the FIRST argument and the options object has no `entities` key | E306 |
|
|
216
|
+
| E301 never fires even though an entity is clearly unregistered | A `forFeature()` names neither a class array nor `entitiesPath`, so membership is unknown and the check is skipped for the whole run | W614 |
|
|
204
217
|
| Autoloading finds nothing | `entitiesPath` / `seedsPath` points at `src/` instead of compiled `dist/` | E303 |
|
|
205
218
|
| Duplicate seed rows after a restart | Record is missing one or more `importKeyFields` | E205 |
|
|
206
219
|
| Seed relation is empty or fails to resolve | Relation referenced by numeric id, or the target seed runs later | E203 + E304 |
|
|
@@ -1159,6 +1159,11 @@ function analyzeModules(ts, sf, model) {
|
|
|
1159
1159
|
const seedsNode = opts.get("seeds") ? unwrapExpr(ts, opts.get("seeds")) : undefined;
|
|
1160
1160
|
const m = {
|
|
1161
1161
|
sf, node,
|
|
1162
|
+
// `entities` as an OPTION is not one of the two documented shapes: the
|
|
1163
|
+
// classes go in argument 0. Recorded so E306 can say so, instead of the
|
|
1164
|
+
// array being silently unread — which degraded the module to "autoload"
|
|
1165
|
+
// and switched E301/E302/E304 off for the whole run.
|
|
1166
|
+
entitiesOptionNode: a0IsOptions ? (opts.get("entities") ?? null) : null,
|
|
1162
1167
|
entities: side(
|
|
1163
1168
|
"entitiesPath",
|
|
1164
1169
|
a0IsArray ? a0 : null,
|
|
@@ -1222,6 +1227,24 @@ function checkRegistration(ts, model, findings, rootDir) {
|
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
1224
1229
|
|
|
1230
|
+
for (const m of model.modules) {
|
|
1231
|
+
if (m.entitiesOptionNode) {
|
|
1232
|
+
findings.push(finding(ts, m.sf, m.entitiesOptionNode, "E306",
|
|
1233
|
+
`EntityModule.forFeature({ entities: [...] }) is not a supported shape — the options object takes only ` +
|
|
1234
|
+
`seeds, entitiesPath and seedsPath. Entity classes are the FIRST argument: ` +
|
|
1235
|
+
`forFeature([A, B], { seeds: [...] }). As written, nothing registers these classes and no table is ` +
|
|
1236
|
+
`created for them`));
|
|
1237
|
+
}
|
|
1238
|
+
// Neither an explicit array nor a path: this module registers no entities,
|
|
1239
|
+
// and E301 cannot know what is covered. Say so rather than fall silent.
|
|
1240
|
+
if (m.entities.mode === "autoload" && !m.entities.pathNode && !m.entitiesOptionNode) {
|
|
1241
|
+
findings.push(finding(ts, m.sf, m.entities.node, "W614",
|
|
1242
|
+
`EntityModule.forFeature() names neither an entities array (first argument) nor entitiesPath, so this ` +
|
|
1243
|
+
`module registers no entity classes — E301 (unregistered entity) is skipped for the whole run. Pass the ` +
|
|
1244
|
+
`classes as the first argument, or set entitiesPath to the compiled dist/ directory`));
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1225
1248
|
if (model.entities.size > 0 && model.modules.length === 0) {
|
|
1226
1249
|
const first = [...model.entities.values()][0];
|
|
1227
1250
|
findings.push(finding(ts, first.sf, first.node.name ?? first.node, "E305",
|