Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "analysis-workflow",
"version": "0.4.0",
"version": "0.4.1",
"description": "Conventions for analysis repos where humans (notebooks) and coding agents (scripts) work side by side: one task per session, worktree and directory; worktree-safe output paths; additive write-back to AnnData zarr working objects. Ships a skill, guard hooks and the analysis_workflow Python package.",
"author": {
"name": "quadbio"
Expand Down
4 changes: 3 additions & 1 deletion hooks/session_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def main() -> int:
print(f"\nEvery Bash command runs on `{variables['CONDA_PREFIX']}`: run `python …` directly.")
else:
print(f"\nNo environment is active: run `pixi run --manifest-path {main_checkout}/pixi.toml --as-is …`.")
if deliverables := os.environ.get("CLAUDE_PLUGIN_OPTION_DELIVERABLES", "").strip():
manifest = json.loads((Path(__file__).parents[1] / ".claude-plugin" / "plugin.json").read_text())
default = manifest["userConfig"]["deliverables"]["default"] # Claude Code sets the variable only once it is saved
if deliverables := os.environ.get("CLAUDE_PLUGIN_OPTION_DELIVERABLES", default).strip():
print(f"Default deliverables, from the plugin settings: {deliverables}.")
return 0

Expand Down
13 changes: 9 additions & 4 deletions tests/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ def test_guards_ignore_repos_that_have_not_adopted_the_plugin(unadopted_repo):

def session_start(cwd: Path, **env: str) -> str:
payload = json.dumps({"hook_event_name": "SessionStart", "cwd": str(cwd)})
environ = {k: v for k, v in os.environ.items() if k != "CLAUDE_ENV_FILE"} | env
environ = {
k: v for k, v in os.environ.items() if k != "CLAUDE_ENV_FILE" and not k.startswith("CLAUDE_PLUGIN_OPTION_")
} | env
return subprocess.run(
[sys.executable, HOOKS / "session_start.py"],
input=payload,
Expand All @@ -310,10 +312,13 @@ def test_session_start_prints_the_rules_only_in_an_adopted_repo(repo, unadopted_
assert session_start(unadopted_repo[0]) == session_start(tmp_path) == ""


def test_session_start_lists_the_default_deliverables_when_set(repo):
def test_session_start_lists_the_default_deliverables(repo):
main, _ = repo
line = "Default deliverables, from the plugin settings: a figure."
assert line in session_start(main, CLAUDE_PLUGIN_OPTION_DELIVERABLES="a figure")
manifest = json.loads((HOOKS.parent / ".claude-plugin" / "plugin.json").read_text())
default = manifest["userConfig"]["deliverables"]["default"]
assert f"Default deliverables, from the plugin settings: {default}." in session_start(main)
line = "Default deliverables, from the plugin settings: a report."
assert line in session_start(main, CLAUDE_PLUGIN_OPTION_DELIVERABLES="a report")
assert "Default deliverables" not in session_start(main, CLAUDE_PLUGIN_OPTION_DELIVERABLES="")


Expand Down
Loading