shotgun-sh 0.1.0.dev1__py3-none-any.whl
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.
Potentially problematic release.
This version of shotgun-sh might be problematic. Click here for more details.
- shotgun/__init__.py +3 -0
- shotgun/agents/__init__.py +1 -0
- shotgun/agents/agent_manager.py +196 -0
- shotgun/agents/common.py +295 -0
- shotgun/agents/config/__init__.py +13 -0
- shotgun/agents/config/manager.py +215 -0
- shotgun/agents/config/models.py +120 -0
- shotgun/agents/config/provider.py +91 -0
- shotgun/agents/history/__init__.py +5 -0
- shotgun/agents/history/history_processors.py +213 -0
- shotgun/agents/models.py +94 -0
- shotgun/agents/plan.py +119 -0
- shotgun/agents/research.py +131 -0
- shotgun/agents/tasks.py +122 -0
- shotgun/agents/tools/__init__.py +26 -0
- shotgun/agents/tools/codebase/__init__.py +28 -0
- shotgun/agents/tools/codebase/codebase_shell.py +256 -0
- shotgun/agents/tools/codebase/directory_lister.py +141 -0
- shotgun/agents/tools/codebase/file_read.py +144 -0
- shotgun/agents/tools/codebase/models.py +252 -0
- shotgun/agents/tools/codebase/query_graph.py +67 -0
- shotgun/agents/tools/codebase/retrieve_code.py +81 -0
- shotgun/agents/tools/file_management.py +130 -0
- shotgun/agents/tools/user_interaction.py +36 -0
- shotgun/agents/tools/web_search.py +69 -0
- shotgun/cli/__init__.py +1 -0
- shotgun/cli/codebase/__init__.py +5 -0
- shotgun/cli/codebase/commands.py +202 -0
- shotgun/cli/codebase/models.py +21 -0
- shotgun/cli/config.py +261 -0
- shotgun/cli/models.py +10 -0
- shotgun/cli/plan.py +65 -0
- shotgun/cli/research.py +78 -0
- shotgun/cli/tasks.py +71 -0
- shotgun/cli/utils.py +25 -0
- shotgun/codebase/__init__.py +12 -0
- shotgun/codebase/core/__init__.py +46 -0
- shotgun/codebase/core/change_detector.py +358 -0
- shotgun/codebase/core/code_retrieval.py +243 -0
- shotgun/codebase/core/ingestor.py +1497 -0
- shotgun/codebase/core/language_config.py +297 -0
- shotgun/codebase/core/manager.py +1554 -0
- shotgun/codebase/core/nl_query.py +327 -0
- shotgun/codebase/core/parser_loader.py +152 -0
- shotgun/codebase/models.py +107 -0
- shotgun/codebase/service.py +148 -0
- shotgun/logging_config.py +172 -0
- shotgun/main.py +73 -0
- shotgun/prompts/__init__.py +5 -0
- shotgun/prompts/agents/__init__.py +1 -0
- shotgun/prompts/agents/partials/codebase_understanding.j2 +79 -0
- shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +10 -0
- shotgun/prompts/agents/partials/interactive_mode.j2 +8 -0
- shotgun/prompts/agents/plan.j2 +57 -0
- shotgun/prompts/agents/research.j2 +38 -0
- shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +13 -0
- shotgun/prompts/agents/state/system_state.j2 +1 -0
- shotgun/prompts/agents/tasks.j2 +67 -0
- shotgun/prompts/codebase/__init__.py +1 -0
- shotgun/prompts/codebase/cypher_query_patterns.j2 +221 -0
- shotgun/prompts/codebase/cypher_system.j2 +28 -0
- shotgun/prompts/codebase/enhanced_query_context.j2 +10 -0
- shotgun/prompts/codebase/partials/cypher_rules.j2 +24 -0
- shotgun/prompts/codebase/partials/graph_schema.j2 +28 -0
- shotgun/prompts/codebase/partials/temporal_context.j2 +21 -0
- shotgun/prompts/history/__init__.py +1 -0
- shotgun/prompts/history/summarization.j2 +46 -0
- shotgun/prompts/loader.py +140 -0
- shotgun/prompts/user/research.j2 +5 -0
- shotgun/py.typed +0 -0
- shotgun/sdk/__init__.py +13 -0
- shotgun/sdk/codebase.py +195 -0
- shotgun/sdk/exceptions.py +17 -0
- shotgun/sdk/models.py +189 -0
- shotgun/sdk/services.py +23 -0
- shotgun/telemetry.py +68 -0
- shotgun/tui/__init__.py +0 -0
- shotgun/tui/app.py +49 -0
- shotgun/tui/components/prompt_input.py +69 -0
- shotgun/tui/components/spinner.py +86 -0
- shotgun/tui/components/splash.py +25 -0
- shotgun/tui/components/vertical_tail.py +28 -0
- shotgun/tui/screens/chat.py +415 -0
- shotgun/tui/screens/chat.tcss +28 -0
- shotgun/tui/screens/provider_config.py +221 -0
- shotgun/tui/screens/splash.py +31 -0
- shotgun/tui/styles.tcss +10 -0
- shotgun/utils/__init__.py +5 -0
- shotgun/utils/file_system_utils.py +31 -0
- shotgun_sh-0.1.0.dev1.dist-info/METADATA +318 -0
- shotgun_sh-0.1.0.dev1.dist-info/RECORD +94 -0
- shotgun_sh-0.1.0.dev1.dist-info/WHEEL +4 -0
- shotgun_sh-0.1.0.dev1.dist-info/entry_points.txt +3 -0
- shotgun_sh-0.1.0.dev1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"""Language configuration for Tree-sitter parsing."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass
|
|
7
|
+
class LanguageConfig:
|
|
8
|
+
"""Configuration for language-specific Tree-sitter parsing."""
|
|
9
|
+
|
|
10
|
+
name: str
|
|
11
|
+
file_extensions: list[str]
|
|
12
|
+
function_node_types: list[str]
|
|
13
|
+
class_node_types: list[str] = field(default_factory=list)
|
|
14
|
+
module_node_types: list[str] = field(default_factory=list)
|
|
15
|
+
call_node_types: list[str] = field(default_factory=list)
|
|
16
|
+
decorator_node_types: list[str] = field(default_factory=list)
|
|
17
|
+
import_node_types: list[str] = field(default_factory=list)
|
|
18
|
+
import_from_node_types: list[str] = field(default_factory=list)
|
|
19
|
+
package_indicators: list[str] = field(default_factory=list)
|
|
20
|
+
function_query: str | None = None
|
|
21
|
+
class_query: str | None = None
|
|
22
|
+
call_query: str | None = None
|
|
23
|
+
import_query: str | None = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# Language configurations
|
|
27
|
+
LANGUAGE_CONFIGS = {
|
|
28
|
+
"python": LanguageConfig(
|
|
29
|
+
name="python",
|
|
30
|
+
file_extensions=[".py"],
|
|
31
|
+
function_node_types=["function_definition"],
|
|
32
|
+
class_node_types=["class_definition"],
|
|
33
|
+
module_node_types=["module"],
|
|
34
|
+
call_node_types=["call"],
|
|
35
|
+
decorator_node_types=["decorator"],
|
|
36
|
+
import_node_types=["import_statement"],
|
|
37
|
+
import_from_node_types=["import_from_statement"],
|
|
38
|
+
package_indicators=["__init__.py"],
|
|
39
|
+
function_query="""
|
|
40
|
+
(function_definition
|
|
41
|
+
name: (identifier) @function_name
|
|
42
|
+
parameters: (parameters) @params
|
|
43
|
+
body: (block) @body
|
|
44
|
+
) @function
|
|
45
|
+
""",
|
|
46
|
+
class_query="""
|
|
47
|
+
(class_definition
|
|
48
|
+
name: (identifier) @class_name
|
|
49
|
+
body: (block) @body
|
|
50
|
+
) @class
|
|
51
|
+
""",
|
|
52
|
+
call_query="""
|
|
53
|
+
(call
|
|
54
|
+
function: [
|
|
55
|
+
(identifier) @call_name
|
|
56
|
+
(attribute
|
|
57
|
+
object: (identifier)? @object
|
|
58
|
+
attribute: (identifier) @method
|
|
59
|
+
)
|
|
60
|
+
]
|
|
61
|
+
) @call
|
|
62
|
+
""",
|
|
63
|
+
import_query="""
|
|
64
|
+
[
|
|
65
|
+
(import_statement
|
|
66
|
+
name: (dotted_name) @import_name
|
|
67
|
+
) @import
|
|
68
|
+
(import_from_statement
|
|
69
|
+
module_name: (dotted_name)? @module_name
|
|
70
|
+
name: (dotted_name)? @import_name
|
|
71
|
+
) @import_from
|
|
72
|
+
(import_from_statement
|
|
73
|
+
module_name: (dotted_name)? @module_name
|
|
74
|
+
name: (aliased_import
|
|
75
|
+
name: (dotted_name) @import_name
|
|
76
|
+
alias: (identifier) @alias
|
|
77
|
+
)
|
|
78
|
+
) @import_from_alias
|
|
79
|
+
]
|
|
80
|
+
""",
|
|
81
|
+
),
|
|
82
|
+
"javascript": LanguageConfig(
|
|
83
|
+
name="javascript",
|
|
84
|
+
file_extensions=[".js", ".jsx", ".mjs", ".cjs"],
|
|
85
|
+
function_node_types=[
|
|
86
|
+
"function_declaration",
|
|
87
|
+
"function_expression",
|
|
88
|
+
"arrow_function",
|
|
89
|
+
"method_definition",
|
|
90
|
+
"generator_function_declaration",
|
|
91
|
+
"generator_function",
|
|
92
|
+
],
|
|
93
|
+
class_node_types=["class_declaration", "class_expression"],
|
|
94
|
+
module_node_types=["program"],
|
|
95
|
+
call_node_types=["call_expression"],
|
|
96
|
+
import_node_types=["import_statement"],
|
|
97
|
+
import_from_node_types=["import_statement"],
|
|
98
|
+
package_indicators=["package.json"],
|
|
99
|
+
function_query="""
|
|
100
|
+
[
|
|
101
|
+
(function_declaration name: (identifier) @function_name) @function
|
|
102
|
+
(function_expression name: (identifier)? @function_name) @function
|
|
103
|
+
(arrow_function) @function
|
|
104
|
+
(method_definition
|
|
105
|
+
name: (property_identifier) @function_name
|
|
106
|
+
) @function
|
|
107
|
+
(variable_declarator
|
|
108
|
+
name: (identifier) @function_name
|
|
109
|
+
value: [(arrow_function) (function_expression)]
|
|
110
|
+
) @function
|
|
111
|
+
]
|
|
112
|
+
""",
|
|
113
|
+
class_query="""
|
|
114
|
+
[
|
|
115
|
+
(class_declaration name: (identifier) @class_name) @class
|
|
116
|
+
(class_expression name: (identifier)? @class_name) @class
|
|
117
|
+
]
|
|
118
|
+
""",
|
|
119
|
+
call_query="""
|
|
120
|
+
(call_expression
|
|
121
|
+
function: [
|
|
122
|
+
(identifier) @call_name
|
|
123
|
+
(member_expression
|
|
124
|
+
object: (identifier)? @object
|
|
125
|
+
property: (property_identifier) @method
|
|
126
|
+
)
|
|
127
|
+
]
|
|
128
|
+
) @call
|
|
129
|
+
""",
|
|
130
|
+
),
|
|
131
|
+
"typescript": LanguageConfig(
|
|
132
|
+
name="typescript",
|
|
133
|
+
file_extensions=[".ts", ".tsx"],
|
|
134
|
+
function_node_types=[
|
|
135
|
+
"function_declaration",
|
|
136
|
+
"function_expression",
|
|
137
|
+
"arrow_function",
|
|
138
|
+
"method_definition",
|
|
139
|
+
"method_signature",
|
|
140
|
+
"generator_function_declaration",
|
|
141
|
+
"generator_function",
|
|
142
|
+
],
|
|
143
|
+
class_node_types=[
|
|
144
|
+
"class_declaration",
|
|
145
|
+
"class_expression",
|
|
146
|
+
"interface_declaration",
|
|
147
|
+
"type_alias_declaration",
|
|
148
|
+
],
|
|
149
|
+
module_node_types=["program"],
|
|
150
|
+
call_node_types=["call_expression"],
|
|
151
|
+
import_node_types=["import_statement"],
|
|
152
|
+
import_from_node_types=["import_statement"],
|
|
153
|
+
package_indicators=["package.json", "tsconfig.json"],
|
|
154
|
+
function_query="""
|
|
155
|
+
[
|
|
156
|
+
(function_declaration name: (identifier) @function_name) @function
|
|
157
|
+
(function_expression name: (identifier)? @function_name) @function
|
|
158
|
+
(arrow_function) @function
|
|
159
|
+
(method_definition
|
|
160
|
+
name: (property_identifier) @function_name
|
|
161
|
+
) @function
|
|
162
|
+
(method_signature
|
|
163
|
+
name: (property_identifier) @function_name
|
|
164
|
+
) @function
|
|
165
|
+
(variable_declarator
|
|
166
|
+
name: (identifier) @function_name
|
|
167
|
+
value: [(arrow_function) (function_expression)]
|
|
168
|
+
) @function
|
|
169
|
+
]
|
|
170
|
+
""",
|
|
171
|
+
class_query="""
|
|
172
|
+
[
|
|
173
|
+
(class_declaration name: (type_identifier) @class_name) @class
|
|
174
|
+
(interface_declaration name: (type_identifier) @class_name) @interface
|
|
175
|
+
(type_alias_declaration name: (type_identifier) @class_name) @type_alias
|
|
176
|
+
]
|
|
177
|
+
""",
|
|
178
|
+
call_query="""
|
|
179
|
+
(call_expression
|
|
180
|
+
function: [
|
|
181
|
+
(identifier) @call_name
|
|
182
|
+
(member_expression
|
|
183
|
+
object: (identifier)? @object
|
|
184
|
+
property: (property_identifier) @method
|
|
185
|
+
)
|
|
186
|
+
]
|
|
187
|
+
) @call
|
|
188
|
+
""",
|
|
189
|
+
),
|
|
190
|
+
"go": LanguageConfig(
|
|
191
|
+
name="go",
|
|
192
|
+
file_extensions=[".go"],
|
|
193
|
+
function_node_types=["function_declaration", "method_declaration"],
|
|
194
|
+
class_node_types=["type_declaration"],
|
|
195
|
+
module_node_types=["source_file"],
|
|
196
|
+
call_node_types=["call_expression"],
|
|
197
|
+
import_node_types=["import_declaration"],
|
|
198
|
+
import_from_node_types=["import_spec"],
|
|
199
|
+
package_indicators=["go.mod", "go.sum"],
|
|
200
|
+
function_query="""
|
|
201
|
+
[
|
|
202
|
+
(function_declaration
|
|
203
|
+
name: (identifier) @function_name
|
|
204
|
+
) @function
|
|
205
|
+
(method_declaration
|
|
206
|
+
receiver: (parameter_list
|
|
207
|
+
(parameter_declaration
|
|
208
|
+
type: [
|
|
209
|
+
(type_identifier) @receiver_type
|
|
210
|
+
(pointer_type (type_identifier) @receiver_type)
|
|
211
|
+
]
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
name: (field_identifier) @function_name
|
|
215
|
+
) @method
|
|
216
|
+
]
|
|
217
|
+
""",
|
|
218
|
+
class_query="""
|
|
219
|
+
(type_declaration
|
|
220
|
+
(type_spec
|
|
221
|
+
name: (type_identifier) @class_name
|
|
222
|
+
type: [
|
|
223
|
+
(struct_type) @struct
|
|
224
|
+
(interface_type) @interface
|
|
225
|
+
]
|
|
226
|
+
)
|
|
227
|
+
) @type
|
|
228
|
+
""",
|
|
229
|
+
call_query="""
|
|
230
|
+
(call_expression
|
|
231
|
+
function: [
|
|
232
|
+
(identifier) @call_name
|
|
233
|
+
(selector_expression
|
|
234
|
+
operand: (identifier)? @object
|
|
235
|
+
field: (field_identifier) @method
|
|
236
|
+
)
|
|
237
|
+
]
|
|
238
|
+
) @call
|
|
239
|
+
""",
|
|
240
|
+
),
|
|
241
|
+
"rust": LanguageConfig(
|
|
242
|
+
name="rust",
|
|
243
|
+
file_extensions=[".rs"],
|
|
244
|
+
function_node_types=["function_item", "closure_expression"],
|
|
245
|
+
class_node_types=["struct_item", "enum_item", "trait_item", "impl_item"],
|
|
246
|
+
module_node_types=["source_file", "mod_item"],
|
|
247
|
+
call_node_types=["call_expression"],
|
|
248
|
+
import_node_types=["use_declaration"],
|
|
249
|
+
import_from_node_types=["use_as_clause", "use_list"],
|
|
250
|
+
package_indicators=["Cargo.toml"],
|
|
251
|
+
function_query="""
|
|
252
|
+
[
|
|
253
|
+
(function_item
|
|
254
|
+
name: (identifier) @function_name
|
|
255
|
+
) @function
|
|
256
|
+
(impl_item
|
|
257
|
+
type: (type_identifier) @impl_type
|
|
258
|
+
body: (declaration_list
|
|
259
|
+
(function_item
|
|
260
|
+
name: (identifier) @method_name
|
|
261
|
+
) @method
|
|
262
|
+
)
|
|
263
|
+
)
|
|
264
|
+
]
|
|
265
|
+
""",
|
|
266
|
+
class_query="""
|
|
267
|
+
[
|
|
268
|
+
(struct_item name: (type_identifier) @class_name) @struct
|
|
269
|
+
(enum_item name: (type_identifier) @class_name) @enum
|
|
270
|
+
(trait_item name: (type_identifier) @class_name) @trait
|
|
271
|
+
]
|
|
272
|
+
""",
|
|
273
|
+
call_query="""
|
|
274
|
+
(call_expression
|
|
275
|
+
function: [
|
|
276
|
+
(identifier) @call_name
|
|
277
|
+
(field_expression
|
|
278
|
+
value: (identifier)? @object
|
|
279
|
+
field: (field_identifier) @method
|
|
280
|
+
)
|
|
281
|
+
(scoped_identifier
|
|
282
|
+
path: (identifier)? @module
|
|
283
|
+
name: (identifier) @call_name
|
|
284
|
+
)
|
|
285
|
+
]
|
|
286
|
+
) @call
|
|
287
|
+
""",
|
|
288
|
+
),
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def get_language_config(file_extension: str) -> LanguageConfig | None:
|
|
293
|
+
"""Get language configuration based on file extension."""
|
|
294
|
+
for config in LANGUAGE_CONFIGS.values():
|
|
295
|
+
if file_extension in config.file_extensions:
|
|
296
|
+
return config
|
|
297
|
+
return None
|