Skip to content

CLI Reference

XunLong provides a comprehensive command-line interface for all content generation tasks.

Installation

bash
# Install XunLong
pip install -r requirements.txt

# Verify installation
python xunlong.py --version

Global Options

bash
python xunlong.py [COMMAND] [OPTIONS]
OptionDescription
--versionShow version and exit
--helpShow help message

Commands Overview

CommandPurposeQuick Example
reportGenerate research reportsxunlong.py report "AI Trends"
fictionCreate fiction storiesxunlong.py fiction "Mystery novel"
pptGenerate presentationsxunlong.py ppt "Product Launch"
exportExport to different formatsxunlong.py export <id> --type pdf
iterateRefine existing contentxunlong.py iterate <id> "Add examples"
askQuick Q&A (experimental)xunlong.py ask "What is AI?"
statusCheck system statusxunlong.py status

report Command

Generate comprehensive research reports.

Syntax

bash
python xunlong.py report QUERY [OPTIONS]

Arguments

ArgumentRequiredDescription
QUERYYesResearch topic or question

Options

OptionShortTypeDefaultDescription
--type-tChoicecomprehensiveReport type
--depth-dChoicedeepSearch depth
--max-results-mInteger20Maximum search results
--output-format-oChoicehtmlOutput format
--html-templateStringacademicHTML template
--html-themeStringlightHTML theme
--verbose-vFlagfalseShow detailed process

Report Types

ValueDescriptionBest For
comprehensiveFull detailed reportIn-depth analysis
dailyDaily briefing formatQuick updates
analysisAnalytical reportData analysis
researchAcademic researchResearch papers

Search Depth

ValueSpeedResultsBest For
surfaceFast5-10Quick overviews
mediumModerate10-15Standard reports
deepSlower15-20+Comprehensive research

Output Formats

ValueExtensionDescription
html.htmlStyled web page
md / markdown.mdPlain Markdown

HTML Templates

ValueStyleBest For
academicFormal, structuredResearch reports
technicalCode-friendlyTechnical docs

HTML Themes

ValueStyle
lightLight background
darkDark background

Examples

Basic usage:

bash
python xunlong.py report "Artificial Intelligence trends in 2025"

Custom depth and results:

bash
python xunlong.py report "Blockchain technology" \
  --type analysis \
  --depth deep \
  --max-results 30

Markdown output:

bash
python xunlong.py report "Quantum Computing" \
  -o md \
  -v

Technical report with dark theme:

bash
python xunlong.py report "Kubernetes best practices" \
  --type research \
  --html-template technical \
  --html-theme dark

fiction Command

Create fictional stories and novels.

Syntax

bash
python xunlong.py fiction QUERY [OPTIONS]

Arguments

ArgumentRequiredDescription
QUERYYesStory premise or description

Options

OptionShortTypeDefaultDescription
--genre-gChoicemysteryStory genre
--length-lChoiceshortStory length
--viewpoint-vpChoicefirstNarrative perspective
--constraint-cStringNoneSpecial constraints (multi)
--output-format-oChoicehtmlOutput format
--html-templateStringnovelHTML template
--html-themeStringsepiaHTML theme
--verbose-vFlagfalseShow details

Genres

ValueDescriptionCharacteristics
mysteryMystery/DetectivePuzzle-solving, clues
scifiScience FictionFuturistic, technology
fantasyFantasyMagic, mythical
horrorHorrorSuspense, fear
romanceRomanceLove story
wuxiaWuxiaMartial arts

Story Lengths

ValueChaptersWordsReading Time
short510,000-15,0001-2 hours
medium1230,000-50,0003-5 hours
long3080,000-120,0008-12 hours

Viewpoints

ValueDescriptionExample
firstFirst person"I walked into the room..."
thirdThird person limited"She walked into the room..."
omniscientOmniscient narrator"Unknown to her, danger lurked..."

Constraints

Use -c multiple times to add constraints:

bash
-c "locked room" -c "snowstorm" -c "limited time"

HTML Templates

ValueStyleBest For
novelBook-style layoutGeneral fiction
ebookE-reader optimizedDigital reading

HTML Themes

ValueBackgroundBest For
lightWhiteDay reading
darkBlackNight reading
sepiaCreamEye comfort

Examples

Basic mystery story:

bash
python xunlong.py fiction "A detective investigates a locked room murder"

Sci-fi novella:

bash
python xunlong.py fiction "First contact with aliens" \
  --genre scifi \
  --length medium \
  --viewpoint third

Constrained mystery:

bash
python xunlong.py fiction "Murder in a mansion" \
  --genre mystery \
  -c "snowstorm isolation" \
  -c "8 suspects" \
  -o html \
  -v

Long fantasy epic:

bash
python xunlong.py fiction "Young hero's journey to save the kingdom" \
  --genre fantasy \
  --length long \
  --viewpoint omniscient \
  --html-template ebook

ppt Command

Generate PowerPoint-style presentations.

Syntax

bash
python xunlong.py ppt TOPIC [OPTIONS]

Arguments

ArgumentRequiredDescription
TOPICYesPresentation topic

Options

OptionShortTypeDefaultDescription
--style-sChoicebusinessPPT style
--slides-nInteger10Number of slides
--depth-dChoicemediumContent depth
--themeStringdefaultColor theme
--speech-notesStringNoneGenerate speaker notes
--verbose-vFlagfalseShow details

PPT Styles

ValueDescriptionBest For
redRED minimalistSimple, focused
businessBusiness detailedCorporate
academicAcademic styleResearch talks
creativeCreative designMarketing
simpleMinimal designTech talks

Slide Counts

SlidesDurationBest For
5-75-10 minQuick pitch
10-1515-20 minStandard presentation
20-3030-45 minDetailed talk
40+60+ minWorkshop/training

Depth Levels

ValueDetailContent/Slide
surfaceBrief3-5 bullet points
mediumBalanced5-7 bullet points
deepDetailed7-10 bullet points

Themes

ValueColorsBest For
defaultNeutralGeneral use
blueBlue tonesCorporate
redRed accentBold statements
greenGreen tonesEnvironmental
purplePurple shadesCreative

Speech Notes

Provide a scenario description to generate speaker notes:

bash
--speech-notes "Investor pitch for seed funding"

This generates detailed talking points for each slide.

Examples

Basic presentation:

bash
python xunlong.py ppt "Artificial Intelligence Overview"

Business presentation:

bash
python xunlong.py ppt "Q4 Sales Performance" \
  --style business \
  --slides 15 \
  --theme blue

Academic talk:

bash
python xunlong.py ppt "Machine Learning Research" \
  --style academic \
  --depth deep \
  --slides 25

Investor pitch with notes:

bash
python xunlong.py ppt "Startup Seed Round" \
  --style red \
  --slides 10 \
  --speech-notes "Presenting to venture capitalists" \
  -v

Creative marketing deck:

bash
python xunlong.py ppt "New Brand Launch Campaign" \
  --style creative \
  --slides 18 \
  --theme purple \
  --depth medium

export Command

Export projects to different formats.

Syntax

bash
python xunlong.py export PROJECT_ID --type FORMAT [OPTIONS]

Arguments

ArgumentRequiredDescription
PROJECT_IDYesProject identifier (from generation output)

Options

OptionShortTypeRequiredDescription
--type-tChoiceYesExport format
--output-oStringNoCustom output path
--verbose-vFlagNoShow details

Export Formats

ValueExtensionDescriptionDependencies
pptx.pptxPowerPoint filepython-pptx
pdf.pdfPDF documentweasyprint
docx.docxWord documentpython-docx
md.mdMarkdown fileBuilt-in

Examples

Export to PowerPoint:

bash
python xunlong.py export 20251005_143022_ai_trends --type pptx

Export to PDF with custom path:

bash
python xunlong.py export 20251005_180344_report \
  --type pdf \
  --output ~/Desktop/my_report.pdf

Export to Word:

bash
python xunlong.py export 20251005_215421_novel \
  --type docx \
  -v

Export to Markdown:

bash
python xunlong.py export 20251005_123456_presentation --type md

Install Export Dependencies

bash
# For PPTX export
pip install python-pptx

# For PDF export
pip install weasyprint

# For DOCX export
pip install python-docx

# For Markdown conversion
pip install markdown2

# Install all
pip install python-pptx python-docx markdown2 weasyprint

iterate Command

Refine and modify existing projects.

Syntax

bash
python xunlong.py iterate PROJECT_ID REQUIREMENT [OPTIONS]

Arguments

ArgumentRequiredDescription
PROJECT_IDYesProject identifier
REQUIREMENTYesModification request

Options

OptionShortTypeDefaultDescription
--verbose-vFlagfalseShow details

Modification Examples

For Reports:

bash
# Add content
python xunlong.py iterate 20251005_143022 "Add a section on future trends"

# Update data
python xunlong.py iterate 20251005_143022 "Update statistics with 2025 data"

# Improve clarity
python xunlong.py iterate 20251005_143022 "Simplify technical explanations"

For Fiction:

bash
# Character development
python xunlong.py iterate 20251005_180344 "Make protagonist more conflicted in chapter 3"

# Plot enhancement
python xunlong.py iterate 20251005_180344 "Add foreshadowing in chapter 5"

# Pacing
python xunlong.py iterate 20251005_180344 "Slow down the climax scene"

For PPT:

bash
# Add slides
python xunlong.py iterate 20251005_215421 "Add 2 slides on market analysis after slide 5"

# Modify content
python xunlong.py iterate 20251005_215421 "Change slide 3 chart to pie chart"

# Reorder
python xunlong.py iterate 20251005_215421 "Move conclusion before Q&A slide"

Examples

Add section to report:

