Skip to content

Scope picker on bare 'mcs sync' when no project root is detected #331

@bguidolim

Description

@bguidolim

Context

Follow-up to #329 (Part 2, deferred from that issue). When `mcs sync` runs with no flags (`--global`, `--pack`, `--all`) and `ProjectDetector` returns nil — no `.git/`, no `CLAUDE.local.md`, no `.claude/.mcs-project` — show a scope selector before the pack picker:

```
Where to sync?

This directory (./)
Global (~/.claude)
```

Rationale

Kills the "cd somewhere to configure globally" instinct at the root. Users never need to navigate to a specific directory to pick global scope. The cwd guard from #329 (shipped in #330) prevents the worst-case silent corruption, but users in an unrelated directory still have no in-CLI signal that `--global` is an option.

Scope

  • `Sources/mcs/Commands/SyncCommand.swift` — detect the "no flags + no project root" condition at the top of `perform()`, prompt via `CLIOutput.singleSelect` (existing helper), then dispatch to `performGlobal` or `performProject` based on the choice.
  • Non-interactive modes (`--pack`, `--all`, `--dry-run` with flags) unaffected.
  • `--dry-run` alone should also surface the picker so the preview reflects actual intent.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions