@chatbi-v/cli 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/app/.env +8 -0
  2. package/dist/app/.env.hbs +8 -0
  3. package/dist/app/README.md.hbs +16 -0
  4. package/dist/app/chatbi.config.ts.hbs +60 -0
  5. package/dist/{default/apps/main → app}/index.html.hbs +3 -4
  6. package/dist/app/package.json.hbs +34 -0
  7. package/dist/app/src/App.tsx.hbs +92 -0
  8. package/dist/app/src/components/GlobalErrorBoundary.tsx.hbs +69 -0
  9. package/dist/app/src/components/GlobalSettingsModal.tsx.hbs +35 -0
  10. package/dist/app/src/components/LayoutSkeletons.tsx.hbs +79 -0
  11. package/dist/app/src/components/index.ts.hbs +2 -0
  12. package/dist/app/src/custom-antd.less.hbs +7 -0
  13. package/dist/app/src/features/settings/ConfigRenderStrategy.tsx.hbs +119 -0
  14. package/dist/app/src/features/settings/ExtensionSettings.tsx.hbs +52 -0
  15. package/dist/app/src/features/settings/PluginList.tsx.hbs +115 -0
  16. package/dist/app/src/features/settings/PluginSettings.tsx.hbs +123 -0
  17. package/dist/app/src/features/settings/SchemaSettingsRenderer.tsx.hbs +56 -0
  18. package/dist/app/src/hooks/useAppRoutes.ts.hbs +39 -0
  19. package/dist/app/src/hooks/usePluginLoader.ts.hbs +22 -0
  20. package/dist/app/src/hooks/usePluginSettings.ts.hbs +29 -0
  21. package/dist/app/src/hooks/useThemeSync.ts.hbs +108 -0
  22. package/dist/app/src/index.css.hbs +45 -0
  23. package/dist/app/src/layouts/BackgroundEffects.tsx.hbs +10 -0
  24. package/dist/app/src/layouts/MainContent.tsx.hbs +58 -0
  25. package/dist/app/src/layouts/SidebarNav.tsx.hbs +182 -0
  26. package/dist/app/src/main.tsx.hbs +43 -0
  27. package/dist/app/src/providers/AppProviders.tsx.hbs +36 -0
  28. package/dist/app/src/services/api/index.ts.hbs +37 -0
  29. package/dist/app/src/services/api/modules/auth.ts.hbs +18 -0
  30. package/dist/app/src/services/config-service.ts.hbs +48 -0
  31. package/dist/app/src/stores/storage-adapter.ts.hbs +29 -0
  32. package/dist/app/src/stores/useSessionStore.ts.hbs +22 -0
  33. package/dist/app/src/stores/useUIStore.ts.hbs +64 -0
  34. package/dist/app/tailwind.config.cjs.hbs +14 -0
  35. package/dist/app/tsconfig.json.hbs +26 -0
  36. package/dist/app/vite.config.ts.hbs +89 -0
  37. package/dist/index.js +5343 -4330
  38. package/dist/monorepo/.gitignore.hbs +3 -0
  39. package/dist/{default → monorepo}/package.json.hbs +4 -0
  40. package/dist/monorepo/pnpm-workspace.yaml.hbs +10 -0
  41. package/dist/{default → monorepo}/tsconfig.json.hbs +3 -1
  42. package/dist/{default/plugins/demo-plugin → plugin}/package.json.hbs +7 -2
  43. package/dist/plugin/src/index.tsx.hbs +90 -0
  44. package/dist/plugin/tsconfig.json.hbs +14 -0
  45. package/package.json +9 -4
  46. package/templates/app/.env.hbs +8 -0
  47. package/templates/app/README.md.hbs +16 -0
  48. package/templates/app/chatbi.config.ts.hbs +60 -0
  49. package/templates/app/index.html.hbs +12 -0
  50. package/templates/app/package.json.hbs +34 -0
  51. package/templates/app/postcss.config.cjs.hbs +6 -0
  52. package/templates/app/src/App.tsx.hbs +92 -0
  53. package/templates/app/src/components/GlobalErrorBoundary.tsx.hbs +69 -0
  54. package/templates/app/src/components/GlobalSettingsModal.tsx.hbs +35 -0
  55. package/templates/app/src/components/LayoutSkeletons.tsx.hbs +79 -0
  56. package/templates/app/src/components/index.ts.hbs +2 -0
  57. package/templates/app/src/custom-antd.less.hbs +7 -0
  58. package/templates/app/src/features/settings/ConfigRenderStrategy.tsx.hbs +119 -0
  59. package/templates/app/src/features/settings/ExtensionSettings.tsx.hbs +52 -0
  60. package/templates/app/src/features/settings/PluginList.tsx.hbs +115 -0
  61. package/templates/app/src/features/settings/PluginSettings.tsx.hbs +123 -0
  62. package/templates/app/src/features/settings/SchemaSettingsRenderer.tsx.hbs +56 -0
  63. package/templates/app/src/hooks/useAppRoutes.ts.hbs +39 -0
  64. package/templates/app/src/hooks/usePluginLoader.ts.hbs +22 -0
  65. package/templates/app/src/hooks/usePluginSettings.ts.hbs +29 -0
  66. package/templates/app/src/hooks/useThemeSync.ts.hbs +108 -0
  67. package/templates/app/src/index.css.hbs +45 -0
  68. package/templates/app/src/layouts/BackgroundEffects.tsx.hbs +10 -0
  69. package/templates/app/src/layouts/MainContent.tsx.hbs +58 -0
  70. package/templates/app/src/layouts/SidebarNav.tsx.hbs +182 -0
  71. package/templates/app/src/main.tsx.hbs +43 -0
  72. package/templates/app/src/providers/AppProviders.tsx.hbs +36 -0
  73. package/templates/app/src/services/api/index.ts.hbs +37 -0
  74. package/templates/app/src/services/api/modules/auth.ts.hbs +18 -0
  75. package/templates/app/src/services/config-service.ts.hbs +48 -0
  76. package/templates/app/src/stores/storage-adapter.ts.hbs +29 -0
  77. package/templates/app/src/stores/useSessionStore.ts.hbs +22 -0
  78. package/templates/app/src/stores/useUIStore.ts.hbs +64 -0
  79. package/templates/app/tailwind.config.cjs.hbs +14 -0
  80. package/templates/app/tsconfig.json.hbs +26 -0
  81. package/templates/app/vite.config.ts.hbs +89 -0
  82. package/templates/monorepo/.gitignore.hbs +3 -0
  83. package/templates/monorepo/README.md.hbs +30 -0
  84. package/templates/monorepo/package.json.hbs +38 -0
  85. package/templates/monorepo/pnpm-workspace.yaml.hbs +10 -0
  86. package/templates/monorepo/tsconfig.json.hbs +26 -0
  87. package/templates/plugin/package.json.hbs +23 -0
  88. package/templates/plugin/src/index.tsx.hbs +90 -0
  89. package/templates/plugin/tsconfig.json.hbs +14 -0
  90. package/dist/default/apps/main/package.json.hbs +0 -20
  91. package/dist/default/apps/main/src/App.tsx.hbs +0 -178
  92. package/dist/default/apps/main/src/components/NavIcon.tsx.hbs +0 -41
  93. package/dist/default/apps/main/src/hooks/usePluginLoader.ts.hbs +0 -25
  94. package/dist/default/apps/main/src/index.css.hbs +0 -8
  95. package/dist/default/apps/main/src/main.tsx.hbs +0 -13
  96. package/dist/default/apps/main/src/pages/Guide.tsx.hbs +0 -133
  97. package/dist/default/apps/main/tailwind.config.cjs.hbs +0 -17
  98. package/dist/default/apps/main/tsconfig.json.hbs +0 -10
  99. package/dist/default/apps/main/vite.config.ts.hbs +0 -16
  100. package/dist/default/plugins/demo-plugin/src/index.tsx.hbs +0 -44
  101. package/dist/default/plugins/demo-plugin/tsconfig.json.hbs +0 -10
  102. package/dist/default/pnpm-workspace.yaml.hbs +0 -3
  103. /package/dist/{default/apps/main → app}/postcss.config.cjs.hbs +0 -0
  104. /package/dist/{default → monorepo}/README.md.hbs +0 -0
