@gramatr/mcp 0.8.10 → 0.8.12
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/gramatr-mcp.js +1 -1
- package/dist/bin/setup-config-io.d.ts +26 -0
- package/dist/bin/setup-config-io.d.ts.map +1 -0
- package/dist/bin/setup-config-io.js +131 -0
- package/dist/bin/setup-config-io.js.map +1 -0
- package/dist/bin/setup-legacy.d.ts +9 -0
- package/dist/bin/setup-legacy.d.ts.map +1 -0
- package/dist/bin/setup-legacy.js +289 -0
- package/dist/bin/setup-legacy.js.map +1 -0
- package/dist/bin/setup-platforms.d.ts +20 -0
- package/dist/bin/setup-platforms.d.ts.map +1 -0
- package/dist/bin/setup-platforms.js +180 -0
- package/dist/bin/setup-platforms.js.map +1 -0
- package/dist/bin/setup-shared.d.ts +26 -0
- package/dist/bin/setup-shared.d.ts.map +1 -0
- package/dist/bin/setup-shared.js +39 -0
- package/dist/bin/setup-shared.js.map +1 -0
- package/dist/bin/setup.d.ts +14 -68
- package/dist/bin/setup.d.ts.map +1 -1
- package/dist/bin/setup.js +32 -612
- package/dist/bin/setup.js.map +1 -1
- package/dist/hooks/generated/schema-constants.d.ts +2 -2
- package/dist/hooks/generated/schema-constants.d.ts.map +1 -1
- package/dist/hooks/generated/schema-constants.js +2 -2
- package/dist/hooks/generated/schema-constants.js.map +1 -1
- package/dist/hooks/lib/gramatr-hook-utils.d.ts +1 -1
- package/dist/hooks/lib/gramatr-hook-utils.d.ts.map +1 -1
- package/dist/hooks/lib/gramatr-hook-utils.js +4 -5
- package/dist/hooks/lib/gramatr-hook-utils.js.map +1 -1
- package/dist/hooks/lib/hook-state.d.ts +21 -0
- package/dist/hooks/lib/hook-state.d.ts.map +1 -1
- package/dist/hooks/lib/hook-state.js +46 -0
- package/dist/hooks/lib/hook-state.js.map +1 -1
- package/dist/hooks/lib/project-file.d.ts +22 -0
- package/dist/hooks/lib/project-file.d.ts.map +1 -0
- package/dist/hooks/lib/project-file.js +44 -0
- package/dist/hooks/lib/project-file.js.map +1 -0
- package/dist/hooks/lib/session.d.ts +17 -1
- package/dist/hooks/lib/session.d.ts.map +1 -1
- package/dist/hooks/lib/session.js +65 -2
- package/dist/hooks/lib/session.js.map +1 -1
- package/dist/hooks/lib/types.d.ts +4 -0
- package/dist/hooks/lib/types.d.ts.map +1 -1
- package/dist/hooks/session-end.d.ts.map +1 -1
- package/dist/hooks/session-end.js +9 -2
- package/dist/hooks/session-end.js.map +1 -1
- package/dist/hooks/session-start.d.ts.map +1 -1
- package/dist/hooks/session-start.js +12 -2
- package/dist/hooks/session-start.js.map +1 -1
- package/dist/hooks/user-prompt-submit.d.ts.map +1 -1
- package/dist/hooks/user-prompt-submit.js +11 -1
- package/dist/hooks/user-prompt-submit.js.map +1 -1
- package/dist/setup/generated/instruction-blocks.d.ts +3 -1
- package/dist/setup/generated/instruction-blocks.d.ts.map +1 -1
- package/dist/setup/generated/instruction-blocks.js +3 -1
- package/dist/setup/generated/instruction-blocks.js.map +1 -1
- package/dist/setup/instructions.d.ts.map +1 -1
- package/dist/setup/instructions.js +5 -1
- package/dist/setup/instructions.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* setup-platforms — Platform-specific setup functions.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from setup.ts for SRP: each target's setup logic
|
|
5
|
+
* (Codex, Gemini, OpenCode, web connectors, generic MCP targets).
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, } from 'node:fs';
|
|
8
|
+
import { join, dirname } from 'node:path';
|
|
9
|
+
import { getGramatrDirFromEnv, getGramatrUrlFromEnv } from '../config-runtime.js';
|
|
10
|
+
import { buildCodexHooksFile, ensureCodexHooksFeature, mergeManagedHooks, } from '../setup/integrations.js';
|
|
11
|
+
import { CODEX_BLOCK_END, CODEX_BLOCK_START, CODEX_GUIDANCE, buildInstallPromptSuggestion, } from '../setup/instructions.js';
|
|
12
|
+
import { buildGeminiExtensionManifest, buildGeminiHooksFile, buildLocalMcpServerEntry, buildOpenCodeMcpServerEntry, getGeminiExtensionDir, getGeminiHooksPath, getGeminiManifestPath, getOpenCodeConfigPath, mergeMcpServerConfig, } from '../setup/targets.js';
|
|
13
|
+
import { buildConnectorInstructions, buildPromptSuggestion, validateServerReachability, } from '../setup/web-connector.js';
|
|
14
|
+
import { deployPlatformBinary } from './setup-shared.js';
|
|
15
|
+
import { readJsonFile, readClaudeConfig, escapeRegExp, upsertManagedBlock, ensureLocalSettings, getCodexHooksPath, getCodexConfigPath, getCodexAgentsPath, HOME, } from './setup-config-io.js';
|
|
16
|
+
function toTomlString(value) {
|
|
17
|
+
return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
18
|
+
}
|
|
19
|
+
function stripTomlSection(content, section) {
|
|
20
|
+
const pattern = new RegExp(`^\\[${escapeRegExp(section)}\\]\\n[\\s\\S]*?(?=^\\[[^\\n]+\\]\\n|\\s*$)`, 'm');
|
|
21
|
+
return content.replace(pattern, '').replace(/\n{3,}/g, '\n\n').trimEnd();
|
|
22
|
+
}
|
|
23
|
+
export function ensureCodexMcpServerConfig(configToml) {
|
|
24
|
+
const gramatrDir = getGramatrDirFromEnv() || join(HOME, '.gramatr');
|
|
25
|
+
const gramatrUrl = getGramatrUrlFromEnv() || 'https://api.gramatr.com/mcp';
|
|
26
|
+
const base = stripTomlSection(stripTomlSection(configToml.trimEnd(), 'mcp_servers.gramatr.env'), 'mcp_servers.gramatr');
|
|
27
|
+
const block = [
|
|
28
|
+
'[mcp_servers.gramatr]',
|
|
29
|
+
`command = ${toTomlString('npx')}`,
|
|
30
|
+
`args = [${toTomlString('-y')}, ${toTomlString('@gramatr/mcp')}]`,
|
|
31
|
+
'',
|
|
32
|
+
'[mcp_servers.gramatr.env]',
|
|
33
|
+
`GRAMATR_DIR = ${toTomlString(gramatrDir)}`,
|
|
34
|
+
`GRAMATR_URL = ${toTomlString(gramatrUrl)}`,
|
|
35
|
+
].join('\n');
|
|
36
|
+
return `${base ? `${base}\n\n` : ''}${block}\n`;
|
|
37
|
+
}
|
|
38
|
+
export function emitInstallPromptSuggestion(target) {
|
|
39
|
+
const promptBlock = buildInstallPromptSuggestion(target);
|
|
40
|
+
process.stderr.write('\n━━━ Prompt Suggestion (copy into custom instructions) ━━━\n\n');
|
|
41
|
+
process.stdout.write(promptBlock + '\n');
|
|
42
|
+
process.stderr.write('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
43
|
+
process.stderr.write('[gramatr-mcp] Paste the prompt block above into your custom instructions / project knowledge.\n');
|
|
44
|
+
}
|
|
45
|
+
export function setupCodex(dryRun = false, showPrompts = false) {
|
|
46
|
+
deployPlatformBinary(dryRun);
|
|
47
|
+
const hooksPath = getCodexHooksPath();
|
|
48
|
+
const configPath = getCodexConfigPath();
|
|
49
|
+
const agentsPath = getCodexAgentsPath();
|
|
50
|
+
const hooksConfig = readClaudeConfig(hooksPath);
|
|
51
|
+
const managedHooks = buildCodexHooksFile(join(HOME, '.gramatr'));
|
|
52
|
+
const mergedHooks = mergeManagedHooks(hooksConfig, managedHooks);
|
|
53
|
+
const existingToml = existsSync(configPath) ? readFileSync(configPath, 'utf8') : '';
|
|
54
|
+
const updatedToml = ensureCodexMcpServerConfig(ensureCodexHooksFeature(existingToml));
|
|
55
|
+
const existingAgents = existsSync(agentsPath) ? readFileSync(agentsPath, 'utf8') : '';
|
|
56
|
+
const updatedAgents = upsertManagedBlock(existingAgents, CODEX_GUIDANCE, CODEX_BLOCK_START, CODEX_BLOCK_END);
|
|
57
|
+
if (dryRun) {
|
|
58
|
+
process.stderr.write('[gramatr-mcp] Dry run — would write to: ' + hooksPath + '\n');
|
|
59
|
+
process.stderr.write(JSON.stringify(mergedHooks, null, 2) + '\n');
|
|
60
|
+
process.stderr.write('[gramatr-mcp] Dry run — would write to: ' + configPath + '\n');
|
|
61
|
+
process.stderr.write(updatedToml);
|
|
62
|
+
process.stderr.write('\n[gramatr-mcp] Dry run — would write to: ' + agentsPath + '\n');
|
|
63
|
+
process.stderr.write(updatedAgents + '\n');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
mkdirSync(join(HOME, '.codex'), { recursive: true });
|
|
67
|
+
ensureLocalSettings();
|
|
68
|
+
writeFileSync(hooksPath, JSON.stringify(mergedHooks, null, 2) + '\n', 'utf8');
|
|
69
|
+
writeFileSync(configPath, updatedToml, 'utf8');
|
|
70
|
+
writeFileSync(agentsPath, updatedAgents, 'utf8');
|
|
71
|
+
process.stderr.write(`[gramatr-mcp] Configured Codex hooks in ${hooksPath}\n`);
|
|
72
|
+
process.stderr.write(`[gramatr-mcp] Configured Codex MCP + hooks in ${configPath}\n`);
|
|
73
|
+
process.stderr.write(`[gramatr-mcp] Configured Codex guidance in ${agentsPath}\n`);
|
|
74
|
+
process.stderr.write('[gramatr-mcp] Restart Codex or start a new session to pick up the change.\n');
|
|
75
|
+
if (showPrompts)
|
|
76
|
+
emitInstallPromptSuggestion('codex');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Generic MCP-only target setup — merges the gramatr MCP server entry into
|
|
80
|
+
* the target's JSON config file. Used by all platforms that support MCP via
|
|
81
|
+
* a JSON config (Claude Desktop, ChatGPT Desktop, Cursor, Windsurf, VS Code).
|
|
82
|
+
*/
|
|
83
|
+
export function setupMcpTarget(targetName, configPath, dryRun) {
|
|
84
|
+
deployPlatformBinary(dryRun);
|
|
85
|
+
const current = readJsonFile(configPath, {});
|
|
86
|
+
const gramatrUrl = getGramatrUrlFromEnv() || 'https://api.gramatr.com/mcp';
|
|
87
|
+
const next = mergeMcpServerConfig(current, buildLocalMcpServerEntry(HOME, gramatrUrl));
|
|
88
|
+
if (dryRun) {
|
|
89
|
+
process.stderr.write(`[gramatr-mcp] Dry run — would write ${targetName} config to: ${configPath}\n`);
|
|
90
|
+
process.stderr.write(JSON.stringify(next, null, 2) + '\n');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
94
|
+
ensureLocalSettings();
|
|
95
|
+
writeFileSync(configPath, JSON.stringify(next, null, 2) + '\n', 'utf8');
|
|
96
|
+
process.stderr.write(`[gramatr-mcp] Configured ${targetName} MCP server in ${configPath}\n`);
|
|
97
|
+
process.stderr.write(`[gramatr-mcp] Restart ${targetName} to pick up the change.\n`);
|
|
98
|
+
}
|
|
99
|
+
export function setupGemini(dryRun = false, showPrompts = false) {
|
|
100
|
+
deployPlatformBinary(dryRun);
|
|
101
|
+
const extensionDir = getGeminiExtensionDir(HOME);
|
|
102
|
+
const manifestPath = getGeminiManifestPath(HOME);
|
|
103
|
+
const hooksPath = getGeminiHooksPath(HOME);
|
|
104
|
+
const gramatrUrl = getGramatrUrlFromEnv() || 'https://api.gramatr.com/mcp';
|
|
105
|
+
const manifest = buildGeminiExtensionManifest(HOME, gramatrUrl);
|
|
106
|
+
const hooks = buildGeminiHooksFile(HOME);
|
|
107
|
+
if (dryRun) {
|
|
108
|
+
process.stderr.write('[gramatr-mcp] Dry run — would write Gemini manifest to: ' + manifestPath + '\n');
|
|
109
|
+
process.stderr.write(JSON.stringify(manifest, null, 2) + '\n');
|
|
110
|
+
process.stderr.write('[gramatr-mcp] Dry run — would write Gemini hooks to: ' + hooksPath + '\n');
|
|
111
|
+
process.stderr.write(JSON.stringify(hooks, null, 2) + '\n');
|
|
112
|
+
if (showPrompts)
|
|
113
|
+
emitInstallPromptSuggestion('gemini-cli');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
mkdirSync(join(extensionDir, 'hooks'), { recursive: true });
|
|
117
|
+
ensureLocalSettings();
|
|
118
|
+
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf8');
|
|
119
|
+
writeFileSync(hooksPath, JSON.stringify(hooks, null, 2) + '\n', 'utf8');
|
|
120
|
+
process.stderr.write(`[gramatr-mcp] Configured Gemini extension manifest in ${manifestPath}\n`);
|
|
121
|
+
process.stderr.write(`[gramatr-mcp] Configured Gemini hooks in ${hooksPath}\n`);
|
|
122
|
+
process.stderr.write('[gramatr-mcp] Restart Gemini CLI to pick up the change.\n');
|
|
123
|
+
if (showPrompts)
|
|
124
|
+
emitInstallPromptSuggestion('gemini-cli');
|
|
125
|
+
}
|
|
126
|
+
export function setupOpenCode(dryRun = false, showPrompts = false) {
|
|
127
|
+
deployPlatformBinary(dryRun);
|
|
128
|
+
const configPath = getOpenCodeConfigPath(HOME);
|
|
129
|
+
const gramatrUrl = getGramatrUrlFromEnv() || 'https://api.gramatr.com/mcp';
|
|
130
|
+
const mcpEntry = buildOpenCodeMcpServerEntry(HOME, gramatrUrl);
|
|
131
|
+
// OpenCode stores its config as JSON with an mcp section (similar to Cursor/VS Code)
|
|
132
|
+
const current = readJsonFile(configPath, {});
|
|
133
|
+
const next = mergeMcpServerConfig(current, mcpEntry);
|
|
134
|
+
if (dryRun) {
|
|
135
|
+
process.stderr.write('[gramatr-mcp] Dry run — would write OpenCode config to: ' + configPath + '\n');
|
|
136
|
+
process.stderr.write(JSON.stringify(next, null, 2) + '\n');
|
|
137
|
+
if (showPrompts)
|
|
138
|
+
emitInstallPromptSuggestion('opencode');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
142
|
+
ensureLocalSettings();
|
|
143
|
+
writeFileSync(configPath, JSON.stringify(next, null, 2) + '\n', 'utf8');
|
|
144
|
+
process.stderr.write(`[gramatr-mcp] Configured OpenCode MCP server in ${configPath}\n`);
|
|
145
|
+
process.stderr.write('[gramatr-mcp] Copy the plugin scaffold from packages/mcp/src/setup/examples/gramatr-opencode-plugin.ts\n');
|
|
146
|
+
process.stderr.write('[gramatr-mcp] Restart OpenCode to pick up the change.\n');
|
|
147
|
+
if (showPrompts)
|
|
148
|
+
emitInstallPromptSuggestion('opencode');
|
|
149
|
+
}
|
|
150
|
+
export async function setupWeb(target = 'claude-web') {
|
|
151
|
+
const gramatrUrl = getGramatrUrlFromEnv() || 'https://api.gramatr.com/mcp';
|
|
152
|
+
// Check reachability first
|
|
153
|
+
process.stderr.write(`[gramatr-mcp] Checking server reachability at ${gramatrUrl}...\n`);
|
|
154
|
+
const reachability = await validateServerReachability(gramatrUrl);
|
|
155
|
+
if (reachability.reachable) {
|
|
156
|
+
process.stderr.write(`[gramatr-mcp] Server is reachable (HTTP ${reachability.statusCode})\n\n`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
process.stderr.write(`[gramatr-mcp] Warning: server unreachable — ${reachability.error}\n`);
|
|
160
|
+
process.stderr.write('[gramatr-mcp] Setup instructions generated anyway. Verify connectivity before use.\n\n');
|
|
161
|
+
}
|
|
162
|
+
// Build and display connector instructions
|
|
163
|
+
const instructions = buildConnectorInstructions({ serverUrl: gramatrUrl, target });
|
|
164
|
+
process.stderr.write('━━━ Connector Setup Instructions ━━━\n\n');
|
|
165
|
+
process.stderr.write(` Target: ${instructions.target}\n`);
|
|
166
|
+
process.stderr.write(` Server URL: ${instructions.serverUrl}\n`);
|
|
167
|
+
process.stderr.write(` Auth: ${instructions.authMethod}\n`);
|
|
168
|
+
process.stderr.write(` Server card: ${instructions.serverCardUrl}\n\n`);
|
|
169
|
+
for (let i = 0; i < instructions.steps.length; i++) {
|
|
170
|
+
process.stderr.write(` ${i + 1}. ${instructions.steps[i]}\n`);
|
|
171
|
+
}
|
|
172
|
+
// Build and display the prompt suggestion
|
|
173
|
+
const promptBlock = buildPromptSuggestion(target);
|
|
174
|
+
process.stderr.write('\n━━━ Prompt Suggestion (copy into custom instructions) ━━━\n\n');
|
|
175
|
+
// Write to stdout so it's easily pipeable/copyable
|
|
176
|
+
process.stdout.write(promptBlock + '\n');
|
|
177
|
+
process.stderr.write('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
178
|
+
process.stderr.write('[gramatr-mcp] Paste the prompt block above into your custom instructions / project knowledge.\n');
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=setup-platforms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-platforms.js","sourceRoot":"","sources":["../../src/bin/setup-platforms.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,GACL,MAAM,sBAAsB,CAAC;AAE9B,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;AAClE,CAAC;AAED,SAAS,g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KAAK,CAAC,kBAAkB,YAAY,CAAC,aAAa,MAAM,CAAC,CAAC;IAEzE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAED,0CAA0C;IAC1C,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAElD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACxF,mDAAmD;IACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iGAAiG,CAAC,CAAC;AAC1H,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* setup-shared — Small shared utilities used across setup modules.
|
|
3
|
+
*
|
|
4
|
+
* Contains binary resolution and deployment (both no-ops in npx mode).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the path to the gramatr binary.
|
|
8
|
+
* Prefers the compiled Bun binary at ~/.gramatr/bin/gramatr (self-contained,
|
|
9
|
+
* no Node version dependency). Falls back to npx for first-run / not-yet-installed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveBinaryPath(): {
|
|
12
|
+
command: string;
|
|
13
|
+
args: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Deploy the correct platform-specific pre-compiled binary to ~/.gramatr/bin/.
|
|
17
|
+
*
|
|
18
|
+
* Checks for platform-specific binaries (e.g. gramatr-linux-x64) in the package
|
|
19
|
+
* dist/ directory, then falls back to the generic 'gramatr' binary from
|
|
20
|
+
* build-binary.mjs. If neither exists, logs a warning and returns false so the
|
|
21
|
+
* caller can fall back to npx.
|
|
22
|
+
*
|
|
23
|
+
* Uses atomic copy (write to .new, then rename) to avoid partial-binary issues.
|
|
24
|
+
*/
|
|
25
|
+
export declare function deployPlatformBinary(_dryRun?: boolean): boolean;
|
|
26
|
+
//# sourceMappingURL=setup-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-shared.d.ts","sourceRoot":"","sources":["../../src/bin/setup-shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAQvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,UAAQ,GAAG,OAAO,CAK7D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* setup-shared — Small shared utilities used across setup modules.
|
|
3
|
+
*
|
|
4
|
+
* Contains binary resolution and deployment (both no-ops in npx mode).
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
// gramatr-allow: C1 — CLI entry point, reads HOME for config path
|
|
9
|
+
const HOME = process.env.HOME || process.env.USERPROFILE || '';
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the path to the gramatr binary.
|
|
12
|
+
* Prefers the compiled Bun binary at ~/.gramatr/bin/gramatr (self-contained,
|
|
13
|
+
* no Node version dependency). Falls back to npx for first-run / not-yet-installed.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveBinaryPath() {
|
|
16
|
+
const bunBin = join(HOME, '.gramatr', 'bin', 'gramatr');
|
|
17
|
+
if (existsSync(bunBin)) {
|
|
18
|
+
return { command: bunBin, args: [] };
|
|
19
|
+
}
|
|
20
|
+
// Fallback to npx (first install, before binary is deployed)
|
|
21
|
+
return { command: 'npx', args: ['-y', '@gramatr/mcp'] };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deploy the correct platform-specific pre-compiled binary to ~/.gramatr/bin/.
|
|
25
|
+
*
|
|
26
|
+
* Checks for platform-specific binaries (e.g. gramatr-linux-x64) in the package
|
|
27
|
+
* dist/ directory, then falls back to the generic 'gramatr' binary from
|
|
28
|
+
* build-binary.mjs. If neither exists, logs a warning and returns false so the
|
|
29
|
+
* caller can fall back to npx.
|
|
30
|
+
*
|
|
31
|
+
* Uses atomic copy (write to .new, then rename) to avoid partial-binary issues.
|
|
32
|
+
*/
|
|
33
|
+
export function deployPlatformBinary(_dryRun = false) {
|
|
34
|
+
// No-op: MCP server and hooks now use npx @gramatr/mcp (no compiled binary).
|
|
35
|
+
// Compiled binaries are broken on macOS (Gatekeeper) and Windows (silent stdout).
|
|
36
|
+
// Kept as a function so callers don't need updating.
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=setup-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-shared.js","sourceRoot":"","sources":["../../src/bin/setup-shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,kEAAkE;AAClE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACxD,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC;IAED,6DAA6D;IAC7D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAO,GAAG,KAAK;IAClD,6EAA6E;IAC7E,kFAAkF;IAClF,qDAAqD;IACrD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/bin/setup.d.ts
CHANGED
|
@@ -1,78 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* gramatr setup
|
|
2
|
+
* gramatr setup — Main orchestrator for multi-platform setup.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Delegates to focused modules:
|
|
5
|
+
* - setup-config-io.ts — Config file reading/writing, path resolution
|
|
6
|
+
* - setup-legacy.ts — Legacy artifact cleanup (pre-rebrand remnants)
|
|
7
|
+
* - setup-platforms.ts — Platform-specific setup (Codex, Gemini, OpenCode, web, generic MCP)
|
|
8
|
+
* - setup-shared.ts — Binary resolution / deployment (npx no-ops)
|
|
9
|
+
*
|
|
10
|
+
* This file owns: setupClaude(), setupAutoInstall(), verifySetupInstall(),
|
|
11
|
+
* getAutoDetectedTargets(), and the convenience wrappers for MCP-only targets
|
|
12
|
+
* (Claude Desktop, ChatGPT Desktop, Cursor, Windsurf, VS Code).
|
|
7
13
|
*
|
|
8
14
|
* Usage:
|
|
9
15
|
* gramatr-mcp setup claude Configure Claude Code
|
|
10
16
|
* gramatr-mcp setup claude --dry Run without writing
|
|
11
17
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
interface McpServerEntry {
|
|
18
|
-
command: string;
|
|
19
|
-
args?: string[];
|
|
20
|
-
env?: Record<string, string>;
|
|
21
|
-
[key: string]: unknown;
|
|
22
|
-
}
|
|
18
|
+
export { getClaudeConfigPath, getClaudeSettingsPath, getCodexHooksPath, getCodexConfigPath, getClaudeMarkdownPath, getCodexAgentsPath, getGramatrSettingsPath, readJsonFile, readClaudeConfig, escapeRegExp, upsertManagedBlock, ensureLocalSettings, parseJson, readManagedBlock, hasHookCommand, } from './setup-config-io.js';
|
|
19
|
+
export { runCleanInstall, } from './setup-legacy.js';
|
|
20
|
+
export { ensureCodexMcpServerConfig, emitInstallPromptSuggestion, setupCodex, setupMcpTarget, setupGemini, setupOpenCode, setupWeb, } from './setup-platforms.js';
|
|
21
|
+
export { resolveBinaryPath, deployPlatformBinary, } from './setup-shared.js';
|
|
23
22
|
type SetupTarget = 'all' | 'claude' | 'codex' | 'opencode' | 'claude-desktop' | 'chatgpt-desktop' | 'gemini' | 'cursor' | 'windsurf' | 'vscode';
|
|
24
23
|
export type InstallableTarget = Exclude<SetupTarget, 'all'>;
|
|
25
24
|
export declare const AUTO_TARGET_ORDER: InstallableTarget[];
|
|
26
|
-
/**
|
|
27
|
-
* Resolve the path to the gramatr binary.
|
|
28
|
-
* Prefers the compiled Bun binary at ~/.gramatr/bin/gramatr (self-contained,
|
|
29
|
-
* no Node version dependency). Falls back to npx for first-run / not-yet-installed.
|
|
30
|
-
*/
|
|
31
|
-
export declare function resolveBinaryPath(): {
|
|
32
|
-
command: string;
|
|
33
|
-
args: string[];
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Deploy the correct platform-specific pre-compiled binary to ~/.gramatr/bin/.
|
|
37
|
-
*
|
|
38
|
-
* Checks for platform-specific binaries (e.g. gramatr-linux-x64) in the package
|
|
39
|
-
* dist/ directory, then falls back to the generic 'gramatr' binary from
|
|
40
|
-
* build-binary.mjs. If neither exists, logs a warning and returns false so the
|
|
41
|
-
* caller can fall back to npx.
|
|
42
|
-
*
|
|
43
|
-
* Uses atomic copy (write to .new, then rename) to avoid partial-binary issues.
|
|
44
|
-
*/
|
|
45
|
-
export declare function deployPlatformBinary(_dryRun?: boolean): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Get the Claude Code config file path.
|
|
48
|
-
* Claude Code stores global MCP config in ~/.claude.json
|
|
49
|
-
*/
|
|
50
|
-
export declare function getClaudeConfigPath(): string;
|
|
51
|
-
export declare function getClaudeSettingsPath(): string;
|
|
52
|
-
export declare function getCodexHooksPath(): string;
|
|
53
|
-
export declare function getCodexConfigPath(): string;
|
|
54
|
-
export declare function getClaudeMarkdownPath(): string;
|
|
55
|
-
export declare function getCodexAgentsPath(): string;
|
|
56
|
-
export declare function getGramatrSettingsPath(): string;
|
|
57
|
-
export declare function readJsonFile<T>(path: string, fallback: T): T;
|
|
58
|
-
/**
|
|
59
|
-
* Read existing Claude config or return empty.
|
|
60
|
-
*/
|
|
61
|
-
export declare function readClaudeConfig(configPath: string): ClaudeConfig;
|
|
62
|
-
export declare function upsertManagedBlock(existing: string, content: string, startMarker: string, endMarker: string): string;
|
|
63
|
-
export declare function escapeRegExp(text: string): string;
|
|
64
|
-
export declare function ensureCodexMcpServerConfig(configToml: string): string;
|
|
65
|
-
export declare function ensureLocalSettings(): void;
|
|
66
|
-
export declare function runCleanInstall(dryRun: boolean): void;
|
|
67
|
-
export declare function emitInstallPromptSuggestion(target: Parameters<typeof buildInstallPromptSuggestion>[0]): void;
|
|
68
25
|
export declare function setupClaude(dryRun?: boolean, cleanInstall?: boolean, showPrompts?: boolean): void;
|
|
69
|
-
export declare function setupCodex(dryRun?: boolean, showPrompts?: boolean): void;
|
|
70
|
-
/**
|
|
71
|
-
* Generic MCP-only target setup — merges the gramatr MCP server entry into
|
|
72
|
-
* the target's JSON config file. Used by all platforms that support MCP via
|
|
73
|
-
* a JSON config (Claude Desktop, ChatGPT Desktop, Cursor, Windsurf, VS Code).
|
|
74
|
-
*/
|
|
75
|
-
export declare function setupMcpTarget(targetName: string, configPath: string, dryRun: boolean): void;
|
|
76
26
|
export declare function setupClaudeDesktop(dryRun?: boolean, showPrompts?: boolean): void;
|
|
77
27
|
export declare function setupChatgptDesktop(dryRun?: boolean, showPrompts?: boolean): void;
|
|
78
28
|
export declare function setupCursor(dryRun?: boolean, showPrompts?: boolean): void;
|
|
@@ -86,12 +36,8 @@ export declare function setupAutoInstall(options?: {
|
|
|
86
36
|
selectedTargets?: InstallableTarget[];
|
|
87
37
|
showPrompts?: boolean;
|
|
88
38
|
}): number;
|
|
89
|
-
export declare function setupGemini(dryRun?: boolean, showPrompts?: boolean): void;
|
|
90
|
-
export declare function setupOpenCode(dryRun?: boolean, showPrompts?: boolean): void;
|
|
91
|
-
export declare function setupWeb(target?: 'claude-web' | 'chatgpt-web' | 'gemini-web'): Promise<void>;
|
|
92
39
|
export declare function verifySetupInstall(target?: SetupTarget, options?: {
|
|
93
40
|
json?: boolean;
|
|
94
41
|
showPrompts?: boolean;
|
|
95
42
|
}): number;
|
|
96
|
-
export {};
|
|
97
43
|
//# sourceMappingURL=setup.d.ts.map
|
package/dist/bin/setup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/bin/setup.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/bin/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAoCH,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,gBAAgB,EAChB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,UAAU,EACV,cAAc,EACd,WAAW,EACX,aAAa,EACb,QAAQ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