From 8f59b5c1dc00e53be37d655104b9d4b5674b0c47 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 06:40:42 +0000 Subject: [PATCH] Implement workspace setup skill Co-authored-by: julwrites <18639913+julwrites@users.noreply.github.com> --- .claude/skills/workspace/SKILL.md | 13 ++++ ...-planning-and-isolation-workspace-setup.md | 2 +- scripts/workspace.py | 61 +++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .claude/skills/workspace/SKILL.md create mode 100755 scripts/workspace.py diff --git a/.claude/skills/workspace/SKILL.md b/.claude/skills/workspace/SKILL.md new file mode 100644 index 0000000..6026981 --- /dev/null +++ b/.claude/skills/workspace/SKILL.md @@ -0,0 +1,13 @@ +--- +name: workspace +description: Ensure clean isolation before coding. Automates branching, establishes a test baseline, and ensures environment readiness. +--- + +# Workspace + +Ensure clean isolation before coding. Automates branching, runs tests to establish a baseline, and ensures the environment is ready for a new task. + +### Run Workspace Setup +```bash +python3 scripts/workspace.py setup +``` diff --git a/docs/tasks/features/FEATURES-20260305-171247-LAG-implement-phase-1-planning-and-isolation-workspace-setup.md b/docs/tasks/features/FEATURES-20260305-171247-LAG-implement-phase-1-planning-and-isolation-workspace-setup.md index 04bc194..86874e2 100644 --- a/docs/tasks/features/FEATURES-20260305-171247-LAG-implement-phase-1-planning-and-isolation-workspace-setup.md +++ b/docs/tasks/features/FEATURES-20260305-171247-LAG-implement-phase-1-planning-and-isolation-workspace-setup.md @@ -1,6 +1,6 @@ --- id: FEATURES-20260305-171247-LAG -status: pending +status: completed title: Implement Phase 1 Planning and Isolation Workspace Setup priority: medium created: 2026-03-05 17:12:47 diff --git a/scripts/workspace.py b/scripts/workspace.py new file mode 100755 index 0000000..9f30683 --- /dev/null +++ b/scripts/workspace.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +""" +Workspace skill backing script. +Ensures clean isolation before coding. +Automates branching and runs tests to establish a baseline. +""" + +import os +import sys +import subprocess +import argparse + +def setup_workspace(task_id): + """ + Sets up the workspace for a given task ID. + Runs `quality verify` and checks out a new branch. + """ + print(f"Setting up workspace for task: {task_id}") + print("-" * 50) + + # Step 1: Run quality verify to establish a test baseline + print("Running quality verify to establish a test baseline...") + + repo_root = os.environ.get("TASKS_REPO_ROOT", os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + quality_script = os.path.join(repo_root, "scripts", "quality.py") + + result = subprocess.run([sys.executable, quality_script, "verify"], cwd=repo_root) + + if result.returncode != 0: + print("\nError: `quality verify` failed. Please fix the baseline before starting a new task.", file=sys.stderr) + sys.exit(1) + + print("\nQuality verify passed. Baseline established.") + + # Step 2: Check out a new branch + print(f"Creating and checking out branch: {task_id}...") + + git_result = subprocess.run(["git", "checkout", "-b", task_id], cwd=repo_root) + + if git_result.returncode != 0: + print(f"\nError: Failed to create or checkout branch '{task_id}'.", file=sys.stderr) + sys.exit(1) + + print(f"\nWorkspace is ready. You are now on branch: {task_id}") + +def main(): + parser = argparse.ArgumentParser(description="Workspace Setup Tool") + subparsers = parser.add_subparsers(dest="command", help="Command to run") + + setup_parser = subparsers.add_parser("setup", help="Set up workspace for a new task") + setup_parser.add_argument("task_id", help="The ID of the task to start working on") + + args = parser.parse_args() + + if args.command == "setup": + setup_workspace(args.task_id) + else: + parser.print_help() + +if __name__ == "__main__": + main()