@stan-chen/simple-cli 0.2.2 → 0.2.4

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.
Files changed (100) hide show
  1. package/README.md +58 -271
  2. package/dist/anyllm.py +62 -0
  3. package/dist/builtins.d.ts +726 -0
  4. package/dist/builtins.js +481 -0
  5. package/dist/cli.d.ts +0 -4
  6. package/dist/cli.js +37 -279
  7. package/dist/engine.d.ts +33 -0
  8. package/dist/engine.js +138 -0
  9. package/dist/learnings.d.ts +15 -0
  10. package/dist/learnings.js +54 -0
  11. package/dist/llm.d.ts +18 -0
  12. package/dist/llm.js +66 -0
  13. package/dist/mcp.d.ts +132 -0
  14. package/dist/mcp.js +43 -0
  15. package/dist/skills.d.ts +5 -16
  16. package/dist/skills.js +91 -253
  17. package/dist/tui.d.ts +1 -0
  18. package/dist/tui.js +10 -0
  19. package/package.json +88 -78
  20. package/dist/commands/add.d.ts +0 -9
  21. package/dist/commands/add.js +0 -50
  22. package/dist/commands/git/commit.d.ts +0 -12
  23. package/dist/commands/git/commit.js +0 -97
  24. package/dist/commands/git/status.d.ts +0 -6
  25. package/dist/commands/git/status.js +0 -42
  26. package/dist/commands/index.d.ts +0 -16
  27. package/dist/commands/index.js +0 -376
  28. package/dist/commands/mcp/status.d.ts +0 -6
  29. package/dist/commands/mcp/status.js +0 -31
  30. package/dist/commands/swarm.d.ts +0 -36
  31. package/dist/commands/swarm.js +0 -236
  32. package/dist/commands.d.ts +0 -32
  33. package/dist/commands.js +0 -427
  34. package/dist/context.d.ts +0 -116
  35. package/dist/context.js +0 -327
  36. package/dist/index.d.ts +0 -6
  37. package/dist/index.js +0 -109
  38. package/dist/lib/agent.d.ts +0 -98
  39. package/dist/lib/agent.js +0 -281
  40. package/dist/lib/editor.d.ts +0 -74
  41. package/dist/lib/editor.js +0 -441
  42. package/dist/lib/git.d.ts +0 -164
  43. package/dist/lib/git.js +0 -351
  44. package/dist/lib/ui.d.ts +0 -159
  45. package/dist/lib/ui.js +0 -252
  46. package/dist/mcp/client.d.ts +0 -22
  47. package/dist/mcp/client.js +0 -81
  48. package/dist/mcp/manager.d.ts +0 -186
  49. package/dist/mcp/manager.js +0 -446
  50. package/dist/prompts/provider.d.ts +0 -22
  51. package/dist/prompts/provider.js +0 -78
  52. package/dist/providers/index.d.ts +0 -15
  53. package/dist/providers/index.js +0 -82
  54. package/dist/providers/multi.d.ts +0 -11
  55. package/dist/providers/multi.js +0 -28
  56. package/dist/registry.d.ts +0 -24
  57. package/dist/registry.js +0 -379
  58. package/dist/repoMap.d.ts +0 -5
  59. package/dist/repoMap.js +0 -79
  60. package/dist/router.d.ts +0 -41
  61. package/dist/router.js +0 -108
  62. package/dist/swarm/coordinator.d.ts +0 -86
  63. package/dist/swarm/coordinator.js +0 -257
  64. package/dist/swarm/index.d.ts +0 -28
  65. package/dist/swarm/index.js +0 -29
  66. package/dist/swarm/task.d.ts +0 -104
  67. package/dist/swarm/task.js +0 -221
  68. package/dist/swarm/types.d.ts +0 -132
  69. package/dist/swarm/types.js +0 -37
  70. package/dist/swarm/worker.d.ts +0 -107
  71. package/dist/swarm/worker.js +0 -299
  72. package/dist/tools/analyzeFile.d.ts +0 -16
  73. package/dist/tools/analyzeFile.js +0 -43
  74. package/dist/tools/git.d.ts +0 -40
  75. package/dist/tools/git.js +0 -236
  76. package/dist/tools/glob.d.ts +0 -34
  77. package/dist/tools/glob.js +0 -165
  78. package/dist/tools/grep.d.ts +0 -53
  79. package/dist/tools/grep.js +0 -296
  80. package/dist/tools/linter.d.ts +0 -35
  81. package/dist/tools/linter.js +0 -349
  82. package/dist/tools/listDir.d.ts +0 -29
  83. package/dist/tools/listDir.js +0 -50
  84. package/dist/tools/memory.d.ts +0 -34
  85. package/dist/tools/memory.js +0 -215
  86. package/dist/tools/readFiles.d.ts +0 -25
  87. package/dist/tools/readFiles.js +0 -31
  88. package/dist/tools/reloadTools.d.ts +0 -11
  89. package/dist/tools/reloadTools.js +0 -22
  90. package/dist/tools/runCommand.d.ts +0 -32
  91. package/dist/tools/runCommand.js +0 -79
  92. package/dist/tools/scraper.d.ts +0 -31
  93. package/dist/tools/scraper.js +0 -211
  94. package/dist/tools/writeFiles.d.ts +0 -63
  95. package/dist/tools/writeFiles.js +0 -87
  96. package/dist/ui/server.d.ts +0 -5
  97. package/dist/ui/server.js +0 -74
  98. package/dist/watcher.d.ts +0 -35
  99. package/dist/watcher.js +0 -164
  100. /package/{docs/assets → assets}/logo.jpeg +0 -0
