(t *testing.T)
| 311 | } |
| 312 | |
| 313 | func TestInitRepositoryWithNoMCP(t *testing.T) { |
| 314 | tmpDir := testutil.TempDir(t, "test-*") |
| 315 | |
| 316 | originalDir, err := os.Getwd() |
| 317 | if err != nil { |
| 318 | t.Fatalf("Failed to get current directory: %v", err) |
| 319 | } |
| 320 | defer func() { |
| 321 | _ = os.Chdir(originalDir) |
| 322 | }() |
| 323 | |
| 324 | if err := os.Chdir(tmpDir); err != nil { |
| 325 | t.Fatalf("Failed to change to temp directory: %v", err) |
| 326 | } |
| 327 | |
| 328 | // Initialize git repo |
| 329 | if err := exec.Command("git", "init").Run(); err != nil { |
| 330 | t.Skip("Git not available") |
| 331 | } |
| 332 | |
| 333 | // Configure git |
| 334 | exec.Command("git", "config", "user.name", "Test User").Run() |
| 335 | exec.Command("git", "config", "user.email", "test@example.com").Run() |
| 336 | |
| 337 | // Test init with --no-mcp flag (mcp=false) |
| 338 | err = InitRepository(InitOptions{Verbose: false, Skill: true, Agent: true, MCP: false, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil}) |
| 339 | if err != nil { |
| 340 | t.Fatalf("InitRepository(, false, false, false, nil) with --no-mcp failed: %v", err) |
| 341 | } |
| 342 | |
| 343 | // Verify .github/mcp.json was NOT created |
| 344 | mcpConfigPath := mcpConfigFilePath |
| 345 | if _, err := os.Stat(mcpConfigPath); err == nil { |
| 346 | t.Error("Expected .github/mcp.json to NOT be created with --no-mcp flag") |
| 347 | } |
| 348 | |
| 349 | // Verify copilot-setup-steps.yml was NOT created |
| 350 | setupStepsPath := filepath.Join(".github", "workflows", "copilot-setup-steps.yml") |
| 351 | if _, err := os.Stat(setupStepsPath); err == nil { |
| 352 | t.Error("Expected .github/workflows/copilot-setup-steps.yml to NOT be created with --no-mcp flag") |
| 353 | } |
| 354 | |
| 355 | // Verify basic files were still created |
| 356 | if _, err := os.Stat(".gitattributes"); os.IsNotExist(err) { |
| 357 | t.Error("Expected .gitattributes to be created even with --no-mcp flag") |
| 358 | } |
| 359 | if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")); os.IsNotExist(err) { |
| 360 | t.Error("Expected dispatcher skill file to still be created with --no-mcp flag") |
| 361 | } |
| 362 | if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflow-designer", "SKILL.md")); os.IsNotExist(err) { |
| 363 | t.Error("Expected workflow designer skill file to still be created with --no-mcp flag") |
| 364 | } |
| 365 | if _, err := os.Stat(filepath.Join(".github", "agents", "agentic-workflows.md")); os.IsNotExist(err) { |
| 366 | t.Error("Expected Agentic Workflows custom agent file to still be created with --no-mcp flag") |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | func TestInitRepositoryWithNoSkill(t *testing.T) { |
nothing calls this directly
no test coverage detected