suppa-mcp-2 1.14.0 → 1.15.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/README.md CHANGED
@@ -378,9 +378,14 @@ shipped with restated defaults and four bare relation stand-ins. Install the
378
378
  guards into an application repo:
379
379
 
380
380
  ```bash
381
+ npx suppa-entity-guards .
382
+ # or, without npx:
381
383
  node node_modules/suppa-mcp-2/skills/suppa-entity-code/scripts/install-entity-code-guards.mjs .
382
384
  ```
383
385
 
386
+ It is idempotent, and it refuses to write a hook whose path does not resolve —
387
+ hooks pointing at nothing behave exactly like no hooks at all.
388
+
384
389
  Five layers, each covering a way the previous one is missed: Claude Code hooks
385
390
  put the rules in an agent's context **before** it writes `*.entity.ts` and the
386
391
  gate's findings in front of it **after**, a `Stop` hook refuses to end a turn
package/package.json CHANGED
@@ -1,61 +1,62 @@
1
- {
2
- "name": "suppa-mcp-2",
3
- "version": "1.14.0",
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
- "type": "module",
6
- "bin": {
7
- "suppa-mcp": "dist/bin.js"
8
- },
9
- "main": "dist/bin.js",
10
- "files": [
11
- "dist",
12
- "skills",
13
- "README.md",
14
- "LICENSE"
15
- ],
16
- "engines": {
17
- "node": ">=18"
18
- },
19
- "scripts": {
20
- "build": "tsc",
21
- "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
22
- "rebuild": "npm run clean && npm run build",
23
- "start": "node dist/bin.js",
24
- "dev": "tsc --watch",
25
- "test": "node scripts/check-version-literals.mjs && vitest run",
26
- "test:watch": "vitest",
27
- "prepublishOnly": "npm run build && npm test",
28
- "inspect": "npx @modelcontextprotocol/inspector node dist/bin.js",
29
- "schema:gate": "node skills/suppa-entity-code/scripts/entity-code-guard.mjs --ci .",
30
- "guards:install": "node skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
31
- },
32
- "keywords": [
33
- "mcp",
34
- "model-context-protocol",
35
- "suppa",
36
- "modern-expo",
37
- "ai",
38
- "llm",
39
- "tools",
40
- "claude",
41
- "copilot",
42
- "cursor"
43
- ],
44
- "license": "MIT",
45
- "repository": {
46
- "type": "git",
47
- "url": "https://git.modern-expo.com/asu/me-development/skills.git",
48
- "directory": "suppa-mcp-node"
49
- },
50
- "homepage": "https://modern.suppa.me",
51
- "dependencies": {
52
- "@modelcontextprotocol/sdk": "^1.18.0",
53
- "@napi-rs/keyring": "^1.1.0",
54
- "zod": "^3.23.8"
55
- },
56
- "devDependencies": {
57
- "@types/node": "^20.0.0",
58
- "typescript": "^5.6.0",
59
- "vitest": "^2.1.0"
60
- }
61
- }
1
+ {
2
+ "name": "suppa-mcp-2",
3
+ "version": "1.15.0",
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
+ "type": "module",
6
+ "bin": {
7
+ "suppa-mcp": "dist/bin.js",
8
+ "suppa-entity-guards": "skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
9
+ },
10
+ "main": "dist/bin.js",
11
+ "files": [
12
+ "dist",
13
+ "skills",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
23
+ "rebuild": "npm run clean && npm run build",
24
+ "start": "node dist/bin.js",
25
+ "dev": "tsc --watch",
26
+ "test": "node scripts/check-version-literals.mjs && vitest run",
27
+ "test:watch": "vitest",
28
+ "prepublishOnly": "npm run build && npm test",
29
+ "inspect": "npx @modelcontextprotocol/inspector node dist/bin.js",
30
+ "schema:gate": "node skills/suppa-entity-code/scripts/entity-code-guard.mjs --ci .",
31
+ "guards:install": "node skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
32
+ },
33
+ "keywords": [
34
+ "mcp",
35
+ "model-context-protocol",
36
+ "suppa",
37
+ "modern-expo",
38
+ "ai",
39
+ "llm",
40
+ "tools",
41
+ "claude",
42
+ "copilot",
43
+ "cursor"
44
+ ],
45
+ "license": "MIT",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://git.modern-expo.com/asu/me-development/skills.git",
49
+ "directory": "suppa-mcp-node"
50
+ },
51
+ "homepage": "https://modern.suppa.me",
52
+ "dependencies": {
53
+ "@modelcontextprotocol/sdk": "^1.18.0",
54
+ "@napi-rs/keyring": "^1.1.0",
55
+ "zod": "^3.23.8"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20.0.0",
59
+ "typescript": "^5.6.0",
60
+ "vitest": "^2.1.0"
61
+ }
62
+ }
@@ -26,7 +26,7 @@
26
26
 
