-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentSchema.ts
More file actions
88 lines (78 loc) · 2.8 KB
/
Copy pathcontentSchema.ts
File metadata and controls
88 lines (78 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import type { DimensionId } from '../types';
// The frontmatter contract for content articles (the "Learn" layer around the Advisor). This file
// is the SINGLE source for the field names, enums, and the parsed-document shape. The build-time
// guard (scripts/check-content.mjs) independently re-implements these rules and cross-checks every
// article — mirroring the repo's "two independent sources, cross-checked" discipline (like
// verify-model.mjs vs the config). No zod / heavy deps: validation is dependency-free, matching the
// existing model guards. See docs/03-blueprint/architecture-reader.md and rencana-konten-*.md.
export const SECTION_IDS = [
'catalog',
'playbook',
'review',
'library',
'roadmap',
'academy',
'lab',
] as const;
export type SectionId = (typeof SECTION_IDS)[number];
export const EVIDENCE_STRENGTHS = ['strong', 'moderate', 'emerging'] as const;
export type EvidenceStrength = (typeof EVIDENCE_STRENGTHS)[number];
export const AUDIENCES = ['awam', 'expert'] as const;
export type Audience = (typeof AUDIENCES)[number];
export const TRANSLATION_STATUSES = ['id', 'en', 'id+en'] as const;
export type TranslationStatus = (typeof TRANSLATION_STATUSES)[number];
export interface ContentSource {
label: string;
venue: string;
year: number;
url: string;
}
export interface RelatedAdvisor {
/** Dimension ids the article maps to — must exist in the frozen model. */
dimensions: DimensionId[];
/** Option ids the article maps to — must exist in the frozen model. */
options: string[];
}
/** Validated frontmatter fields. */
export interface ContentFrontmatter {
title_id: string;
title_en: string;
slug: string;
section: SectionId;
audience: Audience[];
summary_tldr_id: string;
summary_tldr_en: string;
evidence_strength: EvidenceStrength;
last_reviewed: string; // YYYY-MM-DD
review_due: string; // = last_reviewed + 12 months
translation_status: TranslationStatus;
related_advisor: RelatedAdvisor;
sources: ContentSource[];
status: 'draft' | 'published';
author: string;
}
/** A parsed article: validated frontmatter + the Markdown body per language. */
export interface ContentDoc extends ContentFrontmatter {
/** English Markdown body (the part before the `<!-- lang:id -->` delimiter, or the whole body). */
body_en: string;
/** Indonesian Markdown body (after the delimiter; falls back to `body_en` when absent). */
body_id: string;
}
/** Required frontmatter keys — the app type and the guard both reference this list. */
export const REQUIRED_FRONTMATTER_KEYS: (keyof ContentFrontmatter)[] = [
'title_id',
'title_en',
'slug',
'section',
'audience',
'summary_tldr_id',
'summary_tldr_en',
'evidence_strength',
'last_reviewed',
'review_due',
'translation_status',
'related_advisor',
'sources',
'status',
'author',
];