@@ -3,128 +3,108 @@ title: Your First Command
33description : Learn the basics of using Magic Shell to translate natural language to terminal commands.
44---
55
6- import { Aside , Steps } from ' @astrojs/starlight/components' ;
6+ import { Aside , Steps , Tabs , TabItem } from ' @astrojs/starlight/components' ;
77
88Now that you have Magic Shell installed and configured, let's try your first command!
99
10- ## Basic Usage
10+ ## Choose Your Mode
1111
12- Simply describe what you want to do in plain English :
12+ Magic Shell offers two ways to work :
1313
14- ``` bash
15- msh " find all JavaScript files "
16- ```
14+ < Tabs >
15+ < TabItem label = " TUI Mode (Recommended) " >
16+ Launch the interactive terminal interface:
1717
18- Magic Shell will translate this and show you the command:
18+ ``` bash
19+ mshell
20+ ```
1921
20- ```
21- find . -name "*.js"
22- ```
22+ The TUI gives you:
23+ - A persistent interface for multiple queries
24+ - Command history and context
25+ - Live model and theme switching
26+ - Safety analysis display
27+ - Keyboard shortcuts for everything
2328
24- ## Execution Modes
29+ Simply type your query and press Enter. The translated command appears with safety info, ready to execute or copy.
30+ </TabItem >
31+ <TabItem label = " CLI Mode" >
32+ For quick one-off translations:
2533
26- ### Print Only (Default)
34+ ``` bash
35+ msh " find all JavaScript files"
36+ ```
2737
28- By default, Magic Shell prints the command without executing it:
38+ Output:
39+ ```
40+ find . -name "* .js"
41+ ```
2942
30- ``` bash
31- msh " show disk usage"
32- # Output: df -h
33- ```
43+ Use ` -x ` to execute directly:
44+ ```bash
45+ msh -x "show disk usage"
46+ ```
47+ </TabItem >
48+ </Tabs >
3449
35- ### Execute Immediately
50+ ## TUI Workflow
3651
37- Use the ` -x ` flag to execute the command directly:
38-
39- ``` bash
40- msh -x " show current directory "
41- # Executes: pwd
42- ```
52+ < Steps >
53+ 1 . Launch with ` mshell `
54+ 2 . Type your query in natural language
55+ 3 . Review the translated command and safety analysis
56+ 4 . Press Enter to execute, or use keyboard shortcuts to copy/modify
57+ </ Steps >
4358
44- <Aside type = " caution " >
45- The ` -x ` flag executes commands immediately. Always review the command in the output before using ` -x ` on unfamiliar queries.
59+ <Aside type = " tip " >
60+ The TUI remembers your command history across sessions, making it easy to refine and re-run previous queries.
4661</Aside >
4762
48- ### Dry Run with Safety Analysis
49-
50- Use ` -n ` to see the command with a full safety analysis:
51-
52- ``` bash
53- msh -n " delete all node_modules folders"
54- ```
55-
56- This shows:
57- - The translated command
58- - Safety severity level
59- - Why it was flagged (if applicable)
60- - Whether confirmation is required
63+ ## CLI Quick Reference
6164
62- ## Interactive Mode
65+ | Command | Description |
66+ | ---------| -------------|
67+ | ` msh "query" ` | Translate and print |
68+ | ` msh -x "query" ` | Translate and execute |
69+ | ` msh -n "query" ` | Dry run with safety analysis |
6370
64- For a richer experience, launch the TUI:
65-
66- ``` bash
67- msh -i
68- # or just
69- msh
70- ```
71-
72- In TUI mode you can:
73- - Type queries naturally
74- - See command history
75- - Change models on the fly
76- - Toggle dry-run mode
77- - Switch themes
71+ <Aside type = " caution" >
72+ The ` -x ` flag executes commands immediately. Use ` -n ` first on unfamiliar queries to review the safety analysis.
73+ </Aside >
7874
7975## Example Queries
8076
81- Here are some things you can ask Magic Shell :
77+ Try these in either mode :
8278
8379### File Operations
84- ``` bash
85- msh " find files larger than 100MB"
86- msh " count lines of code in this project"
87- msh " show the 10 most recently modified files"
88- msh " compress this folder to a zip file"
89- ```
80+ - "find files larger than 100MB"
81+ - "count lines of code in this project"
82+ - "show the 10 most recently modified files"
9083
9184### Git Operations
92- ``` bash
93- msh " undo my last commit but keep changes"
94- msh " show commits from the last week"
95- msh " create a branch called feature-login"
96- msh " what files changed in the last commit"
97- ```
85+ - "undo my last commit but keep changes"
86+ - "show commits from the last week"
87+ - "what files changed in the last commit"
9888
9989### System Operations
100- ``` bash
101- msh " what process is using port 3000"
102- msh " show memory usage"
103- msh " list all running docker containers"
104- msh " check if nginx is running"
105- ```
106-
107- ### Network
108- ``` bash
109- msh " download this file" # followed by URL
110- msh " what's my IP address"
111- msh " test if google.com is reachable"
112- ```
90+ - "what process is using port 3000"
91+ - "show memory usage"
92+ - "list all running docker containers"
11393
11494## Tips
11595
11696<Steps >
117- 1 . ** Be specific** : "find large files" is good, "find files larger than 100MB in the downloads folder " is better.
97+ 1 . ** Be specific** : "find files larger than 100MB in downloads" is better than "find large files"
11898
119- 2 . ** Mention your context ** : "in this git repo" or "in the current directory" helps Magic Shell generate more accurate commands.
99+ 2 . ** Use TUI for exploration ** : The interactive mode makes it easy to refine queries and see history
120100
121- 3 . ** Use dry run first ** : When trying something new, use ` -n ` to review the command and its safety analysis.
101+ 3 . ** Check safety analysis ** : Commands are analyzed for risk before execution
122102
123- 4 . ** Check the model ** : Different models have different strengths. Use ` Ctrl+X M ` in TUI to switch models.
103+ 4 . ** Switch models ** : Different models have different strengths. Use ` Ctrl+X M ` in TUI to switch
124104</Steps >
125105
126106## Next Steps
127107
108+ - Explore [ TUI mode] ( /features/tui-mode/ ) features and shortcuts
128109- Learn about [ AI providers] ( /features/providers/ ) and which models to use
129110- Understand the [ safety system] ( /features/safety-levels/ ) that protects you
130- - Explore [ TUI mode] ( /features/tui-mode/ ) features and shortcuts
0 commit comments