27
27
  import { execFileSync } from "node:child_process";
28
28
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
29
- import { dirname, join, relative, resolve } from "node:path";
29
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
30
30
  import { fileURLToPath } from "node:url";
31
31
 
32
32
  const HERE = dirname(fileURLToPath(import.meta.url));
@@ -61,16 +61,36 @@ function readIfExists(path) {
61
61
  }
62
62
  }
63
63
 
64
+ /**
65
+ * The guard's path RELATIVE to the repo, or null when it lives outside it.
66
+ *
67
+ * `relative()` returns an ABSOLUTE path when the two sides sit on different
68
+ * Windows drives — a global install, or the repo on another drive. That path
69
+ * does not start with "..", so the old test read it as "inside the repo" and
70
+ * wrote `${CLAUDE_PROJECT_DIR}/D:/…`: a path that can never resolve, on hooks
71
+ * that then do nothing and say nothing. Guards installed and silently dead is
72
+ * the exact failure this installer exists to prevent.
73
+ */
74
+ function guardRelativeToRoot() {
75
+ const rel = relative(root, GUARD);
76
+ return rel && !rel.startsWith("..") && !isAbsolute(rel) ? rel.replace(/\\/g, "/") : null;
77
+ }
78
+
64
79
  /**
65
80
  * How the hook command should name the guard. Inside the repo (the normal
66
81
  * `pnpm add -D suppa-mcp-2` case) it is written relative to the project so the
67
82
  * settings file stays portable across machines; outside it, absolutely.
68
83
  */
69
84
  function guardPath() {
70
- const rel = relative(root, GUARD);
71
- return !rel.startsWith("..")
72
- ? `\${CLAUDE_PROJECT_DIR}/${rel.replace(/\\/g, "/")}`
73
- : GUARD.replace(/\\/g, "/");
85
+ const rel = guardRelativeToRoot();
86
+ return rel ? `\${CLAUDE_PROJECT_DIR}/${rel}` : GUARD.replace(/\\/g, "/");
87
+ }
88
+
89
+ /** Does the path just written actually land on the guard? */
90
+ function guardPathResolves(written) {
91
+ const prefix = "${CLAUDE_PROJECT_DIR}/";
92
+ const resolved = written.startsWith(prefix) ? join(root, written.slice(prefix.length)) : written;
93
+ return existsSync(resolved);
74
94
  }
75
95
 
76
96
  // ── 1. Claude Code hooks ──
@@ -87,6 +107,16 @@ function installHooks() {
87
107
  }
88
108
  }
89
109
  const guard = guardPath();
110
+ if (!guardPathResolves(guard)) {
111
+ // Never write a hook that points at nothing: it behaves exactly like no
112
+ // hook at all — no rules before the write, no gate after, and no message
113
+ // either way.
114
+ skipped.push(
115
+ `.claude/settings.json NOT written — the guard would be '${guard}', which does not exist. ` +
116
+ `Install suppa-mcp-2 in this repo (npm i -D suppa-mcp-2) and re-run.`,
117
+ );
118
+ return;
119
+ }
90
120
  const entry = (mode, statusMessage) => ({
91
121
  type: "command",
92
122
  command: "node",
@@ -149,9 +179,9 @@ function installGitHook() {
149
179
  skipped.push("git hook skipped (--no-git)");
150
180
  return;
151
181
  }
152
- const guard = relative(root, GUARD).startsWith("..")
153
- ? GUARD.replace(/\\/g, "/")
154
- : relative(root, GUARD).replace(/\\/g, "/");
182
+ // Same rule as the hooks: inside the repo it stays relative (git runs its
183
+ // hooks from the repo root), outside it is absolute.
184
+ const guard = guardRelativeToRoot() ?? GUARD.replace(/\\/g, "/");
155
185
  const hook = `#!/bin/sh
156
186
  # Managed by suppa-mcp-2 (skills/suppa-entity-code). Refuses a commit whose
157
187
  # staged *.entity.ts / *.seed.ts files fail the schema gate.