|
1 | 1 | """Tests for CopilotIntegration.""" |
2 | 2 |
|
3 | 3 | import json |
| 4 | +import os |
4 | 5 |
|
5 | 6 | from specify_cli.integrations import get_integration |
6 | 7 | from specify_cli.integrations.manifest import IntegrationManifest |
@@ -144,3 +145,123 @@ def test_templates_are_processed(self, tmp_path): |
144 | 145 | assert "{ARGS}" not in content, f"{agent_file.name} has unprocessed {{ARGS}}" |
145 | 146 | assert "\nscripts:\n" not in content |
146 | 147 | assert "\nagent_scripts:\n" not in content |
| 148 | + |
| 149 | + def test_complete_file_inventory_sh(self, tmp_path): |
| 150 | + """Every file produced by specify init --integration copilot --script sh.""" |
| 151 | + from typer.testing import CliRunner |
| 152 | + from specify_cli import app |
| 153 | + project = tmp_path / "inventory-sh" |
| 154 | + project.mkdir() |
| 155 | + old_cwd = os.getcwd() |
| 156 | + try: |
| 157 | + os.chdir(project) |
| 158 | + result = CliRunner().invoke(app, [ |
| 159 | + "init", "--here", "--integration", "copilot", "--script", "sh", "--no-git", |
| 160 | + ], catch_exceptions=False) |
| 161 | + finally: |
| 162 | + os.chdir(old_cwd) |
| 163 | + assert result.exit_code == 0 |
| 164 | + actual = sorted(str(p.relative_to(project)) for p in project.rglob("*") if p.is_file()) |
| 165 | + expected = sorted([ |
| 166 | + ".github/agents/speckit.analyze.agent.md", |
| 167 | + ".github/agents/speckit.checklist.agent.md", |
| 168 | + ".github/agents/speckit.clarify.agent.md", |
| 169 | + ".github/agents/speckit.constitution.agent.md", |
| 170 | + ".github/agents/speckit.implement.agent.md", |
| 171 | + ".github/agents/speckit.plan.agent.md", |
| 172 | + ".github/agents/speckit.specify.agent.md", |
| 173 | + ".github/agents/speckit.tasks.agent.md", |
| 174 | + ".github/agents/speckit.taskstoissues.agent.md", |
| 175 | + ".github/prompts/speckit.analyze.prompt.md", |
| 176 | + ".github/prompts/speckit.checklist.prompt.md", |
| 177 | + ".github/prompts/speckit.clarify.prompt.md", |
| 178 | + ".github/prompts/speckit.constitution.prompt.md", |
| 179 | + ".github/prompts/speckit.implement.prompt.md", |
| 180 | + ".github/prompts/speckit.plan.prompt.md", |
| 181 | + ".github/prompts/speckit.specify.prompt.md", |
| 182 | + ".github/prompts/speckit.tasks.prompt.md", |
| 183 | + ".github/prompts/speckit.taskstoissues.prompt.md", |
| 184 | + ".vscode/settings.json", |
| 185 | + ".specify/integration.json", |
| 186 | + ".specify/init-options.json", |
| 187 | + ".specify/integrations/copilot.manifest.json", |
| 188 | + ".specify/integrations/speckit.manifest.json", |
| 189 | + ".specify/integrations/copilot/scripts/update-context.ps1", |
| 190 | + ".specify/integrations/copilot/scripts/update-context.sh", |
| 191 | + ".specify/scripts/bash/check-prerequisites.sh", |
| 192 | + ".specify/scripts/bash/common.sh", |
| 193 | + ".specify/scripts/bash/create-new-feature.sh", |
| 194 | + ".specify/scripts/bash/setup-plan.sh", |
| 195 | + ".specify/scripts/bash/update-agent-context.sh", |
| 196 | + ".specify/templates/agent-file-template.md", |
| 197 | + ".specify/templates/checklist-template.md", |
| 198 | + ".specify/templates/constitution-template.md", |
| 199 | + ".specify/templates/plan-template.md", |
| 200 | + ".specify/templates/spec-template.md", |
| 201 | + ".specify/templates/tasks-template.md", |
| 202 | + ".specify/memory/constitution.md", |
| 203 | + ]) |
| 204 | + assert actual == expected, ( |
| 205 | + f"Missing: {sorted(set(expected) - set(actual))}\n" |
| 206 | + f"Extra: {sorted(set(actual) - set(expected))}" |
| 207 | + ) |
| 208 | + |
| 209 | + def test_complete_file_inventory_ps(self, tmp_path): |
| 210 | + """Every file produced by specify init --integration copilot --script ps.""" |
| 211 | + from typer.testing import CliRunner |
| 212 | + from specify_cli import app |
| 213 | + project = tmp_path / "inventory-ps" |
| 214 | + project.mkdir() |
| 215 | + old_cwd = os.getcwd() |
| 216 | + try: |
| 217 | + os.chdir(project) |
| 218 | + result = CliRunner().invoke(app, [ |
| 219 | + "init", "--here", "--integration", "copilot", "--script", "ps", "--no-git", |
| 220 | + ], catch_exceptions=False) |
| 221 | + finally: |
| 222 | + os.chdir(old_cwd) |
| 223 | + assert result.exit_code == 0 |
| 224 | + actual = sorted(str(p.relative_to(project)) for p in project.rglob("*") if p.is_file()) |
| 225 | + expected = sorted([ |
| 226 | + ".github/agents/speckit.analyze.agent.md", |
| 227 | + ".github/agents/speckit.checklist.agent.md", |
| 228 | + ".github/agents/speckit.clarify.agent.md", |
| 229 | + ".github/agents/speckit.constitution.agent.md", |
| 230 | + ".github/agents/speckit.implement.agent.md", |
| 231 | + ".github/agents/speckit.plan.agent.md", |
| 232 | + ".github/agents/speckit.specify.agent.md", |
| 233 | + ".github/agents/speckit.tasks.agent.md", |
| 234 | + ".github/agents/speckit.taskstoissues.agent.md", |
| 235 | + ".github/prompts/speckit.analyze.prompt.md", |
| 236 | + ".github/prompts/speckit.checklist.prompt.md", |
| 237 | + ".github/prompts/speckit.clarify.prompt.md", |
| 238 | + ".github/prompts/speckit.constitution.prompt.md", |
| 239 | + ".github/prompts/speckit.implement.prompt.md", |
| 240 | + ".github/prompts/speckit.plan.prompt.md", |
| 241 | + ".github/prompts/speckit.specify.prompt.md", |
| 242 | + ".github/prompts/speckit.tasks.prompt.md", |
| 243 | + ".github/prompts/speckit.taskstoissues.prompt.md", |
| 244 | + ".vscode/settings.json", |
| 245 | + ".specify/integration.json", |
| 246 | + ".specify/init-options.json", |
| 247 | + ".specify/integrations/copilot.manifest.json", |
| 248 | + ".specify/integrations/speckit.manifest.json", |
| 249 | + ".specify/integrations/copilot/scripts/update-context.ps1", |
| 250 | + ".specify/integrations/copilot/scripts/update-context.sh", |
| 251 | + ".specify/scripts/powershell/check-prerequisites.ps1", |
| 252 | + ".specify/scripts/powershell/common.ps1", |
| 253 | + ".specify/scripts/powershell/create-new-feature.ps1", |
| 254 | + ".specify/scripts/powershell/setup-plan.ps1", |
| 255 | + ".specify/scripts/powershell/update-agent-context.ps1", |
| 256 | + ".specify/templates/agent-file-template.md", |
| 257 | + ".specify/templates/checklist-template.md", |
| 258 | + ".specify/templates/constitution-template.md", |
| 259 | + ".specify/templates/plan-template.md", |
| 260 | + ".specify/templates/spec-template.md", |
| 261 | + ".specify/templates/tasks-template.md", |
| 262 | + ".specify/memory/constitution.md", |
| 263 | + ]) |
| 264 | + assert actual == expected, ( |
| 265 | + f"Missing: {sorted(set(expected) - set(actual))}\n" |
| 266 | + f"Extra: {sorted(set(actual) - set(expected))}" |
| 267 | + ) |
0 commit comments