lucius-mcp 0.1.0__py3-none-any.whl → 0.2.2__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.
- {lucius_mcp-0.1.0.dist-info → lucius_mcp-0.2.2.dist-info}/METADATA +23 -2
- {lucius_mcp-0.1.0.dist-info → lucius_mcp-0.2.2.dist-info}/RECORD +29 -14
- src/client/client.py +105 -0
- src/client/generated/README.md +65 -7
- src/client/generated/__init__.py +16 -0
- src/client/generated/api/__init__.py +8 -0
- src/client/generated/api/custom_field_controller_api.py +2617 -0
- src/client/generated/api/custom_field_project_controller_api.py +2337 -0
- src/client/generated/api/custom_field_project_controller_v2_api.py +659 -0
- src/client/generated/api/custom_field_schema_controller_api.py +1710 -0
- src/client/generated/api/custom_field_value_controller_api.py +3106 -0
- src/client/generated/api/custom_field_value_project_controller_api.py +1835 -0
- src/client/generated/api/project_controller_api.py +2986 -0
- src/client/generated/api/status_controller_api.py +1780 -0
- src/client/generated/docs/CustomFieldControllerApi.md +616 -0
- src/client/generated/docs/CustomFieldProjectControllerApi.md +554 -0
- src/client/generated/docs/CustomFieldProjectControllerV2Api.md +149 -0
- src/client/generated/docs/CustomFieldSchemaControllerApi.md +421 -0
- src/client/generated/docs/CustomFieldValueControllerApi.md +723 -0
- src/client/generated/docs/CustomFieldValueProjectControllerApi.md +430 -0
- src/client/generated/docs/LaunchControllerApi.md +2 -2
- src/client/generated/docs/ProjectControllerApi.md +717 -0
- src/client/generated/docs/StatusControllerApi.md +429 -0
- src/services/test_case_service.py +92 -33
- src/tools/__init__.py +3 -0
- src/tools/get_custom_fields.py +48 -0
- src/client/refactor-hotspots.md +0 -53
- src/client/refactor-plan.md +0 -78
- {lucius_mcp-0.1.0.dist-info → lucius_mcp-0.2.2.dist-info}/WHEEL +0 -0
- {lucius_mcp-0.1.0.dist-info → lucius_mcp-0.2.2.dist-info}/entry_points.txt +0 -0
- {lucius_mcp-0.1.0.dist-info → lucius_mcp-0.2.2.dist-info}/licenses/LICENSE +0 -0
src/client/refactor-hotspots.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Refactor Hotspots in `src/client/client.py`
|
|
2
|
-
|
|
3
|
-
Below are the main repetition hotspots identified in `src/client/client.py` with ordered numbering and detailed explanations.
|
|
4
|
-
|
|
5
|
-
1. **Repeated “entered” guard across public methods**
|
|
6
|
-
- **Where:** Multiple methods begin with the same check:
|
|
7
|
-
`if not self._is_entered: raise AllureAPIError("Client not initialized. Use 'async with AllureClient(...)'")`
|
|
8
|
-
(e.g., `create_test_case` at `src/client/client.py:397`, `list_test_cases` at `:462`, `upload_attachment` at `:510`, `create_scenario_step` at `:551`, `get_test_case` at `:634`, `delete_test_case` at `:846`, and many others).
|
|
9
|
-
- **Why it’s repetitive:** The guard is identical and repeated across nearly every API-facing method.
|
|
10
|
-
- **Refactor idea:** Add a private helper (e.g., `_require_entered()`) that encapsulates this check, and call it at the top of each method.
|
|
11
|
-
|
|
12
|
-
2. **Token refresh + API existence checks repeated**
|
|
13
|
-
- **Where:** Pattern appears in most methods:
|
|
14
|
-
`await self._ensure_valid_token()` then `if self._X_api is None: raise AllureAPIError("Internal error: X_api not initialized")`
|
|
15
|
-
(e.g., `create_test_case` at `:400-404`, `list_test_cases` at `:465-468`, `upload_attachment` at `:513-515`, `create_scenario_step` at `:554-556`, `get_test_case` at `:637-639`).
|
|
16
|
-
- **Why it’s repetitive:** Each method repeats the same two steps, only the controller attribute changes.
|
|
17
|
-
- **Refactor idea:** Provide a helper like `_require_api(attr_name: str)` that ensures valid token and returns the controller or raises consistently.
|
|
18
|
-
|
|
19
|
-
3. **Boilerplate `ApiException` mapping block**
|
|
20
|
-
- **Where:** Many methods wrap API calls in `try/except` that only invokes `_handle_api_exception` and re-raises
|
|
21
|
-
(e.g., `create_test_case` at `:408-416`, `list_test_cases` at `:479-489`, `upload_attachment` at `:517-525`, `delete_scenario_step` at `:611-618`, `update_test_case` at `:705-714`).
|
|
22
|
-
- **Why it’s repetitive:** The `try/except` structure is identical across methods with only the API call inside changing.
|
|
23
|
-
- **Refactor idea:** Add a helper like `_call_api(coro)` that awaits the coroutine and handles `ApiException` centrally.
|
|
24
|
-
|
|
25
|
-
4. **Scenario step creation logic duplicated**
|
|
26
|
-
- **Where:** `create_scenario_step` and `create_shared_step_scenario_step`
|
|
27
|
-
(`src/client/client.py:527-593` and `:933-976`).
|
|
28
|
-
- **Why it’s repetitive:** Both methods call `*_without_preload_content`, validate the HTTP status, parse JSON, and construct `ScenarioStepCreatedResponseDto` in the same way.
|
|
29
|
-
- **Refactor idea:** Extract a shared helper (e.g., `_create_scenario_step_via_api(api, step, after_id=None, with_expected_result=False)`) that performs the common workflow.
|
|
30
|
-
|
|
31
|
-
5. **Attachment upload methods are structurally identical**
|
|
32
|
-
- **Where:** `upload_attachment` and `upload_shared_step_attachment`
|
|
33
|
-
(`src/client/client.py:491-525` and `:978-1007`).
|
|
34
|
-
- **Why it’s repetitive:** Both methods follow the same structure: ensure entered, refresh token, check controller, call `createXX`, handle `ApiException`.
|
|
35
|
-
- **Refactor idea:** Use a shared private method that takes the controller and ID parameter name/value (test case vs shared step) and file data.
|
|
36
|
-
|
|
37
|
-
6. **Two attributes for the same controller type**
|
|
38
|
-
- **Where:** `_scenario_api` and `_test_case_scenario_api` both use `TestCaseScenarioControllerApi` in `__init__` and `_ensure_valid_token`
|
|
39
|
-
(`src/client/client.py:173-175` and `:309-310`).
|
|
40
|
-
- **Why it’s repetitive:** Maintaining separate attributes for the same class adds duplicated initialization and checks without a functional difference.
|
|
41
|
-
- **Refactor idea:** Keep a single attribute (e.g., `_scenario_api`) and reuse it for both operations, or wrap access in a helper to avoid duplicated state.
|
|
42
|
-
|
|
43
|
-
7. **Repeated “internal error” strings for uninitialized controllers**
|
|
44
|
-
- **Where:** Many methods raise nearly identical errors with only the controller name changed
|
|
45
|
-
(e.g., `:402`, `:467`, `:515`, `:556`, `:609`, `:639`, `:703`, `:734`, `:918`, `:950`, `:997`, `:1020`, `:1047`, `:1076`).
|
|
46
|
-
- **Why it’s repetitive:** These strings are copy-pasted and differ only in the controller identifier.
|
|
47
|
-
- **Refactor idea:** Centralize the error generation in a helper (e.g., `_raise_missing_api("test_case")`).
|
|
48
|
-
|
|
49
|
-
8. **Duplicate entries in `__all__`**
|
|
50
|
-
- **Where:** `ScenarioStepCreateDto` and `ScenarioStepCreatedResponseDto` appear twice
|
|
51
|
-
(`src/client/client.py:97-100`).
|
|
52
|
-
- **Why it’s repetitive:** The export list contains duplicates, which is unnecessary and can be cleaned up for clarity.
|
|
53
|
-
- **Refactor idea:** Remove duplicates from `__all__`.
|
src/client/refactor-plan.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Refactor Plan for `src/client/client.py`
|
|
2
|
-
|
|
3
|
-
This plan targets the repetition hotspots documented in `src/client/refactor-hotspots.md` and keeps behavior unchanged.
|
|
4
|
-
|
|
5
|
-
## Goals
|
|
6
|
-
- Reduce repeated guards, token refresh checks, and exception handling boilerplate.
|
|
7
|
-
- Centralize controller access and error messaging.
|
|
8
|
-
- Deduplicate scenario step creation and attachment upload flows.
|
|
9
|
-
- Keep API behavior and error semantics identical.
|
|
10
|
-
|
|
11
|
-
## Non-goals
|
|
12
|
-
- No functional changes to API behavior or response handling.
|
|
13
|
-
- No changes to external interfaces beyond internal helper use.
|
|
14
|
-
- No changes to configuration, logging, or test behavior.
|
|
15
|
-
|
|
16
|
-
## Step-by-step plan
|
|
17
|
-
|
|
18
|
-
1. **Introduce a shared “entered” guard helper**
|
|
19
|
-
- **Why:** Replaces repeated `if not self._is_entered ...` checks across methods (e.g., `src/client/client.py:397`, `:462`, `:510`, `:551`, `:634`, `:846`).
|
|
20
|
-
- **Action:** Add a private method (e.g., `_require_entered(self) -> None`) and use it at the top of public API methods.
|
|
21
|
-
- **Behavioral constraint:** Same exception type/message as today.
|
|
22
|
-
|
|
23
|
-
2. **Add a controller access helper that includes token refresh**
|
|
24
|
-
- **Why:** Many methods do `await self._ensure_valid_token()` and then check a controller attribute (e.g., `:400-404`, `:465-468`, `:513-515`, `:554-556`, `:637-639`).
|
|
25
|
-
- **Action:** Add a helper such as:
|
|
26
|
-
- `_get_api(self, attr_name: str) -> ControllerType`
|
|
27
|
-
- It should call `_require_entered()`, await `_ensure_valid_token()`, and return the controller or raise the same “Internal error: X_api not initialized” message.
|
|
28
|
-
- **Behavioral constraint:** Preserve error text formatting exactly.
|
|
29
|
-
|
|
30
|
-
3. **Centralize `ApiException` mapping**
|
|
31
|
-
- **Why:** Many methods have identical `try/except ApiException` blocks calling `_handle_api_exception` (e.g., `:408-416`, `:479-489`, `:517-525`, `:611-618`, `:705-714`).
|
|
32
|
-
- **Action:** Create a helper wrapper such as `_call_api(self, coro: Awaitable[T]) -> T` that awaits the call, catches `ApiException`, routes to `_handle_api_exception`, then re-raises.
|
|
33
|
-
- **Behavioral constraint:** Preserve the same exception mapping and logging.
|
|
34
|
-
|
|
35
|
-
4. **Extract common scenario step creation logic**
|
|
36
|
-
- **Why:** `create_scenario_step` and `create_shared_step_scenario_step` are nearly identical (see `src/client/client.py:527-593` and `:933-976`).
|
|
37
|
-
- **Action:** Add a private helper like `_create_scenario_step_via_api(...)` that:
|
|
38
|
-
- Calls the `*_without_preload_content` endpoint
|
|
39
|
-
- Validates HTTP status
|
|
40
|
-
- Parses JSON
|
|
41
|
-
- Returns `ScenarioStepCreatedResponseDto.model_construct(...)`
|
|
42
|
-
- **Behavioral constraint:** Keep the same status validation and response parsing.
|
|
43
|
-
|
|
44
|
-
5. **Extract common attachment upload logic**
|
|
45
|
-
- **Why:** `upload_attachment` and `upload_shared_step_attachment` repeat the same flow (`src/client/client.py:491-525`, `:978-1007`).
|
|
46
|
-
- **Action:** Create a helper to accept controller + target ID + file data, and invoke the corresponding `createXX` method.
|
|
47
|
-
- **Behavioral constraint:** Same exception handling and timeout usage.
|
|
48
|
-
|
|
49
|
-
6. **Consolidate scenario controller attributes**
|
|
50
|
-
- **Why:** Both `_scenario_api` and `_test_case_scenario_api` are `TestCaseScenarioControllerApi` (see `:173-175`, initialization in `:309-310`).
|
|
51
|
-
- **Action:** Keep a single attribute (prefer `_scenario_api`) and update usages to that single field.
|
|
52
|
-
- **Behavioral constraint:** No change in which endpoints are called.
|
|
53
|
-
|
|
54
|
-
7. **Centralize “internal error” message formatting**
|
|
55
|
-
- **Why:** Repeated strings with only controller name changed (e.g., `:402`, `:467`, `:515`, `:556`, `:609`, `:639`, `:703`, `:734`, `:918`, `:950`, `:997`, `:1020`, `:1047`, `:1076`).
|
|
56
|
-
- **Action:** Add a helper that formats and raises the same `AllureAPIError` message.
|
|
57
|
-
- **Behavioral constraint:** Preserve exact wording.
|
|
58
|
-
|
|
59
|
-
8. **Clean up duplicate entries in `__all__`**
|
|
60
|
-
- **Why:** `ScenarioStepCreateDto` and `ScenarioStepCreatedResponseDto` appear twice (`src/client/client.py:97-100`).
|
|
61
|
-
- **Action:** Remove duplicates to keep `__all__` concise and accurate.
|
|
62
|
-
|
|
63
|
-
9. **Validation & regression checks**
|
|
64
|
-
- **Action:** After refactor, review call sites to ensure all exceptions, timeouts, and API calls are unchanged.
|
|
65
|
-
- **Optional:** Run unit/integration tests if desired (per project test instructions).
|
|
66
|
-
|
|
67
|
-
## Helper signatures (non-binding)
|
|
68
|
-
- `_require_entered(self) -> None`
|
|
69
|
-
- `_get_api(self, attr_name: str) -> ControllerType`
|
|
70
|
-
- `_call_api(self, coro: Awaitable[T]) -> T`
|
|
71
|
-
- `_raise_missing_api(self, api_name: str) -> None`
|
|
72
|
-
- `_create_scenario_step_via_api(...) -> ScenarioStepCreatedResponseDto`
|
|
73
|
-
- `_upload_attachment_via_api(...) -> list[AttachmentRowType]`
|
|
74
|
-
|
|
75
|
-
## Notes
|
|
76
|
-
- Keep new helpers type-annotated without introducing `Any`.
|
|
77
|
-
- Maintain all existing exception classes and messages.
|
|
78
|
-
- Avoid changing public method signatures.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|