Skip to content

Commit 39ac7e4

Browse files
author
pragya247
committed
Add Azure DevOps work item synchronization with handoffs system
1 parent b55d00b commit 39ac7e4

8 files changed

Lines changed: 2133 additions & 1 deletion

File tree

‎scripts/bash/create-ado-workitems.sh‎

Lines changed: 469 additions & 0 deletions
Large diffs are not rendered by default.

‎scripts/powershell/create-ado-workitems.ps1‎

Lines changed: 574 additions & 0 deletions
Large diffs are not rendered by default.

‎templates/commands/adosync.md‎

Lines changed: 496 additions & 0 deletions
Large diffs are not rendered by default.

‎templates/commands/plan.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ handoffs:
55
agent: speckit.tasks
66
prompt: Break the plan into tasks
77
send: true
8+
- label: Sync Tasks to Azure DevOps
9+
agent: speckit.adosync
10+
prompt: |
11+
Read the tasks.md file and show me all the tasks that will be created in Azure DevOps.
12+
Ask me which tasks I want to sync (I can say "all", specific numbers like "1,2,3", or ranges like "1-10").
13+
Then use the create-ado-workitems-oauth.ps1 script with the -FromTasks flag to create Task work items in Azure DevOps.
14+
The script will automatically link tasks to their parent User Stories based on the [US#] references in the task descriptions.
15+
Make sure to show me a preview before creating the work items.
16+
send: true
817
- label: Create Checklist
918
agent: speckit.checklist
1019
prompt: Create a checklist for the following domain...

‎templates/commands/specify.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
---
22
description: Create or update the feature specification from a natural language feature description.
33
handoffs:
4+
- label: Sync to Azure DevOps
5+
agent: speckit.adosync
6+
prompt: |
7+
Sync user stories from the spec.md we just created to Azure DevOps.
8+
9+
The spec file path is: {spec_file_path}
10+
11+
Please:
12+
1. Show me the list of user stories found
13+
2. Ask which ones I want to sync (or suggest 'all')
14+
3. Create the work items in Azure DevOps
15+
send: true
416
- label: Build Technical Plan
517
agent: speckit.plan
618
prompt: Create a plan for the spec. I am building with...
@@ -193,7 +205,7 @@ Given that feature description, do this:
193205

194206
d. **Update Checklist**: After each validation iteration, update the checklist file with current pass/fail status
195207

196-
7. Report completion with branch name, spec file path, checklist results, and readiness for the next phase (`/speckit.clarify` or `/speckit.plan`).
208+
7. Report completion with branch name, spec file path, checklist results, and readiness for the next phase (`/speckit.clarify` or `/speckit.adosync` or `/speckit.plan`).
197209

198210
**NOTE:** The script creates and checks out the new branch and initializes the spec file before writing.
199211

‎templates/commands/tasks.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
33
handoffs:
4+
- label: Sync to Azure DevOps
5+
agent: speckit.adosync
6+
prompt: Sync user stories to Azure DevOps
7+
send: false
48
- label: Analyze For Consistency
59
agent: speckit.analyze
610
prompt: Run a project analysis for consistency

‎tests/test_ai_skills.py‎

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,272 @@ def test_ai_skills_flag_appears_in_help(self):
632632
assert "agent skills" in plain.lower()
633633

634634

635+
class TestHandoffsFieldInSkills:
636+
"""Test handling of handoffs field in command templates for AI skills (ADO sync feature)."""
637+
638+
def test_skill_generation_with_handoffs_in_template(self, project_dir):
639+
"""Skills should generate successfully from templates containing handoffs field."""
640+
# Create template with handoffs
641+
cmds_dir = project_dir / ".claude" / "commands"
642+
cmds_dir.mkdir(parents=True)
643+
644+
(cmds_dir / "specify.md").write_text(
645+
"---\n"
646+
"description: Create specification\n"
647+
"handoffs:\n"
648+
" - label: Sync to Azure DevOps\n"
649+
" agent: speckit.adosync\n"
650+
" prompt: Sync user stories to ADO\n"
651+
" send: true\n"
652+
" - label: Build Plan\n"
653+
" agent: speckit.plan\n"
654+
" send: false\n"
655+
"---\n"
656+
"\n"
657+
"# Specify Command\n"
658+
"\n"
659+
"Create specs.\n",
660+
encoding="utf-8",
661+
)
662+
663+
result = install_ai_skills(project_dir, "claude")
664+
665+
assert result is True
666+
skill_file = project_dir / ".claude" / "skills" / "speckit-specify" / "SKILL.md"
667+
assert skill_file.exists()
668+
content = skill_file.read_text()
669+
670+
# Verify skill has valid structure
671+
assert "name: speckit-specify" in content
672+
assert "description:" in content
673+
# Body content should be preserved
674+
assert "Create specs." in content
675+
676+
def test_skill_generation_with_multiline_handoffs_prompt(self, project_dir):
677+
"""Skills should generate successfully from templates with multiline handoffs prompts."""
678+
cmds_dir = project_dir / ".claude" / "commands"
679+
cmds_dir.mkdir(parents=True)
680+
681+
(cmds_dir / "plan.md").write_text(
682+
"---\n"
683+
"description: Create plan\n"
684+
"handoffs:\n"
685+
" - label: Sync Tasks\n"
686+
" agent: speckit.adosync\n"
687+
" prompt: |\n"
688+
" Read the tasks.md file and show me all the tasks.\n"
689+
" Ask me which tasks I want to sync.\n"
690+
" Then create Task work items in Azure DevOps.\n"
691+
" send: true\n"
692+
"---\n"
693+
"\n"
694+
"# Plan\n"
695+
"\n"
696+
"Plan body.\n",
697+
encoding="utf-8",
698+
)
699+
700+
result = install_ai_skills(project_dir, "claude")
701+
702+
assert result is True
703+
skill_file = project_dir / ".claude" / "skills" / "speckit-plan" / "SKILL.md"
704+
content = skill_file.read_text()
705+
706+
# Verify skill was generated successfully
707+
assert "name: speckit-plan" in content
708+
assert "Plan body." in content
709+
710+
def test_handoffs_field_parseable_in_generated_skill(self, project_dir):
711+
"""Generated SKILL.md should have valid parseable YAML regardless of source frontmatter."""
712+
cmds_dir = project_dir / ".claude" / "commands"
713+
cmds_dir.mkdir(parents=True)
714+
715+
(cmds_dir / "tasks.md").write_text(
716+
"---\n"
717+
"description: Generate tasks\n"
718+
"handoffs:\n"
719+
" - label: Sync to ADO\n"
720+
" agent: speckit.adosync\n"
721+
" prompt: Sync tasks to Azure DevOps\n"
722+
"---\n"
723+
"\n"
724+
"# Tasks\n"
725+
"\n"
726+
"Task content.\n",
727+
encoding="utf-8",
728+
)
729+
730+
install_ai_skills(project_dir, "claude")
731+
732+
skill_file = project_dir / ".claude" / "skills" / "speckit-tasks" / "SKILL.md"
733+
content = skill_file.read_text()
734+
735+
# Extract and parse frontmatter to verify it's valid YAML
736+
parts = content.split("---", 2)
737+
assert len(parts) >= 3
738+
parsed = yaml.safe_load(parts[1])
739+
740+
# The generated SKILL.md should have agentskills.io compliant frontmatter
741+
assert isinstance(parsed, dict)
742+
assert "name" in parsed
743+
assert parsed["name"] == "speckit-tasks"
744+
assert "description" in parsed
745+
assert "compatibility" in parsed
746+
747+
# Body should be preserved
748+
assert "Task content." in content
749+
750+
def test_templates_with_handoffs_and_scripts_fields(self, project_dir):
751+
"""Skills should generate from templates with multiple complex fields like handoffs and scripts."""
752+
cmds_dir = project_dir / ".claude" / "commands"
753+
cmds_dir.mkdir(parents=True)
754+
755+
(cmds_dir / "specify.md").write_text(
756+
"---\n"
757+
"description: Spec command\n"
758+
"handoffs:\n"
759+
" - label: Sync to ADO\n"
760+
" agent: speckit.adosync\n"
761+
" prompt: |\n"
762+
" Sync user stories from spec.md.\n"
763+
" The spec file path is: {spec_file_path}\n"
764+
"scripts:\n"
765+
" sh: scripts/bash/create-new-feature.sh\n"
766+
" ps: scripts/powershell/create-new-feature.ps1\n"
767+
"---\n"
768+
"\n"
769+
"# Specify\n"
770+
"\n"
771+
"Command body.\n",
772+
encoding="utf-8",
773+
)
774+
775+
install_ai_skills(project_dir, "claude")
776+
777+
skill_file = project_dir / ".claude" / "skills" / "speckit-specify" / "SKILL.md"
778+
content = skill_file.read_text()
779+
780+
# Skill should be generated successfully
781+
assert "name: speckit-specify" in content
782+
assert "Command body." in content
783+
784+
def test_multiple_handoffs_dont_break_skill_generation(self, project_dir):
785+
"""Templates with multiple handoffs should generate skills without errors."""
786+
cmds_dir = project_dir / ".claude" / "commands"
787+
cmds_dir.mkdir(parents=True)
788+
789+
(cmds_dir / "plan.md").write_text(
790+
"---\n"
791+
"description: Plan command\n"
792+
"handoffs:\n"
793+
" - label: Sync User Stories\n"
794+
" agent: speckit.adosync\n"
795+
" prompt: Sync user stories\n"
796+
" send: true\n"
797+
" - label: Sync Tasks\n"
798+
" agent: speckit.adosync\n"
799+
" prompt: Sync tasks with -FromTasks\n"
800+
" send: false\n"
801+
" - label: Create Checklist\n"
802+
" agent: speckit.checklist\n"
803+
" send: true\n"
804+
"---\n"
805+
"\n"
806+
"# Plan\n"
807+
"\n"
808+
"Planning content.\n",
809+
encoding="utf-8",
810+
)
811+
812+
result = install_ai_skills(project_dir, "claude")
813+
814+
assert result is True
815+
skill_file = project_dir / ".claude" / "skills" / "speckit-plan" / "SKILL.md"
816+
content = skill_file.read_text()
817+
818+
# Skill should be generated with valid structure
819+
assert "name: speckit-plan" in content
820+
assert "Planning content." in content
821+
822+
def test_handoffs_field_optional_in_skills(self, project_dir):
823+
"""Commands without handoffs should still generate valid skills."""
824+
cmds_dir = project_dir / ".claude" / "commands"
825+
cmds_dir.mkdir(parents=True)
826+
827+
(cmds_dir / "legacy.md").write_text(
828+
"---\n"
829+
"description: Legacy command without handoffs\n"
830+
"---\n"
831+
"\n"
832+
"# Legacy Command\n",
833+
encoding="utf-8",
834+
)
835+
836+
result = install_ai_skills(project_dir, "claude")
837+
838+
assert result is True
839+
skill_file = project_dir / ".claude" / "skills" / "speckit-legacy" / "SKILL.md"
840+
assert skill_file.exists()
841+
content = skill_file.read_text()
842+
843+
# Should have valid structure without handoffs
844+
assert "name: speckit-legacy" in content
845+
assert "Legacy command without handoffs" in content
846+
847+
def test_empty_handoffs_array_in_skills(self, project_dir):
848+
"""Commands with empty handoffs array should generate valid skills."""
849+
cmds_dir = project_dir / ".claude" / "commands"
850+
cmds_dir.mkdir(parents=True)
851+
852+
(cmds_dir / "test.md").write_text(
853+
"---\n"
854+
"description: Test command\n"
855+
"handoffs: []\n"
856+
"---\n"
857+
"\n"
858+
"# Test\n",
859+
encoding="utf-8",
860+
)
861+
862+
result = install_ai_skills(project_dir, "claude")
863+
864+
assert result is True
865+
skill_file = project_dir / ".claude" / "skills" / "speckit-test" / "SKILL.md"
866+
content = skill_file.read_text()
867+
868+
# Should handle empty handoffs gracefully
869+
assert "name: speckit-test" in content
870+
871+
def test_adosync_command_generates_skill(self, project_dir):
872+
"""The adosync command itself should generate a valid skill."""
873+
cmds_dir = project_dir / ".claude" / "commands"
874+
cmds_dir.mkdir(parents=True)
875+
876+
(cmds_dir / "adosync.md").write_text(
877+
"---\n"
878+
"description: Sync selected user stories or tasks to Azure DevOps\n"
879+
"scripts:\n"
880+
" sh: scripts/bash/create-ado-workitems.sh\n"
881+
" ps: scripts/powershell/create-ado-workitems.ps1\n"
882+
"---\n"
883+
"\n"
884+
"# ADO Sync Command\n"
885+
"\n"
886+
"Sync to Azure DevOps.\n",
887+
encoding="utf-8",
888+
)
889+
890+
result = install_ai_skills(project_dir, "claude")
891+
892+
assert result is True
893+
skill_file = project_dir / ".claude" / "skills" / "speckit-adosync" / "SKILL.md"
894+
assert skill_file.exists()
895+
content = skill_file.read_text()
896+
897+
assert "name: speckit-adosync" in content
898+
assert "Azure DevOps" in content
899+
900+
635901
class TestParameterOrderingIssue:
636902
"""Test fix for GitHub issue #1641: parameter ordering issues."""
637903

0 commit comments

Comments
 (0)