|
24 | 24 | from prompt_toolkit.styles import Style |
25 | 25 | from prompt_toolkit.widgets import TextArea |
26 | 26 |
|
| 27 | +from ..cli._helpers import SOURCE_CHOICES |
27 | 28 | from ..cli.export import _run_export |
28 | 29 | from ..config import load_config, save_config |
29 | 30 | from ..daemon import ( |
@@ -332,6 +333,14 @@ def _register_builtin_commands(self) -> None: |
332 | 333 | handler=self._cmd_watch, |
333 | 334 | ) |
334 | 335 | ) |
| 336 | + self.registry.register( |
| 337 | + SlashCommand( |
| 338 | + name="source", |
| 339 | + help_text="Show or change active source scope", |
| 340 | + usage="/source [auto|claude|codex|both|cursor|windsurf|aider|continue|antigravity|vscode|zed|xcode-beta]", |
| 341 | + handler=self._cmd_source, |
| 342 | + ) |
| 343 | + ) |
335 | 344 | self.registry.register( |
336 | 345 | SlashCommand( |
337 | 346 | name="logs", |
@@ -488,6 +497,24 @@ def _cmd_watch(self, _ctx, args: list[str]) -> CommandResult: |
488 | 497 | return CommandResult(bool(payload.get("ok", True)), "watch resumed") |
489 | 498 | return CommandResult(False, f"Unknown watch action: {action}") |
490 | 499 |
|
| 500 | + def _cmd_source(self, _ctx, args: list[str]) -> CommandResult: |
| 501 | + if not args: |
| 502 | + return CommandResult(True, f"current source: {self.source}") |
| 503 | + if len(args) != 1: |
| 504 | + return CommandResult(False, "Usage: /source <value>") |
| 505 | + candidate = args[0].strip().lower() |
| 506 | + if candidate not in SOURCE_CHOICES: |
| 507 | + return CommandResult(False, f"Invalid source: {candidate}") |
| 508 | + |
| 509 | + self.source = candidate |
| 510 | + cfg = load_config() |
| 511 | + if candidate == "auto": |
| 512 | + cfg["source"] = None |
| 513 | + else: |
| 514 | + cfg["source"] = candidate |
| 515 | + save_config(cfg) |
| 516 | + return CommandResult(True, f"source updated: {candidate}") |
| 517 | + |
491 | 518 | def _cmd_logs(self, _ctx, args: list[str]) -> CommandResult: |
492 | 519 | count = 40 |
493 | 520 | if args: |
|
0 commit comments