Repository navigation
0101cb2b: doc create --from and doc export md/docx — verification, CLI help/test gap closure - #330
Merged
Merged
Conversation
…est gaps Verification of doc create --from and export --format md|docx on origin/main: task docs, card-docs, sponsor docs (all 9 templates) and KB docs (all 12 doc types) already support both in the backend and the CLI, with backend tests covering copy and export for every family. Implemented only the gaps: - kb help: restore the 'Publish new content' description to 'kb write' (it was left dangling on the 'kb export' line when create/export were added) and describe 'kb create' and 'kb export'. - sponsor doc create usage line (shown when the target id is missing) now mentions --from DOC-ID for newsletter, webinar, workshop and podcast. - CLI tests: sponsor doc create --from sends the source (URL ids extracted, podcast copies inherit the source template server-side, webinar keeps its forced template, newsletter slot flags stay non-applicable with --from); kb create --from request shape and missing-flag error; kb export md to stdout, docx binary round-trip to --output, unsupported-format error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task: 0101cb2b —
doc create --from <doc-id>anddoc export --format md|docxfor every doc type.Inventory on origin/main (184b107) — verified before implementing
--frombackend--fromCLIdataops doc(kinds: transcript, timecodes, summary, note)backend/tests/documents.test.tsdataops card-doc(same kinds)backend/tests/card-documents.test.tsnewsletter/webinar/workshop/podcast doc(9 templates: newsletter-main/-secondary/-standalone, webinar, workshop, podcast, podcast-guest-research, podcast-run-sheet, podcast-episode-brief)renderSponsorDocMarkdownExport→markdownToDocx)backend/tests/sponsor-docs.test.tsdataops kb(12 doc_types: sop, checklist, template, reference, playbook, prompt, task-template, system-overview, process, archive, code-view, doc)--sop)backend/tests/docs-content-api.test.tsClear error paths already existed everywhere:
from must be a document id(400),Source document not found(404),A copy must use the source document template(400, sponsor docs),from and content cannot be combined(400, KB). The dev server decodes base64 Lambda bodies (backend/scripts/dev-server.ts), so docx binary export works end-to-end locally too.Conclusion: no product gap — the feature is fully implemented on main. This PR closes the remaining help-text and CLI test coverage gaps found during verification.
Changes
cli/src/commands/kb.mjs: the Publish new content (as the web editor does) description had dangled on thekb exportline sincekb create/kb exportwere inserted into the help (1ff43ee); it is restored tokb write, andkb create/kb exportget their own one-line descriptions.cli/src/commands/sponsorDocs.mjs: thecreateusage line (shown when the target id is missing) now mentions[--from DOC-ID]for the newsletter, webinar, workshop and podcast domains — the family help texts already did.cli/test/cli.test.mjs: new test —sponsor doc create --fromsends the copy source (doc URLs are reduced to ids), a podcast copy without--templatesends no template so the server inherits the source template, a webinar copy keeps its forced template, and--fromdoes not bypass the speaker-domain guards (--slotwith--fromstill exits 2).cli/test/kb.test.mjs: new tests —kb create --fromposts{ path, from, title, absent, expectedRevision }fetched from the head revision; copy without--fromis a usage error calling nothing;kb exportprints markdown withformat=md, rejects--format pdf, and--format docx --outputround-trips binary bytes.No backend changes; no package.json/lock churn.
Tests run (targeted only)
node --test cli/test/kb.test.mjs— 24 pass, 0 fail (4 new)node --test cli/test/cli.test.mjs— 23 pass, 0 fail (1 new)node --test cli/test/documents.test.mjs cli/test/card-documents.test.mjs cli/test/document-transfer.test.mjs cli/test/kb-import.test.mjs cli/test/kb-mirror.test.mjs cli/test/kb-publish.test.mjs— 44 pass, 0 failDeliberately out of scope / remaining gaps
--fromor export: all four families support both. The email-intake document store (backend/src/routes/emailDocuments.ts) is a machine intake pipeline, not a user-facing doc type, so it has no create/export CLI surface.