make-laten 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -51
- package/dist/cli/index.js +70 -110
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +70 -110
- package/dist/cli/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,49 +1,161 @@
|
|
|
1
1
|
# make-laten
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/make-laten)
|
|
4
|
+
[](https://github.com/sukirman1901/make-laten/blob/main/LICENSE)
|
|
5
|
+
[]()
|
|
6
|
+
|
|
7
|
+
Universal efficiency toolkit for AI coding agents — compress, cache, and optimize token usage across all platforms.
|
|
4
8
|
|
|
5
9
|
## What it does
|
|
6
10
|
|
|
7
11
|
make-laten reduces token consumption when working with AI coding agents by compressing outputs, caching results, and routing operations intelligently.
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
```
|
|
14
|
+
User → AI Agent → make-laten intercept → compress (60-90% savings) → return
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Token savings per command:**
|
|
18
|
+
|
|
19
|
+
| Command | Savings | Description |
|
|
20
|
+
|---------|---------|-------------|
|
|
21
|
+
| `read` | **89%** | Compressed file read — exports, classes, functions only |
|
|
22
|
+
| `grep` | **70%** | Grouped by file with line numbers |
|
|
23
|
+
| `git diff` | **60%** | Condensed hunks, only changes shown |
|
|
24
|
+
| `git status` | **65%** | Status summary |
|
|
25
|
+
| `fetch` | **75%** | Web content with semantic extraction |
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
**One command to set up everything:**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx make-laten init --all
|
|
33
|
+
```
|
|
10
34
|
|
|
11
|
-
|
|
35
|
+
This auto-detects your installed AI agents and configures MCP for each one.
|
|
36
|
+
|
|
37
|
+
**Or install globally first:**
|
|
12
38
|
|
|
13
39
|
```bash
|
|
14
40
|
npm install -g make-laten
|
|
41
|
+
make-laten init --all
|
|
15
42
|
```
|
|
16
43
|
|
|
17
|
-
##
|
|
44
|
+
## Setup Options
|
|
45
|
+
|
|
46
|
+
### Option 1: Init Wizard (Recommended)
|
|
18
47
|
|
|
19
48
|
```bash
|
|
20
|
-
#
|
|
21
|
-
make-laten
|
|
49
|
+
# Auto-configure all detected agents
|
|
50
|
+
npx make-laten init --all
|
|
51
|
+
|
|
52
|
+
# Per-project only (creates .mcp.json)
|
|
53
|
+
npx make-laten init --project
|
|
54
|
+
|
|
55
|
+
# Interactive (choose agents one by one)
|
|
56
|
+
npx make-laten init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Option 2: Global Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g make-laten
|
|
63
|
+
|
|
64
|
+
# Install shell aliases
|
|
65
|
+
make-laten install
|
|
66
|
+
|
|
67
|
+
# Or configure MCP for agents
|
|
68
|
+
make-laten init --all
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Option 3: Shell Aliases Only
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Add to ~/.zshrc or ~/.bashrc
|
|
75
|
+
source $(npm root -g)/make-laten/shell/init.sh
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This gives you short aliases:
|
|
79
|
+
|
|
80
|
+
| Alias | Command | Description |
|
|
81
|
+
|-------|---------|-------------|
|
|
82
|
+
| `mread` | `make-laten read` | Compressed file read |
|
|
83
|
+
| `mgrep` | `make-laten grep` | Grouped grep |
|
|
84
|
+
| `mdiff` | `make-laten git diff` | Compressed git diff |
|
|
85
|
+
| `mstatus` | `make-laten git status` | Git status summary |
|
|
86
|
+
| `msearch` | `make-laten search` | Web search |
|
|
87
|
+
| `mfetch` | `make-laten fetch` | Web fetch + compress |
|
|
88
|
+
|
|
89
|
+
## CLI Commands
|
|
22
90
|
|
|
23
|
-
|
|
24
|
-
|
|
91
|
+
```bash
|
|
92
|
+
# File operations
|
|
93
|
+
make-laten read src/index.ts # 89% savings
|
|
94
|
+
make-laten grep "TODO" src/ # grouped by file
|
|
95
|
+
make-laten grep "export" . --ignore ts
|
|
25
96
|
|
|
26
|
-
#
|
|
27
|
-
make-laten git diff
|
|
97
|
+
# Git operations
|
|
98
|
+
make-laten git diff # 60% savings
|
|
28
99
|
make-laten git diff --staged
|
|
29
100
|
make-laten git status
|
|
30
101
|
|
|
31
|
-
# Web
|
|
102
|
+
# Web operations
|
|
32
103
|
make-laten search "typescript generics"
|
|
33
|
-
|
|
34
|
-
# Web fetch + semantic extraction + compression
|
|
35
104
|
make-laten fetch https://docs.example.com
|
|
36
105
|
|
|
37
|
-
# Cache
|
|
106
|
+
# Cache
|
|
38
107
|
make-laten cache stats
|
|
39
108
|
make-laten cache clear
|
|
40
109
|
|
|
41
|
-
#
|
|
42
|
-
make-laten
|
|
43
|
-
make-laten install
|
|
44
|
-
make-laten install --
|
|
110
|
+
# Setup
|
|
111
|
+
make-laten init --all # detect + configure MCP
|
|
112
|
+
make-laten install # install shell aliases
|
|
113
|
+
make-laten install --status # show what's installed
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## MCP Server
|
|
117
|
+
|
|
118
|
+
make-laten includes an MCP server that auto-compresses tool outputs for any MCP-compatible agent.
|
|
119
|
+
|
|
120
|
+
**Tools provided:**
|
|
121
|
+
|
|
122
|
+
| Tool | Description |
|
|
123
|
+
|------|-------------|
|
|
124
|
+
| `make-laten-read` | Compressed file read |
|
|
125
|
+
| `make-laten-grep` | Grouped grep results |
|
|
126
|
+
| `make-laten-git-diff` | Compressed git diff |
|
|
127
|
+
| `make-laten-git-status` | Git status summary |
|
|
128
|
+
| `make-laten-cache-stats` | Cache performance |
|
|
129
|
+
|
|
130
|
+
**Manual MCP config (if needed):**
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"mcpServers": {
|
|
135
|
+
"make-laten": {
|
|
136
|
+
"command": "npx",
|
|
137
|
+
"args": ["-y", "make-laten-mcp", "server"]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
45
141
|
```
|
|
46
142
|
|
|
143
|
+
## Supported Agents
|
|
144
|
+
|
|
145
|
+
make-laten works with **9+ AI coding agents**:
|
|
146
|
+
|
|
147
|
+
| Agent | Integration | Setup |
|
|
148
|
+
|-------|-------------|-------|
|
|
149
|
+
| **Claude Code** | MCP + Hooks | `npx make-laten init --all` |
|
|
150
|
+
| **Cursor** | MCP + Rules | `npx make-laten init --all` |
|
|
151
|
+
| **Codex** | MCP + AGENTS.md | `npx make-laten init --all` |
|
|
152
|
+
| **OpenCode** | MCP + Skill | `npx make-laten init --all` |
|
|
153
|
+
| **Gemini CLI** | MCP | `npx make-laten init --all` |
|
|
154
|
+
| **Windsurf** | MCP | `npx make-laten init --all` |
|
|
155
|
+
| **Cline** | MCP | `npx make-laten init --all` |
|
|
156
|
+
| **GitHub Copilot** | MCP | `npx make-laten init --all` |
|
|
157
|
+
| **Any MCP client** | MCP | Add server config manually |
|
|
158
|
+
|
|
47
159
|
## Programmatic Usage
|
|
48
160
|
|
|
49
161
|
```typescript
|
|
@@ -51,10 +163,10 @@ import {
|
|
|
51
163
|
FileReadCompressor,
|
|
52
164
|
GrepCompressor,
|
|
53
165
|
GitDiffCompressor,
|
|
54
|
-
SemanticCache,
|
|
55
166
|
WebRouter,
|
|
56
|
-
|
|
57
|
-
|
|
167
|
+
RateLimiter,
|
|
168
|
+
Logger,
|
|
169
|
+
Pipeline
|
|
58
170
|
} from 'make-laten'
|
|
59
171
|
|
|
60
172
|
// Compress file reads
|
|
@@ -64,20 +176,59 @@ const result = await compressor.compress({
|
|
|
64
176
|
filePath: 'src/main.ts',
|
|
65
177
|
language: 'typescript'
|
|
66
178
|
})
|
|
179
|
+
// result.content → compressed output (89% smaller)
|
|
180
|
+
// result.metadata.savings → 0.89
|
|
67
181
|
|
|
68
|
-
// Semantic web search
|
|
182
|
+
// Semantic web search + fetch
|
|
69
183
|
const web = new WebRouter()
|
|
70
184
|
const results = await web.search('how to use async await')
|
|
71
185
|
const page = await web.fetch('https://example.com/docs')
|
|
186
|
+
// page.content → compressed (75% smaller)
|
|
187
|
+
// page.semantic → sections, code examples, key points
|
|
72
188
|
|
|
73
|
-
//
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
189
|
+
// Middleware pipeline
|
|
190
|
+
const pipeline = new Pipeline()
|
|
191
|
+
pipeline.use(async (ctx, next) => {
|
|
192
|
+
ctx.metadata.enhanced = true
|
|
193
|
+
return next(ctx)
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
// Rate limiting
|
|
197
|
+
const limiter = new RateLimiter({ maxRequests: 100, windowMs: 60000 })
|
|
198
|
+
if (limiter.allow('user1')) { /* proceed */ }
|
|
199
|
+
|
|
200
|
+
// Structured logging
|
|
201
|
+
const logger = new Logger({ level: 'info', handler: (entry) => console.log(entry) })
|
|
202
|
+
logger.info('Processing', { file: 'src/main.ts' })
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Architecture
|
|
77
206
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
207
|
+
```
|
|
208
|
+
┌──────────────────────────────────────────────────────────┐
|
|
209
|
+
│ User / AI Agent │
|
|
210
|
+
│ │
|
|
211
|
+
│ "read src/index.ts" "grep TODO" "git diff" │
|
|
212
|
+
└─────────────────┬────────────────────┬──────────────────┘
|
|
213
|
+
│ │
|
|
214
|
+
┌─────────────────▼────────────────────▼──────────────────┐
|
|
215
|
+
│ make-laten MCP Server │
|
|
216
|
+
│ │
|
|
217
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
218
|
+
│ │ Compress │ │ Cache │ │ Web │ │
|
|
219
|
+
│ │ Layer │ │ L1/L2/L3│ │ Router │ │
|
|
220
|
+
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
|
|
221
|
+
│ │ │ │ │
|
|
222
|
+
│ ┌────▼──────────────▼──────────────▼─────┐ │
|
|
223
|
+
│ │ Knowledge Graph │ │
|
|
224
|
+
│ │ (patterns, failures, learning) │ │
|
|
225
|
+
│ └────────────────────────────────────────┘ │
|
|
226
|
+
└─────────────────────────────────────────────────────────┘
|
|
227
|
+
│
|
|
228
|
+
┌─────────────────▼───────────────────────────────────────┐
|
|
229
|
+
│ Shell Aliases (terminal) │
|
|
230
|
+
│ mread | mgrep | mdiff | mstatus | msearch | mfetch │
|
|
231
|
+
└─────────────────────────────────────────────────────────┘
|
|
81
232
|
```
|
|
82
233
|
|
|
83
234
|
## Modules
|
|
@@ -89,44 +240,40 @@ await installer.install()
|
|
|
89
240
|
| `graph` | Knowledge graph for operation patterns |
|
|
90
241
|
| `route` | Smart routing between compression strategies |
|
|
91
242
|
| `tool` | Tool router with pattern matching |
|
|
92
|
-
| `adapter` | Agent adapters (
|
|
243
|
+
| `adapter` | Agent adapters (9+ agents) |
|
|
93
244
|
| `learn` | Pattern mining and failure learning |
|
|
94
245
|
| `correct` | Auto-correction engine |
|
|
95
246
|
| `web` | Web search, fetch, semantic extraction |
|
|
96
|
-
| `middleware` | Middleware pipeline |
|
|
247
|
+
| `middleware` | Middleware pipeline with chain execution |
|
|
97
248
|
| `plugin` | Plugin system with lifecycle |
|
|
98
249
|
| `security` | Rate limiter |
|
|
99
250
|
| `logging` | Structured logger |
|
|
100
251
|
| `error` | Error handler with suggestions |
|
|
101
252
|
| `metrics` | Counters, gauges, histograms |
|
|
102
253
|
| `session` | Session manager with timeout |
|
|
103
|
-
|
|
104
|
-
## Supported Agents
|
|
105
|
-
|
|
106
|
-
make-laten works with 7+ AI coding agents:
|
|
107
|
-
|
|
108
|
-
- **Claude Code** — hook-based interception
|
|
109
|
-
- **Codex** — hook-based interception
|
|
110
|
-
- **Gemini CLI** — hook-based interception
|
|
111
|
-
- **Cursor** — rules injection
|
|
112
|
-
- **Windsurf** — rules injection
|
|
113
|
-
- **Cline** — rules injection
|
|
114
|
-
- **GitHub Copilot** — rules injection
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
# Auto-detect and configure
|
|
118
|
-
make-laten install
|
|
119
|
-
```
|
|
254
|
+
| `mcp` | MCP server for AI agent integration |
|
|
120
255
|
|
|
121
256
|
## Development
|
|
122
257
|
|
|
123
258
|
```bash
|
|
259
|
+
git clone https://github.com/sukirman1901/make-laten.git
|
|
260
|
+
cd make-laten
|
|
124
261
|
npm install
|
|
125
|
-
npm test #
|
|
126
|
-
npm run build # Build CJS + ESM
|
|
262
|
+
npm test # 201 tests passing
|
|
263
|
+
npm run build # Build CJS + ESM + MCP
|
|
127
264
|
npm run typecheck # Type check
|
|
128
265
|
```
|
|
129
266
|
|
|
267
|
+
## Contributing
|
|
268
|
+
|
|
269
|
+
1. Fork the repo
|
|
270
|
+
2. Create a feature branch (`git checkout -b feat/amazing`)
|
|
271
|
+
3. Write tests first (`tests/`)
|
|
272
|
+
4. Implement feature (`src/`)
|
|
273
|
+
5. Run `npm test` — all 201 tests must pass
|
|
274
|
+
6. Run `npm run typecheck` — must be clean
|
|
275
|
+
7. Submit PR
|
|
276
|
+
|
|
130
277
|
## License
|
|
131
278
|
|
|
132
|
-
MIT
|
|
279
|
+
MIT © [Sukirman](https://github.com/sukirman1901)
|
package/dist/cli/index.js
CHANGED
|
@@ -1349,125 +1349,102 @@ async function directoryExists(dirPath) {
|
|
|
1349
1349
|
return false;
|
|
1350
1350
|
}
|
|
1351
1351
|
}
|
|
1352
|
+
async function readJSON(filePath) {
|
|
1353
|
+
try {
|
|
1354
|
+
const raw = await import_promises3.default.readFile(filePath, "utf-8");
|
|
1355
|
+
return JSON.parse(raw);
|
|
1356
|
+
} catch {
|
|
1357
|
+
return {};
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
async function writeJSON(filePath, data) {
|
|
1361
|
+
try {
|
|
1362
|
+
const dir = import_path2.default.dirname(filePath);
|
|
1363
|
+
await import_promises3.default.mkdir(dir, { recursive: true });
|
|
1364
|
+
await import_promises3.default.writeFile(filePath, JSON.stringify(data, null, 2));
|
|
1365
|
+
return true;
|
|
1366
|
+
} catch {
|
|
1367
|
+
return false;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
var MCP_CMD = ["npx", "-y", "make-laten-mcp", "server"];
|
|
1352
1371
|
async function detectAllAgents() {
|
|
1353
1372
|
const home = getHome2();
|
|
1354
1373
|
const agents2 = [];
|
|
1355
|
-
const claudeConfig = import_path2.default.join(home, ".claude", "mcp.json");
|
|
1356
|
-
const claudeDir = import_path2.default.join(home, ".claude");
|
|
1357
1374
|
agents2.push({
|
|
1358
1375
|
name: "Claude Code",
|
|
1359
|
-
detected: await commandExists2("claude") || await directoryExists(
|
|
1360
|
-
configPath:
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1376
|
+
detected: await commandExists2("claude") || await directoryExists(import_path2.default.join(home, ".claude")),
|
|
1377
|
+
configPath: import_path2.default.join(home, ".claude", "mcp.json"),
|
|
1378
|
+
version: await commandExists2("claude") ? await execAsync4("claude --version", { timeout: 3e3 }).then((r) => r.stdout.trim().split("\n")[0]).catch(() => "unknown") : void 0,
|
|
1379
|
+
writeConfig: async (p) => {
|
|
1380
|
+
const data = await readJSON(p);
|
|
1381
|
+
data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
|
|
1382
|
+
return writeJSON(p, data);
|
|
1383
|
+
}
|
|
1367
1384
|
});
|
|
1368
|
-
const cursorMcp = import_path2.default.join(home, ".cursor", "mcp.json");
|
|
1369
|
-
const cursorDir = import_path2.default.join(home, ".cursor");
|
|
1370
1385
|
agents2.push({
|
|
1371
1386
|
name: "Cursor",
|
|
1372
|
-
detected: await directoryExists(
|
|
1373
|
-
configPath:
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1387
|
+
detected: await directoryExists(import_path2.default.join(home, ".cursor")),
|
|
1388
|
+
configPath: import_path2.default.join(home, ".cursor", "mcp.json"),
|
|
1389
|
+
writeConfig: async (p) => {
|
|
1390
|
+
const data = await readJSON(p);
|
|
1391
|
+
data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
|
|
1392
|
+
return writeJSON(p, data);
|
|
1378
1393
|
}
|
|
1379
1394
|
});
|
|
1380
|
-
const codexMcp = import_path2.default.join(home, ".codex", "config.json");
|
|
1381
|
-
const codexDir = import_path2.default.join(home, ".codex");
|
|
1382
1395
|
agents2.push({
|
|
1383
1396
|
name: "Codex",
|
|
1384
|
-
detected: await commandExists2("codex") || await directoryExists(
|
|
1385
|
-
configPath:
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1397
|
+
detected: await commandExists2("codex") || await directoryExists(import_path2.default.join(home, ".codex")),
|
|
1398
|
+
configPath: import_path2.default.join(home, ".codex", "config.json"),
|
|
1399
|
+
writeConfig: async (p) => {
|
|
1400
|
+
const data = await readJSON(p);
|
|
1401
|
+
data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
|
|
1402
|
+
return writeJSON(p, data);
|
|
1390
1403
|
}
|
|
1391
1404
|
});
|
|
1392
|
-
const windsurfMcp = import_path2.default.join(home, ".codeium", "windsurf", "mcp_config.json");
|
|
1393
|
-
const windsurfDir = import_path2.default.join(home, ".codeium", "windsurf");
|
|
1394
1405
|
agents2.push({
|
|
1395
|
-
name: "
|
|
1396
|
-
detected: await directoryExists(
|
|
1397
|
-
configPath:
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1406
|
+
name: "OpenCode",
|
|
1407
|
+
detected: await directoryExists(import_path2.default.join(home, ".config", "opencode")),
|
|
1408
|
+
configPath: import_path2.default.join(home, ".config", "opencode", "opencode.json"),
|
|
1409
|
+
writeConfig: async (p) => {
|
|
1410
|
+
const data = await readJSON(p);
|
|
1411
|
+
data.mcp = { ...data.mcp || {}, "make-laten": { type: "local", command: MCP_CMD, enabled: true } };
|
|
1412
|
+
delete data.mcpServers;
|
|
1413
|
+
return writeJSON(p, data);
|
|
1402
1414
|
}
|
|
1403
1415
|
});
|
|
1404
|
-
const openCodeConfig = import_path2.default.join(home, ".config", "opencode", "opencode.json");
|
|
1405
|
-
const openCodeDir = import_path2.default.join(home, ".config", "opencode");
|
|
1406
1416
|
agents2.push({
|
|
1407
|
-
name: "
|
|
1408
|
-
detected: await directoryExists(
|
|
1409
|
-
configPath:
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1417
|
+
name: "Windsurf",
|
|
1418
|
+
detected: await directoryExists(import_path2.default.join(home, ".codeium", "windsurf")),
|
|
1419
|
+
configPath: import_path2.default.join(home, ".codeium", "windsurf", "mcp_config.json"),
|
|
1420
|
+
writeConfig: async (p) => {
|
|
1421
|
+
const data = await readJSON(p);
|
|
1422
|
+
data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
|
|
1423
|
+
return writeJSON(p, data);
|
|
1414
1424
|
}
|
|
1415
1425
|
});
|
|
1416
|
-
const clineDir = import_path2.default.join(home, ".cline");
|
|
1417
|
-
const clineMcp = import_path2.default.join(home, ".cline", "mcp_settings.json");
|
|
1418
1426
|
agents2.push({
|
|
1419
1427
|
name: "Cline",
|
|
1420
|
-
detected: await directoryExists(
|
|
1421
|
-
configPath:
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1428
|
+
detected: await directoryExists(import_path2.default.join(home, ".cline")),
|
|
1429
|
+
configPath: import_path2.default.join(home, ".cline", "mcp_settings.json"),
|
|
1430
|
+
writeConfig: async (p) => {
|
|
1431
|
+
const data = await readJSON(p);
|
|
1432
|
+
data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
|
|
1433
|
+
return writeJSON(p, data);
|
|
1426
1434
|
}
|
|
1427
1435
|
});
|
|
1428
|
-
const vscodeDir = import_path2.default.join(home, "Library", "Application Support", "Code", "User", "globalStorage");
|
|
1429
|
-
agents2.push({
|
|
1430
|
-
name: "GitHub Copilot (VS Code)",
|
|
1431
|
-
detected: await directoryExists(vscodeDir),
|
|
1432
|
-
configPath: "",
|
|
1433
|
-
mcpConfig: {}
|
|
1434
|
-
});
|
|
1435
|
-
const geminiDir = import_path2.default.join(home, ".gemini");
|
|
1436
1436
|
agents2.push({
|
|
1437
1437
|
name: "Gemini CLI",
|
|
1438
|
-
detected: await commandExists2("gemini") || await directoryExists(
|
|
1438
|
+
detected: await commandExists2("gemini") || await directoryExists(import_path2.default.join(home, ".gemini")),
|
|
1439
1439
|
configPath: import_path2.default.join(home, ".gemini", "settings.json"),
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1440
|
+
writeConfig: async (p) => {
|
|
1441
|
+
const data = await readJSON(p);
|
|
1442
|
+
data.mcpServers = { ...data.mcpServers || {}, "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } };
|
|
1443
|
+
return writeJSON(p, data);
|
|
1444
1444
|
}
|
|
1445
1445
|
});
|
|
1446
1446
|
return agents2;
|
|
1447
1447
|
}
|
|
1448
|
-
async function writeMCPConfig(agent) {
|
|
1449
|
-
try {
|
|
1450
|
-
const dir = import_path2.default.dirname(agent.configPath);
|
|
1451
|
-
await import_promises3.default.mkdir(dir, { recursive: true });
|
|
1452
|
-
let existing = {};
|
|
1453
|
-
try {
|
|
1454
|
-
const raw = await import_promises3.default.readFile(agent.configPath, "utf-8");
|
|
1455
|
-
existing = JSON.parse(raw);
|
|
1456
|
-
} catch {
|
|
1457
|
-
}
|
|
1458
|
-
const merged = {
|
|
1459
|
-
...existing,
|
|
1460
|
-
mcpServers: {
|
|
1461
|
-
...existing.mcpServers || {},
|
|
1462
|
-
...agent.mcpConfig.mcpServers
|
|
1463
|
-
}
|
|
1464
|
-
};
|
|
1465
|
-
await import_promises3.default.writeFile(agent.configPath, JSON.stringify(merged, null, 2));
|
|
1466
|
-
return true;
|
|
1467
|
-
} catch {
|
|
1468
|
-
return false;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
1448
|
function askQuestion(rl, question) {
|
|
1472
1449
|
return new Promise((resolve) => rl.question(question, resolve));
|
|
1473
1450
|
}
|
|
@@ -1494,42 +1471,25 @@ async function initCommand(options) {
|
|
|
1494
1471
|
console.log("");
|
|
1495
1472
|
if (options.all) {
|
|
1496
1473
|
for (const agent of detected) {
|
|
1497
|
-
const success = await
|
|
1474
|
+
const success = await agent.writeConfig(agent.configPath);
|
|
1498
1475
|
if (success) {
|
|
1499
1476
|
console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
|
|
1500
1477
|
} else {
|
|
1501
|
-
console.log(` \u2717 ${agent.name} \u2192 failed`);
|
|
1478
|
+
console.log(` \u2717 ${agent.name} \u2192 failed to write config`);
|
|
1502
1479
|
}
|
|
1503
1480
|
}
|
|
1504
1481
|
} else if (options.project) {
|
|
1505
1482
|
const cwd = process.cwd();
|
|
1506
|
-
const mcpConfig = {
|
|
1507
|
-
mcpServers: {
|
|
1508
|
-
"make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] }
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
1483
|
const configPath = import_path2.default.join(cwd, ".mcp.json");
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
const raw = await import_promises3.default.readFile(configPath, "utf-8");
|
|
1515
|
-
existing = JSON.parse(raw);
|
|
1516
|
-
} catch {
|
|
1517
|
-
}
|
|
1518
|
-
const merged = {
|
|
1519
|
-
...existing,
|
|
1520
|
-
mcpServers: {
|
|
1521
|
-
...existing.mcpServers || {},
|
|
1522
|
-
...mcpConfig.mcpServers
|
|
1523
|
-
}
|
|
1524
|
-
};
|
|
1525
|
-
await import_promises3.default.writeFile(configPath, JSON.stringify(merged, null, 2));
|
|
1484
|
+
const data = { mcpServers: { "make-laten": { command: "npx", args: ["-y", "make-laten-mcp", "server"] } } };
|
|
1485
|
+
await writeJSON(configPath, data);
|
|
1526
1486
|
console.log(` \u2713 .mcp.json created in ${cwd}`);
|
|
1527
1487
|
} else {
|
|
1528
1488
|
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
1529
1489
|
for (const agent of detected) {
|
|
1530
1490
|
const answer = await askQuestion(rl, ` Configure ${agent.name}? (Y/n) `);
|
|
1531
1491
|
if (answer.toLowerCase() !== "n") {
|
|
1532
|
-
const success = await
|
|
1492
|
+
const success = await agent.writeConfig(agent.configPath);
|
|
1533
1493
|
if (success) {
|
|
1534
1494
|
console.log(` \u2713 ${agent.name} \u2192 MCP configured`);
|
|
1535
1495
|
} else {
|