@@ -1,133 +0,0 @@
1
- import React from 'react';
2
- import { Typography, Card, Space, Divider, List, Tag } from 'antd';
3
- import {
4
- FolderOpenOutlined,
5
- RocketOutlined,
6
- BuildOutlined,
7
- CodeOutlined,
8
- BlockOutlined,
9
- SettingOutlined
10
- } from '@ant-design/icons';
11
-
12
- const { Title, Paragraph, Text } = Typography;
13
-
14
- const GuidePage: React.FC = () => {
15
- return (
16
- <div className="max-w-4xl mx-auto py-8 px-4">
17
- <Typography>
18
- <Title level={2} className="flex items-center gap-2">
19
- <RocketOutlined className="text-indigo-500" />
20
- 欢迎使用 {{name}} 开发容器
21
- </Title>
22
- <Paragraph className="text-gray-500 text-lg">
23
- 这是一个基于 ChatBI-V SDK 构建的业务插件开发环境。你可以通过此容器快速开发、调试并预览你的插件。
24
- </Paragraph>
25
- </Typography>
26
-
27
- <Divider />
28
-
29
- <Space direction="vertical" size="large" className="w-full">
30
- {/* 项目目录介绍 */}
31
- <Card
32
- title={<span className="flex items-center gap-2"><FolderOpenOutlined /> 项目目录介绍</span>}
33
- variant="borderless"
34
- className="shadow-sm"
35
- >
36
- <List
37
- itemLayout="horizontal"
38
- dataSource={[
39
- {
40
- title: 'apps/main',
41
- description: '宿主应用框架,负责加载插件、提供布局和基础能力。',
42
- icon: <BlockOutlined className="text-blue-500" />
43
- },
44
- {
45
- title: 'plugins/',
46
- description: '业务插件源码目录,你开发的所有插件都应放置在此目录下。',
47
- icon: <CodeOutlined className="text-green-500" />
48
- },
49
- {
50
- title: '.chatbi/',
51
- description: '离线 SDK 资源,包含核心库 (@chatbi-v/core) 和内置标准插件。',
52
- icon: <SettingOutlined className="text-orange-500" />
53
- },
54
- {
55
- title: 'scripts/',
56
- description: '辅助开发脚本,如快速创建插件脚本。',
57
- icon: <BuildOutlined className="text-purple-500" />
58
- }
59
- ]}
60
- renderItem={(item) => (
61
- <List.Item>
62
- <List.Item.Meta
63
- avatar={item.icon}
64
- title={<Text strong>{item.title}</Text>}
65
- description={item.description}
66
- />
67
- </List.Item>
68
- )}
69
- />
70
- </Card>
71
-
72
- {/* 开发指南 */}
73
- <Card
74
- title={<span className="flex items-center gap-2"><BuildOutlined /> 开发指南</span>}
75
- variant="borderless"
76
- className="shadow-sm"
77
- >
78
- <div className="space-y-4">
79
- <div>
80
- <Text strong className="block mb-2">1. 安装依赖</Text>
81
- <Tag color="default" className="font-mono px-2 py-1">pnpm install</Tag>
82
- </div>
83
- <div>
84
- <Text strong className="block mb-2">2. 启动开发环境</Text>
85
- <Tag color="blue" className="font-mono px-2 py-1">pnpm dev</Tag>
86
- <Paragraph className="mt-2 text-gray-500 text-sm">
87
- 该命令会同时启动宿主应用和监听插件变化。
88
- </Paragraph>
89
- </div>
90
- <div>
91
- <Text strong className="block mb-2">3. 构建发布</Text>
92
- <Tag color="green" className="font-mono px-2 py-1">pnpm build</Tag>
93
- <Paragraph className="mt-2 text-gray-500 text-sm">
94
- 生成生产环境可用的静态资源。
95
- </Paragraph>
96
- </div>
97
- </div>
98
- </Card>
99
-
100
- {/* 插件开发指南 */}
101
- <Card
102
- title={<span className="flex items-center gap-2"><CodeOutlined /> 插件开发指南</span>}
103
- variant="borderless"
104
- className="shadow-sm"
105
- >
106
- <Typography>
107
- <Paragraph>
108
- 要创建一个新的业务插件,请运行:
109
- </Paragraph>
110
- <Tag color="magenta" className="font-mono px-2 py-1 mb-4">pnpm create:plugin [plugin-name]</Tag>
111
-
112
- <Title level={5}>插件核心结构:</Title>
113
- <Paragraph>
114
- 每个插件都需要继承自 <Text code>Plugin</Text> 类并导出。关键属性包括:
115
- </Paragraph>
116
- <ul className="list-disc pl-5 space-y-2 text-gray-600">
117
- <li><Text strong>id</Text>: 插件唯一标识。</li>
118
- <li><Text strong>metadata.routes</Text>: 定义插件自带的页面路由。</li>
119
- <li><Text strong>metadata.extensions</Text>: 通过插槽 (Slot) 扩展宿主应用的 UI。</li>
120
- <li><Text strong>onLoad</Text>: 插件加载时的初始化逻辑。</li>
121
- </ul>
122
- </Typography>
123
- </Card>
124
- </Space>
125
-
126
- <div className="mt-12 text-center text-gray-400 text-sm">
127
- © 2025 ChatBI-V System. All rights reserved.
128
- </div>
129
- </div>
130
- );
131
- };
132
-
133
- export default GuidePage;
@@ -1,17 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: [
4
- "./index.html",
5
- "./src/**/*.{js,ts,jsx,tsx}",
6
- "../../plugins/*/src/**/*.{js,ts,jsx,tsx}",
7
- "../../.chatbi/plugins/*/dist/*.{js,mjs}"
8
- ],
9
- theme: {
10
- extend: {
11
- colors: {
12
- primary: '#6366f1',
13
- }
14
- },
15
- },
16
- plugins: [],
17
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "paths": {
6
- "@/*": ["./src/*"]
7
- }
8
- },
9
- "include": ["src"]
10
- }
@@ -1,16 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import react from '@vitejs/plugin-react'
3
- import path from 'path'
4
-
5
- export default defineConfig({
6
- plugins: [react()],
7
- resolve: {
8
- alias: {
9
- '@chatbi-v/core': path.resolve(__dirname, '../../.chatbi/core'),
10
- '@chatbi-v/plugin-theme-manager': path.resolve(__dirname, '../../.chatbi/plugins/theme-manager/dist/index.mjs'),
11
- '@chatbi-v/plugin-system-user': path.resolve(__dirname, '../../.chatbi/plugins/system-user/dist/index.mjs'),
12
- '@chatbi-v/plugin-system-monitor': path.resolve(__dirname, '../../.chatbi/plugins/system-monitor/dist/index.mjs'),
13
- '@chatbi-v/plugin-demo-plugin': path.resolve(__dirname, '../../plugins/demo-plugin/src/index.tsx'),
14
- }
15
- }
16
- })
@@ -1,44 +0,0 @@
1
- import React from 'react'
2
- import { Plugin, PluginContext, Slot } from '@chatbi-v/core'
3
- import { MessageOutlined } from '@ant-design/icons'
4
-
5
- export class {{className}} implements Plugin {
6
- id = '{{pluginId}}'
7
- metadata = {
8
- id: '{{pluginId}}',
9
- name: '{{pluginId}} Plugin',
10
- version: '1.0.0',
11
- type: '{{pluginType}}' as const,
12
- routes: [
13
- {
14
- path: '/{{pluginId}}',
15
- component: () => <div style=\{{ padding: '20px', background: '#f5f5f5', borderRadius: '8px' }}>
16
- <h3>Hello from {{pluginId}} Plugin!</h3>
17
- <p>This is a {{pluginType}} plugin generated by ChatBI CLI.</p>
18
- </div>,
19
- meta: {
20
- title: '{{pluginId}}',
21
- icon: 'MessageOutlined'
22
- }
23
- }
24
- ],
25
- extensions: [
26
- {
27
- slot: Slot.Sidebar,
28
- component: () => null,
29
- order: 10,
30
- meta: {
31
- title: '{{pluginId}}',
32
- icon: <MessageOutlined />,
33
- path: '/{{pluginId}}'
34
- }
35
- }
36
- ]
37
- }
38
-
39
- onLoad(context: PluginContext) {
40
- context.logger.info('{{className}} Loaded!')
41
- }
42
- }
43
-
44
- export default {{className}}
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "paths": {
6
- "@/*": ["./src/*"]
7
- }
8
- },
9
- "include": ["src"]
10
- }
@@ -1,3 +0,0 @@
1
- packages:
2
- - 'apps/*'
3
- - 'plugins/*'
File without changes