@gramatr/mcp 0.7.20 → 0.8.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/bin/setup.d.ts +2 -1
- package/dist/bin/setup.d.ts.map +1 -1
- package/dist/bin/setup.js +35 -1
- package/dist/bin/setup.js.map +1 -1
- package/dist/gramatr +0 -0
- package/dist/hooks/agent-gate.d.ts.map +1 -1
- package/dist/hooks/agent-gate.js +11 -7
- package/dist/hooks/agent-gate.js.map +1 -1
- package/dist/hooks/agent-verify.d.ts.map +1 -1
- package/dist/hooks/agent-verify.js +2 -1
- package/dist/hooks/agent-verify.js.map +1 -1
- package/dist/hooks/edit-tracker.d.ts.map +1 -1
- package/dist/hooks/edit-tracker.js +2 -1
- package/dist/hooks/edit-tracker.js.map +1 -1
- package/dist/hooks/generated/hook-timeouts.d.ts +41 -0
- package/dist/hooks/generated/hook-timeouts.d.ts.map +1 -0
- package/dist/hooks/generated/hook-timeouts.js +41 -0
- package/dist/hooks/generated/hook-timeouts.js.map +1 -0
- package/dist/hooks/generated/schema-constants.d.ts +46 -0
- package/dist/hooks/generated/schema-constants.d.ts.map +1 -1
- package/dist/hooks/generated/schema-constants.js +88 -11
- package/dist/hooks/generated/schema-constants.js.map +1 -1
- package/dist/hooks/git-gate.d.ts.map +1 -1
- package/dist/hooks/git-gate.js +14 -13
- package/dist/hooks/git-gate.js.map +1 -1
- package/dist/hooks/input-validator.d.ts.map +1 -1
- package/dist/hooks/input-validator.js +2 -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 -1
- package/dist/hooks/lib/gramatr-hook-utils.js.map +1 -1
- package/dist/hooks/lib/hook-state.d.ts +3 -0
- package/dist/hooks/lib/hook-state.d.ts.map +1 -1
- package/dist/hooks/lib/hook-state.js +14 -3
- package/dist/hooks/lib/hook-state.js.map +1 -1
- package/dist/hooks/lib/routing.d.ts.map +1 -1
- package/dist/hooks/lib/routing.js +8 -7
- package/dist/hooks/lib/routing.js.map +1 -1
- package/dist/hooks/lib/version-check.d.ts +1 -1
- package/dist/hooks/lib/version-check.d.ts.map +1 -1
- package/dist/hooks/lib/version-check.js +4 -5
- package/dist/hooks/lib/version-check.js.map +1 -1
- package/dist/hooks/rating-capture.d.ts.map +1 -1
- package/dist/hooks/rating-capture.js +15 -9
- package/dist/hooks/rating-capture.js.map +1 -1
- package/dist/hooks/session-start.d.ts.map +1 -1
- package/dist/hooks/session-start.js +7 -1
- package/dist/hooks/session-start.js.map +1 -1
- package/dist/hooks/stop.d.ts.map +1 -1
- package/dist/hooks/stop.js +1 -1
- package/dist/hooks/stop.js.map +1 -1
- package/dist/hooks/tool-tracker.d.ts.map +1 -1
- package/dist/hooks/tool-tracker.js +2 -1
- package/dist/hooks/tool-tracker.js.map +1 -1
- package/dist/hooks/user-prompt-submit.d.ts.map +1 -1
- package/dist/hooks/user-prompt-submit.js +15 -50
- package/dist/hooks/user-prompt-submit.js.map +1 -1
- package/dist/proxy/local-client.d.ts +12 -6
- package/dist/proxy/local-client.d.ts.map +1 -1
- package/dist/proxy/local-client.js +35 -7
- package/dist/proxy/local-client.js.map +1 -1
- package/dist/setup/examples/gramatr-opencode-plugin.d.ts +45 -0
- package/dist/setup/examples/gramatr-opencode-plugin.d.ts.map +1 -0
- package/dist/setup/examples/gramatr-opencode-plugin.js +129 -0
- package/dist/setup/examples/gramatr-opencode-plugin.js.map +1 -0
- package/dist/setup/generated/platform-hooks.d.ts +64 -0
- package/dist/setup/generated/platform-hooks.d.ts.map +1 -0
- package/dist/setup/generated/platform-hooks.js +526 -0
- package/dist/setup/generated/platform-hooks.js.map +1 -0
- package/dist/setup/instructions.d.ts +3 -3
- package/dist/setup/instructions.d.ts.map +1 -1
- package/dist/setup/instructions.js +138 -86
- package/dist/setup/instructions.js.map +1 -1
- package/dist/setup/integrations.d.ts.map +1 -1
- package/dist/setup/integrations.js +31 -42
- package/dist/setup/integrations.js.map +1 -1
- package/dist/setup/targets.d.ts +3 -0
- package/dist/setup/targets.d.ts.map +1 -1
- package/dist/setup/targets.js +19 -3
- package/dist/setup/targets.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,58 @@
|
|
|
1
|
+
import { ENTITY_TYPES as ENTITY_TYPE_LIST } from '../hooks/generated/schema-constants.js';
|
|
1
2
|
export const CLAUDE_BLOCK_START = '<!-- GRAMATR-START -->';
|
|
2
3
|
export const CLAUDE_BLOCK_END = '<!-- GRAMATR-END -->';
|
|
3
4
|
export const CODEX_BLOCK_START = '<!-- GRAMATR-CODEX-START -->';
|
|
4
5
|
export const CODEX_BLOCK_END = '<!-- GRAMATR-CODEX-END -->';
|
|
6
|
+
// ── Shared contract base ──
|
|
7
|
+
// Single source of truth for all platform templates. Platform-specific
|
|
8
|
+
// wrappers add only how the packet arrives (hooks vs explicit call).
|
|
9
|
+
const CONTRACT_RULES = `**Mandatory contract fields — treat as execution requirements:**
|
|
10
|
+
- \`directives.hard_gates\` — non-negotiable behavioral constraints
|
|
11
|
+
- \`directives.behavioral_rules\` — algorithm phases, code rules, safety rules
|
|
12
|
+
- \`directives.behavioral_directives\` — per-turn instructions from the classifier
|
|
13
|
+
- \`process.phase_template\` — effort-gated phase sequence (MUST follow)
|
|
14
|
+
- \`process.quality_gate_config\` — ISC verification rules (MUST pass before done)
|
|
15
|
+
- \`enrichment.data.reasoning\` — RE + ISC scaffold when present (MUST consume)`;
|
|
16
|
+
const MEMORY_RULES = `**Memory:** Use gramatr MCP tools (\`search_semantic\`, \`create_entity\`,
|
|
17
|
+
\`add_observation\`), not local markdown files. Never write to MEMORY.md.`;
|
|
18
|
+
/** Composed from generated ENTITY_TYPES constant — stays in sync automatically */
|
|
19
|
+
const ENTITY_TYPES = `**Entity types (${ENTITY_TYPE_LIST.length}-type taxonomy):** \`create_entity\` requires \`entity_type\`
|
|
20
|
+
from: ${ENTITY_TYPE_LIST.join(', ')}.
|
|
21
|
+
Invalid types are blocked by the PreToolUse hook.`;
|
|
22
|
+
const REQUIRED_FIELDS = `**Required fields:** task/milestone: status (open|in_progress|blocked|review|done).
|
|
23
|
+
Decision: status + project_id. Session: status + project_id.`;
|
|
24
|
+
const FEEDBACK_RULES = `**Feedback loop (MANDATORY — trains the classifier flywheel):**
|
|
25
|
+
1. Call \`gramatr_classification_feedback\` after non-trivial work — evaluates
|
|
26
|
+
if effort, intent, and skills were classified correctly.
|
|
27
|
+
2. Call \`gramatr_save_reflection\` in LEARN phase — captures what worked, what
|
|
28
|
+
didn't, what a smarter AI would do differently.
|
|
29
|
+
Skipping these breaks the training flywheel.`;
|
|
30
|
+
const SUBAGENT_RULES = `**Sub-agent composition (MANDATORY for non-trivial sub-agents):**
|
|
31
|
+
Before launching any sub-agent, call \`gramatr_route_request\` with the task
|
|
32
|
+
prompt. Pass the returned packet VERBATIM to the agent — do not rewrite or
|
|
33
|
+
paraphrase: \`orchestration.agents.composed\` → agent system prompt,
|
|
34
|
+
\`enrichment.data.reasoning.isc_scaffold\` → acceptance criteria,
|
|
35
|
+
\`enrichment.data.reasoning.reverse_engineering\` → task context,
|
|
36
|
+
\`directives.hard_gates\` → constraints. If you disagree with the packet's
|
|
37
|
+
framing, state the disagreement before overriding — never silently replace.
|
|
38
|
+
Use \`isolation: "worktree"\` for code-modifying agents.
|
|
39
|
+
|
|
40
|
+
**Sub-agent audit briefs must include:**
|
|
41
|
+
1. Static check — is the config/code correct?
|
|
42
|
+
2. Runtime check — does it actually execute successfully?
|
|
43
|
+
3. State check — did expected side effects happen (DB writes, API calls)?
|
|
44
|
+
4. Error check — capture stderr, don't trust silent success`;
|
|
45
|
+
const EFFORT_PHASES = `**Effort-gated phases:**
|
|
46
|
+
- instant: RESPOND only
|
|
47
|
+
- fast: OBSERVE → RESPOND
|
|
48
|
+
- standard: OBSERVE → PLAN → BUILD → VERIFY
|
|
49
|
+
- extended+: OBSERVE → THINK → PLAN → BUILD → EXECUTE → VERIFY → LEARN`;
|
|
50
|
+
const IDENTITY = `**Identity:** Read from \`~/.gramatr/settings.json\` — \`daidentity\` for your
|
|
51
|
+
name, \`principal\` for the user's name.`;
|
|
52
|
+
const DEGRADED_MODE = `**If the server is unavailable:** Degrade cleanly and keep working. Use the
|
|
53
|
+
7-phase structure. Create ISC before work. Never combine phases.`;
|
|
54
|
+
// ── Platform templates ──
|
|
55
|
+
// Each composes from the shared blocks above. Only the intro differs.
|
|
5
56
|
export const CLAUDE_CODE_GUIDANCE = `${CLAUDE_BLOCK_START}
|
|
6
57
|
# gramatr
|
|
7
58
|
|
|
@@ -12,60 +63,46 @@ packet into your context on every prompt.
|
|
|
12
63
|
phase templates, capability audit, quality gates, memory/search results,
|
|
13
64
|
agent suggestions, and enrichment (RE + ISC scaffold).
|
|
14
65
|
|
|
15
|
-
|
|
16
|
-
- \`directives.hard_gates\` — non-negotiable behavioral constraints
|
|
17
|
-
- \`directives.behavioral_rules\` — algorithm phases, code rules, safety rules
|
|
18
|
-
- \`process.phase_template\` — effort-gated phase sequence
|
|
19
|
-
- \`process.quality_gate_config\` — ISC verification rules
|
|
20
|
-
- \`enrichment.data.reasoning\` — RE + ISC when present
|
|
66
|
+
${CONTRACT_RULES}
|
|
21
67
|
|
|
22
|
-
|
|
23
|
-
\`add_observation\`), not local markdown files.
|
|
68
|
+
${MEMORY_RULES}
|
|
24
69
|
|
|
25
|
-
|
|
26
|
-
call \`gramatr_route_request\` with the task prompt first. Use the returned
|
|
27
|
-
packet to compose the brief: RE → task description, ISC scaffold → acceptance
|
|
28
|
-
criteria, orchestration.agents.composed → agent system prompt, hard_gates →
|
|
29
|
-
constraints.
|
|
70
|
+
${ENTITY_TYPES}
|
|
30
71
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- standard: OBSERVE → PLAN → BUILD → VERIFY
|
|
35
|
-
- extended+: OBSERVE → THINK → PLAN → BUILD → EXECUTE → VERIFY → LEARN
|
|
72
|
+
${REQUIRED_FIELDS}
|
|
73
|
+
|
|
74
|
+
${FEEDBACK_RULES}
|
|
36
75
|
|
|
37
|
-
|
|
38
|
-
name, \`principal\` for the user's name.
|
|
76
|
+
${SUBAGENT_RULES}
|
|
39
77
|
|
|
40
|
-
|
|
41
|
-
|
|
78
|
+
${EFFORT_PHASES}
|
|
79
|
+
|
|
80
|
+
${IDENTITY}
|
|
81
|
+
|
|
82
|
+
${DEGRADED_MODE}
|
|
42
83
|
${CLAUDE_BLOCK_END}
|
|
43
84
|
`;
|
|
44
85
|
export const CODEX_GUIDANCE = `${CODEX_BLOCK_START}
|
|
45
86
|
# gramatr codex guidance
|
|
46
87
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- Use \`process.quality_gate_config\` for ISC verification.
|
|
66
|
-
- Consume \`enrichment.data.reasoning\` for RE and ISC when present.
|
|
67
|
-
- \`gramatr_route_request\` is mandatory when hook injection is missing/stale.
|
|
68
|
-
- \`search_semantic\` remains available for follow-up memory expansion.
|
|
88
|
+
Hooks inject a \`gmtr.intelligence.contract.v2\` packet on every prompt.
|
|
89
|
+
Follow it as authoritative. Call \`gramatr_route_request\` when missing.
|
|
90
|
+
|
|
91
|
+
${CONTRACT_RULES}
|
|
92
|
+
|
|
93
|
+
${MEMORY_RULES}
|
|
94
|
+
|
|
95
|
+
${ENTITY_TYPES}
|
|
96
|
+
|
|
97
|
+
${REQUIRED_FIELDS}
|
|
98
|
+
|
|
99
|
+
${FEEDBACK_RULES}
|
|
100
|
+
|
|
101
|
+
${SUBAGENT_RULES}
|
|
102
|
+
|
|
103
|
+
${EFFORT_PHASES}
|
|
104
|
+
|
|
105
|
+
${DEGRADED_MODE}
|
|
69
106
|
${CODEX_BLOCK_END}
|
|
70
107
|
`;
|
|
71
108
|
export function buildInstallPromptSuggestion(target) {
|
|
@@ -73,7 +110,11 @@ export function buildInstallPromptSuggestion(target) {
|
|
|
73
110
|
case 'claude-code':
|
|
74
111
|
case 'codex':
|
|
75
112
|
case 'gemini-cli':
|
|
113
|
+
case 'opencode':
|
|
76
114
|
return buildHookedPromptSuggestion(target);
|
|
115
|
+
case 'chatgpt-web':
|
|
116
|
+
return buildCompactPromptSuggestion('ChatGPT Web');
|
|
117
|
+
case 'claude-web':
|
|
77
118
|
case 'claude-desktop':
|
|
78
119
|
case 'chatgpt-desktop':
|
|
79
120
|
case 'cursor':
|
|
@@ -85,11 +126,13 @@ export function buildInstallPromptSuggestion(target) {
|
|
|
85
126
|
}
|
|
86
127
|
}
|
|
87
128
|
function buildHookedPromptSuggestion(target) {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
:
|
|
91
|
-
|
|
92
|
-
|
|
129
|
+
const platformMap = {
|
|
130
|
+
'claude-code': 'Claude Code',
|
|
131
|
+
codex: 'Codex',
|
|
132
|
+
'gemini-cli': 'Gemini CLI',
|
|
133
|
+
opencode: 'OpenCode',
|
|
134
|
+
};
|
|
135
|
+
const platform = platformMap[target];
|
|
93
136
|
return `# gramatr (${platform})
|
|
94
137
|
|
|
95
138
|
gramatr is installed locally. Hooks inject a \`gmtr.intelligence.contract.v2\`
|
|
@@ -99,31 +142,25 @@ When a gramatr intelligence block is present, follow it as authoritative.
|
|
|
99
142
|
When the packet is missing or clearly stale, call \`gramatr_route_request\`
|
|
100
143
|
with the user's request before answering.
|
|
101
144
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
145
|
+
${CONTRACT_RULES}
|
|
146
|
+
|
|
147
|
+
${ENTITY_TYPES}
|
|
105
148
|
|
|
106
|
-
|
|
107
|
-
Follow \`process.phase_template\` for effort-gated phase sequencing.
|
|
108
|
-
Use \`process.quality_gate_config\` for ISC verification.
|
|
109
|
-
Consume \`enrichment.data.reasoning\` for RE and ISC when present.
|
|
149
|
+
${REQUIRED_FIELDS}
|
|
110
150
|
|
|
111
|
-
|
|
112
|
-
\`data\` field as the canonical tool payload.
|
|
151
|
+
${FEEDBACK_RULES}
|
|
113
152
|
|
|
114
|
-
|
|
115
|
-
call \`gramatr_load_handoff\` first, then \`search_semantic\` for detail.
|
|
153
|
+
${SUBAGENT_RULES}
|
|
116
154
|
|
|
117
|
-
|
|
118
|
-
1. Call \`gramatr_classification_feedback\` — trains the classifier.
|
|
119
|
-
2. Call \`gramatr_save_reflection\` — feeds the learning pipeline.
|
|
155
|
+
${EFFORT_PHASES}
|
|
120
156
|
|
|
121
|
-
Use gramatr tools for memory and project state.
|
|
122
|
-
notes when gramatr state is available.`;
|
|
157
|
+
Use gramatr tools for memory and project state. Never maintain local notes.`;
|
|
123
158
|
}
|
|
124
159
|
function buildHooklessLocalPromptSuggestion(target) {
|
|
125
160
|
const platformMap = {
|
|
161
|
+
'claude-web': 'Claude Web',
|
|
126
162
|
'claude-desktop': 'Claude Desktop',
|
|
163
|
+
'chatgpt-web': 'ChatGPT Web',
|
|
127
164
|
'chatgpt-desktop': 'ChatGPT Desktop',
|
|
128
165
|
cursor: 'Cursor',
|
|
129
166
|
windsurf: 'Windsurf',
|
|
@@ -140,31 +177,46 @@ the user's prompt. This returns a \`gmtr.intelligence.contract.v2\` packet.
|
|
|
140
177
|
phase templates, capability audit, quality gates, memory/search results,
|
|
141
178
|
agent suggestions, and enrichment (RE + ISC scaffold).
|
|
142
179
|
|
|
143
|
-
|
|
144
|
-
- \`directives.hard_gates\` — non-negotiable behavioral constraints
|
|
145
|
-
- \`directives.behavioral_rules\` — algorithm phases, code rules, safety rules
|
|
146
|
-
- \`process.phase_template\` — effort-gated phase sequence
|
|
147
|
-
- \`process.quality_gate_config\` — ISC verification rules
|
|
148
|
-
- \`enrichment.data.reasoning\` — RE + ISC when present
|
|
180
|
+
${CONTRACT_RULES}
|
|
149
181
|
|
|
150
|
-
|
|
151
|
-
\`add_observation\`) as the source of truth — not local notes.
|
|
182
|
+
${MEMORY_RULES}
|
|
152
183
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
184
|
+
${ENTITY_TYPES}
|
|
185
|
+
|
|
186
|
+
${REQUIRED_FIELDS}
|
|
187
|
+
|
|
188
|
+
${EFFORT_PHASES}
|
|
189
|
+
|
|
190
|
+
${FEEDBACK_RULES}
|
|
191
|
+
|
|
192
|
+
${SUBAGENT_RULES}
|
|
193
|
+
|
|
194
|
+
For continuity questions, call \`gramatr_load_handoff\` then \`search_semantic\`.`;
|
|
195
|
+
}
|
|
196
|
+
// ── Compact variant (<1500 chars) for platforms with character limits ──
|
|
197
|
+
function buildCompactPromptSuggestion(displayName) {
|
|
198
|
+
return `# gramatr (${displayName})
|
|
199
|
+
|
|
200
|
+
You have gramatr connected as an MCP server.
|
|
201
|
+
|
|
202
|
+
Before responding to any message, call gramatr_route_request with the user's prompt. This returns a gmtr.intelligence.contract.v2 packet with classification, directives, memory, and phase templates.
|
|
203
|
+
|
|
204
|
+
Follow the packet as authoritative. Key fields:
|
|
205
|
+
- directives.hard_gates — non-negotiable constraints
|
|
206
|
+
- directives.behavioral_directives — per-turn instructions
|
|
207
|
+
- process.phase_template — phase sequence to follow (instant→RESPOND, fast→OBSERVE/RESPOND, standard→OBSERVE/PLAN/BUILD/VERIFY, extended+→full 7-phase)
|
|
208
|
+
- enrichment.data.reasoning — RE + ISC scaffold when present
|
|
209
|
+
- classification.effort_level — determines depth of response
|
|
210
|
+
- memory.search_results — pre-loaded context from knowledge graph
|
|
211
|
+
|
|
212
|
+
Use gramatr MCP tools for memory (search_semantic, create_entity, add_observation). Never maintain local notes or files.
|
|
213
|
+
|
|
214
|
+
After non-trivial work, call gramatr_classification_feedback to train the classifier. In LEARN phase, call gramatr_save_reflection to capture what worked and what didn't.
|
|
158
215
|
|
|
159
|
-
|
|
160
|
-
\`data\` as the canonical payload.
|
|
216
|
+
Entity types are validated server-side. Call gramatr_list_entity_types for valid types. Required fields: task/milestone need status, decision needs status + project_id.
|
|
161
217
|
|
|
162
|
-
|
|
163
|
-
1. Call \`gramatr_classification_feedback\` with the original prompt — evaluates if effort, intent, and skills were classified correctly. This trains the classifier.
|
|
164
|
-
2. Call \`gramatr_save_reflection\` — captures what worked, what didn't, what a smarter AI would do differently. This feeds the learning pipeline.
|
|
165
|
-
Skipping these breaks the training flywheel. Without feedback, the classifier never improves.
|
|
218
|
+
For continuity questions ("what were we doing?"), call gramatr_load_handoff then search_semantic for detail.
|
|
166
219
|
|
|
167
|
-
For
|
|
168
|
-
call \`gramatr_load_handoff\` before answering, then \`search_semantic\`.`;
|
|
220
|
+
For common retrieval, prefer gramatr_execute_intent over chaining low-level tools.`;
|
|
169
221
|
}
|
|
170
222
|
//# sourceMappingURL=instructions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/setup/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/setup/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAe5D,6BAA6B;AAC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"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../src/setup/integrations.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAAC,CAAC;CAClD;AAYD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AA8DnD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAExE;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAEvE;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpD,OAAO,EAAE,gBAAgB,GACxB,gBAAgB,CAyBlB;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAalE;AAMD,wBAAgB,yBAAyB,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAIhF"}
|
|
@@ -1,47 +1,33 @@
|
|
|
1
|
+
import { CLAUDE_CODE_HOOKS as CLAUDE_CODE_PLATFORM, CODEX_HOOKS as CODEX_PLATFORM, } from './generated/platform-hooks.js';
|
|
1
2
|
export const MCP_HOOK_BIN_RELATIVE = 'bin/gramatr';
|
|
2
3
|
const TS_RUNNER = 'npx tsx';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
event: 'UserPromptSubmit',
|
|
32
|
-
mcpHookName: 'user-prompt-submit',
|
|
33
|
-
hookArgs: ['--codex'],
|
|
34
|
-
statusMessage: 'Routing request through gramatr',
|
|
35
|
-
timeout: 15,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
event: 'Stop',
|
|
39
|
-
mcpHookName: 'stop',
|
|
40
|
-
hookArgs: ['--codex'],
|
|
41
|
-
statusMessage: 'Submitting gramatr classification feedback',
|
|
42
|
-
timeout: 10,
|
|
43
|
-
},
|
|
44
|
-
];
|
|
4
|
+
/**
|
|
5
|
+
* Converts a generated PlatformConfig into the HookSpec[] format used by buildHooksFile.
|
|
6
|
+
* The client_flag from the platform config becomes the hookArgs (e.g. "--claude-code").
|
|
7
|
+
*/
|
|
8
|
+
function platformToHookSpecs(platform) {
|
|
9
|
+
const specs = [];
|
|
10
|
+
const clientFlag = platform.client_flag !== 'none' ? platform.client_flag : undefined;
|
|
11
|
+
for (const [event, entries] of Object.entries(platform.hooks)) {
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
const spec = {
|
|
14
|
+
event,
|
|
15
|
+
mcpHookName: entry.hook,
|
|
16
|
+
hookArgs: clientFlag ? [clientFlag] : undefined,
|
|
17
|
+
};
|
|
18
|
+
if (entry.matcher)
|
|
19
|
+
spec.matcher = entry.matcher;
|
|
20
|
+
if (entry.statusMessage)
|
|
21
|
+
spec.statusMessage = entry.statusMessage;
|
|
22
|
+
if (entry.timeout)
|
|
23
|
+
spec.timeout = entry.timeout;
|
|
24
|
+
specs.push(spec);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return specs;
|
|
28
|
+
}
|
|
29
|
+
const CLAUDE_HOOKS = platformToHookSpecs(CLAUDE_CODE_PLATFORM);
|
|
30
|
+
const CODEX_HOOKS = platformToHookSpecs(CODEX_PLATFORM);
|
|
45
31
|
function buildHookCommand(clientDir, spec) {
|
|
46
32
|
if (spec.mcpHookName) {
|
|
47
33
|
const args = spec.hookArgs?.length ? ` ${spec.hookArgs.join(' ')}` : '';
|
|
@@ -113,6 +99,9 @@ export function ensureCodexHooksFeature(configToml) {
|
|
|
113
99
|
const prefix = text ? `${text}\n\n` : '';
|
|
114
100
|
return `${prefix}[features]\ncodex_hooks = true\n`;
|
|
115
101
|
}
|
|
102
|
+
// OpenCode uses a plugin-based architecture instead of hooks.json files.
|
|
103
|
+
// The gramatr plugin scaffold lives at setup/examples/gramatr-opencode-plugin.ts.
|
|
104
|
+
// No OPENCODE_HOOKS array is needed here — lifecycle events are handled by the plugin.
|
|
116
105
|
export function buildClaudeMcpServerEntry() {
|
|
117
106
|
return {
|
|
118
107
|
command: '~/.gramatr/bin/gramatr',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/setup/integrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../src/setup/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,IAAI,oBAAoB,EACzC,WAAW,IAAI,cAAc,GAG9B,MAAM,+BAA+B,CAAC;AA4BvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAEnD,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B;;;GAGG;AACH,SAAS,mBAAmB,CAAC,QAAwB;IACnD,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,KAAK,M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AC,IAAI,CAAC,EAAE,CAAC;QACvC,IAAI,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,oBAAoB,CAAC,IAAI,CAAC;QAC9E,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,gCAAgC,CAAC,IAAI,CAAC;IACxF,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,OAAO,GAAG,MAAM,kCAAkC,CAAC;AACrD,CAAC;AAED,yEAAyE;AACzE,kFAAkF;AAClF,uFAAuF;AAEvF,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,OAAO,EAAE,wBAAwB;KAClC,CAAC;AACJ,CAAC"}
|
package/dist/setup/targets.d.ts
CHANGED
|
@@ -38,6 +38,9 @@ export declare function getChatgptDesktopConfigPath(home: string, platform?: str
|
|
|
38
38
|
export declare function getCursorConfigPath(home: string): string;
|
|
39
39
|
export declare function getWindsurfConfigPath(home: string): string;
|
|
40
40
|
export declare function getVscodeConfigPath(home: string): string;
|
|
41
|
+
export declare function getOpenCodeConfigPath(home: string): string;
|
|
42
|
+
export declare function getOpenCodeProjectConfigPath(): string;
|
|
43
|
+
export declare function buildOpenCodeMcpServerEntry(home: string, serverUrl: string, platform?: string): McpCommandServerEntry;
|
|
41
44
|
export declare function getGeminiExtensionDir(home: string): string;
|
|
42
45
|
export declare function getGeminiHooksPath(home: string): string;
|
|
43
46
|
export declare function getGeminiManifestPath(home: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../../src/setup/targets.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAA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AC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAyB,GAAG,qBAAqB,CASvI;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAyB,GAAG,qBAAqB,CASpI;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,qBAAqB,GAAG,aAAa,CAQzG;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAYrG;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAyB,GAAG,eAAe,CA8CvG"}
|
package/dist/setup/targets.js
CHANGED
|
@@ -20,6 +20,22 @@ export function getWindsurfConfigPath(home) {
|
|
|
20
20
|
export function getVscodeConfigPath(home) {
|
|
21
21
|
return join(home, '.vscode', 'mcp.json');
|
|
22
22
|
}
|
|
23
|
+
export function getOpenCodeConfigPath(home) {
|
|
24
|
+
return join(home, '.config', 'opencode', 'config.json');
|
|
25
|
+
}
|
|
26
|
+
export function getOpenCodeProjectConfigPath() {
|
|
27
|
+
return 'opencode.json';
|
|
28
|
+
}
|
|
29
|
+
export function buildOpenCodeMcpServerEntry(home, serverUrl, platform = process.platform) {
|
|
30
|
+
const binaryName = platform === 'win32' ? 'gramatr.exe' : 'gramatr';
|
|
31
|
+
return {
|
|
32
|
+
command: join(home, '.gramatr', 'bin', binaryName),
|
|
33
|
+
env: {
|
|
34
|
+
GRAMATR_DIR: join(home, '.gramatr'),
|
|
35
|
+
GRAMATR_URL: serverUrl,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
23
39
|
export function getGeminiExtensionDir(home) {
|
|
24
40
|
return join(home, '.gemini', 'extensions', 'gramatr');
|
|
25
41
|
}
|
|
@@ -71,7 +87,7 @@ export function buildGeminiHooksFile(home, platform = process.platform) {
|
|
|
71
87
|
hooks: [
|
|
72
88
|
{
|
|
73
89
|
type: 'command',
|
|
74
|
-
command: `${hookBase} session-start`,
|
|
90
|
+
command: `${hookBase} session-start --gemini`,
|
|
75
91
|
name: 'gramatr-session-start',
|
|
76
92
|
timeout: 15,
|
|
77
93
|
description: 'Load gramatr session context and handoff',
|
|
@@ -84,7 +100,7 @@ export function buildGeminiHooksFile(home, platform = process.platform) {
|
|
|
84
100
|
hooks: [
|
|
85
101
|
{
|
|
86
102
|
type: 'command',
|
|
87
|
-
command: `${hookBase} user-prompt-submit`,
|
|
103
|
+
command: `${hookBase} user-prompt-submit --gemini`,
|
|
88
104
|
name: 'gramatr-prompt-routing',
|
|
89
105
|
timeout: 15,
|
|
90
106
|
description: 'Route prompt through gramatr intelligence',
|
|
@@ -97,7 +113,7 @@ export function buildGeminiHooksFile(home, platform = process.platform) {
|
|
|
97
113
|
hooks: [
|
|
98
114
|
{
|
|
99
115
|
type: 'command',
|
|
100
|
-
command: `${hookBase} stop`,
|
|
116
|
+
command: `${hookBase} stop --gemini`,
|
|
101
117
|
name: 'gramatr-session-end',
|
|
102
118
|
timeout: 10,
|
|
103
119
|
description: 'Submit classification feedback to gramatr',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../../src/setup/targets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA2CjC,MAAM,UAAU,0BAA0B,CAAC,IAAY,EAAE,WAAmB,OAAO,CAAC,QAAQ;IAC1F,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAA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AO,EAAE,EAAE;4BACX,WAAW,EAAE,2CAA2C;yBACzD;qBACF;iBACF;aACF;YACD,UAAU,EAAE;gBACV;oBACE,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,SAAS;4BACf,OAAO,EAAE,GAAG,QAAQ,gBAAgB;4BACpC,IAAI,EAAE,qBAAqB;4BAC3B,OAAO,EAAE,EAAE;4BACX,WAAW,EAAE,2CAA2C;yBACzD;qBACF;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gramatr/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
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": {
|