diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 8b01cb5..3c90e24 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "analysis-workflow", - "version": "0.9.0", + "version": "0.9.1", "description": "Conventions for analysis repos where humans and coding agents work side by side: versioned task directories for both, one session, worktree and PR per agent task; worktree-safe output paths; additive write-back to AnnData and SpatialData stores, which record which task wrote what. Ships a skill, guard hooks and the analysis_workflow Python package.", "author": { "name": "quadbio" diff --git a/src/analysis_workflow/cli.py b/src/analysis_workflow/cli.py index 8063186..7bc4f94 100644 --- a/src/analysis_workflow/cli.py +++ b/src/analysis_workflow/cli.py @@ -40,12 +40,15 @@ def _version(directory: str, name: str) -> int | None: return None -def new_task(path: Path, author: str, notebook: str | None = None, today: datetime.date | None = None) -> Path: +def new_task( + path: Path, author: str | None = None, notebook: str | None = None, today: datetime.date | None = None +) -> Path: """Create the task directory ``path`` from the task template; return it. ``path`` is ``analysis///.../__vN``, relative to the working directory or absolute, and ``vN`` must be the next version of ```` beside it, counted over both lanes, in this checkout and the - main one. ``notebook`` (``NN_``) copies the repo's starter notebook into ``notebooks/``. + main one. ``author`` defaults, for a human's task, to the git user name; an agent's task names its model. + ``notebook`` (``NN_``) copies the repo's starter notebook into ``notebooks/``. """ path = Path(path).resolve() checkout, main = _checkouts_of(path) @@ -57,6 +60,12 @@ def new_task(path: Path, author: str, notebook: str | None = None, today: dateti raise ValueError(f"{path.name!r} is not a task name: {form}.") if path.exists(): raise FileExistsError(f"{path} already exists.") + if author is None and m["lane"] == "human": + author = subprocess.run( + ["git", "-C", str(checkout), "config", "user.name"], capture_output=True, text=True + ).stdout.strip() + if not author: + raise ValueError("Pass --author: the model for an agent's task, or a name where git has no `user.name`.") parent = path.parent.relative_to(checkout) found = [ v @@ -95,7 +104,9 @@ def new_task(path: Path, author: str, notebook: str | None = None, today: dateti @app.command("new") def new( path: Path = typer.Argument(..., help="analysis///__v"), - author: str = typer.Option(..., help="A human's initials, or the model, e.g. 'Claude Opus 5.5'."), + author: str | None = typer.Option( + None, help="A human's name or initials (default: the git user name), or the model, e.g. 'Claude Opus 5.5'." + ), notebook: str | None = typer.Option(None, help="Also copy the repo's starter notebook in, as NN_."), ) -> None: """Start a task directory from the task template.""" diff --git a/src/analysis_workflow/task_template/README.md b/src/analysis_workflow/task_template/README.md index c9a4380..6aec379 100644 --- a/src/analysis_workflow/task_template/README.md +++ b/src/analysis_workflow/task_template/README.md @@ -1,7 +1,7 @@ # **Date:** -**Author:** +**Author:** **Id:**