@compilr-dev/agents-coding-go 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +40 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +27 -0
  5. package/dist/parser/go-parser.d.ts +104 -0
  6. package/dist/parser/go-parser.d.ts.map +1 -0
  7. package/dist/parser/go-parser.js +492 -0
  8. package/dist/parser/index.d.ts +6 -0
  9. package/dist/parser/index.d.ts.map +1 -0
  10. package/dist/parser/index.js +5 -0
  11. package/dist/parser/node-types.d.ts +130 -0
  12. package/dist/parser/node-types.d.ts.map +1 -0
  13. package/dist/parser/node-types.js +4 -0
  14. package/dist/skills/go-best-practices.d.ts +7 -0
  15. package/dist/skills/go-best-practices.d.ts.map +1 -0
  16. package/dist/skills/go-best-practices.js +78 -0
  17. package/dist/skills/go-code-health.d.ts +7 -0
  18. package/dist/skills/go-code-health.d.ts.map +1 -0
  19. package/dist/skills/go-code-health.js +209 -0
  20. package/dist/skills/go-code-structure.d.ts +7 -0
  21. package/dist/skills/go-code-structure.d.ts.map +1 -0
  22. package/dist/skills/go-code-structure.js +155 -0
  23. package/dist/skills/go-dependency-audit.d.ts +7 -0
  24. package/dist/skills/go-dependency-audit.d.ts.map +1 -0
  25. package/dist/skills/go-dependency-audit.js +246 -0
  26. package/dist/skills/go-refactor-impact.d.ts +7 -0
  27. package/dist/skills/go-refactor-impact.d.ts.map +1 -0
  28. package/dist/skills/go-refactor-impact.js +232 -0
  29. package/dist/skills/index.d.ts +26 -0
  30. package/dist/skills/index.d.ts.map +1 -0
  31. package/dist/skills/index.js +36 -0
  32. package/dist/tools/extract-docstrings.d.ts +51 -0
  33. package/dist/tools/extract-docstrings.d.ts.map +1 -0
  34. package/dist/tools/extract-docstrings.js +292 -0
  35. package/dist/tools/find-dead-code.d.ts +62 -0
  36. package/dist/tools/find-dead-code.d.ts.map +1 -0
  37. package/dist/tools/find-dead-code.js +422 -0
  38. package/dist/tools/find-duplicates.d.ts +65 -0
  39. package/dist/tools/find-duplicates.d.ts.map +1 -0
  40. package/dist/tools/find-duplicates.js +289 -0
  41. package/dist/tools/find-implementations.d.ts +71 -0
  42. package/dist/tools/find-implementations.d.ts.map +1 -0
  43. package/dist/tools/find-implementations.js +342 -0
  44. package/dist/tools/find-patterns.d.ts +71 -0
  45. package/dist/tools/find-patterns.d.ts.map +1 -0
  46. package/dist/tools/find-patterns.js +477 -0
  47. package/dist/tools/find-references.d.ts +66 -0
  48. package/dist/tools/find-references.d.ts.map +1 -0
  49. package/dist/tools/find-references.js +306 -0
  50. package/dist/tools/find-symbol.d.ts +86 -0
  51. package/dist/tools/find-symbol.d.ts.map +1 -0
  52. package/dist/tools/find-symbol.js +380 -0
  53. package/dist/tools/get-call-graph.d.ts +89 -0
  54. package/dist/tools/get-call-graph.d.ts.map +1 -0
  55. package/dist/tools/get-call-graph.js +431 -0
  56. package/dist/tools/get-class-hierarchy.d.ts +34 -0
  57. package/dist/tools/get-class-hierarchy.d.ts.map +1 -0
  58. package/dist/tools/get-class-hierarchy.js +250 -0
  59. package/dist/tools/get-complexity.d.ts +53 -0
  60. package/dist/tools/get-complexity.d.ts.map +1 -0
  61. package/dist/tools/get-complexity.js +357 -0
  62. package/dist/tools/get-dependency-graph.d.ts +85 -0
  63. package/dist/tools/get-dependency-graph.d.ts.map +1 -0
  64. package/dist/tools/get-dependency-graph.js +389 -0
  65. package/dist/tools/get-exports.d.ts +78 -0
  66. package/dist/tools/get-exports.d.ts.map +1 -0
  67. package/dist/tools/get-exports.js +437 -0
  68. package/dist/tools/get-file-structure.d.ts +28 -0
  69. package/dist/tools/get-file-structure.d.ts.map +1 -0
  70. package/dist/tools/get-file-structure.js +172 -0
  71. package/dist/tools/get-imports.d.ts +30 -0
  72. package/dist/tools/get-imports.d.ts.map +1 -0
  73. package/dist/tools/get-imports.js +420 -0
  74. package/dist/tools/get-signature.d.ts +100 -0
  75. package/dist/tools/get-signature.d.ts.map +1 -0
  76. package/dist/tools/get-signature.js +800 -0
  77. package/dist/tools/index.d.ts +55 -0
  78. package/dist/tools/index.d.ts.map +1 -0
  79. package/dist/tools/index.js +75 -0
  80. package/dist/tools/types.d.ts +408 -0
  81. package/dist/tools/types.d.ts.map +1 -0
  82. package/dist/tools/types.js +4 -0
  83. package/package.json +86 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 scozzola
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:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @compilr-dev/agents-coding-go
3
+ *
4
+ * Go analysis tools for AI agents.
5
+ * AST-based code analysis using Tree-sitter.
6
+ */
7
+ export * from "./parser/index.js";
8
+ export * from "./tools/index.js";
9
+ export * from "./skills/index.js";
10
+ import { allGoTools } from "./tools/index.js";
11
+ import { goSkills, goSkillsMap, goBestPracticesSkill, goCodeHealthSkill, goCodeStructureSkill, goDependencyAuditSkill, goRefactorImpactSkill } from "./skills/index.js";
12
+ /**
13
+ * All Go analysis tools (named exports)
14
+ */
15
+ export declare const goTools: {
16
+ readonly getFileStructure: import("@compilr-dev/agents").Tool<import("./tools/get-file-structure.js").GetFileStructureInput>;
17
+ readonly findSymbol: import("@compilr-dev/agents").Tool<import("./tools/find-symbol.js").FindSymbolInput>;
18
+ readonly findReferences: import("@compilr-dev/agents").Tool<import("./tools/find-references.js").FindReferencesInput>;
19
+ readonly getImports: import("@compilr-dev/agents").Tool<import("./tools/get-imports.js").GetImportsInput>;
20
+ readonly getClassHierarchy: import("@compilr-dev/agents").Tool<import("./tools/get-class-hierarchy.js").GetClassHierarchyInput>;
21
+ readonly getComplexity: import("@compilr-dev/agents").Tool<import("./tools/get-complexity.js").GetComplexityInput>;
22
+ readonly extractDocstrings: import("@compilr-dev/agents").Tool<import("./tools/extract-docstrings.js").ExtractDocstringsInput>;
23
+ readonly findDeadCode: import("@compilr-dev/agents").Tool<import("./tools/find-dead-code.js").FindDeadCodeInput>;
24
+ readonly findDuplicates: import("@compilr-dev/agents").Tool<import("./tools/find-duplicates.js").FindDuplicatesInput>;
25
+ readonly findImplementations: import("@compilr-dev/agents").Tool<import("./tools/find-implementations.js").FindImplementationsInput>;
26
+ readonly findPatterns: import("@compilr-dev/agents").Tool<import("./tools/find-patterns.js").FindPatternsInput>;
27
+ readonly getCallGraph: import("@compilr-dev/agents").Tool<import("./tools/get-call-graph.js").GetCallGraphInput>;
28
+ readonly getDependencyGraph: import("@compilr-dev/agents").Tool<import("./tools/get-dependency-graph.js").GetDependencyGraphInput>;
29
+ readonly getSignature: import("@compilr-dev/agents").Tool<import("./tools/get-signature.js").GetSignatureInput>;
30
+ readonly getExports: import("@compilr-dev/agents").Tool<import("./tools/get-exports.js").GetExportsInput>;
31
+ };
32
+ /**
33
+ * Array of all Go tools
34
+ */
35
+ export { allGoTools };
36
+ /**
37
+ * All Go skills
38
+ */
39
+ export { goSkills, goSkillsMap, goBestPracticesSkill, goCodeHealthSkill, goCodeStructureSkill, goDependencyAuditSkill, goRefactorImpactSkill, };
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @compilr-dev/agents-coding-go
3
+ *
4
+ * Go analysis tools for AI agents.
5
+ * AST-based code analysis using Tree-sitter.
6
+ */
7
+ // Parser
8
+ export * from "./parser/index.js";
9
+ // Tools
10
+ export * from "./tools/index.js";
11
+ // Skills
12
+ export * from "./skills/index.js";
13
+ // Re-export commonly used items at top level
14
+ import { allGoTools, goToolsMap } from "./tools/index.js";
15
+ import { goSkills, goSkillsMap, goBestPracticesSkill, goCodeHealthSkill, goCodeStructureSkill, goDependencyAuditSkill, goRefactorImpactSkill, } from "./skills/index.js";
16
+ /**
17
+ * All Go analysis tools (named exports)
18
+ */
19
+ export const goTools = goToolsMap;
20
+ /**
21
+ * Array of all Go tools
22
+ */
23
+ export { allGoTools };
24
+ /**
25
+ * All Go skills
26
+ */
27
+ export { goSkills, goSkillsMap, goBestPracticesSkill, goCodeHealthSkill, goCodeStructureSkill, goDependencyAuditSkill, goRefactorImpactSkill, };
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Go Parser using Tree-sitter
3
+ *
4
+ * Provides AST parsing and traversal for Go source files.
5
+ */
6
+ import Parser from "tree-sitter";
7
+ import type { ClassInfo, FunctionInfo, MethodInfo, VariableInfo, ImportInfo, ParameterInfo } from "./node-types.js";
8
+ /**
9
+ * Parse result containing the tree and source
10
+ */
11
+ export interface ParseResult {
12
+ tree: Parser.Tree;
13
+ source: string;
14
+ hasErrors: boolean;
15
+ errors: ParseError[];
16
+ }
17
+ /**
18
+ * Parse error information
19
+ */
20
+ export interface ParseError {
21
+ message: string;
22
+ line: number;
23
+ column: number;
24
+ }
25
+ /**
26
+ * Parse Go source code
27
+ */
28
+ export declare function parseSource(source: string): ParseResult;
29
+ /**
30
+ * Parse Go file
31
+ */
32
+ export declare function parseFile(path: string): Promise<ParseResult>;
33
+ /**
34
+ * Get text from a node
35
+ */
36
+ export declare function getNodeText(node: Parser.SyntaxNode, source: string): string;
37
+ /**
38
+ * Extract doc comment from above a declaration
39
+ * Go uses line comments (//) or block comments before declarations
40
+ */
41
+ export declare function extractDocComment(node: Parser.SyntaxNode, source: string): string | undefined;
42
+ /**
43
+ * Check if a name is exported (starts with uppercase)
44
+ */
45
+ export declare function isExported(name: string): boolean;
46
+ /**
47
+ * Parse function parameters
48
+ */
49
+ export declare function parseParameters(node: Parser.SyntaxNode, source: string): ParameterInfo[];
50
+ /**
51
+ * Parse return types (Go supports multiple return values)
52
+ */
53
+ export declare function parseReturnTypes(node: Parser.SyntaxNode, source: string): string | undefined;
54
+ /**
55
+ * Parse a function declaration
56
+ */
57
+ export declare function parseFunction(node: Parser.SyntaxNode, source: string): FunctionInfo;
58
+ /**
59
+ * Parse a method declaration (function with receiver)
60
+ */
61
+ export declare function parseMethod(node: Parser.SyntaxNode, source: string): MethodInfo;
62
+ /**
63
+ * Parse a type declaration (struct or interface)
64
+ * We treat these as "classes" for compatibility with the tool interface
65
+ */
66
+ export declare function parseClass(node: Parser.SyntaxNode, source: string): ClassInfo;
67
+ /**
68
+ * Parse import declaration
69
+ */
70
+ export declare function parseImport(node: Parser.SyntaxNode, source: string): ImportInfo[];
71
+ /**
72
+ * Parse variable/constant declaration
73
+ */
74
+ export declare function parseVariable(node: Parser.SyntaxNode, source: string): VariableInfo[];
75
+ /**
76
+ * Get package name from source file
77
+ */
78
+ export declare function getPackageName(tree: Parser.Tree, source: string): string | undefined;
79
+ /**
80
+ * Walk the AST and collect all nodes of given types
81
+ */
82
+ export declare function walkTree(node: Parser.SyntaxNode, types?: string[]): Generator<Parser.SyntaxNode>;
83
+ /**
84
+ * Find all nodes matching a predicate
85
+ */
86
+ export declare function findNodes(node: Parser.SyntaxNode, predicate: (n: Parser.SyntaxNode) => boolean): Parser.SyntaxNode[];
87
+ /**
88
+ * Get the containing scope for a node (function or type)
89
+ */
90
+ export declare function getContainingScope(node: Parser.SyntaxNode): {
91
+ type: "function" | "class" | "module";
92
+ name: string;
93
+ node: Parser.SyntaxNode;
94
+ } | null;
95
+ /**
96
+ * Parse decorators - Go doesn't have decorators, returns empty array
97
+ * This is a compatibility function for tools that expect this export
98
+ */
99
+ export declare function parseDecorators(_node: Parser.SyntaxNode, _source: string): string[];
100
+ /**
101
+ * Alias for extractDocComment for compatibility with tools expecting Python-style docstring extraction
102
+ */
103
+ export declare const extractDocstring: typeof extractDocComment;
104
+ //# sourceMappingURL=go-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"go-parser.d.ts","sourceRoot":"","sources":["../../src/parser/go-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,a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