rosetta-cli 2.0.0__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.
- rosetta_cli/__init__.py +12 -0
- rosetta_cli/__main__.py +6 -0
- rosetta_cli/cli.py +379 -0
- rosetta_cli/commands/__init__.py +5 -0
- rosetta_cli/commands/base_command.py +82 -0
- rosetta_cli/commands/cleanup_command.py +214 -0
- rosetta_cli/commands/list_command.py +70 -0
- rosetta_cli/commands/parse_command.py +205 -0
- rosetta_cli/commands/publish_command.py +113 -0
- rosetta_cli/commands/verify_command.py +46 -0
- rosetta_cli/ims_auth.py +124 -0
- rosetta_cli/ims_config.py +317 -0
- rosetta_cli/ims_publisher.py +859 -0
- rosetta_cli/ims_utils.py +28 -0
- rosetta_cli/ragflow_client.py +928 -0
- rosetta_cli/services/__init__.py +8 -0
- rosetta_cli/services/auth_service.py +114 -0
- rosetta_cli/services/dataset_service.py +72 -0
- rosetta_cli/services/document_data.py +408 -0
- rosetta_cli/services/document_service.py +357 -0
- rosetta_cli/typing_utils.py +49 -0
- rosetta_cli-2.0.0.dist-info/METADATA +639 -0
- rosetta_cli-2.0.0.dist-info/RECORD +26 -0
- rosetta_cli-2.0.0.dist-info/WHEEL +5 -0
- rosetta_cli-2.0.0.dist-info/entry_points.txt +2 -0
- rosetta_cli-2.0.0.dist-info/top_level.txt +1 -0
rosetta_cli/ims_utils.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Shared path utilities for Rosetta CLI."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def resolve_workspace_root(path: Path) -> Path:
|
|
7
|
+
"""Resolve the workspace root for a publish target.
|
|
8
|
+
|
|
9
|
+
Preference order:
|
|
10
|
+
1. Parent of the topmost `instructions/` directory in the target path.
|
|
11
|
+
2. Nearest ancestor containing `.git`.
|
|
12
|
+
3. The target directory itself, or the parent for a file target.
|
|
13
|
+
"""
|
|
14
|
+
resolved = path.resolve()
|
|
15
|
+
container = resolved if resolved.is_dir() else resolved.parent
|
|
16
|
+
|
|
17
|
+
parts = container.parts
|
|
18
|
+
for index, part in enumerate(parts):
|
|
19
|
+
if part == "instructions" and index > 0:
|
|
20
|
+
return Path(*parts[:index])
|
|
21
|
+
|
|
22
|
+
current = container
|
|
23
|
+
while current != current.parent:
|
|
24
|
+
if (current / ".git").exists():
|
|
25
|
+
return current
|
|
26
|
+
current = current.parent
|
|
27
|
+
|
|
28
|
+
return container
|