| 516 | } |
| 517 | |
| 518 | static bool render_profile_text(profile_buffer_t *buffer, cbm_graph_profile_dialect_t dialect, |
| 519 | cbm_graph_tier_t tier, cbm_graph_access_t access, |
| 520 | const char *binary_path, const char *prompt) { |
| 521 | const char *slug = cbm_graph_tier_slug(tier); |
| 522 | const char *display = cbm_graph_tier_display_name(tier); |
| 523 | const char *description = profile_description(tier, access); |
| 524 | bool direct = access == CBM_GRAPH_ACCESS_DIRECT; |
| 525 | switch (dialect) { |
| 526 | case CBM_GRAPH_DIALECT_CLAUDE: |
| 527 | if (!append_yaml_identity(buffer, slug, description) || |
| 528 | !profile_buffer_append(buffer, "tools:\n - Read\n - Grep\n - Glob\n") || |
| 529 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 530 | (direct && !profile_buffer_append(buffer, "mcpServers: [codebase-memory-mcp]\n")) || |
| 531 | !profile_buffer_append(buffer, |
| 532 | "permissionMode: plan\nskills: [codebase-memory]\n---\n") || |
| 533 | !profile_buffer_append(buffer, prompt)) { |
| 534 | return false; |
| 535 | } |
| 536 | return true; |
| 537 | case CBM_GRAPH_DIALECT_CODEX: |
| 538 | return append_codex_profile(buffer, tier, access, binary_path, prompt, false); |
| 539 | case CBM_GRAPH_DIALECT_GEMINI: |
| 540 | if (!append_yaml_identity(buffer, slug, description) || |
| 541 | !profile_buffer_append(buffer, |
| 542 | "kind: local\ntools:\n - read_file\n - grep_search\n") || |
| 543 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 544 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 545 | return false; |
| 546 | } |
| 547 | return true; |
| 548 | case CBM_GRAPH_DIALECT_QWEN: |
| 549 | if (!append_yaml_identity(buffer, slug, description) || |
| 550 | !profile_buffer_append(buffer, |
| 551 | "model: inherit\napprovalMode: plan\ntools:\n - read_file\n - " |
| 552 | "grep_search\n - glob\n - list_directory\n") || |
| 553 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 554 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 555 | return false; |
| 556 | } |
| 557 | return true; |
| 558 | case CBM_GRAPH_DIALECT_COPILOT: |
| 559 | if (!append_yaml_identity(buffer, slug, description) || |
| 560 | !profile_buffer_append(buffer, "tools:\n - read\n - search\n") || |
| 561 | (direct && !append_yaml_mcp_tools(buffer, dialect, tier)) || |
| 562 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
| 563 | return false; |
| 564 | } |
| 565 | return true; |
| 566 | case CBM_GRAPH_DIALECT_OPENCODE: |
| 567 | return append_opencode_profile(buffer, tier, access, prompt, false); |
| 568 | case CBM_GRAPH_DIALECT_KILO: |
| 569 | if (!profile_buffer_append(buffer, "---\ndescription: ") || |
| 570 | !profile_buffer_append(buffer, description) || |
| 571 | !profile_buffer_append( |
| 572 | buffer, "\nmode: subagent\npermission:\n \"*\": deny\n read: allow\n grep: " |
| 573 | "allow\n glob: allow\n") || |
| 574 | (direct && !append_permission_mcp_tools(buffer, dialect, tier)) || |
| 575 | !profile_buffer_append(buffer, "---\n") || !profile_buffer_append(buffer, prompt)) { |
no test coverage detected