CLI Reference
Command-line tool for exporting Discord content to static files.
Installation
# Install globally
npm install -g @discolink/cli
# Or use npx
npx @discolink/cli export --help Commands
discolink init
Initialize a new DiscoLink project with interactive prompts.
discolink init Creates discolink.config.json with your configuration:
{
"serverId": "123456789",
"apiUrl": "http://localhost:3000",
"template": "faq",
"output": "./dist",
"build": {
"clean": true,
"generateSitemap": true,
"generateRss": true
}
} discolink export
Export Discord content to static HTML files.
discolink export [options] Options
| Option | Description | Default |
|---|---|---|
-s, --server <id> | Server ID to export | From config |
-t, --thread <id> | Export single thread | - |
-c, --channel <id> | Export specific channel only | - |
-o, --output <dir> | Output directory | ./dist |
--template <name> | Template: faq, changelog, kb, blog | faq |
--base-url <url> | Base URL for generated links | - |
--api-url <url> | DiscoLink API URL | http://localhost:3000 |
--clean | Clean output directory first | false |
Examples
# Export entire server
discolink export --server 123456789 --output ./dist
# Export with custom template
discolink export --server 123456789 --template changelog
# Export single thread
discolink export --thread 987654321
# Export with base URL for production
discolink export --server 123456789 --base-url https://faq.example.com discolink sync
Verify API connection and show server status.
discolink sync [options] Options
| Option | Description | Default |
|---|---|---|
-s, --server <id> | Server ID to check | From config |
--api-url <url> | DiscoLink API URL | http://localhost:3000 |
Output Structure
After running discolink export, you'll have:
dist/
├── index.html # Main listing page
├── threads/
│ ├── how-to-auth.html
│ ├── getting-started.html
│ └── ...
├── sitemap.xml # Sitemap for SEO
├── feed.xml # RSS feed
└── robots.txt # Robots.txt Deployment
The output is static HTML that can be deployed anywhere:
Netlify
# netlify.toml
[build]
command = "discolink export --server YOUR_ID"
publish = "dist" Vercel
# vercel.json
{
"buildCommand": "discolink export --server YOUR_ID",
"outputDirectory": "dist"
} GitHub Pages
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
schedule:
- cron: '0 */6 * * *' # Rebuild every 6 hours
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install -g @discolink/cli
- run: discolink export --server ${{ secrets.SERVER_ID }} --api-url ${{ secrets.API_URL }}
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist Configuration File
The discolink.config.json file supports:
{
"serverId": "123456789", // Required
"apiUrl": "http://localhost:3000", // API endpoint
"template": "faq", // Default template
"output": "./dist", // Output directory
"build": {
"clean": true, // Clean before build
"generateSitemap": true, // Generate sitemap.xml
"generateRss": true // Generate feed.xml
},
"seo": {
"titleSuffix": " - My FAQ", // Append to page titles
"defaultDescription": "..." // Default meta description
}
}