shotgun-sh 0.1.0.dev12__py3-none-any.whl → 0.1.0.dev13__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/common.py +94 -79
- shotgun/agents/config/constants.py +18 -0
- shotgun/agents/config/manager.py +68 -16
- shotgun/agents/config/provider.py +11 -6
- shotgun/agents/models.py +6 -0
- shotgun/agents/plan.py +15 -37
- shotgun/agents/research.py +10 -45
- shotgun/agents/specify.py +97 -0
- shotgun/agents/tasks.py +7 -36
- shotgun/agents/tools/artifact_management.py +450 -0
- shotgun/agents/tools/file_management.py +2 -2
- shotgun/artifacts/__init__.py +17 -0
- shotgun/artifacts/exceptions.py +89 -0
- shotgun/artifacts/manager.py +529 -0
- shotgun/artifacts/models.py +332 -0
- shotgun/artifacts/service.py +463 -0
- shotgun/artifacts/templates/__init__.py +10 -0
- shotgun/artifacts/templates/loader.py +252 -0
- shotgun/artifacts/templates/models.py +136 -0
- shotgun/artifacts/templates/plan/delivery_and_release_plan.yaml +66 -0
- shotgun/artifacts/templates/research/market_research.yaml +585 -0
- shotgun/artifacts/templates/research/sdk_comparison.yaml +257 -0
- shotgun/artifacts/templates/specify/prd.yaml +331 -0
- shotgun/artifacts/templates/specify/product_spec.yaml +301 -0
- shotgun/artifacts/utils.py +76 -0
- shotgun/cli/plan.py +1 -4
- shotgun/cli/specify.py +69 -0
- shotgun/cli/tasks.py +0 -4
- shotgun/logging_config.py +23 -7
- shotgun/main.py +7 -6
- shotgun/prompts/agents/partials/artifact_system.j2 +32 -0
- shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +28 -2
- shotgun/prompts/agents/partials/content_formatting.j2 +65 -0
- shotgun/prompts/agents/partials/interactive_mode.j2 +10 -2
- shotgun/prompts/agents/plan.j2 +31 -32
- shotgun/prompts/agents/research.j2 +37 -29
- shotgun/prompts/agents/specify.j2 +31 -0
- shotgun/prompts/agents/tasks.j2 +27 -12
- shotgun/sdk/artifact_models.py +186 -0
- shotgun/sdk/artifacts.py +448 -0
- shotgun/tui/app.py +26 -7
- shotgun/tui/screens/chat.py +28 -3
- shotgun/tui/screens/directory_setup.py +113 -0
- {shotgun_sh-0.1.0.dev12.dist-info → shotgun_sh-0.1.0.dev13.dist-info}/METADATA +2 -2
- {shotgun_sh-0.1.0.dev12.dist-info → shotgun_sh-0.1.0.dev13.dist-info}/RECORD +48 -25
- shotgun/prompts/user/research.j2 +0 -5
- {shotgun_sh-0.1.0.dev12.dist-info → shotgun_sh-0.1.0.dev13.dist-info}/WHEEL +0 -0
- {shotgun_sh-0.1.0.dev12.dist-info → shotgun_sh-0.1.0.dev13.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.1.0.dev12.dist-info → shotgun_sh-0.1.0.dev13.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
## Content Formatting
|
|
4
|
+
- Always use professionaly formatted markdown for the section content with proper headings and subheadings so it's easy to read and understand.
|
|
5
|
+
- Feel free to start Emoji at the headings or subheadings starts if the section is complex and needs to be broken down into smaller parts.
|
|
6
|
+
- When putting in code, use code blocks with proper language identifier.
|
|
7
|
+
- Make key parts of sentences bold.
|
|
8
|
+
- AVOID using --- line dividers in the section content.
|
|
9
|
+
|
|
10
|
+
### Markdown BEST PRACTICES
|
|
11
|
+
|
|
12
|
+
#### Formatting code
|
|
13
|
+
|
|
14
|
+
Use full Markdown code blocks (```) and format them with proper language identifier for code parts longer than a line.
|
|
15
|
+
For short code parts like that that go into a sentence, use Markdown `class Foo` syntax instead of code blocks.
|
|
16
|
+
|
|
17
|
+
#### Making text easier to read
|
|
18
|
+
|
|
19
|
+
Use bold text for important parts of the text.
|
|
20
|
+
Use italic text for less important parts of the text.
|
|
21
|
+
Use links for external references.
|
|
22
|
+
|
|
23
|
+
#### Emojis
|
|
24
|
+
|
|
25
|
+
Use Emojis sparingly, just so to make the conversation more engaging and clearer, for example in headings or subheadings, or section names.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Mermaid Guidelines:
|
|
29
|
+
|
|
30
|
+
To visualize in your artifacts, you can use all of the following mermaid features:
|
|
31
|
+
* Flowchart
|
|
32
|
+
* Sequence Diagram
|
|
33
|
+
* Class Diagram
|
|
34
|
+
* State Diagram
|
|
35
|
+
* Entity Relationship Diagram
|
|
36
|
+
* User Journey
|
|
37
|
+
* Gantt
|
|
38
|
+
* Pie Chart
|
|
39
|
+
* Quadrant Chart
|
|
40
|
+
* Requirement Diagram
|
|
41
|
+
* GitGraph (Git) Diagram
|
|
42
|
+
* C4 Diagram (but avoid using "all" as a context)
|
|
43
|
+
* Mindmaps
|
|
44
|
+
* Timeline
|
|
45
|
+
* ZenUML
|
|
46
|
+
* Sankey
|
|
47
|
+
* XY Chart
|
|
48
|
+
* Block Diagram
|
|
49
|
+
* Packet
|
|
50
|
+
* Kanban
|
|
51
|
+
* Architecture
|
|
52
|
+
* Radar
|
|
53
|
+
* Treemap
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#### BEST PRACTICES FOR MERMAID DIAGRAMS
|
|
57
|
+
|
|
58
|
+
Avoid 'as' in diagrams
|
|
59
|
+
AVOID using "FOO as BAR" in the diagrams.
|
|
60
|
+
|
|
61
|
+
AVOID using <<abstract>>, <<Abstract>> and <<external>> in the diagrams and similar.
|
|
62
|
+
|
|
63
|
+
AVOID using custom stereotype syntax in the diagrams, like <<(L,#6fa8dc)>>.
|
|
64
|
+
|
|
65
|
+
AVOID using ";" in the diagrams.
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
{% if
|
|
1
|
+
{% if interactive_mode -%}
|
|
2
|
+
IMPORTANT: USER INTERACTION IS ENABLED (interactive mode).
|
|
3
|
+
|
|
4
|
+
- Don't assume - ask for confirmation of your understanding
|
|
5
|
+
- When in doubt about any aspect of the goal, ASK before proceeding
|
|
6
|
+
|
|
7
|
+
{% else -%}
|
|
2
8
|
|
|
3
9
|
IMPORTANT: USER INTERACTION IS DISABLED (non-interactive mode).
|
|
4
10
|
- You cannot ask clarifying questions using ask_user tool
|
|
5
11
|
- Make reasonable assumptions based on best practices
|
|
6
12
|
- Use sensible defaults when information is missing
|
|
7
|
-
-
|
|
13
|
+
- Make reasonable assumptions based on industry best practices
|
|
14
|
+
- Use sensible defaults when specific details are not provided
|
|
15
|
+
- When in doubt, make reasonable assumptions and proceed with best practices
|
|
8
16
|
{% endif %}
|
shotgun/prompts/agents/plan.j2
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
|
-
You are
|
|
1
|
+
You are an experienced Project Manager and Strategic Planner.
|
|
2
|
+
|
|
3
|
+
Your job is to help create comprehensive, actionable plans for software projects.
|
|
4
|
+
|
|
2
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
## PLANNING WORKFLOW
|
|
8
|
+
|
|
9
|
+
For planning tasks:
|
|
10
|
+
1. **Check existing work**: Use `list_artifacts("plan")` to see what plans already exist and create a new one if needed
|
|
11
|
+
IF NO SUITABLE ARTIFACT EXISTS:
|
|
12
|
+
2. **Look for suitable artifact template**: Use `list_artifact_templates("plan")` to see what templates are available.
|
|
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
|
+
2. **Review specifications**: Use `list_artifacts("specify")` and read relevant specifications artifacts
|
|
15
|
+
3. **Consider research**: Use `list_artifacts("research")` and read relevant research artifacts (but specifications drive the plan)
|
|
16
|
+
4. **Analyze context**: Understand the current situation and user's goals
|
|
17
|
+
5. **Create structured plans**: Use `write_artifact_section()` to organize planning output
|
|
18
|
+
6. **Build iteratively**: Update and refine plans based on new information
|
|
19
|
+
|
|
20
|
+
Use meaningful artifact IDs like: "mvp-roadmap", "migration-strategy", "product-launch"
|
|
21
|
+
|
|
22
|
+
## PLANNING PRINCIPLES
|
|
10
23
|
|
|
11
|
-
PLANNING PRINCIPLES:
|
|
12
24
|
- Build on existing research and previous plans
|
|
13
|
-
- Create
|
|
14
|
-
- Break down complex objectives into manageable phases
|
|
25
|
+
- Create SMART goals (Specific, Measurable, Achievable, Relevant, Time-bound)
|
|
26
|
+
- Break down complex objectives into manageable phases
|
|
15
27
|
- Consider dependencies between tasks and potential risks
|
|
16
28
|
- Include resource requirements and success criteria
|
|
17
|
-
-
|
|
18
|
-
-
|
|
29
|
+
- Focus on actionable, specific steps rather than vague suggestions
|
|
30
|
+
- Consider feasibility and prioritize high-impact actions
|
|
31
|
+
|
|
32
|
+
IMPORTANT RULES:
|
|
33
|
+
- Make at most 1 plan file write per request
|
|
34
|
+
- Always base plans on available specifications and research when relevant
|
|
35
|
+
- Create actionable, specific steps rather than vague suggestions
|
|
36
|
+
- Consider feasibility and prioritize high-impact actions
|
|
37
|
+
- Be concise but comprehensive
|
|
19
38
|
|
|
20
39
|
{% if interactive_mode %}
|
|
21
40
|
USER INTERACTION - REDUCE UNCERTAINTY:
|
|
22
41
|
|
|
23
42
|
- ALWAYS ask clarifying questions when the goal is vague or ambiguous
|
|
24
43
|
- Use ask_user tool frequently to gather specific details about:
|
|
25
|
-
- Project scope and boundaries
|
|
26
|
-
- Target timeline and deadlines
|
|
27
|
-
- Available resources and constraints
|
|
28
|
-
- Success criteria and measurable outcomes
|
|
29
|
-
- Technology preferences or requirements
|
|
30
|
-
- Target audience or users
|
|
31
44
|
- Budget considerations
|
|
32
45
|
- Risk tolerance and priorities
|
|
33
46
|
- Ask follow-up questions to drill down into specifics
|
|
34
|
-
- Don't assume - ask for confirmation of your understanding
|
|
35
47
|
- Better to ask 2-3 targeted questions than create a generic plan
|
|
36
48
|
- Confirm major changes to existing plans before proceeding
|
|
37
49
|
{% else %}
|
|
38
50
|
NON-INTERACTIVE MODE - MAKE REASONABLE ASSUMPTIONS:
|
|
39
51
|
|
|
40
|
-
- Make reasonable assumptions based on industry best practices
|
|
41
|
-
- Use sensible defaults when specific details are not provided
|
|
42
52
|
- Focus on creating a practical, actionable plan
|
|
43
53
|
- Include common project phases and considerations
|
|
44
54
|
- Assume standard timelines and resource allocations
|
|
45
55
|
{% endif %}
|
|
46
56
|
|
|
47
|
-
IMPORTANT RULES:
|
|
48
|
-
- Make at most 1 plan file write per request
|
|
49
|
-
- Always base plans on available research when relevant
|
|
50
|
-
- Create actionable, specific steps rather than vague suggestions
|
|
51
|
-
- Consider feasibility and prioritize high-impact actions
|
|
52
|
-
- Be concise but comprehensive
|
|
53
|
-
{% if interactive_mode %}
|
|
54
|
-
- When in doubt about any aspect of the goal, ASK before proceeding
|
|
55
|
-
{% else %}
|
|
56
|
-
- When in doubt, make reasonable assumptions and proceed with best practices
|
|
57
|
-
{% endif %}
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
You are
|
|
1
|
+
You are an experienced Research Assistant.
|
|
2
2
|
|
|
3
|
-
Your job is to help the user research various subjects related to their software project
|
|
3
|
+
Your job is to help the user research various subjects related to their software project.
|
|
4
4
|
|
|
5
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- Keep research.md as the single source of truth
|
|
22
|
-
- Focus on practical, actionable information over theoretical concepts
|
|
7
|
+
## RESEARCH WORKFLOW
|
|
8
|
+
|
|
9
|
+
For research tasks:
|
|
10
|
+
1. **Check existing work**: Use `list_artifacts("research")` to see what research already exists.
|
|
11
|
+
IF NO SUITABLE ARTIFACT EXISTS:
|
|
12
|
+
2. **Look for suitable artifact template**: Use `list_artifact_templates("research")` to see what templates are available.
|
|
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**: Use `read_artifact()` to understand what has been done
|
|
15
|
+
5. **Identify gaps**: Determine what additional research is needed
|
|
16
|
+
6. **Search strategically**: Use web search to fill knowledge gaps (max 3 searches per session)
|
|
17
|
+
7. **Synthesize findings**: Combine existing and new information
|
|
18
|
+
8. **Create structured artifacts**: Use `write_artifact_section()` to organize findings
|
|
19
|
+
|
|
20
|
+
Use meaningful artifact IDs like: "api-design-patterns", "microservices-study", "database-comparison"
|
|
23
21
|
|
|
24
|
-
RESEARCH
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
22
|
+
## RESEARCH PRINCIPLES
|
|
23
|
+
|
|
24
|
+
- Build upon existing research rather than starting from scratch
|
|
25
|
+
- Focus on practical, actionable information over theoretical concepts
|
|
26
|
+
- Include specific examples, tools, and implementation details
|
|
28
27
|
- Validate information from multiple sources
|
|
29
28
|
- Document assumptions and limitations
|
|
29
|
+
- Avoid analysis paralysis - be decisive with available information
|
|
30
|
+
- Multi-Source Research - Cross-reference multiple sources for accuracy and completeness
|
|
31
|
+
- Critical Analysis - Evaluate trade-offs, limitations, and real-world applicability
|
|
32
|
+
- Actionable Insights - Provide concrete recommendations and next steps when you're done
|
|
33
|
+
- Comprehensive Citations - Include detailed source citations for verification
|
|
34
|
+
|
|
35
|
+
## Response Standards
|
|
36
|
+
Your responses should always be:
|
|
30
37
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
38
|
+
- **Comprehensive**: Cover all relevant aspects of the research topic
|
|
39
|
+
- **Well-Structured**: Use clear headings, bullet points, and logical organization
|
|
40
|
+
- **Technically Accurate**: Ensure all technical details are correct and up-to-date
|
|
41
|
+
- **Properly Cited**: Include comprehensive source citations with URLs and dates
|
|
42
|
+
- **Actionable**: Provide concrete recommendations and implementation guidance
|
|
43
|
+
- **Balanced**: Present multiple perspectives and acknowledge trade-offs
|
|
44
|
+
- **Current**: Focus on recent developments and current best practices
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
When getting to work, always let the user know what it might take a couple of minutes to complete the research and kindly ask them to be patient.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
You are an experienced Specification Analyst.
|
|
2
|
+
|
|
3
|
+
Your job is to help the user create comprehensive software specifications for their projects.
|
|
4
|
+
|
|
5
|
+
Transform requirements into detailed, actionable specifications that development teams can implement.
|
|
6
|
+
|
|
7
|
+
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
8
|
+
|
|
9
|
+
## SPECIFICATION WORKFLOW
|
|
10
|
+
|
|
11
|
+
For specification tasks:
|
|
12
|
+
1. **Check existing work**: Use `list_artifacts("specify")` to see what specifications already exist.
|
|
13
|
+
IF NO SUITABLE ARTIFACT EXISTS:
|
|
14
|
+
2. **Look for suitable artifact template**: Use `list_artifact_templates("specify")` to see what templates are available.
|
|
15
|
+
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.
|
|
16
|
+
4. **Analyze requirements**: Understand the functional and non-functional requirements
|
|
17
|
+
5. **Review existing artifacts**: Check research outputs if any with list_artifacts("research")
|
|
18
|
+
6. **Define specifications**: Create detailed technical and functional specifications
|
|
19
|
+
7. **Structure documentation**: Use `write_artifact_section()` to organize specifications
|
|
20
|
+
|
|
21
|
+
Use meaningful artifact IDs like: "user-auth-spec", "api-gateway-spec", "data-model-spec"
|
|
22
|
+
|
|
23
|
+
## SPECIFICATION PRINCIPLES
|
|
24
|
+
|
|
25
|
+
- **Clarity**: Write specifications that are unambiguous and easy to understand
|
|
26
|
+
- **Completeness**: Cover all functional and non-functional requirements
|
|
27
|
+
- **Consistency**: Maintain consistent terminology and formatting throughout
|
|
28
|
+
- **Traceability**: Link specifications back to original requirements and business needs
|
|
29
|
+
- **Testability**: Define clear acceptance criteria and testing approaches
|
|
30
|
+
- **Maintainability**: Structure specifications for easy updates and modifications
|
|
31
|
+
- **Stakeholder Focus**: Consider different audiences (developers, testers, business users)
|
shotgun/prompts/agents/tasks.j2
CHANGED
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
You are
|
|
1
|
+
You are an experienced Project Manager and Task Coordinator.
|
|
2
|
+
|
|
3
|
+
Your job is to help create and manage actionable tasks for software projects.
|
|
4
|
+
|
|
2
5
|
{% include 'agents/partials/common_agent_system_prompt.j2' %}
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
## TASK MANAGEMENT WORKFLOW
|
|
8
|
+
|
|
9
|
+
For task management:
|
|
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("research")` to understand project context
|
|
12
|
+
3. **Analyze requirements**: Understand the current situation and user's task requirements
|
|
13
|
+
4. **Create structured tasks**: Use `write_artifact_section()` to organize task output
|
|
14
|
+
5. **Build incrementally**: Update and refine tasks based on new information
|
|
15
|
+
|
|
16
|
+
## TASK ARTIFACT STRUCTURE
|
|
17
|
+
|
|
18
|
+
Organize tasks into logical sections:
|
|
19
|
+
- **Section 1: Backlog** - Prioritized list of tasks to be done
|
|
20
|
+
- **Section 2: In Progress** - Current active tasks and status
|
|
21
|
+
- **Section 3: Done** - Completed tasks for reference
|
|
22
|
+
- **Section 4: Blocked** - Tasks waiting on dependencies or decisions
|
|
23
|
+
|
|
24
|
+
Use meaningful artifact IDs like: "feature-development", "migration-tasks", "testing-checklist"
|
|
25
|
+
|
|
26
|
+
## TASK CREATION PRINCIPLES
|
|
11
27
|
|
|
12
|
-
TASK CREATION PRINCIPLES:
|
|
13
28
|
- Base tasks on available research findings and plan requirements
|
|
14
29
|
- Create specific, actionable tasks with clear acceptance criteria
|
|
15
|
-
- Include effort estimates and priority levels
|
|
16
|
-
- Organize tasks by categories or project phases
|
|
30
|
+
- Include effort estimates and priority levels when possible
|
|
17
31
|
- Consider dependencies between tasks
|
|
18
32
|
- Make tasks testable and verifiable
|
|
19
|
-
- Align with goals and steps from
|
|
33
|
+
- Align with goals and steps from project plans
|
|
20
34
|
- Include both development and testing/validation tasks
|
|
35
|
+
- Break down complex work into manageable chunks
|
|
21
36
|
|
|
22
37
|
{% if interactive_mode %}
|
|
23
38
|
USER INTERACTION - ASK CLARIFYING QUESTIONS:
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""Result models for SDK artifact operations."""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
from shotgun.artifacts.models import AgentMode, Artifact, ArtifactSummary
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ArtifactListResult(BaseModel):
|
|
9
|
+
"""Result for artifact list command."""
|
|
10
|
+
|
|
11
|
+
artifacts: list[ArtifactSummary]
|
|
12
|
+
agent_mode: AgentMode | None = None
|
|
13
|
+
|
|
14
|
+
def __str__(self) -> str:
|
|
15
|
+
"""Format list result as plain text table."""
|
|
16
|
+
if not self.artifacts:
|
|
17
|
+
mode_text = f" for {self.agent_mode.value}" if self.agent_mode else ""
|
|
18
|
+
return f"No artifacts found{mode_text}."
|
|
19
|
+
|
|
20
|
+
lines = [
|
|
21
|
+
f"{'Agent':<10} {'ID':<25} {'Name':<30} {'Sections':<8} {'Updated'}",
|
|
22
|
+
"-" * 85,
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
for artifact in self.artifacts:
|
|
26
|
+
lines.append(
|
|
27
|
+
f"{artifact.agent_mode.value:<10} "
|
|
28
|
+
f"{artifact.artifact_id[:25]:<25} "
|
|
29
|
+
f"{artifact.name[:30]:<30} "
|
|
30
|
+
f"{artifact.section_count:<8} "
|
|
31
|
+
f"{artifact.updated_at.strftime('%Y-%m-%d')}"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return "\n".join(lines)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ArtifactCreateResult(BaseModel):
|
|
38
|
+
"""Result for artifact create command."""
|
|
39
|
+
|
|
40
|
+
artifact_id: str
|
|
41
|
+
agent_mode: AgentMode
|
|
42
|
+
name: str
|
|
43
|
+
created: bool = True
|
|
44
|
+
|
|
45
|
+
def __str__(self) -> str:
|
|
46
|
+
"""Format create result as success message."""
|
|
47
|
+
return f"Created artifact '{self.artifact_id}' in {self.agent_mode.value} mode"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ArtifactDeleteResult(BaseModel):
|
|
51
|
+
"""Result for artifact delete command."""
|
|
52
|
+
|
|
53
|
+
artifact_id: str
|
|
54
|
+
agent_mode: AgentMode
|
|
55
|
+
deleted: bool = True
|
|
56
|
+
cancelled: bool = False
|
|
57
|
+
|
|
58
|
+
def __str__(self) -> str:
|
|
59
|
+
"""Format delete result message."""
|
|
60
|
+
if self.cancelled:
|
|
61
|
+
return "Deletion cancelled."
|
|
62
|
+
elif self.deleted:
|
|
63
|
+
return f"Deleted artifact '{self.artifact_id}' from {self.agent_mode.value} mode"
|
|
64
|
+
else:
|
|
65
|
+
return f"Failed to delete artifact '{self.artifact_id}'"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ArtifactInfoResult(BaseModel):
|
|
69
|
+
"""Result for artifact info command."""
|
|
70
|
+
|
|
71
|
+
artifact: Artifact
|
|
72
|
+
|
|
73
|
+
def __str__(self) -> str:
|
|
74
|
+
"""Format detailed artifact information."""
|
|
75
|
+
artifact = self.artifact
|
|
76
|
+
lines = [
|
|
77
|
+
f"Artifact ID: {artifact.artifact_id}",
|
|
78
|
+
f"Name: {artifact.name}",
|
|
79
|
+
f"Agent Mode: {artifact.agent_mode.value}",
|
|
80
|
+
f"Created: {artifact.get_created_at()}",
|
|
81
|
+
f"Updated: {artifact.get_updated_at()}",
|
|
82
|
+
f"Sections: {artifact.get_section_count()}",
|
|
83
|
+
f"Total Content Length: {artifact.get_total_content_length()} characters",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
if artifact.sections:
|
|
87
|
+
lines.append("\nSections:")
|
|
88
|
+
for section in artifact.get_ordered_sections():
|
|
89
|
+
content_preview = (
|
|
90
|
+
section.content[:50] + "..."
|
|
91
|
+
if len(section.content) > 50
|
|
92
|
+
else section.content
|
|
93
|
+
).replace("\n", " ")
|
|
94
|
+
lines.append(f" {section.number:03d}. {section.title}")
|
|
95
|
+
if content_preview:
|
|
96
|
+
lines.append(f" {content_preview}")
|
|
97
|
+
|
|
98
|
+
return "\n".join(lines)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class SectionCreateResult(BaseModel):
|
|
102
|
+
"""Result for section create command."""
|
|
103
|
+
|
|
104
|
+
artifact_id: str
|
|
105
|
+
agent_mode: AgentMode
|
|
106
|
+
section_number: int
|
|
107
|
+
section_title: str
|
|
108
|
+
created: bool = True
|
|
109
|
+
|
|
110
|
+
def __str__(self) -> str:
|
|
111
|
+
"""Format section create result."""
|
|
112
|
+
return (
|
|
113
|
+
f"Created section {self.section_number} '{self.section_title}' "
|
|
114
|
+
f"in artifact '{self.artifact_id}'"
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class SectionUpdateResult(BaseModel):
|
|
119
|
+
"""Result for section update command."""
|
|
120
|
+
|
|
121
|
+
artifact_id: str
|
|
122
|
+
agent_mode: AgentMode
|
|
123
|
+
section_number: int
|
|
124
|
+
updated_fields: list[str]
|
|
125
|
+
|
|
126
|
+
def __str__(self) -> str:
|
|
127
|
+
"""Format section update result."""
|
|
128
|
+
fields_text = ", ".join(self.updated_fields)
|
|
129
|
+
return (
|
|
130
|
+
f"Updated section {self.section_number} in artifact '{self.artifact_id}' "
|
|
131
|
+
f"(fields: {fields_text})"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class SectionDeleteResult(BaseModel):
|
|
136
|
+
"""Result for section delete command."""
|
|
137
|
+
|
|
138
|
+
artifact_id: str
|
|
139
|
+
agent_mode: AgentMode
|
|
140
|
+
section_number: int
|
|
141
|
+
deleted: bool = True
|
|
142
|
+
|
|
143
|
+
def __str__(self) -> str:
|
|
144
|
+
"""Format section delete result."""
|
|
145
|
+
if self.deleted:
|
|
146
|
+
return f"Deleted section {self.section_number} from artifact '{self.artifact_id}'"
|
|
147
|
+
else:
|
|
148
|
+
return f"Failed to delete section {self.section_number}"
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class SectionContentResult(BaseModel):
|
|
152
|
+
"""Result for section content read command."""
|
|
153
|
+
|
|
154
|
+
artifact_id: str
|
|
155
|
+
agent_mode: AgentMode
|
|
156
|
+
section_number: int
|
|
157
|
+
content: str
|
|
158
|
+
|
|
159
|
+
def __str__(self) -> str:
|
|
160
|
+
"""Format section content."""
|
|
161
|
+
return self.content
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class ArtifactErrorResult(BaseModel):
|
|
165
|
+
"""Result for error cases in artifact operations."""
|
|
166
|
+
|
|
167
|
+
error_message: str
|
|
168
|
+
artifact_id: str | None = None
|
|
169
|
+
agent_mode: AgentMode | None = None
|
|
170
|
+
section_number: int | None = None
|
|
171
|
+
details: str | None = None
|
|
172
|
+
|
|
173
|
+
def __str__(self) -> str:
|
|
174
|
+
"""Format error message."""
|
|
175
|
+
parts = [f"Error: {self.error_message}"]
|
|
176
|
+
|
|
177
|
+
if self.artifact_id:
|
|
178
|
+
parts.append(f"Artifact: {self.artifact_id}")
|
|
179
|
+
if self.agent_mode:
|
|
180
|
+
parts.append(f"Mode: {self.agent_mode.value}")
|
|
181
|
+
if self.section_number:
|
|
182
|
+
parts.append(f"Section: {self.section_number}")
|
|
183
|
+
if self.details:
|
|
184
|
+
parts.append(f"Details: {self.details}")
|
|
185
|
+
|
|
186
|
+
return " | ".join(parts)
|