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

[CTX-0014] feat(workflow): workflow-import fresh-clone restore helper - #20

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-0014/feat-workflow-import
Sep 10, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-0014/feat-workflow-import

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Outcome

Closes #19.

Fresh clones have no .git/carryctx/state.sqlite; CarryCtx state is never cloned, and engineering
workflow history lives in bitty-mcp-workflow as redacted ctxpack v2 snapshots. This adds the
supported restore path (port of bitty CTX-0316, merged PR #535 / 8fae335):

  • scripts/fetch-ctxpack.sh — staging-clones the mirror (default
    https://github.com/bitty-terminal/bitty-mcp-workflow.git; WORKFLOW_MIRROR_URL/--url and
    WORKFLOW_MIRROR_DIR/--mirror overridable), reads LATEST (--snapshot pins one), copies the
    snapshot to a temp staging path, validates it, initializes CarryCtx state only when the local DB
    has no project row, imports with --mode replace --yes, then prints provenance (snapshot id +
    source commit) and carryctx stats.
  • just workflow-import and just workflow-import-dry.
  • scripts/fetch-ctxpack-selftest.sh — isolated lab (temp HOME/XDG/TMPDIR + throwaway targets).
  • Docs: README/AGENTS notes; the mirror README template in scripts/publish-ctxpack.sh now
    carries the restore recipe.

Safety

  • Refuses to replace a NON-EMPTY local DB without --force.
  • --dry-run fetches + validates only; it never creates or writes the DB.
  • Validation runs before any local DB write; a tampered snapshot is refused.
  • carryctx init rewrites .carryctx/config.toml defaults; the script restores the committed
    file, so the checkout stays clean.
  • Timeouts on every git/carryctx/python op; no secrets in fixtures or output.
  • No publish-pipeline behavior change: publish-ctxpack.sh only has the mirror README recipe text
    updated.

Verification

  • scripts/fetch-ctxpack-selftest.sh: 6/6 PASS in an isolated temp HOME/XDG/TMPDIR.
  • just check, bash -n, shellcheck -S warning, shfmt -d: green.
  • Real E2E against a fresh gh repo clone of bitty-mcp (throwaway):
    • --dry-run: dry-run PASS: snapshot 20260910T193216Z-3950e5b fetched + validated; nothing imported.
    • real run: provenance snapshot=20260910T193216Z-3950e5b ... redacted=true,
      source_commit=3950e5bf3221971aa582dd263191b9315c26e449; afterwards git status --porcelain is empty (committed config
      preserved).
    • restored counts vs mirror manifest: tasks 13/13, checkpoints 15/15, sessions 10/10, graph_nodes 11/11, graph_edges 13/13, agents 4/4.

Priority: P1 | Area: devtools | Labels: feat,area:devtools,P1 | Milestone: v0.1.0 | RFC: none | Task: CTX-0014

@Xuepoo Xuepoo added this to the v0.1.0 milestone Sep 10, 2026
@Xuepoo Xuepoo added P1 High priority area:devtools Developer tooling feat Feature labels Sep 10, 2026
@Xuepoo
Xuepoo merged commit 50422f0 into main Sep 10, 2026
5 checks passed
@Xuepoo
Xuepoo deleted the ctx-0014/feat-workflow-import branch September 10, 2026 21:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area:devtools Developer tooling feat Feature P1 High priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(workflow): just workflow-import — restore local CarryCtx DB from bitty-mcp-workflow LATEST snapshot

1 participant