Skip to content

0101cb2b: doc create --from and doc export md/docx — verification, CLI help/test gap closure - #330

Merged
alexeygrigorev merged 1 commit into
mainfrom
fix/doc-create-from-export
Nov 4, 2026
Merged

alexeygrigorev merged 1 commit into
mainfrom
fix/doc-create-from-export

Conversation

@alexeygrigorev

Copy link
Copy Markdown
Member

Task: 0101cb2b — doc create --from <doc-id> and doc export --format md|docx for every doc type.

Inventory on origin/main (184b107) — verified before implementing

Doc family (types) create --from backend create --from CLI export md export docx Backend tests
Task docs dataops doc (kinds: transcript, timecodes, summary, note) yes (copies title/content/kind) yes yes yes copy + md/txt/docx round-trip: backend/tests/documents.test.ts
Card docs dataops card-doc (same kinds) yes yes yes yes copy + export: backend/tests/card-documents.test.ts
Sponsor docs newsletter/webinar/workshop/podcast doc (9 templates: newsletter-main/-secondary/-standalone, webinar, workshop, podcast, podcast-guest-research, podcast-run-sheet, podcast-episode-brief) yes (copies content/template/title; template mismatch → 400) yes yes (renders per template) yes (via renderSponsorDocMarkdownExport → markdownToDocx) copy + md/docx export: backend/tests/sponsor-docs.test.ts
KB docs dataops kb (12 doc_types: sop, checklist, template, reference, playbook, prompt, task-template, system-overview, process, archive, code-view, doc) yes (new identity, code-view copies require --sop) yes yes yes copy of every doc_type + export: backend/tests/docs-content-api.test.ts

Clear 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 the kb export line since kb create/kb export were inserted into the help (1ff43ee); it is restored to kb write, and kb create/kb export get their own one-line descriptions.
  • cli/src/commands/sponsorDocs.mjs: the create usage 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 --from sends the copy source (doc URLs are reduced to ids), a podcast copy without --template sends no template so the server inherits the source template, a webinar copy keeps its forced template, and --from does not bypass the speaker-domain guards (--slot with --from still exits 2).
  • cli/test/kb.test.mjs: new tests — kb create --from posts { path, from, title, absent, expectedRevision } fetched from the head revision; copy without --from is a usage error calling nothing; kb export prints markdown with format=md, rejects --format pdf, and --format docx --output round-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 fail

Deliberately out of scope / remaining gaps

  • No doc type was excluded from --from or 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.
  • Frontend portal surfaces were not in scope (CLI + backend task).
  • No prod calls were made; everything is verified from source and tests on the worktree at origin/main.

…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.
@alexeygrigorev
alexeygrigorev merged commit 81e183b into main Nov 4, 2026
1 check passed
@alexeygrigorev
alexeygrigorev deleted the fix/doc-create-from-export branch November 5, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant