Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
simplify: extract attachNonEnumerable helper, clarify markdown round-trip role caveat
[._.]/ Adam Eivy7733f7b5fc85
diff --git a/server/lib/catalogBulkParsers.js b/server/lib/catalogBulkParsers.jsindex 6ef0913674..82e3b46dc3 100644--- a/server/lib/catalogBulkParsers.js+++ b/server/lib/catalogBulkParsers.js@@ -126,10 +126,7 @@ export function parseJsonBulk(payload) {// instead of collapsing every row onto the batch-level default. Rides as// a non-enumerable field so deep-equal tests on the entry shape still pass.if (entry && typeof entry.roleForExportedRef === 'string' && entry.roleForExportedRef.trim()) {- Object.defineProperty(normalized, 'roleForExportedRef', {- value: entry.roleForExportedRef.trim(),- enumerable: false,- });+ attachNonEnumerable(normalized, 'roleForExportedRef', entry.roleForExportedRef.trim());}return normalized;});@@ -139,10 +136,7 @@ export function parseJsonBulk(payload) {// callers are unaffected.if (isBundle && parsed.ref && typeof parsed.ref === 'object'&& typeof parsed.ref.kind === 'string' && parsed.ref.id != null) {- Object.defineProperty(entries, 'bundleRef', {- value: { kind: parsed.ref.kind, id: String(parsed.ref.id) },- enumerable: false,- });+ attachNonEnumerable(entries, 'bundleRef', { kind: parsed.ref.kind, id: String(parsed.ref.id) });}return entries;}@@ -256,12 +250,16 @@ function tokenizeCsv(text) {* it (until the next `## ` heading) becomes the body. Body lands in the* type's primary content key per PRIMARY_CONTENT_KEY_BY_TYPE.*- * This is the inverse of `ingredientToMarkdown`, so it also recognizes the two- * structured sections that exporter emits inside a `## ` block:+ * This mirrors `ingredientToMarkdown` for everything that format emits, so it+ * also recognizes the two structured sections that exporter writes inside a+ * `## ` block:* - a ` ```json … ``` ` fence carrying the non-primary payload keys, which* is parsed back into `payload.*` (merged under the body's primary key);* - a `### Scraps` subsection of `- (kind) text` bullets, preserved as a* sibling `scraps[]` array for a lossless round-trip.+ * (Per-row export role rides only the JSON bundle's `roleForExportedRef`; the+ * markdown format does not carry it, so markdown re-import falls back to the+ * route's default role — lossy on role by design.)* Both terminate the body so re-importing an export doesn't pollute the* primary content key with fence text or scrap bullets.*/@@ -383,7 +381,7 @@ export function parseMarkdownBulk(payload) {// existing callers that array-index `result[i]` (or deep-equal it in// tests) keep working; the bulk-import handler reads `result.warnings`// to surface typos back to the user.- Object.defineProperty(entries, 'warnings', { value: warnings, enumerable: false });+ attachNonEnumerable(entries, 'warnings', warnings);return entries;}@@ -442,6 +440,13 @@ export function ingredientToMarkdown(ing) {return lines.join('\n');}+// Attach metadata (warnings, bundleRef, roleForExportedRef) that rides+// alongside the parsed shape without affecting array-indexing callers or+// deep-equal tests on the entry/array shape.+function attachNonEnumerable(target, key, value) {+ Object.defineProperty(target, key, { value, enumerable: false });+}+function capitalize(s) {if (!s) return '';return s.charAt(0).toUpperCase() + s.slice(1);