init Command

init Command

Create a Capyseo configuration file for your project.

Usage

capyseo init [options]

Options

Option Type Default Description
--typescript flag false Generate TypeScript config
--force flag false Overwrite existing config

Examples

# Create JavaScript config capyseo init # Create TypeScript config capyseo init --typescript # Overwrite existing config capyseo init --force # TypeScript with overwrite capyseo init --typescript --force

Generated Files

JavaScript (capyseo.config.js)

/** @type {import('@capyseo/core').CapyseoConfig} */ export default { rules: { // Critical SEO 'meta-title': { severity: 'error' }, 'meta-description': { severity: 'error' }, 'image-alt': { severity: 'error' }, 'canonical-url': { severity: 'error' }, 'lang-attribute': { severity: 'error' }, // Important 'heading-hierarchy': { severity: 'warning' }, 'open-graph': { severity: 'warning' }, 'twitter-card': { severity: 'warning' }, 'broken-links': { severity: 'warning' }, // Nice to have 'json-ld': { severity: 'info' }, 'security-headers': { severity: 'info' }, 'word-count': { severity: 'info' }, 'readability': { severity: 'info' }, }, ai: { enabled: true, model: 'gemini-2.5-flash', cacheDir: '.capyseo-cache', cacheTTL: 86400000, // 24 hours }, crawl: { maxPages: 100, exclude: ['/admin/*', '/api/*', '/*.pdf'], respectRobotsTxt: true, }, ci: { minScore: 80, failOn: ['error'], }, };

TypeScript (capyseo.config.ts)

import type { CapyseoConfig } from '@capyseo/core'; const config: CapyseoConfig = { rules: { 'meta-title': { severity: 'error' }, 'meta-description': { severity: 'error' }, // ... same as JavaScript }, // ... same as JavaScript }; export default config;

Post-Init Output

After running init, you'll see:

✓ Created capyseo.config.js Next steps: 1. Edit the config file to customize rules 2. Run: capyseo analyze ./dist 3. For AI features, set GEMINI_API_KEY env variable Available commands: capyseo analyze <dir|url> Analyze pages for SEO issues capyseo generate sitemap Generate sitemap.xml capyseo generate robots Generate robots.txt capyseo generate meta Generate meta tags with AI capyseo watch <dir> Watch for changes

Customizing After Init

Disable Rules

rules: { 'word-count': { enabled: false }, 'broken-links': { enabled: false }, }

Change Severity

rules: { // Make OG required 'open-graph': { severity: 'error' }, // Make JSON-LD required 'json-ld': { severity: 'error' }, }

Adjust CI Threshold

ci: { minScore: 90, // Higher bar failOn: ['error', 'warning'], // Fail on warnings too }

File Detection Order

Capyseo looks for config files in this order:

  1. Explicit --config <path>
  2. capyseo.config.ts
  3. capyseo.config.js
  4. capyseo.config.mjs
  5. .capyseorc.json

If none found, default settings are used.