bash
python xunlong.py iterate 20251005_143022 "Add case studies section"

Enhance fiction chapter:

bash
python xunlong.py iterate 20251005_180344 "Rewrite chapter 5 with more suspense" -v

Modify PPT slide:

bash
python xunlong.py iterate 20251005_215421 "Change slide 3 to use infographic" -v

ask Command

Quick Q&A without deep research (experimental).

Syntax

bash
python xunlong.py ask QUESTION [OPTIONS]

Arguments

ArgumentRequiredDescription
QUESTIONYesYour question

Options

OptionShortTypeDefaultDescription
--model-mChoicebalancedModel selection
--verbose-vFlagfalseShow details

Model Options

ValueSpeedQualityBest For
fastFastestBasicQuick answers
balancedModerateGoodGeneral Q&A
qualitySlowerBestComplex questions

Examples

bash
# Basic question
python xunlong.py ask "What is quantum computing?"

# High quality answer
python xunlong.py ask "Explain machine learning" --model quality -v

Note: This feature is currently under development.


status Command

Check system status and configuration.

Syntax

bash
python xunlong.py status

Output Information

  • System status
  • LLM configuration count
  • Available providers
  • Provider status

Example

bash
python xunlong.py status

Output:

=== XunLong System Status ===

System: XunLong v1.0.0
Status: ✓ Running

LLM Configuration: 3 configs

Available Providers:
  • OpenAI: Available
  • Anthropic: Available
  • Local: Not configured

Common Workflows

1. Generate Report → Export to PDF

bash
# Step 1: Generate report
python xunlong.py report "AI Industry Analysis 2025" \
  --type comprehensive \
  --depth deep \
  -o md

# Step 2: Get project ID from output
# (e.g., 20251005_143022_ai_industry_analysis)

# Step 3: Export to PDF
python xunlong.py export 20251005_143022_ai_industry_analysis --type pdf

2. Create Fiction → Iterate → Export

bash
# Step 1: Generate story
python xunlong.py fiction "Detective mystery" \
  --genre mystery \
  --length medium

# Step 2: Refine
python xunlong.py iterate 20251005_180344_detective_mystery \
  "Add more clues in chapter 3"

# Step 3: Export to DOCX
python xunlong.py export 20251005_180344_detective_mystery --type docx

3. Create PPT → Add Slides → Export

bash
# Step 1: Generate PPT
python xunlong.py ppt "Product Launch 2025" \
  --style business \
  --slides 12

# Step 2: Add slides
python xunlong.py iterate 20251005_215421_product_launch \
  "Add 3 slides on pricing strategy"

# Step 3: Export to PowerPoint
python xunlong.py export 20251005_215421_product_launch --type pptx

Environment Variables

Configure XunLong behavior via environment variables:

bash
# LLM API Keys
export OPENAI_API_KEY="your-key"
export ANTHROPIC_API_KEY="your-key"

# LangFuse Tracking (optional)
export LANGFUSE_SECRET_KEY="your-key"
export LANGFUSE_PUBLIC_KEY="your-key"
export LANGFUSE_HOST="https://cloud.langfuse.com"

# Default Settings
export XUNLONG_DEFAULT_DEPTH="deep"
export XUNLONG_DEFAULT_FORMAT="html"

Tips & Best Practices

1. Use Verbose Mode for Debugging

bash
python xunlong.py report "Topic" -v

Shows detailed execution steps.

2. Save Project IDs

Project IDs are needed for export and iteration:

bash
# Good practice: save to variable
PROJECT_ID=$(python xunlong.py report "Topic" | grep "Project ID" | cut -d: -f2)
python xunlong.py export $PROJECT_ID --type pdf

3. Combine Formats

Generate both HTML and Markdown:

bash
# Generate HTML
python xunlong.py report "Topic" -o html

# Export same project to Markdown
python xunlong.py export <project-id> --type md

4. Iterative Refinement

Don't aim for perfection on first try:

bash
# 1. Quick generation
python xunlong.py report "Topic" --depth surface

# 2. Review output
# 3. Iterate to improve
python xunlong.py iterate <id> "Add more examples"

5. Use Appropriate Depth

TaskRecommended Depth
Quick overviewsurface
Standard reportmedium
Research paperdeep
Blog postsurface or medium

Troubleshooting

Command Not Found

bash
# Use python explicitly
python xunlong.py --help

# Or make executable
chmod +x xunlong.py
./xunlong.py --help

Missing Dependencies

bash
# Install all dependencies
pip install -r requirements.txt

# Install export dependencies
pip install python-pptx python-docx markdown2 weasyprint

API Key Issues

bash
# Check if API key is set
echo $OPENAI_API_KEY

# Set API key
export OPENAI_API_KEY="sk-..."

Project Not Found

bash
# List projects
ls storage/

# Use full project ID including timestamp
python xunlong.py export 20251005_143022_full_name --type pdf

Next Steps

Released under the MIT License.