@compilr-dev/agents-coding-go 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,13 +1,100 @@
1
- MIT License
1
+ Functional Source License, Version 1.1, MIT Future License
2
2
 
3
- Copyright (c) 2026 scozzola
3
+ Abbreviation: FSL-1.1-MIT
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
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
@@ -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;;;;;;;;;;;;;;;;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
+ {"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"}
@@ -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 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>];
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,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxE,cAAc,YAAY,CAAC;AAG3B,YAAY,EAAE,qBAAq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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"}
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-symbol.d.ts","sourceRoot":"","sources":["../../src/tools/read-symbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,qBAAqB,CAAC;AAYrE,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC;IAC/C,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;IAC9D,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA+TD,eAAO,MAAM,gBAAgB,yBA8B3B,CAAC;AAiFH,eAAO,MAAM,cAAc,uBA6BzB,CAAC;AAwEH,eAAO,MAAM,YAAY,qBAwBvB,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,476 @@
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
+ export const readFunctionTool = defineTool({
267
+ name: "read_function_go",
268
+ description: "Read a specific Go function or method by name. Returns the exact source code without guessing line numbers. " +
269
+ "Use this instead of read_file when you need to see a specific function. " +
270
+ 'For methods, specify the receiverType parameter (e.g., "*Server" or "Handler").',
271
+ inputSchema: {
272
+ type: "object",
273
+ properties: {
274
+ path: {
275
+ type: "string",
276
+ description: "Absolute path to the Go file",
277
+ },
278
+ name: {
279
+ type: "string",
280
+ description: "Function or method name to read",
281
+ },
282
+ receiverType: {
283
+ type: "string",
284
+ description: 'Receiver type if reading a method (e.g., "*Server" or "Handler")',
285
+ },
286
+ includeDoc: {
287
+ type: "boolean",
288
+ description: "Include doc comment (default: true)",
289
+ },
290
+ },
291
+ required: ["path", "name"],
292
+ },
293
+ execute: executeReadFunction,
294
+ });
295
+ // =============================================================================
296
+ // read_struct Tool
297
+ // =============================================================================
298
+ async function executeReadStruct(input) {
299
+ const { path: filePath, name, include = "full", includeDoc = true } = input;
300
+ if (!filePath || !name) {
301
+ return createErrorResult("Both path and name are required");
302
+ }
303
+ if (!isGoFile(filePath)) {
304
+ return createErrorResult(`Not a Go file: ${filePath}`);
305
+ }
306
+ try {
307
+ await fs.access(filePath);
308
+ }
309
+ catch {
310
+ return createErrorResult(`File not found: ${filePath}`);
311
+ }
312
+ try {
313
+ const parseResult = await parseFile(filePath);
314
+ const { tree, source } = parseResult;
315
+ const found = findTypeNode(tree.rootNode, name, source);
316
+ if (!found || found.kind !== "struct") {
317
+ return createErrorResult(`Struct not found: ${name}`);
318
+ }
319
+ const { node } = found;
320
+ let content;
321
+ if (include === "full") {
322
+ let startIndex = node.startIndex;
323
+ if (includeDoc) {
324
+ const docSource = getDocCommentSource(node, source);
325
+ if (docSource) {
326
+ startIndex = node.startIndex - docSource.length;
327
+ }
328
+ }
329
+ content = source.slice(startIndex, node.endIndex);
330
+ }
331
+ else if (include === "signature") {
332
+ content = extractTypeSignature(node, source, "struct");
333
+ if (includeDoc) {
334
+ const doc = extractDocComment(node, source);
335
+ if (doc) {
336
+ content = `// ${doc.split("\n").join("\n// ")}\n${content}`;
337
+ }
338
+ }
339
+ }
340
+ else {
341
+ // include === 'fields-only'
342
+ content = extractStructFields(node, source);
343
+ }
344
+ const startLine = node.startPosition.row + 1;
345
+ const endLine = node.endPosition.row + 1;
346
+ const result = {
347
+ name,
348
+ kind: "struct",
349
+ startLine,
350
+ endLine,
351
+ content,
352
+ signature: extractTypeSignature(node, source, "struct"),
353
+ };
354
+ return createSuccessResult(result);
355
+ }
356
+ catch (error) {
357
+ return createErrorResult(`Failed to read struct: ${error instanceof Error ? error.message : String(error)}`);
358
+ }
359
+ }
360
+ export const readStructTool = defineTool({
361
+ name: "read_struct_go",
362
+ description: "Read a specific Go struct by name. Returns the exact source code without guessing line numbers. " +
363
+ "Use the include parameter to get: full struct, signature only, or fields only.",
364
+ inputSchema: {
365
+ type: "object",
366
+ properties: {
367
+ path: {
368
+ type: "string",
369
+ description: "Absolute path to the Go file",
370
+ },
371
+ name: {
372
+ type: "string",
373
+ description: "Struct name to read",
374
+ },
375
+ include: {
376
+ type: "string",
377
+ enum: ["full", "signature", "fields-only"],
378
+ description: "What to include (default: full)",
379
+ },
380
+ includeDoc: {
381
+ type: "boolean",
382
+ description: "Include doc comment (default: true)",
383
+ },
384
+ },
385
+ required: ["path", "name"],
386
+ },
387
+ execute: executeReadStruct,
388
+ });
389
+ // =============================================================================
390
+ // read_type Tool
391
+ // =============================================================================
392
+ async function executeReadType(input) {
393
+ const { path: filePath, name, includeDoc = true } = input;
394
+ if (!filePath || !name) {
395
+ return createErrorResult("Both path and name are required");
396
+ }
397
+ if (!isGoFile(filePath)) {
398
+ return createErrorResult(`Not a Go file: ${filePath}`);
399
+ }
400
+ try {
401
+ await fs.access(filePath);
402
+ }
403
+ catch {
404
+ return createErrorResult(`File not found: ${filePath}`);
405
+ }
406
+ try {
407
+ const parseResult = await parseFile(filePath);
408
+ const { tree, source } = parseResult;
409
+ const found = findTypeNode(tree.rootNode, name, source);
410
+ if (!found) {
411
+ return createErrorResult(`Type not found: ${name}. Supported types: struct, interface, type alias`);
412
+ }
413
+ const { node, kind } = found;
414
+ // Get content with optional doc comment
415
+ let startIndex = node.startIndex;
416
+ if (includeDoc) {
417
+ const docSource = getDocCommentSource(node, source);
418
+ if (docSource) {
419
+ startIndex = node.startIndex - docSource.length;
420
+ }
421
+ }
422
+ const content = source.slice(startIndex, node.endIndex);
423
+ const startLine = node.startPosition.row + 1;
424
+ const endLine = node.endPosition.row + 1;
425
+ const result = {
426
+ name,
427
+ kind,
428
+ startLine,
429
+ endLine,
430
+ content,
431
+ signature: kind === "struct" || kind === "interface"
432
+ ? extractTypeSignature(node, source, kind)
433
+ : undefined,
434
+ };
435
+ return createSuccessResult(result);
436
+ }
437
+ catch (error) {
438
+ return createErrorResult(`Failed to read type: ${error instanceof Error ? error.message : String(error)}`);
439
+ }
440
+ }
441
+ export const readTypeTool = defineTool({
442
+ name: "read_type_go",
443
+ description: "Read a specific Go type definition by name. Returns the exact source code without guessing line numbers. " +
444
+ "Works for: struct, interface, and type aliases.",
445
+ inputSchema: {
446
+ type: "object",
447
+ properties: {
448
+ path: {
449
+ type: "string",
450
+ description: "Absolute path to the Go file",
451
+ },
452
+ name: {
453
+ type: "string",
454
+ description: "Type name to read (struct, interface, or type alias)",
455
+ },
456
+ includeDoc: {
457
+ type: "boolean",
458
+ description: "Include doc comment (default: true)",
459
+ },
460
+ },
461
+ required: ["path", "name"],
462
+ },
463
+ execute: executeReadType,
464
+ });
465
+ // =============================================================================
466
+ // Factory Functions
467
+ // =============================================================================
468
+ export function createReadFunctionTool() {
469
+ return readFunctionTool;
470
+ }
471
+ export function createReadStructTool() {
472
+ return readStructTool;
473
+ }
474
+ export function createReadTypeTool() {
475
+ return readTypeTool;
476
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/agents-coding-go",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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": ">=18.0.0"
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.30.1",
76
- "@compilr-dev/agents": "^0.3.1",
75
+ "@anthropic-ai/sdk": "^0.74.0",
76
+ "@compilr-dev/agents": "^0.3.11",
77
77
  "@eslint/js": "^9.39.1",
78
- "@types/node": "^24.10.1",
79
- "@vitest/coverage-v8": "^3.2.4",
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
- "vitest": "^3.2.4"
83
+ "typescript-eslint": "^8.48.0",
84
+ "vitest": "^4.0.18"
85
85
  }
86
86
  }