code-analysis-client-dev 1.6.368__tar.gz → 1.6.370__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 (30) hide show
  1. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/PKG-INFO +1 -1
  2. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/check_chain.py +7 -14
  3. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/server_api.py +24 -21
  4. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/validation.py +8 -0
  5. code_analysis_client_dev-1.6.370/code_analysis_client/version.txt +1 -0
  6. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/worktree.py +57 -91
  7. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client_dev.egg-info/PKG-INFO +1 -1
  8. code_analysis_client_dev-1.6.368/code_analysis_client/version.txt +0 -1
  9. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/README.md +0 -0
  10. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/__init__.py +0 -0
  11. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/client.py +0 -0
  12. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/commands_proxy.py +0 -0
  13. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/config.py +0 -0
  14. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/exceptions.py +0 -0
  15. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/file_session.py +0 -0
  16. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/project.py +0 -0
  17. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/py.typed +0 -0
  18. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/queue_wait.py +0 -0
  19. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/responses.py +0 -0
  20. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/schema_disk_cache.py +0 -0
  21. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/server_schema.py +0 -0
  22. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/symbol_tree.py +0 -0
  23. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/universal_file.py +0 -0
  24. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client/vectorizer_state.py +0 -0
  25. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client_dev.egg-info/SOURCES.txt +0 -0
  26. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client_dev.egg-info/dependency_links.txt +0 -0
  27. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client_dev.egg-info/requires.txt +0 -0
  28. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/code_analysis_client_dev.egg-info/top_level.txt +0 -0
  29. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/pyproject.toml +0 -0
  30. {code_analysis_client_dev-1.6.368 → code_analysis_client_dev-1.6.370}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-analysis-client-dev
3
- Version: 1.6.368
3
+ Version: 1.6.370
4
4
  Summary: Async JSON-RPC client for the code-analysis MCP server (mcp-proxy-adapter JsonRpcClient)
5
5
  Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
6
6
  Requires-Python: >=3.10
@@ -17,6 +17,7 @@ from dataclasses import dataclass, field
17
17
  from typing import TYPE_CHECKING, Any, Dict, List, Optional
18
18
 
19
19
  from code_analysis_client.exceptions import ClientValidationError
20
+ from code_analysis_client.validation import require_non_empty
20
21
  from code_analysis_client.responses import command_error_code, FacadeCaller
21
22
  from code_analysis_client.worktree import WorktreeConflictError
22
23
 
@@ -178,14 +179,6 @@ class FileCheckAndPromoteResult:
178
179
  lock_wait: Optional[Dict[str, float]] = None
179
180
 
180
181
 
181
- def _require_non_empty(value: Any, *, field_name: str) -> str:
182
- """Return stripped text or raise ClientValidationError."""
183
- text = str(value or "").strip()
184
- if not text:
185
- raise ClientValidationError(f"{field_name} is required", field=field_name)
186
- return text
187
-
188
-
189
182
  def _error_parts(data: Dict[str, Any]) -> tuple[str, str, Dict[str, Any]]:
190
183
  """Return (code, message, details) of a failed response."""
191
184
  code = command_error_code(data)
@@ -272,7 +265,7 @@ class CheckChainClient:
272
265
  Calls ``check_chain_list``. Raises CheckChainConfigInvalidError for a
273
266
  malformed registry entry and CheckChainError for other server errors.
274
267
  """
275
- project_id = _require_non_empty(project_id, field_name="project_id")
268
+ project_id = require_non_empty(project_id, field_name="project_id")
276
269
  data = await self._client.call_validated(
277
270
  "check_chain_list", {"project_id": project_id}
278
271
  )
@@ -296,8 +289,8 @@ class CheckChainClient:
296
289
  Calls ``check_chain_get``. An unconfigured extension is source ``empty``
297
290
  with an empty chain.
298
291
  """
299
- project_id = _require_non_empty(project_id, field_name="project_id")
300
- extension = _require_non_empty(extension, field_name="extension")
292
+ project_id = require_non_empty(project_id, field_name="project_id")
293
+ extension = require_non_empty(extension, field_name="extension")
301
294
  if not _EXTENSION_RE.match(extension):
