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.
@@ -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