Przeglądaj źródła

feat: rebuild .clinerules with Context7 config and workflow templates

- Add Context7 MCP usage guidelines in .clinerules/Context7.md
- Add workflow template for creating new workflows in .clinerules/workflows/create-new-workflow.md
- Add git commit and push automation workflow in .clinerules/workflows/git-commit-and-push.md
sw 2 tygodni temu
rodzic
commit
d20809cad8

+ 6 - 3
.clinerules → .clinerules/Context7.md

@@ -12,12 +12,13 @@
 ## 具体指示
 
 这意味着你应该自动使用 Context7 MCP 工具来:
+
 - 使用 `resolve-library-id` 工具解析库名称到 Context7 兼容的库 ID
 - 使用 `get-library-docs` 工具获取最新的库文档和代码示例
 - 无需我明确要求 "use context7",应该主动使用这些工具
 - Always use context7 when I need code generation, setup or configuration steps, or
-library/API documentation. This means you should automatically use the Context7 MCP
-tools to resolve library id and get library docs without me having to explicitly ask.
+  library/API documentation. This means you should automatically use the Context7 MCP
+  tools to resolve library id and get library docs without me having to explicitly ask.
 
 ## 示例场景
 
@@ -27,6 +28,8 @@ tools to resolve library id and get library docs without me having to explicitly
 - 当我需要实现特定功能的代码示例时
 
 通过自动使用 Context7,确保提供的代码和文档都是最新、准确的。
+
 ## 注意
+
 - 优先考虑使用和当前依赖库版本兼容的代码和文档
-- 如果无法通过 Context7 获取所需信息,再考虑其他来源
+- 如果无法通过 Context7 获取所需信息,再考虑其他来源

+ 55 - 0
.clinerules/workflows/create-new-workflow.md

@@ -0,0 +1,55 @@
+<task name="Create New Workflow">
+
+<task_objective>
+Guide the user through the process of creating a new standardized Cline workflow file according to the established conventions. The output will be a properly structured workflow file in the .clinerules/workflows directory.
+</task_objective>
+
+<detailed_sequence_steps>
+
+# Create New Workflow Process - Detailed Sequence of Steps
+
+## 1. Define Workflow Purpose
+
+1. Use the `ask_followup_question` command to ask the USER for the purpose of the new workflow.
+2. Use the `ask_followup_question` command to ask the USER for a concise name for the workflow.
+3. Determine the appropriate filename using kebab-case format (e.g., `analyze-system-requirements.md`).
+
+4. Inform the USER of the upcoming workflow file creation process and the main steps they will be asked to complete.
+
+## 2. Define Task Objective
+
+1. Use the `ask_followup_question` command to ask the USER for the primary objective of the workflow. Remind the user to provide breadcrubs of the inputs to be used, the output to be generated, and a generalization of the processing to formulate the outputs.
+2. Use the `ask_followup_question` command to ask the USER if know what MCP servers will be required at this point by providing of a list of Cline's active MCP server names.
+3. Use the `ask_followup_question` command to ask the USER what the expected output format will be (e.g., markdown file, code file, terminal output).
+4. Formulate a clear, concise task objective statement (1-3 sentences) based on the USER's responses.
+
+## 3. Outline Major Steps
+
+1. Use the `ask_followup_question` command to ask the USER to list the major steps in the workflow (3-7 steps recommended) and they will have a oppurtunity provide more details later or let Cline determine this for them
+2. For each major step, determine the following:
+   - Required tools or resources
+   - Expected outputs or transitions to the next step
+
+## 4. Define Detailed Substeps
+
+1. For each major step identified and analyzied, present the user what how you intended to perform the step and use the `ask_followup_question` command to see confirmation or clarification.
+
+## 5. Generate Workflow File
+
+1. Determine if the `.clinerules/workflows` directory exists. If not, create it.
+
+2. Create a markdown file named `.clinerules/workflows/{{workflow-filename}}.md` with the following structure:
+   i. Task definition with name attribute
+   ii. Task objective section
+   iii. Detailed sequence steps section with proper formatting
+   iv. Proper tool references and formatting conventions
+
+3. Use the `read_file` command to read the `.clinerules/workflow-template.md` file to ensure the new workflow follows all conventions.
+
+4. Use the `write_to_file` command to write the completed workflow file.
+
+5. Use the `attempt_completion` command to present the USER with the completed workflow file and confirmation of its creation.
+
+</detailed_sequence_steps>
+
+</task>

