| 495 | } |
| 496 | |
| 497 | static bool render_profile_text(profile_buffer_t *buffer, cbm_graph_profile_dialect_t dialect, |
| 498 | cbm_graph_tier_t tier, cbm_graph_access_t access, |
| 499 | const char *binary_path, const char *prompt) { |
| 500 | const char *slug = cbm_graph_tier_slug(tier); |
| 501 | const char *display = cbm_graph_tier_display_name(tier); |
| 502 | const char *description = profile_description(tier, access); |
| 503 | bool direct = access == CBM_GRAPH_ACCESS_DIRECT; |
| 504 | switch (dialect) { |
| 505 | case CBM_GRAPH_DIALECT_CLAUDE: |
| 506 | if (!append_yaml_identity(buffer, slug, description) || |
| 507 | !profile_buffer_append(buffer, "tools:\n - Read\n - Grep\n - Glob\n") || |
| 508 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 509 | (direct && !profile_buffer_append(buffer, "mcpServers: [codebase-memory-mcp]\n")) || |
| 510 | !profile_buffer_append(buffer, |
| 511 | "permissionMode: plan\nskills: [codebase-memory]\n---\n") || |
| 512 | !profile_buffer_append(buffer, prompt)) { |
| 513 | return false; |
| 514 | } |
| 515 | return true; |
| 516 | case CBM_GRAPH_DIALECT_CODEX: |
| 517 | return append_codex_profile(buffer, tier, access, binary_path, prompt, false); |
| 518 | case CBM_GRAPH_DIALECT_GEMINI: |
| 519 | if (!append_yaml_identity(buffer, slug, description) || |
| 520 | !profile_buffer_append(buffer, |
| 521 | "kind: local\ntools:\n - read_file\n - grep_search\n") || |
| 522 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 523 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 524 | return false; |
| 525 | } |
| 526 | return true; |
| 527 | case CBM_GRAPH_DIALECT_QWEN: |
| 528 | if (!append_yaml_identity(buffer, slug, description) || |
| 529 | !profile_buffer_append(buffer, |
| 530 | "model: inherit\napprovalMode: plan\ntools:\n - read_file\n - " |
| 531 | "grep_search\n - glob\n - list_directory\n") || |
| 532 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 533 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 534 | return false; |
| 535 | } |
| 536 | return true; |
| 537 | case CBM_GRAPH_DIALECT_COPILOT: |
| 538 | if (!append_yaml_identity(buffer, slug, description) || |
| 539 | !profile_buffer_append(buffer, "tools:\n - read\n - search\n") || |
| 540 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 541 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 542 | return false; |
| 543 | } |
| 544 | return true; |
| 545 | case CBM_GRAPH_DIALECT_OPENCODE: |
| 546 | case CBM_GRAPH_DIALECT_KILO: |
| 547 | if (!profile_buffer_append(buffer, "---\ndescription: ") || |
| 548 | !profile_buffer_append(buffer, description) || |
| 549 | !profile_buffer_append( |
| 550 | buffer, "\nmode: subagent\npermission:\n \"*\": deny\n read: allow\n grep: " |
| 551 | "allow\n glob: allow\n") || |
| 552 | (direct && !append_permission_mcp_tools(buffer, dialect, tier)) || |
| 553 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 554 | return false; |
no test coverage detected