The Tara content importer CLI (P9.4 of the Tara Content Workbench). It takes
a validated publish bundle and lays it into the real apps/tara/content tree on
a fresh git branch — the last step of the publishing bridge, run by an editorial
lead once a bundle is approved and its assets are staged.
What it does#
Given a bundle-export JSON
({ manifest, assets: [{ relativePath, sha256, base64 }] }), the importer:
- Validates
manifestagainst the checked-inapps/tara/content/schemas/meditation.schema.json(JSON Schema 2020-12). - Re-hashes every asset's bytes and compares against its recorded
sha256— integrity is verified from the content, never trusted from the bundle's own claim. - Refuses (exit code 1, prints every reason) if the manifest is invalid or any checksum mismatches — before a single file is written and before any branch is created. There are no partial imports.
- Otherwise creates a git branch and writes the item at
meditations/<category>/<slug>/—metadata.json(the manifest) plus every asset beside it — thengit add+git commit.
Usage#
bash
# From the repo root (uses the workspace tsx):
pnpm --filter @oshun/tara-content cli -- import \
--bundle path/to/bundle-export.json \
--content-root apps/tara/content
# Validate + plan only (writes nothing, no git):
… import --bundle b.json --content-root apps/tara/content --dry-run
# Write files without branching/committing (non-repo targets, CI diffs):
… import --bundle b.json --content-root apps/tara/content --skip-git
Options:
-b, --bundle <path>— the bundle-export JSON (required).-c, --content-root <path>— theapps/tara/contenttree (required).--branch <name>— branch name (defaulttara-content/<category>-<slug>).--dry-run— validate + plan only.--skip-git— write files but do not branch/commit.
Programmatic use#
importBundle(bundle, options, schemaPath?) is exported for the golden-bundle
round-trip test (P9.8): it throws ImportRefusedError with reasons[] on any
validation failure, and returns the { itemDir, branch, files } plan otherwise.