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,221 @@
|
|
|
1
|
+
"""Screen for configuring provider API keys before entering chat."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, cast
|
|
6
|
+
|
|
7
|
+
from textual import on
|
|
8
|
+
from textual.app import ComposeResult
|
|
9
|
+
from textual.containers import Horizontal, Vertical
|
|
10
|
+
from textual.reactive import reactive
|
|
11
|
+
from textual.screen import Screen
|
|
12
|
+
from textual.widgets import Button, Input, Label, ListItem, ListView, Static
|
|
13
|
+
|
|
14
|
+
from shotgun.agents.config import ConfigManager, ProviderType
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from ..app import ShotgunApp
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ProviderConfigScreen(Screen[None]):
|
|
21
|
+
"""Collect API keys for available providers."""
|
|
22
|
+
|
|
23
|
+
CSS = """
|
|
24
|
+
ProviderConfig {
|
|
25
|
+
layout: vertical;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ProviderConfig > * {
|
|
29
|
+
height: auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#titlebox {
|
|
33
|
+
height: auto;
|
|
34
|
+
margin: 2 0;
|
|
35
|
+
padding: 1;
|
|
36
|
+
border: hkey $border;
|
|
37
|
+
content-align: center middle;
|
|
38
|
+
|
|
39
|
+
& > * {
|
|
40
|
+
text-align: center;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#provider-config-title {
|
|
45
|
+
padding: 1 0;
|
|
46
|
+
text-style: bold;
|
|
47
|
+
color: $text-accent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#provider-list {
|
|
51
|
+
margin: 2 0;
|
|
52
|
+
height: auto;
|
|
53
|
+
& > * {
|
|
54
|
+
padding: 1 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
#provider-actions {
|
|
58
|
+
padding: 1;
|
|
59
|
+
}
|
|
60
|
+
#provider-actions > * {
|
|
61
|
+
margin-right: 2;
|
|
62
|
+
}
|
|
63
|
+
#provider-list {
|
|
64
|
+
padding: 1;
|
|
65
|
+
}
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
BINDINGS = [
|
|
69
|
+
("escape", "done", "Back"),
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
selected_provider: reactive[ProviderType] = reactive(ProviderType.OPENAI)
|
|
73
|
+
|
|
74
|
+
def compose(self) -> ComposeResult:
|
|
75
|
+
with Vertical(id="titlebox"):
|
|
76
|
+
yield Static("Provider setup", id="provider-config-title")
|
|
77
|
+
yield Static(
|
|
78
|
+
"Select a provider and enter the API key needed to activate it.",
|
|
79
|
+
id="provider-config-summary",
|
|
80
|
+
)
|
|
81
|
+
yield ListView(*self._build_provider_items(), id="provider-list")
|
|
82
|
+
yield Input(
|
|
83
|
+
placeholder=self._input_placeholder(self.selected_provider),
|
|
84
|
+
password=True,
|
|
85
|
+
id="api-key",
|
|
86
|
+
)
|
|
87
|
+
with Horizontal(id="provider-actions"):
|
|
88
|
+
yield Button("Save key \\[ENTER]", variant="primary", id="save")
|
|
89
|
+
yield Button("Clear key", id="clear", variant="warning")
|
|
90
|
+
yield Button("Done \\[ESC]", id="done")
|
|
91
|
+
|
|
92
|
+
def on_mount(self) -> None:
|
|
93
|
+
self.refresh_provider_status()
|
|
94
|
+
list_view = self.query_one(ListView)
|
|
95
|
+
if list_view.children:
|
|
96
|
+
list_view.index = 0
|
|
97
|
+
self.selected_provider = ProviderType.OPENAI
|
|
98
|
+
self.set_focus(self.query_one("#api-key", Input))
|
|
99
|
+
|
|
100
|
+
def action_done(self) -> None:
|
|
101
|
+
self.dismiss()
|
|
102
|
+
|
|
103
|
+
@on(ListView.Highlighted)
|
|
104
|
+
def _on_provider_highlighted(self, event: ListView.Highlighted) -> None:
|
|
105
|
+
provider = self._provider_from_item(event.item)
|
|
106
|
+
if provider:
|
|
107
|
+
self.selected_provider = provider
|
|
108
|
+
|
|
109
|
+
@on(ListView.Selected)
|
|
110
|
+
def _on_provider_selected(self, event: ListView.Selected) -> None:
|
|
111
|
+
provider = self._provider_from_item(event.item)
|
|
112
|
+
if provider:
|
|
113
|
+
self.selected_provider = provider
|
|
114
|
+
self.set_focus(self.query_one("#api-key", Input))
|
|
115
|
+
|
|
116
|
+
@on(Button.Pressed, "#save")
|
|
117
|
+
def _on_save_pressed(self) -> None:
|
|
118
|
+
self._save_api_key()
|
|
119
|
+
|
|
120
|
+
@on(Button.Pressed, "#clear")
|
|
121
|
+
def _on_clear_pressed(self) -> None:
|
|
122
|
+
self._clear_api_key()
|
|
123
|
+
|
|
124
|
+
@on(Button.Pressed, "#done")
|
|
125
|
+
def _on_done_pressed(self) -> None:
|
|
126
|
+
self.action_done()
|
|
127
|
+
|
|
128
|
+
@on(Input.Submitted, "#api-key")
|
|
129
|
+
def _on_input_submitted(self, event: Input.Submitted) -> None:
|
|
130
|
+
del event # unused
|
|
131
|
+
self._save_api_key()
|
|
132
|
+
|
|
133
|
+
def watch_selected_provider(self, provider: ProviderType) -> None:
|
|
134
|
+
if not self.is_mounted:
|
|
135
|
+
return
|
|
136
|
+
input_widget = self.query_one("#api-key", Input)
|
|
137
|
+
input_widget.placeholder = self._input_placeholder(provider)
|
|
138
|
+
input_widget.value = ""
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def config_manager(self) -> ConfigManager:
|
|
142
|
+
app = cast("ShotgunApp", self.app)
|
|
143
|
+
return app.config_manager
|
|
144
|
+
|
|
145
|
+
def refresh_provider_status(self) -> None:
|
|
146
|
+
"""Update the list view entries to reflect configured providers."""
|
|
147
|
+
for provider in ProviderType:
|
|
148
|
+
label = self.query_one(f"#label-{provider.value}", Label)
|
|
149
|
+
label.update(self._provider_label(provider))
|
|
150
|
+
|
|
151
|
+
def _build_provider_items(self) -> list[ListItem]:
|
|
152
|
+
items: list[ListItem] = []
|
|
153
|
+
for provider in ProviderType:
|
|
154
|
+
label = Label(self._provider_label(provider), id=f"label-{provider.value}")
|
|
155
|
+
items.append(ListItem(label, id=f"provider-{provider.value}"))
|
|
156
|
+
return items
|
|
157
|
+
|
|
158
|
+
def _provider_from_item(self, item: ListItem | None) -> ProviderType | None:
|
|
159
|
+
if item is None or item.id is None:
|
|
160
|
+
return None
|
|
161
|
+
provider_id = item.id.removeprefix("provider-")
|
|
162
|
+
try:
|
|
163
|
+
return ProviderType(provider_id)
|
|
164
|
+
except ValueError:
|
|
165
|
+
return None
|
|
166
|
+
|
|
167
|
+
def _provider_label(self, provider: ProviderType) -> str:
|
|
168
|
+
display = self._provider_display_name(provider)
|
|
169
|
+
status = (
|
|
170
|
+
"Configured"
|
|
171
|
+
if self.config_manager.has_provider_key(provider)
|
|
172
|
+
else "Not configured"
|
|
173
|
+
)
|
|
174
|
+
return f"{display} · {status}"
|
|
175
|
+
|
|
176
|
+
def _provider_display_name(self, provider: ProviderType) -> str:
|
|
177
|
+
names = {
|
|
178
|
+
ProviderType.OPENAI: "OpenAI",
|
|
179
|
+
ProviderType.ANTHROPIC: "Anthropic",
|
|
180
|
+
ProviderType.GOOGLE: "Google Gemini",
|
|
181
|
+
}
|
|
182
|
+
return names.get(provider, provider.value.title())
|
|
183
|
+
|
|
184
|
+
def _input_placeholder(self, provider: ProviderType) -> str:
|
|
185
|
+
return f"{self._provider_display_name(provider)} API key"
|
|
186
|
+
|
|
187
|
+
def _save_api_key(self) -> None:
|
|
188
|
+
input_widget = self.query_one("#api-key", Input)
|
|
189
|
+
api_key = input_widget.value.strip()
|
|
190
|
+
|
|
191
|
+
if not api_key:
|
|
192
|
+
self.notify("Enter an API key before saving.", severity="error")
|
|
193
|
+
return
|
|
194
|
+
|
|
195
|
+
try:
|
|
196
|
+
self.config_manager.update_provider(
|
|
197
|
+
self.selected_provider,
|
|
198
|
+
api_key=api_key,
|
|
199
|
+
)
|
|
200
|
+
except Exception as exc: # pragma: no cover - defensive; textual path
|
|
201
|
+
self.notify(f"Failed to save key: {exc}", severity="error")
|
|
202
|
+
return
|
|
203
|
+
|
|
204
|
+
input_widget.value = ""
|
|
205
|
+
self.refresh_provider_status()
|
|
206
|
+
self.notify(
|
|
207
|
+
f"Saved API key for {self._provider_display_name(self.selected_provider)}."
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
def _clear_api_key(self) -> None:
|
|
211
|
+
try:
|
|
212
|
+
self.config_manager.clear_provider_key(self.selected_provider)
|
|
213
|
+
except Exception as exc: # pragma: no cover - defensive; textual path
|
|
214
|
+
self.notify(f"Failed to clear key: {exc}", severity="error")
|
|
215
|
+
return
|
|
216
|
+
|
|
217
|
+
self.refresh_provider_status()
|
|
218
|
+
self.query_one("#api-key", Input).value = ""
|
|
219
|
+
self.notify(
|
|
220
|
+
f"Cleared API key for {self._provider_display_name(self.selected_provider)}."
|
|
221
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from textual.app import ComposeResult
|
|
2
|
+
from textual.containers import Container
|
|
3
|
+
from textual.screen import Screen
|
|
4
|
+
|
|
5
|
+
from ..components.splash import SplashWidget
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class SplashScreen(Screen[None]):
|
|
9
|
+
CSS = """
|
|
10
|
+
#splash-container {
|
|
11
|
+
align: center middle;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
SplashWidget {
|
|
18
|
+
color: $text-accent;
|
|
19
|
+
}
|
|
20
|
+
"""
|
|
21
|
+
"""Splash screen for the app."""
|
|
22
|
+
|
|
23
|
+
def on_mount(self) -> None:
|
|
24
|
+
self.set_timer(2, self.on_timer_tick)
|
|
25
|
+
|
|
26
|
+
def on_timer_tick(self) -> None:
|
|
27
|
+
self.dismiss()
|
|
28
|
+
|
|
29
|
+
def compose(self) -> ComposeResult:
|
|
30
|
+
with Container(id="splash-container"):
|
|
31
|
+
yield SplashWidget()
|
shotgun/tui/styles.tcss
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""File system utility functions."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_shotgun_home() -> Path:
|
|
8
|
+
"""Get the Shotgun home directory path.
|
|
9
|
+
|
|
10
|
+
Can be overridden with SHOTGUN_HOME environment variable for testing.
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
Path to shotgun home directory (default: ~/.shotgun-sh/)
|
|
14
|
+
"""
|
|
15
|
+
# Allow override via environment variable (useful for testing)
|
|
16
|
+
if custom_home := os.environ.get("SHOTGUN_HOME"):
|
|
17
|
+
return Path(custom_home)
|
|
18
|
+
|
|
19
|
+
return Path.home() / ".shotgun-sh"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def ensure_shotgun_directory_exists() -> Path:
|
|
23
|
+
"""Ensure the .shotgun directory exists and return its path.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Path: The path to the .shotgun directory.
|
|
27
|
+
"""
|
|
28
|
+
shotgun_dir = Path.cwd() / ".shotgun"
|
|
29
|
+
shotgun_dir.mkdir(exist_ok=True)
|
|
30
|
+
# Note: Removed logger to avoid circular dependency with logging_config
|
|
31
|
+
return shotgun_dir
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shotgun-sh
|
|
3
|
+
Version: 0.1.0.dev1
|
|
4
|
+
Summary: AI-powered research, planning, and task management CLI tool
|
|
5
|
+
Project-URL: Homepage, https://github.com/shotgun-sh/shotgun
|
|
6
|
+
Project-URL: Repository, https://github.com/shotgun-sh/shotgun
|
|
7
|
+
Project-URL: Issues, https://github.com/shotgun-sh/shotgun/issues
|
|
8
|
+
Project-URL: Discord, https://discord.gg/5RmY6J2N7s
|
|
9
|
+
Author-email: "Proofs.io" <hello@proofs.io>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agent,ai,cli,llm,planning,productivity,pydantic-ai,research,task-management
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: httpx>=0.27.0
|
|
26
|
+
Requires-Dist: jinja2>=3.1.0
|
|
27
|
+
Requires-Dist: kuzu>=0.7.0
|
|
28
|
+
Requires-Dist: openinference-instrumentation-pydantic-ai
|
|
29
|
+
Requires-Dist: opentelemetry-api
|
|
30
|
+
Requires-Dist: opentelemetry-exporter-otlp
|
|
31
|
+
Requires-Dist: opentelemetry-sdk
|
|
32
|
+
Requires-Dist: pydantic-ai>=0.0.14
|
|
33
|
+
Requires-Dist: rich>=13.0.0
|
|
34
|
+
Requires-Dist: textual-dev>=1.7.0
|
|
35
|
+
Requires-Dist: textual>=6.1.0
|
|
36
|
+
Requires-Dist: tree-sitter-go>=0.23.0
|
|
37
|
+
Requires-Dist: tree-sitter-javascript>=0.23.0
|
|
38
|
+
Requires-Dist: tree-sitter-languages>=1.10.0
|
|
39
|
+
Requires-Dist: tree-sitter-python>=0.23.0
|
|
40
|
+
Requires-Dist: tree-sitter-rust>=0.23.0
|
|
41
|
+
Requires-Dist: tree-sitter-typescript>=0.23.0
|
|
42
|
+
Requires-Dist: tree-sitter>=0.21.0
|
|
43
|
+
Requires-Dist: typer>=0.12.0
|
|
44
|
+
Requires-Dist: watchdog>=4.0.0
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: commitizen>=3.13.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: lefthook>=1.12.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: mypy>=1.11.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
# Shotgun
|
|
53
|
+
|
|
54
|
+
A Python CLI tool for research, planning, and task management powered by AI agents.
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- **Research**: Perform research with agentic loops
|
|
59
|
+
- **Planning**: Generate structured plans for achieving goals
|
|
60
|
+
- **Tasks**: Generate prioritized task lists with agentic approaches
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
### From PyPI (Recommended)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install shotgun-sh
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### From Source
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/shotgun-sh/shotgun.git
|
|
74
|
+
cd shotgun
|
|
75
|
+
uv sync --all-extras
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
After installation from source, you can use either method:
|
|
79
|
+
|
|
80
|
+
**Method 1: Direct command (after uv sync)**
|
|
81
|
+
```bash
|
|
82
|
+
shotgun --help
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Method 2: Via uv run**
|
|
86
|
+
```bash
|
|
87
|
+
uv run shotgun --help
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If installed from PyPI, simply use:
|
|
91
|
+
```bash
|
|
92
|
+
shotgun --help
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Virtual Environment Setup (Optional)
|
|
96
|
+
|
|
97
|
+
If you prefer using a local virtual environment:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
uv venv
|
|
101
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
102
|
+
uv sync --all-extras
|
|
103
|
+
shotgun --help
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
### Using Direct Commands (after uv sync)
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Research a topic
|
|
112
|
+
shotgun research "What is quantum computing?"
|
|
113
|
+
|
|
114
|
+
# Generate a plan
|
|
115
|
+
shotgun plan "Build a web application"
|
|
116
|
+
shotgun plan "build me a house"
|
|
117
|
+
|
|
118
|
+
# Generate tasks for a project
|
|
119
|
+
shotgun tasks "Create a machine learning model"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Using uv run
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Research a topic
|
|
126
|
+
uv run shotgun research "What is quantum computing?"
|
|
127
|
+
|
|
128
|
+
# Generate a plan
|
|
129
|
+
uv run shotgun plan "Build a web application"
|
|
130
|
+
|
|
131
|
+
# Generate tasks for a project
|
|
132
|
+
uv run shotgun tasks "Create a machine learning model"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Development Setup
|
|
136
|
+
|
|
137
|
+
### Requirements
|
|
138
|
+
|
|
139
|
+
- **Python 3.10+** (3.13 recommended)
|
|
140
|
+
- **uv** - Fast Python package installer and resolver
|
|
141
|
+
- **actionlint** (optional) - For GitHub Actions workflow validation
|
|
142
|
+
|
|
143
|
+
### Quick Start
|
|
144
|
+
|
|
145
|
+
1. **Clone and setup**:
|
|
146
|
+
```bash
|
|
147
|
+
git clone https://github.com/shotgun-sh/shotgun.git
|
|
148
|
+
cd shotgun
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
2. **Install uv** (if not already installed):
|
|
152
|
+
```bash
|
|
153
|
+
# macOS/Linux
|
|
154
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
155
|
+
|
|
156
|
+
# Or via brew
|
|
157
|
+
brew install uv
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
3. **Install dependencies**:
|
|
161
|
+
```bash
|
|
162
|
+
uv sync --all-extras
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
4. **Install git hooks**:
|
|
166
|
+
```bash
|
|
167
|
+
uv run lefthook install
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
5. **Verify setup**:
|
|
171
|
+
```bash
|
|
172
|
+
uv run shotgun --version
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Development Commands
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Run the CLI
|
|
179
|
+
uv run shotgun --help
|
|
180
|
+
|
|
181
|
+
# Run the TUI
|
|
182
|
+
uv run tui
|
|
183
|
+
|
|
184
|
+
# Run tests
|
|
185
|
+
uv run pytest
|
|
186
|
+
|
|
187
|
+
# Run tests with coverage
|
|
188
|
+
uv run pytest --cov=src --cov-report=term-missing --cov-report=html
|
|
189
|
+
|
|
190
|
+
# Run linting
|
|
191
|
+
uv run ruff check .
|
|
192
|
+
|
|
193
|
+
# Run formatting
|
|
194
|
+
uv run ruff format .
|
|
195
|
+
|
|
196
|
+
# Run type checking
|
|
197
|
+
uv run mypy src/
|
|
198
|
+
|
|
199
|
+
# Run all pre-commit hooks manually
|
|
200
|
+
uv run lefthook run pre-commit
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Code Coverage
|
|
204
|
+
|
|
205
|
+
To analyze test coverage and identify areas that need testing:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Run tests with coverage analysis
|
|
209
|
+
uv run pytest --cov=src --cov-report=term-missing --cov-report=html
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This will:
|
|
213
|
+
- Display coverage summary in the terminal
|
|
214
|
+
- Generate a detailed HTML coverage report
|
|
215
|
+
|
|
216
|
+
**Viewing the coverage report:**
|
|
217
|
+
Open `htmlcov/index.html` in your browser to see:
|
|
218
|
+
- Overall coverage percentage
|
|
219
|
+
- File-by-file coverage breakdown
|
|
220
|
+
- Line-by-line coverage highlighting
|
|
221
|
+
- Missing coverage areas
|
|
222
|
+
|
|
223
|
+
The coverage configuration is in `pyproject.toml` and will automatically run when you use `uv run pytest`.
|
|
224
|
+
|
|
225
|
+
### Git Hooks (Lefthook)
|
|
226
|
+
|
|
227
|
+
This project uses [lefthook](https://github.com/evilmartians/lefthook) for git hooks. The hooks automatically run:
|
|
228
|
+
|
|
229
|
+
- **ruff** - Python linting with auto-fix
|
|
230
|
+
- **ruff-format** - Code formatting
|
|
231
|
+
- **mypy** - Type checking
|
|
232
|
+
- **commitizen** - Commit message validation
|
|
233
|
+
- **actionlint** - GitHub Actions workflow validation (if installed)
|
|
234
|
+
|
|
235
|
+
#### Installing actionlint (recommended)
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# macOS
|
|
239
|
+
brew install actionlint
|
|
240
|
+
|
|
241
|
+
# Linux/macOS (direct download)
|
|
242
|
+
curl -sSfL https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash | bash
|
|
243
|
+
|
|
244
|
+
# Go install
|
|
245
|
+
go install github.com/rhysd/actionlint/cmd/actionlint@latest
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
### Python Version Management
|
|
250
|
+
|
|
251
|
+
The project supports **Python 3.10+**. The `.python-version` file specifies Python 3.10 to ensure development against the minimum supported version.
|
|
252
|
+
|
|
253
|
+
If using **pyenv**:
|
|
254
|
+
```bash
|
|
255
|
+
pyenv install 3.10.16 # or latest 3.10.x
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
If using **uv** (recommended):
|
|
259
|
+
```bash
|
|
260
|
+
uv python install 3.10
|
|
261
|
+
uv sync --python 3.10
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Commit Message Convention
|
|
265
|
+
|
|
266
|
+
This project enforces **Conventional Commits** specification. All commit messages must follow this format:
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
<type>[optional scope]: <description>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Required commit types:**
|
|
273
|
+
- `feat`: New feature
|
|
274
|
+
- `fix`: Bug fix
|
|
275
|
+
- `docs`: Documentation changes
|
|
276
|
+
- `style`: Code formatting changes
|
|
277
|
+
- `refactor`: Code restructuring without feature changes
|
|
278
|
+
- `perf`: Performance improvements
|
|
279
|
+
- `test`: Adding or updating tests
|
|
280
|
+
- `build`: Build system changes
|
|
281
|
+
- `ci`: CI/CD changes
|
|
282
|
+
- `chore`: Maintenance tasks
|
|
283
|
+
- `revert`: Reverting previous commits
|
|
284
|
+
|
|
285
|
+
**Examples:**
|
|
286
|
+
```bash
|
|
287
|
+
feat: add user authentication system
|
|
288
|
+
fix: resolve memory leak in data processing
|
|
289
|
+
docs: update API documentation
|
|
290
|
+
refactor: simplify user validation logic
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**For interactive commit creation:**
|
|
294
|
+
```bash
|
|
295
|
+
uv run cz commit
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Contributing
|
|
299
|
+
|
|
300
|
+
1. Fork the repository
|
|
301
|
+
2. Create a feature branch: `git checkout -b feat/feature-name`
|
|
302
|
+
3. Make your changes
|
|
303
|
+
4. Run the pre-commit hooks: `uv run lefthook run pre-commit`
|
|
304
|
+
5. Commit with conventional format: `git commit -m "feat: add new feature"`
|
|
305
|
+
6. Push to your fork: `git push origin feat/feature-name`
|
|
306
|
+
7. Create a Pull Request with conventional title format
|
|
307
|
+
|
|
308
|
+
### CI/CD
|
|
309
|
+
|
|
310
|
+
GitHub Actions automatically:
|
|
311
|
+
- Runs on pull requests and pushes to main
|
|
312
|
+
- Tests with Python 3.10
|
|
313
|
+
- Validates code with ruff, ruff-format, and mypy
|
|
314
|
+
- Ensures all checks pass before merge
|
|
315
|
+
|
|
316
|
+
## Support
|
|
317
|
+
|
|
318
|
+
Join our discord https://discord.gg/5RmY6J2N7s
|