Skip to content

feat(cli): effa sync family for effect-app/shared content#764

Open
patroza wants to merge 2 commits into
mainfrom
r/sync
Open

feat(cli): effa sync family for effect-app/shared content#764
patroza wants to merge 2 commits into
mainfrom
r/sync

Conversation

@patroza
Copy link
Copy Markdown
Member

@patroza patroza commented May 23, 2026

Summary

Add three subcommands to the effa CLI for syncing content (architecture docs, e2e helpers, ts-plugins) from effect-app/shared into consuming projects.

  • effa sync — pull artifacts per project-side .shared.json lockfile. Caches the shared repo at ~/.cache/effa/shared/<slug>, checks out the pinned ref, copies files into project paths (honoring exclude list).
  • effa sync-diff — sha256 compare each tracked file against the cache copy. Reports M (modified locally) / D (missing from project) / E (excluded).
  • effa sync-push [--pr] [-m msg] [--branch name] — detect modified files, create a branch off the pinned ref in the cache, copy modified files in, commit, push. Optional --pr opens a PR via gh pr create.

Architecture

  • New module: src/sync-shared.tssyncShared, syncDiff, syncPush + shared helpers ensureCache, walkArtifacts.
  • Wired into src/index.ts as three flat subcommands (matches existing sync-effect convention).
  • Lockfile shape:
    {
      "repo": "github.com/effect-app/shared",
      "ref": "<sha>",
      "artifacts": { "<src-in-shared>": "<dest-in-project>" },
      "exclude": ["<src-path>"]
    }

Validation

Test plan

  • pnpm build clean
  • Smoke effa sync in a project with .shared.json
  • Smoke effa sync-diff (should be clean post-sync)
  • Smoke effa sync-push --pr w/ a test edit (creates branch + PR upstream)

Notes

MVP: effa sync overwrites destination files (no conflict detection beyond sync-diff reporting). Caller reviews via git status post-sync. Follow-ups: 3-way merge / safer overwrite mode, templates-diff support.

🤖 Generated with Claude Code

patroza and others added 2 commits May 23, 2026 10:05
Pulls docs/architecture, e2e helpers, ts-plugins (any artifact map) from
effect-app/shared per project-side .shared.json. Caches the shared repo at
~/.cache/effa/shared/<slug>, checks out the pinned ref, walks the artifact
map honoring an `exclude` list, then updates `synced_at`.

MVP: read-only sync, overwrites destination files. Caller reviews via
`git status` post-sync. Follow-ups: `sync status`, `sync push`, conflict
detection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sync-diff: compares each tracked file against the cache copy at the pinned
ref, reports M (modified locally), D (missing from project), E (excluded).
sha256-based comparison.

sync-push: detects modified files, creates a fresh branch off the pinned ref
in the cache clone, copies project files in, commits, and pushes to origin.
Optional `--pr` opens a PR via `gh pr create`.

Refactored sync-shared.ts to share `ensureCache` + `walkArtifacts` helpers
across the three subcommands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 23, 2026

Open in StackBlitz

@effect-app/cli

npm i https://pkg.pr.new/effect-app/libs/@effect-app/cli@764

effect-app

npm i https://pkg.pr.new/effect-app/libs/effect-app@764

@effect-app/eslint-codegen-model

npm i https://pkg.pr.new/effect-app/libs/@effect-app/eslint-codegen-model@764

@effect-app/eslint-shared-config

npm i https://pkg.pr.new/effect-app/libs/@effect-app/eslint-shared-config@764

@effect-app/infra

npm i https://pkg.pr.new/effect-app/libs/@effect-app/infra@764

@effect-app/vue

npm i https://pkg.pr.new/effect-app/libs/@effect-app/vue@764

@effect-app/vue-components

npm i https://pkg.pr.new/effect-app/libs/@effect-app/vue-components@764

commit: 088a51b

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