feat(i18n): per-entity content, per-group UI, page manifests (spec-v4-data-organization)

- split content.json -> content/{profile,skills,experience,projects}.json and
  ui.json -> 14 feature-group files (vi+en); index.ts merges both trees and
  asserts the merge against the group lists; merged CONTENT verified
  byte-identical against pre-split baseline dumps
- src/data/pages/*.json: 8 per-route manifests + pages.ts loader +
  PageId/PageManifestClaim/PageManifest types; validate.ts rules 1-4 (unknown
  entity, unknown ui group, unresolvable field path, orphan text field,
  missing manifest) - all five rejects verified by a throwaway harness
- draft.ts: data-driven registry of the 12 writable documents (4 structure +
  8 text); describeField() names the per-entity file; smoke-draft fixtures
  follow the new registry (8/8)
- EditBar: 'appears on' page annotations computed from the manifests
- remove JsonPanel.tsx + panel labels (inline-editing task 8); docs: AGENTS.md
  Data Layer / Live Edit Mode / Component Structure, v4 spec progress tables
This commit is contained in:
dong.nguyen committed 2026-10-23 10:55:29 +07:00
1 parent dad5f3edd7
commit 939260e4fb
69 files changed
+1816 -1596

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
// Typed loader for the page manifests (spec-v4-data-organization §5): which
// joined records and which page-owned UI groups each page consumes.
// Manifests are language-neutral, part of validation, and read-only in the
// app — they exist for provenance (EditBar grouping, orphan-field rule),
// never for rendering.
import aboutJson from './pages/about.json';
import contactJson from './pages/contact.json';
import experienceJson from './pages/experience.json';
import homeJson from './pages/home.json';
import philosophyJson from './pages/philosophy.json';
import projectDetailJson from './pages/project-detail.json';
import projectsJson from './pages/projects.json';
import resumeJson from './pages/resume.json';
import type { ContentEntityId, PageManifest, PageManifestClaim } from '../types/index';
export const pageManifests: PageManifest[] = [
homeJson,
aboutJson,
experienceJson,
projectsJson,
projectDetailJson,
contactJson,
philosophyJson,
resumeJson,
] as PageManifest[];
// Record-keyed text documents (and array structure documents) carry the
// record as their first path segment; a claim names the record-relative
// field ("summary", "sections.*"). The profile documents name fields
// directly.
function claimMatches(claim: string, relPath: string): boolean {
if (claim === '*') return true;
if (claim.endsWith('.*')) return relPath.startsWith(claim.slice(0, -2) + '.');
return (
relPath === claim || relPath.startsWith(claim + '.') || relPath.startsWith(claim + '[')
);
}
// Does this manifest claim this document-relative path?
export function manifestClaimsPath(
manifest: PageManifest,
entity: ContentEntityId,
relPath: string,
): boolean {
const candidate =
entity === 'profile'
? relPath
: relPath.includes('.')
? relPath.slice(relPath.indexOf('.') + 1)
: '';
return manifest.content.some(
(claim: PageManifestClaim) =>
claim.entity === entity && claim.fields.some((field) => claimMatches(field, candidate)),
);
}
// The manifests that claim a path — EditBar's "appears on" annotation
// (§6.3), computed from the manifests, never from component code.
export function manifestsClaiming(
entity: ContentEntityId,
relPath: string,
): PageManifest[] {
return pageManifests.filter((m) => manifestClaimsPath(m, entity, relPath));
}
// Draft path prefixes (`skills`, `experience`) name the text file; the §3
// entity ids name the joined record (`skillGroups`, `experiences`). Manifest
// claims and EditBar grouping work on the record ids.
export function recordEntity(
textEntity: 'profile' | 'skills' | 'experience' | 'projects',
): ContentEntityId {
if (textEntity === 'skills') return 'skillGroups';
if (textEntity === 'experience') return 'experiences';
return textEntity;
}
+12
View File
@@ -0,0 +1,12 @@
{
"id": "about",
"route": "/about",
"content": [
{
"entity": "profile",
"fields": ["name", "bio", "subtitle", "currentInterests", "philosophy"]
},
{ "entity": "skillGroups", "fields": ["*"] }
],
"ui": ["about"]
}
+19
View File
@@ -0,0 +1,19 @@
{
"id": "contact",
"route": "/contact",
"content": [
{
"entity": "profile",
"fields": [
"email",
"githubUrl",
"githubHandle",
"linkedinUrl",
"linkedinHandle",
"telegramUrl",
"telegramHandle"
]
}
],
"ui": ["contact"]
}
+9
View File
@@ -0,0 +1,9 @@
{
"id": "experience",
"route": "/experience",
"content": [
{ "entity": "profile", "fields": ["tldr"] },
{ "entity": "experiences", "fields": ["*"] }
],
"ui": ["experience"]
}
+29
View File
@@ -0,0 +1,29 @@
{
"id": "home",
"route": "/",
"content": [
{
"entity": "profile",
"fields": [
"name",
"tagline",
"roles",
"bio",
"currentInterests",
"philosophy",
"tldr",
"email",
"githubUrl",
"githubHandle",
"linkedinUrl",
"linkedinHandle",
"telegramUrl",
"telegramHandle"
]
},
{ "entity": "skillGroups", "fields": ["*"] },
{ "entity": "experiences", "fields": ["*"] },
{ "entity": "projects", "fields": ["featured", "title", "summary", "technologies", "category"] }
],
"ui": ["hero", "about", "expertise", "experience", "projects", "contact"]
}
+8
View File
@@ -0,0 +1,8 @@
{
"id": "philosophy",
"route": "/philosophy",
"content": [
{ "entity": "profile", "fields": ["philosophyQuotes"] }
],
"ui": ["philosophy"]
}
+11
View File
@@ -0,0 +1,11 @@
{
"id": "project-detail",
"route": "/projects/:id",
"content": [
{
"entity": "projects",
"fields": ["title", "summary", "role", "metrics", "technologies", "category", "sections.*"]
}
],
"ui": ["projectDetail"]
}
+8
View File
@@ -0,0 +1,8 @@
{
"id": "projects",
"route": "/projects",
"content": [
{ "entity": "projects", "fields": ["*"] }
],
"ui": ["projects"]
}
+25
View File
@@ -0,0 +1,25 @@
{
"id": "resume",
"route": null,
"content": [
{
"entity": "profile",
"fields": [
"name",
"title",
"bio",
"email",
"githubUrl",
"githubHandle",
"linkedinUrl",
"linkedinHandle",
"telegramUrl",
"telegramHandle"
]
},
{ "entity": "skillGroups", "fields": ["*"] },
{ "entity": "experiences", "fields": ["*"] },
{ "entity": "projects", "fields": ["*"] }
],
"ui": []
}