302
295
  raise ClientValidationError(
303
296
  f"extension must match {EXTENSION_PATTERN}", field="extension"
@@ -336,11 +329,11 @@ class CheckChainClient:
336
329
  too (DOCUMENTATION_SERVER_UNAVAILABLE, NOT_FOUND or INTERNAL_ERROR) although
337
330
  the commit is promoted; the edit and the lock stay with the session.
338
331
  """
339
- project_id = _require_non_empty(project_id, field_name="project_id")
340
- editor_session_id = _require_non_empty(
332
+ project_id = require_non_empty(project_id, field_name="project_id")
333
+ editor_session_id = require_non_empty(
341
334
  editor_session_id, field_name="editor_session_id"
342
335
  )
343
- path = _require_non_empty(path, field_name="path")
336
+ path = require_non_empty(path, field_name="path")
344
337
  if not isinstance(content, str):
345
338
  raise ClientValidationError("content must be a string", field="content")
346
339
  if not isinstance(check_only, bool):
@@ -245,15 +245,22 @@ def _command_registered(get_command: Callable[[str], object], name: str) -> bool
245
245
  return False
246
246
 
247
247
 
248
+ def _assert_all_registered(
249
+ get_command: Callable[[str], object], names: FrozenSet[str], message: str
250
+ ) -> None:
251
+ """Raise ``KeyError`` naming every ``names`` entry missing from the registry."""
252
+ missing = [name for name in sorted(names) if not _command_registered(get_command, name)]
253
+ if missing:
254
+ raise KeyError(f"{message}: {missing}")
255
+
256
+
248
257
  def assert_facade_commands_registered(get_command: Callable[[str], object]) -> None:
249
258
  """Raise ``KeyError`` if any facade command is missing from the server registry."""
250
- missing = [
251
- name
252
- for name in sorted(CLIENT_FACADE_COMMANDS)
253
- if not _command_registered(get_command, name)
254
- ]
255
- if missing:
256
- raise KeyError(f"Client facade commands not registered on server: {missing}")
259
+ _assert_all_registered(
260
+ get_command,
261
+ CLIENT_FACADE_COMMANDS,
262
+ "Client facade commands not registered on server",
263
+ )
257
264
 
258
265
 
259
266
  def assert_removed_commands_absent(get_command: Callable[[str], object]) -> None:
@@ -271,21 +278,17 @@ def assert_file_content_read_commands_registered(
271
278
  get_command: Callable[[str], object],
272
279
  ) -> None:
273
280
  """Raise ``KeyError`` if a read-only content command is missing from the registry."""
274
- missing = [
275
- name
276
- for name in sorted(FILE_CONTENT_READ_COMMANDS)
277
- if not _command_registered(get_command, name)
278
- ]
279
- if missing:
280
- raise KeyError(f"File content read commands not registered: {missing}")
281
+ _assert_all_registered(
282
+ get_command,
283
+ FILE_CONTENT_READ_COMMANDS,
284
+ "File content read commands not registered",
285
+ )
281
286
 
282
287
 
283
288
  def assert_fs_commands_registered(get_command: Callable[[str], object]) -> None:
284
289
  """Raise ``KeyError`` if a filesystem helper command is missing from the registry."""
285
- missing = [
286
- name
287
- for name in sorted(FS_COMMANDS)
288
- if not _command_registered(get_command, name)
289
- ]
290
- if missing:
291
- raise KeyError(f"Filesystem commands not registered: {missing}")
290
+ _assert_all_registered(
291
+ get_command,
292
+ FS_COMMANDS,
293
+ "Filesystem commands not registered",
294
+ )
@@ -96,3 +96,11 @@ def validate_params_against_schema(
96
96
  f"{command_name}: required parameter {key!r} is missing",
97
97
  field=key,
98
98
  )
99
+
100
+
101
+ def require_non_empty(value: Any, *, field_name: str) -> str:
102
+ """Return stripped text or raise ClientValidationError for an empty field."""
103
+ text = str(value or "").strip()
104
+ if not text:
105
+ raise ClientValidationError(f"{field_name} is required", field=field_name)
106
+ return text
@@ -13,6 +13,7 @@ from __future__ import annotations
13
13
  from typing import TYPE_CHECKING, Any, Dict, List, Optional
14
14
 
15
15
  from code_analysis_client.exceptions import ClientValidationError
16
+ from code_analysis_client.validation import require_non_empty
16
17
  from code_analysis_client.responses import unwrap_command_result, FacadeCaller
17
18
 
18
19
  if TYPE_CHECKING:
@@ -40,14 +41,6 @@ def _unwrap(data: Dict[str, Any]) -> Dict[str, Any]:
40
41
  return unwrap_command_result(data)
41
42
 
42
43
 
43
- def _require_non_empty(value: Any, *, field: str) -> str:
44
- """Return stripped text or raise ClientValidationError for an empty field."""
45
- text = str(value or "").strip()
46
- if not text:
47
- raise ClientValidationError(f"{field} is required", field=field)
48
- return text
49
-
50
-
51
44
  class WorktreeClient:
52
45
  """Worktree lifecycle and sync management commands."""
53
46
 
@@ -73,8 +66,8 @@ class WorktreeClient:
73
66
 
74
67
  Calls ``worktree_ensure`` per candidate-WT-1.md section 5.1.
75
68
  """
76
- project_id = _require_non_empty(project_id, field="project_id")
77
- name = _require_non_empty(name, field="name")
69
+ project_id = require_non_empty(project_id, field_name="project_id")
70
+ name = require_non_empty(name, field_name="name")
78
71
 
79
72
  params: Dict[str, Any] = {
80
73
  "project_id": project_id,
@@ -104,7 +97,7 @@ class WorktreeClient:
104
97
 
105
98
  Calls ``worktree_list`` per candidate-WT-1.md section 5.2.
106
99
  """
107
- project_id = _require_non_empty(project_id, field="project_id")
100
+ project_id = require_non_empty(project_id, field_name="project_id")
108
101
 
109
102
  params: Dict[str, Any] = {"project_id": project_id}
110
103
  if owner_session_id is not None:
@@ -116,6 +109,35 @@ class WorktreeClient:
116
109
  await self._client.call_validated("worktree_list", params)
117
110
  )
118
111
 
112
+ async def _named_read(self, command: str, project_id: str, name: str) -> Dict[str, Any]:
113
+ """Validate project_id and name, then call one read-only worktree command."""
114
+ project_id = require_non_empty(project_id, field_name="project_id")
115
+ name = require_non_empty(name, field_name="name")
116
+ params: Dict[str, Any] = {"project_id": project_id, "name": name}
117
+ return _unwrap(await self._client.call_validated(command, params))
118
+
119
+ async def _named_op(
120
+ self,
121
+ command: str,
122
+ project_id: str,
123
+ name: str,
124
+ *,
125
+ auto_poll: bool,
126
+ timeout: Optional[float],
127
+ ) -> Dict[str, Any]:
128
+ """Validate project_id and name, then call one polled worktree command."""
129
+ project_id = require_non_empty(project_id, field_name="project_id")
130
+ name = require_non_empty(name, field_name="name")
131
+ params: Dict[str, Any] = {"project_id": project_id, "name": name}
132
+ return _unwrap(
133
+ await self._client.call_validated(
134
+ command,
135
+ params,
136
+ auto_poll=auto_poll,
137
+ timeout=timeout,
138
+ )
139
+ )
140
+
119
141
  async def status(
120
142
  self,
121
143
  project_id: str,
@@ -125,17 +147,7 @@ class WorktreeClient:
125
147
 
126
148
  Calls ``worktree_status`` per candidate-WT-1.md section 5.3.
127
149
  """
128
- project_id = _require_non_empty(project_id, field="project_id")
129
- name = _require_non_empty(name, field="name")
130
-
131
- params: Dict[str, Any] = {
132
- "project_id": project_id,
133
- "name": name,
134
- }
135
-
136
- return _unwrap(
137
- await self._client.call_validated("worktree_status", params)
138
- )
150
+ return await self._named_read("worktree_status", project_id, name)
139
151
 
140
152
  async def diff(
141
153
  self,
@@ -150,8 +162,8 @@ class WorktreeClient:
150
162
 
151
163
  Calls ``worktree_diff`` per candidate-WT-1.md section 5.4.
152
164
  """
153
- project_id = _require_non_empty(project_id, field="project_id")
154
- name = _require_non_empty(name, field="name")
165
+ project_id = require_non_empty(project_id, field_name="project_id")
166
+ name = require_non_empty(name, field_name="name")
155
167
 
156
168
  params: Dict[str, Any] = {
157
169
  "project_id": project_id,
@@ -185,8 +197,8 @@ class WorktreeClient:
185
197
  Calls ``worktree_sync`` per candidate-WT-1.md section 5.5.
186
198
  Raises WorktreeConflictError on WORKTREE_SYNC_CONFLICT.
187
199
  """
188
- project_id = _require_non_empty(project_id, field="project_id")
189
- name = _require_non_empty(name, field="name")
200
+ project_id = require_non_empty(project_id, field_name="project_id")
201
+ name = require_non_empty(name, field_name="name")
190
202
 
191
203
  params: Dict[str, Any] = {
192
204
  "project_id": project_id,
@@ -226,17 +238,7 @@ class WorktreeClient:
226
238
 
227
239
  Calls ``worktree_conflicts`` per candidate-WT-1.md section 5.6.
228
240
  """
229
- project_id = _require_non_empty(project_id, field="project_id")
230
- name = _require_non_empty(name, field="name")
231
-
232
- params: Dict[str, Any] = {
233
- "project_id": project_id,
234
- "name": name,
235
- }
236
-
237
- return _unwrap(
238
- await self._client.call_validated("worktree_conflicts", params)
239
- )
241
+ return await self._named_read("worktree_conflicts", project_id, name)
240
242
 
241
243
  async def continue_(
242
244
  self,
@@ -252,8 +254,8 @@ class WorktreeClient:
252
254
 
253
255
  Calls ``worktree_continue`` per candidate-WT-1.md section 5.7.
254
256
  """
255
- project_id = _require_non_empty(project_id, field="project_id")
256
- name = _require_non_empty(name, field="name")
257
+ project_id = require_non_empty(project_id, field_name="project_id")
258
+ name = require_non_empty(name, field_name="name")
257
259
  if not resolved_paths:
258
260
  raise ClientValidationError(
259
261
  "resolved_paths must be non-empty",
@@ -289,21 +291,8 @@ class WorktreeClient:
289
291
 
290
292
  Calls ``worktree_abort`` per candidate-WT-1.md section 5.8.
291
293
  """
292
- project_id = _require_non_empty(project_id, field="project_id")
293
- name = _require_non_empty(name, field="name")
294
-
295
- params: Dict[str, Any] = {
296
- "project_id": project_id,
297
- "name": name,
298
- }
299
-
300
- return _unwrap(
301
- await self._client.call_validated(
302
- "worktree_abort",
303
- params,
304
- auto_poll=auto_poll,
305
- timeout=timeout,
306
- )
294
+ return await self._named_op(
295
+ "worktree_abort", project_id, name, auto_poll=auto_poll, timeout=timeout
307
296
  )
308
297
 
309
298
  # === Commit and removal ===
@@ -323,9 +312,9 @@ class WorktreeClient:
323
312
 
324
313
  Calls ``worktree_commit`` per candidate-WT-1.md section 5.9.
325
314
  """
326
- project_id = _require_non_empty(project_id, field="project_id")
327
- name = _require_non_empty(name, field="name")
328
- message = _require_non_empty(message, field="message")
315
+ project_id = require_non_empty(project_id, field_name="project_id")
316
+ name = require_non_empty(name, field_name="name")
317
+ message = require_non_empty(message, field_name="message")
329
318
 
330
319
  if not paths and not all:
331
320
  raise ClientValidationError(
@@ -366,8 +355,8 @@ class WorktreeClient:
366
355
 
367
356
  Calls ``worktree_remove`` per candidate-WT-1.md section 5.10.
368
357
  """
369
- project_id = _require_non_empty(project_id, field="project_id")
370
- name = _require_non_empty(name, field="name")
358
+ project_id = require_non_empty(project_id, field_name="project_id")
359
+ name = require_non_empty(name, field_name="name")
371
360
 
372
361
  params: Dict[str, Any] = {
373
362
  "project_id": project_id,
@@ -402,7 +391,7 @@ class WorktreeClient:
402
391
 
403
392
  Calls ``worktree_prune`` per candidate-WT-1.md section 5.11.
404
393
  """
405
- project_id = _require_non_empty(project_id, field="project_id")
394
+ project_id = require_non_empty(project_id, field_name="project_id")
406
395
 
407
396
  params: Dict[str, Any] = {"project_id": project_id}
408
397
  if name is not None:
@@ -436,8 +425,8 @@ class WorktreeClient:
436
425
 
437
426
  Calls ``worktree_lock`` per candidate-WT-1.md section 5.12.
438
427
  """
439
- project_id = _require_non_empty(project_id, field="project_id")
440
- name = _require_non_empty(name, field="name")
428
+ project_id = require_non_empty(project_id, field_name="project_id")
429
+ name = require_non_empty(name, field_name="name")
441
430
 
442
431
  params: Dict[str, Any] = {
443
432
  "project_id": project_id,
@@ -459,17 +448,7 @@ class WorktreeClient:
459
448
 
460
449
  Calls ``worktree_unlock`` per candidate-WT-1.md section 5.13.
461
450
  """
462
- project_id = _require_non_empty(project_id, field="project_id")
463
- name = _require_non_empty(name, field="name")
464
-
465
- params: Dict[str, Any] = {
466
- "project_id": project_id,
467
- "name": name,
468
- }
469
-
470
- return _unwrap(
471
- await self._client.call_validated("worktree_unlock", params)
472
- )
451
+ return await self._named_read("worktree_unlock", project_id, name)
473
452
 
474
453
  async def move(
475
454
  self,
@@ -484,9 +463,9 @@ class WorktreeClient:
484
463
 
485
464
  Calls ``worktree_move`` per candidate-WT-1.md section 5.14.
486
465
  """
487
- project_id = _require_non_empty(project_id, field="project_id")
488
- name = _require_non_empty(name, field="name")
489
- new_name = _require_non_empty(new_name, field="new_name")
466
+ project_id = require_non_empty(project_id, field_name="project_id")
467
+ name = require_non_empty(name, field_name="name")
468
+ new_name = require_non_empty(new_name, field_name="new_name")
490
469
 
491
470
  params: Dict[str, Any] = {
492
471
  "project_id": project_id,
@@ -515,19 +494,6 @@ class WorktreeClient:
515
494
 
516
495
  Calls ``worktree_repair`` per candidate-WT-1.md section 5.15.
517
496
  """
518
- project_id = _require_non_empty(project_id, field="project_id")
519
- name = _require_non_empty(name, field="name")
520
-
521
- params: Dict[str, Any] = {
522
- "project_id": project_id,
523
- "name": name,
524
- }
525
-
526
- return _unwrap(
527
- await self._client.call_validated(
528
- "worktree_repair",
529
- params,
530
- auto_poll=auto_poll,
531
- timeout=timeout,
532
- )
497
+ return await self._named_op(
498
+ "worktree_repair", project_id, name, auto_poll=auto_poll, timeout=timeout
533
499
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-analysis-client-dev
3
- Version: 1.6.368
3
+ Version: 1.6.370
4
4
  Summary: Async JSON-RPC client for the code-analysis MCP server (mcp-proxy-adapter JsonRpcClient)
5
5
  Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
6
6
  Requires-Python: >=3.10