@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.
- package/LICENSE +21 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/parser/go-parser.d.ts +104 -0
- package/dist/parser/go-parser.d.ts.map +1 -0
- package/dist/parser/go-parser.js +492 -0
- package/dist/parser/index.d.ts +6 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +5 -0
- package/dist/parser/node-types.d.ts +130 -0
- package/dist/parser/node-types.d.ts.map +1 -0
- package/dist/parser/node-types.js +4 -0
- package/dist/skills/go-best-practices.d.ts +7 -0
- package/dist/skills/go-best-practices.d.ts.map +1 -0
- package/dist/skills/go-best-practices.js +78 -0
- package/dist/skills/go-code-health.d.ts +7 -0
- package/dist/skills/go-code-health.d.ts.map +1 -0
- package/dist/skills/go-code-health.js +209 -0
- package/dist/skills/go-code-structure.d.ts +7 -0
- package/dist/skills/go-code-structure.d.ts.map +1 -0
- package/dist/skills/go-code-structure.js +155 -0
- package/dist/skills/go-dependency-audit.d.ts +7 -0
- package/dist/skills/go-dependency-audit.d.ts.map +1 -0
- package/dist/skills/go-dependency-audit.js +246 -0
- package/dist/skills/go-refactor-impact.d.ts +7 -0
- package/dist/skills/go-refactor-impact.d.ts.map +1 -0
- package/dist/skills/go-refactor-impact.js +232 -0
- package/dist/skills/index.d.ts +26 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +36 -0
- package/dist/tools/extract-docstrings.d.ts +51 -0
- package/dist/tools/extract-docstrings.d.ts.map +1 -0
- package/dist/tools/extract-docstrings.js +292 -0
- package/dist/tools/find-dead-code.d.ts +62 -0
- package/dist/tools/find-dead-code.d.ts.map +1 -0
- package/dist/tools/find-dead-code.js +422 -0
- package/dist/tools/find-duplicates.d.ts +65 -0
- package/dist/tools/find-duplicates.d.ts.map +1 -0
- package/dist/tools/find-duplicates.js +289 -0
- package/dist/tools/find-implementations.d.ts +71 -0
- package/dist/tools/find-implementations.d.ts.map +1 -0
- package/dist/tools/find-implementations.js +342 -0
- package/dist/tools/find-patterns.d.ts +71 -0
- package/dist/tools/find-patterns.d.ts.map +1 -0
- package/dist/tools/find-patterns.js +477 -0
- package/dist/tools/find-references.d.ts +66 -0
- package/dist/tools/find-references.d.ts.map +1 -0
- package/dist/tools/find-references.js +306 -0
- package/dist/tools/find-symbol.d.ts +86 -0
- package/dist/tools/find-symbol.d.ts.map +1 -0
- package/dist/tools/find-symbol.js +380 -0
- package/dist/tools/get-call-graph.d.ts +89 -0
- package/dist/tools/get-call-graph.d.ts.map +1 -0
- package/dist/tools/get-call-graph.js +431 -0
- package/dist/tools/get-class-hierarchy.d.ts +34 -0
- package/dist/tools/get-class-hierarchy.d.ts.map +1 -0
- package/dist/tools/get-class-hierarchy.js +250 -0
- package/dist/tools/get-complexity.d.ts +53 -0
- package/dist/tools/get-complexity.d.ts.map +1 -0
- package/dist/tools/get-complexity.js +357 -0
- package/dist/tools/get-dependency-graph.d.ts +85 -0
- package/dist/tools/get-dependency-graph.d.ts.map +1 -0
- package/dist/tools/get-dependency-graph.js +389 -0
- package/dist/tools/get-exports.d.ts +78 -0
- package/dist/tools/get-exports.d.ts.map +1 -0
- package/dist/tools/get-exports.js +437 -0
- package/dist/tools/get-file-structure.d.ts +28 -0
- package/dist/tools/get-file-structure.d.ts.map +1 -0
- package/dist/tools/get-file-structure.js +172 -0
- package/dist/tools/get-imports.d.ts +30 -0
- package/dist/tools/get-imports.d.ts.map +1 -0
- package/dist/tools/get-imports.js +420 -0
- package/dist/tools/get-signature.d.ts +100 -0
- package/dist/tools/get-signature.d.ts.map +1 -0
- package/dist/tools/get-signature.js +800 -0
- package/dist/tools/index.d.ts +55 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +75 -0
- package/dist/tools/types.d.ts +408 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +4 -0
- package/package.json +86 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go Dependency Audit Skill
|
|
3
|
+
*
|
|
4
|
+
* Analyzes Go imports, dependencies, and finds circular dependency issues.
|
|
5
|
+
*/
|
|
6
|
+
import { defineSkill } from "@compilr-dev/agents";
|
|
7
|
+
export const goDependencyAuditSkill = defineSkill({
|
|
8
|
+
name: "go-dependency-audit",
|
|
9
|
+
description: "Audit Go imports and dependencies for issues",
|
|
10
|
+
version: "1.1.0",
|
|
11
|
+
tags: ["python", "dependencies", "imports", "audit"],
|
|
12
|
+
prompt: `You are in Go dependency audit mode. Use these tools systematically:
|
|
13
|
+
|
|
14
|
+
## Dependency Audit Workflow
|
|
15
|
+
|
|
16
|
+
### Step 1: Build Dependency Graph
|
|
17
|
+
Use **get_dependency_graph_go** to build a complete module dependency graph:
|
|
18
|
+
- Detect circular dependencies
|
|
19
|
+
- Identify external vs internal dependencies
|
|
20
|
+
- Find modules with excessive dependencies
|
|
21
|
+
- Find highly-depended-upon modules
|
|
22
|
+
|
|
23
|
+
\`\`\`
|
|
24
|
+
get_dependency_graph_go({
|
|
25
|
+
path: "/path/to/project",
|
|
26
|
+
includeExternal: true
|
|
27
|
+
})
|
|
28
|
+
\`\`\`
|
|
29
|
+
|
|
30
|
+
### Step 2: Import Analysis
|
|
31
|
+
Use **get_imports_go** to categorize all imports:
|
|
32
|
+
- **stdlib**: Go standard library (safe, always available)
|
|
33
|
+
- **third_party**: External packages (need installation)
|
|
34
|
+
- **local**: Project-internal modules
|
|
35
|
+
|
|
36
|
+
### Step 3: Reference Mapping
|
|
37
|
+
Use **find_references_go** to understand usage:
|
|
38
|
+
- How modules depend on each other
|
|
39
|
+
- What functions/classes are imported where
|
|
40
|
+
- Which modules are most heavily used
|
|
41
|
+
|
|
42
|
+
### Step 4: Structure Review
|
|
43
|
+
Use **get_file_structure_go** to see module organization:
|
|
44
|
+
- What each module exports
|
|
45
|
+
- Public API surface (__all__)
|
|
46
|
+
- Internal vs public modules
|
|
47
|
+
|
|
48
|
+
### Step 5: Export Analysis
|
|
49
|
+
Use **get_exports_go** to understand public API:
|
|
50
|
+
- What symbols are in __all__
|
|
51
|
+
- Public vs private symbols
|
|
52
|
+
- Re-exports from submodules
|
|
53
|
+
|
|
54
|
+
## Go Dependency Types
|
|
55
|
+
|
|
56
|
+
### Direct Dependencies
|
|
57
|
+
\`\`\`python
|
|
58
|
+
import requests # Whole module
|
|
59
|
+
from flask import Flask # Specific import
|
|
60
|
+
\`\`\`
|
|
61
|
+
|
|
62
|
+
### Relative Imports (Local)
|
|
63
|
+
\`\`\`python
|
|
64
|
+
from . import utils # Same package
|
|
65
|
+
from ..core import models # Parent package
|
|
66
|
+
from .helpers import parse # Same package, specific
|
|
67
|
+
\`\`\`
|
|
68
|
+
|
|
69
|
+
### Conditional/Lazy Imports
|
|
70
|
+
\`\`\`python
|
|
71
|
+
if TYPE_CHECKING:
|
|
72
|
+
from heavy_module import BigClass # Type-only
|
|
73
|
+
|
|
74
|
+
def get_thing():
|
|
75
|
+
from expensive import Thing # Lazy load
|
|
76
|
+
return Thing()
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
## Circular Dependency Detection
|
|
80
|
+
|
|
81
|
+
### Using get_dependency_graph_go
|
|
82
|
+
The tool automatically detects circular dependencies:
|
|
83
|
+
\`\`\`
|
|
84
|
+
get_dependency_graph_go({ path: "/path/to/project" })
|
|
85
|
+
// Check result.circularDependencies array
|
|
86
|
+
// Each cycle shows: [A → B → C → A]
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
### Severity Assessment
|
|
90
|
+
- 2-node cycles: HIGH - direct mutual dependency
|
|
91
|
+
- 3-node cycles: MEDIUM - triangular dependency
|
|
92
|
+
- 4+ node cycles: LOW - long chain, often architectural
|
|
93
|
+
|
|
94
|
+
### Common Solutions
|
|
95
|
+
1. **Extract Common Code**: Move shared code to a third module
|
|
96
|
+
2. **Use Lazy Imports**: Import inside functions, not at module level
|
|
97
|
+
3. **Dependency Inversion**: Depend on abstractions, not concrete modules
|
|
98
|
+
4. **TYPE_CHECKING Guard**: For type hints only, use conditional import
|
|
99
|
+
|
|
100
|
+
\`\`\`python
|
|
101
|
+
from typing import TYPE_CHECKING
|
|
102
|
+
|
|
103
|
+
if TYPE_CHECKING:
|
|
104
|
+
from other_module import SomeClass # Only for type checking
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
## Import Best Practices
|
|
108
|
+
|
|
109
|
+
### Order (PEP 8)
|
|
110
|
+
\`\`\`python
|
|
111
|
+
# 1. Standard library
|
|
112
|
+
import os
|
|
113
|
+
import sys
|
|
114
|
+
|
|
115
|
+
# 2. Third-party
|
|
116
|
+
import requests
|
|
117
|
+
import flask
|
|
118
|
+
|
|
119
|
+
# 3. Local
|
|
120
|
+
from . import utils
|
|
121
|
+
from .models import User
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
### What to Avoid
|
|
125
|
+
- **\`from module import *\`**: Pollutes namespace, unclear dependencies
|
|
126
|
+
- **Unused imports**: Adds clutter, confuses readers
|
|
127
|
+
- **Circular imports**: Causes runtime errors
|
|
128
|
+
- **Absolute imports of local modules**: Use relative imports within package
|
|
129
|
+
|
|
130
|
+
## Dependency Metrics
|
|
131
|
+
|
|
132
|
+
### Import Health
|
|
133
|
+
| Metric | Good | Acceptable | Needs Work |
|
|
134
|
+
|--------|------|------------|------------|
|
|
135
|
+
| Third-party deps | < 10 | 10-20 | > 20 |
|
|
136
|
+
| Circular deps | 0 | 1-2 | > 2 |
|
|
137
|
+
| Star imports | 0 | 0 | > 0 |
|
|
138
|
+
| Unused imports | 0 | 1-3 | > 3 |
|
|
139
|
+
|
|
140
|
+
### Module Coupling
|
|
141
|
+
| Metric | Good | Acceptable | Needs Work |
|
|
142
|
+
|--------|------|------------|------------|
|
|
143
|
+
| Inbound refs | < 10 | 10-20 | > 20 |
|
|
144
|
+
| Outbound deps | < 8 | 8-15 | > 15 |
|
|
145
|
+
| Depth in hierarchy | < 3 | 3-4 | > 4 |
|
|
146
|
+
|
|
147
|
+
### Dependency Graph Stats
|
|
148
|
+
| Metric | Good | Acceptable | Needs Work |
|
|
149
|
+
|--------|------|------------|------------|
|
|
150
|
+
| Total modules | < 50 | 50-100 | > 100 |
|
|
151
|
+
| Avg deps per module | < 5 | 5-10 | > 10 |
|
|
152
|
+
| Most depended-upon | < 15 | 15-25 | > 25 |
|
|
153
|
+
|
|
154
|
+
## Audit Report Template
|
|
155
|
+
|
|
156
|
+
\`\`\`markdown
|
|
157
|
+
# Dependency Audit Report
|
|
158
|
+
|
|
159
|
+
## Dependency Graph Summary
|
|
160
|
+
| Metric | Value |
|
|
161
|
+
|--------|-------|
|
|
162
|
+
| Total modules | X |
|
|
163
|
+
| Internal modules | Y |
|
|
164
|
+
| External packages | Z |
|
|
165
|
+
| Total edges | N |
|
|
166
|
+
| Circular dependencies | M |
|
|
167
|
+
|
|
168
|
+
## Circular Dependencies (if any)
|
|
169
|
+
1. \`module_a.go\` → \`module_b.go\` → \`module_a.go\`
|
|
170
|
+
- Severity: HIGH (2-node cycle)
|
|
171
|
+
- Suggested fix: Extract shared code to new module
|
|
172
|
+
|
|
173
|
+
## Hot Spots
|
|
174
|
+
| Module | Incoming | Outgoing | Risk |
|
|
175
|
+
|--------|----------|----------|------|
|
|
176
|
+
| utils/__init__.go | 15 | 3 | HIGH - God module |
|
|
177
|
+
| services/api.go | 2 | 12 | MEDIUM - Many deps |
|
|
178
|
+
|
|
179
|
+
## External Packages (N total)
|
|
180
|
+
- **Core**: requests, flask, sqlalchemy
|
|
181
|
+
- **Dev**: pytest, mypy, black
|
|
182
|
+
- **Potential issues**:
|
|
183
|
+
- requests + httpx (duplicate functionality)
|
|
184
|
+
|
|
185
|
+
## Import Breakdown
|
|
186
|
+
| Category | Count | % |
|
|
187
|
+
|----------|-------|---|
|
|
188
|
+
| stdlib | N | X% |
|
|
189
|
+
| third_party | N | X% |
|
|
190
|
+
| local | N | X% |
|
|
191
|
+
|
|
192
|
+
## Unused Imports
|
|
193
|
+
1. module.go:5 - unused import 'os'
|
|
194
|
+
|
|
195
|
+
## Recommendations
|
|
196
|
+
1. Break up utils/__init__.go into focused modules
|
|
197
|
+
2. Resolve circular dependency between A and B
|
|
198
|
+
3. Consider replacing requests with httpx for async support
|
|
199
|
+
4. Remove unused imports (N total)
|
|
200
|
+
\`\`\`
|
|
201
|
+
|
|
202
|
+
## Common Scenarios
|
|
203
|
+
|
|
204
|
+
### "What does this module depend on?"
|
|
205
|
+
\`\`\`
|
|
206
|
+
get_imports_go({ path: "module.go" })
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
### "What depends on this module?"
|
|
210
|
+
\`\`\`
|
|
211
|
+
find_references_go({ name: "my_module", filterType: "import" })
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
### "Find all circular dependencies"
|
|
215
|
+
\`\`\`
|
|
216
|
+
get_dependency_graph_go({ path: "/path/to/project" })
|
|
217
|
+
// Check circularDependencies in result
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
### "Find all third-party dependencies"
|
|
221
|
+
\`\`\`
|
|
222
|
+
get_imports_go({ path: ".", recursive: true })
|
|
223
|
+
// Filter result for category: "third_party"
|
|
224
|
+
\`\`\`
|
|
225
|
+
|
|
226
|
+
### "Check for import issues in a directory"
|
|
227
|
+
\`\`\`
|
|
228
|
+
get_imports_go({ path: "src/", recursive: true })
|
|
229
|
+
// Look for: star imports, unused, circular patterns
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
### "Analyze module's public API"
|
|
233
|
+
\`\`\`
|
|
234
|
+
get_exports_go({ path: "module.go" })
|
|
235
|
+
// Shows __all__, public symbols, re-exports
|
|
236
|
+
\`\`\`
|
|
237
|
+
|
|
238
|
+
## When to Use This Skill
|
|
239
|
+
|
|
240
|
+
- Before adding new dependencies
|
|
241
|
+
- During code review
|
|
242
|
+
- Debugging import errors
|
|
243
|
+
- Planning module restructuring
|
|
244
|
+
- Dependency cleanup sprints
|
|
245
|
+
`,
|
|
246
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go-refactor-impact.d.ts","sourceRoot":"","sources":["../../src/skills/go-refactor-impact.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,eAAO,MAAM,qBAAqB,qCAiOhC,CAAC"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go Refactor Impact Skill
|
|
3
|
+
*
|
|
4
|
+
* Assesses the impact of potential code changes and refactoring.
|
|
5
|
+
*/
|
|
6
|
+
import { defineSkill } from "@compilr-dev/agents";
|
|
7
|
+
export const goRefactorImpactSkill = defineSkill({
|
|
8
|
+
name: "go-refactor-impact",
|
|
9
|
+
description: "Assess impact of Go code changes and refactoring",
|
|
10
|
+
version: "1.1.0",
|
|
11
|
+
tags: ["python", "refactoring", "impact", "analysis"],
|
|
12
|
+
prompt: `You are in Go refactor impact analysis mode. Use these tools systematically:
|
|
13
|
+
|
|
14
|
+
## Impact Analysis Workflow
|
|
15
|
+
|
|
16
|
+
### Step 1: Find the Symbol
|
|
17
|
+
Use **find_symbol_go** to locate what you want to change:
|
|
18
|
+
- Function definition
|
|
19
|
+
- Class definition
|
|
20
|
+
- Method or constant
|
|
21
|
+
|
|
22
|
+
### Step 2: Find All References
|
|
23
|
+
Use **find_references_go** to understand usage:
|
|
24
|
+
- **definition**: Where it's defined
|
|
25
|
+
- **read**: Where it's used/accessed
|
|
26
|
+
- **write**: Where it's assigned
|
|
27
|
+
- **call**: Where it's called as a function
|
|
28
|
+
- **import**: Where it's imported
|
|
29
|
+
- **attribute**: Where it's accessed as an attribute
|
|
30
|
+
|
|
31
|
+
### Step 3: Analyze Call Graph
|
|
32
|
+
Use **get_call_graph_go** to understand function relationships:
|
|
33
|
+
- Who calls this function?
|
|
34
|
+
- What functions does it call?
|
|
35
|
+
- Trace impact through call chains
|
|
36
|
+
|
|
37
|
+
\`\`\`
|
|
38
|
+
get_call_graph_go({
|
|
39
|
+
startFunction: "process_order",
|
|
40
|
+
path: "/path/to/project",
|
|
41
|
+
direction: "both", // "callers", "callees", or "both"
|
|
42
|
+
maxDepth: 3
|
|
43
|
+
})
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
### Step 4: Understand the Hierarchy
|
|
47
|
+
Use **get_class_hierarchy_go** for class changes:
|
|
48
|
+
- What classes inherit from this?
|
|
49
|
+
- What does this class inherit from?
|
|
50
|
+
- How will changes propagate?
|
|
51
|
+
|
|
52
|
+
### Step 5: Find Implementations
|
|
53
|
+
Use **find_implementations_go** for ABC/Protocol changes:
|
|
54
|
+
- Find all concrete implementations of an abstract class
|
|
55
|
+
- Find all classes implementing a Protocol
|
|
56
|
+
- Understand which classes need updating
|
|
57
|
+
|
|
58
|
+
\`\`\`
|
|
59
|
+
find_implementations_go({
|
|
60
|
+
name: "BaseHandler",
|
|
61
|
+
scope: "/path/to/project"
|
|
62
|
+
})
|
|
63
|
+
\`\`\`
|
|
64
|
+
|
|
65
|
+
### Step 6: Check Dependencies
|
|
66
|
+
Use **get_imports_go** to see module dependencies:
|
|
67
|
+
- What imports this module?
|
|
68
|
+
- Breaking changes affect all importers
|
|
69
|
+
|
|
70
|
+
### Step 7: Assess Complexity
|
|
71
|
+
Use **get_complexity_go** to understand scope:
|
|
72
|
+
- How complex is the current code?
|
|
73
|
+
- Will the refactor simplify it?
|
|
74
|
+
|
|
75
|
+
## Impact Categories
|
|
76
|
+
|
|
77
|
+
### High Impact Changes
|
|
78
|
+
- Renaming public classes/functions
|
|
79
|
+
- Changing function signatures
|
|
80
|
+
- Modifying class hierarchy (adding/removing base classes)
|
|
81
|
+
- Changing module structure (moving files)
|
|
82
|
+
- Modifying __init__.go exports
|
|
83
|
+
|
|
84
|
+
### Medium Impact Changes
|
|
85
|
+
- Adding optional parameters
|
|
86
|
+
- Changing implementation (keeping signature)
|
|
87
|
+
- Adding new methods to classes
|
|
88
|
+
- Deprecating old interfaces
|
|
89
|
+
|
|
90
|
+
### Low Impact Changes
|
|
91
|
+
- Renaming private members (_name)
|
|
92
|
+
- Changing internal implementation details
|
|
93
|
+
- Adding docstrings
|
|
94
|
+
- Fixing bugs without API changes
|
|
95
|
+
|
|
96
|
+
## Go-Specific Considerations
|
|
97
|
+
|
|
98
|
+
### Duck Typing Impact
|
|
99
|
+
- Go uses duck typing - changes affect any code expecting the interface
|
|
100
|
+
- No compiler to catch broken references
|
|
101
|
+
- Tests are critical for catching breakage
|
|
102
|
+
|
|
103
|
+
### Dynamic Imports
|
|
104
|
+
\`\`\`python
|
|
105
|
+
# These won't be caught by static analysis
|
|
106
|
+
module = importlib.import_module(f"plugins.{name}")
|
|
107
|
+
getattr(obj, "method_name")()
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
### Magic Methods
|
|
111
|
+
\`\`\`python
|
|
112
|
+
# Changes to __init__, __str__, etc. have wide impact
|
|
113
|
+
def __eq__(self, other): # Affects dict keys, set membership
|
|
114
|
+
def __hash__(self): # Affects dict/set operations
|
|
115
|
+
def __iter__(self): # Affects for loops, unpacking
|
|
116
|
+
\`\`\`
|
|
117
|
+
|
|
118
|
+
### Decorators
|
|
119
|
+
\`\`\`python
|
|
120
|
+
@property # Changes how attribute is accessed
|
|
121
|
+
@classmethod # Changes how method is called
|
|
122
|
+
@staticmethod # Changes binding behavior
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
## Impact Assessment Checklist
|
|
126
|
+
|
|
127
|
+
### Before Renaming
|
|
128
|
+
- [ ] Find all references (find_references_go)
|
|
129
|
+
- [ ] Check for string-based access (getattr, dictionary keys)
|
|
130
|
+
- [ ] Check for dynamic imports
|
|
131
|
+
- [ ] Check test files
|
|
132
|
+
- [ ] Check config files
|
|
133
|
+
|
|
134
|
+
### Before Changing Signature
|
|
135
|
+
- [ ] Find all call sites (find_references_go with type: call)
|
|
136
|
+
- [ ] Check for **kwargs usage (may hide callers)
|
|
137
|
+
- [ ] Check for partial/functools.partial usage
|
|
138
|
+
- [ ] Consider adding deprecation warning first
|
|
139
|
+
|
|
140
|
+
### Before Changing Inheritance
|
|
141
|
+
- [ ] Find all subclasses (get_class_hierarchy_go)
|
|
142
|
+
- [ ] Check for super() calls
|
|
143
|
+
- [ ] Check for overridden methods
|
|
144
|
+
- [ ] Check for ABC abstract methods
|
|
145
|
+
|
|
146
|
+
### Before Moving Code
|
|
147
|
+
- [ ] Find all imports (find_references_go with type: import)
|
|
148
|
+
- [ ] Check for relative imports
|
|
149
|
+
- [ ] Update __init__.go exports
|
|
150
|
+
- [ ] Consider re-exporting from old location temporarily
|
|
151
|
+
|
|
152
|
+
## Impact Report Template
|
|
153
|
+
|
|
154
|
+
\`\`\`markdown
|
|
155
|
+
# Refactor Impact Analysis
|
|
156
|
+
|
|
157
|
+
## Change Description
|
|
158
|
+
- **Target**: function/class name
|
|
159
|
+
- **Change**: rename/modify signature/move/delete
|
|
160
|
+
- **Location**: file:line
|
|
161
|
+
|
|
162
|
+
## Impact Summary
|
|
163
|
+
- Files affected: N
|
|
164
|
+
- Direct references: N
|
|
165
|
+
- Indirect references: N
|
|
166
|
+
- Risk level: High/Medium/Low
|
|
167
|
+
|
|
168
|
+
## Direct References
|
|
169
|
+
| File | Line | Type | Code Snippet |
|
|
170
|
+
|------|------|------|--------------|
|
|
171
|
+
| a.go | 42 | call | foo() |
|
|
172
|
+
| b.go | 15 | import | from m import foo |
|
|
173
|
+
|
|
174
|
+
## Inheritance Impact (for classes)
|
|
175
|
+
- Subclasses: ChildA, ChildB
|
|
176
|
+
- Methods overridden by: 3 classes
|
|
177
|
+
|
|
178
|
+
## Test Coverage
|
|
179
|
+
- Related tests: N
|
|
180
|
+
- Test files: test_foo.go, test_bar.go
|
|
181
|
+
|
|
182
|
+
## Migration Plan
|
|
183
|
+
1. Add deprecation warning
|
|
184
|
+
2. Create new function with new signature
|
|
185
|
+
3. Update internal callers
|
|
186
|
+
4. Update external callers
|
|
187
|
+
5. Remove deprecated function
|
|
188
|
+
|
|
189
|
+
## Risks
|
|
190
|
+
- Dynamic imports may be missed
|
|
191
|
+
- String-based getattr usage
|
|
192
|
+
\`\`\`
|
|
193
|
+
|
|
194
|
+
## Safe Refactoring Strategies
|
|
195
|
+
|
|
196
|
+
### 1. Deprecation Path
|
|
197
|
+
\`\`\`python
|
|
198
|
+
import warnings
|
|
199
|
+
|
|
200
|
+
def old_function():
|
|
201
|
+
warnings.warn(
|
|
202
|
+
"old_function is deprecated, use new_function instead",
|
|
203
|
+
DeprecationWarning,
|
|
204
|
+
stacklevel=2
|
|
205
|
+
)
|
|
206
|
+
return new_function()
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
### 2. Backwards-Compatible Signature
|
|
210
|
+
\`\`\`python
|
|
211
|
+
def function(new_param=None, *, old_param=None):
|
|
212
|
+
if old_param is not None:
|
|
213
|
+
warnings.warn("old_param is deprecated", DeprecationWarning)
|
|
214
|
+
new_param = old_param
|
|
215
|
+
# ...
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
### 3. Re-export After Move
|
|
219
|
+
\`\`\`python
|
|
220
|
+
# In old location's __init__.go
|
|
221
|
+
from new_location import moved_function # Re-export for backwards compat
|
|
222
|
+
\`\`\`
|
|
223
|
+
|
|
224
|
+
## When to Use This Skill
|
|
225
|
+
|
|
226
|
+
- Before any refactoring
|
|
227
|
+
- Planning breaking changes
|
|
228
|
+
- Assessing technical debt cleanup
|
|
229
|
+
- Preparing deprecation plans
|
|
230
|
+
- Code review of refactoring PRs
|
|
231
|
+
`,
|
|
232
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go Skills
|
|
3
|
+
*
|
|
4
|
+
* Skills for Go code analysis, best practices, and workflows.
|
|
5
|
+
*/
|
|
6
|
+
export { goBestPracticesSkill } from "./go-best-practices.js";
|
|
7
|
+
export { goCodeHealthSkill } from "./go-code-health.js";
|
|
8
|
+
export { goCodeStructureSkill } from "./go-code-structure.js";
|
|
9
|
+
export { goDependencyAuditSkill } from "./go-dependency-audit.js";
|
|
10
|
+
export { goRefactorImpactSkill } from "./go-refactor-impact.js";
|
|
11
|
+
import type { Skill } from "@compilr-dev/agents";
|
|
12
|
+
/**
|
|
13
|
+
* All Go skills
|
|
14
|
+
*/
|
|
15
|
+
export declare const goSkills: Skill[];
|
|
16
|
+
/**
|
|
17
|
+
* Go skills by name for selective use
|
|
18
|
+
*/
|
|
19
|
+
export declare const goSkillsMap: {
|
|
20
|
+
readonly bestPractices: Skill;
|
|
21
|
+
readonly codeHealth: Skill;
|
|
22
|
+
readonly codeStructure: Skill;
|
|
23
|
+
readonly dependencyAudit: Skill;
|
|
24
|
+
readonly refactorImpact: Skill;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAOhE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,EAM3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go Skills
|
|
3
|
+
*
|
|
4
|
+
* Skills for Go code analysis, best practices, and workflows.
|
|
5
|
+
*/
|
|
6
|
+
// Individual skill exports
|
|
7
|
+
export { goBestPracticesSkill } from "./go-best-practices.js";
|
|
8
|
+
export { goCodeHealthSkill } from "./go-code-health.js";
|
|
9
|
+
export { goCodeStructureSkill } from "./go-code-structure.js";
|
|
10
|
+
export { goDependencyAuditSkill } from "./go-dependency-audit.js";
|
|
11
|
+
export { goRefactorImpactSkill } from "./go-refactor-impact.js";
|
|
12
|
+
import { goBestPracticesSkill } from "./go-best-practices.js";
|
|
13
|
+
import { goCodeHealthSkill } from "./go-code-health.js";
|
|
14
|
+
import { goCodeStructureSkill } from "./go-code-structure.js";
|
|
15
|
+
import { goDependencyAuditSkill } from "./go-dependency-audit.js";
|
|
16
|
+
import { goRefactorImpactSkill } from "./go-refactor-impact.js";
|
|
17
|
+
/**
|
|
18
|
+
* All Go skills
|
|
19
|
+
*/
|
|
20
|
+
export const goSkills = [
|
|
21
|
+
goBestPracticesSkill,
|
|
22
|
+
goCodeHealthSkill,
|
|
23
|
+
goCodeStructureSkill,
|
|
24
|
+
goDependencyAuditSkill,
|
|
25
|
+
goRefactorImpactSkill,
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Go skills by name for selective use
|
|
29
|
+
*/
|
|
30
|
+
export const goSkillsMap = {
|
|
31
|
+
bestPractices: goBestPracticesSkill,
|
|
32
|
+
codeHealth: goCodeHealthSkill,
|
|
33
|
+
codeStructure: goCodeStructureSkill,
|
|
34
|
+
dependencyAudit: goDependencyAuditSkill,
|
|
35
|
+
refactorImpact: goRefactorImpactSkill,
|
|
36
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* extractDocstrings Tool
|
|
3
|
+
*
|
|
4
|
+
* Extract documentation comments from Go code.
|
|
5
|
+
* Go uses godoc-style comments above declarations.
|
|
6
|
+
*/
|
|
7
|
+
import type { Tool } from "@compilr-dev/agents";
|
|
8
|
+
import type { DocumentationResult } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Input for extractDocstrings tool
|
|
11
|
+
*/
|
|
12
|
+
export interface ExtractDocstringsInput {
|
|
13
|
+
/** Path to Go file or directory */
|
|
14
|
+
path: string;
|
|
15
|
+
/** Recursive scan for directories */
|
|
16
|
+
recursive?: boolean;
|
|
17
|
+
/** Filter by symbol name */
|
|
18
|
+
name?: string;
|
|
19
|
+
/** Include undocumented symbols */
|
|
20
|
+
includeUndocumented?: boolean;
|
|
21
|
+
/** Maximum files to process */
|
|
22
|
+
maxFiles?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Output from extractDocstrings tool
|
|
26
|
+
*/
|
|
27
|
+
export interface ExtractDocstringsResult {
|
|
28
|
+
/** Analyzed path */
|
|
29
|
+
path: string;
|
|
30
|
+
/** Documentation results */
|
|
31
|
+
docs: DocumentationResult[];
|
|
32
|
+
/** Statistics */
|
|
33
|
+
stats: {
|
|
34
|
+
total: number;
|
|
35
|
+
documented: number;
|
|
36
|
+
undocumented: number;
|
|
37
|
+
percentage: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* extractDocstrings tool - Extract Go documentation
|
|
42
|
+
*/
|
|
43
|
+
export declare const extractDocstringsTool: Tool<ExtractDocstringsInput>;
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create a customized extractDocstrings tool
|
|
46
|
+
*/
|
|
47
|
+
export declare function createExtractDocstringsTool(options?: {
|
|
48
|
+
defaultMaxFiles?: number;
|
|
49
|
+
defaultIncludeUndocumented?: boolean;
|
|
50
|
+
}): Tool<ExtractDocstringsInput>;
|
|
51
|
+
//# sourceMappingURL=extract-docstrings.d.ts.map
|
|
@@ -0,0 +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;AAsCD;;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"}
|