Skip to content

Commit bb19743

Browse files
fix README
1 parent 16498af commit bb19743

File tree

3 files changed

+382
-1
lines changed

3 files changed

+382
-1
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ MCP (Model Context Protocol) server for [Nativelink Cloud](https://app.nativelin
1010
- 🚀 **Generate optimized Bazel configurations** using Nativelink Cloud endpoints
1111
- 📚 **Access Nativelink Cloud setup and migration guides** directly in your AI assistant
1212
- 📊 **Analyze build performance** with AI-powered recommendations
13+
- 🔄 **Set up automatic builds and tests** with file watchers and Nativelink caching
1314
- 🏗️ **Generate deployment configurations** for self-hosted Nativelink instances
1415
- 🔐 **Integration with app.nativelink.com** for personalized configurations
1516
- 💡 **Smart recommendations** based on your project's specific needs
@@ -94,7 +95,7 @@ Debug why my Bazel builds are slow. use nativelink
9495
```
9596

9697
```
97-
Invoke bazel build //... after whenever a file is saved. use nativelink
98+
Set up automatic builds and tests after file changes. use nativelink
9899
```
99100

100101
## Available Tools
@@ -151,6 +152,29 @@ Generates deployment configurations for various platforms.
151152
Generate a Kubernetes deployment for Nativelink with autoscaling. use nativelink
152153
```
153154

155+
### 5. `setup-watch-and-build`
156+
Sets up automatic Bazel builds and tests on file changes with Nativelink Cloud caching.
157+
158+
**Parameters:**
159+
- `command` (optional): build, test, or both (default: both)
160+
- `targets` (optional): Bazel targets to build/test (default: //...)
161+
- `useIbazel` (optional): Use iBazel for intelligent watching (recommended)
162+
- `watchPaths` (optional): Paths/patterns to watch
163+
- `excludePaths` (optional): Paths/patterns to exclude
164+
- `debounceMs` (optional): Delay before rebuilding (default: 1000ms)
165+
166+
**Example:**
167+
```
168+
Set up automatic builds and tests when files change. use nativelink
169+
```
170+
171+
**What it provides:**
172+
- Configuration for iBazel (intelligent Bazel watcher)
173+
- Setup instructions for watchexec, entr, nodemon
174+
- Custom watch scripts
175+
- VS Code task configuration
176+
- Integration with Nativelink Cloud for instant cache hits
177+
154178
## Configuration
155179

156180
### Environment Variables

src/index.ts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { generateBazelConfig, GetBazelConfigSchema } from './tools/config.js';
2020
import { getNativelinkDocs, GetNativelinkDocsSchema } from './tools/docs.js';
2121
import { analyzeBuildPerformance, AnalyzeBuildPerformanceSchema } from './tools/performance.js';
2222
import { generateDeploymentConfig, GenerateDeploymentConfigSchema } from './tools/deployment.js';
23+
import { setupWatchAndBuild, SetupWatchAndBuildSchema } from './tools/watch.js';
2324

2425
const CONFIG: NativelinkConfig = {
2526
apiKey: process.env.NATIVELINK_API_KEY,
@@ -166,6 +167,42 @@ async function createNativelinkServer(config: NativelinkConfig) {
166167
},
167168
required: ['platform', 'scale']
168169
}
170+
},
171+
{
172+
name: 'setup-watch-and-build',
173+
description: 'Set up automatic Bazel builds and tests on file changes with Nativelink',
174+
inputSchema: {
175+
type: 'object',
176+
properties: {
177+
command: {
178+
type: 'string',
179+
enum: ['build', 'test', 'both'],
180+
description: 'What to run on file changes (default: both)'
181+
},
182+
targets: {
183+
type: 'string',
184+
description: 'Bazel targets to build/test (default: //...)'
185+
},
186+
watchPaths: {
187+
type: 'array',
188+
items: { type: 'string' },
189+
description: 'Paths/patterns to watch for changes'
190+
},
191+
excludePaths: {
192+
type: 'array',
193+
items: { type: 'string' },
194+
description: 'Paths/patterns to exclude from watching'
195+
},
196+
debounceMs: {
197+
type: 'number',
198+
description: 'Milliseconds to wait before rebuilding (100-10000, default: 1000)'
199+
},
200+
useIbazel: {
201+
type: 'boolean',
202+
description: 'Use iBazel for intelligent watching (recommended)'
203+
}
204+
}
205+
}
169206
}
170207
]
171208
}));
@@ -219,6 +256,17 @@ async function createNativelinkServer(config: NativelinkConfig) {
219256
};
220257
}
221258

259+
case 'setup-watch-and-build': {
260+
const params = SetupWatchAndBuildSchema.parse(args);
261+
const watchConfig = setupWatchAndBuild(params);
262+
return {
263+
content: [{
264+
type: 'text',
265+
text: watchConfig
266+
}]
267+
};
268+
}
269+
222270
default:
223271
throw new McpError(
224272
ErrorCode.MethodNotFound,
@@ -388,6 +436,42 @@ async function startHttpServer() {
388436
},
389437
required: ['platform', 'scale']
390438
}
439+
},
440+
{
441+
name: 'setup-watch-and-build',
442+
description: 'Set up automatic Bazel builds and tests on file changes with Nativelink',
443+
inputSchema: {
444+
type: 'object',
445+
properties: {
446+
command: {
447+
type: 'string',
448+
enum: ['build', 'test', 'both'],
449+
description: 'What to run on file changes (default: both)'
450+
},
451+
targets: {
452+
type: 'string',
453+
description: 'Bazel targets to build/test (default: //...)'
454+
},
455+
watchPaths: {
456+
type: 'array',
457+
items: { type: 'string' },
458+
description: 'Paths/patterns to watch for changes'
459+
},
460+
excludePaths: {
461+
type: 'array',
462+
items: { type: 'string' },
463+
description: 'Paths/patterns to exclude from watching'
464+
},
465+
debounceMs: {
466+
type: 'number',
467+
description: 'Milliseconds to wait before rebuilding (100-10000, default: 1000)'
468+
},
469+
useIbazel: {
470+
type: 'boolean',
471+
description: 'Use iBazel for intelligent watching (recommended)'
472+
}
473+
}
474+
}
391475
}
392476
]
393477
};
@@ -423,6 +507,11 @@ async function startHttpServer() {
423507
content = generateDeploymentConfig(params);
424508
break;
425509
}
510+
case 'setup-watch-and-build': {
511+
const params = SetupWatchAndBuildSchema.parse(args);
512+
content = setupWatchAndBuild(params);
513+
break;
514+
}
426515
default:
427516
throw new Error(`Unknown tool: ${toolName}`);
428517
}

0 commit comments

Comments
 (0)