@compilr-dev/agents-coding-go 0.1.3 → 0.1.5
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/LICENSE +95 -8
- package/README.md +4 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/tools/extract-docstrings.d.ts.map +1 -1
- package/dist/tools/extract-docstrings.js +2 -4
- package/dist/tools/find-dead-code.d.ts.map +1 -1
- package/dist/tools/find-dead-code.js +2 -4
- package/dist/tools/find-duplicates.d.ts.map +1 -1
- package/dist/tools/find-duplicates.js +2 -4
- package/dist/tools/find-implementations.d.ts.map +1 -1
- package/dist/tools/find-implementations.js +2 -4
- package/dist/tools/find-patterns.d.ts.map +1 -1
- package/dist/tools/find-patterns.js +2 -4
- package/dist/tools/find-references.d.ts.map +1 -1
- package/dist/tools/find-references.js +2 -4
- package/dist/tools/find-symbol.d.ts.map +1 -1
- package/dist/tools/find-symbol.js +2 -4
- package/dist/tools/get-call-graph.d.ts.map +1 -1
- package/dist/tools/get-call-graph.js +2 -4
- package/dist/tools/get-class-hierarchy.d.ts.map +1 -1
- package/dist/tools/get-class-hierarchy.js +2 -4
- package/dist/tools/get-complexity.d.ts.map +1 -1
- package/dist/tools/get-complexity.js +2 -4
- package/dist/tools/get-dependency-graph.d.ts.map +1 -1
- package/dist/tools/get-dependency-graph.js +2 -4
- package/dist/tools/get-exports.d.ts.map +1 -1
- package/dist/tools/get-exports.js +2 -4
- package/dist/tools/get-file-structure.d.ts +0 -3
- package/dist/tools/get-file-structure.d.ts.map +1 -1
- package/dist/tools/get-file-structure.js +4 -3
- package/dist/tools/get-imports.d.ts.map +1 -1
- package/dist/tools/get-imports.js +2 -4
- package/dist/tools/get-signature.js +3 -4
- package/dist/tools/index.d.ts +6 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +8 -0
- package/dist/tools/read-symbol.d.ts +63 -0
- package/dist/tools/read-symbol.d.ts.map +1 -0
- package/dist/tools/read-symbol.js +475 -0
- package/package.json +9 -9
package/LICENSE
CHANGED
|
@@ -1,13 +1,100 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
Functional Source License, Version 1.1, MIT Future License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Abbreviation: FSL-1.1-MIT
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
Notice
|
|
6
|
+
|
|
7
|
+
Copyright 2026 Carmelo Scozzola
|
|
8
|
+
|
|
9
|
+
Terms and Conditions
|
|
10
|
+
|
|
11
|
+
Licensor ("We")
|
|
12
|
+
|
|
13
|
+
The party offering the Software under these Terms and Conditions.
|
|
14
|
+
|
|
15
|
+
The Software
|
|
16
|
+
|
|
17
|
+
The "Software" is each version of the software that we make available under
|
|
18
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
19
|
+
Conditions with the Software.
|
|
20
|
+
|
|
21
|
+
License Grant
|
|
22
|
+
|
|
23
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
24
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
25
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
26
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
27
|
+
|
|
28
|
+
Permitted Purpose
|
|
29
|
+
|
|
30
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
31
|
+
means making the Software available to others in a commercial product or
|
|
32
|
+
service that:
|
|
33
|
+
|
|
34
|
+
1. substitutes for the Software;
|
|
35
|
+
|
|
36
|
+
2. substitutes for any other product or service we offer using the Software
|
|
37
|
+
that exists as of the date we make the Software available; or
|
|
38
|
+
|
|
39
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
40
|
+
|
|
41
|
+
Permitted Purposes specifically include using the Software:
|
|
42
|
+
|
|
43
|
+
1. for your internal use and access;
|
|
44
|
+
|
|
45
|
+
2. for non-commercial education;
|
|
46
|
+
|
|
47
|
+
3. for non-commercial research; and
|
|
48
|
+
|
|
49
|
+
4. in connection with professional services that you provide to a licensee
|
|
50
|
+
using the Software in accordance with these Terms and Conditions.
|
|
51
|
+
|
|
52
|
+
Patents
|
|
53
|
+
|
|
54
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
55
|
+
patents, the license grant above includes a license under our patents. If you
|
|
56
|
+
make a claim against any party that the Software infringes or contributes to
|
|
57
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
58
|
+
immediately.
|
|
59
|
+
|
|
60
|
+
Redistribution
|
|
61
|
+
|
|
62
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
63
|
+
the Software.
|
|
64
|
+
|
|
65
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
66
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
67
|
+
remove any copyright notices provided in or with the Software.
|
|
68
|
+
|
|
69
|
+
Disclaimer
|
|
70
|
+
|
|
71
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
72
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
73
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
74
|
+
|
|
75
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
76
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
77
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
78
|
+
|
|
79
|
+
Trademarks
|
|
80
|
+
|
|
81
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
82
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
83
|
+
trademarks, trade names, service marks or product names.
|
|
84
|
+
|
|
85
|
+
Grant of Future License
|
|
86
|
+
|
|
87
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
88
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
89
|
+
the Software available. On or after that date, you may use the Software under
|
|
90
|
+
the MIT license, in which case the following will apply:
|
|
91
|
+
|
|
92
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
93
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
94
|
+
the Software without restriction, including without limitation the rights to
|
|
95
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
96
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
97
|
+
so, subject to the following conditions:
|
|
11
98
|
|
|
12
99
|
The above copyright notice and this permission notice shall be included in all
|
|
13
100
|
copies or substantial portions of the Software.
|
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Go analysis tools for AI agents - AST-based code analysis using Tree-sitter.
|
|
4
4
|
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> This package is in beta. APIs may change between minor versions.
|
|
7
|
+
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
@@ -45,4 +48,4 @@ agent.registerSkills(goSkills);
|
|
|
45
48
|
|
|
46
49
|
## License
|
|
47
50
|
|
|
48
|
-
MIT
|
|
51
|
+
[FSL-1.1-MIT](https://fsl.software/) - See [LICENSE](LICENSE) for details. Converts to MIT after 2 years per version.
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export declare const goTools: {
|
|
|
28
28
|
readonly getDependencyGraph: import("@compilr-dev/agents").Tool<import("./tools/get-dependency-graph.js").GetDependencyGraphInput>;
|
|
29
29
|
readonly getSignature: import("@compilr-dev/agents").Tool<import("./tools/get-signature.js").GetSignatureInput>;
|
|
30
30
|
readonly getExports: import("@compilr-dev/agents").Tool<import("./tools/get-exports.js").GetExportsInput>;
|
|
31
|
+
readonly readFunction: import("@compilr-dev/agents").Tool<import("./tools/read-symbol.js").ReadFunctionInput>;
|
|
32
|
+
readonly readStruct: import("@compilr-dev/agents").Tool<import("./tools/read-symbol.js").ReadStructInput>;
|
|
33
|
+
readonly readType: import("@compilr-dev/agents").Tool<import("./tools/read-symbol.js").ReadTypeInput>;
|
|
31
34
|
};
|
|
32
35
|
/**
|
|
33
36
|
* Array of all Go tools
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAc,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAc,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAElC;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB;;GAEG;AACH,OAAO,EACL,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-docstrings.d.ts","sourceRoot":"","sources":["../../src/tools/extract-docstrings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AASrE,OAAO,KAAK,EACV,mBAAmB,EAMpB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,iBAAiB;IACjB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"extract-docstrings.d.ts","sourceRoot":"","sources":["../../src/tools/extract-docstrings.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AASrE,OAAO,KAAK,EACV,mBAAmB,EAMpB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,iBAAiB;IACjB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAqCD;;GAEG;AACH,eAAO,MAAM,qBAAqB,8BAKhC,CAAC;AAqRH;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,CAAC,EAAE;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAmB/B"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction, parseMethod, parseClass, extractDocComment, walkTree, } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Returns parsed godoc-style comments for functions, types, and methods.
|
|
14
|
-
Helps understand code documentation coverage and quality.`;
|
|
11
|
+
// Original: 'Extract documentation comments from Go code. Returns parsed godoc-style comments for functions, types, and methods. Helps understand code documentation coverage and quality.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Extract godoc-style documentation comments from Go code.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-dead-code.d.ts","sourceRoot":"","sources":["../../src/tools/find-dead-code.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAIrE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iDAAiD;IACjD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kDAAkD;IAClD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;IACnD,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"find-dead-code.d.ts","sourceRoot":"","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M,CAAC;CAC1B,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAa1B"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction, parseClass } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Analyzes the codebase to identify code that may be dead (never used).
|
|
14
|
-
Useful for cleanup and reducing code size.`;
|
|
11
|
+
// Original: 'Find potentially unused functions, classes, and variables in Go code. Analyzes the codebase to identify code that may be dead (never used). Useful for cleanup and reducing code size.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Find potentially unused functions, types, and variables in Go code.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-duplicates.d.ts","sourceRoot":"","sources":["../../src/tools/find-duplicates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;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H,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAgED;;GAEG;AACH,eAAO,MAAM,kBAAkB,2BAK7B,CAAC;AAmQH;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAc5B"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import * as crypto from "node:crypto";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Uses content hashing to find similar code patterns.
|
|
14
|
-
Useful for identifying refactoring opportunities and reducing code duplication.`;
|
|
11
|
+
// Original: 'Detect duplicate code blocks in Go files. Uses content hashing to find similar code patterns. Useful for identifying refactoring opportunities and reducing code duplication.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Detect duplicate code blocks in Go files using content hashing.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-implementations.d.ts","sourceRoot":"","sources":["../../src/tools/find-implementations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,EAAE,OAAO,GAAG,WAAW,CAAC;IAC5B,kBAAkB;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kCAAkC;IAClC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,cAAc,CAAC,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,4BAA4B;IAC5B,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,iBAAiB;IACjB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"find-implementations.d.ts","sourceRoot":"","sources":["../../src/tools/find-implementations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,K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
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseClass, parseFunction } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Returns information about each implementation including which methods are implemented.
|
|
14
|
-
Useful for understanding how base classes are used across the codebase.`;
|
|
11
|
+
// Original: 'Find classes that inherit from a base class, ABC, or implement a Protocol. Returns information about each implementation including which methods are implemented. Useful for understanding how base classes are used across the codebase.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Find types that implement an interface or embed a struct in Go code.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-patterns.d.ts","sourceRoot":"","sources":["../../src/tools/find-patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,cAAc,GAAG,OAAO,GAAG,SAAS,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,IAAI,EAAE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AO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,mDAAmD;IACnD,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,aAAa,GAAG,iBAAiB,GAAG,KAAK,CAAC,CAAC;IAC3E,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,UAAU,EAAE;YACV,KAAK,EAAE,MAAM,CAAC;YACd,OAAO,EAAE,MAAM,CAAC;YAChB,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;AA2ND;;GAEG;AACH,eAAO,MAAM,gBAAgB,yBAK3B,CAAC;AAiTH;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;CACpC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAiB1B"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Searches for common issues like security vulnerabilities, performance problems, and maintainability concerns.
|
|
14
|
-
Supports built-in patterns or custom pattern definitions.`;
|
|
11
|
+
// Original: 'Find code patterns, anti-patterns, and code smells in Go code. Searches for common issues like security vulnerabilities, performance problems, and maintainability concerns. Supports built-in patterns or custom pattern definitions.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Find code patterns, anti-patterns, and code smells in Go code.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-references.d.ts","sourceRoot":"","sources":["../../src/tools/find-references.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAGrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB;IACjB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"find-references.d.ts","sourceRoot":"","sources":["../../src/tools/find-references.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAGrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB;IACjB,KAAK,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAqCD;;GAEG;AACH,eAAO,MAAM,kBAAkB,2BAK7B,CAAC;AA4UH;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE;IACjD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAiB5B"}
|
|
@@ -10,10 +10,8 @@ import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-de
|
|
|
10
10
|
import { parseFile, getNodeText } from "../parser/go-parser.js";
|
|
11
11
|
// Supported file extensions
|
|
12
12
|
const SUPPORTED_EXTENSIONS = new Set([".go", ".goi"]);
|
|
13
|
-
//
|
|
14
|
-
const TOOL_DESCRIPTION =
|
|
15
|
-
Returns locations grouped by file with context about each reference.
|
|
16
|
-
Useful for refactoring, understanding usage patterns, and impact analysis.`;
|
|
13
|
+
// Original: 'Find all references to a symbol across Go files. Returns locations grouped by file with context about each reference. Useful for refactoring, understanding usage patterns, and impact analysis.'
|
|
14
|
+
const TOOL_DESCRIPTION = "Find all references to a symbol across Go files with locations and context.";
|
|
17
15
|
// Tool input schema
|
|
18
16
|
const TOOL_INPUT_SCHEMA = {
|
|
19
17
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-symbol.d.ts","sourceRoot":"","sources":["../../src/tools/find-symbol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAerE;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,UAAU,GACV,UAAU,GACV,MAAM,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,KAAK,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,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AE,CAAC;IAClC,wBAAwB;IACxB,KAAK,EAAE,WAAW,CAAC;CACpB;AA+CD;;GAEG;AACH,eAAO,MAAM,cAAc,uBAKzB,CAAC;AAoXH;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAC7C,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,GAAG,IAAI,CAAC,eAAe,CAAC,CAexB"}
|
|
@@ -10,10 +10,8 @@ import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-de
|
|
|
10
10
|
import { parseFile, parseClass, parseFunction, parseMethod, parseVariable, isExported, walkTree, getNodeText, } from "../parser/go-parser.js";
|
|
11
11
|
// Supported file extensions for searching
|
|
12
12
|
const SUPPORTED_EXTENSIONS = new Set([".go"]);
|
|
13
|
-
//
|
|
14
|
-
const TOOL_DESCRIPTION =
|
|
15
|
-
Returns structured JSON with file path, line number, symbol kind, and other metadata.
|
|
16
|
-
Use this to locate where functions, structs, interfaces, variables, etc. are defined.`;
|
|
13
|
+
// Original: 'Find the definition location of a symbol by name across Go codebases. Returns structured JSON with file path, line number, symbol kind, and other metadata. Use this to locate where functions, structs, interfaces, variables, etc. are defined.'
|
|
14
|
+
const TOOL_DESCRIPTION = "Find the definition location of a symbol by name across Go files.";
|
|
17
15
|
// Tool input schema
|
|
18
16
|
const TOOL_INPUT_SCHEMA = {
|
|
19
17
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-call-graph.d.ts","sourceRoot":"","sources":["../../src/tools/get-call-graph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAIrE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,QAAQ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AAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,cAAc,CAAC;CACvB;AA8CD;;GAEG;AACH,eAAO,MAAM,gBAAgB,yBAK3B,CAAC;AA6dH;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE;IAC/C,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAoB1B"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction, parseClass } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Returns a call graph showing which functions call which other functions.
|
|
14
|
-
Use this to understand code flow, dependencies, and refactoring impact.`;
|
|
11
|
+
// Original: 'Analyze function call relationships in Go code. Returns a call graph showing which functions call which other functions. Use this to understand code flow, dependencies, and refactoring impact.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Analyze function call relationships and build a call graph for Go code.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-class-hierarchy.d.ts","sourceRoot":"","sources":["../../src/tools/get-class-hierarchy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAIrE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,SAAS,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;IAC7C,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"get-class-hierarchy.d.ts","sourceRoot":"","sources":["../../src/tools/get-class-hierarchy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAIrE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8FAA8F;IAC9F,SAAS,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;IAC7C,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAsCD;;GAEG;AACH,eAAO,MAAM,qBAAqB,8BAKhC,CAAC;AA2OH;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,CAAC,EAAE;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAgB/B"}
|
|
@@ -9,10 +9,8 @@ import * as fs from "node:fs/promises";
|
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { parseFile, parseClass, walkTree } from "../parser/go-parser.js";
|
|
12
|
-
//
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Go uses composition (embedding) rather than inheritance.
|
|
15
|
-
Returns embedded types and types that embed the target type.`;
|
|
12
|
+
// Original: 'Analyze type hierarchies in Go code. Go uses composition (embedding) rather than inheritance. Returns embedded types and types that embed the target type.'
|
|
13
|
+
const TOOL_DESCRIPTION = "Analyze Go type hierarchies including embedding and interface satisfaction.";
|
|
16
14
|
// Tool input schema
|
|
17
15
|
const TOOL_INPUT_SCHEMA = {
|
|
18
16
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-complexity.d.ts","sourceRoot":"","sources":["../../src/tools/get-complexity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAQrE,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,oBAAoB;IACpB,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"get-complexity.d.ts","sourceRoot":"","sources":["../../src/tools/get-complexity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAQrE,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,oBAAoB;IACpB,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAsCD;;GAEG;AACH,eAAO,MAAM,iBAAiB,0BAK5B,CAAC;AAuWH;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE;IAChD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAiB3B"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction, parseMethod, walkTree, } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Returns complexity metrics and identifies functions that may need refactoring.
|
|
14
|
-
Helps find overly complex code that's hard to test and maintain.`;
|
|
11
|
+
// Original: 'Calculate cyclomatic and cognitive complexity for Go functions. Returns complexity metrics and identifies functions that may need refactoring. Helps find overly complex code that is hard to test and maintain.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Calculate cyclomatic and cognitive complexity for Go functions.";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-dependency-graph.d.ts","sourceRoot":"","sources":["../../src/tools/get-dependency-graph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,QAAQ,GAAG,aAAa,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oB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O,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,IAAI,CAAC,uBAAuB,CAAC,CAiBhC"}
|
|
@@ -9,10 +9,8 @@ import { accessSync } from "node:fs";
|
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
11
11
|
import { parseFile, parseImport } from "../parser/go-parser.js";
|
|
12
|
-
//
|
|
13
|
-
const TOOL_DESCRIPTION =
|
|
14
|
-
Returns a dependency graph showing which modules import which other modules.
|
|
15
|
-
Detects circular dependencies and provides dependency statistics.`;
|
|
12
|
+
// Original: 'Analyze module-level dependencies in Go code. Returns a dependency graph showing which modules import which other modules. Detects circular dependencies and provides dependency statistics.'
|
|
13
|
+
const TOOL_DESCRIPTION = "Analyze module-level dependencies and detect circular imports in Go code.";
|
|
16
14
|
// Tool input schema
|
|
17
15
|
const TOOL_INPUT_SCHEMA = {
|
|
18
16
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-exports.d.ts","sourceRoot":"","sources":["../../src/tools/get-exports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAIrE;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,gBAAgB,GAChB,OAAO,GACP,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACv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AAE,OAAO,CAAC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,GAAG,IAAI,CAAC,eAAe,CAAC,CAexB"}
|
|
@@ -8,10 +8,8 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction, parseClass } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
const TOOL_DESCRIPTION =
|
|
13
|
-
Analyzes __all__ declarations and identifies public API surface.
|
|
14
|
-
Use this to understand what a module exposes to other modules.`;
|
|
11
|
+
// Original: 'Get all exports from a Go package. Analyzes __all__ declarations and identifies public API surface. Use this to understand what a module exposes to other modules.'
|
|
12
|
+
const TOOL_DESCRIPTION = "Get all exports from a Go package (uppercase public symbols).";
|
|
15
13
|
// Tool input schema
|
|
16
14
|
const TOOL_INPUT_SCHEMA = {
|
|
17
15
|
type: "object",
|
|
@@ -15,9 +15,6 @@ export interface GetFileStructureInput {
|
|
|
15
15
|
/** Maximum nesting depth */
|
|
16
16
|
maxDepth?: number;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Get file structure tool
|
|
20
|
-
*/
|
|
21
18
|
export declare const getFileStructureTool: import("@compilr-dev/agents").Tool<GetFileStructureInput>;
|
|
22
19
|
/**
|
|
23
20
|
* Factory function to create getFileStructure tool with custom options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-structure.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-structure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"get-file-structure.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-structure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD,eAAO,MAAM,oBAAoB,2DAsB/B,CAAC;AAwHH;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,6DAkCxE"}
|
|
@@ -11,10 +11,11 @@ import { parseFile, parseClass, parseFunction, parseMethod, parseImport, parseVa
|
|
|
11
11
|
/**
|
|
12
12
|
* Get file structure tool
|
|
13
13
|
*/
|
|
14
|
+
// Original: 'Get structural overview of a Go file including types (structs/interfaces), functions, variables, and imports. Useful for understanding file organization and API surface.'
|
|
15
|
+
const TOOL_DESCRIPTION = "Get structural overview of a Go file including types, functions, variables, and imports.";
|
|
14
16
|
export const getFileStructureTool = defineTool({
|
|
15
17
|
name: "get_file_structure_go",
|
|
16
|
-
description:
|
|
17
|
-
"Useful for understanding file organization and API surface.",
|
|
18
|
+
description: TOOL_DESCRIPTION,
|
|
18
19
|
inputSchema: {
|
|
19
20
|
type: "object",
|
|
20
21
|
properties: {
|
|
@@ -142,7 +143,7 @@ async function executeGetFileStructure(input) {
|
|
|
142
143
|
export function createGetFileStructureTool(options) {
|
|
143
144
|
return defineTool({
|
|
144
145
|
name: "get_file_structure_go",
|
|
145
|
-
description:
|
|
146
|
+
description: TOOL_DESCRIPTION,
|
|
146
147
|
inputSchema: {
|
|
147
148
|
type: "object",
|
|
148
149
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-imports.d.ts","sourceRoot":"","sources":["../../src/tools/get-imports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAkLrE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"get-imports.d.ts","sourceRoot":"","sources":["../../src/tools/get-imports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAkLrE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA2BD;;GAEG;AACH,eAAO,MAAM,cAAc,uBAKzB,CAAC;AAyOH;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE;IAC7C,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,IAAI,CAAC,eAAe,CAAC,CAcxB"}
|
|
@@ -177,10 +177,8 @@ const STDLIB_PACKAGES = new Set([
|
|
|
177
177
|
"unique",
|
|
178
178
|
"unsafe",
|
|
179
179
|
]);
|
|
180
|
-
//
|
|
181
|
-
const TOOL_DESCRIPTION =
|
|
182
|
-
Returns categorized imports (stdlib, third_party, local) with statistics.
|
|
183
|
-
Helps understand dependencies and import organization.`;
|
|
180
|
+
// Original: 'Analyze imports in Go files. Returns categorized imports (stdlib, third_party, local) with statistics. Helps understand dependencies and import organization.'
|
|
181
|
+
const TOOL_DESCRIPTION = "Analyze imports in Go files with stdlib/third-party/local categorization.";
|
|
184
182
|
// Tool input schema
|
|
185
183
|
const TOOL_INPUT_SCHEMA = {
|
|
186
184
|
type: "object",
|
|
@@ -8,10 +8,9 @@ import * as fs from "node:fs/promises";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
10
10
|
import { parseFile, parseFunction, parseClass } from "../parser/go-parser.js";
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Useful for understanding API contracts without reading full source code.`;
|
|
11
|
+
// Original: 'Get detailed signature information for a function, method, or class in Python. Returns parameters with type hints, return type, decorators, and extracted docstring documentation. Useful for understanding API contracts without reading full source code.'
|
|
12
|
+
// BUG FIX: Changed "Python" to "Go" in description
|
|
13
|
+
const TOOL_DESCRIPTION = "Get function/method signature with parameters, return types, and receiver info.";
|
|
15
14
|
// Tool input schema
|
|
16
15
|
const TOOL_INPUT_SCHEMA = {
|
|
17
16
|
type: "object",
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { getCallGraphTool, createGetCallGraphTool } from "./get-call-graph.js";
|
|
|
18
18
|
export { getDependencyGraphTool, createGetDependencyGraphTool, } from "./get-dependency-graph.js";
|
|
19
19
|
export { getSignatureTool, createGetSignatureTool } from "./get-signature.js";
|
|
20
20
|
export { getExportsTool, createGetExportsTool } from "./get-exports.js";
|
|
21
|
+
export { readFunctionTool, createReadFunctionTool, readStructTool, createReadStructTool, readTypeTool, createReadTypeTool, } from "./read-symbol.js";
|
|
21
22
|
export * from "./types.js";
|
|
22
23
|
export type { GetFileStructureInput } from "./get-file-structure.js";
|
|
23
24
|
export type { FindSymbolInput, FindSymbolResult, GoSymbolDefinition, GoSymbolKind, GoSymbolKindFilter, } from "./find-symbol.js";
|
|
@@ -34,7 +35,8 @@ export type { GetCallGraphInput, GetCallGraphResult, CallGraphDirection, CallTyp
|
|
|
34
35
|
export type { GetDependencyGraphInput, GetDependencyGraphResult, ModuleNode, DependencyEdge, CircularDependency, DependencyGraphStats, } from "./get-dependency-graph.js";
|
|
35
36
|
export type { GetSignatureInput, GetSignatureResult, ParameterDetail, ReturnTypeDetail, MemberSignature, Documentation, } from "./get-signature.js";
|
|
36
37
|
export type { GetExportsInput, GetExportsResult, ExportedSymbol, ExportKind, ReExport, ExportStats, } from "./get-exports.js";
|
|
37
|
-
export
|
|
38
|
+
export type { ReadFunctionInput, ReadStructInput, ReadTypeInput, ReadSymbolResult, } from "./read-symbol.js";
|
|
39
|
+
export declare const allGoTools: readonly [import("@compilr-dev/agents").Tool<import("./get-file-structure.js").GetFileStructureInput>, import("@compilr-dev/agents").Tool<import("./find-symbol.js").FindSymbolInput>, import("@compilr-dev/agents").Tool<import("./find-references.js").FindReferencesInput>, import("@compilr-dev/agents").Tool<import("./get-imports.js").GetImportsInput>, import("@compilr-dev/agents").Tool<import("./get-class-hierarchy.js").GetClassHierarchyInput>, import("@compilr-dev/agents").Tool<import("./get-complexity.js").GetComplexityInput>, import("@compilr-dev/agents").Tool<import("./extract-docstrings.js").ExtractDocstringsInput>, import("@compilr-dev/agents").Tool<import("./find-dead-code.js").FindDeadCodeInput>, import("@compilr-dev/agents").Tool<import("./find-duplicates.js").FindDuplicatesInput>, import("@compilr-dev/agents").Tool<import("./find-implementations.js").FindImplementationsInput>, import("@compilr-dev/agents").Tool<import("./find-patterns.js").FindPatternsInput>, import("@compilr-dev/agents").Tool<import("./get-call-graph.js").GetCallGraphInput>, import("@compilr-dev/agents").Tool<import("./get-dependency-graph.js").GetDependencyGraphInput>, import("@compilr-dev/agents").Tool<import("./get-signature.js").GetSignatureInput>, import("@compilr-dev/agents").Tool<import("./get-exports.js").GetExportsInput>, import("@compilr-dev/agents").Tool<import("./read-symbol.js").ReadFunctionInput>, import("@compilr-dev/agents").Tool<import("./read-symbol.js").ReadStructInput>, import("@compilr-dev/agents").Tool<import("./read-symbol.js").ReadTypeInput>];
|
|
38
40
|
export declare const goToolsMap: {
|
|
39
41
|
readonly getFileStructure: import("@compilr-dev/agents").Tool<import("./get-file-structure.js").GetFileStructureInput>;
|
|
40
42
|
readonly findSymbol: import("@compilr-dev/agents").Tool<import("./find-symbol.js").FindSymbolInput>;
|
|
@@ -51,5 +53,8 @@ export declare const goToolsMap: {
|
|
|
51
53
|
readonly getDependencyGraph: import("@compilr-dev/agents").Tool<import("./get-dependency-graph.js").GetDependencyGraphInput>;
|
|
52
54
|
readonly getSignature: import("@compilr-dev/agents").Tool<import("./get-signature.js").GetSignatureInput>;
|
|
53
55
|
readonly getExports: import("@compilr-dev/agents").Tool<import("./get-exports.js").GetExportsInput>;
|
|
56
|
+
readonly readFunction: import("@compilr-dev/agents").Tool<import("./read-symbol.js").ReadFunctionInput>;
|
|
57
|
+
readonly readStruct: import("@compilr-dev/agents").Tool<import("./read-symbol.js").ReadStructInput>;
|
|
58
|
+
readonly readType: import("@compilr-dev/agents").Tool<import("./read-symbol.js").ReadTypeInput>;
|
|
54
59
|
};
|
|
55
60
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAA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A2B,CAAC;AACnC,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AA0B1B,eAAO,MAAM,UAAU,giDAmBb,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;CAmBb,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { getCallGraphTool, createGetCallGraphTool } from "./get-call-graph.js";
|
|
|
19
19
|
export { getDependencyGraphTool, createGetDependencyGraphTool, } from "./get-dependency-graph.js";
|
|
20
20
|
export { getSignatureTool, createGetSignatureTool } from "./get-signature.js";
|
|
21
21
|
export { getExportsTool, createGetExportsTool } from "./get-exports.js";
|
|
22
|
+
export { readFunctionTool, createReadFunctionTool, readStructTool, createReadStructTool, readTypeTool, createReadTypeTool, } from "./read-symbol.js";
|
|
22
23
|
// Type exports
|
|
23
24
|
export * from "./types.js";
|
|
24
25
|
/**
|
|
@@ -39,6 +40,7 @@ import { getCallGraphTool } from "./get-call-graph.js";
|
|
|
39
40
|
import { getDependencyGraphTool } from "./get-dependency-graph.js";
|
|
40
41
|
import { getSignatureTool } from "./get-signature.js";
|
|
41
42
|
import { getExportsTool } from "./get-exports.js";
|
|
43
|
+
import { readFunctionTool, readStructTool, readTypeTool, } from "./read-symbol.js";
|
|
42
44
|
export const allGoTools = [
|
|
43
45
|
getFileStructureTool,
|
|
44
46
|
findSymbolTool,
|
|
@@ -55,6 +57,9 @@ export const allGoTools = [
|
|
|
55
57
|
getDependencyGraphTool,
|
|
56
58
|
getSignatureTool,
|
|
57
59
|
getExportsTool,
|
|
60
|
+
readFunctionTool,
|
|
61
|
+
readStructTool,
|
|
62
|
+
readTypeTool,
|
|
58
63
|
];
|
|
59
64
|
export const goToolsMap = {
|
|
60
65
|
getFileStructure: getFileStructureTool,
|
|
@@ -72,4 +77,7 @@ export const goToolsMap = {
|
|
|
72
77
|
getDependencyGraph: getDependencyGraphTool,
|
|
73
78
|
getSignature: getSignatureTool,
|
|
74
79
|
getExports: getExportsTool,
|
|
80
|
+
readFunction: readFunctionTool,
|
|
81
|
+
readStruct: readStructTool,
|
|
82
|
+
readType: readTypeTool,
|
|
75
83
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart File Reading Tools for Go
|
|
3
|
+
*
|
|
4
|
+
* AST-aware tools that extract specific code elements by name,
|
|
5
|
+
* returning exact source code without guessing line numbers.
|
|
6
|
+
*
|
|
7
|
+
* Tools:
|
|
8
|
+
* - read_function: Read a function/method by name
|
|
9
|
+
* - read_struct: Read a struct by name
|
|
10
|
+
* - read_type: Read a type definition by name
|
|
11
|
+
*/
|
|
12
|
+
import type { Tool } from "@compilr-dev/agents";
|
|
13
|
+
export interface ReadFunctionInput {
|
|
14
|
+
/** Absolute path to the file */
|
|
15
|
+
path: string;
|
|
16
|
+
/** Function or method name to read */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Receiver type if reading a method (e.g., "*Server" or "Handler") */
|
|
19
|
+
receiverType?: string;
|
|
20
|
+
/** Include doc comment (default: true) */
|
|
21
|
+
includeDoc?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ReadStructInput {
|
|
24
|
+
/** Absolute path to the file */
|
|
25
|
+
path: string;
|
|
26
|
+
/** Struct name to read */
|
|
27
|
+
name: string;
|
|
28
|
+
/** What to include: 'full' | 'signature' | 'fields-only' */
|
|
29
|
+
include?: "full" | "signature" | "fields-only";
|
|
30
|
+
/** Include doc comment (default: true) */
|
|
31
|
+
includeDoc?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ReadTypeInput {
|
|
34
|
+
/** Absolute path to the file */
|
|
35
|
+
path: string;
|
|
36
|
+
/** Type name to read (struct, interface, type alias) */
|
|
37
|
+
name: string;
|
|
38
|
+
/** Include doc comment (default: true) */
|
|
39
|
+
includeDoc?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface ReadSymbolResult {
|
|
42
|
+
/** Symbol name */
|
|
43
|
+
name: string;
|
|
44
|
+
/** Symbol kind */
|
|
45
|
+
kind: "function" | "method" | "struct" | "interface" | "type";
|
|
46
|
+
/** Start line (1-based) */
|
|
47
|
+
startLine: number;
|
|
48
|
+
/** End line (1-based) */
|
|
49
|
+
endLine: number;
|
|
50
|
+
/** Source code content */
|
|
51
|
+
content: string;
|
|
52
|
+
/** Signature (for functions/methods/structs) */
|
|
53
|
+
signature?: string;
|
|
54
|
+
/** Receiver type (for methods) */
|
|
55
|
+
receiver?: string;
|
|
56
|
+
}
|
|
57
|
+
export declare const readFunctionTool: Tool<ReadFunctionInput>;
|
|
58
|
+
export declare const readStructTool: Tool<ReadStructInput>;
|
|
59
|
+
export declare const readTypeTool: Tool<ReadTypeInput>;
|
|
60
|
+
export declare function createReadFunctionTool(): Tool<ReadFunctionInput>;
|
|
61
|
+
export declare function createReadStructTool(): Tool<ReadStructInput>;
|
|
62
|
+
export declare function createReadTypeTool(): Tool<ReadTypeInput>;
|
|
63
|
+
//# sourceMappingURL=read-symbol.d.ts.map
|
|
@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AAgUD,eAAO,MAAM,gBAAgB,yBA4B3B,CAAC;AAkFH,eAAO,MAAM,cAAc,uBA2BzB,CAAC;AAyEH,eAAO,MAAM,YAAY,qBAuBvB,CAAC;AAMH,wBAAgB,sBAAsB,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAEhE;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAAC,eAAe,CAAC,CAE5D;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,aAAa,CAAC,CAExD"}
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart File Reading Tools for Go
|
|
3
|
+
*
|
|
4
|
+
* AST-aware tools that extract specific code elements by name,
|
|
5
|
+
* returning exact source code without guessing line numbers.
|
|
6
|
+
*
|
|
7
|
+
* Tools:
|
|
8
|
+
* - read_function: Read a function/method by name
|
|
9
|
+
* - read_struct: Read a struct by name
|
|
10
|
+
* - read_type: Read a type definition by name
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from "node:fs/promises";
|
|
13
|
+
import { defineTool, createSuccessResult, createErrorResult, } from "@compilr-dev/agents";
|
|
14
|
+
import { parseFile, getNodeText, extractDocComment, walkTree, } from "../parser/go-parser.js";
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Helper Functions
|
|
17
|
+
// =============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Check if a file is a Go file
|
|
20
|
+
*/
|
|
21
|
+
function isGoFile(filePath) {
|
|
22
|
+
const ext = filePath.toLowerCase().split(".").pop();
|
|
23
|
+
return ext === "go";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get doc comment source as lines
|
|
27
|
+
*/
|
|
28
|
+
function getDocCommentSource(node, source) {
|
|
29
|
+
// Look for comment nodes immediately before this node
|
|
30
|
+
const parent = node.parent;
|
|
31
|
+
if (!parent)
|
|
32
|
+
return undefined;
|
|
33
|
+
const nodeIndex = parent.children.indexOf(node);
|
|
34
|
+
if (nodeIndex <= 0)
|
|
35
|
+
return undefined;
|
|
36
|
+
// Check for consecutive comments before the node
|
|
37
|
+
const commentNodes = [];
|
|
38
|
+
for (let i = nodeIndex - 1; i >= 0; i--) {
|
|
39
|
+
const sibling = parent.children[i];
|
|
40
|
+
if (sibling.type === "comment") {
|
|
41
|
+
commentNodes.unshift(sibling);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (commentNodes.length === 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
// Get the full source from first comment to the node start
|
|
50
|
+
const startPos = commentNodes[0].startIndex;
|
|
51
|
+
const endPos = node.startIndex;
|
|
52
|
+
return source.slice(startPos, endPos);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extract function signature (func line without body)
|
|
56
|
+
*/
|
|
57
|
+
function extractFunctionSignature(node, source) {
|
|
58
|
+
const text = getNodeText(node, source);
|
|
59
|
+
// Find the first { and take everything before it
|
|
60
|
+
const braceIndex = text.indexOf("{");
|
|
61
|
+
if (braceIndex !== -1) {
|
|
62
|
+
return text.slice(0, braceIndex).trim();
|
|
63
|
+
}
|
|
64
|
+
// Fallback to first line
|
|
65
|
+
const firstLine = text.split("\n")[0];
|
|
66
|
+
return firstLine?.trim() ?? "";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Extract struct/interface signature
|
|
70
|
+
*/
|
|
71
|
+
function extractTypeSignature(node, source, kind) {
|
|
72
|
+
const text = getNodeText(node, source);
|
|
73
|
+
// Find "type Name struct {" or "type Name interface {"
|
|
74
|
+
const match = text.match(new RegExp(`^type\\s+\\w+\\s+${kind}\\s*\\{`, "m"));
|
|
75
|
+
if (match) {
|
|
76
|
+
return match[0].replace("{", "{ ... }");
|
|
77
|
+
}
|
|
78
|
+
const firstLine = text.split("\n")[0];
|
|
79
|
+
return (firstLine?.trim() ?? "") + " { ... }";
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get receiver type from a method declaration
|
|
83
|
+
*/
|
|
84
|
+
function getReceiverType(node, source) {
|
|
85
|
+
const receiverNode = node.childForFieldName("receiver");
|
|
86
|
+
if (!receiverNode)
|
|
87
|
+
return undefined;
|
|
88
|
+
for (const child of receiverNode.children) {
|
|
89
|
+
if (child.type === "parameter_declaration") {
|
|
90
|
+
const typeNode = child.children.find((c) => c.type === "pointer_type" ||
|
|
91
|
+
c.type === "type_identifier" ||
|
|
92
|
+
c.type === "qualified_type");
|
|
93
|
+
if (typeNode) {
|
|
94
|
+
return getNodeText(typeNode, source);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Normalize receiver type for comparison
|
|
102
|
+
* Handles both "*Server" and "Server" matching
|
|
103
|
+
*/
|
|
104
|
+
function normalizeReceiverType(receiverType) {
|
|
105
|
+
return receiverType.replace(/^\*/, "");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Find a function or method declaration by name
|
|
109
|
+
*/
|
|
110
|
+
function findFunctionNode(rootNode, name, source, receiverType) {
|
|
111
|
+
// Look for function_declaration or method_declaration
|
|
112
|
+
for (const node of walkTree(rootNode, [
|
|
113
|
+
"function_declaration",
|
|
114
|
+
"method_declaration",
|
|
115
|
+
])) {
|
|
116
|
+
const nameNode = node.childForFieldName("name");
|
|
117
|
+
if (!nameNode || getNodeText(nameNode, source) !== name) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
// Check if this is a method (has receiver)
|
|
121
|
+
const receiver = getReceiverType(node, source);
|
|
122
|
+
if (receiverType) {
|
|
123
|
+
// Looking for a specific method
|
|
124
|
+
if (receiver &&
|
|
125
|
+
normalizeReceiverType(receiver) === normalizeReceiverType(receiverType)) {
|
|
126
|
+
return { node, receiver };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (!receiver) {
|
|
130
|
+
// Looking for a function (no receiver)
|
|
131
|
+
return { node };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// If looking for a method, also try to find by just the base type
|
|
135
|
+
if (receiverType) {
|
|
136
|
+
const normalizedTarget = normalizeReceiverType(receiverType);
|
|
137
|
+
for (const node of walkTree(rootNode, ["method_declaration"])) {
|
|
138
|
+
const nameNode = node.childForFieldName("name");
|
|
139
|
+
if (!nameNode || getNodeText(nameNode, source) !== name) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const receiver = getReceiverType(node, source);
|
|
143
|
+
if (receiver && normalizeReceiverType(receiver) === normalizedTarget) {
|
|
144
|
+
return { node, receiver };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Find a type declaration by name
|
|
152
|
+
*/
|
|
153
|
+
function findTypeNode(rootNode, name, source) {
|
|
154
|
+
for (const node of walkTree(rootNode, ["type_declaration"])) {
|
|
155
|
+
// Check for type_spec (regular type definition: type Name Type)
|
|
156
|
+
const typeSpec = node.children.find((c) => c.type === "type_spec");
|
|
157
|
+
if (typeSpec) {
|
|
158
|
+
const nameNode = typeSpec.childForFieldName("name");
|
|
159
|
+
if (nameNode && getNodeText(nameNode, source) === name) {
|
|
160
|
+
const typeNode = typeSpec.childForFieldName("type");
|
|
161
|
+
if (!typeNode) {
|
|
162
|
+
return { node, kind: "type" };
|
|
163
|
+
}
|
|
164
|
+
if (typeNode.type === "struct_type") {
|
|
165
|
+
return { node, kind: "struct" };
|
|
166
|
+
}
|
|
167
|
+
if (typeNode.type === "interface_type") {
|
|
168
|
+
return { node, kind: "interface" };
|
|
169
|
+
}
|
|
170
|
+
// Type definition (e.g., type ID int)
|
|
171
|
+
return { node, kind: "type" };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Check for type_alias (type alias: type Name = Type)
|
|
175
|
+
const typeAlias = node.children.find((c) => c.type === "type_alias");
|
|
176
|
+
if (typeAlias) {
|
|
177
|
+
// type_alias has structure: type_identifier, =, type_identifier
|
|
178
|
+
const nameNode = typeAlias.children.find((c) => c.type === "type_identifier");
|
|
179
|
+
if (nameNode && getNodeText(nameNode, source) === name) {
|
|
180
|
+
return { node, kind: "type" };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Extract only struct fields from a type declaration
|
|
188
|
+
*/
|
|
189
|
+
function extractStructFields(node, source) {
|
|
190
|
+
const typeSpec = node.children.find((c) => c.type === "type_spec");
|
|
191
|
+
if (!typeSpec)
|
|
192
|
+
return "";
|
|
193
|
+
const typeNode = typeSpec.childForFieldName("type");
|
|
194
|
+
if (!typeNode || typeNode.type !== "struct_type")
|
|
195
|
+
return "";
|
|
196
|
+
const fieldList = typeNode.children.find((c) => c.type === "field_declaration_list");
|
|
197
|
+
if (!fieldList)
|
|
198
|
+
return "";
|
|
199
|
+
const fields = [];
|
|
200
|
+
for (const field of fieldList.children) {
|
|
201
|
+
if (field.type === "field_declaration") {
|
|
202
|
+
fields.push(getNodeText(field, source));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return fields.join("\n");
|
|
206
|
+
}
|
|
207
|
+
// =============================================================================
|
|
208
|
+
// read_function Tool
|
|
209
|
+
// =============================================================================
|
|
210
|
+
async function executeReadFunction(input) {
|
|
211
|
+
const { path: filePath, name, receiverType, includeDoc = true } = input;
|
|
212
|
+
if (!filePath || !name) {
|
|
213
|
+
return createErrorResult("Both path and name are required");
|
|
214
|
+
}
|
|
215
|
+
if (!isGoFile(filePath)) {
|
|
216
|
+
return createErrorResult(`Not a Go file: ${filePath}`);
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
await fs.access(filePath);
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return createErrorResult(`File not found: ${filePath}`);
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
const parseResult = await parseFile(filePath);
|
|
226
|
+
const { tree, source } = parseResult;
|
|
227
|
+
const found = findFunctionNode(tree.rootNode, name, source, receiverType);
|
|
228
|
+
if (!found) {
|
|
229
|
+
const searchDesc = receiverType
|
|
230
|
+
? `method ${name} with receiver ${receiverType}`
|
|
231
|
+
: `function ${name}`;
|
|
232
|
+
return createErrorResult(`Function not found: ${searchDesc}`);
|
|
233
|
+
}
|
|
234
|
+
const { node, receiver } = found;
|
|
235
|
+
// Get content with optional doc comment
|
|
236
|
+
let startIndex = node.startIndex;
|
|
237
|
+
if (includeDoc) {
|
|
238
|
+
const docSource = getDocCommentSource(node, source);
|
|
239
|
+
if (docSource) {
|
|
240
|
+
startIndex = node.startIndex - docSource.length;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const content = source.slice(startIndex, node.endIndex);
|
|
244
|
+
const startLine = node.startPosition.row +
|
|
245
|
+
1 -
|
|
246
|
+
(includeDoc
|
|
247
|
+
? content.split("\n").length -
|
|
248
|
+
getNodeText(node, source).split("\n").length
|
|
249
|
+
: 0);
|
|
250
|
+
const endLine = node.endPosition.row + 1;
|
|
251
|
+
const result = {
|
|
252
|
+
name,
|
|
253
|
+
kind: receiver ? "method" : "function",
|
|
254
|
+
startLine: includeDoc ? startLine : node.startPosition.row + 1,
|
|
255
|
+
endLine,
|
|
256
|
+
content,
|
|
257
|
+
signature: extractFunctionSignature(node, source),
|
|
258
|
+
receiver,
|
|
259
|
+
};
|
|
260
|
+
return createSuccessResult(result);
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return createErrorResult(`Failed to read function: ${error instanceof Error ? error.message : String(error)}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// Original: 'Read a specific Go function or method by name. Returns the exact source code without guessing line numbers. Use this instead of read_file when you need to see a specific function. For methods, specify the receiverType parameter (e.g., "*Server" or "Handler").'
|
|
267
|
+
export const readFunctionTool = defineTool({
|
|
268
|
+
name: "read_function_go",
|
|
269
|
+
description: "Read a specific Go function or method by name. Returns exact source code.",
|
|
270
|
+
inputSchema: {
|
|
271
|
+
type: "object",
|
|
272
|
+
properties: {
|
|
273
|
+
path: {
|
|
274
|
+
type: "string",
|
|
275
|
+
description: "Absolute path to the Go file",
|
|
276
|
+
},
|
|
277
|
+
name: {
|
|
278
|
+
type: "string",
|
|
279
|
+
description: "Function or method name to read",
|
|
280
|
+
},
|
|
281
|
+
receiverType: {
|
|
282
|
+
type: "string",
|
|
283
|
+
description: 'Receiver type if reading a method (e.g., "*Server" or "Handler")',
|
|
284
|
+
},
|
|
285
|
+
includeDoc: {
|
|
286
|
+
type: "boolean",
|
|
287
|
+
description: "Include doc comment (default: true)",
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
required: ["path", "name"],
|
|
291
|
+
},
|
|
292
|
+
execute: executeReadFunction,
|
|
293
|
+
});
|
|
294
|
+
// =============================================================================
|
|
295
|
+
// read_struct Tool
|
|
296
|
+
// =============================================================================
|
|
297
|
+
async function executeReadStruct(input) {
|
|
298
|
+
const { path: filePath, name, include = "full", includeDoc = true } = input;
|
|
299
|
+
if (!filePath || !name) {
|
|
300
|
+
return createErrorResult("Both path and name are required");
|
|
301
|
+
}
|
|
302
|
+
if (!isGoFile(filePath)) {
|
|
303
|
+
return createErrorResult(`Not a Go file: ${filePath}`);
|
|
304
|
+
}
|
|
305
|
+
try {
|
|
306
|
+
await fs.access(filePath);
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return createErrorResult(`File not found: ${filePath}`);
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
const parseResult = await parseFile(filePath);
|
|
313
|
+
const { tree, source } = parseResult;
|
|
314
|
+
const found = findTypeNode(tree.rootNode, name, source);
|
|
315
|
+
if (!found || found.kind !== "struct") {
|
|
316
|
+
return createErrorResult(`Struct not found: ${name}`);
|
|
317
|
+
}
|
|
318
|
+
const { node } = found;
|
|
319
|
+
let content;
|
|
320
|
+
if (include === "full") {
|
|
321
|
+
let startIndex = node.startIndex;
|
|
322
|
+
if (includeDoc) {
|
|
323
|
+
const docSource = getDocCommentSource(node, source);
|
|
324
|
+
if (docSource) {
|
|
325
|
+
startIndex = node.startIndex - docSource.length;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
content = source.slice(startIndex, node.endIndex);
|
|
329
|
+
}
|
|
330
|
+
else if (include === "signature") {
|
|
331
|
+
content = extractTypeSignature(node, source, "struct");
|
|
332
|
+
if (includeDoc) {
|
|
333
|
+
const doc = extractDocComment(node, source);
|
|
334
|
+
if (doc) {
|
|
335
|
+
content = `// ${doc.split("\n").join("\n// ")}\n${content}`;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
// include === 'fields-only'
|
|
341
|
+
content = extractStructFields(node, source);
|
|
342
|
+
}
|
|
343
|
+
const startLine = node.startPosition.row + 1;
|
|
344
|
+
const endLine = node.endPosition.row + 1;
|
|
345
|
+
const result = {
|
|
346
|
+
name,
|
|
347
|
+
kind: "struct",
|
|
348
|
+
startLine,
|
|
349
|
+
endLine,
|
|
350
|
+
content,
|
|
351
|
+
signature: extractTypeSignature(node, source, "struct"),
|
|
352
|
+
};
|
|
353
|
+
return createSuccessResult(result);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
return createErrorResult(`Failed to read struct: ${error instanceof Error ? error.message : String(error)}`);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// Original: 'Read a specific Go struct by name. Returns the exact source code without guessing line numbers. Use the include parameter to get: full struct, signature only, or fields only.'
|
|
360
|
+
export const readStructTool = defineTool({
|
|
361
|
+
name: "read_struct_go",
|
|
362
|
+
description: "Read a specific Go struct by name. Returns exact source code.",
|
|
363
|
+
inputSchema: {
|
|
364
|
+
type: "object",
|
|
365
|
+
properties: {
|
|
366
|
+
path: {
|
|
367
|
+
type: "string",
|
|
368
|
+
description: "Absolute path to the Go file",
|
|
369
|
+
},
|
|
370
|
+
name: {
|
|
371
|
+
type: "string",
|
|
372
|
+
description: "Struct name to read",
|
|
373
|
+
},
|
|
374
|
+
include: {
|
|
375
|
+
type: "string",
|
|
376
|
+
enum: ["full", "signature", "fields-only"],
|
|
377
|
+
description: "What to include (default: full)",
|
|
378
|
+
},
|
|
379
|
+
includeDoc: {
|
|
380
|
+
type: "boolean",
|
|
381
|
+
description: "Include doc comment (default: true)",
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
required: ["path", "name"],
|
|
385
|
+
},
|
|
386
|
+
execute: executeReadStruct,
|
|
387
|
+
});
|
|
388
|
+
// =============================================================================
|
|
389
|
+
// read_type Tool
|
|
390
|
+
// =============================================================================
|
|
391
|
+
async function executeReadType(input) {
|
|
392
|
+
const { path: filePath, name, includeDoc = true } = input;
|
|
393
|
+
if (!filePath || !name) {
|
|
394
|
+
return createErrorResult("Both path and name are required");
|
|
395
|
+
}
|
|
396
|
+
if (!isGoFile(filePath)) {
|
|
397
|
+
return createErrorResult(`Not a Go file: ${filePath}`);
|
|
398
|
+
}
|
|
399
|
+
try {
|
|
400
|
+
await fs.access(filePath);
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
return createErrorResult(`File not found: ${filePath}`);
|
|
404
|
+
}
|
|
405
|
+
try {
|
|
406
|
+
const parseResult = await parseFile(filePath);
|
|
407
|
+
const { tree, source } = parseResult;
|
|
408
|
+
const found = findTypeNode(tree.rootNode, name, source);
|
|
409
|
+
if (!found) {
|
|
410
|
+
return createErrorResult(`Type not found: ${name}. Supported types: struct, interface, type alias`);
|
|
411
|
+
}
|
|
412
|
+
const { node, kind } = found;
|
|
413
|
+
// Get content with optional doc comment
|
|
414
|
+
let startIndex = node.startIndex;
|
|
415
|
+
if (includeDoc) {
|
|
416
|
+
const docSource = getDocCommentSource(node, source);
|
|
417
|
+
if (docSource) {
|
|
418
|
+
startIndex = node.startIndex - docSource.length;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
const content = source.slice(startIndex, node.endIndex);
|
|
422
|
+
const startLine = node.startPosition.row + 1;
|
|
423
|
+
const endLine = node.endPosition.row + 1;
|
|
424
|
+
const result = {
|
|
425
|
+
name,
|
|
426
|
+
kind,
|
|
427
|
+
startLine,
|
|
428
|
+
endLine,
|
|
429
|
+
content,
|
|
430
|
+
signature: kind === "struct" || kind === "interface"
|
|
431
|
+
? extractTypeSignature(node, source, kind)
|
|
432
|
+
: undefined,
|
|
433
|
+
};
|
|
434
|
+
return createSuccessResult(result);
|
|
435
|
+
}
|
|
436
|
+
catch (error) {
|
|
437
|
+
return createErrorResult(`Failed to read type: ${error instanceof Error ? error.message : String(error)}`);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
// Original: 'Read a specific Go type definition by name. Returns the exact source code without guessing line numbers. Works for: struct, interface, and type aliases.'
|
|
441
|
+
export const readTypeTool = defineTool({
|
|
442
|
+
name: "read_type_go",
|
|
443
|
+
description: "Read a specific Go type definition by name. Returns exact source code.",
|
|
444
|
+
inputSchema: {
|
|
445
|
+
type: "object",
|
|
446
|
+
properties: {
|
|
447
|
+
path: {
|
|
448
|
+
type: "string",
|
|
449
|
+
description: "Absolute path to the Go file",
|
|
450
|
+
},
|
|
451
|
+
name: {
|
|
452
|
+
type: "string",
|
|
453
|
+
description: "Type name to read (struct, interface, or type alias)",
|
|
454
|
+
},
|
|
455
|
+
includeDoc: {
|
|
456
|
+
type: "boolean",
|
|
457
|
+
description: "Include doc comment (default: true)",
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
required: ["path", "name"],
|
|
461
|
+
},
|
|
462
|
+
execute: executeReadType,
|
|
463
|
+
});
|
|
464
|
+
// =============================================================================
|
|
465
|
+
// Factory Functions
|
|
466
|
+
// =============================================================================
|
|
467
|
+
export function createReadFunctionTool() {
|
|
468
|
+
return readFunctionTool;
|
|
469
|
+
}
|
|
470
|
+
export function createReadStructTool() {
|
|
471
|
+
return readStructTool;
|
|
472
|
+
}
|
|
473
|
+
export function createReadTypeTool() {
|
|
474
|
+
return readTypeTool;
|
|
475
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/agents-coding-go",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Go analysis tools for AI agents - AST-based code analysis using Tree-sitter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"tools"
|
|
57
57
|
],
|
|
58
58
|
"author": "Carmelo Scozzola",
|
|
59
|
-
"license": "MIT",
|
|
59
|
+
"license": "FSL-1.1-MIT",
|
|
60
60
|
"bugs": {
|
|
61
61
|
"url": "https://github.com/compilr-dev/agents-coding/issues"
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://github.com/compilr-dev/agents-coding#readme",
|
|
64
64
|
"engines": {
|
|
65
|
-
"node": ">=
|
|
65
|
+
"node": ">=20.0.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@compilr-dev/agents": "^0.3.1"
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
"tree-sitter-go": "^0.25.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@anthropic-ai/sdk": "^0.
|
|
76
|
-
"@compilr-dev/agents": "^0.3.
|
|
75
|
+
"@anthropic-ai/sdk": "^0.74.0",
|
|
76
|
+
"@compilr-dev/agents": "^0.3.11",
|
|
77
77
|
"@eslint/js": "^9.39.1",
|
|
78
|
-
"@types/node": "^
|
|
79
|
-
"@vitest/coverage-v8": "^
|
|
78
|
+
"@types/node": "^25.2.3",
|
|
79
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
80
80
|
"eslint": "^9.39.1",
|
|
81
81
|
"prettier": "^3.7.1",
|
|
82
|
-
"typescript-eslint": "^8.48.0",
|
|
83
82
|
"typescript": "^5.8.3",
|
|
84
|
-
"
|
|
83
|
+
"typescript-eslint": "^8.48.0",
|
|
84
|
+
"vitest": "^4.0.18"
|
|
85
85
|
}
|
|
86
86
|
}
|