Skip to content

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

Release copy: no double gap where a tags-only line was, and remember drafted tags across a YouTube-off draft

Claude17bd139d5690
diff --git a/server/services/musicVideo/publishKit.js b/server/services/musicVideo/publishKit.js
index 9d12f0c122..824da5fb33 100644
--- a/server/services/musicVideo/publishKit.js
+++ b/server/services/musicVideo/publishKit.js
@@ -289,7 +289,8 @@ export async function draftPublishKitCopy(projectId, { providerId = null, model
if (copy.youtube && !('tags' in copy.youtube) && Array.isArray(youtube?.tags) && sameTags(youtube.tags, kit.draftedTags)) {
merged.youtube = { ...youtube, tags: [] };
}
- const draftedTags = Array.isArray(copy.youtube?.tags) ? copy.youtube.tags : [];
+ // A draft without YouTube keeps the record of what the last YouTube draft wrote.
+ const draftedTags = copy.youtube ? (Array.isArray(copy.youtube.tags) ? copy.youtube.tags : []) : (kit.draftedTags || []);
return { project: { ...current, publishKit: { ...kit, copy: merged, draftedTags, notes, draftOptions: options, links: { ...(kit.links || {}), ...links }, copyDraftedAt: new Date().toISOString() } } };
});
}
diff --git a/server/services/musicVideo/publishKit.test.js b/server/services/musicVideo/publishKit.test.js
index 82681f4010..eafee1f5b2 100644
--- a/server/services/musicVideo/publishKit.test.js
+++ b/server/services/musicVideo/publishKit.test.js
@@ -168,6 +168,8 @@ describe('publishing kit copy (#9281)', () => {
const deps = { platforms: { youtube: { enabled: true } }, history: {}, runner: runner(reply) };
const first = await kit.draftPublishKitCopy(id, { include: { hashtags: true } }, deps);
expect(first.project.publishKit.copy.youtube.tags).toEqual(['model tag']);
+ // A draft with YouTube off in between still remembers which tags the model wrote.
+ await kit.draftPublishKitCopy(id, {}, { ...deps, platforms: { x: { enabled: true } }, runner: runner(JSON.stringify({ x: { hook: 'h' } })) });
const second = await kit.draftPublishKitCopy(id, {}, deps);
expect(second.project.publishKit.copy.youtube.tags).toEqual([]);
});
diff --git a/server/services/musicVideo/publishKitText.js b/server/services/musicVideo/publishKitText.js
index ca86576d96..8d8d2c296c 100644
--- a/server/services/musicVideo/publishKitText.js
+++ b/server/services/musicVideo/publishKitText.js
@@ -164,14 +164,23 @@ const CLOSING = /^[,.;:!?)\]}]/;
* mid-line leaves a single space, so indentation and markdown line breaks
* elsewhere are untouched.
*/
-export const stripHashtags = (text) => String(text || '').replace(HASHTAG_RUN, (match, lead, trail, offset, whole) => {
- const end = offset + match.length;
- const lineStart = offset === 0 || whole[offset - 1] === '\n';
- const newline = trail.match(/\r?\n$/)?.[0] || '';
- if (newline || end >= whole.length) return lineStart ? '' : newline;
- if (lineStart) return lead;
- return lead && !CLOSING.test(whole.slice(end)) ? ' ' : '';
-});
+export function stripHashtags(text) {
+ let droppedLine = false;
+ const out = String(text || '').replace(HASHTAG_RUN, (match, lead, trail, offset, whole) => {
+ const end = offset + match.length;
+ const lineStart = offset === 0 || whole[offset - 1] === '\n';
+ const newline = trail.match(/\r?\n$/)?.[0] || '';
+ if (newline || end >= whole.length) {
+ if (!lineStart) return newline;
+ droppedLine = true;
+ return '';
+ }
+ if (lineStart) return lead;
+ return lead && !CLOSING.test(whole.slice(end)) ? ' ' : '';
+ });
+ // A tags-only line between two paragraphs would leave a double gap; close it.
+ return droppedLine ? out.replace(/\r?\n(?:[ \t]*\r?\n){2,}/g, (gap) => (gap.startsWith('\r') ? '\r\n\r\n' : '\n\n')) : out;
+}
/**
* The copy prompt. `notes` is the director's own making-of story; the song
diff --git a/server/services/musicVideo/publishKitText.test.js b/server/services/musicVideo/publishKitText.test.js
index f32355bdf5..194adff68a 100644
--- a/server/services/musicVideo/publishKitText.test.js
+++ b/server/services/musicVideo/publishKitText.test.js
@@ -77,6 +77,9 @@ describe('publish copy prompt + parser (#9281)', () => {
// No tags come back, so a redraft keeps the ones the director typed.
expect(copy.youtube).not.toHaveProperty('tags');
expect(parsePublishCopy(reply, ['tiktok']).tiktok.caption).toContain('#music');
+ // A tags-only line between paragraphs leaves one paragraph break, not two.
+ const between = JSON.stringify({ tiktok: { caption: 'Para one\n\n#a #b\n\nPara two' } });
+ expect(parsePublishCopy(between, ['tiktok'], { hashtags: false }).tiktok.caption).toBe('Para one\n\nPara two');
});
it('clips each field to its platform limit and rejects an empty or non-JSON reply', () => {