en un clic
dearts-dev
// DearTs Framework 开发技能。基于 SDL3 + ImGui 的 C++20 现代应用框架,提供完整的应用生命周期管理、类型安全事件系统、Content Registry 和插件架构。适用于 DearTs Framework 相关的所有开发任务,包括应用程序开发、事件驱动架构、插件系统、多视图应用等。
// DearTs Framework 开发技能。基于 SDL3 + ImGui 的 C++20 现代应用框架,提供完整的应用生命周期管理、类型安全事件系统、Content Registry 和插件架构。适用于 DearTs Framework 相关的所有开发任务,包括应用程序开发、事件驱动架构、插件系统、多视图应用等。
Writes, edits, and creates dbt models following best practices. Use when user needs to create new dbt SQL models, update existing models, or convert raw SQL to dbt format. Handles staging, intermediate, and mart models with proper config blocks, CTEs, and documentation.
Apply Domain-Driven Design, Clean Architecture, CQRS, and command/query patterns to code reviews and feature design. Use when analyzing or designing code in Application, Service, Infrastructure, DataAccess, Validation, Domain, or Functions projects, or when addressing architectural concerns, layering, mapping, entities, value objects, repositories, or validators in the Rome Repair Order Service.
Analyzes and refactors code using Domain-Driven Design principles. Use when refactoring domain models, identifying DDD anti-patterns, improving domain clarity, or applying tactical/strategic DDD patterns.
Guide for DDD strategic design - analyzing domains through structured questioning, conducting stakeholder interviews (PM/domain experts/users), and producing Bounded Context analysis, Context Maps, and Ubiquitous Language. Use when user needs help understanding domain boundaries, planning domain interviews, or structuring DDD strategic artifacts.
Win competitive rounds: run a clean process, deliver value previews before asking, coordinate partners, and manage timelines. Use when you're trying to close a 'must win' deal against other funds.
End-to-end associate workflow with time-boxed gates: thesis -> sourcing -> meetings -> diligence -> memo, ending with either IC-ready memo or explicit kill decision. Use when you need to run the full pipeline for a sector or a specific deal.
| name | dearts-dev |
| description | DearTs Framework 开发技能。基于 SDL3 + ImGui 的 C++20 现代应用框架,提供完整的应用生命周期管理、类型安全事件系统、Content Registry 和插件架构。适用于 DearTs Framework 相关的所有开发任务,包括应用程序开发、事件驱动架构、插件系统、多视图应用等。 |
DearTs 是一个基于 SDL3 + ImGui 的现代 C++20 应用程序框架,参考 ImHex 设计理念,提供完整的模块化架构。
核心特性:
DearTs/
├── core/ # 核心系统
│ ├── app/ # 应用生命周期
│ ├── events/ # 事件总线
│ ├── ui/ # ImGui 集成、视图
│ ├── content/ # Content Registry
│ ├── tasks/ # 任务管理
│ ├── plugin/ # 插件系统
│ └── config/ # 配置管理
├── plugins/ # 插件实现
│ └── builtin/ # 内置插件
└── main/gui/ # 入口
#include "core/app/application.h"
class MyApp : public DearTs::Core::Application {
bool on_initialize() override {
LOG_INFO("Application starting");
return true;
}
void on_render() override {
ImGui::Begin("Hello");
ImGui::Text("Hello DearTs!");
ImGui::End();
}
};
int main() {
MyApp app;
return app.run();
}
#include "core/plugin/plugin.h"
class MyPlugin : public IPlugin {
public:
PluginInfo get_info() const override {
return PluginInfo{
.name = "MyPlugin",
.author = "You",
.description = "My plugin",
.version = "1.0.0",
.api_version = "1.0.0"
};
}
Result<void, std::string> on_load() override {
// 注册命令、视图
ContentRegistry::Commands::register_handler(
"my.action", "My Action", []() { /* ... */ }
);
ContentRegistry::Views::add<MyView>();
return Result::ok();
}
};
// 注册插件
PluginManager::instance().add_builtin(
std::make_unique<MyPlugin>()
);
事件系统:
// 订阅
EventBus::Token token = EventBus::instance().subscribe<Event>(
[](const Event& e) { /* handle */ }
);
// 发布
EventBus::instance().publish(Event{ ... });
// Token RAII 自动取消订阅
配置管理:
ConfigScope cfg("app.window");
cfg.set("width", 1280);
int width = cfg.get_or<int>("width", 1280);
// 加载/保存 JSON
ConfigManager::instance().load_from_file("config.json");
ConfigManager::instance().save_to_file("config.json");
任务管理:
auto task = TaskManager::instance().launch(
"Loading File",
[](const auto& cancel) {
for (int i = 0; i < 100 && !cancel; i++) {
// do work
}
}
);
日志:
LOG_INFO("Loading: {}", filename);
LOG_ERROR("Failed: {}", error);
UNINITIALIZED → INITIALIZING → RUNNING ←→ PAUSED
↓ ↓
STOPPING ←──┘
↓
STOPPED
未加载 (Unloaded)
↓ add_builtin() / load_from_file()
已加载 (Loaded)
↓ enable()
已启用 (Enabled)
↓ disable()
已加载 (Loaded)
↓ unload()
未加载 (Unloaded)
用户操作
↓
ContentRegistry::Commands::invoke()
↓
EventBus::publish(Event)
↓
插件事件处理器
↓
UI 更新 / 后台任务
# Configure
cmake -B build -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build build --config Release
# Run
./build/bin/DearTsApp.exe
| 文档 | 说明 | 用途 |
|---|---|---|
| config_manager_api.md | ConfigManager 完全手册 | 配置管理、层级键、JSON 持久化 |
| logger_api.md | Logger 完全手册 | 日志记录、文件输出、级别控制 |
| task_manager_api.md | TaskManager 完全手册 | 异步任务、进度跟踪、任务取消 |
| plugin_system_api.md | Plugin System 完全手册 | 插件开发、生命周期、API 集成 |
核心系统:
应用层:
集成指南:
插件示例:
plugins/builtin/ - 内置插件完整实现plugins/builtin/include/views/ - 视图示例代码模板:
assets/app_template.cpp - 应用程序模板assets/view_template.cpp - 视图模板assets/plugin_template.cpp - 插件模板assets/cmake_template.txt - CMake 模板渲染示例:
examples/SDL3_ImGui_Hybrid_Rendering.md - SDL3 + ImGui 混合渲染examples/interactive_sdl_render.md - 交互式 SDL 渲染| 任务 | 查阅文档 |
|---|---|
| 创建插件 | plugin_system_api.md |
| 管理配置 | config_manager_api.md |
| 异步任务 | task_manager_api.md |
| 添加日志 | logger_api.md |
| 事件系统 | event_system.md |
| 注册命令 | content_registry.md |
| 创建视图 | ui_system.md |
| 错误处理 | result_type.md |
| CMake 配置 | cmake_config.md |
使用 Result<T, E> 处理错误
Result<Data, std::string> load() {
if (error) return Result::err("Failed");
return Result::ok(data);
}
使用 RAII 管理资源
查看 API 文档而非源码
references/使用 Content Registry
ContentRegistry::Commands::register_handler("id", "Name", callback);
ContentRegistry::Views::add<MyView>();
此技能在以下场景自动激活:
docs/plugins/QUICKSTART.mddocs/plugin_system_guide.mddocs/diagrams/技能版本: 3.0.0 最后更新: 2025-12-30 框架版本: DearTs Framework 1.0.0