@compilr-dev/agents-coding 0.2.1 → 1.0.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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -726
  3. package/dist/core.d.ts +7 -0
  4. package/dist/core.d.ts.map +1 -0
  5. package/dist/core.js +7 -0
  6. package/dist/core.js.map +1 -0
  7. package/dist/dispatcher.d.ts +27 -0
  8. package/dist/dispatcher.d.ts.map +1 -0
  9. package/dist/dispatcher.js +68 -0
  10. package/dist/dispatcher.js.map +1 -0
  11. package/dist/index.d.ts +77 -31
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +157 -67
  14. package/dist/index.js.map +1 -0
  15. package/package.json +26 -30
  16. package/dist/skills/index.d.ts +0 -49
  17. package/dist/skills/index.js +0 -532
  18. package/dist/tools/git/branch.d.ts +0 -17
  19. package/dist/tools/git/branch.js +0 -264
  20. package/dist/tools/git/commit.d.ts +0 -23
  21. package/dist/tools/git/commit.js +0 -280
  22. package/dist/tools/git/diff.d.ts +0 -19
  23. package/dist/tools/git/diff.js +0 -221
  24. package/dist/tools/git/index.d.ts +0 -10
  25. package/dist/tools/git/index.js +0 -11
  26. package/dist/tools/git/log.d.ts +0 -19
  27. package/dist/tools/git/log.js +0 -235
  28. package/dist/tools/git/stash.d.ts +0 -17
  29. package/dist/tools/git/stash.js +0 -294
  30. package/dist/tools/git/status.d.ts +0 -19
  31. package/dist/tools/git/status.js +0 -160
  32. package/dist/tools/git/types.d.ts +0 -293
  33. package/dist/tools/git/types.js +0 -4
  34. package/dist/tools/git/utils.d.ts +0 -58
  35. package/dist/tools/git/utils.js +0 -197
  36. package/dist/tools/index.d.ts +0 -5
  37. package/dist/tools/index.js +0 -5
  38. package/dist/tools/project/detect.d.ts +0 -19
  39. package/dist/tools/project/detect.js +0 -341
  40. package/dist/tools/project/find-root.d.ts +0 -21
  41. package/dist/tools/project/find-root.js +0 -239
  42. package/dist/tools/project/index.d.ts +0 -6
  43. package/dist/tools/project/index.js +0 -5
  44. package/dist/tools/project/types.d.ts +0 -83
  45. package/dist/tools/project/types.js +0 -4
  46. package/dist/tools/runners/build.d.ts +0 -19
  47. package/dist/tools/runners/build.js +0 -306
  48. package/dist/tools/runners/format.d.ts +0 -19
  49. package/dist/tools/runners/format.js +0 -376
  50. package/dist/tools/runners/index.d.ts +0 -9
  51. package/dist/tools/runners/index.js +0 -9
  52. package/dist/tools/runners/lint.d.ts +0 -19
  53. package/dist/tools/runners/lint.js +0 -356
  54. package/dist/tools/runners/test.d.ts +0 -19
  55. package/dist/tools/runners/test.js +0 -386
  56. package/dist/tools/runners/types.d.ts +0 -97
  57. package/dist/tools/runners/types.js +0 -4
  58. package/dist/tools/runners/utils.d.ts +0 -69
  59. package/dist/tools/runners/utils.js +0 -179
  60. package/dist/tools/search/definition.d.ts +0 -19
  61. package/dist/tools/search/definition.js +0 -305
  62. package/dist/tools/search/index.d.ts +0 -8
  63. package/dist/tools/search/index.js +0 -8
  64. package/dist/tools/search/references.d.ts +0 -19
  65. package/dist/tools/search/references.js +0 -179
  66. package/dist/tools/search/todos.d.ts +0 -19
  67. package/dist/tools/search/todos.js +0 -269
  68. package/dist/tools/search/types.d.ts +0 -132
  69. package/dist/tools/search/types.js +0 -4
  70. package/dist/tools/search/utils.d.ts +0 -45
  71. package/dist/tools/search/utils.js +0 -152
package/README.md CHANGED
@@ -1,15 +1,10 @@
1
1
  # @compilr-dev/agents-coding
2
2
 
