mcp-ticketer 0.4.11__py3-none-any.whl → 2.0.1__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 mcp-ticketer might be problematic. Click here for more details.

Files changed (111) hide show
  1. mcp_ticketer/__init__.py +10 -10
  2. mcp_ticketer/__version__.py +3 -3
  3. mcp_ticketer/adapters/__init__.py +2 -0
  4. mcp_ticketer/adapters/aitrackdown.py +394 -9
  5. mcp_ticketer/adapters/asana/__init__.py +15 -0
  6. mcp_ticketer/adapters/asana/adapter.py +1416 -0
  7. mcp_ticketer/adapters/asana/client.py +292 -0
  8. mcp_ticketer/adapters/asana/mappers.py +348 -0
  9. mcp_ticketer/adapters/asana/types.py +146 -0
  10. mcp_ticketer/adapters/github.py +836 -105
  11. mcp_ticketer/adapters/hybrid.py +47 -5
  12. mcp_ticketer/adapters/jira.py +772 -1
  13. mcp_ticketer/adapters/linear/adapter.py +2293 -108
  14. mcp_ticketer/adapters/linear/client.py +146 -12
  15. mcp_ticketer/adapters/linear/mappers.py +105 -11
  16. mcp_ticketer/adapters/linear/queries.py +168 -1
  17. mcp_ticketer/adapters/linear/types.py +80 -4
  18. mcp_ticketer/analysis/__init__.py +56 -0
  19. mcp_ticketer/analysis/dependency_graph.py +255 -0
  20. mcp_ticketer/analysis/health_assessment.py +304 -0
  21. mcp_ticketer/analysis/orphaned.py +218 -0
  22. mcp_ticketer/analysis/project_status.py +594 -0
  23. mcp_ticketer/analysis/similarity.py +224 -0
  24. mcp_ticketer/analysis/staleness.py +266 -0
  25. mcp_ticketer/automation/__init__.py +11 -0
  26. mcp_ticketer/automation/project_updates.py +378 -0
  27. mcp_ticketer/cache/memory.py +3 -3
  28. mcp_ticketer/cli/adapter_diagnostics.py +4 -2
  29. mcp_ticketer/cli/auggie_configure.py +18 -6
  30. mcp_ticketer/cli/codex_configure.py +175 -60
  31. mcp_ticketer/cli/configure.py +884 -146
  32. mcp_ticketer/cli/cursor_configure.py +314 -0
  33. mcp_ticketer/cli/diagnostics.py +31 -28
  34. mcp_ticketer/cli/discover.py +293 -21
  35. mcp_ticketer/cli/gemini_configure.py +18 -6
  36. mcp_ticketer/cli/init_command.py +880 -0
  37. mcp_ticketer/cli/instruction_commands.py +435 -0
  38. mcp_ticketer/cli/linear_commands.py +99 -15
  39. mcp_ticketer/cli/main.py +109 -2055
  40. mcp_ticketer/cli/mcp_configure.py +673 -99
  41. mcp_ticketer/cli/mcp_server_commands.py +415 -0
  42. mcp_ticketer/cli/migrate_config.py +12 -8
  43. mcp_ticketer/cli/platform_commands.py +6 -6
  44. mcp_ticketer/cli/platform_detection.py +477 -0
  45. mcp_ticketer/cli/platform_installer.py +536 -0
  46. mcp_ticketer/cli/project_update_commands.py +350 -0
  47. mcp_ticketer/cli/queue_commands.py +15 -15
  48. mcp_ticketer/cli/setup_command.py +639 -0
  49. mcp_ticketer/cli/simple_health.py +13 -11
  50. mcp_ticketer/cli/ticket_commands.py +277 -36
  51. mcp_ticketer/cli/update_checker.py +313 -0
  52. mcp_ticketer/cli/utils.py +45 -41
  53. mcp_ticketer/core/__init__.py +35 -1
  54. mcp_ticketer/core/adapter.py +170 -5
  55. mcp_ticketer/core/config.py +38 -31
  56. mcp_ticketer/core/env_discovery.py +33 -3
  57. mcp_ticketer/core/env_loader.py +7 -6
  58. mcp_ticketer/core/exceptions.py +10 -4
  59. mcp_ticketer/core/http_client.py +10 -10
  60. mcp_ticketer/core/instructions.py +405 -0
  61. mcp_ticketer/core/label_manager.py +732 -0
  62. mcp_ticketer/core/mappers.py +32 -20
  63. mcp_ticketer/core/models.py +136 -1
  64. mcp_ticketer/core/onepassword_secrets.py +379 -0
  65. mcp_ticketer/core/priority_matcher.py +463 -0
  66. mcp_ticketer/core/project_config.py +148 -14
  67. mcp_ticketer/core/registry.py +1 -1
  68. mcp_ticketer/core/session_state.py +171 -0
  69. mcp_ticketer/core/state_matcher.py +592 -0
  70. mcp_ticketer/core/url_parser.py +425 -0
  71. mcp_ticketer/core/validators.py +69 -0
  72. mcp_ticketer/defaults/ticket_instructions.md +644 -0
  73. mcp_ticketer/mcp/__init__.py +2 -2
  74. mcp_ticketer/mcp/server/__init__.py +2 -2
  75. mcp_ticketer/mcp/server/diagnostic_helper.py +175 -0
  76. mcp_ticketer/mcp/server/main.py +187 -93
  77. mcp_ticketer/mcp/server/routing.py +655 -0
  78. mcp_ticketer/mcp/server/server_sdk.py +58 -0
  79. mcp_ticketer/mcp/server/tools/__init__.py +37 -9
  80. mcp_ticketer/mcp/server/tools/analysis_tools.py +854 -0
  81. mcp_ticketer/mcp/server/tools/attachment_tools.py +65 -20
  82. mcp_ticketer/mcp/server/tools/bulk_tools.py +259 -202
  83. mcp_ticketer/mcp/server/tools/comment_tools.py +74 -12
  84. mcp_ticketer/mcp/server/tools/config_tools.py +1429 -0
  85. mcp_ticketer/mcp/server/tools/diagnostic_tools.py +211 -0
  86. mcp_ticketer/mcp/server/tools/hierarchy_tools.py +878 -319
  87. mcp_ticketer/mcp/server/tools/instruction_tools.py +295 -0
  88. mcp_ticketer/mcp/server/tools/label_tools.py +942 -0
  89. mcp_ticketer/mcp/server/tools/pr_tools.py +3 -7
  90. mcp_ticketer/mcp/server/tools/project_status_tools.py +158 -0
  91. mcp_ticketer/mcp/server/tools/project_update_tools.py +473 -0
  92. mcp_ticketer/mcp/server/tools/search_tools.py +180 -97
  93. mcp_ticketer/mcp/server/tools/session_tools.py +308 -0
  94. mcp_ticketer/mcp/server/tools/ticket_tools.py +1182 -82
  95. mcp_ticketer/mcp/server/tools/user_ticket_tools.py +364 -0
  96. mcp_ticketer/queue/health_monitor.py +1 -0
  97. mcp_ticketer/queue/manager.py +4 -4
  98. mcp_ticketer/queue/queue.py +3 -3
  99. mcp_ticketer/queue/run_worker.py +1 -1
  100. mcp_ticketer/queue/ticket_registry.py +2 -2
  101. mcp_ticketer/queue/worker.py +15 -13
  102. mcp_ticketer/utils/__init__.py +5 -0
  103. mcp_ticketer/utils/token_utils.py +246 -0
  104. mcp_ticketer-2.0.1.dist-info/METADATA +1366 -0
  105. mcp_ticketer-2.0.1.dist-info/RECORD +122 -0
  106. mcp_ticketer-0.4.11.dist-info/METADATA +0 -496
  107. mcp_ticketer-0.4.11.dist-info/RECORD +0 -77
  108. {mcp_ticketer-0.4.11.dist-info → mcp_ticketer-2.0.1.dist-info}/WHEEL +0 -0
  109. {mcp_ticketer-0.4.11.dist-info → mcp_ticketer-2.0.1.dist-info}/entry_points.txt +0 -0
  110. {mcp_ticketer-0.4.11.dist-info → mcp_ticketer-2.0.1.dist-info}/licenses/LICENSE +0 -0
  111. {mcp_ticketer-0.4.11.dist-info → mcp_ticketer-2.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,295 @@
1
+ """Ticket instructions management tools.
2
+
3
+ This module implements MCP tools for managing ticket writing instructions,
4
+ allowing AI agents to query and customize the guidelines that help create
5
+ well-structured, consistent tickets.
6
+ """
7
+
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ from ....core.instructions import (
12
+ InstructionsError,
13
+ InstructionsValidationError,
14
+ TicketInstructionsManager,
15
+ )
16
+
17
+
18
+ async def instructions_get() -> dict[str, Any]:
19
+ """Get current ticket writing instructions.
20
+
21
+ Retrieves the active instructions for the current project, which may be
22
+ custom project-specific instructions or the default embedded instructions.
23
+
24
+ Returns:
25
+ -------
26
+ A dictionary containing:
27
+ - status: "completed" or "error"
28
+ - instructions: The full instruction text (if successful)
29
+ - source: "custom" or "default" indicating which instructions are active
30
+ - path: Path to custom instructions file (if exists)
31
+ - error: Error message (if failed)
32
+
33
+ Example response:
34
+ {
35
+ "status": "completed",
36
+ "instructions": "# Ticket Writing Guidelines...",
37
+ "source": "custom",
38
+ "path": "/path/to/project/.mcp-ticketer/instructions.md"
39
+ }
40
+
41
+ """
42
+ try:
43
+ # Use current working directory as project directory
44
+ manager = TicketInstructionsManager(project_dir=Path.cwd())
45
+
46
+ # Get instructions
47
+ instructions = manager.get_instructions()
48
+
49
+ # Determine source
50
+ source = "custom" if manager.has_custom_instructions() else "default"
51
+
52
+ # Build response
53
+ response: dict[str, Any] = {
54
+ "status": "completed",
55
+ "instructions": instructions,
56
+ "source": source,
57
+ }
58
+
59
+ # Add path if custom instructions exist
60
+ if source == "custom":
61
+ response["path"] = str(manager.get_instructions_path())
62
+
63
+ return response
64
+
65
+ except InstructionsError as e:
66
+ return {
67
+ "status": "error",
68
+ "error": f"Failed to get instructions: {str(e)}",
69
+ }
70
+ except Exception as e:
71
+ return {
72
+ "status": "error",
73
+ "error": f"Unexpected error: {str(e)}",
74
+ }
75
+
76
+
77
+ async def instructions_set(content: str, source: str = "inline") -> dict[str, Any]:
78
+ r"""Set custom ticket writing instructions for the project.
79
+
80
+ Creates or overwrites custom instructions with the provided content.
81
+ The content is validated before saving.
82
+
83
+ Args:
84
+ ----
85
+ content: The custom instructions content (markdown text)
86
+ source: Source type - "inline" for direct content or "file" for file path
87
+ (currently only "inline" is supported by MCP tools)
88
+
89
+ Returns:
90
+ -------
91
+ A dictionary containing:
92
+ - status: "completed" or "error"
93
+ - message: Success or error message
94
+ - path: Path where instructions were saved (if successful)
95
+ - error: Detailed error message (if failed)
96
+
97
+ Example:
98
+ -------
99
+ To set custom instructions:
100
+ instructions_set(
101
+ content="# Our Team's Ticket Guidelines\\n\\n...",
102
+ source="inline"
103
+ )
104
+
105
+ """
106
+ try:
107
+ # Validate source parameter
108
+ if source not in ["inline", "file"]:
109
+ return {
110
+ "status": "error",
111
+ "error": f"Invalid source '{source}'. Must be 'inline' or 'file'",
112
+ }
113
+
114
+ # Use current working directory as project directory
115
+ manager = TicketInstructionsManager(project_dir=Path.cwd())
116
+
117
+ # Set instructions
118
+ manager.set_instructions(content)
119
+
120
+ # Get path where instructions were saved
121
+ inst_path = manager.get_instructions_path()
122
+
123
+ return {
124
+ "status": "completed",
125
+ "message": "Custom instructions saved successfully",
126
+ "path": str(inst_path),
127
+ }
128
+
129
+ except InstructionsValidationError as e:
130
+ return {
131
+ "status": "error",
132
+ "error": f"Validation failed: {str(e)}",
133
+ "message": "Instructions content did not pass validation checks",
134
+ }
135
+ except InstructionsError as e:
136
+ return {
137
+ "status": "error",
138
+ "error": f"Failed to set instructions: {str(e)}",
139
+ }
140
+ except Exception as e:
141
+ return {
142
+ "status": "error",
143
+ "error": f"Unexpected error: {str(e)}",
144
+ }
145
+
146
+
147
+ async def instructions_reset() -> dict[str, Any]:
148
+ """Reset to default instructions by deleting custom instructions.
149
+
150
+ Removes any custom project-specific instructions, causing the system
151
+ to revert to using the default embedded instructions.
152
+
153
+ Returns:
154
+ -------
155
+ A dictionary containing:
156
+ - status: "completed" or "error"
157
+ - message: Description of what happened
158
+ - error: Error message (if failed)
159
+
160
+ Example response (when custom instructions existed):
161
+ {
162
+ "status": "completed",
163
+ "message": "Custom instructions deleted. Now using defaults."
164
+ }
165
+
166
+ Example response (when no custom instructions):
167
+ {
168
+ "status": "completed",
169
+ "message": "No custom instructions to delete. Already using defaults."
170
+ }
171
+
172
+ """
173
+ try:
174
+ # Use current working directory as project directory
175
+ manager = TicketInstructionsManager(project_dir=Path.cwd())
176
+
177
+ # Check if custom instructions exist
178
+ if not manager.has_custom_instructions():
179
+ return {
180
+ "status": "completed",
181
+ "message": "No custom instructions to delete. Already using defaults.",
182
+ }
183
+
184
+ # Delete custom instructions
185
+ deleted = manager.delete_instructions()
186
+
187
+ if deleted:
188
+ return {
189
+ "status": "completed",
190
+ "message": "Custom instructions deleted. Now using defaults.",
191
+ }
192
+ else:
193
+ return {
194
+ "status": "completed",
195
+ "message": "No custom instructions found to delete.",
196
+ }
197
+
198
+ except InstructionsError as e:
199
+ return {
200
+ "status": "error",
201
+ "error": f"Failed to reset instructions: {str(e)}",
202
+ }
203
+ except Exception as e:
204
+ return {
205
+ "status": "error",
206
+ "error": f"Unexpected error: {str(e)}",
207
+ }
208
+
209
+
210
+ async def instructions_validate(content: str) -> dict[str, Any]:
211
+ """Validate ticket instructions content without saving.
212
+
213
+ Checks if the provided content meets validation requirements:
214
+ - Not empty
215
+ - Minimum length (100 characters)
216
+ - Contains markdown headers (warning only)
217
+
218
+ This allows AI agents to validate content before attempting to save it.
219
+
220
+ Args:
221
+ ----
222
+ content: The instructions content to validate (markdown text)
223
+
224
+ Returns:
225
+ -------
226
+ A dictionary containing:
227
+ - status: "valid" or "invalid"
228
+ - warnings: List of non-critical issues (e.g., missing headers)
229
+ - errors: List of critical validation failures
230
+ - message: Summary message
231
+
232
+ Example response (valid):
233
+ {
234
+ "status": "valid",
235
+ "warnings": ["No markdown headers found"],
236
+ "errors": [],
237
+ "message": "Content is valid but has 1 warning"
238
+ }
239
+
240
+ Example response (invalid):
241
+ {
242
+ "status": "invalid",
243
+ "warnings": [],
244
+ "errors": ["Content too short (50 characters). Minimum 100 required."],
245
+ "message": "Content validation failed"
246
+ }
247
+
248
+ """
249
+ warnings: list[str] = []
250
+ errors: list[str] = []
251
+
252
+ try:
253
+ # Check for empty content
254
+ if not content or not content.strip():
255
+ errors.append("Instructions content cannot be empty")
256
+ else:
257
+ # Check minimum length
258
+ if len(content.strip()) < 100:
259
+ errors.append(
260
+ f"Content too short ({len(content)} characters). "
261
+ "Minimum 100 characters required for meaningful guidelines."
262
+ )
263
+
264
+ # Check for markdown headers (warning only)
265
+ if not any(line.strip().startswith("#") for line in content.split("\n")):
266
+ warnings.append(
267
+ "No markdown headers found. "
268
+ "Consider using headers for better structure."
269
+ )
270
+
271
+ # Determine status
272
+ if errors:
273
+ status = "invalid"
274
+ message = "Content validation failed"
275
+ elif warnings:
276
+ status = "valid"
277
+ message = f"Content is valid but has {len(warnings)} warning(s)"
278
+ else:
279
+ status = "valid"
280
+ message = "Content is valid with no issues"
281
+
282
+ return {
283
+ "status": status,
284
+ "warnings": warnings,
285
+ "errors": errors,
286
+ "message": message,
287
+ }
288
+
289
+ except Exception as e:
290
+ return {
291
+ "status": "error",
292
+ "warnings": [],
293
+ "errors": [f"Validation error: {str(e)}"],
294
+ "message": "Validation process failed",
295
+ }