writeAgentInstructions initializes agent instruction files based on the selected agent type.
(ctx context.Context, ch *cmdutil.Helper, repo drivers.RepoStore, agent string)
| 265 | |
| 266 | // writeAgentInstructions initializes agent instruction files based on the selected agent type. |
| 267 | func writeAgentInstructions(ctx context.Context, ch *cmdutil.Helper, repo drivers.RepoStore, agent string) error { |
| 268 | switch agent { |
| 269 | case "all": |
| 270 | if err := instructions.InitClaudeCode(ctx, repo, true); err != nil { |
| 271 | return fmt.Errorf("failed to add Claude Code files: %w", err) |
| 272 | } |
| 273 | ch.Printf("Added Claude instructions in .claude and .mcp.json\n") |
| 274 | if err := instructions.InitCursorRules(ctx, repo, true); err != nil { |
| 275 | return fmt.Errorf("failed to add Cursor rules: %w", err) |
| 276 | } |
| 277 | ch.Printf("Added Cursor rules in .cursor\n") |
| 278 | if err := instructions.InitAgentsMD(ctx, repo, true); err != nil { |
| 279 | return fmt.Errorf("failed to add AGENTS.md files: %w", err) |
| 280 | } |
| 281 | ch.Printf("Added agent instructions in AGENTS.md and .agents\n") |
| 282 | case "agentsmd": |
| 283 | if err := instructions.InitAgentsMD(ctx, repo, true); err != nil { |
| 284 | return fmt.Errorf("failed to add AGENTS.md files: %w", err) |
| 285 | } |
| 286 | ch.Printf("Added agent instructions in AGENTS.md and .agents\n") |
| 287 | case "claude": |
| 288 | if err := instructions.InitClaudeCode(ctx, repo, true); err != nil { |
| 289 | return fmt.Errorf("failed to add Claude Code files: %w", err) |
| 290 | } |
| 291 | ch.Printf("Added Claude instructions in .claude and .mcp.json\n") |
| 292 | case "cursor": |
| 293 | if err := instructions.InitCursorRules(ctx, repo, true); err != nil { |
| 294 | return fmt.Errorf("failed to add Cursor rules: %w", err) |
| 295 | } |
| 296 | ch.Printf("Added Cursor rules in .cursor\n") |
| 297 | case "none": |
| 298 | // No agent instructions to add |
| 299 | default: |
| 300 | return fmt.Errorf("invalid agent option %q", agent) |
| 301 | } |
| 302 | return nil |
| 303 | } |
no test coverage detected