zrb 1.15.3__py3-none-any.whl → 1.21.29__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.
- zrb/__init__.py +2 -6
- zrb/attr/type.py +10 -7
- zrb/builtin/__init__.py +2 -0
- zrb/builtin/git.py +12 -1
- zrb/builtin/group.py +31 -15
- zrb/builtin/llm/attachment.py +40 -0
- zrb/builtin/llm/chat_completion.py +274 -0
- zrb/builtin/llm/chat_session.py +126 -167
- zrb/builtin/llm/chat_session_cmd.py +288 -0
- zrb/builtin/llm/chat_trigger.py +79 -0
- zrb/builtin/llm/history.py +4 -4
- zrb/builtin/llm/llm_ask.py +217 -135
- zrb/builtin/llm/tool/api.py +74 -70
- zrb/builtin/llm/tool/cli.py +35 -21
- zrb/builtin/llm/tool/code.py +55 -73
- zrb/builtin/llm/tool/file.py +278 -344
- zrb/builtin/llm/tool/note.py +84 -0
- zrb/builtin/llm/tool/rag.py +27 -34
- zrb/builtin/llm/tool/sub_agent.py +54 -41
- zrb/builtin/llm/tool/web.py +74 -98
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
- zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
- zrb/builtin/searxng/config/settings.yml +5671 -0
- zrb/builtin/searxng/start.py +21 -0
- zrb/builtin/shell/autocomplete/bash.py +4 -3
- zrb/builtin/shell/autocomplete/zsh.py +4 -3
- zrb/config/config.py +202 -27
- zrb/config/default_prompt/file_extractor_system_prompt.md +109 -9
- zrb/config/default_prompt/interactive_system_prompt.md +24 -30
- zrb/config/default_prompt/persona.md +1 -1
- zrb/config/default_prompt/repo_extractor_system_prompt.md +31 -31
- zrb/config/default_prompt/repo_summarizer_system_prompt.md +27 -8
- zrb/config/default_prompt/summarization_prompt.md +57 -16
- zrb/config/default_prompt/system_prompt.md +36 -30
- zrb/config/llm_config.py +119 -23
- zrb/config/llm_context/config.py +127 -90
- zrb/config/llm_context/config_parser.py +1 -7
- zrb/config/llm_context/workflow.py +81 -0
- zrb/config/llm_rate_limitter.py +100 -47
- zrb/context/any_shared_context.py +7 -1
- zrb/context/context.py +8 -2
- zrb/context/shared_context.py +3 -7
- zrb/group/any_group.py +3 -3
- zrb/group/group.py +3 -3
- zrb/input/any_input.py +5 -1
- zrb/input/base_input.py +18 -6
- zrb/input/option_input.py +13 -1
- zrb/input/text_input.py +7 -24
- zrb/runner/cli.py +21 -20
- zrb/runner/common_util.py +24 -19
- zrb/runner/web_route/task_input_api_route.py +5 -5
- zrb/runner/web_util/user.py +7 -3
- zrb/session/any_session.py +12 -6
- zrb/session/session.py +39 -18
- zrb/task/any_task.py +24 -3
- zrb/task/base/context.py +17 -9
- zrb/task/base/execution.py +15 -8
- zrb/task/base/lifecycle.py +8 -4
- zrb/task/base/monitoring.py +12 -7
- zrb/task/base_task.py +69 -5
- zrb/task/base_trigger.py +12 -5
- zrb/task/llm/agent.py +128 -167
- zrb/task/llm/agent_runner.py +152 -0
- zrb/task/llm/config.py +39 -20
- zrb/task/llm/conversation_history.py +110 -29
- zrb/task/llm/conversation_history_model.py +4 -179
- zrb/task/llm/default_workflow/coding/workflow.md +41 -0
- zrb/task/llm/default_workflow/copywriting/workflow.md +68 -0
- zrb/task/llm/default_workflow/git/workflow.md +118 -0
- zrb/task/llm/default_workflow/golang/workflow.md +128 -0
- zrb/task/llm/default_workflow/html-css/workflow.md +135 -0
- zrb/task/llm/default_workflow/java/workflow.md +146 -0
- zrb/task/llm/default_workflow/javascript/workflow.md +158 -0
- zrb/task/llm/default_workflow/python/workflow.md +160 -0
- zrb/task/llm/default_workflow/researching/workflow.md +153 -0
- zrb/task/llm/default_workflow/rust/workflow.md +162 -0
- zrb/task/llm/default_workflow/shell/workflow.md +299 -0
- zrb/task/llm/file_replacement.py +206 -0
- zrb/task/llm/file_tool_model.py +57 -0
- zrb/task/llm/history_processor.py +206 -0
- zrb/task/llm/history_summarization.py +2 -193
- zrb/task/llm/print_node.py +184 -64
- zrb/task/llm/prompt.py +175 -179
- zrb/task/llm/subagent_conversation_history.py +41 -0
- zrb/task/llm/tool_wrapper.py +226 -85
- zrb/task/llm/workflow.py +76 -0
- zrb/task/llm_task.py +109 -71
- zrb/task/make_task.py +2 -3
- zrb/task/rsync_task.py +25 -10
- zrb/task/scheduler.py +4 -4
- zrb/util/attr.py +54 -39
- zrb/util/cli/markdown.py +12 -0
- zrb/util/cli/text.py +30 -0
- zrb/util/file.py +12 -3
- zrb/util/git.py +2 -2
- zrb/util/{llm/prompt.py → markdown.py} +2 -3
- zrb/util/string/conversion.py +1 -1
- zrb/util/truncate.py +23 -0
- zrb/util/yaml.py +204 -0
- zrb/xcom/xcom.py +10 -0
- {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/METADATA +38 -18
- {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/RECORD +105 -79
- {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/WHEEL +1 -1
- zrb/task/llm/default_workflow/coding.md +0 -24
- zrb/task/llm/default_workflow/copywriting.md +0 -17
- zrb/task/llm/default_workflow/researching.md +0 -18
- {zrb-1.15.3.dist-info → zrb-1.21.29.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "A comprehensive workflow for software engineering tasks, including writing, modifying, and debugging code, as well as creating new applications. ALWAYS activate this workflow whenever you need to deal with software engineering tasks."
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
This workflow provides a structured approach to software engineering tasks. Adhere to these guidelines to deliver high-quality, idiomatic code that respects the project's existing patterns and conventions.
|
|
6
|
+
|
|
7
|
+
# Workflow Loading Strategy
|
|
8
|
+
|
|
9
|
+
This is a general-purpose coding workflow. For tasks involving specific languages or tools, you **MUST** load the relevant specialized workflows.
|
|
10
|
+
|
|
11
|
+
- **If the task involves Python:** Load the `python` workflow.
|
|
12
|
+
- **If the task involves Git:** Load the `git` workflow.
|
|
13
|
+
- **If the task involves shell scripting:** Load the `shell` workflow.
|
|
14
|
+
- **If the task involves Go:** Load the `golang` workflow.
|
|
15
|
+
- **If the task involves Java:** Load the `java` workflow.
|
|
16
|
+
- **If the task involves Javascript/Typescript:** Load the `javascript` workflow.
|
|
17
|
+
- **If the task involves HTML/CSS:** Load the `html-css` workflow.
|
|
18
|
+
- **If the task involves Rust:** Load the `rust` workflow.
|
|
19
|
+
|
|
20
|
+
Always consider if a more specific workflow is available and appropriate for the task at hand.
|
|
21
|
+
|
|
22
|
+
# Core Mandates
|
|
23
|
+
|
|
24
|
+
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
|
|
25
|
+
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
|
|
26
|
+
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
|
|
27
|
+
- **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
|
|
28
|
+
- **Comments:** Add code comments sparingly. Focus on *why* something is done, especially for complex logic, rather than *what* is done. Only add high-value comments if necessary for clarity or if requested by the user. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
|
|
29
|
+
- **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
|
|
30
|
+
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
|
|
31
|
+
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
|
|
32
|
+
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
|
|
33
|
+
|
|
34
|
+
# Software Engineering Tasks
|
|
35
|
+
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
36
|
+
1. **Understand & Strategize:** Think about the user's request and the relevant codebase context. When the task involves **complex refactoring, codebase exploration or system-wide analysis**, your **first and primary tool** must be 'codebase_investigator'. Use it to build a comprehensive understanding of the code, its structure, and dependencies. For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), you should use 'search_file_content' or 'glob' directly.
|
|
37
|
+
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.
|
|
38
|
+
3. **Implement:** Use the available tools (e.g., 'replace_in_file', 'write_to_file' 'run_shell_command' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
|
|
39
|
+
4. **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
|
|
40
|
+
5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. If unsure about these commands, you can ask the user if they'd like you to run them and if so how to.
|
|
41
|
+
6. **Finalize:** After all verification passes, consider the task complete. Do not remove or revert any changes or created files (like tests). Await the user's next instruction.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "A workflow for creating, refining, and organizing textual content."
|
|
3
|
+
---
|
|
4
|
+
Follow this workflow to produce content that is not just correct, but compelling, clear, and perfectly suited to its purpose.
|
|
5
|
+
|
|
6
|
+
# Core Mandates
|
|
7
|
+
|
|
8
|
+
- **Audience-First:** Always understand who you're writing for and what they need to know
|
|
9
|
+
- **Purpose-Driven:** Every piece of content must serve a clear objective
|
|
10
|
+
- **Quality Standards:** Deliver polished, professional content that meets the highest standards
|
|
11
|
+
- **Iterative Refinement:** Content improves through multiple rounds of review and editing
|
|
12
|
+
|
|
13
|
+
# Tool Usage Guideline
|
|
14
|
+
- Use `read_from_file` to analyze existing content and style guides
|
|
15
|
+
- Use `write_to_file` for creating new content drafts
|
|
16
|
+
- Use `replace_in_file` for targeted edits and refinements
|
|
17
|
+
|
|
18
|
+
# Step 1: Understand Intent and Audience
|
|
19
|
+
|
|
20
|
+
1. **Define the Goal:** What is this text supposed to achieve? (e.g., persuade, inform, entertain, sell). If the user is vague, ask for clarification.
|
|
21
|
+
2. **Identify the Audience:** Who are you writing for? (e.g., experts, beginners, customers). This dictates your tone, vocabulary, and level of detail.
|
|
22
|
+
3. **Determine the Tone:** Choose a voice that serves the goal and resonates with the audience (e.g., formal, witty, technical, urgent).
|
|
23
|
+
4. **Analyze Existing Content:** Review any provided examples, style guides, or reference materials to understand established patterns.
|
|
24
|
+
|
|
25
|
+
# Step 2: Plan and Outline
|
|
26
|
+
|
|
27
|
+
1. **Create Logical Structure:** Develop an outline that flows naturally from introduction to conclusion
|
|
28
|
+
2. **Key Sections:** Identify main talking points and supporting arguments
|
|
29
|
+
3. **Call-to-Action:** Define what you want the reader to do or think after reading
|
|
30
|
+
4. **Get Approval:** Present the outline to the user for confirmation before proceeding
|
|
31
|
+
|
|
32
|
+
# Step 3: Draft with Purpose
|
|
33
|
+
|
|
34
|
+
1. **Hook the Reader:** Start with a strong opening that grabs attention
|
|
35
|
+
2. **Use Active Voice:** Make your writing direct and energetic
|
|
36
|
+
3. **Show, Don't Just Tell:** Use examples, stories, and data to illustrate your points
|
|
37
|
+
4. **Maintain Consistency:** Stick to the established tone and style throughout
|
|
38
|
+
|
|
39
|
+
# Step 4: Refine and Polish
|
|
40
|
+
|
|
41
|
+
1. **Read Aloud:** Catch awkward phrasing and grammatical errors
|
|
42
|
+
2. **Cut Mercilessly:** Remove anything that doesn't serve the goal
|
|
43
|
+
3. **Enhance Readability:** Use short paragraphs, headings, bullet points, and bold text
|
|
44
|
+
4. **Verify Accuracy:** Ensure all facts, figures, and claims are correct
|
|
45
|
+
|
|
46
|
+
# Step 5: Task-Specific Execution
|
|
47
|
+
|
|
48
|
+
## Summarization
|
|
49
|
+
- Distill the essence while preserving key information
|
|
50
|
+
- Be objective and ruthless in cutting fluff
|
|
51
|
+
- Maintain the original meaning and context
|
|
52
|
+
|
|
53
|
+
## Proofreading
|
|
54
|
+
- Correct grammar, spelling, and punctuation
|
|
55
|
+
- Improve sentence flow and clarity
|
|
56
|
+
- Preserve the original meaning and voice
|
|
57
|
+
|
|
58
|
+
## Refining/Editing
|
|
59
|
+
- Sharpen the author's message
|
|
60
|
+
- Strengthen arguments and improve clarity
|
|
61
|
+
- Ensure consistent tone while respecting the original voice
|
|
62
|
+
|
|
63
|
+
# Step 6: Finalize and Deliver
|
|
64
|
+
|
|
65
|
+
- Present the final content to the user
|
|
66
|
+
- Be prepared to make additional refinements based on feedback
|
|
67
|
+
- Ensure the content meets all stated objectives
|
|
68
|
+
- Confirm the content is ready for its intended use
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "A workflow for managing version control with git."
|
|
3
|
+
---
|
|
4
|
+
Follow this workflow for safe, consistent, and effective version control operations.
|
|
5
|
+
|
|
6
|
+
# Core Mandates
|
|
7
|
+
|
|
8
|
+
- **Safety First:** Never force operations that could lose data
|
|
9
|
+
- **Atomic Commits:** One logical change per commit
|
|
10
|
+
- **Descriptive Messages:** Explain the "why" in imperative mood
|
|
11
|
+
- **Clean History:** Maintain a readable and useful commit history
|
|
12
|
+
|
|
13
|
+
# Tool Usage Guideline
|
|
14
|
+
- Use `run_shell_command` for all git operations
|
|
15
|
+
- Use `read_from_file` to examine git configuration files
|
|
16
|
+
- Use `search_files` to find specific commit messages or patterns
|
|
17
|
+
|
|
18
|
+
# Step 1: Pre-Operation Safety Check
|
|
19
|
+
|
|
20
|
+
1. **Check Status:** Always run `git status` before operations
|
|
21
|
+
2. **Verify Working Directory:** Ensure the working directory is clean before destructive operations
|
|
22
|
+
3. **Review Changes:** Use `git diff` and `git diff --staged` to understand what will be committed
|
|
23
|
+
4. **Backup Important Changes:** Consider stashing or creating a backup branch for risky operations
|
|
24
|
+
|
|
25
|
+
# Step 2: Standard Development Workflow
|
|
26
|
+
|
|
27
|
+
1. **Create Feature Branch:** `git checkout -b <branch-name>`
|
|
28
|
+
2. **Make Changes:** Implement features or fixes
|
|
29
|
+
3. **Stage Changes:** Use `git add -p` for precision staging
|
|
30
|
+
4. **Commit with Description:** Write clear, descriptive commit messages
|
|
31
|
+
5. **Review and Amend:** Use `git log -1` to review, amend if needed
|
|
32
|
+
6. **Push to Remote:** `git push origin <branch-name>`
|
|
33
|
+
|
|
34
|
+
# Step 3: Commit Message Standards
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
feat: Add user authentication endpoint
|
|
38
|
+
|
|
39
|
+
Implement the /login endpoint using JWT for token-based auth.
|
|
40
|
+
This resolves issue #123 by providing a mechanism for users to
|
|
41
|
+
log in and receive an access token.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Type Prefix:** feat, fix, docs, style, refactor, test, chore
|
|
45
|
+
- **Imperative Mood:** "Add feature" not "Added feature"
|
|
46
|
+
- **50/72 Rule:** 50 character subject, 72 character body lines
|
|
47
|
+
|
|
48
|
+
# Step 4: Branch Management
|
|
49
|
+
|
|
50
|
+
## Safe Branch Operations
|
|
51
|
+
- **Create:** `git checkout -b <name>` or `git switch -c <name>`
|
|
52
|
+
- **Switch:** `git switch <name>`
|
|
53
|
+
- **Update:** `git rebase main` (use with care)
|
|
54
|
+
- **Merge:** `git merge --no-ff <branch>` for explicit merge commits
|
|
55
|
+
|
|
56
|
+
## Remote Branch Operations
|
|
57
|
+
- **Fetch Updates:** `git fetch origin`
|
|
58
|
+
- **Push:** `git push origin <branch>`
|
|
59
|
+
- **Delete Remote:** `git push origin --delete <branch>`
|
|
60
|
+
|
|
61
|
+
# Step 5: Advanced Operations (Use with Caution)
|
|
62
|
+
|
|
63
|
+
## Rebasing
|
|
64
|
+
- **Update Branch:** `git rebase main`
|
|
65
|
+
- **Interactive:** `git rebase -i <commit>` for history editing
|
|
66
|
+
- **Safety:** Never rebase shared/public branches
|
|
67
|
+
|
|
68
|
+
## Stashing
|
|
69
|
+
- **Save Changes:** `git stash push -m "message"`
|
|
70
|
+
- **List Stashes:** `git stash list`
|
|
71
|
+
- **Apply:** `git stash pop` or `git stash apply`
|
|
72
|
+
|
|
73
|
+
## Cherry-picking
|
|
74
|
+
- **Apply Specific Commit:** `git cherry-pick <commit-hash>`
|
|
75
|
+
- **Use Case:** Only when absolutely necessary to avoid duplicate commits
|
|
76
|
+
|
|
77
|
+
# Step 6: Verification and Cleanup
|
|
78
|
+
|
|
79
|
+
1. **Verify Operations:** Check `git status` and `git log` after operations
|
|
80
|
+
2. **Run Tests:** Ensure all tests pass after changes
|
|
81
|
+
3. **Clean Up:** Remove temporary branches and stashes when no longer needed
|
|
82
|
+
4. **Document:** Update documentation if workflow changes affect team processes
|
|
83
|
+
|
|
84
|
+
# Risk Assessment Guidelines
|
|
85
|
+
|
|
86
|
+
## Low Risk (Proceed Directly)
|
|
87
|
+
- `git status`, `git log`, `git diff`
|
|
88
|
+
- Creating new branches
|
|
89
|
+
- Stashing changes
|
|
90
|
+
|
|
91
|
+
## Moderate Risk (Explain and Confirm)
|
|
92
|
+
- `git rebase` operations
|
|
93
|
+
- `git push --force-with-lease`
|
|
94
|
+
- Deleting branches
|
|
95
|
+
|
|
96
|
+
## High Risk (Refuse and Explain)
|
|
97
|
+
- `git push --force` (use --force-with-lease instead)
|
|
98
|
+
- Operations that could lose commit history
|
|
99
|
+
- Modifying shared/public branches
|
|
100
|
+
|
|
101
|
+
# Common Commands Reference
|
|
102
|
+
|
|
103
|
+
## Status & History
|
|
104
|
+
- `git status`: Check working directory status
|
|
105
|
+
- `git diff`: See uncommitted changes to tracked files
|
|
106
|
+
- `git diff --staged`: See staged changes
|
|
107
|
+
- `git log --oneline --graph -10`: View recent commit history
|
|
108
|
+
- `git blame <file>`: See who changed what in a file
|
|
109
|
+
|
|
110
|
+
## Branch Operations
|
|
111
|
+
- `git branch -a`: List all branches (local and remote)
|
|
112
|
+
- `git branch -d <branch>`: Delete a local branch
|
|
113
|
+
- `git remote prune origin`: Clean up remote tracking branches
|
|
114
|
+
|
|
115
|
+
## Configuration
|
|
116
|
+
- `git config --list`: View current configuration
|
|
117
|
+
- `git config user.name "Your Name"`: Set user name
|
|
118
|
+
- `git config user.email "your.email@example.com"`: Set user email
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "A workflow for developing with Go, including project analysis and best practices."
|
|
3
|
+
---
|
|
4
|
+
Follow this workflow to deliver high-quality, idiomatic Go code that respects project conventions.
|
|
5
|
+
|
|
6
|
+
# Core Mandates
|
|
7
|
+
|
|
8
|
+
- **Simplicity First:** Write clear, simple, and readable code
|
|
9
|
+
- **Idiomatic Go:** Follow Go conventions and community standards
|
|
10
|
+
- **Tool Integration:** Leverage Go's excellent tooling ecosystem
|
|
11
|
+
- **Safety and Reliability:** Write robust, well-tested code
|
|
12
|
+
|
|
13
|
+
# Tool Usage Guideline
|
|
14
|
+
- Use `read_from_file` to analyze Go modules and configuration
|
|
15
|
+
- Use `search_files` to find Go patterns and conventions
|
|
16
|
+
- Use `run_shell_command` for Go toolchain operations
|
|
17
|
+
- Use `list_files` to understand project structure
|
|
18
|
+
|
|
19
|
+
# Step 1: Project Analysis
|
|
20
|
+
|
|
21
|
+
1. **Module Information:** Examine `go.mod` for module path and dependencies
|
|
22
|
+
2. **Workspace:** Check for `go.work` for multi-module workspace configuration
|
|
23
|
+
3. **Tooling:** Look for `Makefile` with build, test, and lint commands
|
|
24
|
+
4. **CI/CD Configuration:** Check `.github/workflows/go.yml` for verification commands
|
|
25
|
+
5. **Linting Config:** Examine `.golangci.yml` for linting rules
|
|
26
|
+
6. **Package Structure:** Analyze `pkg/`, `internal/`, and `cmd/` directories
|
|
27
|
+
|
|
28
|
+
# Step 2: Understand Conventions
|
|
29
|
+
|
|
30
|
+
1. **Formatting:** `go fmt` is mandatory for all code
|
|
31
|
+
2. **Linting:** Adhere to project's `golangci-lint` configuration
|
|
32
|
+
3. **Package Naming:** Use short, concise, all-lowercase package names
|
|
33
|
+
4. **Error Handling:** Match existing error handling patterns
|
|
34
|
+
5. **Testing:** Follow established test structure and patterns
|
|
35
|
+
|
|
36
|
+
# Step 3: Implementation Planning
|
|
37
|
+
|
|
38
|
+
1. **File Structure:** Plan where new code should be placed based on project conventions
|
|
39
|
+
2. **Dependencies:** Identify if new dependencies are needed and verify they're appropriate
|
|
40
|
+
3. **API Design:** Consider how new code integrates with existing APIs
|
|
41
|
+
4. **Testing Strategy:** Plan comprehensive tests for new functionality
|
|
42
|
+
|
|
43
|
+
# Step 4: Write Code
|
|
44
|
+
|
|
45
|
+
## Code Quality Standards
|
|
46
|
+
- **Formatting:** All code must be `go fmt` compliant
|
|
47
|
+
- **Linting:** Address all `golangci-lint` warnings
|
|
48
|
+
- **Naming:** Follow Go naming conventions (camelCase for variables, PascalCase for exports)
|
|
49
|
+
- **Documentation:** Add godoc comments for exported functions and types
|
|
50
|
+
|
|
51
|
+
## Implementation Patterns
|
|
52
|
+
- **Error Handling:** Use appropriate error wrapping based on project patterns
|
|
53
|
+
- **Concurrency:** Follow existing goroutine and channel usage patterns
|
|
54
|
+
- **Interfaces:** Define small, focused interfaces
|
|
55
|
+
- **Composition:** Prefer composition over inheritance
|
|
56
|
+
|
|
57
|
+
# Step 5: Testing and Verification
|
|
58
|
+
|
|
59
|
+
1. **Write Tests:** Create comprehensive tests for all new functionality
|
|
60
|
+
2. **Run Tests:** Execute `go test ./...` to verify functionality
|
|
61
|
+
3. **Format Code:** Run `go fmt ./...` to ensure proper formatting
|
|
62
|
+
4. **Lint Code:** Run `golangci-lint run` to catch issues
|
|
63
|
+
5. **Build Verification:** Run `go build ./...` to ensure code compiles
|
|
64
|
+
|
|
65
|
+
# Step 6: Quality Assurance
|
|
66
|
+
|
|
67
|
+
## Testing Standards
|
|
68
|
+
- **Table-Driven Tests:** Use for comprehensive test coverage
|
|
69
|
+
- **Test Files:** Place tests in `_test.go` files within the same package
|
|
70
|
+
- **Benchmarks:** Add benchmarks for performance-critical code
|
|
71
|
+
- **Examples:** Include example code in documentation
|
|
72
|
+
|
|
73
|
+
## Code Review Checklist
|
|
74
|
+
- [ ] Code follows project formatting standards
|
|
75
|
+
- [ ] All tests pass
|
|
76
|
+
- [ ] No linting warnings
|
|
77
|
+
- [ ] Error handling is appropriate
|
|
78
|
+
- [ ] Documentation is complete
|
|
79
|
+
- [ ] Performance considerations addressed
|
|
80
|
+
|
|
81
|
+
# Step 7: Finalize and Deliver
|
|
82
|
+
|
|
83
|
+
1. **Verify Dependencies:** Run `go mod tidy` to clean up dependencies
|
|
84
|
+
2. **Run Full Test Suite:** Ensure all existing tests still pass
|
|
85
|
+
3. **Document Changes:** Update relevant documentation
|
|
86
|
+
4. **Prepare for Review:** Ensure code is ready for team review
|
|
87
|
+
|
|
88
|
+
# Common Commands Reference
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
- `go fmt ./...`: Format all Go code
|
|
92
|
+
- `go vet ./...`: Report suspicious constructs
|
|
93
|
+
- `go build ./...`: Build all packages
|
|
94
|
+
- `go run ./cmd/my-app`: Run a specific application
|
|
95
|
+
|
|
96
|
+
## Testing
|
|
97
|
+
- `go test ./...`: Run all tests
|
|
98
|
+
- `go test -v ./...`: Run tests with verbose output
|
|
99
|
+
- `go test -race ./...`: Run tests with race detector
|
|
100
|
+
- `go test -bench=. ./...`: Run benchmarks
|
|
101
|
+
|
|
102
|
+
## Dependency Management
|
|
103
|
+
- `go mod tidy`: Add missing and remove unused modules
|
|
104
|
+
- `go mod download`: Download modules to local cache
|
|
105
|
+
- `go list -m all`: List all dependencies
|
|
106
|
+
- `go get package@version`: Add or update a dependency
|
|
107
|
+
|
|
108
|
+
## Debugging
|
|
109
|
+
- `dlv debug`: Debug with Delve
|
|
110
|
+
- `go tool pprof`: Performance profiling
|
|
111
|
+
- `go tool trace`: Execution tracing
|
|
112
|
+
|
|
113
|
+
# Risk Assessment Guidelines
|
|
114
|
+
|
|
115
|
+
## Low Risk (Proceed Directly)
|
|
116
|
+
- Reading configuration files
|
|
117
|
+
- Running tests and linters
|
|
118
|
+
- Adding tests to existing packages
|
|
119
|
+
|
|
120
|
+
## Moderate Risk (Explain and Confirm)
|
|
121
|
+
- Adding new dependencies
|
|
122
|
+
- Modifying core business logic
|
|
123
|
+
- Changing public API interfaces
|
|
124
|
+
|
|
125
|
+
## High Risk (Refuse and Explain)
|
|
126
|
+
- Modifying critical system paths
|
|
127
|
+
- Operations that could break the build
|
|
128
|
+
- Changes that affect multiple teams
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "A workflow for developing with HTML and CSS, including project analysis and best practices."
|
|
3
|
+
---
|
|
4
|
+
Follow this workflow to create accessible, responsive, and maintainable web interfaces.
|
|
5
|
+
|
|
6
|
+
# Core Mandates
|
|
7
|
+
|
|
8
|
+
- **Semantic HTML:** Use HTML elements for their intended purpose
|
|
9
|
+
- **Accessibility First:** Ensure content is accessible to all users
|
|
10
|
+
- **Responsive Design:** Create interfaces that work across all devices
|
|
11
|
+
- **Performance:** Optimize for fast loading and smooth interactions
|
|
12
|
+
|
|
13
|
+
# Tool Usage Guideline
|
|
14
|
+
- Use `read_from_file` to analyze HTML/CSS structure and patterns
|
|
15
|
+
- Use `search_files` to find specific styles or markup patterns
|
|
16
|
+
- Use `run_shell_command` for linting and formatting tools
|
|
17
|
+
- Use `list_files` to understand project structure
|
|
18
|
+
|
|
19
|
+
# Step 1: Project Analysis
|
|
20
|
+
|
|
21
|
+
1. **HTML Files:** Examine `*.html` for structure, doctype, and meta tags
|
|
22
|
+
2. **CSS Files:** Analyze `*.css` for architecture (BEM, SMACSS) and frameworks
|
|
23
|
+
3. **Preprocessors:** Check for Sass (`*.scss`), Less (`*.less`), or other preprocessors
|
|
24
|
+
4. **Frameworks:** Identify usage of Bootstrap, Tailwind CSS, or other CSS frameworks
|
|
25
|
+
5. **Configuration:** Look for `.stylelintrc`, `.prettierrc`, and other config files
|
|
26
|
+
6. **Build Tools:** Check for Webpack, Vite, or other build configurations
|
|
27
|
+
|
|
28
|
+
# Step 2: Understand Conventions
|
|
29
|
+
|
|
30
|
+
1. **HTML Standards:** Follow semantic HTML5 elements and attributes
|
|
31
|
+
2. **CSS Methodology:** Adhere to project's CSS architecture (BEM, SMACSS, etc.)
|
|
32
|
+
3. **Accessibility:** Implement WCAG guidelines and ARIA attributes
|
|
33
|
+
4. **Responsive Patterns:** Follow established breakpoints and grid systems
|
|
34
|
+
5. **Performance:** Optimize images, minimize CSS, and leverage browser caching
|
|
35
|
+
|
|
36
|
+
# Step 3: Implementation Planning
|
|
37
|
+
|
|
38
|
+
1. **Component Structure:** Plan HTML structure based on project patterns
|
|
39
|
+
2. **Styling Approach:** Determine CSS organization and naming conventions
|
|
40
|
+
3. **Responsive Strategy:** Plan breakpoints and adaptive layouts
|
|
41
|
+
4. **Accessibility:** Identify required ARIA attributes and keyboard navigation
|
|
42
|
+
5. **Browser Compatibility:** Consider cross-browser testing requirements
|
|
43
|
+
|
|
44
|
+
# Step 4: Write Markup and Styles
|
|
45
|
+
|
|
46
|
+
## HTML Best Practices
|
|
47
|
+
- **Semantic Structure:** Use appropriate elements (`<nav>`, `<main>`, `<article>`, etc.)
|
|
48
|
+
- **Accessibility:** Include `alt` attributes, proper headings, and ARIA labels
|
|
49
|
+
- **SEO Optimization:** Use proper meta tags and semantic markup
|
|
50
|
+
- **Performance:** Minimize DOM depth and avoid unnecessary elements
|
|
51
|
+
|
|
52
|
+
## CSS Best Practices
|
|
53
|
+
- **Methodology:** Follow established naming conventions (BEM, etc.)
|
|
54
|
+
- **Organization:** Use logical grouping and consistent ordering
|
|
55
|
+
- **Responsive Design:** Implement mobile-first media queries
|
|
56
|
+
- **Performance:** Minimize specificity and avoid expensive selectors
|
|
57
|
+
- **Maintainability:** Use variables and modular organization
|
|
58
|
+
|
|
59
|
+
# Step 5: Testing and Verification
|
|
60
|
+
|
|
61
|
+
1. **HTML Validation:** Validate markup using W3C validator
|
|
62
|
+
2. **Accessibility Testing:** Test with screen readers and accessibility tools
|
|
63
|
+
3. **Cross-Browser Testing:** Verify rendering across target browsers
|
|
64
|
+
4. **Responsive Testing:** Test on different screen sizes and devices
|
|
65
|
+
5. **Performance Testing:** Check load times and rendering performance
|
|
66
|
+
|
|
67
|
+
# Step 6: Quality Assurance
|
|
68
|
+
|
|
69
|
+
## Linting and Formatting
|
|
70
|
+
- **HTML Linting:** Use tools like HTMLHint or validator
|
|
71
|
+
- **CSS Linting:** Run `stylelint` with project configuration
|
|
72
|
+
- **Formatting:** Use Prettier or project-specific formatters
|
|
73
|
+
- **Code Quality:** Ensure consistent indentation and organization
|
|
74
|
+
|
|
75
|
+
## Browser Compatibility
|
|
76
|
+
- **Progressive Enhancement:** Ensure core functionality works everywhere
|
|
77
|
+
- **Feature Detection:** Use modern features with fallbacks
|
|
78
|
+
- **Vendor Prefixing:** Use Autoprefixer for cross-browser compatibility
|
|
79
|
+
|
|
80
|
+
# Step 7: Optimization
|
|
81
|
+
|
|
82
|
+
## Performance Optimization
|
|
83
|
+
- **CSS Minification:** Use tools like cssnano for production
|
|
84
|
+
- **Image Optimization:** Compress and use appropriate formats
|
|
85
|
+
- **Critical CSS:** Inline above-the-fold styles for faster rendering
|
|
86
|
+
- **Lazy Loading:** Defer non-critical resources
|
|
87
|
+
|
|
88
|
+
## Accessibility Optimization
|
|
89
|
+
- **Keyboard Navigation:** Ensure all interactive elements are keyboard accessible
|
|
90
|
+
- **Screen Reader Compatibility:** Test with NVDA, VoiceOver, or JAWS
|
|
91
|
+
- **Color Contrast:** Verify sufficient contrast ratios
|
|
92
|
+
- **Focus Management:** Implement proper focus indicators and order
|
|
93
|
+
|
|
94
|
+
# Step 8: Finalize and Deliver
|
|
95
|
+
|
|
96
|
+
1. **Final Validation:** Run comprehensive validation and testing
|
|
97
|
+
2. **Documentation:** Update style guides or component documentation
|
|
98
|
+
3. **Performance Review:** Verify optimization targets are met
|
|
99
|
+
4. **Accessibility Audit:** Complete final accessibility checks
|
|
100
|
+
|
|
101
|
+
# Common Commands Reference
|
|
102
|
+
|
|
103
|
+
## Development Tools
|
|
104
|
+
- `stylelint "**/*.css"`: Lint CSS files
|
|
105
|
+
- `prettier --check "**/*.html"`: Check HTML formatting
|
|
106
|
+
- `prettier --write "**/*.{html,css}"`: Format HTML and CSS files
|
|
107
|
+
- `npx htmlhint "**/*.html"`: Lint HTML files
|
|
108
|
+
|
|
109
|
+
## Build and Optimization
|
|
110
|
+
- `npm run build`: Build project (if using build tools)
|
|
111
|
+
- `npm run dev`: Start development server
|
|
112
|
+
- `npm run lint`: Run all linting
|
|
113
|
+
- `npm run format`: Format all code
|
|
114
|
+
|
|
115
|
+
## Testing
|
|
116
|
+
- `npm test`: Run tests (if test framework configured)
|
|
117
|
+
- Browser developer tools for manual testing
|
|
118
|
+
- Lighthouse for performance and accessibility audits
|
|
119
|
+
|
|
120
|
+
# Risk Assessment Guidelines
|
|
121
|
+
|
|
122
|
+
## Low Risk (Proceed Directly)
|
|
123
|
+
- Adding new CSS classes following established patterns
|
|
124
|
+
- Creating new HTML components with semantic markup
|
|
125
|
+
- Running linters and validators
|
|
126
|
+
|
|
127
|
+
## Moderate Risk (Explain and Confirm)
|
|
128
|
+
- Modifying core layout or grid systems
|
|
129
|
+
- Changing established CSS architecture
|
|
130
|
+
- Adding new dependencies or frameworks
|
|
131
|
+
|
|
132
|
+
## High Risk (Refuse and Explain)
|
|
133
|
+
- Breaking existing responsive layouts
|
|
134
|
+
- Removing accessibility features
|
|
135
|
+
- Changes that affect multiple pages or components
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "A workflow for developing with Java, including project analysis and best practices."
|
|
3
|
+
---
|
|
4
|
+
Follow this workflow to deliver robust, maintainable Java code that follows project conventions.
|
|
5
|
+
|
|
6
|
+
# Core Mandates
|
|
7
|
+
|
|
8
|
+
- **Object-Oriented Excellence:** Follow SOLID principles and design patterns
|
|
9
|
+
- **Type Safety:** Leverage Java's strong typing system
|
|
10
|
+
- **Tool Integration:** Use Maven/Gradle and IDE tools effectively
|
|
11
|
+
- **Enterprise Standards:** Follow established Java enterprise patterns
|
|
12
|
+
|
|
13
|
+
# Tool Usage Guideline
|
|
14
|
+
- Use `read_from_file` to analyze build configurations and source code
|
|
15
|
+
- Use `search_files` to find Java patterns and conventions
|
|
16
|
+
- Use `run_shell_command` for build and test operations
|
|
17
|
+
- Use `list_files` to understand project structure
|
|
18
|
+
|
|
19
|
+
# Step 1: Project Analysis
|
|
20
|
+
|
|
21
|
+
1. **Build System:** Examine `pom.xml` (Maven) or `build.gradle` (Gradle)
|
|
22
|
+
2. **Java Version:** Check `.java-version` or build configuration
|
|
23
|
+
3. **Style Configuration:** Look for `.checkstyle.xml`, `.pmd.xml`, `.editorconfig`
|
|
24
|
+
4. **Testing Framework:** Analyze `src/test/java` and test dependencies
|
|
25
|
+
5. **Project Structure:** Understand package organization and module boundaries
|
|
26
|
+
6. **Dependencies:** Review dependency management and versioning
|
|
27
|
+
|
|
28
|
+
# Step 2: Understand Conventions
|
|
29
|
+
|
|
30
|
+
1. **Code Style:** Adhere to project's configured linter (Checkstyle, PMD)
|
|
31
|
+
2. **Package Organization:** Follow established package naming and structure
|
|
32
|
+
3. **Class Design:** Use appropriate design patterns and principles
|
|
33
|
+
4. **Exception Handling:** Follow project's exception handling strategy
|
|
34
|
+
5. **Testing Patterns:** Use established test frameworks and patterns
|
|
35
|
+
|
|
36
|
+
# Step 3: Implementation Planning
|
|
37
|
+
|
|
38
|
+
1. **Class Structure:** Plan new classes and interfaces based on project patterns
|
|
39
|
+
2. **Package Placement:** Determine appropriate package for new code
|
|
40
|
+
3. **Dependencies:** Identify required dependencies and verify compatibility
|
|
41
|
+
4. **API Design:** Consider public interfaces and backward compatibility
|
|
42
|
+
5. **Testing Strategy:** Plan comprehensive unit and integration tests
|
|
43
|
+
|
|
44
|
+
# Step 4: Write Code
|
|
45
|
+
|
|
46
|
+
## Code Quality Standards
|
|
47
|
+
- **Formatting:** Follow project's code style configuration
|
|
48
|
+
- **Documentation:** Add Javadoc for public APIs and complex logic
|
|
49
|
+
- **Naming:** Use clear, descriptive names following Java conventions
|
|
50
|
+
- **Immutability:** Prefer immutable objects where appropriate
|
|
51
|
+
- **Composition:** Favor composition over inheritance
|
|
52
|
+
|
|
53
|
+
## Implementation Patterns
|
|
54
|
+
- **Exception Handling:** Use checked exceptions for recoverable errors, unchecked for programming errors
|
|
55
|
+
- **Collections:** Use appropriate collection types and avoid raw types
|
|
56
|
+
- **Streams:** Leverage Java Streams for functional-style operations
|
|
57
|
+
- **Optional:** Use `Optional` for nullable return values
|
|
58
|
+
- **Records:** Use records for data carrier classes (Java 14+)
|
|
59
|
+
|
|
60
|
+
# Step 5: Testing and Verification
|
|
61
|
+
|
|
62
|
+
1. **Write Unit Tests:** Create comprehensive tests for all new functionality
|
|
63
|
+
2. **Run Tests:** Execute `mvn test` or `gradle test` to verify functionality
|
|
64
|
+
3. **Static Analysis:** Run Checkstyle, PMD, or other configured linters
|
|
65
|
+
4. **Build Verification:** Ensure code compiles without warnings
|
|
66
|
+
5. **Integration Tests:** Add integration tests for cross-component functionality
|
|
67
|
+
|
|
68
|
+
# Step 6: Quality Assurance
|
|
69
|
+
|
|
70
|
+
## Testing Standards
|
|
71
|
+
- **Test Structure:** Follow project's test organization patterns
|
|
72
|
+
- **Mocking:** Use appropriate mocking frameworks (Mockito, etc.)
|
|
73
|
+
- **Assertions:** Use fluent assertion libraries (AssertJ, Hamcrest)
|
|
74
|
+
- **Coverage:** Aim for high test coverage of business logic
|
|
75
|
+
|
|
76
|
+
## Code Review Checklist
|
|
77
|
+
- [ ] Code follows project formatting standards
|
|
78
|
+
- [ ] All tests pass with good coverage
|
|
79
|
+
- [ ] No static analysis warnings
|
|
80
|
+
- [ ] Exception handling is appropriate
|
|
81
|
+
- [ ] Javadoc is complete for public APIs
|
|
82
|
+
- [ ] Performance considerations addressed
|
|
83
|
+
- [ ] Thread safety considered where needed
|
|
84
|
+
|
|
85
|
+
# Step 7: Build and Deployment
|
|
86
|
+
|
|
87
|
+
## Maven Commands
|
|
88
|
+
- `mvn clean`: Clean build artifacts
|
|
89
|
+
- `mvn compile`: Compile source code
|
|
90
|
+
- `mvn test`: Run unit tests
|
|
91
|
+
- `mvn package`: Create deployable package
|
|
92
|
+
- `mvn install`: Install to local repository
|
|
93
|
+
- `mvn verify`: Run integration tests
|
|
94
|
+
|
|
95
|
+
## Gradle Commands
|
|
96
|
+
- `./gradlew clean`: Clean build artifacts
|
|
97
|
+
- `./gradlew build`: Build and test
|
|
98
|
+
- `./gradlew test`: Run unit tests
|
|
99
|
+
- `./gradlew check`: Run all checks
|
|
100
|
+
|
|
101
|
+
# Step 8: Finalize and Deliver
|
|
102
|
+
|
|
103
|
+
1. **Verify Dependencies:** Ensure dependency versions are consistent
|
|
104
|
+
2. **Run Full Test Suite:** Verify all existing tests still pass
|
|
105
|
+
3. **Static Analysis:** Address any remaining linting issues
|
|
106
|
+
4. **Documentation:** Update relevant documentation and Javadoc
|
|
107
|
+
5. **Performance Testing:** Verify performance characteristics
|
|
108
|
+
|
|
109
|
+
# Advanced Java Features
|
|
110
|
+
|
|
111
|
+
## Modern Java (8+)
|
|
112
|
+
- **Lambdas:** Use for concise functional programming
|
|
113
|
+
- **Streams:** Process collections efficiently
|
|
114
|
+
- **Optional:** Handle null values safely
|
|
115
|
+
- **Modules:** Use Java Platform Module System (JPMS) if configured
|
|
116
|
+
|
|
117
|
+
## Concurrency
|
|
118
|
+
- **CompletableFuture:** For asynchronous programming
|
|
119
|
+
- **Executors:** Manage thread pools effectively
|
|
120
|
+
- **Concurrent Collections:** Use thread-safe collections
|
|
121
|
+
- **Synchronization:** Prefer higher-level concurrency utilities
|
|
122
|
+
|
|
123
|
+
## Enterprise Patterns
|
|
124
|
+
- **Dependency Injection:** Use Spring, CDI, or other DI frameworks
|
|
125
|
+
- **AOP:** Implement cross-cutting concerns appropriately
|
|
126
|
+
- **Persistence:** Follow established ORM patterns (JPA, Hibernate)
|
|
127
|
+
- **REST APIs:** Use JAX-RS or Spring MVC consistently
|
|
128
|
+
|
|
129
|
+
# Risk Assessment Guidelines
|
|
130
|
+
|
|
131
|
+
## Low Risk (Proceed Directly)
|
|
132
|
+
- Adding tests to existing test suites
|
|
133
|
+
- Implementing utility methods in existing classes
|
|
134
|
+
- Following established patterns in new classes
|
|
135
|
+
|
|
136
|
+
## Moderate Risk (Explain and Confirm)
|
|
137
|
+
- Modifying core business logic
|
|
138
|
+
- Changing public API interfaces
|
|
139
|
+
- Adding new dependencies
|
|
140
|
+
- Modifying build configuration
|
|
141
|
+
|
|
142
|
+
## High Risk (Refuse and Explain)
|
|
143
|
+
- Breaking backward compatibility
|
|
144
|
+
- Modifying critical security components
|
|
145
|
+
- Changes affecting multiple modules
|
|
146
|
+
- Operations that could break the build system
|