Skip to main content

assemble_code_mode_prompt_with_schema

Function assemble_code_mode_prompt_with_schema 

Source
pub fn assemble_code_mode_prompt_with_schema(
    schema_text: &str,
    dialect: Dialect,
    config: &ServerConfig,
) -> String
Expand description

File-based counterpart to assemble_code_mode_prompt — assemble the code-mode prompt body from a --schema file’s text WITHOUT any live connector introspection (Plan 85-02 Task 3 / D-04 / D-05).

This is a SYNC fn taking the Dialect + the already-loaded schema_text directly, so it can NEVER trigger a SqlConnector::schema_text round-trip. For lazy / network-backed non-SQLite connectors that matters: the connector-based assemble_code_mode_prompt would hit the network at prompt time (breaking SC-1), and it would surface the LIVE schema rather than the admin-redacted --schema file. Routing the --schema file content through THIS helper makes the file the single source of truth — what’s in the file is exactly what the client sees (the D-05 redaction guarantee).

§Output structure

Mirrors assemble_code_mode_prompt except the schema block is preceded by a # Database Schema header (REVIEW FIX — Gemini LOW, folded here per D-05; the header text is kept identical to the resource-surface merge_schema_resource helper Plan 05 uses, so prompt + resource parity holds):

# Code Mode — {dialect.name()}

{dialect.placeholder_guidance()}

## Schema

# Database Schema

{schema_text}

## Curated Tables

- `table_a`: description A

An empty schema_text still produces a valid (non-panicking) prompt with the # Code Mode header present.