@gramatr/mcp 0.7.6 → 0.7.13
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/__mocks__/bun-sqlite.d.ts +35 -0
- package/dist/__mocks__/bun-sqlite.d.ts.map +1 -0
- package/dist/__mocks__/bun-sqlite.js +89 -0
- package/dist/__mocks__/bun-sqlite.js.map +1 -0
- package/dist/bin/build-mcpb.d.ts +2 -5
- package/dist/bin/build-mcpb.d.ts.map +1 -1
- package/dist/bin/build-mcpb.js +20 -43
- package/dist/bin/build-mcpb.js.map +1 -1
- package/dist/bin/gramatr-mcp.d.ts +13 -0
- package/dist/bin/gramatr-mcp.d.ts.map +1 -1
- package/dist/bin/gramatr-mcp.js +190 -9
- package/dist/bin/gramatr-mcp.js.map +1 -1
- package/dist/bin/login.d.ts.map +1 -1
- package/dist/bin/login.js +5 -0
- package/dist/bin/login.js.map +1 -1
- package/dist/bin/setup.d.ts +27 -10
- package/dist/bin/setup.d.ts.map +1 -1
- package/dist/bin/setup.js +628 -29
- package/dist/bin/setup.js.map +1 -1
- package/dist/cache/lru-cache.js +1 -1
- package/dist/config-runtime.d.ts +13 -0
- package/dist/config-runtime.d.ts.map +1 -1
- package/dist/config-runtime.js +24 -0
- package/dist/config-runtime.js.map +1 -1
- package/dist/gramatr +0 -0
- package/dist/hooks/input-validator.d.ts.map +1 -1
- package/dist/hooks/input-validator.js +27 -9
- package/dist/hooks/input-validator.js.map +1 -1
- package/dist/hooks/lib/client-runtime.d.ts +7 -0
- package/dist/hooks/lib/client-runtime.d.ts.map +1 -0
- package/dist/hooks/lib/client-runtime.js +22 -0
- package/dist/hooks/lib/client-runtime.js.map +1 -0
- package/dist/hooks/lib/hook-state.d.ts +7 -2
- package/dist/hooks/lib/hook-state.d.ts.map +1 -1
- package/dist/hooks/lib/hook-state.js +56 -35
- package/dist/hooks/lib/hook-state.js.map +1 -1
- package/dist/hooks/lib/intelligence.d.ts.map +1 -1
- package/dist/hooks/lib/intelligence.js +229 -427
- package/dist/hooks/lib/intelligence.js.map +1 -1
- package/dist/hooks/lib/routing.d.ts +6 -1
- package/dist/hooks/lib/routing.d.ts.map +1 -1
- package/dist/hooks/lib/routing.js +35 -11
- package/dist/hooks/lib/routing.js.map +1 -1
- package/dist/hooks/lib/session.d.ts.map +1 -1
- package/dist/hooks/lib/session.js +3 -4
- package/dist/hooks/lib/session.js.map +1 -1
- package/dist/hooks/lib/tool-envelope.d.ts +9 -0
- package/dist/hooks/lib/tool-envelope.d.ts.map +1 -0
- package/dist/hooks/lib/tool-envelope.js +24 -0
- package/dist/hooks/lib/tool-envelope.js.map +1 -0
- package/dist/hooks/lib/types.d.ts +7 -0
- package/dist/hooks/lib/types.d.ts.map +1 -1
- package/dist/hooks/lib/version.d.ts.map +1 -1
- package/dist/hooks/lib/version.js +3 -0
- package/dist/hooks/lib/version.js.map +1 -1
- package/dist/hooks/rating-capture.d.ts.map +1 -1
- package/dist/hooks/rating-capture.js +7 -2
- package/dist/hooks/rating-capture.js.map +1 -1
- package/dist/hooks/session-end.d.ts.map +1 -1
- package/dist/hooks/session-end.js +8 -6
- 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 +39 -13
- package/dist/hooks/session-start.js.map +1 -1
- package/dist/hooks/stop.d.ts.map +1 -1
- package/dist/hooks/stop.js +18 -6
- package/dist/hooks/stop.js.map +1 -1
- package/dist/hooks/user-prompt-submit.d.ts.map +1 -1
- package/dist/hooks/user-prompt-submit.js +24 -11
- package/dist/hooks/user-prompt-submit.js.map +1 -1
- package/dist/intelligence/packet2-fetcher.d.ts +2 -2
- package/dist/intelligence/packet2-fetcher.d.ts.map +1 -1
- package/dist/intelligence/packet2-fetcher.js +24 -5
- package/dist/intelligence/packet2-fetcher.js.map +1 -1
- package/dist/intelligence/session-manager.d.ts.map +1 -1
- package/dist/intelligence/session-manager.js +25 -1
- package/dist/intelligence/session-manager.js.map +1 -1
- package/dist/proxy/tool-proxy.d.ts.map +1 -1
- package/dist/proxy/tool-proxy.js +57 -11
- package/dist/proxy/tool-proxy.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +8 -9
- package/dist/server/server.js.map +1 -1
- package/dist/setup/instructions.d.ts +2 -2
- package/dist/setup/instructions.d.ts.map +1 -1
- package/dist/setup/instructions.js +40 -5
- package/dist/setup/instructions.js.map +1 -1
- package/dist/setup/integrations.d.ts +1 -1
- package/dist/setup/integrations.d.ts.map +1 -1
- package/dist/setup/integrations.js +7 -4
- package/dist/setup/integrations.js.map +1 -1
- package/dist/setup/targets.d.ts +1 -1
- package/dist/setup/targets.d.ts.map +1 -1
- package/dist/setup/targets.js +2 -3
- package/dist/setup/targets.js.map +1 -1
- package/dist/setup/web-connector.d.ts.map +1 -1
- package/dist/setup/web-connector.js +6 -0
- package/dist/setup/web-connector.js.map +1 -1
- package/package.json +10 -7
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bun-sqlite.ts — Vitest compatibility shim for bun:sqlite.
|
|
3
|
+
*
|
|
4
|
+
* In production, hook-state.ts imports from 'bun:sqlite' and runs inside the
|
|
5
|
+
* compiled Bun binary. In the Node/vitest test environment, 'bun:sqlite' is
|
|
6
|
+
* unavailable. This shim maps the bun:sqlite API surface to better-sqlite3
|
|
7
|
+
* so the 54 test files can keep running under Node without changes.
|
|
8
|
+
*
|
|
9
|
+
* Key differences handled here:
|
|
10
|
+
* - bun:sqlite named params require @-prefixed keys ({ '@session_id': val });
|
|
11
|
+
* better-sqlite3 requires plain keys ({ session_id: val }). Shim strips the prefix.
|
|
12
|
+
* - bun:sqlite positional params are passed as individual args or an array.
|
|
13
|
+
* better-sqlite3 accepts the same. Scalars pass through unchanged.
|
|
14
|
+
* - bun:sqlite .run() returns void; changes() must be queried via SELECT changes().
|
|
15
|
+
* better-sqlite3 returns a RunResult with .changes — handled transparently.
|
|
16
|
+
*/
|
|
17
|
+
import BetterSqlite3 from 'better-sqlite3';
|
|
18
|
+
type ScalarParam = string | number | bigint | boolean | null | undefined;
|
|
19
|
+
type Params = Record<string, ScalarParam> | ScalarParam[] | ScalarParam;
|
|
20
|
+
declare class Statement<T = unknown> {
|
|
21
|
+
private stmt;
|
|
22
|
+
constructor(stmt: BetterSqlite3.Statement);
|
|
23
|
+
run(...args: Params[]): void;
|
|
24
|
+
get(...args: Params[]): T | null;
|
|
25
|
+
all(...args: Params[]): T[];
|
|
26
|
+
}
|
|
27
|
+
export declare class Database {
|
|
28
|
+
private db;
|
|
29
|
+
constructor(path: string);
|
|
30
|
+
exec(sql: string): void;
|
|
31
|
+
query<T = unknown>(sql: string): Statement<T>;
|
|
32
|
+
close(): void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=bun-sqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun-sqlite.d.ts","sourceRoot":"","sources":["../../src/__mocks__/bun-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAE3C,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AACzE,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,WAAW,EAAE,GAAG,WAAW,CAAC;AAcxE,cAAM,SAAS,CAAC,CAAC,GAAG,OAAO;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa,CAAC,SAAS;IAEjD,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAW5B,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAahC,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE;CAY5B;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,EAAE,CAAyB;gBAEvB,IAAI,EAAE,MAAM;IAIxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIvB,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAI7C,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bun-sqlite.ts — Vitest compatibility shim for bun:sqlite.
|
|
3
|
+
*
|
|
4
|
+
* In production, hook-state.ts imports from 'bun:sqlite' and runs inside the
|
|
5
|
+
* compiled Bun binary. In the Node/vitest test environment, 'bun:sqlite' is
|
|
6
|
+
* unavailable. This shim maps the bun:sqlite API surface to better-sqlite3
|
|
7
|
+
* so the 54 test files can keep running under Node without changes.
|
|
8
|
+
*
|
|
9
|
+
* Key differences handled here:
|
|
10
|
+
* - bun:sqlite named params require @-prefixed keys ({ '@session_id': val });
|
|
11
|
+
* better-sqlite3 requires plain keys ({ session_id: val }). Shim strips the prefix.
|
|
12
|
+
* - bun:sqlite positional params are passed as individual args or an array.
|
|
13
|
+
* better-sqlite3 accepts the same. Scalars pass through unchanged.
|
|
14
|
+
* - bun:sqlite .run() returns void; changes() must be queried via SELECT changes().
|
|
15
|
+
* better-sqlite3 returns a RunResult with .changes — handled transparently.
|
|
16
|
+
*/
|
|
17
|
+
import BetterSqlite3 from 'better-sqlite3';
|
|
18
|
+
function normaliseParams(params) {
|
|
19
|
+
if (params === undefined || params === null)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (Array.isArray(params))
|
|
22
|
+
return params;
|
|
23
|
+
if (typeof params !== 'object')
|
|
24
|
+
return [params]; // scalar → positional array
|
|
25
|
+
// Named param object: strip @, $, : prefix from each key
|
|
26
|
+
return Object.fromEntries(Object.entries(params).map(([k, v]) => [k.replace(/^[@$:]/, ''), v]));
|
|
27
|
+
}
|
|
28
|
+
class Statement {
|
|
29
|
+
stmt;
|
|
30
|
+
constructor(stmt) {
|
|
31
|
+
this.stmt = stmt;
|
|
32
|
+
}
|
|
33
|
+
run(...args) {
|
|
34
|
+
const params = args.length === 0 ? undefined : args.length === 1 ? normaliseParams(args[0]) : args;
|
|
35
|
+
if (params === undefined) {
|
|
36
|
+
this.stmt.run();
|
|
37
|
+
}
|
|
38
|
+
else if (Array.isArray(params)) {
|
|
39
|
+
this.stmt.run(...params);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.stmt.run(params);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
get(...args) {
|
|
46
|
+
const params = args.length === 0 ? undefined : args.length === 1 ? normaliseParams(args[0]) : args;
|
|
47
|
+
let result;
|
|
48
|
+
if (params === undefined) {
|
|
49
|
+
result = this.stmt.get();
|
|
50
|
+
}
|
|
51
|
+
else if (Array.isArray(params)) {
|
|
52
|
+
result = this.stmt.get(...params);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
result = this.stmt.get(params);
|
|
56
|
+
}
|
|
57
|
+
return (result ?? null);
|
|
58
|
+
}
|
|
59
|
+
all(...args) {
|
|
60
|
+
const params = args.length === 0 ? undefined : args.length === 1 ? normaliseParams(args[0]) : args;
|
|
61
|
+
let result;
|
|
62
|
+
if (params === undefined) {
|
|
63
|
+
result = this.stmt.all();
|
|
64
|
+
}
|
|
65
|
+
else if (Array.isArray(params)) {
|
|
66
|
+
result = this.stmt.all(...params);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
result = this.stmt.all(params);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export class Database {
|
|
75
|
+
db;
|
|
76
|
+
constructor(path) {
|
|
77
|
+
this.db = new BetterSqlite3(path);
|
|
78
|
+
}
|
|
79
|
+
exec(sql) {
|
|
80
|
+
this.db.exec(sql);
|
|
81
|
+
}
|
|
82
|
+
query(sql) {
|
|
83
|
+
return new Statement(this.db.prepare(sql));
|
|
84
|
+
}
|
|
85
|
+
close() {
|
|
86
|
+
this.db.close();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=bun-sqlite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun-sqlite.js","sourceRoot":"","sources":["../../src/__mocks__/bun-sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAK3C,SAAS,eAAe,CAAC,MAAc;IACrC,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACzC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;IAC7E,yDAAyD;IACzD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAqC,CAAC,CAAC,GAAG,CACvD,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CACzC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,SAAS;IACO;IAApB,YAAoB,IAA6B;QAA7B,SAAI,GAAJ,IAAI,CAAyB;IAAG,CAAC;IAErD,GAAG,CAAC,GAAG,IAAc;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnG,IAAI,MAAM,KAAK,SAAS,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C,IAAI,CAAC;QACnG,IAAI,MAAiB,CAAC;QACtB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACjC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,MAAwB,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAiC,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,MAAa,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,QAAQ;IACX,EAAE,CAAyB;IAEnC,YAAY,IAAY;QACtB,IAAI,CAAC,EAAE,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,CAAC,GAAW;QACd,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,KAAK,CAAc,GAAW;QAC5B,OAAO,IAAI,SAAS,CAAI,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF"}
|
package/dist/bin/build-mcpb.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ interface McpbManifest {
|
|
|
20
20
|
keywords: string[];
|
|
21
21
|
icon?: string;
|
|
22
22
|
server: {
|
|
23
|
-
type: '
|
|
23
|
+
type: 'binary';
|
|
24
24
|
entry_point: string;
|
|
25
25
|
mcp_config: {
|
|
26
|
-
command:
|
|
26
|
+
command: string;
|
|
27
27
|
args: string[];
|
|
28
28
|
env: Record<string, string>;
|
|
29
29
|
};
|
|
@@ -38,9 +38,6 @@ interface McpbManifest {
|
|
|
38
38
|
compatibility: {
|
|
39
39
|
claude_desktop: string;
|
|
40
40
|
platforms: string[];
|
|
41
|
-
runtimes: {
|
|
42
|
-
node: string;
|
|
43
|
-
};
|
|
44
41
|
};
|
|
45
42
|
privacy_policies: string[];
|
|
46
43
|
tools_generated: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-mcpb.d.ts","sourceRoot":"","sources":["../../src/bin/build-mcpb.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"build-mcpb.d.ts","sourceRoot":"","sources":["../../src/bin/build-mcpb.ts"],"names":[],"mappings":";AAqBA,UAAU,YAAY;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE;YACV,OAAO,EAAE,MAAM,CAAC;YAChB,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAC7B,CAAC;KACH,CAAC;IACF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC1H,aAAa,EAAE;QACb,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAgBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAkD3D;AAqDD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAa7H"}
|
package/dist/bin/build-mcpb.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
|
|
3
3
|
import { execFileSync } from 'node:child_process';
|
|
4
4
|
import { dirname, join, resolve } from 'node:path';
|
|
5
|
-
import { createRequire } from 'node:module';
|
|
6
5
|
import { fileURLToPath } from 'node:url';
|
|
7
6
|
import { getGramatrUrlFromEnv } from '../config-runtime.js';
|
|
8
7
|
const currentFile = fileURLToPath(import.meta.url);
|
|
9
8
|
const binDir = dirname(currentFile);
|
|
10
9
|
const packageDir = dirname(dirname(binDir));
|
|
11
10
|
const repoRoot = dirname(dirname(packageDir));
|
|
12
|
-
const require = createRequire(import.meta.url);
|
|
13
11
|
function readPackageJson(path) {
|
|
14
12
|
return JSON.parse(readFileSync(path, 'utf8'));
|
|
15
13
|
}
|
|
@@ -44,11 +42,11 @@ export function buildManifest(version) {
|
|
|
44
42
|
keywords: ['ai', 'mcp', 'routing', 'memory', 'gramatr', 'claude-desktop'],
|
|
45
43
|
icon: 'icon.png',
|
|
46
44
|
server: {
|
|
47
|
-
type: '
|
|
48
|
-
entry_point: '
|
|
45
|
+
type: 'binary',
|
|
46
|
+
entry_point: 'bin/gramatr',
|
|
49
47
|
mcp_config: {
|
|
50
|
-
command: '
|
|
51
|
-
args: [
|
|
48
|
+
command: '${__dirname}/bin/gramatr',
|
|
49
|
+
args: [],
|
|
52
50
|
env: {
|
|
53
51
|
GRAMATR_API_KEY: '${user_config.api_key}',
|
|
54
52
|
GRAMATR_URL: mcpUrl,
|
|
@@ -67,7 +65,6 @@ export function buildManifest(version) {
|
|
|
67
65
|
compatibility: {
|
|
68
66
|
claude_desktop: '>=1.0.0',
|
|
69
67
|
platforms: ['darwin', 'win32'],
|
|
70
|
-
runtimes: { node: '>=20.0.0' },
|
|
71
68
|
},
|
|
72
69
|
privacy_policies: ['https://gramatr.com/privacy'],
|
|
73
70
|
tools_generated: true,
|
|
@@ -77,42 +74,19 @@ export function buildManifest(version) {
|
|
|
77
74
|
function ensureDir(path) {
|
|
78
75
|
mkdirSync(path, { recursive: true });
|
|
79
76
|
}
|
|
80
|
-
function resolvePackageRoot(packageName) {
|
|
81
|
-
return realpathSync(join(repoRoot, 'node_modules', ...packageName.split('/')));
|
|
82
|
-
}
|
|
83
|
-
function copyPackageRecursive(packageName, nodeModulesDir, seen = new Set()) {
|
|
84
|
-
if (seen.has(packageName))
|
|
85
|
-
return;
|
|
86
|
-
seen.add(packageName);
|
|
87
|
-
const packageRoot = resolvePackageRoot(packageName);
|
|
88
|
-
const packageJson = readPackageJson(join(packageRoot, 'package.json'));
|
|
89
|
-
const destination = join(nodeModulesDir, ...packageName.split('/'));
|
|
90
|
-
ensureDir(dirname(destination));
|
|
91
|
-
cpSync(packageRoot, destination, { recursive: true });
|
|
92
|
-
const dependencies = Object.keys(packageJson.dependencies || {});
|
|
93
|
-
const peerDependencies = Object.entries(packageJson.peerDependencies || {})
|
|
94
|
-
.filter(([name]) => !packageJson.peerDependenciesMeta?.[name]?.optional)
|
|
95
|
-
.map(([name]) => name);
|
|
96
|
-
for (const dependency of [...dependencies, ...peerDependencies]) {
|
|
97
|
-
copyPackageRecursive(dependency, nodeModulesDir, seen);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function writeRuntimePackageJson(bundleDir, version) {
|
|
101
|
-
const runtimePackage = {
|
|
102
|
-
name: 'gramatr-mcpb-runtime',
|
|
103
|
-
version,
|
|
104
|
-
private: true,
|
|
105
|
-
type: 'module',
|
|
106
|
-
};
|
|
107
|
-
writeFileSync(join(bundleDir, 'package.json'), `${JSON.stringify(runtimePackage, null, 2)}\n`, 'utf8');
|
|
108
|
-
}
|
|
109
77
|
function writeManifest(bundleDir, manifest) {
|
|
110
78
|
writeFileSync(join(bundleDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
111
79
|
}
|
|
112
|
-
function copyRuntimeFiles(bundleDir
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
80
|
+
function copyRuntimeFiles(bundleDir) {
|
|
81
|
+
const binDestDir = join(bundleDir, 'bin');
|
|
82
|
+
ensureDir(binDestDir);
|
|
83
|
+
const binaryName = process.platform === 'win32' ? 'gramatr.exe' : 'gramatr';
|
|
84
|
+
const binarySrc = join(packageDir, 'dist', binaryName);
|
|
85
|
+
const binaryDest = join(binDestDir, binaryName);
|
|
86
|
+
copyFileSync(binarySrc, binaryDest);
|
|
87
|
+
if (process.platform !== 'win32') {
|
|
88
|
+
chmodSync(binaryDest, 0o755);
|
|
89
|
+
}
|
|
116
90
|
const licensePath = join(repoRoot, 'LICENSE');
|
|
117
91
|
if (existsSync(licensePath)) {
|
|
118
92
|
copyFileSync(licensePath, join(bundleDir, 'LICENSE'));
|
|
@@ -141,7 +115,7 @@ export function buildMcpb(outDir, version) {
|
|
|
141
115
|
rmSync(stagingDir, { recursive: true, force: true });
|
|
142
116
|
ensureDir(stagingDir);
|
|
143
117
|
writeManifest(stagingDir, manifest);
|
|
144
|
-
copyRuntimeFiles(stagingDir
|
|
118
|
+
copyRuntimeFiles(stagingDir);
|
|
145
119
|
buildArchive(stagingDir, archivePath);
|
|
146
120
|
return { bundleDir: stagingDir, archivePath, manifest };
|
|
147
121
|
}
|
|
@@ -159,5 +133,8 @@ function main() {
|
|
|
159
133
|
process.stdout.write(` Version: ${version}\n`);
|
|
160
134
|
process.stdout.write(` Entry: ${result.manifest.server.entry_point}\n`);
|
|
161
135
|
}
|
|
162
|
-
|
|
136
|
+
const invokedAsScript = process.argv[1] ? resolve(process.argv[1]) === currentFile : false;
|
|
137
|
+
if (invokedAsScript) {
|
|
138
|
+
main();
|
|
139
|
+
}
|
|
163
140
|
//# sourceMappingURL=build-mcpb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-mcpb.js","sourceRoot":"","sources":["../../src/bin/build-mcpb.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"build-mcpb.js","sourceRoot":"","sources":["../../src/bin/build-mcpb.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAA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AAC,CAAC;IACtH,SAAS,CAAC,MAAM,CAAC,CAAC;IAElB,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE1C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,OAAO,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3F,IAAI,eAAe,EAAE,CAAC;IACpB,IAAI,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -9,13 +9,25 @@
|
|
|
9
9
|
* gramatr-mcp logout Remove stored credentials
|
|
10
10
|
* gramatr-mcp clear-creds Remove all stored local credentials
|
|
11
11
|
* gramatr-mcp setup claude Auto-configure Claude Code settings and hooks
|
|
12
|
+
* gramatr-mcp setup claude --clean-install Remove legacy Claude/PAI/Fabric artifacts first
|
|
12
13
|
* gramatr-mcp setup codex Auto-configure Codex hook settings
|
|
13
14
|
* gramatr-mcp setup claude-desktop Auto-configure Claude Desktop MCP settings
|
|
14
15
|
* gramatr-mcp setup chatgpt-desktop Auto-configure ChatGPT Desktop MCP settings
|
|
15
16
|
* gramatr-mcp setup gemini Auto-configure Gemini CLI extension files
|
|
17
|
+
* gramatr-mcp setup cursor Auto-configure Cursor MCP settings
|
|
18
|
+
* gramatr-mcp setup windsurf Auto-configure Windsurf MCP settings
|
|
19
|
+
* gramatr-mcp setup vscode Auto-configure VS Code MCP settings
|
|
20
|
+
* gramatr-mcp setup all Configure all supported local clients
|
|
21
|
+
* gramatr-mcp setup auto Auto-detect and install detected local clients
|
|
22
|
+
* gramatr-mcp setup auto --list List detected install targets only
|
|
23
|
+
* gramatr-mcp setup auto --yes Install all detected targets (non-interactive)
|
|
16
24
|
* gramatr-mcp setup web Show web connector instructions + prompt suggestion
|
|
17
25
|
* gramatr-mcp setup web chatgpt Show ChatGPT web connector instructions
|
|
18
26
|
* gramatr-mcp setup web gemini Show Gemini web connector instructions
|
|
27
|
+
* gramatr-mcp setup clean-install Clean artifacts, then reinstall all supported local clients
|
|
28
|
+
* gramatr-mcp setup verify [target] Verify local MCP/hook install health
|
|
29
|
+
* gramatr-mcp setup verify --json Emit verification results as JSON
|
|
30
|
+
* gramatr-mcp setup verify --show-prompts Include install guidance prompts in verify output
|
|
19
31
|
* gramatr-mcp build-mcpb Build a Claude Desktop .mcpb manifest bundle
|
|
20
32
|
* gramatr-mcp hook <name> [args...] Run a hook (session-start, ...)
|
|
21
33
|
* gramatr-mcp hook --list List registered hooks
|
|
@@ -32,6 +44,7 @@
|
|
|
32
44
|
* client hooks (Claude Code, Codex, Gemini) invoke this binary directly
|
|
33
45
|
* instead of shipping duplicated TypeScript in each integration package.
|
|
34
46
|
*/
|
|
47
|
+
export declare function parseAutoTargetSelection(raw: string, detected: string[]): string[] | null;
|
|
35
48
|
export declare function printHelp(): void;
|
|
36
49
|
export declare function cliMain(cliArgs?: string[]): Promise<void>;
|
|
37
50
|
//# sourceMappingURL=gramatr-mcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gramatr-mcp.d.ts","sourceRoot":"","sources":["../../src/bin/gramatr-mcp.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"gramatr-mcp.d.ts","sourceRoot":"","sources":["../../src/bin/gramatr-mcp.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAkBH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAAE,GACjB,MAAM,EAAE,GAAG,IAAI,CAqBjB;AAqBD,wBAAgB,SAAS,IAAI,IAAI,CAwEhC;AAED,wBAAsB,OAAO,CAAC,OAAO,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA6NtF"}
|
package/dist/bin/gramatr-mcp.js
CHANGED
|
@@ -9,13 +9,25 @@
|
|
|
9
9
|
* gramatr-mcp logout Remove stored credentials
|
|
10
10
|
* gramatr-mcp clear-creds Remove all stored local credentials
|
|
11
11
|
* gramatr-mcp setup claude Auto-configure Claude Code settings and hooks
|
|
12
|
+
* gramatr-mcp setup claude --clean-install Remove legacy Claude/PAI/Fabric artifacts first
|
|
12
13
|
* gramatr-mcp setup codex Auto-configure Codex hook settings
|
|
13
14
|
* gramatr-mcp setup claude-desktop Auto-configure Claude Desktop MCP settings
|
|
14
15
|
* gramatr-mcp setup chatgpt-desktop Auto-configure ChatGPT Desktop MCP settings
|
|
15
16
|
* gramatr-mcp setup gemini Auto-configure Gemini CLI extension files
|
|
17
|
+
* gramatr-mcp setup cursor Auto-configure Cursor MCP settings
|
|
18
|
+
* gramatr-mcp setup windsurf Auto-configure Windsurf MCP settings
|
|
19
|
+
* gramatr-mcp setup vscode Auto-configure VS Code MCP settings
|
|
20
|
+
* gramatr-mcp setup all Configure all supported local clients
|
|
21
|
+
* gramatr-mcp setup auto Auto-detect and install detected local clients
|
|
22
|
+
* gramatr-mcp setup auto --list List detected install targets only
|
|
23
|
+
* gramatr-mcp setup auto --yes Install all detected targets (non-interactive)
|
|
16
24
|
* gramatr-mcp setup web Show web connector instructions + prompt suggestion
|
|
17
25
|
* gramatr-mcp setup web chatgpt Show ChatGPT web connector instructions
|
|
18
26
|
* gramatr-mcp setup web gemini Show Gemini web connector instructions
|
|
27
|
+
* gramatr-mcp setup clean-install Clean artifacts, then reinstall all supported local clients
|
|
28
|
+
* gramatr-mcp setup verify [target] Verify local MCP/hook install health
|
|
29
|
+
* gramatr-mcp setup verify --json Emit verification results as JSON
|
|
30
|
+
* gramatr-mcp setup verify --show-prompts Include install guidance prompts in verify output
|
|
19
31
|
* gramatr-mcp build-mcpb Build a Claude Desktop .mcpb manifest bundle
|
|
20
32
|
* gramatr-mcp hook <name> [args...] Run a hook (session-start, ...)
|
|
21
33
|
* gramatr-mcp hook --list List registered hooks
|
|
@@ -34,6 +46,56 @@
|
|
|
34
46
|
*/
|
|
35
47
|
import { VERSION } from '../hooks/lib/version.js';
|
|
36
48
|
import { fileURLToPath } from 'node:url';
|
|
49
|
+
import { createInterface } from 'node:readline/promises';
|
|
50
|
+
const ALL_LOCAL_SETUP_TARGETS = [
|
|
51
|
+
'claude',
|
|
52
|
+
'codex',
|
|
53
|
+
'gemini',
|
|
54
|
+
'claude-desktop',
|
|
55
|
+
'chatgpt-desktop',
|
|
56
|
+
'cursor',
|
|
57
|
+
'windsurf',
|
|
58
|
+
'vscode',
|
|
59
|
+
];
|
|
60
|
+
export function parseAutoTargetSelection(raw, detected) {
|
|
61
|
+
const normalized = raw.trim().toLowerCase();
|
|
62
|
+
if (!normalized)
|
|
63
|
+
return detected;
|
|
64
|
+
if (normalized === 'all' || normalized === '*')
|
|
65
|
+
return detected;
|
|
66
|
+
if (normalized === 'none' || normalized === 'cancel' || normalized === 'q' || normalized === 'quit')
|
|
67
|
+
return null;
|
|
68
|
+
const indexes = normalized
|
|
69
|
+
.split(',')
|
|
70
|
+
.map((chunk) => chunk.trim())
|
|
71
|
+
.filter(Boolean)
|
|
72
|
+
.map((chunk) => Number.parseInt(chunk, 10));
|
|
73
|
+
if (indexes.length === 0 || indexes.some((n) => Number.isNaN(n))) {
|
|
74
|
+
return detected;
|
|
75
|
+
}
|
|
76
|
+
const selected = indexes
|
|
77
|
+
.map((n) => detected[n - 1])
|
|
78
|
+
.filter((value) => typeof value === 'string');
|
|
79
|
+
return selected.length > 0 ? Array.from(new Set(selected)) : detected;
|
|
80
|
+
}
|
|
81
|
+
async function promptAutoTargetSelection(detected) {
|
|
82
|
+
const rl = createInterface({
|
|
83
|
+
input: process.stdin,
|
|
84
|
+
output: process.stderr,
|
|
85
|
+
});
|
|
86
|
+
try {
|
|
87
|
+
process.stderr.write('\n[gramatr-mcp] Select install targets for setup auto:\n');
|
|
88
|
+
detected.forEach((target, index) => {
|
|
89
|
+
process.stderr.write(` ${index + 1}. ${target}\n`);
|
|
90
|
+
});
|
|
91
|
+
process.stderr.write(' Enter numbers (e.g. 1,3,4), or `all`, or `none` to cancel.\n');
|
|
92
|
+
const answer = await rl.question(' Selection [all]: ');
|
|
93
|
+
return parseAutoTargetSelection(answer, detected);
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
rl.close();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
37
99
|
export function printHelp() {
|
|
38
100
|
process.stderr.write(`
|
|
39
101
|
gramatr-mcp — Local MCP server for grāmatr
|
|
@@ -49,13 +111,29 @@ export function printHelp() {
|
|
|
49
111
|
gramatr-mcp logout Remove stored credentials
|
|
50
112
|
gramatr-mcp clear-creds Remove all stored local credentials
|
|
51
113
|
gramatr-mcp setup claude Configure Claude Code to use this server
|
|
114
|
+
gramatr-mcp setup claude --clean-install
|
|
115
|
+
Remove legacy Claude + PAI/Fabric/AIOS artifacts first
|
|
52
116
|
gramatr-mcp setup codex Configure Codex hook wiring
|
|
53
117
|
gramatr-mcp setup claude-desktop Configure Claude Desktop to use this server
|
|
54
118
|
gramatr-mcp setup chatgpt-desktop Configure ChatGPT Desktop to use this server
|
|
55
119
|
gramatr-mcp setup gemini Configure Gemini CLI extension files
|
|
120
|
+
gramatr-mcp setup cursor Configure Cursor MCP wiring
|
|
121
|
+
gramatr-mcp setup windsurf Configure Windsurf MCP wiring
|
|
122
|
+
gramatr-mcp setup vscode Configure VS Code MCP wiring
|
|
123
|
+
gramatr-mcp setup all Configure all supported local clients
|
|
124
|
+
gramatr-mcp setup auto Detect and install supported local clients
|
|
125
|
+
gramatr-mcp setup auto --list List detected setup targets only
|
|
126
|
+
gramatr-mcp setup auto --yes Install all detected targets non-interactively
|
|
56
127
|
gramatr-mcp setup web Show claude.ai web connector setup + prompt
|
|
57
128
|
gramatr-mcp setup web chatgpt Show ChatGPT web connector setup + prompt
|
|
58
129
|
gramatr-mcp setup web gemini Show Gemini web connector setup + prompt
|
|
130
|
+
gramatr-mcp setup clean-install Clean stale artifacts + reinstall all supported local clients
|
|
131
|
+
gramatr-mcp setup <target> --show-prompts
|
|
132
|
+
Print optional prompt suggestions after setup writes files
|
|
133
|
+
gramatr-mcp setup verify [target] Verify install wiring (all|claude|codex|...)
|
|
134
|
+
gramatr-mcp setup verify --json Emit verify output as JSON
|
|
135
|
+
gramatr-mcp setup verify --show-prompts
|
|
136
|
+
Include install prompt guidance in verify output
|
|
59
137
|
gramatr-mcp build-mcpb Build a Claude Desktop .mcpb bundle
|
|
60
138
|
gramatr-mcp hook <name> [args...] Run a hook (stdin → stdout contract)
|
|
61
139
|
gramatr-mcp hook --list List registered hooks
|
|
@@ -69,9 +147,25 @@ export function printHelp() {
|
|
|
69
147
|
|
|
70
148
|
Setup:
|
|
71
149
|
gramatr-mcp setup claude Write MCP config to ~/.claude.json
|
|
150
|
+
gramatr-mcp setup claude --clean-install
|
|
151
|
+
Remove stale legacy artifacts before writing setup
|
|
72
152
|
gramatr-mcp setup claude-desktop Write Claude Desktop config
|
|
73
153
|
gramatr-mcp setup chatgpt-desktop Write ChatGPT Desktop config
|
|
74
154
|
gramatr-mcp setup gemini Write Gemini extension manifest/hooks
|
|
155
|
+
gramatr-mcp setup cursor Write Cursor MCP config
|
|
156
|
+
gramatr-mcp setup windsurf Write Windsurf MCP config
|
|
157
|
+
gramatr-mcp setup vscode Write VS Code MCP config
|
|
158
|
+
gramatr-mcp setup all Configure all supported local clients
|
|
159
|
+
gramatr-mcp setup auto Detect and install supported local clients
|
|
160
|
+
gramatr-mcp setup auto --list List detected setup targets only
|
|
161
|
+
gramatr-mcp setup auto --yes Install all detected targets non-interactively
|
|
162
|
+
gramatr-mcp setup clean-install Clean stale artifacts, then reinstall all supported local clients
|
|
163
|
+
gramatr-mcp setup <target> --show-prompts
|
|
164
|
+
Print optional prompt suggestions after setup writes files
|
|
165
|
+
gramatr-mcp setup verify Verify setup wiring + managed guidance blocks
|
|
166
|
+
gramatr-mcp setup verify --json Emit verify output as JSON
|
|
167
|
+
gramatr-mcp setup verify --show-prompts
|
|
168
|
+
Include install guidance prompts in verify output
|
|
75
169
|
gramatr-mcp setup claude --dry Preview without writing
|
|
76
170
|
`);
|
|
77
171
|
}
|
|
@@ -117,47 +211,82 @@ export async function cliMain(cliArgs = process.argv.slice(2)) {
|
|
|
117
211
|
if (cliArgs[0] === 'setup') {
|
|
118
212
|
const target = cliArgs[1];
|
|
119
213
|
const dryRun = cliArgs.includes('--dry');
|
|
214
|
+
const cleanInstall = cliArgs.includes('--clean-install') || cliArgs.includes('--clean');
|
|
215
|
+
const showPrompts = cliArgs.includes('--show-prompts');
|
|
216
|
+
const json = cliArgs.includes('--json');
|
|
120
217
|
if (target === 'claude') {
|
|
121
218
|
const { setupClaude } = await import('./setup.js');
|
|
122
|
-
setupClaude(dryRun);
|
|
219
|
+
setupClaude(dryRun, cleanInstall, showPrompts);
|
|
123
220
|
return;
|
|
124
221
|
}
|
|
125
222
|
if (target === 'codex') {
|
|
223
|
+
if (cleanInstall) {
|
|
224
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
225
|
+
runCleanInstall(dryRun);
|
|
226
|
+
}
|
|
126
227
|
const { setupCodex } = await import('./setup.js');
|
|
127
|
-
setupCodex(dryRun);
|
|
228
|
+
setupCodex(dryRun, showPrompts);
|
|
128
229
|
return;
|
|
129
230
|
}
|
|
130
231
|
if (target === 'claude-desktop') {
|
|
232
|
+
if (cleanInstall) {
|
|
233
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
234
|
+
runCleanInstall(dryRun);
|
|
235
|
+
}
|
|
131
236
|
const { setupClaudeDesktop } = await import('./setup.js');
|
|
132
|
-
setupClaudeDesktop(dryRun);
|
|
237
|
+
setupClaudeDesktop(dryRun, showPrompts);
|
|
133
238
|
return;
|
|
134
239
|
}
|
|
135
240
|
if (target === 'chatgpt-desktop') {
|
|
241
|
+
if (cleanInstall) {
|
|
242
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
243
|
+
runCleanInstall(dryRun);
|
|
244
|
+
}
|
|
136
245
|
const { setupChatgptDesktop } = await import('./setup.js');
|
|
137
|
-
setupChatgptDesktop(dryRun);
|
|
246
|
+
setupChatgptDesktop(dryRun, showPrompts);
|
|
138
247
|
return;
|
|
139
248
|
}
|
|
140
249
|
if (target === 'gemini') {
|
|
250
|
+
if (cleanInstall) {
|
|
251
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
252
|
+
runCleanInstall(dryRun);
|
|
253
|
+
}
|
|
141
254
|
const { setupGemini } = await import('./setup.js');
|
|
142
|
-
setupGemini(dryRun);
|
|
255
|
+
setupGemini(dryRun, showPrompts);
|
|
143
256
|
return;
|
|
144
257
|
}
|
|
145
258
|
if (target === 'cursor') {
|
|
259
|
+
if (cleanInstall) {
|
|
260
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
261
|
+
runCleanInstall(dryRun);
|
|
262
|
+
}
|
|
146
263
|
const { setupCursor } = await import('./setup.js');
|
|
147
|
-
setupCursor(dryRun);
|
|
264
|
+
setupCursor(dryRun, showPrompts);
|
|
148
265
|
return;
|
|
149
266
|
}
|
|
150
267
|
if (target === 'windsurf') {
|
|
268
|
+
if (cleanInstall) {
|
|
269
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
270
|
+
runCleanInstall(dryRun);
|
|
271
|
+
}
|
|
151
272
|
const { setupWindsurf } = await import('./setup.js');
|
|
152
|
-
setupWindsurf(dryRun);
|
|
273
|
+
setupWindsurf(dryRun, showPrompts);
|
|
153
274
|
return;
|
|
154
275
|
}
|
|
155
276
|
if (target === 'vscode') {
|
|
277
|
+
if (cleanInstall) {
|
|
278
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
279
|
+
runCleanInstall(dryRun);
|
|
280
|
+
}
|
|
156
281
|
const { setupVscode } = await import('./setup.js');
|
|
157
|
-
setupVscode(dryRun);
|
|
282
|
+
setupVscode(dryRun, showPrompts);
|
|
158
283
|
return;
|
|
159
284
|
}
|
|
160
285
|
if (target === 'web') {
|
|
286
|
+
if (cleanInstall) {
|
|
287
|
+
const { runCleanInstall } = await import('./setup.js');
|
|
288
|
+
runCleanInstall(dryRun);
|
|
289
|
+
}
|
|
161
290
|
const webTarget = cliArgs[2];
|
|
162
291
|
const resolved = webTarget === 'chatgpt' ? 'chatgpt-web'
|
|
163
292
|
: webTarget === 'gemini' ? 'gemini-web'
|
|
@@ -166,8 +295,60 @@ export async function cliMain(cliArgs = process.argv.slice(2)) {
|
|
|
166
295
|
await setupWeb(resolved);
|
|
167
296
|
return;
|
|
168
297
|
}
|
|
298
|
+
if (target === 'auto') {
|
|
299
|
+
const { setupAutoInstall, getAutoDetectedTargets } = await import('./setup.js');
|
|
300
|
+
const listOnly = cliArgs.includes('--list') || cliArgs.includes('--list-only');
|
|
301
|
+
const assumeYes = cliArgs.includes('--yes') || cliArgs.includes('-y');
|
|
302
|
+
const interactiveAllowed = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
303
|
+
let selectedTargets;
|
|
304
|
+
if (!listOnly && !assumeYes && interactiveAllowed) {
|
|
305
|
+
const detected = getAutoDetectedTargets();
|
|
306
|
+
const selected = await promptAutoTargetSelection(detected);
|
|
307
|
+
if (selected === null) {
|
|
308
|
+
process.stderr.write('[gramatr-mcp] setup auto cancelled.\n');
|
|
309
|
+
process.exit(1);
|
|
310
|
+
}
|
|
311
|
+
selectedTargets = selected;
|
|
312
|
+
}
|
|
313
|
+
setupAutoInstall({
|
|
314
|
+
dryRun,
|
|
315
|
+
cleanInstall,
|
|
316
|
+
listOnly,
|
|
317
|
+
selectedTargets,
|
|
318
|
+
showPrompts,
|
|
319
|
+
});
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
if (target === 'all') {
|
|
323
|
+
const { setupAutoInstall } = await import('./setup.js');
|
|
324
|
+
setupAutoInstall({
|
|
325
|
+
dryRun,
|
|
326
|
+
cleanInstall,
|
|
327
|
+
listOnly: false,
|
|
328
|
+
selectedTargets: ALL_LOCAL_SETUP_TARGETS,
|
|
329
|
+
showPrompts,
|
|
330
|
+
});
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (target === 'clean-install') {
|
|
334
|
+
const { setupAutoInstall } = await import('./setup.js');
|
|
335
|
+
setupAutoInstall({
|
|
336
|
+
dryRun,
|
|
337
|
+
cleanInstall: true,
|
|
338
|
+
listOnly: false,
|
|
339
|
+
selectedTargets: ALL_LOCAL_SETUP_TARGETS,
|
|
340
|
+
showPrompts,
|
|
341
|
+
});
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (target === 'verify') {
|
|
345
|
+
const verifyTargetRaw = cliArgs.find((arg, index) => index > 1 && !arg.startsWith('--')) || 'all';
|
|
346
|
+
const verifyTarget = verifyTargetRaw;
|
|
347
|
+
const { verifySetupInstall } = await import('./setup.js');
|
|
348
|
+
process.exit(verifySetupInstall(verifyTarget, { json, showPrompts }));
|
|
349
|
+
}
|
|
169
350
|
process.stderr.write(`[gramatr-mcp] Unknown setup target: ${target}\n`);
|
|
170
|
-
process.stderr.write(' Supported: claude | codex | claude-desktop | chatgpt-desktop | gemini | cursor | windsurf | vscode | web\n');
|
|
351
|
+
process.stderr.write(' Supported: claude | codex | claude-desktop | chatgpt-desktop | gemini | cursor | windsurf | vscode | all | auto | web | clean-install | verify\n');
|
|
171
352
|
process.exit(1);
|
|
172
353
|
}
|
|
173
354
|
// Default: start the stdio server. Lazy-loaded so the `hook` and `setup`
|