zrb 1.21.29__py3-none-any.whl → 2.0.0a4__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 zrb might be problematic. Click here for more details.

Files changed (192) hide show
  1. zrb/__init__.py +118 -129
  2. zrb/builtin/__init__.py +54 -2
  3. zrb/builtin/llm/chat.py +147 -0
  4. zrb/callback/callback.py +8 -1
  5. zrb/cmd/cmd_result.py +2 -1
  6. zrb/config/config.py +491 -280
  7. zrb/config/helper.py +84 -0
  8. zrb/config/web_auth_config.py +50 -35
  9. zrb/context/any_shared_context.py +13 -2
  10. zrb/context/context.py +31 -3
  11. zrb/context/print_fn.py +13 -0
  12. zrb/context/shared_context.py +14 -1
  13. zrb/input/option_input.py +30 -2
  14. zrb/llm/agent/__init__.py +9 -0
  15. zrb/llm/agent/agent.py +215 -0
  16. zrb/llm/agent/summarizer.py +20 -0
  17. zrb/llm/app/__init__.py +10 -0
  18. zrb/llm/app/completion.py +281 -0
  19. zrb/llm/app/confirmation/allow_tool.py +66 -0
  20. zrb/llm/app/confirmation/handler.py +178 -0
  21. zrb/llm/app/confirmation/replace_confirmation.py +77 -0
  22. zrb/llm/app/keybinding.py +34 -0
  23. zrb/llm/app/layout.py +117 -0
  24. zrb/llm/app/lexer.py +155 -0
  25. zrb/llm/app/redirection.py +28 -0
  26. zrb/llm/app/style.py +16 -0
  27. zrb/llm/app/ui.py +733 -0
  28. zrb/llm/config/__init__.py +4 -0
  29. zrb/llm/config/config.py +122 -0
  30. zrb/llm/config/limiter.py +247 -0
  31. zrb/llm/history_manager/__init__.py +4 -0
  32. zrb/llm/history_manager/any_history_manager.py +23 -0
  33. zrb/llm/history_manager/file_history_manager.py +91 -0
  34. zrb/llm/history_processor/summarizer.py +108 -0
  35. zrb/llm/note/__init__.py +3 -0
  36. zrb/llm/note/manager.py +122 -0
  37. zrb/llm/prompt/__init__.py +29 -0
  38. zrb/llm/prompt/claude_compatibility.py +92 -0
  39. zrb/llm/prompt/compose.py +55 -0
  40. zrb/llm/prompt/default.py +51 -0
  41. zrb/llm/prompt/markdown/mandate.md +23 -0
  42. zrb/llm/prompt/markdown/persona.md +3 -0
  43. zrb/llm/prompt/markdown/summarizer.md +21 -0
  44. zrb/llm/prompt/note.py +41 -0
  45. zrb/llm/prompt/system_context.py +46 -0
  46. zrb/llm/prompt/zrb.py +41 -0
  47. zrb/llm/skill/__init__.py +3 -0
  48. zrb/llm/skill/manager.py +86 -0
  49. zrb/llm/task/__init__.py +4 -0
  50. zrb/llm/task/llm_chat_task.py +316 -0
  51. zrb/llm/task/llm_task.py +245 -0
  52. zrb/llm/tool/__init__.py +39 -0
  53. zrb/llm/tool/bash.py +75 -0
  54. zrb/llm/tool/code.py +266 -0
  55. zrb/llm/tool/file.py +419 -0
  56. zrb/llm/tool/note.py +70 -0
  57. zrb/{builtin/llm → llm}/tool/rag.py +8 -5
  58. zrb/llm/tool/search/brave.py +53 -0
  59. zrb/llm/tool/search/searxng.py +47 -0
  60. zrb/llm/tool/search/serpapi.py +47 -0
  61. zrb/llm/tool/skill.py +19 -0
  62. zrb/llm/tool/sub_agent.py +70 -0
  63. zrb/llm/tool/web.py +97 -0
  64. zrb/llm/tool/zrb_task.py +66 -0
  65. zrb/llm/util/attachment.py +101 -0
  66. zrb/llm/util/prompt.py +104 -0
  67. zrb/llm/util/stream_response.py +178 -0
  68. zrb/session/any_session.py +0 -3
  69. zrb/session/session.py +1 -1
  70. zrb/task/base/context.py +25 -13
  71. zrb/task/base/execution.py +52 -47
  72. zrb/task/base/lifecycle.py +7 -4
  73. zrb/task/base_task.py +48 -49
  74. zrb/task/base_trigger.py +4 -1
  75. zrb/task/cmd_task.py +6 -0
  76. zrb/task/http_check.py +11 -5
  77. zrb/task/make_task.py +3 -0
  78. zrb/task/rsync_task.py +5 -0
  79. zrb/task/scaffolder.py +7 -4
  80. zrb/task/scheduler.py +3 -0
  81. zrb/task/tcp_check.py +6 -4
  82. zrb/util/ascii_art/art/bee.txt +17 -0
  83. zrb/util/ascii_art/art/cat.txt +9 -0
  84. zrb/util/ascii_art/art/ghost.txt +16 -0
  85. zrb/util/ascii_art/art/panda.txt +17 -0
  86. zrb/util/ascii_art/art/rose.txt +14 -0
  87. zrb/util/ascii_art/art/unicorn.txt +15 -0
  88. zrb/util/ascii_art/banner.py +92 -0
  89. zrb/util/cli/markdown.py +22 -2
  90. zrb/util/cmd/command.py +33 -10
  91. zrb/util/file.py +51 -32
  92. zrb/util/match.py +78 -0
  93. zrb/util/run.py +3 -3
  94. {zrb-1.21.29.dist-info → zrb-2.0.0a4.dist-info}/METADATA +9 -15
  95. {zrb-1.21.29.dist-info → zrb-2.0.0a4.dist-info}/RECORD +100 -128
  96. zrb/attr/__init__.py +0 -0
  97. zrb/builtin/llm/attachment.py +0 -40
  98. zrb/builtin/llm/chat_completion.py +0 -274
  99. zrb/builtin/llm/chat_session.py +0 -270
  100. zrb/builtin/llm/chat_session_cmd.py +0 -288
  101. zrb/builtin/llm/chat_trigger.py +0 -79
  102. zrb/builtin/llm/history.py +0 -71
  103. zrb/builtin/llm/input.py +0 -27
  104. zrb/builtin/llm/llm_ask.py +0 -269
  105. zrb/builtin/llm/previous-session.js +0 -21
  106. zrb/builtin/llm/tool/__init__.py +0 -0
  107. zrb/builtin/llm/tool/api.py +0 -75
  108. zrb/builtin/llm/tool/cli.py +0 -52
  109. zrb/builtin/llm/tool/code.py +0 -236
  110. zrb/builtin/llm/tool/file.py +0 -560
  111. zrb/builtin/llm/tool/note.py +0 -84
  112. zrb/builtin/llm/tool/sub_agent.py +0 -150
  113. zrb/builtin/llm/tool/web.py +0 -171
  114. zrb/builtin/project/__init__.py +0 -0
  115. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/__init__.py +0 -0
  116. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/service/__init__.py +0 -0
  117. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/__init__.py +0 -0
  118. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/__init__.py +0 -0
  119. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/__init__.py +0 -0
  120. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/__init__.py +0 -0
  121. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/__init__.py +0 -0
  122. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/__init__.py +0 -0
  123. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/__init__.py +0 -0
  124. zrb/builtin/project/create/__init__.py +0 -0
  125. zrb/builtin/shell/__init__.py +0 -0
  126. zrb/builtin/shell/autocomplete/__init__.py +0 -0
  127. zrb/callback/__init__.py +0 -0
  128. zrb/cmd/__init__.py +0 -0
  129. zrb/config/default_prompt/interactive_system_prompt.md +0 -29
  130. zrb/config/default_prompt/persona.md +0 -1
  131. zrb/config/default_prompt/summarization_prompt.md +0 -57
  132. zrb/config/default_prompt/system_prompt.md +0 -38
  133. zrb/config/llm_config.py +0 -339
  134. zrb/config/llm_context/config.py +0 -166
  135. zrb/config/llm_context/config_parser.py +0 -40
  136. zrb/config/llm_context/workflow.py +0 -81
  137. zrb/config/llm_rate_limitter.py +0 -190
  138. zrb/content_transformer/__init__.py +0 -0
  139. zrb/context/__init__.py +0 -0
  140. zrb/dot_dict/__init__.py +0 -0
  141. zrb/env/__init__.py +0 -0
  142. zrb/group/__init__.py +0 -0
  143. zrb/input/__init__.py +0 -0
  144. zrb/runner/__init__.py +0 -0
  145. zrb/runner/web_route/__init__.py +0 -0
  146. zrb/runner/web_route/home_page/__init__.py +0 -0
  147. zrb/session/__init__.py +0 -0
  148. zrb/session_state_log/__init__.py +0 -0
  149. zrb/session_state_logger/__init__.py +0 -0
  150. zrb/task/__init__.py +0 -0
  151. zrb/task/base/__init__.py +0 -0
  152. zrb/task/llm/__init__.py +0 -0
  153. zrb/task/llm/agent.py +0 -204
  154. zrb/task/llm/agent_runner.py +0 -152
  155. zrb/task/llm/config.py +0 -122
  156. zrb/task/llm/conversation_history.py +0 -209
  157. zrb/task/llm/conversation_history_model.py +0 -67
  158. zrb/task/llm/default_workflow/coding/workflow.md +0 -41
  159. zrb/task/llm/default_workflow/copywriting/workflow.md +0 -68
  160. zrb/task/llm/default_workflow/git/workflow.md +0 -118
  161. zrb/task/llm/default_workflow/golang/workflow.md +0 -128
  162. zrb/task/llm/default_workflow/html-css/workflow.md +0 -135
  163. zrb/task/llm/default_workflow/java/workflow.md +0 -146
  164. zrb/task/llm/default_workflow/javascript/workflow.md +0 -158
  165. zrb/task/llm/default_workflow/python/workflow.md +0 -160
  166. zrb/task/llm/default_workflow/researching/workflow.md +0 -153
  167. zrb/task/llm/default_workflow/rust/workflow.md +0 -162
  168. zrb/task/llm/default_workflow/shell/workflow.md +0 -299
  169. zrb/task/llm/error.py +0 -95
  170. zrb/task/llm/file_replacement.py +0 -206
  171. zrb/task/llm/file_tool_model.py +0 -57
  172. zrb/task/llm/history_processor.py +0 -206
  173. zrb/task/llm/history_summarization.py +0 -25
  174. zrb/task/llm/print_node.py +0 -221
  175. zrb/task/llm/prompt.py +0 -321
  176. zrb/task/llm/subagent_conversation_history.py +0 -41
  177. zrb/task/llm/tool_wrapper.py +0 -361
  178. zrb/task/llm/typing.py +0 -3
  179. zrb/task/llm/workflow.py +0 -76
  180. zrb/task/llm_task.py +0 -379
  181. zrb/task_status/__init__.py +0 -0
  182. zrb/util/__init__.py +0 -0
  183. zrb/util/cli/__init__.py +0 -0
  184. zrb/util/cmd/__init__.py +0 -0
  185. zrb/util/codemod/__init__.py +0 -0
  186. zrb/util/string/__init__.py +0 -0
  187. zrb/xcom/__init__.py +0 -0
  188. /zrb/{config/default_prompt/file_extractor_system_prompt.md → llm/prompt/markdown/file_extractor.md} +0 -0
  189. /zrb/{config/default_prompt/repo_extractor_system_prompt.md → llm/prompt/markdown/repo_extractor.md} +0 -0
  190. /zrb/{config/default_prompt/repo_summarizer_system_prompt.md → llm/prompt/markdown/repo_summarizer.md} +0 -0
  191. {zrb-1.21.29.dist-info → zrb-2.0.0a4.dist-info}/WHEEL +0 -0
  192. {zrb-1.21.29.dist-info → zrb-2.0.0a4.dist-info}/entry_points.txt +0 -0
