mcp-keep-feedback 0.1.2__tar.gz

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.
Files changed (152) hide show
  1. mcp_keep_feedback-0.1.2/.bumpversion.cfg +15 -0
  2. mcp_keep_feedback-0.1.2/.env.example +3 -0
  3. mcp_keep_feedback-0.1.2/.gitignore +91 -0
  4. mcp_keep_feedback-0.1.2/.python-version +1 -0
  5. mcp_keep_feedback-0.1.2/AGENTS.md +305 -0
  6. mcp_keep_feedback-0.1.2/LICENSE +24 -0
  7. mcp_keep_feedback-0.1.2/Makefile +205 -0
  8. mcp_keep_feedback-0.1.2/PKG-INFO +451 -0
  9. mcp_keep_feedback-0.1.2/README.md +414 -0
  10. mcp_keep_feedback-0.1.2/RELEASE_NOTES/CHANGELOG.en.md +403 -0
  11. mcp_keep_feedback-0.1.2/RELEASE_NOTES/CHANGELOG.md +367 -0
  12. mcp_keep_feedback-0.1.2/RELEASE_NOTES/CHANGELOG.zh-CN.md +427 -0
  13. mcp_keep_feedback-0.1.2/RELEASE_NOTES/CHANGELOG.zh-TW.md +427 -0
  14. mcp_keep_feedback-0.1.2/RELEASE_NOTES/README.md +66 -0
  15. mcp_keep_feedback-0.1.2/RELEASE_NOTES/SIMPLIFIED_WORKFLOW.md +147 -0
  16. mcp_keep_feedback-0.1.2/RELEASE_NOTES/template.md +24 -0
  17. mcp_keep_feedback-0.1.2/debug_websocket.html +184 -0
  18. mcp_keep_feedback-0.1.2/doc/input-queue-design.md +238 -0
  19. mcp_keep_feedback-0.1.2/doc/openai-proxy-design.md +365 -0
  20. mcp_keep_feedback-0.1.2/docs/DESKTOP_BUILD.md +244 -0
  21. mcp_keep_feedback-0.1.2/docs/DESKTOP_BUILD_IMPROVEMENTS.md +224 -0
  22. mcp_keep_feedback-0.1.2/docs/WORKFLOWS.md +159 -0
  23. mcp_keep_feedback-0.1.2/docs/architecture/README.md +90 -0
  24. mcp_keep_feedback-0.1.2/docs/architecture/api-reference.md +908 -0
  25. mcp_keep_feedback-0.1.2/docs/architecture/component-details.md +1373 -0
  26. mcp_keep_feedback-0.1.2/docs/architecture/deployment-guide.md +642 -0
  27. mcp_keep_feedback-0.1.2/docs/architecture/interaction-flows.md +848 -0
  28. mcp_keep_feedback-0.1.2/docs/architecture/system-overview.md +594 -0
  29. mcp_keep_feedback-0.1.2/docs/cache-management.md +142 -0
  30. mcp_keep_feedback-0.1.2/docs/images/desktop1.png +0 -0
  31. mcp_keep_feedback-0.1.2/docs/images/ssh-remote-connect-url.png +0 -0
  32. mcp_keep_feedback-0.1.2/docs/images/ssh-remote-debug-port.png +0 -0
  33. mcp_keep_feedback-0.1.2/docs/images/ssh-remote-port-setting.png +0 -0
  34. mcp_keep_feedback-0.1.2/docs/images/web1.png +0 -0
  35. mcp_keep_feedback-0.1.2/docs/images/web2.jpeg +0 -0
  36. mcp_keep_feedback-0.1.2/docs/prompt-engineering.md +185 -0
  37. mcp_keep_feedback-0.1.2/docs/ssh-remote/browser-launch-issues.md +115 -0
  38. mcp_keep_feedback-0.1.2/docs//345/267/245/345/205/267/350/266/205/346/227/266/350/207/252/345/212/250/345/233/236/345/244/215/346/226/271/346/241/210.md +39 -0
  39. mcp_keep_feedback-0.1.2/docs//347/213/254/347/253/213/345/221/275/344/273/244/350/241/214/350/247/246/345/217/221/350/256/276/350/256/241/346/226/271/346/241/210.md +85 -0
  40. mcp_keep_feedback-0.1.2/examples/mcp-config-desktop.json +16 -0
  41. mcp_keep_feedback-0.1.2/examples/mcp-config-web.json +16 -0
  42. mcp_keep_feedback-0.1.2/highlights.txt +1 -0
  43. mcp_keep_feedback-0.1.2/pyproject.toml +311 -0
  44. mcp_keep_feedback-0.1.2/pytest.ini +43 -0
  45. mcp_keep_feedback-0.1.2/release_body.md +35 -0
  46. mcp_keep_feedback-0.1.2/scripts/build_desktop.py +437 -0
  47. mcp_keep_feedback-0.1.2/scripts/cleanup_cache.py +306 -0
  48. mcp_keep_feedback-0.1.2/scripts/publish.sh +144 -0
  49. mcp_keep_feedback-0.1.2/scripts/release.py +109 -0
  50. mcp_keep_feedback-0.1.2/scripts/validate_message_codes.py +202 -0
  51. mcp_keep_feedback-0.1.2/scripts/validate_workflows.py +215 -0
  52. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/__init__.py +52 -0
  53. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/__main__.py +306 -0
  54. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/debug.py +79 -0
  55. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/desktop_app/__init__.py +30 -0
  56. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/desktop_app/desktop_app.py +336 -0
  57. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/i18n.py +379 -0
  58. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/py.typed +0 -0
  59. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/server.py +647 -0
  60. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/utils/__init__.py +30 -0
  61. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/utils/cli_client.py +303 -0
  62. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/utils/error_handler.py +449 -0
  63. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/utils/memory_monitor.py +519 -0
  64. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/utils/resource_manager.py +801 -0
  65. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/__init__.py +26 -0
  66. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/constants/__init__.py +8 -0
  67. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/constants/message_codes.py +168 -0
  68. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/locales/en/translation.json +610 -0
  69. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/locales/zh-CN/translation.json +596 -0
  70. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/locales/zh-TW/translation.json +614 -0
  71. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/main.py +1428 -0
  72. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/models/__init__.py +13 -0
  73. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/models/feedback_result.py +16 -0
  74. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/models/feedback_session.py +1023 -0
  75. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/routes/__init__.py +12 -0
  76. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/routes/main_routes.py +930 -0
  77. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/css/audio-management.css +545 -0
  78. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/css/notification-settings.css +152 -0
  79. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/css/prompt-management.css +566 -0
  80. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/css/session-management.css +1428 -0
  81. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/css/styles.css +2313 -0
  82. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/favicon.ico +0 -0
  83. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/icon-192.png +0 -0
  84. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/icon.svg +16 -0
  85. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/index.html +158 -0
  86. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/app.js +1306 -0
  87. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/i18n.js +376 -0
  88. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/audio/audio-manager.js +610 -0
  89. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/audio/audio-settings-ui.js +732 -0
  90. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/connection-monitor.js +435 -0
  91. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/constants/message-codes.js +168 -0
  92. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/file-upload-manager.js +555 -0
  93. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/image-handler.js +199 -0
  94. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/logger.js +404 -0
  95. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/notification/notification-manager.js +360 -0
  96. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/notification/notification-settings.js +344 -0
  97. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/prompt/prompt-input-buttons.js +427 -0
  98. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/prompt/prompt-manager.js +414 -0
  99. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/prompt/prompt-modal.js +458 -0
  100. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/prompt/prompt-settings-ui.js +373 -0
  101. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/session/session-data-manager.js +1040 -0
  102. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/session/session-details-modal.js +594 -0
  103. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/session/session-ui-renderer.js +817 -0
  104. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/session-manager.js +1059 -0
  105. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/settings-manager.js +794 -0
  106. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/tab-manager.js +242 -0
  107. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/textarea-height-manager.js +267 -0
  108. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/ui-manager.js +568 -0
  109. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/utils/dom-utils.js +392 -0
  110. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/utils/status-utils.js +403 -0
  111. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/utils/time-utils.js +276 -0
  112. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/utils.js +485 -0
  113. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/modules/websocket-manager.js +482 -0
  114. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/vendor/marked.min.js +6 -0
  115. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/static/js/vendor/purify.min.js +3 -0
  116. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/templates/components/image-upload.html +43 -0
  117. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/templates/components/settings-card.html +58 -0
  118. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/templates/components/status-indicator.html +31 -0
  119. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/templates/components/toggle-switch.html +19 -0
  120. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/templates/feedback.html +1274 -0
  121. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/templates/index.html +443 -0
  122. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/__init__.py +13 -0
  123. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/browser.py +152 -0
  124. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/compression_config.py +190 -0
  125. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/compression_monitor.py +314 -0
  126. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/network.py +66 -0
  127. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/port_manager.py +321 -0
  128. mcp_keep_feedback-0.1.2/src/mcp_keep_feedback/web/utils/session_cleanup_manager.py +525 -0
  129. mcp_keep_feedback-0.1.2/src-tauri/.cargo/config.toml +11 -0
  130. mcp_keep_feedback-0.1.2/src-tauri/Cargo.toml +60 -0
  131. mcp_keep_feedback-0.1.2/src-tauri/build.rs +3 -0
  132. mcp_keep_feedback-0.1.2/src-tauri/generate_icons.py +102 -0
  133. mcp_keep_feedback-0.1.2/src-tauri/icons/128x128.png +0 -0
  134. mcp_keep_feedback-0.1.2/src-tauri/icons/128x128@2x.png +0 -0
  135. mcp_keep_feedback-0.1.2/src-tauri/icons/256x256.png +0 -0
  136. mcp_keep_feedback-0.1.2/src-tauri/icons/32x32.png +0 -0
  137. mcp_keep_feedback-0.1.2/src-tauri/icons/icon.icns +0 -0
  138. mcp_keep_feedback-0.1.2/src-tauri/icons/icon.ico +0 -0
  139. mcp_keep_feedback-0.1.2/src-tauri/pyproject.toml +39 -0
  140. mcp_keep_feedback-0.1.2/src-tauri/python/mcp_keep_feedback_desktop/__init__.py +30 -0
  141. mcp_keep_feedback-0.1.2/src-tauri/python/mcp_keep_feedback_desktop/desktop_app.py +334 -0
  142. mcp_keep_feedback-0.1.2/src-tauri/src/lib.rs +132 -0
  143. mcp_keep_feedback-0.1.2/src-tauri/src/main.rs +79 -0
  144. mcp_keep_feedback-0.1.2/src-tauri/tauri.conf.json +70 -0
  145. mcp_keep_feedback-0.1.2/tests/__init__.py +6 -0
  146. mcp_keep_feedback-0.1.2/tests/conftest.py +122 -0
  147. mcp_keep_feedback-0.1.2/tests/fixtures/__init__.py +5 -0
  148. mcp_keep_feedback-0.1.2/tests/helpers/__init__.py +5 -0
  149. mcp_keep_feedback-0.1.2/tests/helpers/manual_tooltip_test.html +288 -0
  150. mcp_keep_feedback-0.1.2/tests/helpers/mcp_client.py +245 -0
  151. mcp_keep_feedback-0.1.2/tests/integration/__init__.py +5 -0
  152. mcp_keep_feedback-0.1.2/tests/unit/__init__.py +5 -0
