feat(edit): live edit mode with draft store, inline editing, JSON panel, save bar, branch targeting

?edit entry with Basic-auth probe; DraftStore copy-on-write over live
branch documents (?ref GET / branch PUT, last_commit_sha optimistic
concurrency, three-way rebase on 412); EditableText inline editors;
JsonPanel with templates and orphan-free delete; EditBar sequential-PUT
save with conflict actions and merge hint on non-master branches.
scripts/smoke-draft.ts regression check.
This commit is contained in:
dong.nguyen committed 2026-10-22 09:55:24 +07:00
1 parent f113dfc7b5
commit 6482c993e8
24 files changed
+2523 -52

No files matched your search

+23
View File
@@ -26,6 +26,20 @@ export type ContentStructures = {
const hasHtml = (value: string) => value.includes('<') || value.includes('>');
// Walks every string value of a text document, collecting the document paths
// of empty strings — an empty required value is a half-finished edit, never
// content (rule 6). Mirrors the walk in findHtmlStrings.
function findEmptyStrings(value: unknown, docPath: string): string[] {
if (typeof value === 'string') return value.trim() === '' ? [docPath] : [];
if (Array.isArray(value))
return value.flatMap((item, i) => findEmptyStrings(item, `${docPath}[${i}]`));
if (value && typeof value === 'object')
return Object.entries(value).flatMap(([key, item]) =>
findEmptyStrings(item, `${docPath}.${key}`),
);
return [];
}
// Walks every string value of a text document, collecting its document path.
function findHtmlStrings(value: unknown, docPath: string): string[] {
if (typeof value === 'string') return hasHtml(value) ? [docPath] : [];
@@ -128,6 +142,15 @@ export function collectContentIssues(
}
}
// Rule 6: no empty text values in either language document. Every string in
// a text document is a required field; the editor rejects an empty commit
// with exactly this rule, and CI keeps an emptied field out of master.
for (const [lang, doc] of [['vi', vi], ['en', en]] as const) {
for (const path of findEmptyStrings(doc, `content.${lang}.json`)) {
issues.push({ path, message: 'empty text value' });
}
}
return issues;
}