make-laten 1.1.0 → 1.2.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/README.md +198 -51
- package/dist/cli/index.js +376 -175
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +376 -175
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.js +288 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +274 -67
- package/dist/index.mjs.map +1 -1
- package/dist/mcp/server.js +250 -68
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/server.mjs +250 -68
- package/dist/mcp/server.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` | **65-92%** | Compressed file read — exports, classes, functions only |
|
|
22
|
+
| `grep` | **70%** | Grouped by file with line numbers |
|
|
23
|
+
| `git diff` | **61%** | Condensed hunks, only changes shown |
|
|
24
|
+
| `git status` | **50-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)
|