@gramatr/mcp 0.8.8 → 0.8.10
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/bin/build-mcpb.d.ts +8 -2
- package/dist/bin/build-mcpb.d.ts.map +1 -1
- package/dist/bin/build-mcpb.js +7 -7
- package/dist/bin/build-mcpb.js.map +1 -1
- package/dist/bin/gramatr-mcp.d.ts.map +1 -1
- package/dist/bin/gramatr-mcp.js +10 -2
- package/dist/bin/gramatr-mcp.js.map +1 -1
- package/dist/bin/setup.d.ts +1 -1
- package/dist/bin/setup.d.ts.map +1 -1
- package/dist/bin/setup.js +8 -22
- package/dist/bin/setup.js.map +1 -1
- package/dist/hooks/generated/hook-timeouts.d.ts +13 -1
- package/dist/hooks/generated/hook-timeouts.d.ts.map +1 -1
- package/dist/hooks/generated/hook-timeouts.js +13 -1
- package/dist/hooks/generated/hook-timeouts.js.map +1 -1
- package/dist/hooks/generated/schema-constants.d.ts +23 -9
- package/dist/hooks/generated/schema-constants.d.ts.map +1 -1
- package/dist/hooks/generated/schema-constants.js +26 -9
- package/dist/hooks/generated/schema-constants.js.map +1 -1
- package/dist/hooks/input-validator.d.ts +5 -0
- package/dist/hooks/input-validator.d.ts.map +1 -1
- package/dist/hooks/input-validator.js +113 -1
- package/dist/hooks/input-validator.js.map +1 -1
- package/dist/hooks/lib/gramatr-hook-utils.d.ts.map +1 -1
- package/dist/hooks/lib/gramatr-hook-utils.js +2 -2
- package/dist/hooks/lib/gramatr-hook-utils.js.map +1 -1
- package/dist/hooks/lib/hook-state.d.ts.map +1 -1
- package/dist/hooks/lib/hook-state.js +29 -28
- package/dist/hooks/lib/hook-state.js.map +1 -1
- package/dist/hooks/lib/routing.js +1 -1
- package/dist/hooks/lib/routing.js.map +1 -1
- package/dist/hooks/lib/types.d.ts +0 -1
- package/dist/hooks/lib/types.d.ts.map +1 -1
- package/dist/hooks/user-prompt-submit.js +1 -1
- package/dist/hooks/user-prompt-submit.js.map +1 -1
- package/dist/proxy/remote-client.d.ts.map +1 -1
- package/dist/proxy/remote-client.js +2 -1
- package/dist/proxy/remote-client.js.map +1 -1
- package/dist/setup/examples/gramatr-opencode-plugin.js +5 -5
- package/dist/setup/examples/gramatr-opencode-plugin.js.map +1 -1
- package/dist/setup/generated/instruction-blocks.d.ts +27 -0
- package/dist/setup/generated/instruction-blocks.d.ts.map +1 -0
- package/dist/setup/generated/instruction-blocks.js +27 -0
- package/dist/setup/generated/instruction-blocks.js.map +1 -0
- package/dist/setup/generated/platform-hooks.d.ts +2 -1
- package/dist/setup/generated/platform-hooks.d.ts.map +1 -1
- package/dist/setup/generated/platform-hooks.js +101 -22
- package/dist/setup/generated/platform-hooks.js.map +1 -1
- package/dist/setup/instructions.d.ts.map +1 -1
- package/dist/setup/instructions.js +9 -46
- package/dist/setup/instructions.js.map +1 -1
- package/dist/setup/integrations.d.ts.map +1 -1
- package/dist/setup/integrations.js +4 -3
- package/dist/setup/integrations.js.map +1 -1
- package/dist/setup/targets.d.ts +3 -3
- package/dist/setup/targets.d.ts.map +1 -1
- package/dist/setup/targets.js +8 -9
- package/dist/setup/targets.js.map +1 -1
- package/package.json +3 -2
- package/scripts/postinstall.mjs +49 -97
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gramatr/mcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "grāmatr — Intelligence middleware for AI agents. Pre-classifies every request, injects relevant memory and behavioral context, enforces data quality, and maintains session continuity across Claude, ChatGPT, Codex, Cursor, Gemini, and any MCP-compatible client.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"LICENSE"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
56
|
+
"better-sqlite3": "^12.9.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/better-sqlite3": "^7.6.13",
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -1,115 +1,67 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* postinstall.mjs — Auto-
|
|
2
|
+
* postinstall.mjs — Auto-detect and configure local AI clients.
|
|
3
3
|
*
|
|
4
|
-
* Runs on `npm install @gramatr/
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Runs on `npm install -g @gramatr/mcp`. Detects installed AI clients
|
|
5
|
+
* (Claude Code, Codex, Gemini CLI, etc.), configures them automatically,
|
|
6
|
+
* and prints a link for web/app setup.
|
|
7
7
|
*
|
|
8
8
|
* Design constraints:
|
|
9
|
-
* - Pure Node.js (no external dependencies
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* - ISC-A: npm install must not fail if GitHub is unreachable
|
|
9
|
+
* - Pure Node.js (no external dependencies)
|
|
10
|
+
* - Graceful failure: always exits 0
|
|
11
|
+
* - Non-interactive in CI (no prompts)
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
14
|
+
import { execSync } from "node:child_process";
|
|
15
|
+
import { mkdir } from "node:fs/promises";
|
|
17
16
|
import { homedir } from "node:os";
|
|
18
|
-
import {
|
|
19
|
-
import { pipeline } from "node:stream/promises";
|
|
20
|
-
import { Readable } from "node:stream";
|
|
21
|
-
import { createRequire } from "node:module";
|
|
17
|
+
import { join } from "node:path";
|
|
22
18
|
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { dirname } from "node:path";
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
/** Map (platform, arch) to the binary asset name. */
|
|
29
|
-
function getBinaryName(platform, arch) {
|
|
30
|
-
const map = {
|
|
31
|
-
"linux-x64": "gramatr-linux-x64",
|
|
32
|
-
"linux-arm64": "gramatr-linux-arm64",
|
|
33
|
-
"darwin-x64": "gramatr-darwin-x64",
|
|
34
|
-
"darwin-arm64": "gramatr-darwin-arm64",
|
|
35
|
-
"win32-x64": "gramatr-windows-x64.exe",
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const key = `${platform}-${arch}`;
|
|
39
|
-
return map[key] ?? null;
|
|
40
|
-
}
|
|
21
|
+
async function main() {
|
|
22
|
+
const home = homedir();
|
|
23
|
+
const gramatrDir = join(home, ".gramatr");
|
|
24
|
+
await mkdir(gramatrDir, { recursive: true });
|
|
41
25
|
|
|
42
|
-
|
|
43
|
-
function getVersion() {
|
|
26
|
+
// Resolve the gramatr-mcp entry point relative to this script
|
|
44
27
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
45
|
-
const
|
|
46
|
-
const pkg = require(join(__dirname, "..", "package.json"));
|
|
47
|
-
return pkg.version;
|
|
48
|
-
}
|
|
28
|
+
const entrypoint = join(__dirname, "..", "dist", "bin", "gramatr-mcp.js");
|
|
49
29
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
throw new Error(
|
|
56
|
-
`Download failed: HTTP ${response.status} ${response.statusText}`,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const tempDest = `${dest}.tmp`;
|
|
61
|
-
const body = Readable.fromWeb(response.body);
|
|
62
|
-
const fileStream = createWriteStream(tempDest);
|
|
30
|
+
console.log("");
|
|
31
|
+
console.log(" ┌─────────────────────────────────────────────┐");
|
|
32
|
+
console.log(" │ grāmatr — AI Intelligence Layer installed │");
|
|
33
|
+
console.log(" └─────────────────────────────────────────────┘");
|
|
34
|
+
console.log("");
|
|
63
35
|
|
|
36
|
+
// Auto-detect and configure local clients
|
|
64
37
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const platform = process.platform;
|
|
76
|
-
const arch = process.arch;
|
|
77
|
-
|
|
78
|
-
const binaryName = getBinaryName(platform, arch);
|
|
79
|
-
if (!binaryName) {
|
|
80
|
-
console.warn(
|
|
81
|
-
`[gramatr] Unsupported platform: ${platform}-${arch}. ` +
|
|
82
|
-
"Skipping binary download. You can install manually from " +
|
|
83
|
-
"https://github.com/gramatr/gramatr/releases",
|
|
84
|
-
);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const version = getVersion();
|
|
89
|
-
const url = `${GITHUB_RELEASE_BASE}/v${version}/${binaryName}`;
|
|
90
|
-
|
|
91
|
-
const installDir = join(homedir(), ".gramatr", "bin");
|
|
92
|
-
const isWindows = platform === "win32";
|
|
93
|
-
const installPath = join(installDir, isWindows ? "gramatr.exe" : "gramatr");
|
|
94
|
-
|
|
95
|
-
console.log(`[gramatr] Downloading ${binaryName} v${version}...`);
|
|
96
|
-
|
|
97
|
-
await mkdir(installDir, { recursive: true });
|
|
98
|
-
await downloadBinary(url, installPath);
|
|
99
|
-
|
|
100
|
-
if (!isWindows) {
|
|
101
|
-
await chmod(installPath, 0o755);
|
|
38
|
+
execSync(`node "${entrypoint}" setup auto --yes`, {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
timeout: 30000,
|
|
41
|
+
});
|
|
42
|
+
} catch {
|
|
43
|
+
// Setup failed or timed out — print manual instructions
|
|
44
|
+
console.log(" [gramatr] Auto-setup skipped. Configure manually:");
|
|
45
|
+
console.log(" npx @gramatr/mcp setup claude # Claude Code");
|
|
46
|
+
console.log(" npx @gramatr/mcp setup codex # OpenAI Codex");
|
|
47
|
+
console.log(" npx @gramatr/mcp setup auto # Detect all clients");
|
|
102
48
|
}
|
|
103
49
|
|
|
104
|
-
console.log(
|
|
50
|
+
console.log("");
|
|
51
|
+
console.log(" ── Next steps ──────────────────────────────────");
|
|
52
|
+
console.log("");
|
|
53
|
+
console.log(" Local clients (configured above):");
|
|
54
|
+
console.log(" Restart your AI client to activate gramatr.");
|
|
55
|
+
console.log("");
|
|
56
|
+
console.log(" Web & app clients:");
|
|
57
|
+
console.log(" https://gramatr.com/setup");
|
|
58
|
+
console.log("");
|
|
59
|
+
console.log(" Claude Web / ChatGPT / Gemini — paste your");
|
|
60
|
+
console.log(" prompt or connect the MCP add-on.");
|
|
61
|
+
console.log("");
|
|
62
|
+
console.log(" Verify installation:");
|
|
63
|
+
console.log(" npx @gramatr/mcp setup verify");
|
|
64
|
+
console.log("");
|
|
105
65
|
}
|
|
106
66
|
|
|
107
|
-
main().catch((
|
|
108
|
-
console.warn(
|
|
109
|
-
`[gramatr] Binary download failed: ${err.message}. ` +
|
|
110
|
-
"This is non-fatal — you can install manually from " +
|
|
111
|
-
"https://github.com/gramatr/gramatr/releases",
|
|
112
|
-
);
|
|
113
|
-
// Always exit 0 — never break npm install
|
|
114
|
-
process.exit(0);
|
|
115
|
-
});
|
|
67
|
+
main().catch(() => process.exit(0));
|