zrb 1.8.10__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.

Files changed (147) hide show
  1. zrb/__init__.py +126 -113
  2. zrb/__main__.py +1 -1
  3. zrb/attr/type.py +10 -7
  4. zrb/builtin/__init__.py +2 -50
  5. zrb/builtin/git.py +12 -1
  6. zrb/builtin/group.py +31 -15
  7. zrb/builtin/http.py +7 -8
  8. zrb/builtin/llm/attachment.py +40 -0
  9. zrb/builtin/llm/chat_completion.py +274 -0
  10. zrb/builtin/llm/chat_session.py +152 -85
  11. zrb/builtin/llm/chat_session_cmd.py +288 -0
  12. zrb/builtin/llm/chat_trigger.py +79 -0
  13. zrb/builtin/llm/history.py +7 -9
  14. zrb/builtin/llm/llm_ask.py +221 -98
  15. zrb/builtin/llm/tool/api.py +74 -52
  16. zrb/builtin/llm/tool/cli.py +46 -17
  17. zrb/builtin/llm/tool/code.py +71 -90
  18. zrb/builtin/llm/tool/file.py +301 -241
  19. zrb/builtin/llm/tool/note.py +84 -0
  20. zrb/builtin/llm/tool/rag.py +38 -8
  21. zrb/builtin/llm/tool/sub_agent.py +67 -50
  22. zrb/builtin/llm/tool/web.py +146 -122
  23. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +7 -7
  24. zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_util.py +5 -5
  25. zrb/builtin/project/add/fastapp/fastapp_util.py +1 -1
  26. zrb/builtin/searxng/config/settings.yml +5671 -0
  27. zrb/builtin/searxng/start.py +21 -0
  28. zrb/builtin/setup/latex/ubuntu.py +1 -0
  29. zrb/builtin/setup/ubuntu.py +1 -1
  30. zrb/builtin/shell/autocomplete/bash.py +4 -3
  31. zrb/builtin/shell/autocomplete/zsh.py +4 -3
  32. zrb/builtin/todo.py +13 -2
  33. zrb/config/config.py +614 -0
  34. zrb/config/default_prompt/file_extractor_system_prompt.md +112 -0
  35. zrb/config/default_prompt/interactive_system_prompt.md +29 -0
  36. zrb/config/default_prompt/persona.md +1 -0
  37. zrb/config/default_prompt/repo_extractor_system_prompt.md +112 -0
  38. zrb/config/default_prompt/repo_summarizer_system_prompt.md +29 -0
  39. zrb/config/default_prompt/summarization_prompt.md +57 -0
  40. zrb/config/default_prompt/system_prompt.md +38 -0
  41. zrb/config/llm_config.py +339 -0
  42. zrb/config/llm_context/config.py +166 -0
  43. zrb/config/llm_context/config_parser.py +40 -0
  44. zrb/config/llm_context/workflow.py +81 -0
  45. zrb/config/llm_rate_limitter.py +190 -0
  46. zrb/{runner → config}/web_auth_config.py +17 -22
  47. zrb/context/any_shared_context.py +17 -1
  48. zrb/context/context.py +16 -2
  49. zrb/context/shared_context.py +18 -8
  50. zrb/group/any_group.py +12 -5
  51. zrb/group/group.py +67 -3
  52. zrb/input/any_input.py +5 -1
  53. zrb/input/base_input.py +18 -6
  54. zrb/input/option_input.py +13 -1
  55. zrb/input/text_input.py +8 -25
  56. zrb/runner/cli.py +25 -23
  57. zrb/runner/common_util.py +24 -19
  58. zrb/runner/web_app.py +3 -3
  59. zrb/runner/web_route/docs_route.py +1 -1
  60. zrb/runner/web_route/error_page/serve_default_404.py +1 -1
  61. zrb/runner/web_route/error_page/show_error_page.py +1 -1
  62. zrb/runner/web_route/home_page/home_page_route.py +2 -2
  63. zrb/runner/web_route/login_api_route.py +1 -1
  64. zrb/runner/web_route/login_page/login_page_route.py +2 -2
  65. zrb/runner/web_route/logout_api_route.py +1 -1
  66. zrb/runner/web_route/logout_page/logout_page_route.py +2 -2
  67. zrb/runner/web_route/node_page/group/show_group_page.py +1 -1
  68. zrb/runner/web_route/node_page/node_page_route.py +1 -1
  69. zrb/runner/web_route/node_page/task/show_task_page.py +1 -1
  70. zrb/runner/web_route/refresh_token_api_route.py +1 -1
  71. zrb/runner/web_route/static/static_route.py +1 -1
  72. zrb/runner/web_route/task_input_api_route.py +6 -6
  73. zrb/runner/web_route/task_session_api_route.py +20 -12
  74. zrb/runner/web_util/cookie.py +1 -1
  75. zrb/runner/web_util/token.py +1 -1
  76. zrb/runner/web_util/user.py +8 -4
  77. zrb/session/any_session.py +24 -17
  78. zrb/session/session.py +50 -25
  79. zrb/session_state_logger/any_session_state_logger.py +9 -4
  80. zrb/session_state_logger/file_session_state_logger.py +16 -6
  81. zrb/session_state_logger/session_state_logger_factory.py +1 -1
  82. zrb/task/any_task.py +30 -9
  83. zrb/task/base/context.py +17 -9
  84. zrb/task/base/execution.py +15 -8
  85. zrb/task/base/lifecycle.py +8 -4
  86. zrb/task/base/monitoring.py +12 -7
  87. zrb/task/base_task.py +69 -5
  88. zrb/task/base_trigger.py +12 -5
  89. zrb/task/cmd_task.py +1 -1
  90. zrb/task/llm/agent.py +154 -161
  91. zrb/task/llm/agent_runner.py +152 -0
  92. zrb/task/llm/config.py +47 -18
  93. zrb/task/llm/conversation_history.py +209 -0
  94. zrb/task/llm/conversation_history_model.py +67 -0
  95. zrb/task/llm/default_workflow/coding/workflow.md +41 -0
  96. zrb/task/llm/default_workflow/copywriting/workflow.md +68 -0
  97. zrb/task/llm/default_workflow/git/workflow.md +118 -0
  98. zrb/task/llm/default_workflow/golang/workflow.md +128 -0
  99. zrb/task/llm/default_workflow/html-css/workflow.md +135 -0
  100. zrb/task/llm/default_workflow/java/workflow.md +146 -0
  101. zrb/task/llm/default_workflow/javascript/workflow.md +158 -0
  102. zrb/task/llm/default_workflow/python/workflow.md +160 -0
  103. zrb/task/llm/default_workflow/researching/workflow.md +153 -0
  104. zrb/task/llm/default_workflow/rust/workflow.md +162 -0
  105. zrb/task/llm/default_workflow/shell/workflow.md +299 -0
  106. zrb/task/llm/error.py +24 -10
  107. zrb/task/llm/file_replacement.py +206 -0
  108. zrb/task/llm/file_tool_model.py +57 -0
  109. zrb/task/llm/history_processor.py +206 -0
  110. zrb/task/llm/history_summarization.py +11 -166
  111. zrb/task/llm/print_node.py +193 -69
  112. zrb/task/llm/prompt.py +242 -45
  113. zrb/task/llm/subagent_conversation_history.py +41 -0
  114. zrb/task/llm/tool_wrapper.py +260 -57
  115. zrb/task/llm/workflow.py +76 -0
  116. zrb/task/llm_task.py +182 -171
  117. zrb/task/make_task.py +2 -3
  118. zrb/task/rsync_task.py +26 -11
  119. zrb/task/scheduler.py +4 -4
  120. zrb/util/attr.py +54 -39
  121. zrb/util/callable.py +23 -0
  122. zrb/util/cli/markdown.py +12 -0
  123. zrb/util/cli/text.py +30 -0
  124. zrb/util/file.py +29 -11
  125. zrb/util/git.py +8 -11
  126. zrb/util/git_diff_model.py +10 -0
  127. zrb/util/git_subtree.py +9 -14
  128. zrb/util/git_subtree_model.py +32 -0
  129. zrb/util/init_path.py +1 -1
  130. zrb/util/markdown.py +62 -0
  131. zrb/util/string/conversion.py +2 -2
  132. zrb/util/todo.py +17 -50
  133. zrb/util/todo_model.py +46 -0
  134. zrb/util/truncate.py +23 -0
  135. zrb/util/yaml.py +204 -0
  136. zrb/xcom/xcom.py +10 -0
  137. zrb-1.21.29.dist-info/METADATA +270 -0
  138. {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/RECORD +140 -98
  139. {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/WHEEL +1 -1
  140. zrb/config.py +0 -335
  141. zrb/llm_config.py +0 -411
  142. zrb/llm_rate_limitter.py +0 -125
  143. zrb/task/llm/context.py +0 -102
  144. zrb/task/llm/context_enrichment.py +0 -199
  145. zrb/task/llm/history.py +0 -211
  146. zrb-1.8.10.dist-info/METADATA +0 -264
  147. {zrb-1.8.10.dist-info → zrb-1.21.29.dist-info}/entry_points.txt +0 -0
@@ -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
@@ -0,0 +1,158 @@
1
+ ---
2
+ description: "A workflow for developing with JavaScript and TypeScript, including project analysis and best practices."
3
+ ---
4
+ Follow this workflow to deliver robust, maintainable JavaScript/TypeScript code that follows project conventions.
5
+
6
+ # Core Mandates
7
+
8
+ - **Type Safety First:** Use TypeScript when available, proper typing in JavaScript
9
+ - **Modern Standards:** Follow ES6+ features and best practices
10
+ - **Framework Consistency:** Adhere to project's framework conventions
11
+ - **Tool Integration:** Leverage comprehensive JavaScript tooling ecosystem
12
+
13
+ # Tool Usage Guideline
14
+ - Use `read_from_file` to analyze package.json and configuration files
15
+ - Use `search_files` to find JavaScript/TypeScript patterns
16
+ - Use `run_shell_command` for npm/yarn/pnpm operations
17
+ - Use `list_files` to understand project structure
18
+
19
+ # Step 1: Project Analysis
20
+
21
+ 1. **Package Management:** Examine `package.json` and lock files (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`)
22
+ 2. **TypeScript Configuration:** Check for `tsconfig.json` and TypeScript usage
23
+ 3. **Linting Configuration:** Look for `.eslintrc.js`, `.prettierrc`, ESLint config in `package.json`
24
+ 4. **Build Configuration:** Analyze `webpack.config.js`, `vite.config.ts`, `rollup.config.js`
25
+ 5. **Testing Framework:** Check for `jest.config.js`, `vitest.config.ts`, test directories
26
+ 6. **Framework Usage:** Identify React, Vue, Angular, or other framework usage
27
+
28
+ # Step 2: Understand Conventions
29
+
30
+ 1. **Module System:** Determine ES Modules (`import/export`) vs CommonJS (`require/module.exports`)
31
+ 2. **TypeScript Strictness:** Adhere to project's TypeScript configuration
32
+ 3. **Framework Patterns:** Follow established component, state management, and routing patterns
33
+ 4. **Styling Approach:** Understand CSS-in-JS, CSS modules, or traditional CSS usage
34
+ 5. **Testing Strategy:** Follow established test patterns and mocking approaches
35
+
36
+ # Step 3: Implementation Planning
37
+
38
+ 1. **File Structure:** Plan where new code should be placed based on project conventions
39
+ 2. **Type Definitions:** Plan TypeScript interfaces and types for new functionality
40
+ 3. **Component Design:** Design React/Vue/Angular components following established patterns
41
+ 4. **State Management:** Determine appropriate state management approach
42
+ 5. **Testing Strategy:** Plan comprehensive unit, integration, and end-to-end tests
43
+
44
+ # Step 4: Write Code
45
+
46
+ ## Code Quality Standards
47
+ - **Formatting:** Use Prettier with project configuration
48
+ - **Linting:** Follow ESLint rules and address all warnings
49
+ - **Type Safety:** Use TypeScript strictly when available
50
+ - **Naming:** Use clear, descriptive names following project conventions
51
+ - **Documentation:** Add JSDoc/TSDoc for complex functions and public APIs
52
+
53
+ ## Framework-Specific Patterns
54
+
55
+ ### React
56
+ - **Functional Components:** Use hooks-based functional components
57
+ - **State Management:** Follow established patterns (useState, useReducer, Redux, etc.)
58
+ - **Performance:** Use React.memo, useMemo, useCallback appropriately
59
+ - **Testing:** Use React Testing Library and established testing patterns
60
+
61
+ ### Vue
62
+ - **Composition API:** Prefer Composition API over Options API
63
+ - **State Management:** Use Pinia or Vuex following project patterns
64
+ - **Component Structure:** Follow single-file component conventions
65
+ - **Testing:** Use Vue Test Utils and established testing patterns
66
+
67
+ ### Angular
68
+ - **Component Structure:** Follow Angular module and component conventions
69
+ - **Dependency Injection:** Use Angular's DI system appropriately
70
+ - **RxJS:** Follow established reactive programming patterns
71
+ - **Testing:** Use Angular Testing utilities and established patterns
72
+
73
+ # Step 5: Testing and Verification
74
+
75
+ 1. **Write Tests:** Create comprehensive tests for all new functionality
76
+ 2. **Run Tests:** Execute `npm test` or framework-specific test commands
77
+ 3. **Type Checking:** Run `npm run typecheck` or `tsc --noEmit`
78
+ 4. **Linting:** Run `npm run lint` to catch code quality issues
79
+ 5. **Build Verification:** Run `npm run build` to ensure code compiles correctly
80
+
81
+ # Step 6: Quality Assurance
82
+
83
+ ## Testing Standards
84
+ - **Unit Tests:** Test individual functions and components in isolation
85
+ - **Integration Tests:** Test component interactions and API integrations
86
+ - **End-to-End Tests:** Test complete user workflows (if configured)
87
+ - **Mocking:** Use appropriate mocking libraries and patterns
88
+ - **Coverage:** Aim for high test coverage of business logic
89
+
90
+ ## Code Review Checklist
91
+ - [ ] Code follows project formatting and linting standards
92
+ - [ ] All tests pass with good coverage
93
+ - [ ] TypeScript compiles without errors (if applicable)
94
+ - [ ] No ESLint warnings
95
+ - [ ] Documentation is complete for complex logic
96
+ - [ ] Performance considerations addressed
97
+ - [ ] Accessibility requirements met
98
+
99
+ # Step 7: Package Management
100
+
101
+ ## Dependency Management
102
+ - **npm:** Use `npm install <package>` for new dependencies
103
+ - **yarn:** Use `yarn add <package>` for new dependencies
104
+ - **pnpm:** Use `pnpm add <package>` for new dependencies
105
+ - **Version Management:** Follow project's versioning strategy
106
+
107
+ ## Script Execution
108
+ - `npm install` / `yarn install` / `pnpm install`: Install dependencies
109
+ - `npm run dev` / `yarn dev` / `pnpm dev`: Start development server
110
+ - `npm run build` / `yarn build` / `pnpm build`: Build for production
111
+ - `npm run lint` / `yarn lint` / `pnpm lint`: Run linting
112
+
113
+ # Step 8: Finalize and Deliver
114
+
115
+ 1. **Verify Dependencies:** Ensure dependency versions are consistent
116
+ 2. **Run Full Test Suite:** Verify all existing tests still pass
117
+ 3. **Type Checking:** Ensure TypeScript compilation succeeds
118
+ 4. **Build Verification:** Confirm production build works correctly
119
+ 5. **Documentation:** Update relevant documentation and comments
120
+
121
+ # Common Commands Reference
122
+
123
+ ## Development
124
+ - `npm run dev`: Start development server
125
+ - `npm run build`: Build for production
126
+ - `npm run typecheck`: Type check TypeScript code
127
+ - `npm run lint`: Run ESLint
128
+ - `npm run format`: Format code with Prettier
129
+
130
+ ## Testing
131
+ - `npm test`: Run tests
132
+ - `npm run test:watch`: Run tests in watch mode
133
+ - `npm run test:coverage`: Run tests with coverage
134
+ - `npm run test:e2e`: Run end-to-end tests (if configured)
135
+
136
+ ## Debugging
137
+ - Browser developer tools for frontend debugging
138
+ - `node --inspect` for Node.js debugging
139
+ - Framework-specific debugging tools
140
+
141
+ # Risk Assessment Guidelines
142
+
143
+ ## Low Risk (Proceed Directly)
144
+ - Adding tests to existing test suites
145
+ - Implementing utility functions following established patterns
146
+ - Creating new components in established patterns
147
+
148
+ ## Moderate Risk (Explain and Confirm)
149
+ - Modifying core application state
150
+ - Changing public API interfaces
151
+ - Adding new dependencies
152
+ - Modifying build configuration
153
+
154
+ ## High Risk (Refuse and Explain)
155
+ - Breaking TypeScript strict mode compliance
156
+ - Modifying critical security components
157
+ - Changes affecting multiple applications
158
+ - Operations that could break the build system