shotgun-sh 0.1.0.dev14__py3-none-any.whl → 0.1.0.dev16__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/agents/agent_manager.py +256 -26
- shotgun/agents/models.py +20 -0
- shotgun/agents/tools/artifact_management.py +2 -3
- shotgun/artifacts/templates/research/sdk_comparison.yaml +73 -73
- shotgun/prompts/agents/partials/interactive_mode.j2 +10 -1
- shotgun/prompts/agents/plan.j2 +9 -12
- shotgun/prompts/agents/research.j2 +6 -3
- shotgun/prompts/agents/specify.j2 +8 -9
- shotgun/prompts/agents/state/artifact_templates_available.j2 +3 -1
- shotgun/prompts/agents/state/existing_artifacts_available.j2 +2 -0
- shotgun/prompts/agents/tasks.j2 +1 -1
- shotgun/prompts/codebase/cypher_query_patterns.j2 +2 -0
- shotgun/prompts/codebase/partials/graph_schema.j2 +4 -2
- shotgun/tui/app.py +9 -1
- shotgun/tui/commands/__init__.py +73 -0
- shotgun/tui/screens/chat.py +399 -179
- shotgun/tui/screens/chat.tcss +11 -0
- shotgun/tui/screens/chat_screen/__init__.py +0 -0
- shotgun/tui/screens/chat_screen/command_providers.py +197 -0
- shotgun/tui/screens/chat_screen/history.py +160 -0
- {shotgun_sh-0.1.0.dev14.dist-info → shotgun_sh-0.1.0.dev16.dist-info}/METADATA +1 -1
- {shotgun_sh-0.1.0.dev14.dist-info → shotgun_sh-0.1.0.dev16.dist-info}/RECORD +25 -21
- {shotgun_sh-0.1.0.dev14.dist-info → shotgun_sh-0.1.0.dev16.dist-info}/WHEEL +0 -0
- {shotgun_sh-0.1.0.dev14.dist-info → shotgun_sh-0.1.0.dev16.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.1.0.dev14.dist-info → shotgun_sh-0.1.0.dev16.dist-info}/licenses/LICENSE +0 -0
|
@@ -15,16 +15,16 @@ sections:
|
|
|
15
15
|
instructions: |
|
|
16
16
|
# What is a good research.overview section?
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
* Clarifies the technical need
|
|
19
|
+
* Establishes scope and constraints
|
|
20
|
+
* Aligns the team on evaluation criteria
|
|
21
|
+
* Sets realistic timeline for decision
|
|
22
22
|
|
|
23
23
|
# Questions to ask yourself:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
* What problem are we trying to solve with this SDK/library?
|
|
25
|
+
* What happens if we make the wrong choice?
|
|
26
|
+
* What are our non-negotiable requirements?
|
|
27
|
+
* Is there anything specific to our tech stack that constrains choices?
|
|
28
28
|
|
|
29
29
|
# Includes:
|
|
30
30
|
Research Objective: [One clear sentence stating what SDK/library type we need and why]
|
|
@@ -50,36 +50,36 @@ sections:
|
|
|
50
50
|
|
|
51
51
|
Define technical and business requirements that will guide the evaluation.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
* Separates must-haves from nice-to-haves
|
|
54
|
+
* Includes both functional and non-functional requirements
|
|
55
|
+
* Considers team capabilities and constraints
|
|
56
56
|
|
|
57
57
|
# Questions to ask yourself:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* What features are absolutely essential vs. "would be nice"?
|
|
59
|
+
* What are our technical constraints (language, platform, licenses)?
|
|
60
|
+
* What are our resource constraints (budget, team expertise)?
|
|
61
61
|
|
|
62
62
|
# Includes:
|
|
63
63
|
## Functional Requirements
|
|
64
64
|
Essential Features:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
* [Core functionality needed]
|
|
66
|
+
* [Integration requirements]
|
|
67
|
+
* [Performance benchmarks]
|
|
68
68
|
|
|
69
69
|
Nice-to-Have Features:
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
* [Additional capabilities]
|
|
71
|
+
* [Future-proofing considerations]
|
|
72
72
|
|
|
73
73
|
## Non-Functional Requirements
|
|
74
74
|
Technical Constraints:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
* Language/Platform: [e.g., Must support TypeScript]
|
|
76
|
+
* Architecture: [e.g., Must work in serverless environment]
|
|
77
|
+
* Performance: [e.g., < 50ms latency for operations]
|
|
78
78
|
|
|
79
79
|
Business Constraints:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
* License: [e.g., MIT or Apache 2.0 preferred]
|
|
81
|
+
* Cost: [e.g., Free for commercial use or < $X/month]
|
|
82
|
+
* Support: [e.g., Active community or paid support available]
|
|
83
83
|
depends_on:
|
|
84
84
|
- "research.overview"
|
|
85
85
|
|
|
@@ -89,21 +89,21 @@ sections:
|
|
|
89
89
|
|
|
90
90
|
Document the process and results of finding available options.
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
* Shows comprehensive search methodology
|
|
93
|
+
* Lists all viable candidates with brief descriptions
|
|
94
|
+
* Explains why certain options were excluded early
|
|
95
95
|
|
|
96
96
|
# Questions to ask yourself:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
* Where did we search? (GitHub, npm, package managers, forums)
|
|
98
|
+
* What keywords and criteria did we use?
|
|
99
|
+
* Are there any industry-standard or popular choices we're missing?
|
|
100
100
|
|
|
101
101
|
# Includes:
|
|
102
102
|
## Search Methodology
|
|
103
103
|
Sources Consulted:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
* [Package registries searched]
|
|
105
|
+
* [Community recommendations]
|
|
106
|
+
* [Industry reports/comparisons referenced]
|
|
107
107
|
|
|
108
108
|
## Initial Candidates
|
|
109
109
|
|
|
@@ -115,8 +115,8 @@ sections:
|
|
|
115
115
|
|
|
116
116
|
## Early Eliminations
|
|
117
117
|
Excluded Options:
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
* **[Library Name]**: [Reason for exclusion]
|
|
119
|
+
* **[Library Name]**: [Critical missing feature or constraint violation]
|
|
120
120
|
|
|
121
121
|
depends_on:
|
|
122
122
|
- "research.requirements"
|
|
@@ -127,23 +127,23 @@ sections:
|
|
|
127
127
|
|
|
128
128
|
Deep technical analysis of the top candidates.
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
* Provides objective, measurable comparisons
|
|
131
|
+
* Includes code examples and API comparisons
|
|
132
|
+
* Evaluates developer experience and learning curve
|
|
133
133
|
|
|
134
134
|
# Questions to ask yourself:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
* How easy is it to implement our use case in each option?
|
|
136
|
+
* What are the performance characteristics under our expected load?
|
|
137
|
+
* How well does each option integrate with our existing stack?
|
|
138
138
|
|
|
139
139
|
# Includes:
|
|
140
140
|
## Evaluated Options (Top 3-5 candidates)
|
|
141
141
|
|
|
142
142
|
### **Option A: [Name]**
|
|
143
143
|
Technical Architecture:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
* Core design philosophy
|
|
145
|
+
* Key abstractions and patterns
|
|
146
|
+
* Dependencies and size
|
|
147
147
|
|
|
148
148
|
Code Example:
|
|
149
149
|
```[language]
|
|
@@ -151,15 +151,15 @@ sections:
|
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
Performance Metrics:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
* Benchmark results
|
|
155
|
+
* Memory footprint
|
|
156
|
+
* Bundle size impact
|
|
157
157
|
|
|
158
158
|
Developer Experience:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
* Setup complexity: [Rating]
|
|
160
|
+
* Documentation quality: [Rating]
|
|
161
|
+
* API design: [Rating]
|
|
162
|
+
* Debugging tools: [Rating]
|
|
163
163
|
|
|
164
164
|
[Repeat for each candidate]
|
|
165
165
|
|
|
@@ -172,21 +172,21 @@ sections:
|
|
|
172
172
|
|
|
173
173
|
Side-by-side comparison of all evaluation criteria.
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
* Enables quick visual comparison
|
|
176
|
+
* Uses consistent scoring methodology
|
|
177
|
+
* Weights criteria by importance
|
|
178
178
|
|
|
179
179
|
# Questions to ask yourself:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
* Are we comparing apples to apples?
|
|
181
|
+
* Is our scoring methodology clear and reproducible?
|
|
182
|
+
* Have we weighted criteria appropriately for our use case?
|
|
183
183
|
|
|
184
184
|
# Includes:
|
|
185
185
|
## Scoring Methodology
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
* 🟢 Excellent (3 points): Exceeds requirements
|
|
187
|
+
* 🟡 Good (2 points): Meets requirements
|
|
188
|
+
* 🔴 Poor (1 point): Below requirements
|
|
189
|
+
* ❌ Missing (0 points): Doesn't support
|
|
190
190
|
|
|
191
191
|
## Feature Comparison
|
|
192
192
|
|
|
@@ -215,14 +215,14 @@ sections:
|
|
|
215
215
|
|
|
216
216
|
Clear recommendation with thorough justification.
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
* States the recommendation unambiguously
|
|
219
|
+
* Provides clear rationale tied to requirements
|
|
220
|
+
* Addresses concerns and mitigation strategies
|
|
221
221
|
|
|
222
222
|
# Questions to ask yourself:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
* Will stakeholders understand why we chose this option?
|
|
224
|
+
* Have we addressed all major concerns about our choice?
|
|
225
|
+
* Is our decision reversible if needed?
|
|
226
226
|
|
|
227
227
|
# Includes:
|
|
228
228
|
## Recommendation
|
|
@@ -236,12 +236,12 @@ sections:
|
|
|
236
236
|
## Detailed Justification
|
|
237
237
|
|
|
238
238
|
### Why [Selected] Over [Alternative A]
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
* [Specific technical advantage]
|
|
240
|
+
* [Business consideration]
|
|
241
|
+
* [Risk mitigation]
|
|
242
242
|
|
|
243
243
|
### Why [Selected] Over [Alternative B]
|
|
244
|
-
|
|
244
|
+
* [Comparison points]
|
|
245
245
|
|
|
246
246
|
## Risk Mitigation Plan
|
|
247
247
|
|
|
@@ -250,7 +250,7 @@ sections:
|
|
|
250
250
|
| [Specific risk] | [How we'll address it] | [Team/Person] |
|
|
251
251
|
|
|
252
252
|
## Dissenting Opinions
|
|
253
|
-
|
|
253
|
+
* [Any team concerns and how they were addressed]
|
|
254
254
|
|
|
255
255
|
depends_on:
|
|
256
256
|
- "research.comparison_matrix"
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
!!! CRITICALLY IMPORTANT !!!
|
|
5
|
+
|
|
1
6
|
{% if interactive_mode -%}
|
|
2
7
|
IMPORTANT: USER INTERACTION IS ENABLED (interactive mode).
|
|
3
8
|
|
|
9
|
+
- BEFORE GETTING TO WORK, ALWAYS THINK WHAT YOU'RE GOING TO DO AND ask_user() TO ACCEPT WHAT YOU'RE GOING TO DO.
|
|
10
|
+
- ALWAYS USE ask_user TO REVIEW AND ACCEPT THE ARTIFACT SECTION YOU'VE WORKED ON BEFORE PROCEEDING TO THE NEXT SECTION.
|
|
4
11
|
- Don't assume - ask for confirmation of your understanding
|
|
5
12
|
- When in doubt about any aspect of the goal, ASK before proceeding
|
|
6
13
|
|
|
@@ -13,4 +20,6 @@ IMPORTANT: USER INTERACTION IS DISABLED (non-interactive mode).
|
|
|
13
20
|
- Make reasonable assumptions based on industry best practices
|
|
14
21
|
- Use sensible defaults when specific details are not provided
|
|
15
22
|
- When in doubt, make reasonable assumptions and proceed with best practices
|
|
16
|
-
{% endif %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
|
shotgun/prompts/agents/plan.j2
CHANGED
|
@@ -6,18 +6,15 @@ Your job is to help create comprehensive, actionable plans for software projects
|
|
|
6
6
|
|
|
7
7
|
## PLANNING WORKFLOW
|
|
8
8
|
|
|
9
|
-
For
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
8. **Analyze context**: Understand the current situation and user's goals
|
|
19
|
-
9. **Create structured plans**: Use `write_artifact_section()` to organize planning output
|
|
20
|
-
10. **Build iteratively**: Update and refine plans based on new information
|
|
9
|
+
For PLANNING tasks:
|
|
10
|
+
0. **Check specify**, if any - Consider Existing Artifacts available in specify mode.
|
|
11
|
+
1. **Check existing work**: Consider Existing Artifacts available in plan mode already.
|
|
12
|
+
IF NO SUITABLE ARTIFACT ALREADY EXISTS:
|
|
13
|
+
2. **Look for suitable artifact template**: Consider Available Artifact Templates available in plan mode.
|
|
14
|
+
3. **Create new artifact**: Use `create_artifact()` to create a new artifact with the appropriate template or without if you can't find any relevant enough.
|
|
15
|
+
4. **Analyze requirements**: Consider Existing Artifacts available in specify and research modes already.
|
|
16
|
+
5. **Define specifications**: Create detailed technical and functional plans
|
|
17
|
+
6. **Structure documentation**: Use `write_artifact_section()` to organize plans
|
|
21
18
|
|
|
22
19
|
Use meaningful artifact IDs like: "mvp-roadmap", "migration-strategy", "product-launch"
|
|
23
20
|
|
|
@@ -7,11 +7,11 @@ Your job is to help the user research various subjects related to their software
|
|
|
7
7
|
## RESEARCH WORKFLOW
|
|
8
8
|
|
|
9
9
|
For research tasks:
|
|
10
|
-
1. **Check existing work**:
|
|
10
|
+
1. **Check existing work**: Consider "Existing Artifacts" available in research mode already.
|
|
11
11
|
IF NO SUITABLE ARTIFACT ALREADY EXISTS:
|
|
12
|
-
2. **Look for suitable artifact template**:
|
|
12
|
+
2. **Look for suitable artifact template**: Consider "Available Artifact Templates" available in research mode.
|
|
13
13
|
3. **Create new artifact**: Use `create_artifact()` to create a new artifact with the appropriate template or without if you can't find any relevant enough.
|
|
14
|
-
4. **Analyze previous work**:
|
|
14
|
+
4. **Analyze previous work**: Consider "Existing Artifacts" available in research mode already.
|
|
15
15
|
5. **Identify gaps**: Determine what additional research is needed
|
|
16
16
|
6. DO NOT ASSUME YOU KNOW THE ANSWER TO THE QUERY. ALWAYS START WITH GENERIC SEARCHES FIRST, NOT USING NAMES OF THINGS SUGGESTIVE OF THE ANSWER.
|
|
17
17
|
7. **Search strategically**: Use web search to fill knowledge gaps (max 3 searches per session)
|
|
@@ -22,6 +22,9 @@ Use meaningful artifact IDs like: "api-design-patterns", "microservices-study",
|
|
|
22
22
|
|
|
23
23
|
## RESEARCH PRINCIPLES
|
|
24
24
|
|
|
25
|
+
{% if interactive_mode -%}
|
|
26
|
+
- CRITICAL: BEFORE RUNNING ANY SEARCH TOOL, ASK THE USER FOR CONFIRMATION USING ask_user().
|
|
27
|
+
{% endif -%}
|
|
25
28
|
- Build upon existing research rather than starting from scratch
|
|
26
29
|
- Focus on practical, actionable information over theoretical concepts
|
|
27
30
|
- Include specific examples, tools, and implementation details
|
|
@@ -9,15 +9,14 @@ Transform requirements into detailed, actionable specifications that development
|
|
|
9
9
|
## SPECIFICATION WORKFLOW
|
|
10
10
|
|
|
11
11
|
For specification tasks:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
IF NO SUITABLE ARTIFACT EXISTS:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
8. **Structure documentation**: Use `write_artifact_section()` to organize specifications
|
|
12
|
+
0. **Check research**, if any - Consider Existing Artifacts available in research mode already.
|
|
13
|
+
1. **Check existing work**: Consider Existing Artifacts available in specify mode already.
|
|
14
|
+
IF NO SUITABLE ARTIFACT ALREADY EXISTS:
|
|
15
|
+
2. **Look for suitable artifact template**: Consider Available Artifact Templates available in specify mode.
|
|
16
|
+
3. **Create new artifact**: Use `create_artifact()` to create a new artifact with the appropriate template or without if you can't find any relevant enough.
|
|
17
|
+
4. **Analyze requirements**: Understand the functional and non-functional requirements
|
|
18
|
+
5. **Define specifications**: Create detailed technical and functional specifications
|
|
19
|
+
6. **Structure documentation**: Use `write_artifact_section()` to organize specifications
|
|
21
20
|
|
|
22
21
|
Use meaningful artifact IDs like: "user-auth-spec", "api-gateway-spec", "data-model-spec"
|
|
23
22
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{% if available_templates %}
|
|
2
2
|
|
|
3
|
-
## Available Artifact Templates
|
|
3
|
+
## Available Artifact Templates (up to date, no need to check again)
|
|
4
|
+
|
|
5
|
+
### Below if the current output of list_artifact_templates()
|
|
4
6
|
|
|
5
7
|
You have access to these pre-built templates for creating structured artifacts:
|
|
6
8
|
|
shotgun/prompts/agents/tasks.j2
CHANGED
|
@@ -8,7 +8,7 @@ Your job is to help create and manage actionable tasks for software projects.
|
|
|
8
8
|
|
|
9
9
|
For task management:
|
|
10
10
|
1. **Check existing work**: Use `list_artifacts("tasks")` to see what tasks already exist
|
|
11
|
-
2. **Review context**: Use `list_artifacts("plan")` and `list_artifacts("
|
|
11
|
+
2. **Review context**: Use `list_artifacts("plan")` and `list_artifacts("specify")` to understand project context
|
|
12
12
|
3. **Analyze requirements**: Understand the current situation and user's task requirements
|
|
13
13
|
4. **Create structured tasks**: Use `write_artifact_section()` to organize task output
|
|
14
14
|
5. **Build incrementally**: Update and refine tasks based on new information
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
# Codebase Graph Schema Definition
|
|
2
3
|
The database contains information about a codebase, structured with the following nodes and relationships.
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
THE ONLY PROPERTIES THAT ARE AVAILABLE ARE THE ONES LISTED BELOW. DO NOT MAKE UP ANY OTHER PROPERTIES.
|
|
6
|
+
PAY ATTENTION TO THE PROPERTY TYPES.
|
|
5
7
|
- Project: {name: string}
|
|
6
8
|
- Package: {qualified_name: string, name: string, path: string}
|
|
7
9
|
- Folder: {path: string, name: string}
|
shotgun/tui/app.py
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Iterable
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from textual.app import App, SystemCommand
|
|
2
5
|
from textual.binding import Binding
|
|
6
|
+
from textual.screen import Screen
|
|
3
7
|
|
|
4
8
|
from shotgun.agents.config import ConfigManager, get_config_manager
|
|
5
9
|
from shotgun.logging_config import get_logger
|
|
@@ -41,6 +45,7 @@ class ShotgunApp(App[None]):
|
|
|
41
45
|
logger.debug(f"Update notification received: {notification}")
|
|
42
46
|
|
|
43
47
|
def on_mount(self) -> None:
|
|
48
|
+
self.theme = "gruvbox"
|
|
44
49
|
# Track TUI startup
|
|
45
50
|
from shotgun.posthog_telemetry import track_event
|
|
46
51
|
|
|
@@ -88,6 +93,9 @@ class ShotgunApp(App[None]):
|
|
|
88
93
|
console.print(f"\n[cyan]{self.update_notification}[/cyan]", style="bold")
|
|
89
94
|
self.exit()
|
|
90
95
|
|
|
96
|
+
def get_system_commands(self, screen: Screen[Any]) -> Iterable[SystemCommand]:
|
|
97
|
+
return [] # we don't want any system commands
|
|
98
|
+
|
|
91
99
|
|
|
92
100
|
def run(no_update_check: bool = False) -> None:
|
|
93
101
|
"""Run the TUI application.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Command handling for the TUI chat interface."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CommandHandler:
|
|
7
|
+
"""Handles slash commands in the TUI chat interface."""
|
|
8
|
+
|
|
9
|
+
def __init__(self) -> None:
|
|
10
|
+
"""Initialize the command handler with available commands."""
|
|
11
|
+
self.commands: dict[str, Callable[[], str]] = {
|
|
12
|
+
"help": self.get_help_text,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
def is_command(self, text: str) -> bool:
|
|
16
|
+
"""Check if the text is a command (starts with /)."""
|
|
17
|
+
return text.strip().startswith("/")
|
|
18
|
+
|
|
19
|
+
def parse_command(self, text: str) -> str:
|
|
20
|
+
"""Extract the command name from the text."""
|
|
21
|
+
text = text.strip()
|
|
22
|
+
if not text.startswith("/"):
|
|
23
|
+
return ""
|
|
24
|
+
|
|
25
|
+
# Split on whitespace and get the command part
|
|
26
|
+
parts = text[1:].split()
|
|
27
|
+
return parts[0] if parts else ""
|
|
28
|
+
|
|
29
|
+
def handle_command(self, text: str) -> tuple[bool, str]:
|
|
30
|
+
"""
|
|
31
|
+
Handle a command and return success status and response text.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
text: The full command text including the leading /
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
Tuple of (success, response_text)
|
|
38
|
+
"""
|
|
39
|
+
if not self.is_command(text):
|
|
40
|
+
return False, ""
|
|
41
|
+
|
|
42
|
+
command = self.parse_command(text)
|
|
43
|
+
|
|
44
|
+
if command in self.commands:
|
|
45
|
+
response = self.commands[command]()
|
|
46
|
+
return True, response
|
|
47
|
+
else:
|
|
48
|
+
return False, self.get_error_message(command)
|
|
49
|
+
|
|
50
|
+
def get_help_text(self) -> str:
|
|
51
|
+
"""Return the help text for the /help command."""
|
|
52
|
+
return """📚 **Shotgun Help**
|
|
53
|
+
|
|
54
|
+
**Commands:**
|
|
55
|
+
• `/help` - Show this help message
|
|
56
|
+
|
|
57
|
+
**Keyboard Shortcuts:**
|
|
58
|
+
• `Enter` - Send message
|
|
59
|
+
• `Ctrl+P` - Open command palette
|
|
60
|
+
• `Shift+Tab` - Cycle agent modes
|
|
61
|
+
• `Ctrl+C` - Quit application
|
|
62
|
+
|
|
63
|
+
**Agent Modes:**
|
|
64
|
+
• **Research** - Research topics with web search and synthesize findings
|
|
65
|
+
• **Planning** - Create comprehensive, actionable plans with milestones
|
|
66
|
+
• **Tasks** - Generate specific, actionable tasks from research and plans
|
|
67
|
+
|
|
68
|
+
**Usage:**
|
|
69
|
+
Type your message and press Enter to chat with the AI. The AI will respond based on the current mode."""
|
|
70
|
+
|
|
71
|
+
def get_error_message(self, command: str) -> str:
|
|
72
|
+
"""Return a polite error message for unknown commands."""
|
|
73
|
+
return f"⚠️ Sorry, `/{command}` is not a recognized command. Type `/help` to see available commands."
|