+ 111 - 0
.clinerules/workflows/git-commit-and-push.md

@@ -0,0 +1,111 @@
+<task name="Git Commit and Push">
+
+<task_objective>
+Automate the Git commit and push process by intelligently analyzing file changes, generating semantic commit messages with file paths, and providing an interactive command execution workflow. The workflow opens a new terminal, checks Git status, analyzes changes to create descriptive commit messages, lists commands for user review, and executes Git operations step by step with user confirmation.
+</task_objective>
+
+<detailed_sequence_steps>
+
+# Git Commit and Push Process - Detailed Sequence of Steps
+
+## 1. Open New Terminal and Check Git Status
+
+1. Use the `execute_command` tool to open a new terminal session.
+
+2. Use the `execute_command` tool to execute `git status` to check current repository state.
+
+   - Identify modified files
+   - Identify new (untracked) files
+   - Identify deleted files
+   - Display current branch information
+
+3. Analyze the output to understand the scope of changes in the current working directory.
+
+## 2. Analyze File Changes and Generate Commit Message
+
+1. For each changed file identified in git status:
+
+   - Use the `read_file` tool to examine the content of modified files if needed for context
+   - Analyze the type of changes (new features, bug fixes, documentation, refactoring, etc.)
+
+2. Based on the file changes and any user-provided context information:
+
+   - Generate a semantic commit message following conventional commit format
+   - Include the file paths of changed files in the commit message
+   - Examples:
+     - `feat: add new workflow creation process in .clinerules/workflows/create-new-workflow.md`
+     - `fix: resolve authentication issue in src/API/security/userActions.ts`
+     - `docs: update README.md with installation instructions`
+
+3. Ensure the commit message is descriptive and includes relevant file paths for clarity.
+
+## 3. Present Command List for User Review
+
+1. Generate the complete list of Git commands to be executed:
+
+   ```
+   git add .
+   git commit -m "generated commit message with file paths"
+   git push
+   ```
+
+2. Display the command list clearly to the user for review and confirmation.
+
+3. Show the generated commit message prominently so the user can verify its accuracy.
+
+## 4. Interactive Command Execution Confirmation
+
+1. Use the `ask_followup_question` tool to ask the user for confirmation with clickable options:
+
+   - Question: "是否要开始执行Git命令?"
+   - Options: ["开始执行命令", "修改提交信息", "取消操作"]
+
+2. Handle user response:
+   - If "开始执行命令": Proceed to step 5
+   - If "修改提交信息": Ask user for new commit message and update commands
+   - If "取消操作": Stop the workflow
+
+## 5. Execute Git Commands Step by Step
+
+1. **Execute git add .**
+
+   - Use the `execute_command` tool to run `git add .`
+   - Display the result and confirm success
+   - Wait for command completion before proceeding
+
+2. **Execute git commit**
+
+   - Use the `execute_command` tool to run `git commit -m "final commit message"`
+   - Use the standard git commit command (ignore any git aliases)
+   - Display the commit result including commit hash
+   - Confirm the commit was successful
+
+3. **Execute git push**
+
+   - Use the `execute_command` tool to run `git push`
+   - Display the push result
+   - Confirm files were successfully pushed to remote repository
+
+4. **Final Confirmation**
+   - Use the `attempt_completion` tool to present the final results
+   - Include summary of:
+     - Files that were committed
+     - The final commit message used
+     - Confirmation that changes were pushed to remote repository
+
+## Error Handling
+
+- If any git command fails, display the error message clearly
+- Provide suggested solutions for common git errors
+- Allow user to retry or modify the approach based on the error
+
+## Notes
+
+- Always use standard git commands (`git commit -m`) and ignore user-defined git aliases
+- Ensure commit messages are informative and include file paths for better tracking
+- The workflow assumes the current working directory is already a git repository
+- Each command execution should be confirmed successful before proceeding to the next step
+
+</detailed_sequence_steps>
+
+</task>