3
- Coding-specific tools for [@compilr-dev/agents](https://github.com/scozzola/compilr-dev-agents) - Git operations, project detection, smart runners, and code search.
3
+ Multi-language coding tools for AI agents - umbrella package with auto-detection.
4
4
 
5
5
  ## Overview
6
6
 
7
- This extension package provides tools specifically designed for building AI coding assistants. It complements the core `@compilr-dev/agents` library with:
8
-
9
- - **Git Tools** - Structured git operations with parsed output
10
- - **Project Detection** - Auto-detect project type, package manager, and tooling
11
- - **Smart Runners** - Auto-detect and run tests, lint, build, format
12
- - **Code Search** - Find definitions, references, and TODO comments
7
+ This is the **umbrella package** that provides a unified interface for all coding tools across multiple programming languages. It automatically detects the language from file extensions and routes to the appropriate parser.
13
8
 
14
9
  ## Installation
15
10
 
@@ -17,772 +12,128 @@ This extension package provides tools specifically designed for building AI codi
17
12
  npm install @compilr-dev/agents-coding @compilr-dev/agents
18
13
  ```
19
14
 
15
+ This single install gives you:
16
+ - **Core Tools** - Git operations, project detection, smart runners, code search
17
+ - **TypeScript/JavaScript** - AST-based analysis via TypeScript compiler
18
+ - **Python** - AST-based analysis via Tree-sitter
19
+ - **Go** - AST-based analysis via Tree-sitter
20
+
20
21
  ## Quick Start
21
22
 
22
23
  ```typescript
23
24
  import { Agent } from '@compilr-dev/agents';
24
- import { allCodingTools } from '@compilr-dev/agents-coding';
25
-
26
- // Create an agent with coding tools
27
- const agent = new Agent({
28
- provider: yourProvider,
29
- tools: allCodingTools,
30
- });
31
-
32
- // Or register specific tools
33
25
  import {
26
+ // Core tools (language-agnostic)
34
27
  gitStatusTool,
35
- gitCommitTool,
36
- gitBranchTool,
28
+ gitDiffTool,
37
29
  detectProjectTool,
38
30
  runTestsTool,
39
- runLintTool,
40
- findDefinitionTool,
41
- findReferencesTool,
42
- findTodosTool,
31
+
32
+ // Unified tools with auto-detection
33
+ getFileStructureTool,
43
34
  } from '@compilr-dev/agents-coding';
44
35
 
45
36
  const agent = new Agent({
46
37
  provider: yourProvider,
47
- tools: [gitStatusTool, detectProjectTool],
48
- });
49
- ```
50
-
51
- ## Available Tools
52
-
53
- ### Project Detection
54
-
55
- #### `detectProjectTool`
56
-
57
- Detect project type and available tooling in a directory.
58
-
59
- ```typescript
60
- const result = await detectProjectTool.execute({ path: '/path/to/project' });
61
- // Returns:
62
- // {
63
- // type: 'node',
64
- // types: ['node'],
65
- // packageManager: 'pnpm',
66
- // testFramework: 'vitest',
67
- // linter: 'eslint',
68
- // formatter: 'prettier',
69
- // buildTool: 'vite',
70
- // configFiles: ['package.json', 'tsconfig.json'],
71
- // name: 'my-project'
72
- // }
73
- ```
74
-
75
- **Supported Project Types:**
76
- - `node` - package.json
77
- - `python` - pyproject.toml, setup.py, requirements.txt
78
- - `rust` - Cargo.toml
79
- - `go` - go.mod
80
- - `java` - pom.xml, build.gradle
81
- - `ruby` - Gemfile
82
- - `php` - composer.json
83
- - `dotnet` - *.csproj, *.sln
84
-
85
- #### `findProjectRootTool`
86
-
87
- Find the root directory of a project by looking for marker files.
88
-
89
- ```typescript
90
- const result = await findProjectRootTool.execute({
91
- path: '/path/to/project/src/components',
92
- markers: ['.git', 'package.json'] // optional, uses defaults
93
- });
94
- // Returns:
95
- // {
96
- // root: '/path/to/project',
97
- // foundMarker: 'package.json',
98
- // depth: 2
99
- // }
100
- ```
101
-
102
- ### Git Tools
103
-
104
- #### `gitStatusTool`
105
-
106
- Get structured git working tree status.
107
-
108
- ```typescript
109
- const result = await gitStatusTool.execute({ path: '/path/to/repo' });
110
- // Returns:
111
- // {
112
- // branch: 'main',
113
- // tracking: { remote: 'origin/main', ahead: 2, behind: 0 },
114
- // staged: [{ path: 'src/index.ts', status: 'modified' }],
115
- // modified: [{ path: 'README.md', status: 'modified' }],
116
- // untracked: ['temp.txt'],
117
- // isClean: false
118
- // }
119
- ```
120
-
121
- **Options:**
122
- - `includeUntracked` - Include untracked files (default: true)
123
- - `short` - Also return short format status string
124
-
125
- #### `gitDiffTool`
126
-
127
- Show changes between commits, working tree, etc.
128
-
129
- ```typescript
130
- // Unstaged changes
131
- const result = await gitDiffTool.execute({ path: '/path/to/repo' });
132
-
133
- // Staged changes
134
- const result = await gitDiffTool.execute({ path: '/path/to/repo', staged: true });
135
-
136
- // Compare with a ref
137
- const result = await gitDiffTool.execute({ path: '/path/to/repo', ref: 'HEAD~3' });
138
-
139
- // Compare two refs
140
- const result = await gitDiffTool.execute({
141
- path: '/path/to/repo',
142
- refA: 'main',
143
- refB: 'feature-branch'
144
- });
145
-
146
- // Returns:
147
- // {
148
- // diff: '--- a/file.txt\n+++ b/file.txt\n...',
149
- // files: [{ path: 'file.txt', additions: 10, deletions: 3 }],
150
- // stats: { filesChanged: 1, insertions: 10, deletions: 3 }
151
- // }
152
- ```
153
-
154
- **Options:**
155
- - `staged` - Show staged changes instead of unstaged
156
- - `file` - Diff a specific file
157
- - `ref` - Compare with a commit/branch
158
- - `refA`, `refB` - Compare two refs
159
- - `context` - Number of context lines (default: 3)
160
- - `statOnly` - Show only statistics, no diff content
161
- - `nameOnly` - Show only names of changed files
162
-
163
- #### `gitLogTool`
164
-
165
- Show commit history with filtering options.
166
-
167
- ```typescript
168
- const result = await gitLogTool.execute({
169
- path: '/path/to/repo',
170
- limit: 10,
171
- author: 'john',
172
- since: '2 weeks ago',
173
- grep: 'feat:'
174
- });
175
- // Returns:
176
- // {
177
- // commits: [
178
- // {
179
- // hash: 'abc123...',
180
- // shortHash: 'abc123',
181
- // author: 'John Doe',
182
- // email: 'john@example.com',
183
- // date: '2024-01-15T10:30:00Z',
184
- // message: 'feat: add new feature',
185
- // body: 'Detailed description...'
186
- // }
187
- // ]
188
- // }
189
- ```
190
-
191
- **Options:**
192
- - `limit` - Number of commits (default: 10)
193
- - `file` - Filter by file path
194
- - `author` - Filter by author name/email
195
- - `since`, `until` - Date range filters
196
- - `grep` - Filter by message pattern
197
- - `ref` - Branch/ref to show log for
198
- - `stat` - Include diff statistics
199
-
200
- #### `gitCommitTool`
201
-
202
- Create a git commit with safety features.
203
-
204
- ```typescript
205
- const result = await gitCommitTool.execute({
206
- path: '/path/to/repo',
207
- message: 'feat: add new feature',
208
- files: ['src/index.ts', 'src/utils.ts'], // specific files to stage
209
- // OR
210
- addAll: true, // stage all including untracked
211
- // OR
212
- addModified: true, // stage only modified tracked files
213
- });
214
- // Returns:
215
- // {
216
- // hash: 'abc123def456...',
217
- // shortHash: 'abc123d',
218
- // branch: 'main',
219
- // filesCommitted: 2,
220
- // insertions: 45,
221
- // deletions: 12,
222
- // message: 'feat: add new feature'
223
- // }
224
- ```
225
-
226
- **Safety Features:**
227
- - Automatically blocks commits containing potential secrets (`.env`, `credentials.json`, `.pem`, etc.)
228
- - Warns about large files (>1MB)
229
- - Requires explicit confirmation for `amend` and `noVerify` options
230
-
231
- **Options:**
232
- - `message` (required) - Commit message
233
- - `files` - Specific files to stage before committing
234
- - `addAll` - Stage all files including untracked (`git add -A`)
235
- - `addModified` - Stage modified/deleted tracked files only (`git add -u`)
236
- - `allowEmpty` - Allow creating an empty commit
237
- - `amend` - Amend the previous commit (dangerous)
238
- - `noVerify` - Skip pre-commit hooks (dangerous)
239
-
240
- #### `gitBranchTool`
241
-
242
- Manage git branches.
243
-
244
- ```typescript
245
- // List all branches
246
- const result = await gitBranchTool.execute({
247
- path: '/path/to/repo',
248
- action: 'list',
249
- remotes: true, // include remote branches
250
- });
251
- // Returns:
252
- // {
253
- // current: 'main',
254
- // branches: [
255
- // { name: 'main', isCurrent: true, tracking: 'origin/main', lastCommit: 'abc123' },
256
- // { name: 'feature-x', isCurrent: false, tracking: 'origin/feature-x' }
257
- // ],
258
- // message: 'Found 2 branch(es)'
259
- // }
260
-
261
- // Create a new branch
262
- await gitBranchTool.execute({
263
- path: '/path/to/repo',
264
- action: 'create',
265
- name: 'feature-y',
266
- startPoint: 'main', // optional base
267
- });
268
-
269
- // Switch branches
270
- await gitBranchTool.execute({
271
- path: '/path/to/repo',
272
- action: 'switch',
273
- name: 'feature-y',
274
- });
275
-
276
- // Delete a branch
277
- await gitBranchTool.execute({
278
- path: '/path/to/repo',
279
- action: 'delete',
280
- name: 'feature-y',
281
- force: true, // delete even if not merged
282
- });
283
-
284
- // Rename a branch
285
- await gitBranchTool.execute({
286
- path: '/path/to/repo',
287
- action: 'rename',
288
- name: 'old-name',
289
- newName: 'new-name',
290
- });
291
- ```
292
-
293
- **Actions:**
294
- - `list` - Show all branches
295
- - `create` - Create a new branch
296
- - `delete` - Delete a branch (protects current branch)
297
- - `switch` - Switch to a branch
298
- - `rename` - Rename a branch
299
-
300
- #### `gitStashTool`
301
-
302
- Manage git stashes.
303
-
304
- ```typescript
305
- // Stash current changes
306
- const result = await gitStashTool.execute({
307
- path: '/path/to/repo',
308
- action: 'push',
309
- message: 'WIP: feature work',
310
- includeUntracked: true,
311
- });
312
- // Returns:
313
- // { message: 'Stashed changes: WIP: feature work' }
314
-
315
- // List all stashes
316
- const result = await gitStashTool.execute({
317
- path: '/path/to/repo',
318
- action: 'list',
319
- });
320
- // Returns:
321
- // {
322
- // stashes: [
323
- // { ref: 'stash@{0}', index: 0, branch: 'main', message: 'WIP: feature work' },
324
- // { ref: 'stash@{1}', index: 1, branch: 'main', message: 'backup' }
325
- // ],
326
- // message: 'Found 2 stash(es)'
327
- // }
328
-
329
- // Pop stash (apply and remove)
330
- await gitStashTool.execute({
331
- path: '/path/to/repo',
332
- action: 'pop',
333
- index: 0, // optional, defaults to 0
334
- });
335
-
336
- // Apply stash (keep in stash list)
337
- await gitStashTool.execute({
338
- path: '/path/to/repo',
339
- action: 'apply',
340
- index: 0,
341
- });
342
-
343
- // Show stash contents
344
- const result = await gitStashTool.execute({
345
- path: '/path/to/repo',
346
- action: 'show',
347
- index: 0,
348
- });
349
- // Returns:
350
- // { diff: '--- a/file.txt\n...', message: ' file.txt | 5 ++---\n 1 file changed...' }
351
-
352
- // Drop a specific stash
353
- await gitStashTool.execute({
354
- path: '/path/to/repo',
355
- action: 'drop',
356
- index: 1,
357
- });
358
-
359
- // Clear all stashes
360
- await gitStashTool.execute({
361
- path: '/path/to/repo',
362
- action: 'clear',
363
- });
364
- ```
365
-
366
- **Actions:**
367
- - `push` - Save changes to stash
368
- - `pop` - Apply and remove stash
369
- - `apply` - Apply stash without removing
370
- - `list` - Show all stashes
371
- - `drop` - Remove a specific stash
372
- - `clear` - Remove all stashes
373
- - `show` - Display stash contents
374
-
375
- ### Smart Runner Tools
376
-
377
- All runner tools support a `dryRun` option to detect the tool/framework and return the command without actually executing it. This is useful for:
378
- - Previewing what command would run
379
- - Testing detection logic without side effects
380
- - Implementing "rehearsal" patterns for safety
381
-
382
- ```typescript
383
- // Dry run - just detect, don't execute
384
- const result = await runBuildTool.execute({
385
- path: '/path/to/project',
386
- dryRun: true,
387
- });
388
- // Returns detected tool and command without running it:
389
- // { buildTool: 'vite', command: 'npx vite build', output: '(dry run - command not executed)' }
390
- ```
391
-
392
- #### `runTestsTool`
393
-
394
- Auto-detect and run tests using the appropriate test framework.
395
-
396
- ```typescript
397
- const result = await runTestsTool.execute({
398
- path: '/path/to/project',
399
- pattern: 'src/**/*.test.ts', // optional filter
400
- coverage: true,
401
- verbose: true,
402
- });
403
- // Returns:
404
- // {
405
- // command: 'npx vitest run --coverage',
406
- // output: '...',
407
- // exitCode: 0,
408
- // duration: 5230,
409
- // success: true,
410
- // framework: 'vitest',
411
- // passed: 42,
412
- // failed: 0,
413
- // total: 42
414
- // }
415
- ```
416
-
417
- **Supported Frameworks:**
418
- - `vitest` - vitest.config.ts/js or dependency
419
- - `jest` - jest.config.ts/js/json or dependency
420
- - `mocha` - .mocharc.json/js/yaml or dependency
421
- - `ava` - ava.config.js/cjs or dependency
422
- - `npm test` - package.json scripts.test
423
- - `pytest` - pytest.ini, pyproject.toml, conftest.py
424
- - `unittest` - setup.py, setup.cfg
425
- - `cargo test` - Cargo.toml
426
- - `go test` - go.mod
427
-
428
- **Options:**
429
- - `pattern` - Test file pattern or name filter
430
- - `watch` - Run in watch mode
431
- - `coverage` - Generate coverage report
432
- - `verbose` - Verbose output
433
- - `updateSnapshots` - Update test snapshots (jest/vitest)
434
- - `timeout` - Command timeout in milliseconds
435
-
436
- #### `runLintTool`
437
-
438
- Auto-detect and run linter.
439
-
440
- ```typescript
441
- const result = await runLintTool.execute({
442
- path: '/path/to/project',
443
- fix: true,
444
- files: ['src/index.ts'],
445
- });
446
- // Returns:
447
- // {
448
- // command: 'npx eslint src/index.ts --fix',
449
- // output: '...',
450
- // exitCode: 0,
451
- // duration: 1230,
452
- // success: true,
453
- // linter: 'eslint',
454
- // errors: 0,
455
- // warnings: 2
456
- // }
457
- ```
458
-
459
- **Supported Linters:**
460
- - `eslint` - eslint.config.js/mjs/cjs, .eslintrc.* or dependency
461
- - `biome` - biome.json/jsonc or dependency
462
- - `npm lint` - package.json scripts.lint
463
- - `ruff` - ruff.toml, .ruff.toml
464
- - `pylint` - .pylintrc, pylintrc
465
- - `flake8` - .flake8, setup.cfg
466
- - `clippy` - Cargo.toml
467
- - `golangci-lint` - .golangci.yml/yaml/json or go.mod
468
-
469
- **Options:**
470
- - `files` - Specific files to lint
471
- - `fix` - Auto-fix issues
472
- - `format` - Output format (json, stylish, etc.)
473
- - `timeout` - Command timeout
474
-
475
- #### `runBuildTool`
476
-
477
- Auto-detect and run build.
478
-
479
- ```typescript
480
- const result = await runBuildTool.execute({
481
- path: '/path/to/project',
482
- production: true,
483
- });
484
- // Returns:
485
- // {
486
- // command: 'npx vite build --mode production',
487
- // output: '...',
488
- // exitCode: 0,
489
- // duration: 8500,
490
- // success: true,
491
- // buildTool: 'vite'
492
- // }
493
- ```
494
-
495
- **Supported Build Tools:**
496
- - `vite` - vite.config.ts/js/mjs or dependency
497
- - `next` - next.config.js/mjs/ts or dependency
498
- - `tsc` - tsconfig.json with typescript dependency
499
- - `webpack` - webpack.config.js/ts or dependency
500
- - `rollup` - rollup.config.js/mjs or dependency
501
- - `esbuild` - esbuild.config.js/mjs or dependency
502
- - `turbo` - turbo.json or dependency
503
- - `npm build` - package.json scripts.build
504
- - `cargo build` - Cargo.toml
505
- - `go build` - go.mod
506
- - `python build` - setup.py, pyproject.toml
507
- - `maven` - pom.xml
508
- - `gradle` - build.gradle, build.gradle.kts
509
-
510
- **Options:**
511
- - `production` - Build for production
512
- - `clean` - Clean before build
513
- - `timeout` - Command timeout
514
-
515
- #### `runFormatTool`
516
-
517
- Auto-detect and run formatter.
518
-
519
- ```typescript
520
- const result = await runFormatTool.execute({
521
- path: '/path/to/project',
522
- check: true, // check only, don't write
523
- });
524
- // Returns:
525
- // {
526
- // command: 'npx prettier --check .',
527
- // output: '...',
528
- // exitCode: 0,
529
- // duration: 2100,
530
- // success: true,
531
- // formatter: 'prettier',
532
- // filesProcessed: 45
533
- // }
534
- ```
535
-
536
- **Supported Formatters:**
537
- - `prettier` - .prettierrc.* or prettier.config.* or dependency
538
- - `biome` - biome.json/jsonc or dependency
539
- - `dprint` - dprint.json, .dprint.json or dependency
540
- - `npm format` - package.json scripts.format
541
- - `black` - pyproject.toml, .black
542
- - `ruff format` - ruff.toml, .ruff.toml
543
- - `autopep8` - .pep8, setup.cfg
544
- - `rustfmt` - Cargo.toml
545
- - `gofmt` - go.mod
546
- - `goimports` - go.mod
547
-
548
- **Options:**
549
- - `files` - Specific files to format
550
- - `check` - Check only, don't write changes
551
- - `timeout` - Command timeout
552
-
553
- ### Code Search Tools
554
-
555
- #### `findDefinitionTool`
556
-
557
- Find where a symbol is defined in the codebase.
558
-
559
- ```typescript
560
- const result = await findDefinitionTool.execute({
561
- path: '/path/to/project',
562
- symbol: 'calculateSum',
563
- fileType: 'ts', // optional filter
38
+ tools: [gitStatusTool, detectProjectTool, getFileStructureTool],
564
39
  });
565
- // Returns:
566
- // {
567
- // definitions: [
568
- // {
569
- // file: 'src/utils.ts',
570
- // line: 8,
571
- // column: 17,
572
- // context: 'export function calculateSum(a: number, b: number): number {',
573
- // type: 'function',
574
- // isExported: true
575
- // }
576
- // ],
577
- // totalFound: 1,
578
- // symbol: 'calculateSum'
579
- // }
580
40
  ```
581
41
 
582
- **Supported Languages:**
583
- - TypeScript/JavaScript - functions, classes, interfaces, types, const, enums
584
- - Python - functions, classes, async functions
585
- - Rust - fn, struct, enum, trait, type
586
- - Go - func, type, const, var
587
- - Java/Kotlin - classes, interfaces, methods
42
+ ## Package Structure
588
43
 
589
- **Options:**
590
- - `symbol` (required) - Symbol name to find
591
- - `path` - Working directory
592
- - `fileType` - File type filter (ts, py, rs, go, java, etc.)
593
- - `limit` - Maximum results (default: 20)
44
+ | Package | Description |
45
+ |---------|-------------|
46
+ | `@compilr-dev/agents-coding` | This umbrella (re-exports everything) |
47
+ | `@compilr-dev/agents-coding-core` | Language-agnostic tools (git, runners, search) |
48
+ | `@compilr-dev/agents-coding-ts` | TypeScript/JavaScript analysis |
49
+ | `@compilr-dev/agents-coding-python` | Python analysis |
50
+ | `@compilr-dev/agents-coding-go` | Go analysis |
594
51
 
595
- #### `findReferencesTool`
52
+ ## Language Auto-Detection
596
53
 
597
- Find all usages of a symbol in the codebase.
54
+ The umbrella provides unified tools that automatically detect the language:
598
55
 
599
56
  ```typescript
600
- const result = await findReferencesTool.execute({
601
- path: '/path/to/project',
602
- symbol: 'calculateSum',
603
- excludeDefinitions: true,
604
- });
605
- // Returns:
606
- // {
607
- // references: [
608
- // { file: 'src/main.ts', line: 5, column: 18, context: ' const sum = calculateSum(1, 2);' },
609
- // { file: 'src/calc.ts', line: 12, column: 10, context: ' return calculateSum(a, b);' }
610
- // ],
611
- // totalFound: 2,
612
- // symbol: 'calculateSum'
613
- // }
614
- ```
615
-
616
- **Options:**
617
- - `symbol` (required) - Symbol name to find
618
- - `path` - Working directory
619
- - `fileType` - File type filter
620
- - `excludeDefinitions` - Exclude definition lines, show only usages (default: false)
621
- - `limit` - Maximum results (default: 50)
57
+ import { detectLanguage, getFileStructureTool } from '@compilr-dev/agents-coding';
622
58
 
623
- #### `findTodosTool`
59
+ // Detect language from file path
60
+ detectLanguage('src/app.ts'); // 'typescript'
61
+ detectLanguage('main.py'); // 'python'
62
+ detectLanguage('cmd/server.go'); // 'go'
624
63
 
625
- Find TODO, FIXME, HACK, and other comment markers in code.
626
-
627
- ```typescript
628
- const result = await findTodosTool.execute({
629
- path: '/path/to/project',
630
- types: ['TODO', 'FIXME'],
631
- includeAuthor: true,
632
- });
633
- // Returns:
634
- // {
635
- // todos: [
636
- // {
637
- // type: 'TODO',
638
- // file: 'src/utils.ts',
639
- // line: 5,
640
- // text: 'Add error handling',
641
- // author: 'John Doe' // if includeAuthor: true
642
- // },
643
- // {
644
- // type: 'FIXME',
645
- // file: 'src/api.ts',
646
- // line: 42,
647
- // text: 'This needs optimization'
648
- // }
649
- // ],
650
- // summary: { TODO: 1, FIXME: 1 },
651
- // totalFound: 2
652
- // }
64
+ // Unified tool routes to correct parser
65
+ const result = await getFileStructureTool.execute({ path: 'src/app.ts' });
66
+ // Uses TypeScript parser automatically
653
67
  ```
654
68
 
655
- **Supported Comment Types:**
656
- - `TODO` - Tasks to be done
657
- - `FIXME` - Bugs to fix
658
- - `HACK` - Workarounds
659
- - `XXX` - Critical issues
660
- - `NOTE` - Important notes
661
- - `BUG` - Known bugs
662
- - `WARN` - Warnings
663
-
664
- **Options:**
665
- - `path` - Working directory
666
- - `types` - Comment types to find (default: all)
667
- - `fileType` - File type filter (ts, py, rs, go, etc.)
668
- - `includeAuthor` - Include git blame author info (slower, limited to first 20 results)
669
- - `limit` - Maximum results (default: 100)
670
-
671
- ## Factory Functions
69
+ ## Direct Language Access
672
70
 
673
- Each tool has a factory function for customization:
71
+ Access language-specific tools directly when needed:
674
72
 
675
73
  ```typescript
676
- import { createGitStatusTool, createDetectProjectTool } from '@compilr-dev/agents-coding';
677
-
678
- // Custom base directory
679
- const customGitStatus = createGitStatusTool({
680
- baseDir: '/workspace',
681
- defaultIncludeUntracked: false,
682
- });
74
+ import {
75
+ ts, // TypeScript tools
76
+ python, // Python tools
77
+ go, // Go tools
78
+ } from '@compilr-dev/agents-coding';
683
79
 
684
- const customDetectProject = createDetectProjectTool({
685
- baseDir: '/workspace',
686
- });
80
+ // Use language-specific tools directly
81
+ const tsResult = await ts.getFileStructureTool.execute({ path: 'app.ts' });
82
+ const pyResult = await python.getFileStructureTool.execute({ path: 'main.py' });
83
+ const goResult = await go.getFileStructureTool.execute({ path: 'main.go' });
687
84
  ```
688
85
 
689
- ## Design Principles
690
-
691
- 1. **Zero Dependencies** - Only peer dependency on `@compilr-dev/agents`
692
- 2. **Structured Output** - All tools return parsed, typed data (not raw strings)
693
- 3. **CLI-First** - Uses git CLI directly for predictable behavior
694
- 4. **Safety First** - Git tools include protections against dangerous operations
695
- 5. **TypeScript Native** - Full type safety throughout
696
-
697
- ## Roadmap
86
+ ## Core Tools
698
87
 
699
- ### Phase 1: Foundation
700
- - [x] detectProjectTool
701
- - [x] findProjectRootTool
702
- - [x] gitStatusTool
703
- - [x] gitDiffTool
704
- - [x] gitLogTool
88
+ All language-agnostic tools from `@compilr-dev/agents-coding-core`:
705
89
 
706
- ### Phase 2: Core Git
707
- - [x] gitCommitTool - Create commits with safety features
708
- - [x] gitBranchTool - Branch management
709
- - [x] gitStashTool - Stash operations
90
+ ### Git Tools
91
+ - `gitStatusTool` - Parsed git status
92
+ - `gitDiffTool` - Structured diffs
93
+ - `gitLogTool` - Commit history
94
+ - `gitCommitTool` - Safe commit workflow
95
+ - `gitBranchTool` - Branch management
96
+ - `gitStashTool` - Stash operations
710
97
 
711
- ### Phase 3: Smart Runners ✅
712
- - [x] runTestsTool - Auto-detect and run tests
713
- - [x] runLintTool - Auto-detect and run linter
714
- - [x] runBuildTool - Auto-detect and run build
715
- - [x] runFormatTool - Auto-detect and run formatter
98
+ ### Project Detection
99
+ - `detectProjectTool` - Detect project type, framework, tooling
100
+ - `findProjectRootTool` - Find project root directory
716
101
 
717
- ### Phase 4: Code Search ✅
718
- - [x] findDefinitionTool - Find symbol definitions
719
- - [x] findReferencesTool - Find symbol usages
720
- - [x] findTodosTool - Find TODO/FIXME comments
102
+ ### Smart Runners
103
+ - `runTestsTool` - Auto-detect and run tests
104
+ - `runLintTool` - Auto-detect and run linter
105
+ - `runBuildTool` - Auto-detect and run build
106
+ - `runFormatTool` - Auto-detect and run formatter
721
107
 
722
- ### Phase 5: Skills & Polish ✅
723
- - [x] Coding-specific skills (6 skills)
724
- - [x] Comprehensive documentation
108
+ ### Code Search
109
+ - `findDefinitionTool` - Find symbol definitions
110
+ - `findReferencesTool` - Find symbol usages
111
+ - `findTodosTool` - Find TODO/FIXME comments
725
112
 
726
113
  ## Skills
727
114
 
728
- Coding-specific skills for specialized workflows. Use with `SkillRegistry` from `@compilr-dev/agents`.
729
-
730
115
  ```typescript
731
- import { SkillRegistry } from '@compilr-dev/agents';
732
116
  import { codingSkills } from '@compilr-dev/agents-coding';
733
117
 
734
- const registry = new SkillRegistry();
735
- registry.registerAll(codingSkills);
736
-
737
- // Invoke a skill
738
- const result = registry.invoke('git-workflow');
739
- console.log(result.prompt); // Expanded skill prompt
118
+ // Available skills:
119
+ // - git-workflow
120
+ // - test-driven
121
+ // - code-navigation
122
+ // - pr-workflow
123
+ // - project-onboarding
124
+ // - code-optimization
740
125
  ```
741
126
 
742
- ### Available Skills
743
-
744
- | Skill | Description |
745
- |-------|-------------|
746
- | `git-workflow` | Best practices for git operations with safety checks |
747
- | `test-driven` | Test-driven development workflow with smart runners |
748
- | `code-navigation` | Effectively navigate and understand codebases |
749
- | `pr-workflow` | Pull request creation and review workflow |
750
- | `project-onboarding` | Quickly understand and navigate a new project |
751
- | `code-optimization` | Performance optimization workflow |
127
+ ## Requirements
752
128
 
753
- ### Skill Details
129
+ - **Node.js** 18 or higher
130
+ - **@compilr-dev/agents** peer dependency
754
131
 
755
- #### `git-workflow`
756
- Safe git operations including verification before destructive actions, commit workflow, and recovery strategies.
132
+ ## Related Packages
757
133
 
758
- #### `test-driven`
759
- Red-Green-Refactor cycle with integration of `runTests`, `runLint`, `runBuild`, and `runFormat` tools.
760
-
761
- #### `code-navigation`
762
- Using `findDefinition`, `findReferences`, and `findTodos` to understand and navigate code.
763
-
764
- #### `pr-workflow`
765
- Complete PR workflow from branch preparation through review and merge, with pre-flight checks.
766
-
767
- #### `project-onboarding`
768
- Systematic approach to understanding new codebases using `detectProject` and search tools.
769
-
770
- #### `code-optimization`
771
- Performance optimization with measurement-first approach and common optimization patterns.
772
-
773
- ## Runtime Dependencies
774
-
775
- Some tools require external programs to be installed:
776
-
777
- | Tool | Dependency | Installation |
778
- |------|------------|--------------|
779
- | Code Search tools | `ripgrep` (rg) | `apt install ripgrep` or `brew install ripgrep` |
780
- | Git tools | `git` | Usually pre-installed |
134
+ - [@compilr-dev/agents](https://www.npmjs.com/package/@compilr-dev/agents) - Core agent library
135
+ - [@compilr-dev/cli](https://www.npmjs.com/package/@compilr-dev/cli) - AI-powered CLI assistant
781
136
 
782
137
  ## License
783
138
 
784
139
  MIT
785
-
786
- ## Related
787
-
788
- - [@compilr-dev/agents](https://github.com/scozzola/compilr-dev-agents) - Core agent library