cargo-mate 1.8.0

Rust development companion that enhances cargo with intelligent workflows, state management, performance optimization, and comprehensive project monitoring.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
# 📚 Cargo Mate (cm) - Complete Command Reference

## Table of Contents
1. [Basic Commands]#basic-commands
2. [Journey Commands]#journey-commands
3. [Anchor Commands]#anchor-commands
4. [Captain's Log Commands]#captains-log-commands
5. [Tide Charts Commands]#tide-charts-commands
6. [Treasure Map Commands]#treasure-map-commands
7. [Mutiny Mode Commands]#mutiny-mode-commands
8. [Version Management Commands]#version-management-commands
9. [Build Optimization Commands]#build-optimization-commands
10. [View Commands]#view-commands
11. [Config Commands]#config-commands
12. [Utility Commands]#utility-commands
13. [Shell Integration]#shell-integration

---

## Basic Commands

### `cm`
**Description**: Auto-builds release if Cargo.toml exists, or runs default journey if configured

**Usage**:
```bash
cm
```

**Behavior**:
- If `Cargo.toml` exists and no default journey: runs `cargo build --release`
- If default journey configured: runs that journey
- If no `Cargo.toml`: shows help

---

### `cm init`
**Description**: Initialize cargo-mate and automatically set up shell integration

**Usage**:
```bash
cm init
```

**What it does**:
- Creates local `.cg` config file
- Automatically installs shell integration
- Backs up your shell RC file
- Adds cargo() function to intercept cargo commands
- Creates aliases: `cm` and `cg`

**Shell Integration Added**:
```bash
# === Cargo Mate (cm) Integration ===
cargo() {
    cm exec "$@"
}
alias cm='cargo-mate'
alias cg='cm'
# === End Cargo Mate Integration ===
```

**Output**:
```
🚢 Initializing Cargo Mate...
✅ Local config created: .cg
🔧 Setting up shell integration...
📋 Backed up ~/.bashrc to ~/.bashrc.bak.cargo-mate
✅ Shell integration added to ~/.bashrc
📁 Error logs will be stored in ~/.shipwreck/

🎉 Cargo Mate initialized successfully!

⚡ Shell integration added. The following are now available:
   cargo - Run cargo through cargo-mate
   cm - Direct cargo-mate access
   cg - Alias for cargo-mate

🔄 Please run: source ~/.bashrc
   Or restart your terminal to activate
```

**After Running**:
- All `cargo` commands will be intercepted by cm
- You can use `cm` directly for cargo-mate commands
- `cg` is available as a shortcut

---

### `cm help`
**Description**: Show help information

**Usage**:
```bash
cm help
cm --help
cm <command> --help
```

---

### `cm --version`
**Description**: Show version information

**Usage**:
```bash
cm --version
```

---

### `cm activate`
**Description**: Activate shell integration immediately (alternative to manual sourcing)

**Usage**:
```bash
cm activate
```

**What it does**:
- Sources your shell configuration file (`.bashrc`, `.zshrc`, etc.)
- Activates cargo-mate integration without restarting terminal
- Checks if integration exists before attempting to activate
- Provides clear feedback about activation status

**Example**:
```bash
cm init              # Sets up shell integration
cm activate          # Activates it immediately
cargo --version      # Now uses cargo-mate
```

**Output**:
```
⚡ Activating Cargo Mate shell integration...
🔄 Sourcing /root/.bashrc
✅ Shell integration activated successfully!

🚢 You can now use:
   cargo - cargo commands go through cargo-mate
   cm - direct cargo-mate access
   cg - quick alias

🎯 Try it:
   cargo --version
   cm --help
```

---

## Journey Commands

### `cm journey record <name>`
**Description**: Start recording a journey (sequence of commands)

**Usage**:
```bash
cm journey record deploy-flow
# Execute your commands...
# Press Ctrl+D to stop recording
```

**Features**:
- Records all terminal I/O via PTY
- Captures command timing
- Stores working directory
- Optimizes by removing redundant commands

**Example**:
```bash
cm journey record build-and-test
cargo fmt
cargo build --release
cargo test --all
# Ctrl+D
```

---

### `cm journey play <name> [--dry-run]`
**Description**: Replay a recorded journey

**Usage**:
```bash
cm journey play deploy-flow
cm journey play deploy-flow --dry-run  # Preview without executing
```

**Features**:
- Variable substitution with `{{variables}}`
- Interactive mode with pause points
- Checkpoint validation
- Dry-run mode for preview

---

### `cm journey list`
**Description**: List all available journeys

**Usage**:
```bash
cm journey list
```

**Output**:
```
📚 Available journeys:
  • build-flow
  • deploy-prod
  • test-suite
```

---

### `cm journey export <name> <output>`
**Description**: Export a journey to a file

**Usage**:
```bash
cm journey export deploy-flow ./deploy.journey.json
```

---

### `cm journey import <path>`
**Description**: Import a journey from a file

**Usage**:
```bash
cm journey import ./shared-journey.json
```

---

### `cm journey publish <name> [--tags <tags>...]`
**Description**: Publish a journey to the marketplace (GitHub Gists)

**Usage**:
```bash
cm journey publish build-flow --tags rust cargo build
cm journey publish test-suite
```

**Options**:
- `--tags`: Add searchable tags to your journey

**Features**:
- Uses GitHub CLI (`gh`) to create public gists
- Adds metadata (author, tags, description)
- Returns shareable gist ID and URL
- Tracks published journeys locally

**Output**:
```
📤 Publishing journey 'build-flow' to GitHub Gist...
✅ Journey published successfully!
🔗 Gist URL: https://gist.github.com/username/abc123def456
📋 Share ID: abc123def456
```

---

### `cm journey download <gist-id>`
**Description**: Download a journey from the marketplace

**Usage**:
```bash
cm journey download abc123def456
```

**Features**:
- Downloads journey from GitHub gist
- Validates journey format
- Shows author and metadata
- Adds to local journey library

**Output**:
```
📥 Downloading journey from gist abc123def456...
✅ Journey 'build-flow' downloaded successfully!
📝 Description: Optimized Rust build workflow
👤 Author: username
🏷️ Tags: rust, cargo, build
```

---

### `cm journey search <query>`
**Description**: Search the marketplace for journeys

**Usage**:
```bash
cm journey search "rust build"
cm journey search testing
```

**Features**:
- Searches public GitHub gists
- Filters for Cargo Mate journeys
- Shows author, description, and gist ID
- Sorted by relevance

**Output**:
```
🔍 Searching for journeys matching 'rust build'...
Found 3 journey(s):

1. build-flow by alice
   Optimized Rust build workflow
   ID: abc123def456

2. release-process by bob
   Complete release automation
   ID: ghi789jkl012
```

---

### `cm journey published`
**Description**: List your published journeys

**Usage**:
```bash
cm journey published
```

**Features**:
- Shows all journeys you've published
- Includes gist IDs for reference
- Stored in `~/.shipwreck/journeys/.published.json`

**Output**:
```
📤 Your published journeys:
  • build-flow (abc123def456)
  • test-suite (ghi789jkl012)
  • release-process (mno345pqr678)
```

---

## Anchor Commands

### `cm anchor save <name> [--message <msg>]`
**Description**: Save current project state as an anchor point

**Usage**:
```bash
cm anchor save before-refactor
cm anchor save v1.0 --message "Pre-release state"
```

**What it saves**:
- Git commit hash
- Cargo.lock snapshot
- Source files (SHA256 verified)
- Environment variables
- Project metadata

---

### `cm anchor restore <name>`
**Description**: Restore project to a saved anchor point

**Usage**:
```bash
cm anchor restore before-refactor
```

**What it restores**:
- Git checkout to saved commit
- Cargo.lock file
- Modified/deleted files
- Working directory state

---

### `cm anchor list`
**Description**: List all saved anchors

**Usage**:
```bash
cm anchor list
```

**Output**:
```
⚓ Saved anchors:
⚓ before-refactor - 2024-01-20 14:30:00 (15 files)
   Major refactoring checkpoint
⚓ v1.0 - 2024-01-19 10:00:00 (23 files)
   Pre-release state
```

---

### `cm anchor show <name>`
**Description**: Show detailed information about an anchor

**Usage**:
```bash
cm anchor show before-refactor
```

---

### `cm anchor diff <name>`
**Description**: Show differences between current state and anchor

**Usage**:
```bash
cm anchor diff before-refactor
```

**Output**:
```
=== Diff from anchor 'before-refactor' ===

✨ Added files:
   + src/new_module.rs

📝 Modified files:
   ~ src/main.rs
   ~ Cargo.toml

🗑️  Deleted files:
   - src/old_module.rs
```

---

### `cm anchor auto [OPTIONS] <name>`
**Description**: Start auto-update mode for anchor (runs in background by default)

**Usage**:
```bash
# Default background mode (recommended)
cm anchor auto my-project
cargo anchor auto my-project

# Foreground mode (blocking)
cm anchor auto my-project --foreground
cargo anchor auto my-project --foreground
```

**Options**:
- `--foreground`: Run in blocking foreground mode instead of background

**Background Mode Features**:
- ✅ Non-blocking: Doesn't interfere with your terminal workflow
- 🔄 Real-time: Updates files immediately when changed
- ⚡ Efficient: Only updates specifically modified files
- 📊 Smart: Monitors only relevant directories automatically
- 🛑 Controllable: Easy start/stop management

**Background Mode Output**:
```
🚀 Starting auto-update for anchor: my-project
📁 Setting up file monitoring...
✅ Auto-update STARTED successfully!
🔄 Files will be updated automatically when changed
🛑 Use 'cargo anchor stop my-project' to stop monitoring

💡 Background daemon running for anchor 'my-project'
```

**Foreground Mode Output**:
```
📁 Monitoring 19 files for changes...
💡 Press Ctrl+C to stop auto-update

👀 Watching 2 directories
✅ Auto-update started! Files will be updated automatically.

🔄 Updated src/main.rs in anchor 'my-project'
```

**File Change Notifications**:
When files are modified in background mode, you'll see:
```
🔄 [14:32:15] Updated src/main.rs in anchor 'my-project'
🔄 [14:33:22] Updated Cargo.toml in anchor 'my-project'
```

**Examples**:
```bash
# Start monitoring your project (background by default)
cargo anchor auto my-rust-project

# Start in foreground if you want to see real-time updates
cargo anchor auto my-rust-project --foreground

# The auto-update runs continuously until stopped
# Edit files, and they'll be automatically saved to the anchor!
```

---

### `cm anchor stop <name>`
**Description**: Stop auto-update mode for anchor

**Usage**:
```bash
cm anchor stop my-project
cargo anchor stop my-project
```

**Output**:
```
🛑 Stopping auto-update for anchor: my-project
⚠️  Note: In this implementation, stopping requires restarting the shell
💡 Future versions will have proper daemon management
```

**Examples**:
```bash
# Stop auto-update for your project
cargo anchor stop my-rust-project
```

---

## Captain's Log Commands

### `cm log add <message> [--tags <tags>...]`
**Description**: Add an entry to the captain's log

**Usage**:
```bash
cm log add "Switched to async runtime"
cm log add "Fixed memory leak in parser" --tags bug performance
```

---

### `cm log search <query>`
**Description**: Search through log entries

**Usage**:
```bash
cm log search "memory"
cm log search "performance"
```

---

### `cm log timeline [days]`
**Description**: Show log timeline for specified days (default: 7)

**Usage**:
```bash
cm log timeline        # Last 7 days
cm log timeline 30     # Last 30 days
```

**Output**:
```
=== Captain's Log - Last 7 Days ===

📅 Saturday, January 20, 2024
  📝 14:30:00 - Added async support
      🏷️  async, feature
  ⚙️ 15:45:00 - cargo build --release
      ✅ Success (45.2s)
```

---

### `cm log export <path> [--format <format>]`
**Description**: Export logs to file (formats: json, markdown, html)

**Usage**:
```bash
cm log export ./project-log.md --format markdown
cm log export ./log.json --format json
cm log export ./report.html --format html
```

---

### `cm log analyze`
**Description**: Analyze log patterns and statistics

**Usage**:
```bash
cm log analyze
```

**Output**:
```
=== Captain's Log Analysis ===
📊 Total entries: 142
⚙️  Total commands: 89
✅ Successful builds: 67
❌ Failed builds: 22
📈 Success rate: 75.3%
⏱️  Average build time: 23.4s

🏷️  Most common tags:
   bug (15)
   performance (12)
   feature (10)
```

---

## Tide Charts Commands

### `cm tide show`
**Description**: Show interactive performance charts (TUI)

**Usage**:
```bash
cm tide show
```

**Controls**:
- `Tab` / `Shift+Tab`: Switch between views
- `q` / `Esc`: Quit
- Views: Overview, Performance, Dependencies, Trends

---

### `cm tide analyze`
**Description**: Analyze build performance and dependencies

**Usage**:
```bash
cm tide analyze
```

**Output**:
```
🔍 Analyzing dependency compile times...
✅ Timing data collected. Check target/cargo-timings/ for detailed report.
```

---

### `cm tide export <path>`
**Description**: Export build metrics to CSV

**Usage**:
```bash
cm tide export ./metrics.csv
```

**CSV Format**:
```csv
timestamp,command,duration,success,errors,warnings
2024-01-20T14:30:00Z,build,45.2,true,0,3
```

---

## Treasure Map Commands

### `cm map show`
**Description**: Display dependency tree visualization

**Usage**:
```bash
cm map show
```

**Output**:
```
🗺️  Treasure Map - Dependency Visualization

📦 my-project v0.1.0
├── 📚 serde v1.0.195
│   └── 📚 serde_derive v1.0.195
├── 📚 tokio v1.35.1
│   ├── 📚 mio v0.8.10
│   └── 📚 bytes v1.5.0
└── 📚 reqwest v0.11.23
```

---

### `cm map analyze`
**Description**: Analyze dependencies for issues

**Usage**:
```bash
cm map analyze
```

**Output**:
```
=== Dependency Analysis ===
📊 Total dependencies: 42
   Direct: 8
   Dev: 5
   Max depth: 4
💾 Total size: 15.3 MB

⚠️  2 duplicate dependencies found:
   rand has versions: 0.7.3, 0.8.5

📦 Largest dependencies:
   tokio v1.35.1 - 2.1 MB
   reqwest v0.11.23 - 1.8 MB
```

---

### `cm map export <path>`
**Description**: Export dependency graph as DOT file

**Usage**:
```bash
cm map export ./deps.dot
dot -Tpng deps.dot -o deps.png  # Generate image with graphviz
```

---

### `cm map path <from> <to>`
**Description**: Find dependency path between two crates

**Usage**:
```bash
cm map path serde tokio
```

**Output**:
```
📍 Path from serde to tokio:
  1. serde
  2. serde_json
  3. tower
  4. tokio
```

---

## Mutiny Mode Commands

### `cm mutiny activate <reason>`
**Description**: Activate mutiny mode to override cargo restrictions

**Usage**:
```bash
cm mutiny activate "Quick prototype testing"
```

---

### `cm mutiny deactivate`
**Description**: Deactivate mutiny mode

**Usage**:
```bash
cm mutiny deactivate
```

---

### `cm mutiny allow-warnings`
**Description**: Allow warnings for 1 hour

**Usage**:
```bash
cm mutiny allow-warnings
```

---

### `cm mutiny skip-tests`
**Description**: Skip tests when building

**Usage**:
```bash
cm mutiny skip-tests
```

---

### `cm mutiny force`
**Description**: Force build ignoring dirty state and lockfile

**Usage**:
```bash
cm mutiny force
```

---

### `cm mutiny yolo`
**Description**: DANGEROUS - Disable ALL checks for 30 minutes

**Usage**:
```bash
cm mutiny yolo
```

**⚠️ WARNING**: This disables:
- All lints
- All tests
- Format checking
- Security audits
- Lockfile checking

---

### `cm mutiny status`
**Description**: Show current mutiny mode status

**Usage**:
```bash
cm mutiny status
```

**Output**:
```
=== Mutiny Mode Status ===
Status: 🏴‍☠️ ACTIVE

📋 Active Overrides:
   allow_warnings - Temporarily allowing warnings
      Expires in: 45 minutes

🚩 Forced Flags:
   --cap-lints=warn

⏭️  Skipped Checks:
   test
```

---

## Version Management Commands

### `cm version init [version]`
**Description**: Initialize auto-versioning for the project

**Usage**:
```bash
cm version init              # Use default 1.0.0
cm version init 2.0.0        # Start with specific version
```

**What it does**:
- Creates `.v` file in project root
- Sets up auto-incrementing on cargo operations
- Configures versioning policies
- Integrates with Cargo.toml version field

**Output**:
```
🚢 Setting up auto-versioning for your project
Enter initial version number (default: 1.0.0): 2.0.0
Enable auto-incrementing? (Y/n): Y
Select increment policy:
1) Patch (1.0.0 -> 1.0.1) - Default
2) Minor (1.0.0 -> 1.1.0)
3) Major (1.0.0 -> 2.0.0)
Enter choice (1-3): 1
✅ Auto-versioning initialized with version 2.0.0
```

---

### `cm version info`
**Description**: Show current version information

**Usage**:
```bash
cm version info
```

**Output**:
```
🚢 Version Information:
══════════════════════════════════════════════════
📦 Current Version: 2.0.1
🔄 Auto-increment: Enabled
📊 Increment Policy: Patch
📁 Version File: .v
📋 Cargo.toml: 2.0.1
══════════════════════════════════════════════════
```

---

### `cm version increment <type>`
**Description**: Manually increment version

**Usage**:
```bash
cm version increment patch    # 2.0.1 -> 2.0.2
cm version increment minor    # 2.0.2 -> 2.1.0
cm version increment major    # 2.1.0 -> 3.0.0
```

---

### `cm version config <action> [value]`
**Description**: Configure versioning behavior

**Usage**:
```bash
cm version config show        # Show current configuration
cm version config enable       # Enable auto-incrementing
cm version config disable      # Disable auto-incrementing
cm version config policy patch # Set increment policy
```

**Policies**:
- `patch`: Increment patch version (1.0.0 -> 1.0.1)
- `minor`: Increment minor version (1.0.0 -> 1.1.0)
- `major`: Increment major version (1.0.0 -> 2.0.0)

---

## Build Optimization Commands

### `cm optimize aggressive`
**Description**: Apply aggressive optimizations for maximum build speed

**Usage**:
```bash
cm optimize aggressive
```

**What it applies**:
- Parallel jobs: CPU core count (8 on 8-core system)
- Incremental compilation: true
- Optimization level: 1 (basic optimizations)
- Codegen units: 256 (maximum parallelism)
- Debug level: 1 (reduced debug info)
- LTO: false (faster dev builds)

**Output**:
```
📋 Backed up Cargo.toml to Cargo.toml.backup
✅ Applied Aggressive optimizations to Cargo.toml

🚀 Build Optimization Summary:
══════════════════════════════════════════════════
📊 Parallel Jobs: 8
🔄 Incremental: true
⚡ Optimization Level: 1
🐛 Debug Level: 1
🏗️  Codegen Units: 256
🔗 Link-Time Optimization: false

🌍 Environment Variables:
  CARGO_BUILD_JOBS = "8"
  CARGO_INCREMENTAL = "1"
══════════════════════════════════════════════════
💡 Run 'cargo build' to see the speed improvements!
```

---

### `cm optimize balanced`
**Description**: Apply balanced optimizations for good speed/stability

**Usage**:
```bash
cm optimize balanced
```

**What it applies**:
- Parallel jobs: CPU core count / 2 (4 on 8-core system)
- Incremental compilation: true
- Optimization level: 1 (basic optimizations)
- Codegen units: 128 (moderate parallelism)
- Debug level: 1 (reduced debug info)
- LTO: false (faster dev builds)

---

### `cm optimize conservative`
**Description**: Apply conservative optimizations for maximum stability

**Usage**:
```bash
cm optimize conservative
```

**What it applies**:
- Parallel jobs: 2
- Incremental compilation: true
- Optimization level: 0 (no optimizations)
- Codegen units: 64 (minimal parallelism)
- Debug level: 2 (full debug info)
- LTO: false (faster dev builds)

---

### `cm optimize custom [JOBS] [INCREMENTAL] [OPT_LEVEL] [DEBUG_LEVEL] [CODEGEN_UNITS]`
**Description**: Apply custom optimizations with specific values

**Usage**:
```bash
cm optimize custom 16 true 2 1 512
```

**Parameters**:
- `JOBS`: Number of parallel jobs (default: 4)
- `INCREMENTAL`: Enable incremental compilation (default: true)
- `OPT_LEVEL`: Optimization level 0-3 (default: 1)
- `DEBUG_LEVEL`: Debug level 0-2 (default: 1)
- `CODEGEN_UNITS`: Codegen units for parallelism (default: 128)

---

### `cm optimize status`
**Description**: Show current optimization status

**Usage**:
```bash
cm optimize status
```

**Output**:
```
🔍 Current Build Optimization Status:
══════════════════════════════════════════════════
📊 Build Configuration:
  incremental: true
  jobs: 8

⚡ Dev Profile:
  codegen-units: 256
  debug: 1
  lto: false
  opt-level: 1

🌍 Environment Variables:
  CARGO_BUILD_JOBS: "8"
  CARGO_INCREMENTAL: "1"
══════════════════════════════════════════════════
```

---

### `cm optimize recommendations`
**Description**: Show optimization recommendations based on your system

**Usage**:
```bash
cm optimize recommendations
```

**Output**:
```
💡 Build Optimization Recommendations:
══════════════════════════════════════════════════
🖥️  CPU Cores: 8
📊 Recommended Jobs: 8

🚀 Aggressive Profile:
  - Parallel jobs: 8
  - Incremental: true
  - Opt level: 1 (basic optimizations)
  - Codegen units: 256 (maximum parallelism)
  - Debug: 1 (reduced debug info)

⚖️  Balanced Profile:
  - Parallel jobs: 4
  - Incremental: true
  - Opt level: 1 (basic optimizations)
  - Codegen units: 128 (moderate parallelism)
  - Debug: 1 (reduced debug info)

🛡️  Conservative Profile:
  - Parallel jobs: 2
  - Incremental: true
  - Opt level: 0 (no optimizations)
  - Codegen units: 64 (minimal parallelism)
  - Debug: 2 (full debug info)

💡 Use 'cm optimize aggressive' for maximum speed
💡 Use 'cm optimize balanced' for good speed/stability
💡 Use 'cm optimize conservative' for maximum stability
```

---

### `cm optimize restore`
**Description**: Restore original Cargo.toml from backup

**Usage**:
```bash
cm optimize restore
```

**Output**:
```
✅ Restored Cargo.toml from backup
```

---

## View Commands

### `cm view errors`
**Description**: View all build errors

**Usage**:
```bash
cm view errors
```

**Output**:
```
🔴 Latest Errors:
══════════════════════════════════════════════════
error[E0308]: mismatched types
  --> src/main.rs:42:5
  |
42 |     let result: String = 42;
  |         ^^^^^ expected String, found integer
  |
  = note: expected due to previous error

error[E0433]: failed to resolve: use of undeclared crate
  --> src/main.rs:7:5
  |
7 | use nonexistent_crate;
  |     ^^^^^^^^^^^^^^^^
══════════════════════════════════════════════════
```

---

### `cm view warnings`
**Description**: View all build warnings

**Usage**:
```bash
cm view warnings
```

---

### `cm view artifacts`
**Description**: View generated files and locations

**Usage**:
```bash
cm view artifacts
```

**Output**:
```
📦 Generated Artifacts:
══════════════════════════════════════════════════
🔨 Build Scripts:
  cargo-mate -> libs: 0, paths: 0, cfgs: 0

📁 Target Directory: target/
  ├── debug/
  │   ├── cm (executable)
  │   └── deps/
  └── release/
      ├── cm (executable)
      └── deps/

📋 Cargo.toml: Updated to version 1.0.1
══════════════════════════════════════════════════
```

---

### `cm view scripts`
**Description**: View build script outputs

**Usage**:
```bash
cm view scripts
```

---

### `cm view history`
**Description**: View detailed build history

**Usage**:
```bash
cm view history
```

---

### `cm view checklist`
**Description**: View checklist and fixes

**Usage**:
```bash
cm view checklist
```

---

### `cm view all`
**Description**: View all results in one place

**Usage**:
```bash
cm view all
```

**Output**:
```
🔍 Complete Build Results View:
══════════════════════════════════════════════════

🔴 ERRORS (2):
error[E0308]: mismatched types
  --> src/main.rs:42:5
  |
42 |     let result: String = 42;
  |         ^^^^^ expected String, found integer

⚠️  WARNINGS (1):
warning: unused variable
  --> src/main.rs:15:5
  |
15 |     let unused = "hello";
  |     ^^^^^^^^^

📦 ARTIFACTS:
🔨 Build Scripts:
  cargo-mate -> libs: 0, paths: 0, cfgs: 0

📁 Target Directory: target/
  ├── debug/
  │   ├── cm (executable)
  │   └── deps/
  └── release/
      ├── cm (executable)
      └── deps/

📋 Cargo.toml: Updated to version 1.0.1
══════════════════════════════════════════════════
```

---

### `cm view latest`
**Description**: Quick view of latest issues

**Usage**:
```bash
cm view latest
```

---

### `cm view open`
**Description**: Open results in file explorer

**Usage**:
```bash
cm view open
---

### `cm view all`
**Description**: View all results in one place

**Usage**:
```bash
cm view all
```

**Output**:
```
🔍 Complete Build Results View:
══════════════════════════════════════════════════

🔴 ERRORS (2):
error[E0308]: mismatched types
  --> src/main.rs:42:5
  |
42 |     let result: String = 42;
  |         ^^^^^ expected String, found integer

error[E0433]: failed to resolve: use of undeclared crate
  --> src/main.rs:7:5
  |
7 | use nonexistent_crate;
  |     ^^^^^^^^^^^^^^^^

⚠️  WARNINGS (1):
warning: unused variable
  --> src/main.rs:15:5
  |
15 |     let unused = "hello";
  |     ^^^^^^^^^

📦 ARTIFACTS:
🔨 Build Scripts:
  cargo-mate -> libs: 0, paths: 0, cfgs: 0

📁 Target Directory: target/
  ├── debug/
  │   ├── cm (executable)
  │   └── deps/
  └── release/
      ├── cm (executable)
      └── deps/

📋 Cargo.toml: Updated to version 1.0.1
══════════════════════════════════════════════════
```

---

### `cm view latest`
**Description**: Quick view of latest issues

**Usage**:
```bash
cm view latest
```

---

### `cm view open`
**Description**: Open results in file explorer

**Usage**:
```bash
cm view open
```

---

### `cm activate`
**Description**: Activate shell integration immediately

**Usage**:
```bash
cm activate
```

**What it does**:
- Sources your shell configuration file (`.bashrc`, `.zshrc`, etc.)
- Activates cargo-mate integration without restarting terminal
- Checks if integration exists before attempting to activate
- Provides clear feedback about activation status

**Example**:
```bash
cm init              # Sets up shell integration
cm activate          # Activates it immediately
cargo --version      # Now uses cargo-mate
```

**Output**:
```
⚡ Activating Cargo Mate shell integration...
🔄 Sourcing /root/.bashrc
✅ Shell integration activated successfully!

🚢 You can now use:
   cargo - cargo commands go through cargo-mate
   cm - direct cargo-mate access
   cg - quick alias

🎯 Try it:
   cargo --version
   cm --help
```

---

## Config Commands

### `cm config init`
**Description**: Initialize local project config

**Usage**:
```bash
cm config init
```

**Creates**: `.cg` file in project root

---

### `cm config set <key> <value> [--local]`
**Description**: Set a configuration value

**Usage**:
```bash
cm config set project.name "my-app" --local
cm config set build.default_profile release
cm config set auto_fix.format_on_save true
```

**Available Keys**:
- `project.name`
- `project.default_journey`
- `project.theme`
- `project.auto_checklist`
- `auto_fix.format_on_save`
- `auto_fix.clippy_on_build`
- `build.default_profile`
- `build.incremental`

---

### `cm config get <key>`
**Description**: Get a configuration value

**Usage**:
```bash
cm config get project.name
cm config get build.default_profile
```

---

### `cm config list`
**Description**: List all configuration

**Usage**:
```bash
cm config list
```

---

### `cm config shortcut <name> <command> [--local]`
**Description**: Add a command shortcut

**Usage**:
```bash
cm config shortcut b "build --release" --local
cm config shortcut t "test --all"
cm config shortcut d "doc --open"
```

---

### `cm config hook <type> <command> [--local]`
**Description**: Add a build hook

**Usage**:
```bash
cm config hook pre_build "cargo fmt"
cm config hook post_build "cargo test"
cm config hook on_error "cm checklist"
cm config hook on_success "echo 'Build successful!'"
```

**Hook Types**:
- `pre_build`: Run before cargo commands
- `post_build`: Run after successful builds
- `on_error`: Run when build fails
- `on_success`: Run when build succeeds

---

## Utility Commands

### `cm checklist`
**Description**: Show current error/warning checklist

**Usage**:
```bash
cm checklist
```

**Output**:
```
=== Build Checklist [3 errors, 2 warnings] ===
Generated: 2024-01-20 14:30:00

ERRORS (must fix):
[ ] Fix E0308 in src/main.rs:42 - mismatched types: expected String, found &str
[ ] Fix E0384 in src/lib.rs:13 - cannot assign twice to immutable variable
[ ] Fix E0433 in src/parser.rs:7 - failed to resolve: use of undeclared crate

WARNINGS (consider fixing):
[ ] dead_code in src/utils.rs:23 - function `helper` is never used
[ ] unused_imports in src/main.rs:3 - unused import: `std::fs`
```

---

### `cm history <type> [limit]`
**Description**: Show build history

**Usage**:
```bash
cm history summary 20    # Last 20 builds summary
cm history errors 10     # Last 10 errors
cm history warnings 10   # Last 10 warnings
```

**Output (summary)**:
```
=== Build History Summary ===
📊 Last 20 builds:
  ✅ Successful: 15
  ❌ Failed: 5

📈 Recent builds:
  ✅ 2024-01-20 14:30:00 - cargo build - 🔴 0 ⚠️ 3
  ❌ 2024-01-20 14:00:00 - cargo test - 🔴 2 ⚠️ 1
```

---

### `cm exec <cargo-command> [args...]`
**Description**: Execute cargo command through cm wrapper

**Usage**:
```bash
cm exec build --release
cm exec test --all
cm exec clippy
```

**Note**: Any unrecognized cm command automatically falls through to cargo

---

## Shell Integration

### `cm install`
**Description**: Install shell integration (bash, zsh, fish)

**Usage**:
```bash
cm install
```

**What it does**:
1. Detects your shell
2. Backs up your RC file
3. Adds cargo function override
4. Creates aliases (cm, cg)
5. Installs completions
6. Sets up auto-config loading

**After installation**:
```bash
source ~/.bashrc  # or ~/.zshrc
# OR use the new command:
cm activate
```

**Result**:
- `cargo` commands routed through cm
- `cm` available directly
- `cg` as quick alias
- Tab completion enabled
- `.cg` files auto-loaded in directories

---

## Environment Variables

### Configuration
- `CM_PROJECT_CONFIG`: Path to project config file
- `CM_DEFAULT_PROFILE`: Default build profile
- `CM_PARALLEL_JOBS`: Number of parallel build jobs
- `CM_AUTO_FIX`: Enable auto-fix features
- `CM_THEME`: UI theme (nautical by default)

### Example:
```bash
export CM_DEFAULT_PROFILE=release
export CM_AUTO_FIX=true
cm  # Will use these settings
```

---

## Config File Examples

### Global Config (`~/.shipwreck/config.toml`)
```toml
[project]
theme = "nautical"
auto_checklist = true
track_performance = true

[shortcuts]
b = "build --release"
t = "test --all"
c = "check"

[auto_fix]
format_on_save = true
clippy_on_build = false

[build]
default_profile = "dev"
incremental = true
```

### Project Config (`.cg`)
```toml
[project]
name = "my-awesome-project"
default_journey = "dev-cycle"

[shortcuts]
dev = "run --bin dev-server"
prod = "build --release --target x86_64-unknown-linux-musl"

[hooks]
pre_build = ["cargo fmt --check"]
post_build = ["cargo test --quiet"]
on_error = ["cm checklist"]

[version]
auto_increment = true
increment_policy = "patch"
```

---

## Tips & Tricks

### 1. Quick Development Cycle
```bash
cm journey record dev-cycle
cargo fmt
cargo clippy
cargo test
cargo run
# Ctrl+D

# Later:
cm  # If default_journey = "dev-cycle"
```

### 2. Safe Experimentation
```bash
cm anchor save safe-point
cm mutiny yolo  # Go wild for 30 min
# ... experiment ...
cm anchor restore safe-point  # If things go wrong
```

### 3. Team Workflow Sharing
```bash
cm journey record onboarding
# Show new developer the full setup
cm journey export onboarding team-onboarding.json
# Share the file
```

### 4. Performance Tracking
```bash
# After each build, cm automatically tracks metrics
cm tide show  # View beautiful charts
cm tide export metrics.csv  # For external analysis
```

### 5. Dependency Auditing
```bash
cm map analyze  # Quick dependency check
cm map path vulnerable-crate my-crate  # Trace dependencies
```

### 6. Build Optimization
```bash
# Get recommendations for your system
cm optimize recommendations

# Apply aggressive optimizations
cm optimize aggressive

# Check what was changed
cm optimize status

# Restore if needed
cm optimize restore
```

### 7. Auto-Versioning
```bash
# Initialize with custom version
cm version init 2.0.0

# Version auto-increments on every build
cm check    # 2.0.0 -> 2.0.1
cm build    # 2.0.1 -> 2.0.2

# Manual version bump
cm version increment minor  # 2.0.2 -> 2.1.0
```

---

## Error Codes

| Code | Description | Solution |
|------|-------------|----------|
| File not found | Journey/Anchor doesn't exist | Check name with `list` command |
| Permission denied | Can't write to ~/.shipwreck | Check directory permissions |
| Invalid config | Config file malformed | Check TOML syntax |
| Cargo not found | Cargo not in PATH | Install Rust toolchain |

---

## Troubleshooting

### Issue: Commands not working after install
**Solution**: Source your shell RC file or restart terminal
```bash
source ~/.bashrc  # or ~/.zshrc
```

### Issue: Tide charts not displaying
**Solution**: Requires terminal with UTF-8 support and 80+ columns

### Issue: Journey recording captures too much
**Solution**: Edit journey file in ~/.shipwreck/journeys/ to remove unwanted commands

### Issue: Mutiny mode won't deactivate
**Solution**: Settings expire automatically, or run:
```bash
cm mutiny deactivate
rm ~/.shipwreck/mutiny.toml  # Nuclear option
```

### Issue: Version not auto-incrementing
**Solution**: Check if auto-increment is enabled:
```bash
cm version config show
cm version config enable  # If disabled
```

### Issue: Build optimizations not working
**Solution**: Check current status and restore if needed:
```bash
cm optimize status
cm optimize restore  # If configuration is corrupted
```

---

## More Information

- GitHub: [cargo-mate repository]#
- Issues: [Report bugs]#
- Docs: See README.md for overview
- Version: Run `cm --version`

---

*Built with ❤️ for the Rust community*