specweave 0.28.15 → 0.28.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +1,57 @@
1
1
  ---
2
2
  name: specweave:save
3
- description: Save and push changes across all repositories in an umbrella setup. Detects repos with changes, sets up remotes if missing, auto-generates or accepts user commit message, and pushes to origin. Works for single repos and multi-repo umbrella setups.
3
+ description: SMART save - auto-generates commit messages, handles git pull/merge/rebase automatically, resolves divergent branches, stashes dirty work. Works for single repos and umbrella multi-repo setups. Just run /specweave:save with no args for fully automatic save!
4
4
  ---
5
5
 
6
- # /specweave:save - Save Changes Across Repositories
6
+ # /specweave:save - Smart Save with Auto-Sync
7
7
 
8
- Save and push changes across all repositories in your project. Works for both single repos and umbrella multi-repo setups.
8
+ **SMART SAVE** - Handles everything automatically: commit message generation, remote sync (pull/rebase), branch setup, and push. Just run `/specweave:save` and it figures out what to do!
9
9
 
10
- ## What This Command Does
10
+ ## TL;DR - Just Works!
11
11
 
12
- 1. **Detects repositories** - Finds all repos (umbrella childRepos or current repo)
13
- 2. **Checks for changes** - Identifies repos with uncommitted changes
14
- 3. **Sets up remotes** - Prompts for remote URL if missing
15
- 4. **Auto-generates or accepts commit message** - Smart message generation from changes
16
- 5. **Pushes to remote** - Pushes commits to origin
12
+ ```bash
13
+ /specweave:save # FULLY AUTOMATIC - generates message, syncs, pushes (NO prompts!)
14
+ /specweave:save "msg" # Your message, auto-sync
15
+ /specweave:save -i # Interactive - asks before each step
16
+ ```
17
+
18
+ **What it handles automatically:**
19
+ - ✅ All files included (`git add -A`) - trust your `.gitignore`
20
+ - ✅ No commit message? → Generates from changes
21
+ - ✅ Remote has new commits? → Auto-pulls (rebase by default)
22
+ - ✅ Uncommitted changes during pull? → Auto-stash/unstash
23
+ - ✅ Branch not tracking? → Auto-setup with `-u`
24
+ - ✅ Multi-repo umbrella? → Syncs all repos
25
+ - ⚠️ Warns (but doesn't block) if secrets/huge files detected
26
+ - ⛔ **NEVER force pushes** - Always merges with remote safely
27
+
28
+ ## What This Command Does (In Order)
29
+
30
+ 1. **Detect repos** - Current repo OR all umbrella child repos
31
+ 2. **Pre-flight check** - Check remote status BEFORE anything else
32
+ 3. **Smart sync** - Auto-pull/rebase if behind remote (with stash if needed)
33
+ 4. **Auto-commit message** - Generate from changes if not provided
34
+ 5. **Push** - Push to remote with auto-retry on recoverable errors
35
+ 6. **Report** - Show what was done
17
36
 
18
37
  ## Usage
19
38
 
20
39
  ```bash
21
- # Auto-generate commit message from changes (NEW!)
40
+ # FULLY AUTOMATIC - zero prompts! (DEFAULT)
22
41
  /specweave:save
23
42
 
24
- # With explicit commit message
25
- /specweave:save "feat: Add menu builder feature"
43
+ # With your own commit message
44
+ /specweave:save "feat: Add menu builder"
26
45
 
27
- # Dry run (show what would happen, don't execute)
28
- /specweave:save --dry-run
46
+ # Interactive mode - asks before each action
47
+ /specweave:save -i
48
+ /specweave:save --interactive
29
49
 
30
- # Save specific repos only (umbrella mode)
31
- /specweave:save "fix: Bug fixes" --repos frontend,backend
50
+ # Dry run - preview without executing
51
+ /specweave:save --dry-run
32
52
 
33
- # Skip repos without remote (don't prompt)
34
- /specweave:save "chore: Updates" --skip-no-remote
53
+ # Force push (careful! requires "FORCE" confirmation)
54
+ /specweave:save --force
35
55
  ```
36
56
 
37
57
  ## Auto-Generated Commit Messages (IMPORTANT!)
@@ -176,7 +196,19 @@ chore(deps): update package dependencies
176
196
  | update | >5 | `update [scope/category]` |
177
197
  | remove | any | `remove [thing(s)]` |
178
198
 
179
- #### 8. Present for Confirmation
199
+ #### 8. Execute (Default) or Confirm (Interactive Mode)
200
+
201
+ **DEFAULT BEHAVIOR (no `-i` flag):** Just use the generated message and proceed:
202
+
203
+ ```markdown
204
+ 📊 Analyzing changes...
205
+
206
+ 🤖 Auto-generated: `docs(docs-site): add academy section and update learning journey`
207
+
208
+ ✅ Committing and pushing...
209
+ ```
210
+
211
+ **INTERACTIVE MODE (`-i` flag):** Ask for confirmation:
180
212
 
181
213
  ```markdown
182
214
  📊 **Analyzing changes...**
@@ -316,128 +348,348 @@ For umbrella setups, generate per-repo messages:
316
348
  3️⃣ Edit each message
317
349
  ```
318
350
 
319
- ## Workflow
351
+ ## SMART SYNC ALGORITHM (The Magic!)
320
352
 
321
- ### Step 1: Detect Repositories
353
+ ### Pre-Flight Check - BEFORE Any Commit
354
+
355
+ **ALWAYS check remote status first.** Don't wait for push to fail!
356
+
357
+ ```bash
358
+ # Step 1: Fetch without merge (safe, just gets info)
359
+ git fetch origin
360
+
361
+ # Step 2: Check relationship between local and remote
362
+ LOCAL=$(git rev-parse HEAD)
363
+ REMOTE=$(git rev-parse @{u} 2>/dev/null || echo "no-upstream")
364
+ BASE=$(git merge-base HEAD @{u} 2>/dev/null || echo "no-base")
365
+
366
+ # Step 3: Determine sync state
367
+ if [ "$REMOTE" = "no-upstream" ]; then
368
+ STATE="no-tracking"
369
+ elif [ "$LOCAL" = "$REMOTE" ]; then
370
+ STATE="up-to-date"
371
+ elif [ "$LOCAL" = "$BASE" ]; then
372
+ STATE="behind" # Remote has commits we don't have
373
+ elif [ "$REMOTE" = "$BASE" ]; then
374
+ STATE="ahead" # We have commits remote doesn't have
375
+ else
376
+ STATE="diverged" # Both have unique commits
377
+ fi
378
+ ```
379
+
380
+ ### Smart Sync Decision Tree
381
+
382
+ ```
383
+ ┌─────────────────────────────────────────────────────────────────┐
384
+ │ PRE-FLIGHT CHECK │
385
+ ├─────────────────────────────────────────────────────────────────┤
386
+ │ git fetch origin (safe - just gets metadata) │
387
+ │ Compare LOCAL vs REMOTE vs BASE │
388
+ └──────────────────────────┬──────────────────────────────────────┘
389
+
390
+ ┌───────────────┼───────────────┐
391
+ ▼ ▼ ▼
392
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
393
+ │ UP-TO- │ │ AHEAD │ │ BEHIND │
394
+ │ DATE │ │ (local │ │ (remote │
395
+ │ │ │ has new) │ │ has new) │
396
+ └────┬─────┘ └────┬─────┘ └────┬─────┘
397
+ │ │ │
398
+ Just commit Just commit ┌────┴────┐
399
+ and push and push │ STASH │
400
+ │ PULL │
401
+ │ UNSTASH │
402
+ └────┬────┘
403
+
404
+ Then commit
405
+ and push
406
+
407
+ ┌───────────────┴───────────────┐
408
+ ▼ ▼
409
+ ┌──────────────┐ ┌──────────────┐
410
+ │ DIVERGED │ │ NO TRACKING │
411
+ │ (both have │ │ (new branch) │
412
+ │ unique) │ │ │
413
+ └──────┬───────┘ └──────┬───────┘
414
+ │ │
415
+ ┌──────┴──────┐ Auto setup:
416
+ │ STASH │ git push -u
417
+ │ PULL │ origin HEAD
418
+ │ --rebase │
419
+ │ UNSTASH │
420
+ └──────┬──────┘
421
+
422
+ Then commit
423
+ and push
424
+ ```
425
+
426
+ ### Stash Handling (Auto-Magic!)
427
+
428
+ **Problem**: Can't pull/rebase with uncommitted changes.
429
+ **Solution**: Auto-stash, sync, unstash.
430
+
431
+ ```bash
432
+ # Check if working tree is dirty
433
+ DIRTY=$(git status --porcelain)
434
+
435
+ if [ -n "$DIRTY" ] && [ "$STATE" != "up-to-date" ] && [ "$STATE" != "ahead" ]; then
436
+ echo "📦 Stashing uncommitted changes..."
437
+ git stash push -m "specweave-save-autostash"
438
+ STASHED=true
439
+ fi
440
+
441
+ # Do the sync (pull/rebase)
442
+ git pull --rebase origin $(git branch --show-current)
443
+
444
+ # Restore stash if we stashed
445
+ if [ "$STASHED" = true ]; then
446
+ echo "📦 Restoring stashed changes..."
447
+ git stash pop
448
+ fi
449
+ ```
450
+
451
+ ### Conflict Handling
452
+
453
+ **If rebase/merge has conflicts:**
322
454
 
323
455
  ```markdown
324
- Scanning for repositories...
456
+ ⚠️ **Merge conflict detected!**
325
457
 
326
- Mode: Umbrella (3 child repos)
458
+ Conflicting files:
459
+ - src/services/auth.ts
460
+ - package.json
327
461
 
328
- Repositories found:
329
- 1. sw-qr-menu-fe (./sw-qr-menu-fe)
330
- 2. sw-qr-menu-be (./sw-qr-menu-be)
331
- 3. sw-qr-menu-shared (./sw-qr-menu-shared)
462
+ Options:
463
+ 1. 🔧 Resolve conflicts manually (I'll wait)
464
+ 2. ⏮️ Abort rebase, keep local state
465
+ 3. 🔀 Try merge instead of rebase
466
+
467
+ ? Choose:
332
468
  ```
333
469
 
334
- **For single repo:**
470
+ **Smart Auto-Resolution** (no user input needed for these):
471
+
472
+ | File Type | Resolution | Reason |
473
+ |-----------|------------|--------|
474
+ | `package-lock.json` | Delete, run `npm install` | Auto-regenerates correctly |
475
+ | `yarn.lock` | Delete, run `yarn` | Auto-regenerates correctly |
476
+ | `.specweave/increments/*/metadata.json` | Keep LOCAL | Your work takes precedence |
477
+ | `.specweave/increments/*/tasks.md` | Keep LOCAL | Your progress |
478
+ | `*.md` in `.specweave/` | Keep LOCAL | Your documentation |
479
+ | `dist/`, `build/`, `node_modules/` | Keep REMOTE | Will rebuild anyway |
480
+
481
+ **Files that ALWAYS need manual resolution:**
482
+ - Source code (`*.ts`, `*.js`, `*.tsx`)
483
+ - Configuration (`*.config.*`, `tsconfig.json`)
484
+ - Environment (`.env*`)
485
+
486
+ ### Smart File Importance Detection
487
+
488
+ When conflicts occur, automatically categorize:
489
+
335
490
  ```markdown
336
- Scanning for repositories...
491
+ 🔍 Analyzing conflict importance...
492
+
493
+ MUST INCLUDE (your work):
494
+ ✓ src/services/auth.ts (modified by you)
495
+ ✓ tests/auth.test.ts (new file)
496
+ ✓ .specweave/increments/0042/ (your increment)
497
+
498
+ CAN AUTO-RESOLVE:
499
+ ✓ package-lock.json → npm install
500
+ ✓ dist/bundle.js → rebuild
501
+
502
+ NEEDS DECISION:
503
+ ⚠️ package.json (both modified version)
504
+ LOCAL: "version": "1.2.0"
505
+ REMOTE: "version": "1.1.5"
506
+ → Keep LOCAL (your version bump)? [Y/n]
507
+ ```
337
508
 
338
- Mode: Single repository
509
+ ### NEVER Force Push (Safety First!)
339
510
 
340
- Repository: my-project (.)
511
+ **Force push is DISABLED by default.** Even with `--force` flag:
512
+
513
+ ```markdown
514
+ User: /specweave:save --force
515
+
516
+ Claude:
517
+ ⚠️ Force push requested!
518
+
519
+ This will OVERWRITE remote history. Are you SURE?
520
+ - Remote has 3 commits that will be LOST
521
+ - Other team members may lose work
522
+
523
+ ? Type "FORCE" to confirm (or anything else to cancel):
341
524
  ```
342
525
 
343
- ### Step 2: Check Git Status
526
+ **The `--force` flag requires explicit confirmation** because:
527
+ - It destroys remote history
528
+ - Team members lose commits
529
+ - Usually indicates a workflow problem
530
+
531
+ **Better alternatives:**
532
+ - Let auto-sync handle it (rebase/merge)
533
+ - Create a new branch: `/specweave:save --branch fix-conflict`
534
+ - Ask team to pull before you push
535
+
536
+ ### Full Smart Workflow
344
537
 
345
538
  ```markdown
346
- Checking git status...
539
+ /specweave:save
347
540
 
348
- sw-qr-menu-fe:
349
- Status: 3 files changed
350
- - src/components/MenuBuilder.tsx (modified)
351
- - src/hooks/useMenu.ts (new)
352
- - package.json (modified)
353
- Remote: origin -> github.com/user/sw-qr-menu-fe
541
+ 📡 Scanning repositories...
542
+ Mode: Single repo (my-project)
354
543
 
355
- sw-qr-menu-be:
356
- Status: 5 files changed
357
- - src/routes/menu.ts (modified)
358
- - src/models/MenuItem.ts (new)
359
- - src/services/MenuService.ts (modified)
360
- - tests/menu.test.ts (new)
361
- - package.json (modified)
362
- Remote: origin -> github.com/user/sw-qr-menu-be
544
+ 🔍 Pre-flight check...
545
+ Remote: origin/develop
546
+ Local: 3 commits ahead, 2 commits behind
547
+ State: DIVERGED
363
548
 
364
- sw-qr-menu-shared:
365
- Status: No changes
366
- Skipping (nothing to commit)
549
+ 📦 Stashing uncommitted changes... (5 files)
550
+ Created: stash@{0} "specweave-save-autostash"
551
+
552
+ 🔄 Syncing with remote...
553
+ git pull --rebase origin develop
554
+ ✓ Rebased 3 commits onto latest remote
555
+
556
+ 📦 Restoring stashed changes...
557
+ ✓ Applied stash@{0}
558
+
559
+ 📊 Analyzing changes...
560
+ Detected: 5 modified files in src/
561
+ Active increment: 0042-menu-builder
562
+
563
+ 🤖 Auto-generated message:
564
+ feat(menu): implement drag-drop menu builder
565
+
566
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
567
+
568
+ ? Action: [1] Use message [2] Edit [3] Custom
569
+ > 1
570
+
571
+ 💾 Committing...
572
+ git add -A
573
+ git commit -m "feat(menu): implement drag-drop menu builder"
574
+
575
+ 🚀 Pushing...
576
+ git push origin develop
577
+ ✓ Pushed to origin/develop
578
+
579
+ ✅ DONE!
580
+ Synced: 2 commits from remote
581
+ Committed: 1 new commit
582
+ Pushed: 4 commits total
367
583
  ```
368
584
 
369
- ### Step 3: Handle Missing Remotes
585
+ ### Workflow
586
+
587
+ ### Step 1: Detect Repositories
370
588
 
371
589
  ```markdown
372
- sw-qr-menu-fe:
373
- No remote configured.
590
+ 📡 Scanning for repositories...
374
591
 
375
- Options:
376
- 1. Enter remote URL manually
377
- 2. Use GitHub convention (github.com/[user]/sw-qr-menu-fe)
378
- 3. Skip this repo
592
+ Mode: Umbrella (3 child repos)
379
593
 
380
- ? Choice: [1/2/3]
594
+ Repositories:
595
+ 1. sw-qr-menu-fe (./sw-qr-menu-fe)
596
+ 2. sw-qr-menu-be (./sw-qr-menu-be)
597
+ 3. sw-qr-menu-shared (./sw-qr-menu-shared)
598
+ ```
381
599
 
382
- > 2
600
+ ### Step 2: Pre-Flight Check (NEW!)
383
601
 
384
- Using: https://github.com/user/sw-qr-menu-fe
385
- git remote add origin https://github.com/user/sw-qr-menu-fe
602
+ ```markdown
603
+ 🔍 Pre-flight check...
604
+
605
+ sw-qr-menu-fe:
606
+ Branch: develop
607
+ Remote: origin/develop
608
+ State: ✓ UP-TO-DATE
609
+
610
+ sw-qr-menu-be:
611
+ Branch: develop
612
+ Remote: origin/develop
613
+ State: ⚠️ BEHIND (2 commits)
614
+ Action: Will pull --rebase before push
615
+
616
+ sw-qr-menu-shared:
617
+ Branch: develop
618
+ Remote: origin/develop
619
+ State: ✓ AHEAD (1 commit, ready to push)
386
620
  ```
387
621
 
388
- ### Step 4: Get or Generate Commit Message
622
+ ### Step 3: Smart Sync (Auto-Pull/Rebase)
389
623
 
390
- **If message was provided in command:**
391
624
  ```markdown
392
- Commit message: "feat: Add menu builder with drag-drop support"
625
+ 🔄 Syncing repositories...
626
+
627
+ sw-qr-menu-be:
628
+ 📦 Stashing 3 uncommitted files...
629
+ 🔄 git pull --rebase origin develop
630
+ Applied: 2 commits from remote
631
+ 📦 Restoring stashed files...
632
+ ✓ Synced!
633
+
634
+ sw-qr-menu-fe:
635
+ ✓ Already up-to-date
636
+
637
+ sw-qr-menu-shared:
638
+ ✓ Already ahead, ready to push
393
639
  ```
394
640
 
395
- **If NO message provided (auto-generate):**
641
+ ### Step 4: Generate/Confirm Message
642
+
396
643
  ```markdown
397
- 📊 Analyzing changes...
644
+ 📊 Analyzing changes across repos...
398
645
 
399
- Detected:
400
- 📄 3 modified source files (src/components/)
401
- 📄 2 new test files
402
- 📁 1 new increment folder
646
+ sw-qr-menu-fe (4 files):
647
+ 🤖 Auto: feat(components): add menu builder UI
403
648
 
404
- 🤖 Auto-generated commit message:
649
+ sw-qr-menu-be (2 files):
650
+ 🤖 Auto: feat(api): add menu endpoints
405
651
 
406
- feat(components): add menu builder with drag-drop support
652
+ sw-qr-menu-shared (0 files):
653
+ ⏭️ Skip (no changes)
407
654
 
408
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
655
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
409
656
 
410
- ? Choose action:
411
- 1. Use this message
412
- 2. ✏️ Edit message
413
- 3. 📝 Enter custom message
657
+ ? Use per-repo messages or same for all?
658
+ [1] Per-repo (auto-generated)
659
+ [2] Same message (enter custom)
660
+ [3] Edit each
414
661
 
415
662
  > 1
416
-
417
- Using: "feat(components): add menu builder with drag-drop support"
418
663
  ```
419
664
 
420
- ### Step 5: Execute Save
665
+ ### Step 5: Commit & Push
421
666
 
422
667
  ```markdown
423
- Saving changes...
668
+ 💾 Saving changes...
424
669
 
425
670
  sw-qr-menu-fe:
426
- Staging: git add -A
427
- Committing: feat: Add menu builder with drag-drop support
428
- Pushing: origin/main
429
- Done
671
+ git add -A
672
+ git commit -m "feat(components): add menu builder UI"
673
+ git push origin develop
674
+ Done!
430
675
 
431
676
  sw-qr-menu-be:
432
- Staging: git add -A
433
- Committing: feat: Add menu builder with drag-drop support
434
- Pushing: origin/main
435
- Done
677
+ git add -A
678
+ git commit -m "feat(api): add menu endpoints"
679
+ git push origin develop
680
+ Done!
436
681
 
437
- Summary:
438
- Saved: 2/3 repositories
439
- Skipped: 1 (no changes)
440
- Commit: feat: Add menu builder with drag-drop support
682
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
683
+
684
+ SUMMARY
685
+
686
+ Synced: 1 repo (pulled 2 commits)
687
+ Saved: 2/3 repos
688
+ Skipped: 1 (no changes)
689
+
690
+ Commits:
691
+ sw-qr-menu-fe: feat(components): add menu builder UI
692
+ sw-qr-menu-be: feat(api): add menu endpoints
441
693
  ```
442
694
 
443
695
  ## Remote Setup Options
@@ -499,46 +751,75 @@ Skipping sw-qr-menu-fe (no remote, user chose to skip)
499
751
 
500
752
  ```markdown
501
753
  sw-qr-menu-fe:
502
- Pushing failed!
754
+ Push failed: Permission denied (publickey)
755
+
756
+ Quick fixes:
757
+ 1. Test SSH: ssh -T git@github.com
758
+ 2. Switch to HTTPS: git remote set-url origin https://github.com/...
759
+ 3. Check token scope (needs 'repo')
760
+
761
+ ? [R]etry / [S]kip repo / [A]bort all
762
+ ```
763
+
764
+ ### Divergent History (NOW HANDLED AUTOMATICALLY!)
765
+
766
+ **Old behavior**: Wait for push to fail, then ask.
767
+ **New behavior**: Detect BEFORE push, auto-sync!
503
768
 
504
- Error: Permission denied (publickey)
769
+ ```markdown
770
+ 🔍 Pre-flight detected: DIVERGED (3 ahead, 2 behind)
505
771
 
506
- Troubleshooting:
507
- 1. Check SSH key is added: ssh -T git@github.com
508
- 2. Use HTTPS instead: git remote set-url origin https://...
509
- 3. Check GitHub token has 'repo' scope
772
+ 🔄 Auto-syncing...
773
+ git stash push -m "autostash"
774
+ git pull --rebase origin develop
775
+ git stash pop
776
+ ✓ Synced!
510
777
 
511
- ? Continue with other repos? [Yes / No]
778
+ Now ready to commit and push.
512
779
  ```
513
780
 
514
- ### Push Failure (Divergent History)
781
+ **If auto-sync fails** (rare, only on complex conflicts):
515
782
 
516
783
  ```markdown
517
- sw-qr-menu-be:
518
- Pushing failed!
784
+ ⚠️ Rebase conflict in: src/services/auth.ts
519
785
 
520
- Error: Updates were rejected (remote contains work not in local)
786
+ Options:
787
+ 1. 🔧 Open editor to resolve (I'll wait)
788
+ 2. 🔀 Try merge instead of rebase
789
+ 3. ⏮️ Abort and keep local state (no push)
790
+ 4. 💪 Force push (overwrites remote - DANGEROUS)
521
791
 
522
- Options:
523
- 1. Pull and merge: git pull --rebase origin main
524
- 2. Force push (DANGEROUS): git push --force
525
- 3. Skip this repo
792
+ ? Choice:
793
+ ```
794
+
795
+ ### Branch Not Tracking (NOW AUTO-SETUP!)
796
+
797
+ **Old behavior**: Ask user what to do.
798
+ **New behavior**: Auto-setup tracking!
526
799
 
527
- ? Choice: [1/2/3]
800
+ ```markdown
801
+ 🔍 Pre-flight: Branch 'feature-x' has no upstream
802
+
803
+ 🔧 Auto-fixing...
804
+ git push -u origin feature-x
805
+ ✓ Branch now tracks origin/feature-x
528
806
  ```
529
807
 
530
- ### Branch Not Tracking
808
+ ### Stash Conflicts (Rare)
531
809
 
532
810
  ```markdown
533
- sw-qr-menu-shared:
534
- Current branch 'feature-x' has no upstream.
811
+ ⚠️ Stash pop conflict!
535
812
 
536
- Options:
537
- 1. Push with tracking: git push -u origin feature-x
538
- 2. Push to main: git push origin HEAD:main
539
- 3. Skip this repo
813
+ Your stashed changes conflict with pulled changes.
814
+ Conflicting files:
815
+ - package.json
816
+
817
+ Options:
818
+ 1. 🔧 Resolve manually (stash is in stash@{0})
819
+ 2. 🗑️ Drop stash, keep pulled version
820
+ 3. ⏮️ Restore original state (abort everything)
540
821
 
541
- ? Choice: [1/2/3]
822
+ ? Choice:
542
823
  ```
543
824
 
544
825
  ## Integration with Umbrella Config
@@ -620,133 +901,190 @@ Summary:
620
901
 
621
902
  | Flag | Description |
622
903
  |------|-------------|
623
- | `--dry-run` | Show what would happen, don't execute |
904
+ | `--interactive` / `-i` | **Interactive mode** - Ask for confirmation before each step |
905
+ | `--dry-run` | Preview mode - show what would happen |
906
+ | `--sync=rebase` | (default) Pull --rebase before push |
907
+ | `--sync=merge` | Pull --merge instead of rebase |
908
+ | `--sync=none` | Skip auto-sync (old behavior) |
909
+ | `--no-stash` | Don't auto-stash (fail if dirty + needs sync) |
624
910
  | `--repos <list>` | Only save specific repos (comma-separated) |
625
911
  | `--skip-no-remote` | Skip repos without remotes (don't prompt) |
626
912
  | `--all` | Include repos outside umbrella config |
627
913
  | `--no-push` | Commit but don't push |
628
- | `--force` | Force push (use with caution!) |
629
- | `--yes` or `-y` | Accept auto-generated message without confirmation |
914
+ | `--force` | Force push (REQUIRES typing "FORCE" to confirm!) |
915
+ | `--branch <name>` | Create new branch instead of force pushing |
916
+
917
+ ### Quick Reference
918
+
919
+ ```bash
920
+ # Most common - fully automatic (DEFAULT!)
921
+ /specweave:save
922
+
923
+ # Preview what will happen
924
+ /specweave:save --dry-run
925
+
926
+ # Custom message, automatic sync
927
+ /specweave:save "feat: new feature"
928
+
929
+ # Interactive - asks before each step
930
+ /specweave:save -i
931
+
932
+ # Merge instead of rebase
933
+ /specweave:save --sync=merge
934
+
935
+ # Create branch if conflicts (safest!)
936
+ /specweave:save --branch my-changes
937
+
938
+ # Old behavior (fail if behind)
939
+ /specweave:save --sync=none
940
+ ```
941
+
942
+ ### Conflict Resolution Strategy
943
+
944
+ **Default priority: YOUR WORK WINS**
945
+
946
+ When merging with remote, the command follows this priority:
947
+ 1. **Your code changes** - Always preserved
948
+ 2. **Your increment files** - Always preserved
949
+ 3. **Lock files** - Regenerated (npm/yarn)
950
+ 4. **Build artifacts** - Use remote (will rebuild)
951
+ 5. **Config conflicts** - Ask user
952
+
953
+ This ensures you never lose work while still syncing with team.
630
954
 
631
955
  ## Best Practices
632
956
 
633
- 1. **Use descriptive commit messages** - Same message applies to all repos
634
- 2. **Review changes first** - Use `--dry-run` to see what will happen
635
- 3. **Configure githubUrl** - Set in umbrella config for seamless remote setup
636
- 4. **Handle failures** - Don't ignore push failures, resolve before continuing
957
+ 1. **Just run `/specweave:save`** - Zero prompts, fully automatic! Let it figure things out
958
+ 2. **Use `-i` for control** - Interactive mode when you want to review/edit the message
959
+ 3. **Preview with `--dry-run`** - See what will happen before committing
960
+ 4. **Configure `githubUrl` in umbrella config** - Enables auto-remote setup
961
+ 5. **Trust the auto-message** - It analyzes changes intelligently
637
962
 
638
963
  ## Example Interactions
639
964
 
640
- ### Quick Save
965
+ ### Zero-Args Fully Automatic (The Power Move!)
641
966
 
642
967
  ```
643
- User: /specweave:save "feat: Complete user registration flow"
968
+ User: /specweave:save
644
969
 
645
970
  Claude:
646
- Scanning for repositories...
647
- Mode: Umbrella (3 child repos)
971
+ 📡 Scanning... Single repo (specweave)
648
972
 
649
- Checking git status...
973
+ 🔍 Pre-flight check...
974
+ Branch: develop → origin/develop
975
+ State: DIVERGED (2 ahead, 3 behind)
650
976
 
651
- frontend:
652
- Status: 4 files changed
653
- Remote: origin -> github.com/user/frontend
977
+ 📦 Stashing 5 uncommitted files...
978
+ 🔄 Syncing: git pull --rebase origin develop
979
+ Rebased 2 commits onto 3 new remote commits
980
+ 📦 Restoring stashed files...
654
981
 
655
- backend:
656
- Status: 2 files changed
657
- Remote: origin -> github.com/user/backend
982
+ 📊 Analyzing changes...
983
+ 🤖 Auto: feat(save): add smart sync with auto-pull
658
984
 
659
- shared:
660
- Status: No changes (skipping)
985
+ 💾 Saving...
986
+ git add -A
987
+ git commit -m "feat(save): add smart sync with auto-pull"
988
+ git push origin develop
661
989
 
662
- Saving changes...
990
+ DONE! (synced 3 + pushed 3 commits)
991
+ ```
992
+
993
+ **That's it!** One command, zero prompts, handles everything.
994
+
995
+ ### With Commit Message (Still Smart!)
996
+
997
+ ```
998
+ User: /specweave:save "feat: Complete user registration"
999
+
1000
+ Claude:
1001
+ 📡 Scanning... Umbrella (3 repos)
1002
+
1003
+ 🔍 Pre-flight check...
1004
+ frontend: ✓ UP-TO-DATE
1005
+ backend: ⚠️ BEHIND (2 commits)
1006
+ shared: ✓ No changes
1007
+
1008
+ 🔄 Syncing backend...
1009
+ git pull --rebase origin develop
1010
+ ✓ Applied 2 remote commits
1011
+
1012
+ 💾 Saving...
663
1013
 
664
1014
  frontend:
665
- git add -A
666
- git commit -m "feat: Complete user registration flow"
667
- git push origin main
1015
+ git add -A && commit && push ✓
668
1016
 
669
1017
  backend:
670
- git add -A
671
- git commit -m "feat: Complete user registration flow"
672
- git push origin main
1018
+ git add -A && commit && push ✓
673
1019
 
674
- Summary:
675
- Saved: 2/3 repositories
676
- Skipped: 1 (no changes)
1020
+ ✅ Saved 2/3 repos with: feat: Complete user registration
677
1021
  ```
678
1022
 
679
- ### Auto-Generated Message (No Args)
1023
+ ### Interactive Mode (With `-i` flag)
680
1024
 
681
1025
  ```
682
- User: /specweave:save
1026
+ User: /specweave:save -i
683
1027
 
684
1028
  Claude:
685
- Scanning for repositories...
686
- Mode: Single repository
687
- Repository: my-app (.)
688
-
689
- Checking git status...
1029
+ 📡 Scanning... Single repo
690
1030
 
691
- my-app:
692
- Status: 7 files changed
693
- Remote: origin -> github.com/user/my-app
1031
+ 🔍 Pre-flight: ✓ UP-TO-DATE (no sync needed)
694
1032
 
695
1033
  📊 Analyzing changes...
1034
+ 5 modified docs, 1 new folder
696
1035
 
697
- Detected:
698
- 📄 5 modified documentation files
699
- 📁 1 new docs section (academy/)
700
- 📁 1 new increment folder
701
-
702
- 🤖 Auto-generated commit message:
1036
+ 🤖 Auto-generated:
1037
+ docs(docs-site): add academy section
703
1038
 
704
- docs(docs-site): add academy section and update documentation
1039
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
705
1040
 
706
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
707
-
708
- ? Choose action:
709
- 1. ✅ Use this message
710
- 2. ✏️ Edit message
711
- 3. 📝 Enter custom message
1041
+ ? [1] Use [2] Edit [3] Custom
712
1042
 
713
1043
  User: 1
714
1044
 
715
- Saving changes...
716
-
717
- my-app:
718
- git add -A
719
- git commit -m "docs(docs-site): add academy section and update documentation"
720
- git push origin develop
721
-
722
- Summary:
723
- ✅ Saved: 1/1 repository
724
- 📝 Message: docs(docs-site): add academy section and update documentation
1045
+ 💾 Committing & pushing...
1046
+ ✅ Done!
725
1047
  ```
726
1048
 
727
- ### Quick Auto-Save (--yes flag)
1049
+ ### Handling Merge Conflicts (Rare but Covered!)
728
1050
 
729
1051
  ```
730
- User: /specweave:save --yes
1052
+ User: /specweave:save
731
1053
 
732
1054
  Claude:
733
- Scanning for repositories...
734
- Mode: Single repository
1055
+ 📡 Scanning... Single repo
735
1056
 
736
- 📊 Auto-analyzing changes...
1057
+ 🔍 Pre-flight: DIVERGED
737
1058
 
738
- Detected: 3 modified source files in src/cli/
1059
+ 📦 Stashing...
1060
+ 🔄 Syncing: git pull --rebase
1061
+ ⚠️ CONFLICT in src/config.ts
739
1062
 
740
- 🤖 Auto-generated: refactor(cli): update command handlers
1063
+ Conflict preview:
1064
+ <<<<<<< HEAD
1065
+ maxRetries: 5
1066
+ =======
1067
+ maxRetries: 3
1068
+ >>>>>>> upstream
741
1069
 
742
- Saving changes (auto-confirmed)...
1070
+ ? Options:
1071
+ [1] 🔧 Resolve manually (I'll wait)
1072
+ [2] 🔀 Try merge instead
1073
+ [3] ⏮️ Abort (keep local)
1074
+ [4] 💪 Force push (DANGEROUS)
743
1075
 
744
- my-app:
745
- git add -A
746
- git commit -m "refactor(cli): update command handlers"
747
- git push origin develop
1076
+ User: 1
1077
+
1078
+ Waiting for conflict resolution...
1079
+ Run: git rebase --continue
1080
+ Then say: continue
1081
+
1082
+ User: continue
748
1083
 
749
- Done! Saved with auto-generated message.
1084
+ 🔄 Continuing...
1085
+ 📦 Restoring stash...
1086
+ 💾 Saving...
1087
+ ✅ Done!
750
1088
  ```
751
1089
 
752
1090
  ### First-Time Remote Setup