@cogita/core

中文 | English
The intelligent core engine that orchestrates Cogita's theme-driven architecture.
What is it?
@cogita/core is the brain of the Cogita framework. It automatically loads themes, manages plugins, and provides a type-safe configuration system that makes building a blog as simple as choosing a theme.
Key Features
- 🎨 Theme-Driven: Themes automatically load their required plugins
- ⚙️ Type-Safe Config: Full TypeScript support with intelligent defaults
- 🔧 Zero Config: Works out-of-the-box, customizable when needed
- ⚡ Rspress Powered: Built on the fast and modern Rspress foundation
Quick Start
Installation
pnpm add @cogita/core @cogita/theme-lucid
Basic Usage
Create cogita.config.ts:
import { defineConfig } from '@cogita/core';
export default defineConfig({
site: {
title: 'My Blog',
description: 'A blog built with Cogita',
},
theme: 'lucid',
});
Create your first post in posts/hello.md:
---
title: "Hello Cogita!"
createDate: "2024-01-01"
---
# Welcome to my blog!
Start development:
pnpm dev
That's it! Your blog is ready at http://localhost:3000.
How It Works
- Load Config: Reads your
cogita.config.ts
- Load Theme: Automatically loads the specified theme
- Register Plugins: Theme declares its plugin dependencies
- Generate Config: Creates optimized Rspress configuration
- Build/Serve: Powers your blog with Rspress
Configuration
Basic Site Config
export default defineConfig({
site: {
title: 'My Blog',
description: 'My awesome blog',
base: '/blog/',
},
theme: 'lucid',
});
Advanced Configuration
export default defineConfig({
site: { },
theme: 'lucid',
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
{ text: 'About', link: '/about' },
],
socialLinks: [
{ icon: 'github', mode: 'link', content: 'https://github.com/you' }
],
},
builderConfig: {
output: { assetPrefix: 'https://cdn.example.com/' }
},
});
API Reference
defineConfig(config: CogitaConfig)
Type-safe configuration helper.
loadCogitaConfig(root?: string)
Load configuration from project directory.
Main Types
interface CogitaConfig {
site?: {
title?: string;
description?: string;
base?: string;
};
theme?: string;
themeConfig?: any;
builderConfig?: any;
}
Available Themes
lucid (default) - Clean, content-focused blog theme
- More themes coming soon...
Development Commands
pnpm dev
pnpm build
pnpm preview
Learn More
Related Packages
License
MIT © wu9o