@@ -0,0 +1,15 @@
1
+ [bumpversion]
2
+ current_version = 2.6.0
3
+ commit = False
4
+ tag = False
5
+ allow_dirty = True
6
+ parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
7
+ serialize = {major}.{minor}.{patch}
8
+
9
+ [bumpversion:file:pyproject.toml]
10
+ search = version = "{current_version}"
11
+ replace = version = "{new_version}"
12
+
13
+ [bumpversion:file:src/mcp_feedback_enhanced/__init__.py]
14
+ search = __version__ = "{current_version}"
15
+ replace = __version__ = "{new_version}"
@@ -0,0 +1,3 @@
1
+ # PyPI API Token
2
+ # 获取方式: https://pypi.org/manage/account/token/
3
+ PYPI_TOKEN=pypi-xxx
@@ -0,0 +1,91 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Development tool caches
10
+ .mypy_cache/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Virtual environments
17
+ .venv*/
18
+ venv*/
19
+
20
+
21
+
22
+ # Logs
23
+ *.log
24
+
25
+
26
+ # macOS
27
+ .DS_Store
28
+ .AppleDouble
29
+ .LSOverride
30
+
31
+ # Windows
32
+ Thumbs.db
33
+ ehthumbs.db
34
+ Desktop.ini
35
+
36
+ # Linux
37
+ *~
38
+
39
+ # IDE
40
+ .vscode/
41
+ .idea/
42
+ *.swp
43
+ *.swo
44
+
45
+ # Others
46
+ .cursor/rules/
47
+ uv.lock
48
+ .mcp_feedback_settings.json
49
+ test_reports/
50
+
51
+ # Temporary test files
52
+ test_*.py
53
+
54
+ # User configuration files
55
+ ui_settings.json
56
+ .config/
57
+
58
+ # Backup files
59
+ *.bak
60
+ *.backup
61
+ *.orig
62
+
63
+ # Environment files
64
+ .env
65
+ .env.local
66
+ .env.*.local
67
+
68
+ # Rust/Tauri build artifacts
69
+ src-tauri/target/
70
+ src-tauri/Cargo.lock
71
+ src-tauri/WixTools/
72
+ src-tauri/gen/
73
+
74
+
75
+
76
+
77
+ # Tauri bundle outputs
78
+ src-tauri/target/bundle/
79
+ src-tauri/target/release/bundle/
80
+
81
+ # Node.js (if using Tauri with frontend framework)
82
+ node_modules/
83
+ package-lock.json
84
+ yarn.lock
85
+
86
+ # Temporary build files
87
+ *.tmp
88
+ *.temp
89
+
90
+ .sisyphus
91
+ src/mcp_keep_feedback/desktop_release
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,305 @@
1
+ # AGENTS.md - AI Agent Development Guide
2
+
3
+ > This file provides essential information for AI coding agents working in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ **mcp-keep-feedback** is an MCP (Model Context Protocol) server for interactive user feedback in AI-assisted development. It provides a dual-interface architecture (Web UI and Desktop Application) with intelligent environment detection.
8
+
9
+ - **Language**: Python 3.11+
10
+ - **Package Manager**: uv
11
+ - **Build Backend**: Hatchling with Maturin (for Rust extensions)
12
+ - **Framework**: FastMCP, FastAPI, Tauri (desktop)
13
+
14
+ ---
15
+
16
+ ## Code Style Guidelines
17
+
18
+ ### Python Version
19
+ - Target: Python 3.11+
20
+ - Use modern type syntax: `list[str]`, `dict[str, Any]`, `str | None` (not `Optional[str]`)
21
+
22
+ ### Imports
23
+ Imports are managed by ruff/isort with these rules:
24
+ - `known-first-party = ["mcp_keep_feedback"]`
25
+ - `lines-after-imports = 2`
26
+ - Order: standard library → third-party → local imports
27
+
28
+ ```python
29
+ # Standard library
30
+ import asyncio
31
+ import os
32
+ from pathlib import Path
33
+ from typing import Any
34
+
35
+ # Third-party
36
+ from fastapi import WebSocket
37
+ from pydantic import Field
38
+
39
+ # Local imports
40
+ from .debug import debug_log
41
+ from .utils.error_handler import ErrorHandler, ErrorType
42
+ ```
43
+
44
+ ### Formatting (Ruff)
45
+ - Line length: 88 characters
46
+ - Indent: 4 spaces
47
+ - Quotes: double quotes (`"`)
48
+ - Line ending: auto
49
+
50
+ ### Type Annotations
51
+ Always use type annotations for function parameters and return types:
52
+
53
+ ```python
54
+ def process_images(self, images: list[dict]) -> list[dict]:
55
+ """Process image data with type safety."""
56
+ ...
57
+
58
+ async def submit_feedback(
59
+ self,
60
+ feedback: str,
61
+ images: list[dict[str, Any]],
62
+ settings: dict[str, Any] | None = None,
63
+ ) -> None:
64
+ """Submit feedback and images."""
65
+ ...
66
+ ```
67
+
68
+ ### Naming Conventions
69
+ - **Classes**: PascalCase (`WebFeedbackSession`, `ErrorHandler`)
70
+ - **Functions/Methods**: snake_case (`process_images`, `get_error_solutions`)
71
+ - **Constants**: UPPER_SNAKE_CASE (`MAX_IMAGE_SIZE`, `SUPPORTED_IMAGE_TYPES`)
72
+ - **Private methods**: prefix with underscore (`_process_images`, `_safe_close_websocket`)
73
+ - **Module-level private**: prefix with underscore (`_encoding_initialized`)
74
+
75
+ ### Docstrings
76
+ Use Chinese (Traditional) for docstrings in this project:
77
+
78
+ ```python
79
+ def classify_error(error: Exception) -> ErrorType:
80
+ """
81
+ 根據異常類型自動分類錯誤
82
+
83
+ Args:
84
+ error: Python 異常對象
85
+
86
+ Returns:
87
+ ErrorType: 錯誤類型
88
+ """
89
+ ...
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Error Handling
95
+
96
+ ### Use the ErrorHandler Framework
97
+ Do not use bare `except` or print errors directly. Use the unified `ErrorHandler`:
98
+
99
+ ```python
100
+ from .utils.error_handler import ErrorHandler, ErrorType
101
+
102
+ try:
103
+ # ... operation
104
+ pass
105
+ except Exception as e:
106
+ error_id = ErrorHandler.log_error_with_context(
107
+ e,
108
+ context={"operation": "描述操作", "file_path": path},
109
+ error_type=ErrorType.FILE_IO,
110
+ )
111
+ user_message = ErrorHandler.format_user_error(e, include_technical=False)
112
+ ```
113
+
114
+ ### Error Types Available
115
+ - `NETWORK` - Network-related errors
116
+ - `FILE_IO` - File I/O errors
117
+ - `PROCESS` - Process-related errors
118
+ - `TIMEOUT` - Timeout errors
119
+ - `USER_CANCEL` - User cancelled operation
120
+ - `SYSTEM` - System errors
121
+ - `PERMISSION` - Permission errors
122
+ - `VALIDATION` - Data validation errors
123
+ - `DEPENDENCY` - Dependency errors
124
+ - `CONFIGURATION` - Configuration errors
125
+
126
+ ---
127
+
128
+ ## Async Patterns
129
+
130
+ ### Use async/await properly
131
+ ```python
132
+ # Correct: async context manager for WebSocket
133
+ async with self.websocket:
134
+ await self.websocket.send_json({"type": "message"})
135
+
136
+ # Correct: async task creation
137
+ asyncio.create_task(read_output())
138
+
139
+ # Correct: run blocking code in executor
140
+ await asyncio.get_event_loop().run_in_executor(None, blocking_function)
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Internationalization (i18n)
146
+
147
+ The project supports three languages:
148
+ - `zh-TW` - Traditional Chinese (default)
149
+ - `zh-CN` - Simplified Chinese
150
+ - `en` - English
151
+
152
+ Use the i18n manager for user-facing messages:
153
+
154
+ ```python
155
+ from .i18n import get_i18n_manager
156
+
157
+ i18n = get_i18n_manager()
158
+ message = i18n.t("key.path.to.message")
159
+ ```
160
+
161
+ ---
162
+
163
+ ## MCP Tool Definition Pattern
164
+
165
+ Use FastMCP decorators with Pydantic Field for parameter descriptions:
166
+
167
+ ```python
168
+ from fastmcp import FastMCP
169
+ from pydantic import Field
170
+ from typing import Annotated
171
+
172
+ mcp = FastMCP("Server Name")
173
+
174
+ @mcp.tool()
175
+ async def interactive_feedback(
176
+ project_directory: Annotated[str, Field(description="項目目錄路徑")],
177
+ full_report_and_output: Annotated[str, Field(description="完整報告內容")],
178
+ ) -> list:
179
+ """Tool description here."""
180
+ ...
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Pre-commit Hooks
186
+
187
+ Pre-commit hooks run automatically on commit. Key hooks:
188
+ - `trailing-whitespace` - Remove trailing whitespace
189
+ - `end-of-file-fixer` - Ensure files end with newline
190
+ - `check-yaml` / `check-toml` / `check-json` - Validate config files
191
+ - `ruff` - Linting with auto-fix
192
+ - `ruff-format` - Code formatting
193
+
194
+ Manual commands:
195
+ ```bash
196
+ uv run pre-commit run # Run on staged files
197
+ uv run pre-commit run --all-files # Run on all files
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Key Directories
203
+
204
+ ```
205
+ src/mcp_keep_feedback/
206
+ ├── __init__.py # Package exports
207
+ ├── __main__.py # CLI entry point
208
+ ├── server.py # MCP server and tools
209
+ ├── debug.py # Debug logging utilities
210
+ ├── i18n.py # Internationalization
211
+ ├── web/ # Web UI module
212
+ │ ├── main.py # WebUIManager
213
+ │ ├── routes/ # FastAPI routes
214
+ │ ├── models/ # Data models
215
+ │ ├── utils/ # Web utilities
216
+ │ └── constants/ # Message codes
217
+ ├── utils/ # Shared utilities
218
+ │ ├── error_handler.py # Error handling framework
219
+ │ └── resource_manager.py # Resource cleanup
220
+ └── desktop_app/ # Tauri desktop integration
221
+
222
+ tests/
223
+ ├── conftest.py # Pytest fixtures
224
+ ├── unit/ # Unit tests
225
+ ├── integration/ # Integration tests
226
+ ├── fixtures/ # Test data
227
+ └── helpers/ # Test utilities
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Ruff Linting Rules
233
+
234
+ Key enabled rules:
235
+ - `E`, `W` - pycodestyle errors/warnings
236
+ - `F` - Pyflakes
237
+ - `I` - isort
238
+ - `B` - flake8-bugbear
239
+ - `UP` - pyupgrade
240
+ - `S` - bandit (security)
241
+ - `PL` - Pylint
242
+ - `RUF` - Ruff-specific
243
+
244
+ Key ignored rules (see pyproject.toml for full list):
245
+ - `E501` - Line length (handled by formatter)
246
+ - `S101` - Allow assert in tests
247
+ - `T201` - Allow print for debugging
248
+ - `RUF001-003` - Allow Chinese characters
249
+
250
+ ---
251
+
252
+ ## Important Notes
253
+
254
+ 1. **Never suppress type errors** with `# type: ignore` or `as any` without justification
255
+ 2. **Never use bare `except:`** - always specify exception types
256
+ 3. **Always clean up resources** - use the resource manager for processes, files, etc.
257
+ 4. **JSON RPC safety** - Error handling must not affect stdout (used for MCP communication)
258
+ 5. **WebSocket lifecycle** - Use `_safe_close_websocket()` for proper cleanup
259
+ 6. **Subprocess security** - Use `shlex.split()` and `shell=False` for command execution
260
+
261
+ ---
262
+
263
+ ## Publishing
264
+
265
+ ```bash
266
+ # 发布到 PyPI
267
+ make publish
268
+
269
+ # 发布到 TestPyPI
270
+ make publish-test
271
+ ```
272
+
273
+ 环境变量:在 `.env` 文件中设置 `PYPI_TOKEN=pypi-xxx`
274
+
275
+ ---
276
+
277
+ ## Tunable Prompts (可调优提示词)
278
+
279
+ 项目中包含四个核心提示词,用于控制 AI 行为协议。修改时需注意保持一致性。
280
+
281
+ ### 1. prompt-engineering.md (提示工程文档)
282
+
283
+ - **位置**: `docs/prompt-engineering.md`
284
+ - **用途**: 用户参考文档,包含完整的 MCP 模式规则和示例
285
+ - **核心内容**: 绝对视觉隔离、强制闭环调用、无限循环、超时重试等规则
286
+
287
+ ### 2. AUTO_REPLY_MESSAGE (自动回复消息)
288
+
289
+ - **位置**: `src/mcp_keep_feedback/web/models/feedback_session.py` (约第 69-80 行)
290
+ - **用途**: 当用户在 `MCP_AUTO_REPLY_TIMEOUT` 设定时间内未响应时,系统自动发送此消息
291
+ - **核心内容**: 引导 AI 继续调用 `mcp-keep-feedback` 工具,不放弃、不派发子代理
292
+
293
+ ### 3. append_message (强制提醒协议)
294
+
295
+ - **位置**:
296
+ - `src/mcp_keep_feedback/web/models/feedback_session.py` (约第 441-465 行)
297
+ - `src/mcp_keep_feedback/web/main.py` (约第 500-524 行) - 重复定义,需同步修改
298
+ - **用途**: 每次用户提交反馈后,自动附加此协议提醒到反馈内容末尾
299
+ - **核心内容**: 强制闭环调用、无限循环、超时重试、禁止子代理派发等规则
300
+
301
+ ### 修改注意事项
302
+
303
+ 1. **两处 `append_message` 必须同步修改** - `feedback_session.py` 和 `main.py` 中的定义需保持一致
304
+ 2. **协议逻辑关联** - 四个 prompt 共同构成完整的闭环协议,修改一处需考虑其他三处的语义一致性
305
+ 3. **关键词保持** - `[MUST]`、`[STRICTLY FORBIDDEN]`、`[NEVER]` 等强调词对 AI 行为有显著影响
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Fábio Ferreira
4
+
5
+ Portions of this software are modifications and enhancements
6
+ Copyright (c) 2024 Minidoracat
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
@@ -0,0 +1,205 @@
1
+ # Makefile for mcp-keep-feedback development
2
+ # 適用於 mcp-keep-feedback 專案開發
3
+ # Compatible with Windows PowerShell and Unix systems
4
+ # 兼容 Windows PowerShell 和 Unix 系統
5
+
6
+ .PHONY: help install install-dev install-hooks lint format type-check test clean pre-commit-run pre-commit-all update-deps check-rust build-desktop build-desktop-release test-desktop clean-desktop build-all test-all test-func test-web test-desktop-func publish publish-test
7
+
8
+ # 預設目標 - 顯示幫助訊息
9
+ help: ## Show this help message
10
+ @echo "Available commands:"
11
+ @echo ""
12
+ @echo " dev-setup Complete development setup"
13
+ @echo " install Install the package"
14
+ @echo " install-dev Install development dependencies"
15
+ @echo " install-hooks Install pre-commit hooks"
16
+ @echo " lint Run linting with Ruff"
17
+ @echo " lint-fix Run linting with auto-fix"
18
+ @echo " format Format code with Ruff"
19
+ @echo " format-check Check code formatting"
20
+ @echo " type-check Run type checking with mypy"
21
+ @echo " check Run all code quality checks"
22
+ @echo " check-fix Run all checks with auto-fix"
23
+ @echo " pre-commit-run Run pre-commit on staged files"
24
+ @echo " pre-commit-all Run pre-commit on all files"
25
+ @echo " pre-commit-update Update pre-commit hooks"
26
+ @echo " test Run tests"
27
+ @echo " test-cov Run tests with coverage"
28
+ @echo " test-fast Run tests without slow tests"
29
+ @echo " test-func Run functional tests (standard)"
30
+ @echo " test-web Run Web UI tests (continuous)"
31
+ @echo " test-desktop-func Run desktop application functional tests"
32
+ @echo " clean Clean up cache and temporary files"
33
+ @echo " ps-clean PowerShell version of clean (Windows)"
34
+ @echo " update-deps Update dependencies"
35
+ @echo " build Build the package"
36
+ @echo " build-check Check the built package"
37
+ @echo " bump-patch Bump patch version"
38
+ @echo " bump-minor Bump minor version"
39
+ @echo " bump-major Bump major version"
40
+ @echo " publish Publish to PyPI"
41
+ @echo " publish-test Publish to TestPyPI"
42
+ @echo " ci Simulate CI pipeline locally"
43
+ @echo " quick-check Quick check with auto-fix"
44
+ @echo ""
45
+ @echo "Desktop Application Commands:"
46
+ @echo " build-desktop Build desktop application (debug)"
47
+ @echo " build-desktop-release Build desktop application (release)"
48
+ @echo " test-desktop Test desktop application"
49
+ @echo " clean-desktop Clean desktop build artifacts"
50
+ @echo " check-rust Check Rust development environment"
51
+
52
+ # 安裝相關命令
53
+ install: ## Install the package
54
+ uv sync
55
+
56
+ install-dev: ## Install development dependencies
57
+ uv sync --dev
58
+
59
+ install-hooks: ## Install pre-commit hooks
60
+ uv run pre-commit install
61
+ @echo "✅ Pre-commit hooks installed successfully!"
62
+
63
+ # 程式碼品質檢查命令
64
+ lint: ## Run linting with Ruff
65
+ uv run ruff check .
66
+
67
+ lint-fix: ## Run linting with auto-fix
68
+ uv run ruff check . --fix
69
+
70
+ format: ## Format code with Ruff
71
+ uv run ruff format .
72
+
73
+ format-check: ## Check code formatting
74
+ uv run ruff format . --check
75
+
76
+ type-check: ## Run type checking with mypy
77
+ uv run mypy
78
+
79
+ # 組合品質檢查命令
80
+ check: lint format-check type-check ## Run all code quality checks
81
+
82
+ check-fix: lint-fix format type-check ## Run all checks with auto-fix
83
+
84
+ # Pre-commit 相關命令
85
+ pre-commit-run: ## Run pre-commit on staged files
86
+ uv run pre-commit run
87
+
88
+ pre-commit-all: ## Run pre-commit on all files
89
+ uv run pre-commit run --all-files
90
+
91
+ pre-commit-update: ## Update pre-commit hooks
92
+ uv run pre-commit autoupdate
93
+
94
+ # 測試相關命令
95
+ test: ## Run tests
96
+ uv run pytest
97
+
98
+ test-cov: ## Run tests with coverage
99
+ uv run pytest --cov=src/mcp_keep_feedback --cov-report=html --cov-report=term
100
+
101
+ test-fast: ## Run tests without slow tests
102
+ uv run pytest -m "not slow"
103
+
104
+ # 功能測試命令
105
+ test-func: ## Run functional tests (standard)
106
+ uv run python -m mcp_keep_feedback test
107
+
108
+ test-web: ## Run Web UI tests (continuous)
109
+ uvx --no-cache --with-editable . mcp-keep-feedback test --web
110
+
111
+ test-desktop-func: ## Run desktop application functional tests
112
+ uvx --no-cache --with-editable . mcp-keep-feedback test --desktop
113
+
114
+ # 維護相關命令
115
+ clean: ## Clean up cache and temporary files
116
+ @echo "Cleaning up..."
117
+ @if exist ".mypy_cache" rmdir /s /q ".mypy_cache" 2>nul || true
118
+ @if exist ".ruff_cache" rmdir /s /q ".ruff_cache" 2>nul || true
119
+ @if exist ".pytest_cache" rmdir /s /q ".pytest_cache" 2>nul || true
120
+ @if exist "htmlcov" rmdir /s /q "htmlcov" 2>nul || true
121
+ @if exist "dist" rmdir /s /q "dist" 2>nul || true
122
+ @if exist "build" rmdir /s /q "build" 2>nul || true
123
+ @find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
124
+ @find . -name "*.pyc" -delete 2>/dev/null || true
125
+ @find . -name "*.pyo" -delete 2>/dev/null || true
126
+ @find . -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
127
+ @echo "✅ Cleanup completed!"
128
+
129
+ update-deps: ## Update dependencies
130
+ uv sync --upgrade
131
+
132
+ # 建置相關命令
133
+ build: ## Build the package
134
+ uv build
135
+
136
+ build-check: ## Check the built package
137
+ uv run twine check dist/*
138
+
139
+ # 版本發布命令
140
+ bump-patch: ## Bump patch version
141
+ uv run bump2version patch
142
+
143
+ bump-minor: ## Bump minor version
144
+ uv run bump2version minor
145
+
146
+ bump-major: ## Bump major version
147
+ uv run bump2version major
148
+
149
+ # PyPI 发布命令
150
+ publish: ## Publish to PyPI
151
+ @./scripts/publish.sh
152
+
153
+ publish-test: ## Publish to TestPyPI
154
+ @./scripts/publish.sh --test
155
+
156
+ # 開發工作流程
157
+ dev-setup: install-dev install-hooks ## Complete development setup
158
+ @echo "🎉 Development environment setup complete!"
159
+ @echo ""
160
+ @echo "Next steps:"
161
+ @echo " 1. Run 'make check' to verify everything works"
162
+ @echo " 2. Start coding! Pre-commit hooks will run automatically"
163
+ @echo " 3. Use 'make help' to see all available commands"
164
+
165
+ # CI 流程模擬
166
+ ci: clean install-dev pre-commit-all test ## Simulate CI pipeline locally
167
+
168
+ # 快速開發命令
169
+ quick-check: lint-fix format type-check ## Quick check with auto-fix (recommended for development)
170
+
171
+ # Windows PowerShell 專用命令
172
+ ps-clean: ## PowerShell version of clean (Windows)
173
+ powershell -Command "Get-ChildItem -Path . -Recurse -Name '__pycache__' | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue; Get-ChildItem -Path . -Recurse -Name '*.pyc' | Remove-Item -Force -ErrorAction SilentlyContinue; @('.mypy_cache', '.ruff_cache', '.pytest_cache', 'htmlcov', 'dist', 'build') | ForEach-Object { if (Test-Path $$_) { Remove-Item $$_ -Recurse -Force } }"
174
+
175
+ # 桌面應用程式相關命令
176
+ check-rust: ## Check Rust development environment
177
+ @echo "🔍 Checking Rust environment..."
178
+ @rustc --version || (echo "❌ Rust not installed. Please visit https://rustup.rs/" && exit 1)
179
+ @cargo --version || (echo "❌ Cargo not installed" && exit 1)
180
+ @cargo install --list | grep tauri-cli || (echo "⚠️ Tauri CLI not installed, installing..." && cargo install tauri-cli)
181
+ @echo "✅ Rust environment check completed"
182
+
183
+ build-desktop: ## Build desktop application (debug mode)
184
+ @echo "🔨 Building desktop application (debug)..."
185
+ uv run python scripts/build_desktop.py
186
+
187
+ build-desktop-release: ## Build desktop application (release mode)
188
+ @echo "🚀 Building desktop application (release)..."
189
+ uv run python scripts/build_desktop.py --release
190
+
191
+ test-desktop: build-desktop ## Test desktop application
192
+ @echo "🖥️ Testing desktop application..."
193
+ uv run python -m mcp_keep_feedback test --desktop
194
+
195
+ clean-desktop: ## Clean desktop build artifacts
196
+ @echo "🧹 Cleaning desktop build artifacts..."
197
+ uv run python scripts/build_desktop.py --clean
198
+
199
+ # 完整構建流程(包含桌面應用程式)
200
+ build-all: clean build-desktop-release build ## Build complete package with desktop app
201
+ @echo "🎉 Complete build finished!"
202
+
203
+ # 測試所有功能
204
+ test-all: test test-func test-desktop ## Run all tests including desktop and functional tests
205
+ @echo "✅ All tests completed!"