Skip to content

cw-import CLI: automated imports

Admin

Handle larger or recurring imports without the interactive Import page – via script or schedule (cron/launchd/Task Scheduler). The interactive variant is described in Import a document; the concept behind it is Import.

cw-import is a standalone command-line tool (Python, built as a binary for macOS/Windows). It runs the same pipeline as the UI: Ingest → Convert → Fix → Enrich → Validate → Publish and writes finished Markdown articles with frontmatter and image assets into the knowledge base store.

  • cw-import process <paths/URLs…> – full pipeline for files, folders or URLs (options: --recursive, --force, --enrich).
  • cw-import confluence --space <KEY> – mirror a Confluence space (--dry-run, --enrich, --rewrite-links).
  • cw-import sharepoint crawl – mirror a SharePoint Online site (--site, --report).
  • cw-import status [doc-id] · retry doc-id · reject doc-id – check status / retry / discard.
  • cw-import config init|show|validate – create/check the configuration.

Individual phases can also be run separately (ingest/convert/fix/enrich/validate/publish).

Config file in this order: --config, environment variable CW_IMPORT_CONFIG, ./cw-import.yaml, ~/.cw-import/config.yaml. Credentials come from the environment (.env), among them MISTRAL_API_KEY (OCR), OPENAI_API_KEY (enrichment), CONFLUENCE_PASSWORD, SHAREPOINT_TENANT_ID/CLIENT_ID/CLIENT_SECRET. → Environment variables & appsettings

The tool does not bring its own scheduler – use the operating system:

  • Linux/macOS (cron): 0 2 * * * cd /path/cw-import && cw-import confluence --space HOWTO --enrich
  • macOS (launchd): LaunchAgent plist with the same invocation.
  • Windows (Task Scheduler): schtasks /create /tn "CW Import" /tr "cw-import.exe confluence --space HOWTO" /sc daily /st 02:00
  • cw-import status shows published documents; in the app the articles appear in the target knowledge base.
  • --dry-run (Confluence/SharePoint) lists hits without writing – ideal for testing.
  • OCR/enrichment fails – missing/invalid MISTRAL_API_KEY or OPENAI_API_KEY.
  • Duplicate imports – without --force already-published documents are skipped.
  • Confluence/SharePoint empty – check the space key/site and credentials; verify with --dry-run.