v4.0.0
Major Changes
-
497c18e: Breaking: collapse the CLI to a config-file-only workflow.
sync-worktreesnow does one thing: load a config file and run it. Every knob (runOnce, branch filters, LFS, mode, depth, retry, parallelism, debug,updateExistingWorktrees, etc.) lives in the config file.Removed CLI flags
--repoUrl(-u),--worktreeDir(-w),--cronSchedule(-s),--bareRepoDir(-b),--branchMaxAge(-a),--branchInclude,--branchExclude,--skipLfs,--no-update-existing,--mode,--branch,--runOnce,--debug,--sync-on-start,--filter(on the default command),--list.The single-repo flag invocation, the missing-config-file rescue prompt, and the auto-launched interactive setup are all gone.
New surface
sync-worktrees [--config <path>] sync-worktrees init [--config <path>] [--force] sync-worktrees list [--config <path>] [--filter <pat>]initwrites a new config file (./sync-worktrees.config.jsby default) and exits. Refuses to overwrite an existing target unless--forceis passed. Atomic write viaflag: "wx"— no TOCTOU between check and write.listis the new home for what used to be--list.--filteronly exists onlist(it's a list-query parameter, not a sync-run override).- yargs is configured with
camel-case-expansion: falseandstrict()— typos and removed flags fail loudly.
Migration
- Replace any single-repo CLI invocation with a config file (run
sync-worktrees initto generate one). - Replace
sync-worktrees --list ...withsync-worktrees list .... - Move
--runOncetodefaults.runOnce: truein the config file. (Per-reporunOnceonly suppresses TUI cron scheduling for that one repo — to run the whole CLI as one-shot, set it underdefaults.) - Move
--no-update-existingtoupdateExistingWorktrees: false(per-repo or underdefaults). - Move
--debugtodebug: true(per-repo or underdefaults; included in the exported config types). - Move
--filter(sync-run shard targeting) into the config file by maintaining narrower per-environment configs.
Internals
- New
ConfigFileNotFoundErrortyped error insrc/errors;loadConfigFilethrows it instead of a stringly-typedError. runSingleRepository,reconstructCliCommand,isInteractiveMode,CliOptionsextras removed.InteractiveUIService.ReloadOptionsremoved (the TUI no longer carries CLI overrides).ConfigandRepositoryConfiggain three optional fields for the new clone-mode surface:mode?: "clone" | "worktree",branch?: string, anddepth?: number. Existing worktree-mode configs do not need to set them (defaults preserve current behavior); integrators with customConfigconsumers may need to widen their types.
Minor Changes
-
497c18e: Add
mode: "clone"repository strategy. When set, the tool runsgit clone --branch <X> --single-branchdirectly intoworktreeDir— no bare repo, noworktreeDir/<branch>subfolder — and on each sync tick fetches + fast-forwards if the working tree is clean. Clone-mode initialize/sync operations now also emit structured progress notifications for branch resolution, clone/fetch progress, sparse-checkout, LFS verification, skip reasons, and fast-forward updates. Designed for monorepo sibling dependencies that require fixed relative paths between repos. The default mode remainsworktree(no behavior change for existing configs).Shallow clone-mode repos (
depth: N) no longer misclassify a fast-forward-able remote asdivergedwhengit merge-basecannot walk past the shallow boundary.GitService.classifyRemoteRelationship()replaces the booleancanFastForward()check inside clone-mode and distinguishesup_to_date,fast_forward,local_ahead,diverged, andindeterminate_shallow. When the relationship is indeterminate, clone-mode now deepens the local view by successive absolute--depthtargets (50 → 200 → 1000, skipping any target ≤ configured depth) and re-classifies after each step. If the budget exhausts without a verdict the run records a newindeterminate_shallowsoft skip distinct fromdiverged, including the highest deepen target attempted, so operators can grep logs and choose to remove or raisedepth. -
497c18e: Add published config autocomplete types for JavaScript config files. Generated and example configs now use
// @ts-checkplus JSDoc@satisfiesannotations with zero runtime imports, and the package publishesdist/index.d.tsfor editors to resolveSyncWorktreesConfig.
Patch Changes
-
497c18e: Internal polish follow-up to the CLI collapse refactor:
- Extract
fileExists()helper, dedupe 8 inlinefs.accessexistence checks across config + status paths. - Replace
InitConfigInputinterface withPick<RepositoryConfig, ...>so init wizard input type auto-tracksRepositoryConfig. - Add
CLI_COMMANDSconst + discriminatedCliOptionsunion;main()now usesswitchwith exhaustiveneverguard so future commands fail at compile time. - Collapse
runMultipleRepositoriessignature — takes the loadedConfigFiledirectly and derivesrunOnce/maxParallelinternally. - Multi-repo runner already sets
process.exitCode = 1on any init/sync failure (shipped in the parent PR).
- Extract
-
497c18e: Discoverability + AI-agent positioning:
- Updated package description and added
mcp,model-context-protocol,claude-code,claude-desktop,cursor,ai-agent,ai-tools,agentickeywords so the package surfaces in MCP/AI-agent searches on npm. - Restructured README: added shields.io badges, a "pick your path" Quickstart with CLI / Claude Code / generic-MCP-client snippets, and a "Why it pairs with AI agents" worked example showing the typical agent tool-call sequence.
- Reordered the Features list to lead with the MCP server and the interactive TUI.
- Added top-level
AGENTS.mdwith bootstrap order, tool-selection guidance, and safety rules for agents using the MCP server.
- Updated package description and added