@@ -1,160 +0,0 @@
1
- ---
2
- description: "A workflow for developing with Python, including project analysis and best practices."
3
- ---
4
- Follow this workflow to deliver clean, maintainable Python code that follows PEP standards and project conventions.
5
-
6
- # Core Mandates
7
-
8
- - **PEP 8 Compliance:** Follow Python style guide unless project specifies otherwise
9
- - **Type Safety:** Use type hints when project supports them
10
- - **Virtual Environments:** Always work within appropriate Python environments
11
- - **Testing Excellence:** Write comprehensive tests for all functionality
12
-
13
- # Tool Usage Guideline
14
- - Use `read_from_file` to analyze pyproject.toml, requirements.txt, and source code
15
- - Use `search_files` to find Python patterns and conventions
16
- - Use `run_shell_command` for Python toolchain operations
17
- - Use `list_files` to understand project structure
18
-
19
- # Step 1: Project Analysis
20
-
21
- 1. **Dependency Management:** Examine `pyproject.toml`, `requirements.txt`, `setup.py`
22
- 2. **Virtual Environment:** Check for `.venv`, `venv`, or other environment indicators
23
- 3. **Python Version:** Look for `.python-version` or configuration in `pyproject.toml`
24
- 4. **Linting Configuration:** Check for `ruff.toml`, `.flake8`, `.pylintrc`
25
- 5. **Type Checking:** Look for `mypy.ini`, `pyrightconfig.json`
26
- 6. **Testing Framework:** Analyze `tests/` directory, `pytest.ini`, `tox.ini`
27
-
28
- # Step 2: Environment Setup
29
-
30
- 1. **Activate Virtual Environment:**
31
- ```bash
32
- source .venv/bin/activate # Linux/Mac
33
- .venv\Scripts\activate # Windows
34
- ```
35
- 2. **Create Environment if Missing:**
36
- ```bash
37
- python -m venv .venv
38
- source .venv/bin/activate
39
- pip install -e . # Install project in development mode
40
- ```
41
- 3. **Install Dependencies:** Use appropriate package manager (pip, poetry, pdm)
42
-
43
- # Step 3: Understand Conventions
44
-
45
- 1. **Code Style:** Adhere to project's configured linter (ruff, flake8, pylint)
46
- 2. **Type Hints:** Use type hints if project supports them, following existing patterns
47
- 3. **Import Organization:** Follow project's import sorting (isort, ruff)
48
- 4. **Docstring Format:** Match existing format (Google, NumPy, reStructuredText)
49
- 5. **Testing Patterns:** Follow established pytest or unittest patterns
50
-
51
- # Step 4: Implementation Planning
52
-
53
- 1. **Module Structure:** Plan where new code should be placed
54
- 2. **Class Design:** Design classes following Pythonic principles
55
- 3. **Function Design:** Create focused, single-responsibility functions
56
- 4. **Type Annotations:** Plan appropriate type hints for new code
57
- 5. **Testing Strategy:** Plan comprehensive unit and integration tests
58
-
59
- # Step 5: Write Code
60
-
61
- ## Code Quality Standards
62
- - **Formatting:** Use black, autopep8, or ruff format with project configuration
63
- - **Linting:** Address all linter warnings (ruff, flake8, pylint)
64
- - **Type Hints:** Add comprehensive type annotations
65
- - **Documentation:** Write clear docstrings following project format
66
- - **Naming:** Use snake_case for variables/functions, PascalCase for classes
67
-
68
- ## Pythonic Patterns
69
- - **List Comprehensions:** Use for simple transformations
70
- - **Context Managers:** Use `with` statements for resource management
71
- - **Generators:** Use for large datasets or streaming data
72
- - **Decorators:** Use for cross-cutting concerns
73
- - **Data Classes:** Use for simple data containers (Python 3.7+)
74
-
75
- # Step 6: Testing and Verification
76
-
77
- 1. **Write Tests:** Create comprehensive tests using project's test framework
78
- 2. **Run Tests:** Execute `pytest` or `python -m unittest`
79
- 3. **Type Checking:** Run `mypy` or `pyright` if configured
80
- 4. **Linting:** Run `ruff check` or project's linter
81
- 5. **Formatting:** Run `black` or project's formatter
82
-
83
- # Step 7: Quality Assurance
84
-
85
- ## Testing Standards
86
- - **Test Organization:** Follow project's test structure and naming
87
- - **Fixtures:** Use pytest fixtures for test setup
88
- - **Mocking:** Use unittest.mock or pytest-mock appropriately
89
- - **Coverage:** Aim for high test coverage of business logic
90
- - **Parametrized Tests:** Use for testing multiple input scenarios
91
-
92
- ## Code Review Checklist
93
- - [ ] Code follows PEP 8 and project formatting standards
94
- - [ ] All tests pass with good coverage
95
- - [ ] Type checking passes (if configured)
96
- - [ ] No linter warnings
97
- - [ ] Docstrings are complete and follow project format
98
- - [ ] Error handling is appropriate
99
- - [ ] Performance considerations addressed
100
-
101
- # Step 8: Package Management
102
-
103
- ## Dependency Management
104
- - **pip:** Add to `requirements.txt` and run `pip install -r requirements.txt`
105
- - **poetry:** Use `poetry add <package>` and `poetry install`
106
- - **pdm:** Use `pdm add <package>` and `pdm install`
107
-
108
- ## Common Commands
109
- - `python -m pytest`: Run tests with pytest
110
- - `python -m mypy .`: Run type checking with mypy
111
- - `python -m black .`: Format code with black
112
- - `python -m ruff check .`: Lint code with ruff
113
- - `python -m isort .`: Sort imports with isort
114
-
115
- # Step 9: Finalize and Deliver
116
-
117
- 1. **Verify Environment:** Ensure virtual environment is active and dependencies installed
118
- 2. **Run Full Test Suite:** Verify all existing tests still pass
119
- 3. **Static Analysis:** Address any remaining linting or type issues
120
- 4. **Documentation:** Update relevant documentation, docstrings, and README
121
- 5. **Packaging:** Verify package can be built and installed if applicable
122
-
123
- # Advanced Python Features
124
-
125
- ## Modern Python (3.8+)
126
- - **Walrus Operator:** Use `:=` for assignment in expressions
127
- - **Structural Pattern Matching:** Use `match`/`case` for complex conditionals
128
- - **Positional-only Parameters:** Use `/` in function definitions
129
- - **Dataclasses:** Use for simple data containers
130
-
131
- ## Performance Optimization
132
- - **Profiling:** Use cProfile for performance analysis
133
- - **Caching:** Use functools.lru_cache for expensive function calls
134
- - **Async/Await:** Use for I/O-bound operations
135
- - **C Extensions:** Consider for performance-critical code
136
-
137
- ## Security Considerations
138
- - **Input Validation:** Validate and sanitize all user inputs
139
- - **Dependency Security:** Use tools like safety or bandit
140
- - **Secret Management:** Never hardcode secrets in code
141
- - **SQL Injection:** Use parameterized queries
142
-
143
- # Risk Assessment Guidelines
144
-
145
- ## Low Risk (Proceed Directly)
146
- - Adding tests to existing test suites
147
- - Implementing utility functions following established patterns
148
- - Creating new modules in established patterns
149
-
150
- ## Moderate Risk (Explain and Confirm)
151
- - Modifying core business logic
152
- - Changing public API interfaces
153
- - Adding new dependencies
154
- - Modifying virtual environment or dependency configuration
155
-
156
- ## High Risk (Refuse and Explain)
157
- - Breaking backward compatibility
158
- - Modifying critical security components
159
- - Changes affecting multiple packages
160
- - Operations that could break the virtual environment
@@ -1,153 +0,0 @@
1
- ---
2
- description: "A workflow for finding, synthesizing, and analyzing information from various sources."
3
- ---
4
- Follow this workflow to deliver accurate, well-sourced, and synthesized research findings.
5
-
6
- # Core Mandates
7
-
8
- - **Unyielding Objectivity:** Report facts, identify biases, never inject opinions
9
- - **Source Hierarchy:** Prioritize authoritative sources over secondary ones
10
- - **Synthesis Excellence:** Connect information into coherent narratives
11
- - **Comprehensive Attribution:** Cite all significant claims and data points
12
-
13
- # Tool Usage Guideline
14
- - Use `search_internet` for web research and information gathering
15
- - Use `open_web_page` to read and analyze web content
16
- - Use `read_from_file` to analyze provided documents and materials
17
- - Use `write_to_file` to organize research findings and notes
18
-
19
- # Step 1: Deconstruct and Strategize
20
-
21
- 1. **Isolate Core Questions:** Break down the user's request into specific, answerable questions
22
- 2. **Develop Search Strategy:** Create precise keywords, phrases, and boolean operators
23
- 3. **Identify Source Types:** Determine what types of sources will be most valuable
24
- 4. **Plan Research Approach:** Outline the sequence of research activities
25
-
26
- # Step 2: Source Evaluation and Collection
27
-
28
- ## Source Hierarchy (The 3 Tiers)
29
-
30
- ### Tier 1 (Ground Truth)
31
- - Official documentation and specifications
32
- - Peer-reviewed academic papers
33
- - Direct source code and technical specifications
34
- - Primary legal/government documents
35
- - Statistical data from authoritative sources
36
-
37
- ### Tier 2 (Reputable Reporting)
38
- - Established news organizations
39
- - Respected industry publications
40
- - Books by credible authors and experts
41
- - Conference proceedings from reputable organizations
42
-
43
- ### Tier 3 (Qualified Sources)
44
- - Blog posts by known experts
45
- - Conference talks and presentations
46
- - Forum answers from high-reputation users
47
- - **Always qualify these sources** (e.g., "According to a senior engineer at Google...")
48
-
49
- ## Research Execution
50
- 1. **Iterative Searching:** Start with best queries, refine based on results
51
- 2. **Cross-Reference:** Verify information across multiple sources
52
- 3. **Source Vetting:** Quickly assess source credibility and potential biases
53
- 4. **Information Extraction:** Pull out relevant facts, figures, and arguments
54
-
55
- # Step 3: Information Synthesis
56
-
57
- 1. **Identify Patterns:** Look for consensus, debates, or evolving understanding
58
- 2. **Connect Dots:** Find relationships between different pieces of information
59
- 3. **Identify Gaps:** Note where information is missing or contradictory
60
- 4. **Structure Findings:** Organize information logically for presentation
61
-
62
- # Step 4: Analysis and Reporting
63
-
64
- ## Report Structure
65
- - **Bottom Line Up Front (BLUF):** Start with direct, concise answer to main question
66
- - **Supporting Evidence:** Present synthesized facts and data supporting the BLUF
67
- - **Methodology:** Explain research approach and sources used
68
- - **Nuance and Limitations:** Acknowledge conflicting information or data gaps
69
- - **Citations:** Provide clear attribution for all significant claims
70
-
71
- ## Quality Standards
72
- - **Accuracy:** Verify all facts and figures before inclusion
73
- - **Clarity:** Present complex information in accessible language
74
- - **Completeness:** Address all aspects of the original question
75
- - **Objectivity:** Present balanced view without personal bias
76
-
77
- # Step 5: Task-Specific Execution
78
-
79
- ## Comparative Analysis
80
- - **Structured Comparison:** Use tables or detailed bullet points
81
- - **Like-for-Like Basis:** Compare items on equivalent criteria
82
- - **Implication Analysis:** Explain what differences mean in practice
83
- - **Objective Assessment:** Avoid subjective preferences
84
-
85
- ## Technical Research
86
- - **Documentation Analysis:** Read and interpret technical specifications
87
- - **Code Examination:** Analyze source code when available
88
- - **Performance Data:** Include benchmarks and performance characteristics
89
- - **Compatibility Analysis:** Consider integration and compatibility factors
90
-
91
- ## Market/Industry Research
92
- - **Market Size:** Include relevant statistics and growth projections
93
- - **Competitive Landscape:** Analyze key players and their positions
94
- - **Trend Analysis:** Identify emerging patterns and future directions
95
- - **Regulatory Environment:** Consider legal and compliance factors
96
-
97
- # Step 6: Verification and Quality Control
98
-
99
- 1. **Fact Checking:** Verify all critical information across multiple sources
100
- 2. **Bias Assessment:** Identify and acknowledge potential biases in sources
101
- 3. **Logical Consistency:** Ensure conclusions follow logically from evidence
102
- 4. **Citation Verification:** Confirm all citations are accurate and accessible
103
-
104
- # Step 7: Final Presentation
105
-
106
- ## Formatting Standards
107
- - **Clear Headings:** Use descriptive section headings
108
- - **Bulleted Lists:** Present information in scannable format
109
- - **Citations:** Use consistent format (e.g., `[Source Name](URL)`)
110
- - **Visual Organization:** Use tables, charts, or diagrams when helpful
111
-
112
- ## Delivery Considerations
113
- - **Executive Summary:** Include high-level findings for quick understanding
114
- - **Detailed Analysis:** Provide comprehensive information for deep dives
115
- - **Actionable Insights:** Highlight implications and recommended actions
116
- - **Further Reading:** Suggest additional resources for interested readers
117
-
118
- # Risk Assessment Guidelines
119
-
120
- ## Low Risk (Proceed Directly)
121
- - Researching publicly available information
122
- - Synthesizing information from authoritative sources
123
- - Creating comparative analyses of established products
124
-
125
- ## Moderate Risk (Explain and Confirm)
126
- - Research involving proprietary or sensitive information
127
- - Analysis that could have legal or compliance implications
128
- - Research requiring access to paid or restricted sources
129
-
130
- ## High Risk (Refuse and Explain)
131
- - Research involving personal or private information
132
- - Analysis that could violate terms of service
133
- - Activities that could be considered hacking or unauthorized access
134
-
135
- # Best Practices
136
-
137
- ## Research Ethics
138
- - **Respect Copyright:** Properly attribute all sources
139
- - **Avoid Plagiarism:** Always cite and paraphrase appropriately
140
- - **Respect Privacy:** Never research personal or private information
141
- - **Maintain Integrity:** Report findings honestly, even if unexpected
142
-
143
- ## Efficiency Techniques
144
- - **Source Tracking:** Keep organized notes of sources and findings
145
- - **Template Usage:** Use consistent formats for similar research tasks
146
- - **Tool Proficiency:** Master research tools and techniques
147
- - **Time Management:** Allocate research time based on question complexity
148
-
149
- ## Continuous Improvement
150
- - **Learn from Results:** Analyze what research approaches work best
151
- - **Update Methods:** Stay current with new research tools and techniques
152
- - **Expand Knowledge:** Build expertise in relevant domains
153
- - **Share Insights:** Document successful research strategies
@@ -1,162 +0,0 @@
1
- ---
2
- description: "A workflow for developing with Rust, including project analysis and best practices."
3
- ---
4
- Follow this workflow to deliver safe, efficient, and idiomatic Rust code that respects project conventions.
5
-
6
- # Core Mandates
7
-
8
- - **Memory Safety:** Leverage Rust's ownership system for safe code
9
- - **Zero-Cost Abstractions:** Use Rust's features without runtime overhead
10
- - **Idiomatic Patterns:** Follow established Rust conventions and practices
11
- - **Tool Integration:** Use Cargo and Rust tooling effectively
12
-
13
- # Tool Usage Guideline
14
- - Use `read_from_file` to analyze Cargo.toml and source code
15
- - Use `search_files` to find Rust patterns and conventions
16
- - Use `run_shell_command` for Cargo operations
17
- - Use `list_files` to understand project structure
18
-
19
- # Step 1: Project Analysis
20
-
21
- 1. **Crate Information:** Examine `Cargo.toml` for dependencies, features, and workspace members
22
- 2. **Toolchain Version:** Check `rust-toolchain.toml` for Rust version and components
23
- 3. **Formatting Configuration:** Look for `rustfmt.toml` or `.rustfmt.toml`
24
- 4. **Linting Configuration:** Check `clippy.toml` or `[lints]` section in `Cargo.toml`
25
- 5. **Module Structure:** Analyze `src/lib.rs`, `src/main.rs`, and `src/bin/` directory
26
- 6. **Workspace Configuration:** Check for workspace members in `Cargo.toml`
27
-
28
- # Step 2: Understand Conventions
29
-
30
- 1. **Formatting:** `cargo fmt` is mandatory for all code
31
- 2. **Linting:** `cargo clippy` must pass with project configuration
32
- 3. **Safety:** Avoid `unsafe` blocks unless absolutely necessary and documented
33
- 4. **Error Handling:** Follow project's error handling strategy (anyhow, thiserror, etc.)
34
- 5. **Testing:** Use established test patterns and organization
35
-
36
- # Step 3: Implementation Planning
37
-
38
- 1. **Type Design:** Plan structs, enums, and traits based on project patterns
39
- 2. **Ownership Strategy:** Consider ownership, borrowing, and lifetime requirements
40
- 3. **Error Handling:** Plan appropriate error types and handling
41
- 4. **Concurrency:** Consider async/await or threading requirements
42
- 5. **Testing Strategy:** Plan comprehensive unit and integration tests
43
-
44
- # Step 4: Write Code
45
-
46
- ## Code Quality Standards
47
- - **Formatting:** All code must be `cargo fmt` compliant
48
- - **Linting:** Address all `cargo clippy` warnings
49
- - **Documentation:** Add rustdoc comments for public APIs
50
- - **Naming:** Follow Rust naming conventions (snake_case for variables/functions, PascalCase for types)
51
- - **Safety:** Write safe Rust without unnecessary `unsafe` blocks
52
-
53
- ## Rust Idioms
54
- - **Result and Option:** Use for error and optional value handling
55
- - **Ownership System:** Leverage borrowing and lifetimes correctly
56
- - **Iterators:** Prefer iterator methods over manual loops
57
- - **Pattern Matching:** Use `match` and `if let` for control flow
58
- - **Traits:** Use for polymorphism and code organization
59
-
60
- # Step 5: Testing and Verification
61
-
62
- 1. **Write Tests:** Create comprehensive tests using `#[cfg(test)]` modules
63
- 2. **Run Tests:** Execute `cargo test` to verify functionality
64
- 3. **Format Code:** Run `cargo fmt` to ensure proper formatting
65
- 4. **Lint Code:** Run `cargo clippy -- -D warnings` to catch issues
66
- 5. **Build Verification:** Run `cargo check` for fast compilation checking
67
-
68
- # Step 6: Quality Assurance
69
-
70
- ## Testing Standards
71
- - **Unit Tests:** Place in `#[cfg(test)]` modules within source files
72
- - **Integration Tests:** Create in `tests/` directory for crate-level testing
73
- - **Documentation Tests:** Include examples in rustdoc comments
74
- - **Property Testing:** Use proptest or quickcheck for comprehensive testing
75
-
76
- ## Code Review Checklist
77
- - [ ] Code follows project formatting standards
78
- - [ ] All tests pass with good coverage
79
- - [ ] No clippy warnings
80
- - [ ] Error handling is appropriate and idiomatic
81
- - [ ] Documentation is complete for public APIs
82
- - [ ] Performance considerations addressed
83
- - [ ] Memory safety verified
84
-
85
- # Step 7: Cargo Operations
86
-
87
- ## Development Commands
88
- - `cargo check`: Fast compilation checking
89
- - `cargo build`: Build the project
90
- - `cargo run`: Build and run the project
91
- - `cargo test`: Run all tests
92
- - `cargo fmt`: Format code
93
- - `cargo clippy`: Run linter
94
-
95
- ## Dependency Management
96
- - `cargo add <dependency>`: Add a new dependency
97
- - `cargo update`: Update dependencies
98
- - `cargo tree`: Show dependency tree
99
- - `cargo audit`: Check for security vulnerabilities
100
-
101
- # Step 8: Advanced Rust Features
102
-
103
- ## Async/Await
104
- - **Async Runtime:** Use tokio, async-std, or smol based on project
105
- - **Futures:** Understand and use futures appropriately
106
- - **Concurrency:** Use channels and synchronization primitives
107
-
108
- ## Macros
109
- - **Declarative Macros:** Use for code generation when appropriate
110
- - **Procedural Macros:** Use for advanced metaprogramming
111
- - **Attribute Macros:** Use for annotations and code transformation
112
-
113
- ## Unsafe Code (Use Sparingly)
114
- - **FFI:** For foreign function interface
115
- - **Memory Management:** For low-level memory operations
116
- - **Performance Optimization:** Only when measurements justify
117
- - **Documentation:** Must document safety invariants
118
-
119
- # Step 9: Finalize and Deliver
120
-
121
- 1. **Verify Dependencies:** Ensure dependency versions are appropriate
122
- 2. **Run Full Test Suite:** Verify all existing tests still pass
123
- 3. **Security Audit:** Run `cargo audit` for security vulnerabilities
124
- 4. **Performance Testing:** Benchmark critical code paths if applicable
125
- 5. **Documentation:** Generate and verify rustdoc documentation
126
-
127
- # Common Patterns
128
-
129
- ## Error Handling
130
- - **thiserror:** For defining custom error types
131
- - **anyhow:** For application-level error handling
132
- - **Result Propagation:** Use `?` operator appropriately
133
-
134
- ## Concurrency
135
- - **std::thread:** For CPU-bound parallelism
136
- - **tokio::spawn:** For async task spawning
137
- - **std::sync:** For synchronization primitives
138
- - **crossbeam:** For advanced concurrency patterns
139
-
140
- ## Performance
141
- - **Profiling:** Use perf, flamegraph, or cargo instruments
142
- - **Benchmarking:** Use criterion for reliable benchmarks
143
- - **Optimization:** Focus on measured bottlenecks
144
-
145
- # Risk Assessment Guidelines
146
-
147
- ## Low Risk (Proceed Directly)
148
- - Adding tests to existing test modules
149
- - Implementing utility functions following established patterns
150
- - Creating new modules in established patterns
151
-
152
- ## Moderate Risk (Explain and Confirm)
153
- - Modifying core data structures
154
- - Changing public trait implementations
155
- - Adding new dependencies
156
- - Using `unsafe` blocks
157
-
158
- ## High Risk (Refuse and Explain)
159
- - Breaking memory safety guarantees
160
- - Modifying critical system components
161
- - Changes affecting multiple crates in workspace
162
- - Operations that could introduce security vulnerabilities