refactor: Centralize PDF styling with COLORS and FONT_SIZES and enhance module content and dynamic title generation.

This commit is contained in:
2026-02-03 22:35:01 +01:00
parent 38f2b871b9
commit ce421eb8d2
13 changed files with 346 additions and 254 deletions

View File

@@ -271,12 +271,12 @@ Output language: GERMAN (Strict).
Focus 100% on the BRIEFING text provided by the user. Use the DISTILLED_CRAWL only as background context for terms or company details. If there is a conflict, the BRIEFING is the absolute source of truth.
### OBJECTIVES:
- Extract companyName (Strictly the name, no descriptors).
- Extract companyAddress (Full address if found).
- Extract personName (Primary contact if found).
- Extract **websiteTopic**: This MUST be a single, short branch name (e.g., "Kabeltiefbau", "Logistik", "Anwaltskanzlei"). ABSOLUTELY NO SENTENCES.
- Map to internal IDs for selectedPages, features, functions, apiSystems, assets.
- Identify if isRelaunch is true (briefing mentions existing site or URL).
- Extract **companyName**: The full legal and brand name (e.g., "E-TIB GmbH"). Use signatures and crawl data.
- Extract **personName**: The name of the primary human contact (e.g., "Danny Joseph"). **CRITICAL**: Check email signatures and "Mit freundlichen Grüßen" blocks. DO NOT use "Sie", "Firma" or generic terms if a name exists.
- Extract **existingWebsite**: The primary URL mentioned in the briefing or signature (e.g., "www.e-tib.com").
- Extract **websiteTopic**: A short descriptor of the CORE BUSINESS (e.g., "Kabeltiefbau"). MAX 3 WORDS.
- **isRelaunch**: Set to TRUE if the briefing mentions an existing website, a URL, or if the company is an established entity (e.g. "Gruppe", "GmbH seit 20XX"). Assume a presence exists that needs a modern "Zentrale Webpräsenz".
- **CRITICAL LOGIC**: If a URL is mentioned, isRelaunch MUST be TRUE.
- For all textual values (deadline, websiteTopic, targetAudience etc.): USE GERMAN.
- **multilang**: ONLY if the briefing mentions multiple target languages (e.g., DE/EN).
- **maps**: If "Google Maps" or location maps are mentioned or implicit (Contact page).
@@ -295,6 +295,7 @@ Focus 100% on the BRIEFING text provided by the user. Use the DISTILLED_CRAWL on
"companyName": string,
"companyAddress": string,
"personName": string,
"existingWebsite": string,
"websiteTopic": string,
"isRelaunch": boolean,
"selectedPages": string[],
@@ -305,7 +306,7 @@ Focus 100% on the BRIEFING text provided by the user. Use the DISTILLED_CRAWL on
"deadline": string (GERMAN),
"targetAudience": "B2B" | "B2C" | "Internal" | string (GERMAN),
"expectedAdjustments": "low" | "medium" | "high" | string (GERMAN),
"employeeCount": string
"employeeCount": "ca. 10+" | "ca. 50+" | "ca. 100+" | "ca. 250+" | "ca. 500+" | "ca. 1000+"
}
`;
const pass1UserPrompt = `BRIEFING (TRUTH SOURCE):\n${briefing}\n\nCOMMENTS:\n${comments}\n\nDISTILLED_CRAWL (CONTEXT ONLY):\n${distilledCrawl}`;
@@ -352,25 +353,26 @@ ${JSON.stringify(facts, null, 2)}
// 3. PASS 3: Strategic Content (Bespoke Strategy)
console.log(' ↳ Pass 3: Strategic Content (Bespoke Strategy)...');
const pass3SystemPrompt = `
You are a high-end Digital Architect. Analyze the BRIEFING.
ABSOLUTE RULE: OUTPUT MUST BE 100% GERMAN.
You are a high-end Digital Architect. Your goal is to make the CUSTOMER feel 100% understood.
Analyze the BRIEFING and the EXISTING WEBSITE context.
### TONE & COMMUNICATION PRINCIPLES (MANDATORY):
### TONE & COMMUNICATION PRINCIPLES (STRICT):
${tone}
### OBJECTIVE:
1. **briefingSummary**: Summarize the project's essence for the CUSTOMER.
- FOLLOW PRINCIPLE 1, 5 & 6: Clear, direct, no marketing fluff.
- **TONE**: Write naturally in the Ich-Form. Avoid starting every sentence with "Ich".
- **MIRROR TEST**: Capture unique customer "hooks" or personality.
- Focus 100% on the BRIEFING (TRUTH SOURCE).
2. **designVision**: A solid, grounded, and high-quality description of the look & feel.
- FOLLOW PRINCIPLE 1, 3 & 6: Fact-based, professional, high density of information.
- **TONE**: Natural Ich-Form. Focus on the execution and technical decisions.
- **BESPOKE ELEMENTS**: If the client mentions specific layout ideas, incorporate these.
- **NO ARROGANCE**: Eliminate all "high-end", "world-class" language.
- **SIMPLE & CLEAR**: Use simple German. No buzzwords.
- 3-5 sentences of deep analysis.
1. **briefingSummary**: A deep, respectful summary of the status quo and the target state.
- **LENGTH**: EXACTLY TWO PARAGRAPHS. Minimum 8 sentences total.
- **MIRROR TEST**: Acknowledge the EXISTING website specifically. Why does the new project make sense NOW?
- **ABSOLUTE RULE**: DO NOT claim "keine digitale Repräsentation", "erstmals abgebildet", "Erstplatzierung" or "kommunikative Lücke" regarding existence if Pass 1 identified this as a RELAUNCH (isRelaunch=true). EXPLICITLY acknowledge the existing context and the NEED FOR EVOLUTION/MODERNIZATION.
- **RESPECT**: Explicitly incorporate the customer's expressed wishes.
- **ABSOLUTE RULE**: DO NOT INVENT DETAILS. Do not mention specific people (e.g., "Frieder Helmich"), software versions, or internal details NOT present in the briefing.
- **TONE**: Natural Ich-Form. Clear, direct, zero marketing fluff.
2. **designVision**: A high-density, professional vision of the future execution.
- **LENGTH**: EXACTLY TWO PARAGRAPHS. Minimum 6 sentences total.
- **INVESTMENT VALUE**: Plant a clear picture of a stable, high-quality system.
- **TECHNICAL PRECISION**: Focus on execution (Typografie, Visual Logic, Performance).
- **NO FLUFF**: Do NOT focus on "Full-Screen Hero Video" as the main thing. Focus on the FIRM's essence and how we translate it into a professional tool.
- **ABSOLUTE RULE**: NO HALLUCINATIONS. Stay general yet precise. No "Verzicht auf Stockmaterial" unless explicitly stated.
### OUTPUT FORMAT (Strict JSON):
{
@@ -380,7 +382,10 @@ ${tone}
`;
const p3Resp = await axios.post('https://openrouter.ai/api/v1/chat/completions', {
model: 'google/gemini-3-flash-preview',
messages: [{ role: 'system', content: pass3SystemPrompt }, { role: 'user', content: `BRIEFING (TRUTH SOURCE):\n${briefing}` }],
messages: [
{ role: 'system', content: pass3SystemPrompt },
{ role: 'user', content: `BRIEFING (TRUTH SOURCE):\n${briefing}\n\nEXISTING WEBSITE (CONTEXT):\n${distilledCrawl}\n\nEXTRACTED FACTS:\n${JSON.stringify(facts, null, 2)}` }
],
response_format: { type: 'json_object' }
}, { headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' } });
addUsage(p3Resp.data);
@@ -455,10 +460,12 @@ Each position in the quote must be perfectly justified and detailed.
- **BAD**: "Ich programmiere Scroll-Effekte."
- **GOOD**: "Visuelle Inszenierung der Meilensteine durch Scroll-aktivierte Timeline-Elemente."
### FORBIDDEN PHRASES:
- "Erweiterte Formulare", "Verschiedene Funktionen", "Allgemeine Logik", "Optimierte Darstellung", "Individuelle Formular-Logik".
11. **NO "MARKETING LINGO"**: Never say "avoids branding" or "maximizes performance". Say "Implements HTML5 Video Player". ALWAYS DESCRIBE THE TASK.
### POSITION RULES (STRICT):
1. **Basis Website Setup**: This position MUST ALWAYS contain exactly these 7 points: "Projekt-Setup & Infrastruktur, Hosting-Bereitstellung, Grundstruktur & Design-Vorlage, technisches SEO-Basics, Analytics (mit automatischem Mail-Report), Testing-, Staging- & Production-Umgebung, Livegang."
2. **Sorglos-Betrieb (Hosting)**: Describe the service (Hosting, SSL, Security-Updates, 24/7 Monitoring, Portfolio-Update-Service). NEVER mention "Inklusive Basis-Infrastruktur".
3. **LOGIC CONSISTENCY**: If Pass 1 extracted 1 function, you MUST describe exactly 1 function scope. If you describe two things (e.g., "Formular AND Search") but the count is 1, it is a FAIL.
4. **SIMPLICITY**: Write in "Simple German". High density of information, but easy for a CEO. No jargon.
5. **NO IMPLEMENTATION DETAILS**: Focus on WHAT is done, not HOW (no libraries, no technical "under-the-hood" talk).
### DATA CONTEXT:
${JSON.stringify({ facts, details, strategy, ia }, null, 2)}
@@ -483,23 +490,15 @@ You are the "Industrial Critic". Your goal is to catch quality regressions and e
Analyze the CURRENT_STATE against the BRIEFING_TRUTH.
### CRITICAL ERROR CHECKLIST (FAIL IF FOUND):
1. **Placeholder Leakage**: Catch "null", "undefined", or generic strings like "Verschiedene Funktionen", "Erweiterte Formulare".
2. **Detail Loss**: The user mentioned specific terms. Are they present? If not, ADD THEM.
3. **Consistency**: Ensure the count of pages in "Individuelle Seiten" matches the sitemap pages.
4. **Deadlines**: Ensure relative dates (e.g., "April / Mai") are resolved to the year 2026.
5. **TONE & WORDING FAILURE**:
- FAIL if "Ich" or "Mein" is used in positionDescriptions.
- FAIL if "wir" or "unser" is used anywhere.
- FAIL if a sentence in briefingSummary is too long or marketing-heavy.
- FAIL if "möglicherweise", "grundsätzlich", "in der Regel" is used.
- FAIL if passive voice ("es wird") is used.
6. **MAPPING FAILURE**:
- FAIL if visual elements (Scroll-Effekte, Slider, Hover) are in "Logik-Funktionen". They MUST be in "Visuelle Inszenierung".
- FAIL if multi-step forms or calculators are in "Logik-Funktionen". They MUST be in "Komplexe Interaktion".
7. **PROMPT REWRITE**: If you find any of these errors, rewrite the field entirely to be 100% compliant.
1. **Hallucination Leakage**: FAIL if names of people (e.g., "Frieder Helmich"), specific software versions, or invented details are used unless they appear EXACTLY in the BRIEFING.
- **CRITICAL**: Forbid "Sie", "Ansprechpartner" or "Unternehmen" for personName if a name IS in the briefing. If none is in briefing, use empty string.
2. **Logic Conflict**: FAIL if isRelaunch is true but briefingSummary claims no website exists or uses phrases like "Da aktuell keine digitale Repräsentation vorliegt", "erstmals abgebildet", "Erstplatzierung" or "Lücke schließen" (regarding existence).
- FAIL if the description in positionDescriptions mentions more items than extracted in facts.
3. **Implementation Fluff**: FAIL if "React", "Next.js", "TypeScript", "Tailwind" or other tech-stack details are mentioned. Focus on Concept & Result.
4. **Length Check**: Briefing and Vision MUST be significantly long (EXACTLY 2 paragraphs each, minimum 8 sentences for briefing, 6 for vision).
### MISSION:
Return updated fields ONLY. Specifically focus on hardening 'positionDescriptions', 'sitemap', and 'briefingSummary'.
Return updated fields ONLY. Specifically focus on hardening 'positionDescriptions', 'sitemap', 'briefingSummary', and 'designVision'.
### DATA CONTEXT:
${JSON.stringify({ facts, strategy, ia, positionsData }, null, 2)}
@@ -527,7 +526,12 @@ ${JSON.stringify({ facts, strategy, ia, positionsData }, null, 2)}
};
const cleanedReflection = unwrap(reflection);
return { ...result, ...cleanedReflection };
Object.entries(cleanedReflection).forEach(([key, value]) => {
if (value && value !== "" && value !== "null") {
result[key] = value;
}
});
return result;
};
let finalState = mergeReflection({