feat: 初始化 TypeScript CLI 模板项目
建立完整的 CLI 产品基础骨架,支持多种演进方向 - 添加项目基础配置(package.json、tsconfig、pnpm-lock.yaml、.gitignore、.npmignore) - 实现运行时基础设施(RuntimeServices 统一注入、日志、输出模式、配置存储、插件加载、任务注册表) - 采用 command/use-case/presenter 三层架构组织业务模块(demo、config、task) - 添加 UI 渲染层(banner、panel、table、主题样式) - 实现插件机制,支持运行时扫描加载外部模块和任务 - 支持 text/json 双输出模式,便于集成与调试 - 添加统一错误模型 AppError 和 CLI 错误边界处理 - 基于 node:test 建立测试基座,包含示例测试用例 - 配置 npm 发布脚本和包元数据 - 编写完整 README 文档,包含快速开始、开发约定和演进方向
This commit is contained in:
20
plugins/example-plugin.js
Normal file
20
plugins/example-plugin.js
Normal file
@@ -0,0 +1,20 @@
|
||||
export default {
|
||||
name: "example-plugin",
|
||||
tasks: [
|
||||
{
|
||||
id: "hello-plugin",
|
||||
create() {
|
||||
return {
|
||||
id: "hello-plugin",
|
||||
title: "Hello From Plugin",
|
||||
async run() {
|
||||
return {
|
||||
plugin: "example-plugin",
|
||||
message: "Plugin task executed"
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user