ask Command
Ask questions and get answers from MyDeskBot.
Usage
bash
mydeskbot ask [options] <question>Options
| Option | Alias | Description | Default |
|---|---|---|---|
--model | -m | AI model to use | Configured model |
--temperature | -t | Temperature (0.0-2.0) | 1.0 |
--max-tokens | -n | Max response tokens | 4096 |
--context | -c | Include context from files | false |
--code | -C | Include code context | false |
--format | -f | Output format (text, markdown, json) | markdown |
--output | -o | Output file | - |
--no-stream | Disable streaming | false | |
--history | -H | Show conversation history | false |
--continue | Continue from last conversation | false | |
--help | -h | Show help | - |
Examples
Basic Question
bash
mydeskbot ask "How do I reverse a string in Python?"With Custom Model
bash
mydeskbot ask -m gpt-4 "Explain quantum computing"With Code Context
bash
mydeskbot ask --code "Review this function for bugs"Save to File
bash
mydeskbot ask "Generate API documentation" -o docs/api.mdJSON Output
bash
mydeskbot ask "What is 2+2?" --format jsonContinue Conversation
bash
# First question
mydeskbot ask "What is React?"
# Continue with follow-up
mydeskbot ask --continue "How do I install it?"Use Cases
1. Quick Questions
bash
mydeskbot ask "What's the difference between let and const in JavaScript?"2. Code Explanation
bash
mydeskbot ask --code "Explain what this function does"3. Best Practices
bash
mydeskbot ask "What are best practices for REST API design?"4. Troubleshooting
bash
mydeskbot ask "Why is my React component not re-rendering?"5. Learning
bash
mydeskbot ask "Explain how machine learning works"Code Context
When using --code, MyDeskBot can read and analyze code files:
bash
# Include specific file
mydeskbot ask --code src/utils/helper.js "Add error handling"
# Include multiple files
mydeskbot ask --code src/ --recursive "Refactor for better performance"Output Formats
Text
bash
mydeskbot ask --format text "What is AI?"Markdown (Default)
bash
mydeskbot ask --format markdown "Create a README"JSON
bash
mydeskbot ask --format json "List 5 colors"Output:
json
{
"response": "1. Red\n2. Blue\n3. Green\n4. Yellow\n5. Purple",
"model": "gpt-4o",
"tokens": 50
}Conversation History
View conversation history:
bash
mydeskbot ask --historyContinue from last conversation:
bash
mydeskbot ask --continue "Tell me more"Tips
1. Be Specific
bash
# Good
mydeskbot ask "How do I implement JWT authentication in Node.js with Express?"
# Less specific
mydeskbot ask "How to auth?"2. Use Context
bash
# With code context
mydeskbot ask --code "Refactor this for better performance"
# Without context (less helpful)
mydeskbot ask "How to optimize code?"3. Save Useful Responses
bash
mydeskbot ask "Generate a .gitignore template" -o .gitignore4. Chain Commands
bash
# Ask and execute
mydeskbot ask "Create a React component" | xargs echoAdvanced Usage
Streaming
bash
# Streaming is enabled by default
mydeskbot ask "Explain microservices"
# Disable streaming
mydeskbot ask --no-stream "Explain microservices"Temperature Control
bash
# Low temperature (more focused)
mydeskbot ask -t 0.2 "Generate SQL query"
# High temperature (more creative)
mydeskbot ask -t 1.5 "Write a story"Context Files
bash
# Include README
mydeskbot ask --context README.md "Add installation instructions"
# Include multiple files
mydeskbot ask -c README.md -c package.json "Update documentation"Common Questions
Q: How do I include my codebase?
bash
mydeskbot ask --code ./src/ "Review this code"Q: Can I save responses?
bash
mydeskbot ask "Generate documentation" -o docs.mdQ: How do I continue a conversation?
bash
mydeskbot ask --continue "More details please"