Skip to content
This repository was archived by the owner on May 9, 2026. It is now read-only.

@clearcms/spec@0.3.1

Choose a tag to compare

@slavasolutions slavasolutions released this 06 May 21:57
925a7c3

Patch Changes

  • #19 bebbdc1 Thanks @slavasolutions! - clear-admin backup and clear-admin restore — first-class operator commands.

    • admin — new clear-admin backup [--out=<dir>] [--slug=<s>] writes a tarball
      containing the bucket directory, clear.db, and a manifest.json
      describing every file with sha256 + bytes + captured package versions.
      Default output dir: $CLEAR_BACKUP_DIR or ~/clear/_backups/<slug>/.
    • admin — new clear-admin restore <tarball> [<target-dir>] [--force]
      extracts a backup, verifies every file's sha256 against the manifest,
      refuses to overwrite a non-empty target unless --force is passed, and
      prints concrete next steps on success.
    • admin — the in-monorepo pnpm backup / pnpm restore scripts now
      delegate to the same modules so they produce v1 manifests too.
    • spec — new @clearcms/spec/backup-manifest export with the
      BackupManifestSchema Zod validator (closed-shape, version-gated).
      JSON Schema artifact at dist/schemas/backup-manifest.json.

    closes #13

  • #35 fde9eab Thanks @slavasolutions! - Schema-aware clear-admin import <dir>.

    • adminclear-admin import <dir> now reads the target collection's
      schema first and maps each markdown file's frontmatter onto the
      declared fields. The body lands in the schema's first kind: "richtext" field by default. Two new escape hatches:
      • Per-file override clear:bodyField: <name> in frontmatter routes
        the body into the named field instead.
      • --no-synthesize errors out (with a documented message) when the
        schema has no richtext field and no override is set, instead of
        auto-appending a body field.
    • admin — unknown frontmatter keys are now logged as warnings (per
      file) and dropped from the imported item, instead of leaking into
      data as untyped values. Keys in the reserved clear: namespace are
      skipped silently.
    • admin — when synthesis fires, the importer appends a single
      body: { kind: "richtext" } entry to
      bucket/schema/fields/<collection>.json and runs syncBucketToDb so
      the DB index matches the new shape.
    • admin--help and inline import usage list the new flags.
    • spec — new BODY_FIELD_FRONTMATTER_KEY = 'clear:bodyField' and
      RESERVED_FRONTMATTER_PREFIX = 'clear:' constants exported from
      @clearcms/spec so adopter tooling can match the importer's contract
      without copying the strings.

    Re-import is still one-way (overwrite, not merge); two-way sync remains
    out of scope for v0.x.

    closes #34