@@ -1,299 +0,0 @@
1
- /**
2
- * Worker - Spawns and manages Simple-CLI worker processes
3
- */
4
- import { spawn } from 'child_process';
5
- import { EventEmitter } from 'events';
6
- import { randomUUID } from 'crypto';
7
- export class Worker extends EventEmitter {
8
- id;
9
- process = null;
10
- state = 'idle';
11
- currentTask = null;
12
- startedAt = 0;
13
- output = '';
14
- options;
15
- constructor(options) {
16
- super();
17
- this.id = `worker-${randomUUID().slice(0, 8)}`;
18
- this.options = options;
19
- }
20
- /**
21
- * Get current worker status
22
- */
23
- getStatus() {
24
- return {
25
- id: this.id,
26
- pid: this.process?.pid,
27
- state: this.state,
28
- currentTask: this.currentTask?.id,
29
- startedAt: this.startedAt || undefined,
30
- completedAt: this.state === 'completed' || this.state === 'failed' ? Date.now() : undefined,
31
- };
32
- }
33
- /**
34
- * Execute a task
35
- */
36
- async execute(task) {
37
- if (this.state === 'running') {
38
- throw new Error(`Worker ${this.id} is already running a task`);
39
- }
40
- this.currentTask = task;
41
- this.state = 'running';
42
- this.startedAt = Date.now();
43
- this.output = '';
44
- return new Promise((resolve, reject) => {
45
- const timeout = task.timeout || this.options.timeout;
46
- let timeoutId = null;
47
- let resolved = false;
48
- const cleanup = () => {
49
- if (timeoutId)
50
- clearTimeout(timeoutId);
51
- this.process = null;
52
- };
53
- const finish = (result) => {
54
- if (resolved)
55
- return;
56
- resolved = true;
57
- cleanup();
58
- this.state = result.success ? 'completed' : 'failed';
59
- this.emit('complete', result);
60
- resolve(result);
61
- };
62
- // Build the prompt from task
63
- const prompt = this.buildPrompt(task);
64
- // Spawn Simple-CLI process
65
- const args = ['--yolo'];
66
- if (this.options.yolo)
67
- args.push('--yolo');
68
- args.push(prompt);
69
- // Use node to run the CLI directly
70
- const cliPath = new URL('../index.js', import.meta.url).pathname;
71
- this.process = spawn('node', [cliPath, ...args], {
72
- cwd: this.options.cwd,
73
- env: {
74
- ...process.env,
75
- ...this.options.env,
76
- SIMPLE_CLI_WORKER: this.id,
77
- SIMPLE_CLI_TASK: task.id,
78
- },
79
- stdio: ['pipe', 'pipe', 'pipe'],
80
- });
81
- this.emit('spawn', this.getStatus());
82
- // Collect output
83
- this.process.stdout?.on('data', (data) => {
84
- this.output += data.toString();
85
- });
86
- this.process.stderr?.on('data', (data) => {
87
- this.output += data.toString();
88
- });
89
- // Handle process exit
90
- this.process.on('close', (code) => {
91
- const duration = Date.now() - this.startedAt;
92
- const success = code === 0;
93
- // Parse output for changed files (simplified)
94
- const filesChanged = this.parseChangedFiles(this.output);
95
- const commitHash = this.parseCommitHash(this.output);
96
- finish({
97
- success,
98
- filesChanged,
99
- commitHash,
100
- error: success ? undefined : `Process exited with code ${code}`,
101
- duration,
102
- output: this.output,
103
- });
104
- });
105
- this.process.on('error', (err) => {
106
- finish({
107
- success: false,
108
- filesChanged: [],
109
- error: err.message,
110
- duration: Date.now() - this.startedAt,
111
- output: this.output,
112
- });
113
- });
114
- // Set timeout
115
- timeoutId = setTimeout(() => {
116
- if (!resolved) {
117
- this.kill();
118
- finish({
119
- success: false,
120
- filesChanged: [],
121
- error: `Task timed out after ${timeout}ms`,
122
- duration: timeout,
123
- output: this.output,
124
- });
125
- }
126
- }, timeout);
127
- // Send task to stdin and close
128
- this.process.stdin?.write(prompt);
129
- this.process.stdin?.end();
130
- });
131
- }
132
- /**
133
- * Build prompt from task
134
- */
135
- buildPrompt(task) {
136
- let prompt = task.description;
137
- if (task.scope.files && task.scope.files.length > 0) {
138
- prompt += `\n\nFocus on these files: ${task.scope.files.join(', ')}`;
139
- }
140
- if (task.scope.directories && task.scope.directories.length > 0) {
141
- prompt += `\n\nWork in these directories: ${task.scope.directories.join(', ')}`;
142
- }
143
- if (task.scope.pattern) {
144
- prompt += `\n\nApply to files matching: ${task.scope.pattern}`;
145
- }
146
- return prompt;
147
- }
148
- /**
149
- * Parse changed files from output
150
- */
151
- parseChangedFiles(output) {
152
- const files = [];
153
- // Look for common patterns indicating file changes
154
- const patterns = [
155
- /(?:wrote|created|modified|updated)\s+([^\s]+)/gi,
156
- /\[Result\].*(?:wrote|created)\s+([^\s]+)/gi,
157
- ];
158
- for (const pattern of patterns) {
159
- let match;
160
- while ((match = pattern.exec(output)) !== null) {
161
- const file = match[1].replace(/['"`,]/g, '');
162
- if (file && !files.includes(file)) {
163
- files.push(file);
164
- }
165
- }
166
- }
167
- return files;
168
- }
169
- /**
170
- * Parse commit hash from output
171
- */
172
- parseCommitHash(output) {
173
- const match = output.match(/commit\s+([a-f0-9]{7,40})/i);
174
- return match ? match[1] : undefined;
175
- }
176
- /**
177
- * Kill the worker process
178
- */
179
- kill() {
180
- if (this.process && !this.process.killed) {
181
- this.process.kill('SIGTERM');
182
- // Force kill after 5 seconds
183
- setTimeout(() => {
184
- if (this.process && !this.process.killed) {
185
- this.process.kill('SIGKILL');
186
- }
187
- }, 5000);
188
- }
189
- }
190
- /**
191
- * Check if worker is busy
192
- */
193
- isBusy() {
194
- return this.state === 'running';
195
- }
196
- /**
197
- * Check if worker is available
198
- */
199
- isAvailable() {
200
- return this.state === 'idle' || this.state === 'completed' || this.state === 'failed';
201
- }
202
- /**
203
- * Reset worker for reuse
204
- */
205
- reset() {
206
- this.state = 'idle';
207
- this.currentTask = null;
208
- this.startedAt = 0;
209
- this.output = '';
210
- this.process = null;
211
- }
212
- /**
213
- * Get task output
214
- */
215
- getOutput() {
216
- return this.output;
217
- }
218
- }
219
- /**
220
- * Worker pool for managing multiple workers
221
- */
222
- export class WorkerPool {
223
- workers = [];
224
- inUse = new Set();
225
- options;
226
- maxWorkers;
227
- constructor(maxWorkers, options) {
228
- this.maxWorkers = maxWorkers;
229
- this.options = options;
230
- }
231
- /**
232
- * Get an available worker (or create one if pool not full)
233
- */
234
- getWorker() {
235
- // Create new worker if pool not full
236
- if (this.workers.length < this.maxWorkers) {
237
- const worker = new Worker(this.options);
238
- this.workers.push(worker);
239
- this.inUse.add(worker.id);
240
- return worker;
241
- }
242
- // Try to find an available worker that's not in use
243
- const available = this.workers.find(w => w.isAvailable() && !this.inUse.has(w.id));
244
- if (available) {
245
- available.reset();
246
- this.inUse.add(available.id);
247
- return available;
248
- }
249
- return null;
250
- }
251
- /**
252
- * Release a worker back to the pool
253
- */
254
- releaseWorker(worker) {
255
- this.inUse.delete(worker.id);
256
- }
257
- /**
258
- * Get all workers
259
- */
260
- getAllWorkers() {
261
- return [...this.workers];
262
- }
263
- /**
264
- * Get worker by ID
265
- */
266
- getWorkerById(id) {
267
- return this.workers.find(w => w.id === id);
268
- }
269
- /**
270
- * Get number of busy workers
271
- */
272
- getBusyCount() {
273
- return this.workers.filter(w => w.isBusy()).length;
274
- }
275
- /**
276
- * Get number of available workers
277
- */
278
- getAvailableCount() {
279
- return Math.max(0, this.maxWorkers - this.getBusyCount());
280
- }
281
- /**
282
- * Kill all workers
283
- */
284
- killAll() {
285
- for (const worker of this.workers) {
286
- worker.kill();
287
- }
288
- }
289
- /**
290
- * Get pool status
291
- */
292
- getStatus() {
293
- return {
294
- total: this.workers.length,
295
- busy: this.getBusyCount(),
296
- available: this.getAvailableCount(),
297
- };
298
- }
299
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Tool: analyzeFile
3
- * Structured analysis of a Source File (TS/JS) using ts-morph
4
- */
5
- import { z } from 'zod';
6
- export declare const name = "analyzeFile";
7
- export declare const description = "Perform structured analysis of a TypeScript/JavaScript file to extract classes, functions, and interfaces.";
8
- export declare const permission: "read";
9
- export declare const schema: z.ZodObject<{
10
- path: z.ZodString;
11
- }, "strip", z.ZodTypeAny, {
12
- path: string;
13
- }, {
14
- path: string;
15
- }>;
16
- export declare const execute: (args: Record<string, unknown>) => Promise<unknown>;
@@ -1,43 +0,0 @@
1
- /**
2
- * Tool: analyzeFile
3
- * Structured analysis of a Source File (TS/JS) using ts-morph
4
- */
5
- import { Project, ScriptTarget } from 'ts-morph';
6
- import { z } from 'zod';
7
- import { readFile } from 'fs/promises';
8
- export const name = 'analyzeFile';
9
- export const description = 'Perform structured analysis of a TypeScript/JavaScript file to extract classes, functions, and interfaces.';
10
- export const permission = 'read';
11
- export const schema = z.object({
12
- path: z.string().describe('Path to the file to analyze')
13
- });
14
- export const execute = async (args) => {
15
- const parsed = schema.parse(args);
16
- const path = parsed.path;
17
- try {
18
- const content = await readFile(path, 'utf-8');
19
- const project = new Project({
20
- compilerOptions: { target: ScriptTarget.ESNext, allowJs: true },
21
- useInMemoryFileSystem: true
22
- });
23
- const sourceFile = project.createSourceFile(path, content);
24
- return {
25
- path,
26
- classes: sourceFile.getClasses().map(c => ({
27
- name: c.getName(),
28
- methods: c.getMethods().map(m => m.getName()),
29
- properties: c.getProperties().map(p => p.getName())
30
- })),
31
- functions: sourceFile.getFunctions().map(f => ({
32
- name: f.getName(),
33
- params: f.getParameters().map(p => p.getName())
34
- })),
35
- interfaces: sourceFile.getInterfaces().map(i => i.getName()),
36
- types: sourceFile.getTypeAliases().map(t => t.getName()),
37
- exports: sourceFile.getExportedDeclarations().keys()
38
- };
39
- }
40
- catch (error) {
41
- throw new Error(`Failed to analyze file ${path}: ${error instanceof Error ? error.message : error}`);
42
- }
43
- };
@@ -1,40 +0,0 @@
1
- /**
2
- * Git Tool - Git operations for version control
3
- * Based on Aider's repo.py
4
- */
5
- import { z } from 'zod';
6
- import type { Tool } from '../registry.js';
7
- export declare const inputSchema: z.ZodObject<{
8
- operation: z.ZodEnum<["status", "diff", "log", "add", "commit", "branch", "checkout", "stash", "show", "blame"]>;
9
- args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
- cwd: z.ZodOptional<z.ZodString>;
11
- message: z.ZodOptional<z.ZodString>;
12
- files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
13
- }, "strip", z.ZodTypeAny, {
14
- operation: "status" | "diff" | "log" | "add" | "commit" | "branch" | "checkout" | "stash" | "show" | "blame";
15
- files?: string[] | undefined;
16
- message?: string | undefined;
17
- args?: string[] | undefined;
18
- cwd?: string | undefined;
19
- }, {
20
- operation: "status" | "diff" | "log" | "add" | "commit" | "branch" | "checkout" | "stash" | "show" | "blame";
21
- files?: string[] | undefined;
22
- message?: string | undefined;
23
- args?: string[] | undefined;
24
- cwd?: string | undefined;
25
- }>;
26
- type GitInput = z.infer<typeof inputSchema>;
27
- interface GitResult {
28
- operation: string;
29
- success: boolean;
30
- output: string;
31
- error?: string;
32
- }
33
- export declare function execute(input: GitInput): Promise<GitResult>;
34
- export declare function getCurrentBranch(cwd?: string): string | null;
35
- export declare function getChangedFiles(cwd?: string): string[];
36
- export declare function getTrackedFiles(cwd?: string): string[];
37
- export declare function isIgnored(filePath: string, cwd?: string): boolean;
38
- export declare function getStagedDiff(cwd?: string): string | null;
39
- export declare const tool: Tool;
40
- export {};
package/dist/tools/git.js DELETED
@@ -1,236 +0,0 @@
1
- /**
2
- * Git Tool - Git operations for version control
3
- * Based on Aider's repo.py
4
- */
5
- import { z } from 'zod';
6
- import { execSync, spawnSync } from 'child_process';
7
- // Input schema for git operations
8
- export const inputSchema = z.object({
9
- operation: z.enum([
10
- 'status',
11
- 'diff',
12
- 'log',
13
- 'add',
14
- 'commit',
15
- 'branch',
16
- 'checkout',
17
- 'stash',
18
- 'show',
19
- 'blame',
20
- ]).describe('Git operation to perform'),
21
- args: z.array(z.string()).optional().describe('Additional arguments for the operation'),
22
- cwd: z.string().optional().describe('Working directory'),
23
- message: z.string().optional().describe('Commit message (for commit operation)'),
24
- files: z.array(z.string()).optional().describe('Files to operate on'),
25
- });
26
- // Check if directory is a git repository
27
- function isGitRepo(cwd) {
28
- try {
29
- execSync('git rev-parse --git-dir', {
30
- cwd,
31
- encoding: 'utf-8',
32
- stdio: ['pipe', 'pipe', 'pipe'],
33
- });
34
- return true;
35
- }
36
- catch {
37
- return false;
38
- }
39
- }
40
- // Run git command
41
- function runGit(args, cwd) {
42
- const operation = args[0] || 'unknown';
43
- try {
44
- const result = spawnSync('git', args, {
45
- cwd,
46
- encoding: 'utf-8',
47
- maxBuffer: 10 * 1024 * 1024, // 10MB
48
- timeout: 60000,
49
- });
50
- if (result.error) {
51
- return {
52
- operation,
53
- success: false,
54
- output: '',
55
- error: result.error.message,
56
- };
57
- }
58
- const output = (result.stdout || '') + (result.stderr || '');
59
- const success = result.status === 0;
60
- return {
61
- operation,
62
- success,
63
- output: output.trim(),
64
- error: success ? undefined : output.trim(),
65
- };
66
- }
67
- catch (error) {
68
- return {
69
- operation,
70
- success: false,
71
- output: '',
72
- error: error instanceof Error ? error.message : String(error),
73
- };
74
- }
75
- }
76
- // Execute git operation
77
- export async function execute(input) {
78
- const { operation, args = [], cwd = process.cwd(), message, files = [], } = inputSchema.parse(input);
79
- // Check if it's a git repository
80
- if (!isGitRepo(cwd)) {
81
- return {
82
- operation,
83
- success: false,
84
- output: '',
85
- error: 'Not a git repository',
86
- };
87
- }
88
- // Build git command based on operation
89
- let gitArgs = [];
90
- switch (operation) {
91
- case 'status':
92
- gitArgs = ['status', '--porcelain=v1', ...args];
93
- break;
94
- case 'diff':
95
- gitArgs = ['diff', '--no-color', ...args, ...files];
96
- break;
97
- case 'log':
98
- gitArgs = [
99
- 'log',
100
- '--oneline',
101
- '--no-decorate',
102
- '-n', '20',
103
- ...args,
104
- ];
105
- break;
106
- case 'add':
107
- if (files.length === 0) {
108
- return {
109
- operation,
110
- success: false,
111
- output: '',
112
- error: 'No files specified to add',
113
- };
114
- }
115
- gitArgs = ['add', ...args, ...files];
116
- break;
117
- case 'commit':
118
- if (!message) {
119
- return {
120
- operation,
121
- success: false,
122
- output: '',
123
- error: 'Commit message required',
124
- };
125
- }
126
- gitArgs = ['commit', '-m', message, ...args];
127
- break;
128
- case 'branch':
129
- gitArgs = ['branch', '--no-color', ...args];
130
- break;
131
- case 'checkout':
132
- gitArgs = ['checkout', ...args, ...files];
133
- break;
134
- case 'stash':
135
- gitArgs = ['stash', ...args];
136
- break;
137
- case 'show':
138
- gitArgs = ['show', '--no-color', '--stat', ...args];
139
- break;
140
- case 'blame':
141
- if (files.length === 0) {
142
- return {
143
- operation,
144
- success: false,
145
- output: '',
146
- error: 'File path required for blame',
147
- };
148
- }
149
- gitArgs = ['blame', '--no-color', '-l', ...args, files[0]];
150
- break;
151
- default:
152
- return {
153
- operation,
154
- success: false,
155
- output: '',
156
- error: `Unknown operation: ${operation}`,
157
- };
158
- }
159
- return runGit(gitArgs, cwd);
160
- }
161
- // Get current branch
162
- export function getCurrentBranch(cwd = process.cwd()) {
163
- try {
164
- const result = execSync('git rev-parse --abbrev-ref HEAD', {
165
- cwd,
166
- encoding: 'utf-8',
167
- });
168
- return result.trim();
169
- }
170
- catch {
171
- return null;
172
- }
173
- }
174
- // Get list of changed files
175
- export function getChangedFiles(cwd = process.cwd()) {
176
- try {
177
- const result = execSync('git status --porcelain=v1', {
178
- cwd,
179
- encoding: 'utf-8',
180
- });
181
- return result
182
- .split('\n')
183
- .filter(Boolean)
184
- .map(line => line.slice(3).trim());
185
- }
186
- catch {
187
- return [];
188
- }
189
- }
190
- // Get list of tracked files
191
- export function getTrackedFiles(cwd = process.cwd()) {
192
- try {
193
- const result = execSync('git ls-files', {
194
- cwd,
195
- encoding: 'utf-8',
196
- });
197
- return result.split('\n').filter(Boolean);
198
- }
199
- catch {
200
- return [];
201
- }
202
- }
203
- // Check if file is ignored
204
- export function isIgnored(filePath, cwd = process.cwd()) {
205
- try {
206
- execSync(`git check-ignore -q "${filePath}"`, {
207
- cwd,
208
- encoding: 'utf-8',
209
- });
210
- return true;
211
- }
212
- catch {
213
- return false;
214
- }
215
- }
216
- // Get commit message for staged changes (using AI)
217
- export function getStagedDiff(cwd = process.cwd()) {
218
- try {
219
- const result = execSync('git diff --cached', {
220
- cwd,
221
- encoding: 'utf-8',
222
- });
223
- return result.trim() || null;
224
- }
225
- catch {
226
- return null;
227
- }
228
- }
229
- // Tool definition
230
- export const tool = {
231
- name: 'git',
232
- description: 'Perform git operations: status, diff, log, add, commit, branch, checkout, stash, show, blame',
233
- inputSchema,
234
- permission: 'execute',
235
- execute: async (args) => execute(args),
236
- };
@@ -1,34 +0,0 @@
1
- /**
2
- * Glob Tool - Find files matching patterns
3
- * Uses fast-glob for reliable glob matching (with fallback)
4
- */
5
- import { z } from 'zod';
6
- import type { Tool } from '../registry.js';
7
- export declare const inputSchema: z.ZodObject<{
8
- pattern: z.ZodString;
9
- cwd: z.ZodOptional<z.ZodString>;
10
- maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
11
- includeDirectories: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
- ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
13
- }, "strip", z.ZodTypeAny, {
14
- pattern: string;
15
- maxResults: number;
16
- includeDirectories: boolean;
17
- ignore?: string[] | undefined;
18
- cwd?: string | undefined;
19
- }, {
20
- pattern: string;
21
- ignore?: string[] | undefined;
22
- cwd?: string | undefined;
23
- maxResults?: number | undefined;
24
- includeDirectories?: boolean | undefined;
25
- }>;
26
- type GlobInput = z.infer<typeof inputSchema>;
27
- export declare function execute(input: GlobInput): Promise<{
28
- pattern: string;
29
- matches: string[];
30
- count: number;
31
- truncated: boolean;
32
- }>;
33
- export declare const tool: Tool;
34
- export {};