diff --git a/.github/scripts/publish_script.py b/.github/scripts/publish_script.py index 2aafff4..68838e1 100644 --- a/.github/scripts/publish_script.py +++ b/.github/scripts/publish_script.py @@ -159,7 +159,7 @@ def handle_publications(manifest_data: List[Dict[str, Any]]) -> bool: dataset["history"][i] = entry finalize_manifest( manifest_data, - f"ci: Publish {dataset['fileName']} v{entry['version']}", + f"ci: Publish {dataset['fileName']} {entry['version']}", ) return True # Process only one publication per run diff --git a/src/datamanager/__main__.py b/src/datamanager/__main__.py index f50b999..5f75948 100644 --- a/src/datamanager/__main__.py +++ b/src/datamanager/__main__.py @@ -10,7 +10,7 @@ from rich.console import Console from rich.table import Table -from typing import Callable, Optional, cast, Any +from typing import Callable, Optional, Any from datamanager.config import settings from datamanager import core, manifest @@ -27,35 +27,6 @@ ) -# Git helpers -def _stage_all() -> None: - """Stage every working-tree change.""" - subprocess.run(["git", "add", "-A"], check=True) - - -def _build_detached_commit(message: str) -> str: - """ - Create a commit object from the **current index** without - moving HEAD. Returns the full commit SHA. - """ - tree = subprocess.check_output(["git", "write-tree"], text=True).strip() - parent = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip() - sha = subprocess.check_output( - ["git", "commit-tree", tree, "-p", parent, "-m", message], - text=True, - ).strip() - return sha - - -# Prompt helpers -def _ask_text(ctx: typer.Context, prompt: str, default: str) -> str: - if ctx.obj.get("no_prompt"): # ← global flag - console.print(f"[cyan]--yes[/] given – using default message: '{default}'") - return default - result: Optional[str] = questionary.text(prompt, default=default).ask() - return cast(str, result) - - def _ask_confirm(ctx: typer.Context, prompt: str, default: bool = False) -> bool: if ctx.obj.get("no_prompt"): return True @@ -321,7 +292,7 @@ def _run_prepare_logic(ctx: typer.Context, name: str, file: Path) -> None: manifest.add_history_entry(name, new_entry) else: - # --- This is for CREATE + # --- This is for CREATE --- new_dataset_obj = { "fileName": name, "latestVersion": "v1", diff --git a/src/datamanager/manifest.py b/src/datamanager/manifest.py index 3b08c44..eb1813a 100644 --- a/src/datamanager/manifest.py +++ b/src/datamanager/manifest.py @@ -95,7 +95,8 @@ def add_history_entry(name: str, new_entry: dict[str, Any]) -> None: Adds a new version entry to the beginning of a dataset's history. This function is used to add the temporary placeholder before the final - commit hash is known. + commit hash is known. It only works for existing datasets. For creating + new datasets, use add_new_dataset() instead. Args: name: The 'fileName' of the dataset to update. @@ -111,9 +112,8 @@ def add_history_entry(name: str, new_entry: dict[str, Any]) -> None: break if not dataset_found: - # This would be for creating a brand new dataset entry - # For now, we assume we only update existing ones. - # A 'datamanager create' command could use this logic. + # We only update existing datasets. For creating new datasets, + # use add_new_dataset() instead. console.print(f"Dataset '{name}' not found. Cannot add history.") return