Members
(constant) BREADCRUMB_TRANSLATIONS
Breadcrumb translations for all supported languages
- Source:
(constant) CONTENT_LABELS
Generate Week Ahead article content
- Source:
(constant) DEFAULT_CONFIG
Default configuration
(constant) DEFAULT_MCP_SERVER_URL
MCP Client for riksdag-regering-mcp Server
JSON-RPC 2.0 client for accessing Swedish Parliament and Government data via the riksdag-regering-mcp server (32 specialized tools).
Server: https://riksdag-regering-ai.onrender.com/mcp Protocol: JSON-RPC 2.0 (https://www.jsonrpc.org/specification) Tools: 32 tools for Swedish political data (Riksdag, Regering, MPs, votes, documents)
MCP Protocol:
- POST to /mcp endpoint (not /mcp/tools/{tool})
- JSON-RPC 2.0 format with method: 'tools/call'
- Direct server: use unprefixed tool names (e.g., 'get_calendar_events')
- MCP Gateway: use prefixed tool names (e.g., 'riksdag-regering--get_calendar_events')
- Client auto-detects which mode based on URL
Usage: import { MCPClient } from './mcp-client.js'; const client = new MCPClient(); const events = await client.fetchCalendarEvents('2026-02-10', '2026-02-17');
Error Handling:
- Automatic retries on network errors (max 3 attempts with exponential backoff)
- Fallback from prefixed to non-prefixed tool names
- Detailed error messages with troubleshooting hints
- Source:
(constant) DEFAULT_THRESHOLDS
Default quality thresholds based on The Economist standards
(constant) DOCUMENT_ID_PATTERNS
Riksdag/Regering document ID patterns
(constant) EDITORIAL_PILLAR_HEADINGS
Evening Analysis Editorial Pillars
Localized heading mappings for the 5 Editorial Pillars structure in evening analysis articles across all 14 supported languages.
Used by:
- tests/news-evening-analysis.test.js (extractSections)
- scripts/validate-evening-analysis.js (extractSections)
The 5 Editorial Pillars:
- Lead Story / Parliamentary Pulse (most significant development)
- Parliamentary Pulse (legislative activity)
- Government Watch (executive activity)
- Opposition Dynamics (cross-party analysis)
- Looking Ahead (tomorrow's preview)
- Source:
(constant) EVENT_CALENDAR_TITLES
Generate event calendar section
- Source:
(constant) FOOTER_LABELS
Footer label translations for all 14 languages
- Source:
(constant) LOCALE_MAP
Locale map for all 14 supported languages
- Source:
(constant) LOCALE_MAP
Map of custom locale codes to Intl-compatible locale strings
- Source:
(constant) MINIMUM_SOURCES
Minimum number of distinct data sources required per article
(constant) OG_LOCALE_MAP
OG locale map for all 14 languages
- Source:
(constant) PARTY_VARIANTS
Map of normalized party codes to their common name variants This prevents double-counting when both full names and abbreviations appear
(constant) PARTY_VARIANTS
Swedish Political Party Variants
Maps canonical party codes to their name/abbreviation variants to prevent double-counting when both forms appear in the same article.
Used by:
- tests/news-evening-analysis.test.js (extractPartyMentions)
- scripts/validate-evening-analysis.js (countPartyPerspectives)
- Source:
(constant) REQUIRED_TOOLS
Required MCP tools for breaking news articles
CURRENT IMPLEMENTATION STATUS:
- search_voteringar: ✅ Implemented (conditional, line 72)
- search_anforanden: ✅ Implemented (conditional, line 79)
- get_voting_group: ❌ TODO - Not yet implemented
- search_ledamoter: ❌ TODO - Not yet implemented
NOTE: REQUIRED_TOOLS lists the full specification for validation. Current implementation calls a subset. This causes validation warnings but allows tests to pass. Full implementation should add the missing tools.
(constant) REQUIRED_TOOLS
Required MCP tools for committee-reports articles
REQUIRED_TOOLS UPDATE (2026-02-14): Initially set to 4 tools ['get_betankanden', 'search_voteringar', 'search_anforanden', 'get_propositioner'] to match tests/validation expectations. However, this caused runtime validation failures since the implementation only calls get_betankanden (line 66).
Reverted to actual implementation (1 tool) to prevent validation failures. When additional tools are implemented in generateCommitteeReports(), add them back here.
(constant) REQUIRED_TOOLS
Required MCP tools for motions articles
REQUIRED_TOOLS UPDATE (2026-02-14): Initially set to 4 tools ['get_motioner', 'search_dokument_fulltext', 'analyze_g0v_by_department', 'search_anforanden'] to match tests/validation expectations. However, this caused runtime validation failures since the implementation only calls get_motioner (line 56).
Reverted to actual implementation (1 tool) to prevent validation failures. When additional tools are implemented in generateMotions(), add them back here.
- Source:
(constant) REQUIRED_TOOLS
Required MCP tools for propositions articles
REQUIRED_TOOLS UPDATE (2026-02-14): Initially set to 4 tools ['get_propositioner', 'search_dokument_fulltext', 'analyze_g0v_by_department', 'search_anforanden'] to match tests/validation expectations. However, this caused runtime validation failures since the implementation only calls get_propositioner (line 56).
Reverted to actual implementation (1 tool) to prevent validation failures. When additional tools are implemented in generatePropositions(), add them back here.
(constant) REQUIRED_TOOLS
Required MCP tools for week-ahead articles
REQUIRED_TOOLS UPDATE (2026-02-14): Initially set to 4 tools ['get_calendar_events', 'search_dokument', 'get_fragor', 'get_interpellationer'] to match tests/validation expectations. However, this caused runtime validation failures since the implementation only calls get_calendar_events (line 81).
Reverted to actual implementation (1 tool) to prevent validation failures. When additional tools are implemented in generateWeekAhead(), add them back here.
- Source:
(constant) REQUIRED_TOOLS_PER_TYPE
Required MCP tools per article type
(constant) RTL_LANGUAGES
RTL languages
(constant) SITE_TAGLINE
Site tagline translations for all 14 languages
- Source:
(constant) WATCH_SECTION_TITLES
Generate "Watch Section" with key points
- Source:
defaultClient
Singleton instance for convenience
- Source:
Methods
L()
Get localized label with fallback to English
- Source:
analyzeArticles()
Analyze all news articles
- Source:
assessAnalyticalDepth(content) → {number}
Assess analytical depth of article content
Looks for:
- Causal reasoning ("because", "therefore", "as a result")
- Comparative analysis ("compared to", "in contrast", "while")
- Trend analysis ("trend", "pattern", "shift")
- Evidence-based claims (references to data, studies, reports)
- Multiple perspectives (quotes from different actors)
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | HTML content of article |
Returns:
Score 0.0-1.0
- Type
- number
batchEnhanceQuality(articlePaths, thresholds) → {Array.<Object>}
Batch enhance multiple articles
Parameters:
| Name | Type | Description |
|---|---|---|
articlePaths |
Array.<string> | Array of article paths |
thresholds |
Object | Quality thresholds |
Returns:
Array of quality results
- Type
- Array.<Object>
buildSlugToLanguagesMap(articlesByLang) → {Object}
Build map of base slugs to available languages for cross-language discovery
Detects articles with the same base slug (e.g., "2026-02-14-week-ahead") across different languages and maps slug -> [language codes].
Parameters:
| Name | Type | Description |
|---|---|---|
articlesByLang |
Object | Articles grouped by language |
- Source:
Returns:
Map of slug -> array of language codes
- Type
- Object
calculateAnalyticalDepth()
Calculate analytical depth score (0.0-1.0)
calculateQualityScore(metrics) → {number}
Calculate overall quality score
Weights:
- Analytical depth: 30%
- Party perspectives: 25%
- Cross-references: 25%
- "Why This Matters": 10%
- Historical context: 5%
- International comparison: 5%
Parameters:
| Name | Type | Description |
|---|---|---|
metrics |
Object | Individual quality metrics |
Returns:
Overall score 0.0-1.0
- Type
- number
calculateQualityScore()
Calculate overall quality score (0.0-1.0)
calculateReadTime(content) → {string}
Calculate estimated read time
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | Article HTML content |
- Source:
Returns:
Read time (e.g., "5 min read")
- Type
- string
calculateScore()
Calculate quality score for cross-referencing (0-1)
checkFileForUntranslatedContent()
Check if a file contains untranslated Swedish content markers
classifyArticleType()
Classify article type based on content and filename. Supports detection keywords in all 14 languages.
- Source:
countCrossReferences(content) → {number}
Count cross-referenced Riksdag/Regering documents
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | HTML content of article |
Returns:
Number of unique document IDs found
- Type
- number
countPartyPerspectives(content) → {number}
Count unique party perspectives mentioned in article
Uses PARTY_VARIANTS pattern to prevent double-counting when both full names and abbreviations appear in the same text.
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | HTML content of article |
Returns:
Number of unique parties mentioned
- Type
- number
countPartyPerspectives()
Count party perspectives (using shared party-variants module)
countWords()
Count words in section
createCareerTrajectoryChart(data)
Create career trajectory line chart from behavioral trends data Shows attendance, effectiveness, and discipline trends over time
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Array | Behavioral trends data from CIA CSV |
- Source:
createExperienceDistributionChart(data)
Create experience distribution bar chart from real CIA data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Array | Experience distribution data from distribution_experience_levels.csv |
- Source:
createProductivityInfluenceChart(riskData, influenceData)
Create productivity vs influence scatter chart from real CIA data Uses risk_summary (productivity proxy via documents/votes) and influence_metrics
Parameters:
| Name | Type | Description |
|---|---|---|
riskData |
Array | Risk summary data with vote counts and documents |
influenceData |
Array | Influence metrics with network connections |
- Source:
detectArticleLanguage(html) → {string}
Detect article language from HTML content
Parameters:
| Name | Type | Description |
|---|---|---|
html |
string | HTML content |
- Source:
Returns:
- Language code (fallback to 'en')
- Type
- string
detectHistoricalContext()
Detect historical context (0-3 scale)
enhanceArticleQuality(articlePath, thresholds) → {Object}
Enhance article quality and validate against thresholds
Parameters:
| Name | Type | Description |
|---|---|---|
articlePath |
string | Path to article HTML file |
thresholds |
Object | Quality thresholds (optional) |
Returns:
Quality assessment result
- Type
- Object
escapeHtml(text) → {string}
Escape HTML special characters for safe inclusion in HTML/JSON-LD. Prevents XSS by converting &, <, >, ", ' to their HTML entity equivalents.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | Raw text to escape |
- Source:
Returns:
Escaped text safe for HTML insertion
- Type
- string
exportCISummary(batchResults) → {Object}
Export validation summary for CI/CD
Parameters:
| Name | Type | Description |
|---|---|---|
batchResults |
Object | Results from validateArticleBatch |
Returns:
CI-friendly summary
- Type
- Object
extractCrossReferences(content) → {Array}
Extract cross-references from article content
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | Article HTML or text content |
Returns:
Array of detected cross-references
- Type
- Array
extractFromFilename()
Extract date from filename (YYYY-MM-DD format)
- Source:
extractLanguage()
Helper functions
extractLeadParagraph()
Extract lead paragraph
extractMetaContent()
Extract content from meta tags
Fixed: regex now properly handles apostrophes and special characters in content
- Source:
extractPartyMentions(html) → {Set.<string>}
Extract unique party mentions from HTML content
Parameters:
| Name | Type | Description |
|---|---|---|
html |
string | HTML content to search |
- Source:
Returns:
- Set of canonical party codes found
- Type
- Set.<string>
extractSection()
Extract section content by heading
extractSections()
Extract sections from article (with multi-language support)
extractStatistics(data) → {Object}
Extract key statistics from parsed CSV data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Array.<Object> | Parsed CSV rows |
- Source:
Returns:
Statistics object
- Type
- Object
extractTags()
Extract tags from article:tag meta tags
- Source:
extractTerms()
Extract political terms from HTML content using structure-based approach
- Source:
extractTitle()
Extract title from
- Source:
extractTopics(documents) → {Array}
Extract key topics from documents
Parameters:
| Name | Type | Description |
|---|---|---|
documents |
Array | Documents from MCP server |
- Source:
Returns:
Topic tags
- Type
- Array
extractTopics()
Extract topics from article tags. Supports topic detection keywords in all 14 languages.
- Source:
extractWatchPoints(data, lang) → {Array}
Extract "Watch Points" from data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object | MCP data |
lang |
string | Language code |
- Source:
Returns:
Watch points for article
- Type
- Array
(async) fetchCIAData(urls) → {Promise.<Array>}
Fetch CSV data with local-first, remote-fallback strategy
Parameters:
| Name | Type | Description |
|---|---|---|
urls |
Array.<string> | Array of [localUrl, remoteUrl] |
- Source:
Returns:
Parsed CSV data
- Type
- Promise.<Array>
fetchCSV(url) → {Promise.<string>}
Fetch CSV from URL via HTTPS
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | CSV URL |
- Source:
Returns:
CSV text
- Type
- Promise.<string>
fetchCalendarEvents()
Convenience functions using default client
- Source:
formatDate()
Helper: Format date for display using locale-appropriate formatting
- Source:
formatDateForSlug()
Format date for article slug
formatDateForSlug()
Format date for article slug
formatDateForSlug()
Format date for article slug
formatDateForSlug()
Format date for article slug
- Source:
formatDateForSlug()
Format date for article slug
formatDateForSlug()
Format date for article slug
- Source:
formatDateRange()
Helper: Format date range for calendar title
- Source:
formatDayLabel()
Format day label (e.g., "February 10 - Monday") using Intl for all 14 languages
- Source:
formatDayName()
Format day name (Monday, Tuesday, etc.) using Intl for all 14 languages
- Source:
generateAllIndexes()
Main generation function
generateArticleContent(data, type, lang) → {string}
Generate article content from MCP data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object | MCP data (events, documents, etc.) |
type |
string | Article type (week-ahead, committee-reports, etc.) |
lang |
string | Language code |
- Source:
Returns:
Article HTML content
- Type
- string
generateAvailableLanguages(languages, currentLang) → {string}
Generate "Available in" text with language badges
Parameters:
| Name | Type | Description |
|---|---|---|
languages |
Array | Array of language codes |
currentLang |
string | Current display language |
- Source:
Returns:
HTML for available languages display
- Type
- string
generateBreakingNews(options)
Generate Breaking News article
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Generation options Properties
|
generateCommitteeContent()
Generate Committee Reports content
- Source:
(async) generateCommitteeReports()
Generate Committee Reports article
generateCommitteeReports(options) → {Promise.<Object>}
Generate Committee Reports article in specified languages
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Generation options Properties
|
Returns:
Generation result
- Type
- Promise.<Object>
generateGenericContent()
Generate generic content
- Source:
generateHreflangTags()
Generate hreflang tags for all languages
generateIndexHTML(langKey, languageArticles, allArticlesByLang)
Generate index HTML for a specific language
Each language index displays only articles in that specific language. Articles include metadata about which other languages they're available in for cross-language discovery indicators.
Parameters:
| Name | Type | Description |
|---|---|---|
langKey |
string | Language code (en, sv, etc.) |
languageArticles |
Array | Articles in the target language only |
allArticlesByLang |
Object | All articles grouped by language |
- Source:
generateLanguageBadge(lang, isRTL) → {string}
Generate language badge HTML for an article
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
lang |
string | Language code (e.g., 'en', 'sv') |
|
isRTL |
boolean | false | Whether the current display language is RTL |
- Source:
Returns:
HTML for language badge
- Type
- string
generateLanguageNotice()
Generate language availability notice for non-EN/SV indexes
generateMetadata(data, type, lang) → {Object}
Generate article metadata
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object | Article data |
type |
string | Article type |
lang |
string | Language code |
- Source:
Returns:
Article metadata
- Type
- Object
(async) generateMotions()
Generate Opposition Motions article
generateMotions()
Generate Opposition Motions article
- Source:
generateMotionsContent()
Generate Motions content
- Source:
(async) generateNews()
Main generation function
generatePRComment()
Generate PR comment with screenshots
(async) generatePropositions()
Generate Government Propositions article
generatePropositions()
Generate Government Propositions article
generatePropositionsContent()
Generate Propositions content
- Source:
generateRTLStyles()
Generate minimal RTL-specific styles All other styles are now in styles.css under .news-page scope
generateReport()
Generate vocabulary report
- Source:
generateSitemap()
Generate sitemap XML
- Source:
generateSources(tools) → {Array}
Generate article sources list
Parameters:
| Name | Type | Description |
|---|---|---|
tools |
Array | MCP tools used |
- Source:
Returns:
Sources list
- Type
- Array
generateUrlEntry()
Generate XML for a URL entry
- Source:
generateValidationReport(validation) → {string}
Generate validation report
Parameters:
| Name | Type | Description |
|---|---|---|
validation |
Object | Validation result from validateCrossReferences |
Returns:
Markdown formatted report
- Type
- string
(async) generateWeekAhead()
Generate Week Ahead article in specified languages
generateWeekAhead(options) → {Promise.<Object>}
Generate Week Ahead article in specified languages
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Generation options Properties
|
- Source:
Returns:
Generation result with success, files, slug, mcpCalls
- Type
- Promise.<Object>
getAllArticlesWithLanguageInfo(articlesByLang) → {Array}
Get all articles with language information for cross-language discovery
NOTE: This function is currently UNUSED in production but preserved for potential future use. It was implemented for Issue #155's cross-language discovery feature but the requirement changed to language-specific filtering (each index shows only articles in its target language).
If cross-language discovery is needed again, this function can be used instead of passing articlesByLang[langKey] to generateIndexHTML() on line 958.
This function collects ALL articles from all languages and enriches each with metadata about which language versions are available for the same slug.
Parameters:
| Name | Type | Description |
|---|---|---|
articlesByLang |
Object | Articles grouped by language |
- Deprecated:
- Currently unused - kept for potential future cross-language discovery
- Source:
Returns:
All articles with availableLanguages field
- Type
- Array
getAllHtmlFiles()
Get all HTML files in a directory (recursive)
getBreadcrumbName(lang, type) → {string}
Get breadcrumb name for a given language
Parameters:
| Name | Type | Description |
|---|---|---|
lang |
string | Language code |
type |
string | Breadcrumb type ('home' or 'news') |
- Source:
Returns:
Translated breadcrumb name
- Type
- string
getCachedData(cacheFile, maxAgeHours) → {Object|null}
Check if cached data is fresh
Parameters:
| Name | Type | Description |
|---|---|---|
cacheFile |
string | Path to cache file |
maxAgeHours |
number | Maximum cache age in hours |
- Source:
Returns:
Cached data if fresh, null otherwise
- Type
- Object | null
getDefaultTimeout() → {number}
Get default request timeout from environment or use 30s default
- Source:
Returns:
Timeout in milliseconds
- Type
- number
getFileModTime()
Get file modification time
- Source:
getLanguageCode()
Determine language code from filename
getLocalizedHeading(lang, pillar) → {string}
Get localized heading for a pillar
Parameters:
| Name | Type | Description |
|---|---|---|
lang |
string | Language code |
pillar |
string | Pillar name |
- Source:
Returns:
- Localized heading
- Type
- string
getNewsArticles()
Get news articles with metadata
- Source:
getTitles()
Get language-specific titles
getTitles()
Get language-specific titles
- Source:
getWeekAheadDateRange()
Get date range for Week Ahead (next 7 days)
- Source:
getWeekAheadDateRange()
Get date range for Week Ahead (next 7 days)
Uses UTC to avoid timezone boundary issues with toISOString()
- Source:
hasForwardLooking()
Check for forward-looking content
hasHistoricalContext(content) → {boolean}
Detect historical context
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | HTML content of article |
Returns:
True if historical context present
- Type
- boolean
hasInternationalComparison(content) → {boolean}
Detect international comparison
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | HTML content of article |
Returns:
True if international comparison present
- Type
- boolean
hasInternationalComparison()
Detect international comparison
hasWhyThisMatters(content) → {boolean}
Detect "Why This Matters" section
Parameters:
| Name | Type | Description |
|---|---|---|
content |
string | HTML content of article |
Returns:
True if section exists
- Type
- boolean
isHighPriority()
Determine if event is high priority
- Source:
isTodayDate()
Check if date is today
- Source:
(async) loadDashboardData()
Load all dashboard data from real CIA CSV files Uses local-first with remote-fallback for each data source
- Source:
loadStats() → {Object}
Load production statistics
- Source:
Returns:
Statistics data
- Type
- Object
main()
Main function
- Source:
(async) main()
Main execution
- Source:
(async) main()
Main execution
- Source:
parseArticle()
Parse HTML article
parseArticleMetadata()
Parse HTML file to extract article metadata
- Source:
parseCSV(csvText) → {Array.<Object>}
Parse CSV text to array of objects
Parameters:
| Name | Type | Description |
|---|---|---|
csvText |
string | CSV text content |
- Source:
Returns:
Parsed data
- Type
- Array.<Object>
parseCSV(csvText) → {Array.<Object>}
Parse CSV text into array of objects
Parameters:
| Name | Type | Description |
|---|---|---|
csvText |
string | Raw CSV text |
- Source:
Returns:
Parsed rows
- Type
- Array.<Object>
parseCSVLine(line) → {Array.<string>}
Parse a single CSV line handling quoted fields
Parameters:
| Name | Type | Description |
|---|---|---|
line |
string | CSV line |
- Source:
Returns:
Parsed values
- Type
- Array.<string>
printValidation()
Print validation results
renderTop10List(containerId, data, scoreLabel)
Render Top 10 list
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
containerId |
string | Container element ID |
|
data |
Array | Top 10 data |
|
scoreLabel |
string | Score | Label for score column |
- Source:
sanitizeArticleBody(htmlContent) → {string}
Sanitize article body content for JSON-LD structured data Removes newlines and normalizes whitespace to prevent invalid JSON
Parameters:
| Name | Type | Description |
|---|---|---|
htmlContent |
string | Article HTML content |
- Source:
Returns:
Sanitized content suitable for JSON-LD
- Type
- string
saveCache(cacheFile, data)
Save statistics to cache file
Parameters:
| Name | Type | Description |
|---|---|---|
cacheFile |
string | Path to cache file |
data |
Object | Statistics data |
- Source:
scanNewsArticles()
Scan news directory and group articles by language
- Source:
showError(message)
Show error message
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string | Error message |
- Source:
stripHtml(html) → {string}
Strip HTML tags from content
Parameters:
| Name | Type | Description |
|---|---|---|
html |
string | HTML content |
Returns:
Plain text
- Type
- string
transformCalendarToEventGrid(events, lang) → {Array}
Transform calendar events into event grid structure for template
Parameters:
| Name | Type | Description |
|---|---|---|
events |
Array | Calendar events from MCP server |
lang |
string | Language code (en, sv) |
- Source:
Returns:
Event grid structure for article template
- Type
- Array
updateHTMLFile(filePath, stats) → {Object}
Update HTML file with new statistics
Parameters:
| Name | Type | Description |
|---|---|---|
filePath |
string | Path to HTML file |
stats |
Object | Statistics data |
- Source:
Returns:
Update summary
- Type
- Object
(async) validateAccessibility()
Validate accessibility tree (WCAG 2.1 AA)
validateAndSave()
Validate and save results to file
validateArticleBatch(articles) → {Object}
Validate multiple articles at once
Parameters:
| Name | Type | Description |
|---|---|---|
articles |
Array | Array of article objects with type, content, mcpCalls |
Returns:
Aggregated validation results
- Type
- Object
validateArticlesWithPlaywright(articlePaths, options) → {Promise.<Object>}
Validate articles with Playwright
Parameters:
| Name | Type | Description |
|---|---|---|
articlePaths |
Array | Array of article file paths relative to news/ |
options |
Object | Validation options |
Returns:
Validation results with screenshots
- Type
- Promise.<Object>
(async) validateColorContrast()
Validate color contrast (4.5:1 for normal text)
validateCommitteeReports()
Validate committee reports article structure
validateCrossReferences(articleType, articleContent, mcpCalls) → {Object}
Validate cross-references for an article
Parameters:
| Name | Type | Description |
|---|---|---|
articleType |
string | Type of article (week-ahead, committee-reports, etc.) |
articleContent |
string | Article HTML or text content |
mcpCalls |
Array | Array of MCP calls made during generation |
Returns:
Validation result
- Type
- Object
validateEveningAnalysis()
Main validation function
(async) validateHeadingHierarchy()
Validate heading hierarchy (h1 → h2 → h3)
validateNewsTranslations()
Main validation function
(async) validateRTL()
Validate RTL layout for Arabic and Hebrew
(async) validateSingleArticle()
Validate a single article
validateSitemap()
Validate sitemap XML
- Source:
validateSources()
Validate sources
validateStructure()
Validate structure of article
validateWeekAhead(article) → {Object}
Validate week-ahead article structure
Parameters:
| Name | Type | Description |
|---|---|---|
article |
Object | Article object with content and metadata |
- Source:
Returns:
Validation result
- Type
- Object
(async) writeArticle()
Write article to file
(async) writeArticlePair()
Write EN/SV article pair (legacy function for backward compatibility)
(async) writeSingleArticle()
Write article in specified language