-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadditional_parameter_improvements.py
More file actions
235 lines (202 loc) · 7.42 KB
/
additional_parameter_improvements.py
File metadata and controls
235 lines (202 loc) · 7.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
"""
Additional parameter improvements for GitLab MCP tools.
These address specific GitLab API parameters that need better examples and guidance.
"""
# Enhanced parameter documentation for complex GitLab API operations
ADDITIONAL_PARAMETER_IMPROVEMENTS = {
# For issue and MR creation tools
"custom_attributes": {
"description": """Custom attributes for GitLab objects (JSON object).
The keys are custom attribute keys and values are the data to set.
**Example: `{"priority": "high", "team": "backend", "environment": "production"}`**
Common use cases:
- Project categorization: {"department": "engineering", "cost_center": "R&D"}
- Issue tracking: {"severity": "critical", "customer": "enterprise_client", "component": "auth"}
- User metadata: {"role": "tech_lead", "location": "remote", "timezone": "UTC-8"}
- Environment tags: {"env": "production", "region": "us-west", "cluster": "k8s-prod"}
Note: Custom attributes must be enabled at the project or group level.""",
},
# Enhanced scope parameter for search operations
"search_scope": {
"description": """Search scope to limit results (string).
**Examples for different search contexts:**
- Code search: `"blobs"` (search in file contents)
- Issue search: `"issues"` (search in issues only)
- Commit search: `"commits"` (search commit messages and diffs)
- Wiki search: `"wiki_blobs"` (search wiki pages)
- Milestone search: `"milestones"` (search milestone titles/descriptions)
**Example combinations:**
- Find security issues: scope="issues", search="security vulnerability"
- Find authentication code: scope="blobs", search="function authenticate"
- Find bug fix commits: scope="commits", search="fix bug memory leak"
Available scopes depend on the tool - check tool description for valid options.""",
},
# Enhanced merge request options
"merge_options": {
"description": """Merge options configuration (JSON object).
**Example: `{"squash": true, "delete_source_branch": true, "merge_when_pipeline_succeeds": true}`**
Available options:
- `squash`: true/false - Squash commits when merging
- `delete_source_branch`: true/false - Delete source branch after merge
- `merge_when_pipeline_succeeds`: true/false - Auto-merge when CI passes
- `should_remove_source_branch`: true/false - Remove source branch (deprecated, use delete_source_branch)
**Common patterns:**
- Clean merge: `{"squash": true, "delete_source_branch": true}`
- Safe merge: `{"merge_when_pipeline_succeeds": true}`
- Feature branch: `{"squash": false, "delete_source_branch": false}`""",
},
# File operations for commits
"file_actions": {
"description": """File operations for commit creation (array of objects).
Each action object specifies a file operation to perform in the commit.
**Example for multiple operations:**
```json
[
{
"action": "create",
"file_path": "src/new_feature.py",
"content": "def new_function():\\n return 'Hello'"
},
{
"action": "update",
"file_path": "README.md",
"content": "Updated documentation"
},
{
"action": "delete",
"file_path": "deprecated/old_file.py"
}
]
```
**Available actions:**
- `create`: Create new file (content required)
- `update`: Modify existing file (content required)
- `delete`: Remove file (content not needed)
- `move`: Rename/move file (previous_path required)
**Action-specific fields:**
- All actions: `action`, `file_path`
- create/update: `content` (file contents as string)
- move: `previous_path` (original file path)""",
},
# Pipeline configuration
"pipeline_variables": {
"description": """Pipeline variables to pass to CI/CD (JSON object).
Variables are passed as environment variables to pipeline jobs.
**Example: `{"ENVIRONMENT": "staging", "DEPLOY_TARGET": "k8s-staging", "DEBUG": "true"}`**
**Common use cases:**
- Environment control: `{"ENVIRONMENT": "production", "REGION": "us-east-1"}`
- Feature flags: `{"FEATURE_X_ENABLED": "true", "EXPERIMENTAL_MODE": "false"}`
- Deployment config: `{"DEPLOY_TARGET": "staging", "REPLICAS": "3"}`
- Debug options: `{"DEBUG": "true", "VERBOSE": "1", "LOG_LEVEL": "debug"}`
**Best practices:**
- Use uppercase for environment variables
- String values only (numbers as strings: "123" not 123)
- Boolean as strings: "true"/"false"
- Sensitive values should use CI/CD variables, not pipeline variables""",
},
# Advanced filtering for lists
"advanced_filters": {
"description": """Advanced filtering options (JSON object).
**Example: `{"state": "opened", "labels": ["bug", "high-priority"], "created_after": "2024-01-01"}`**
**Common filter combinations:**
For issues:
```json
{
"state": "opened",
"labels": ["bug", "critical"],
"assignee_id": 123,
"created_after": "2024-01-01",
"milestone": "v2.0"
}
```
For merge requests:
```json
{
"state": "opened",
"target_branch": "main",
"author_id": 456,
"updated_after": "2024-01-01",
"wip": "no"
}
```
**Date formats:** Use ISO 8601 format: "2024-01-01" or "2024-01-01T10:30:00Z"
**Arrays:** Use arrays for multiple values: `["bug", "feature"]`
**Booleans:** Use strings: `"yes"/"no"` not `true/false`""",
},
}
# Integration examples showing how these work together
INTEGRATION_EXAMPLES = {
"create_comprehensive_issue": """
Create an issue with all advanced options:
```json
{
"title": "Critical authentication bug in production",
"description": "Users cannot login after latest deployment",
"labels": ["bug", "critical", "security"],
"assignee_ids": [123, 456],
"milestone_id": 42,
"custom_attributes": {
"severity": "critical",
"component": "authentication",
"customer_impact": "high",
"environment": "production"
}
}
```
""",
"advanced_merge_request": """
Create MR with pipeline variables and merge options:
```json
{
"title": "Feature: Add OAuth integration",
"source_branch": "feature/oauth-integration",
"target_branch": "main",
"description": "Implements OAuth 2.0 authentication",
"labels": ["feature", "security"],
"assignee_ids": [789],
"merge_options": {
"squash": true,
"delete_source_branch": true,
"merge_when_pipeline_succeeds": true
},
"pipeline_variables": {
"RUN_SECURITY_SCAN": "true",
"DEPLOY_TO_STAGING": "true",
"NOTIFY_TEAM": "security"
}
}
```
""",
"bulk_file_commit": """
Create commit with multiple file operations:
```json
{
"branch": "feature/refactor-auth",
"commit_message": "Refactor authentication system",
"file_actions": [
{
"action": "create",
"file_path": "src/auth/oauth.py",
"content": "class OAuthProvider:\\n def authenticate(self, token):\\n pass"
},
{
"action": "update",
"file_path": "src/auth/__init__.py",
"content": "from .oauth import OAuthProvider\\nfrom .basic import BasicAuth"
},
{
"action": "delete",
"file_path": "src/auth/deprecated_auth.py"
},
{
"action": "move",
"file_path": "src/auth/basic_auth.py",
"previous_path": "src/auth/basic.py"
}
]
}
```
"""
}
print("Additional parameter improvements ready for integration into tool descriptions")
print("These follow proven patterns for complex GitLab API parameter documentation")