@chatbi-v/cli 2.0.3 → 2.0.5

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 (43) hide show
  1. package/bin/chatbi-cli.js +1 -2
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +2645 -189
  4. package/package.json +6 -3
  5. package/templates/app/package.json.hbs +6 -2
  6. package/templates/app/src/features/settings/PluginList.tsx.hbs +7 -1
  7. package/templates/plugin/package.json.hbs +3 -3
  8. package/templates/sandbox/.npmrc.hbs +2 -0
  9. package/templates/sandbox/package.json.hbs +6 -0
  10. package/dist/bench-NMQTZVQF.mjs +0 -77
  11. package/dist/build-66EM7X52.mjs +0 -11
  12. package/dist/chunk-2IR4PJIP.mjs +0 -2255
  13. package/dist/chunk-2REG4NIZ.mjs +0 -9577
  14. package/dist/chunk-6YO7P2EG.mjs +0 -55
  15. package/dist/chunk-7DA7PT2X.mjs +0 -271
  16. package/dist/chunk-AQNFMKFL.mjs +0 -5292
  17. package/dist/chunk-B6J5VVNN.mjs +0 -52
  18. package/dist/chunk-BMUJH4OW.mjs +0 -255
  19. package/dist/chunk-DRBLMVU7.mjs +0 -6368
  20. package/dist/chunk-WUWYFYMG.mjs +0 -89
  21. package/dist/commands/add.js +0 -182
  22. package/dist/commands/bench.js +0 -100
  23. package/dist/commands/build.js +0 -297
  24. package/dist/commands/dev.js +0 -8
  25. package/dist/commands/discover.js +0 -25
  26. package/dist/commands/doctor.js +0 -231
  27. package/dist/commands/fetch.js +0 -41
  28. package/dist/commands/gl.js +0 -151
  29. package/dist/commands/init.js +0 -253
  30. package/dist/commands/install.js +0 -85
  31. package/dist/commands/ls.js +0 -46
  32. package/dist/commands/sync.js +0 -78
  33. package/dist/commands/use.js +0 -31
  34. package/dist/config.js +0 -70
  35. package/dist/corekit.js +0 -371
  36. package/dist/execa-GD72AH35.mjs +0 -17
  37. package/dist/fetch-4EUKQD7S.mjs +0 -10
  38. package/dist/index.cjs +0 -27287
  39. package/dist/index.mjs +0 -2769
  40. package/dist/init-P2UCTRNH.mjs +0 -12
  41. package/dist/sandbox.js +0 -522
  42. package/dist/sync-JWHGYK34.mjs +0 -11
  43. package/dist/utils.js +0 -99
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@chatbi-v/cli",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Standardized CLI tooling for ChatBI Monorepo",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
6
9
  "bin": {
7
10
  "chatbi-cli": "./bin/chatbi-cli.js"
8
11
  },
@@ -43,8 +46,8 @@
43
46
  "vitest": "^1.0.0"
44
47
  },
45
48
  "scripts": {
46
- "build": "chatbi-cli build",
47
- "dev": "chatbi-cli build --watch",
49
+ "build": "tsup",
50
+ "dev": "tsup --watch",
48
51
  "test": "vitest"
49
52
  }
50
53
  }
@@ -12,8 +12,12 @@
12
12
  "dependencies": {
13
13
  "@ant-design/icons": "^5.2.6",
14
14
  "@ant-design/x": "^2.1.1",
15
- "@chatbi-v/core": "^2.0.3",
16
- "@chatbi-v/mocks": "^2.0.3",
15
+ "@chatbi-v/core": "^2.0.5",
16
+ "@chatbi-v/mocks": "^2.0.5",
17
+ "@chatbi-v/cli": "^2.0.5",
18
+ "@chatbi-v/plugin-theme-manager": "2.0.4",
19
+ "@chatbi-v/plugin-layout-transform": "2.0.4",
20
+ "@chatbi-v/plugin-system-monitor": "2.0.4",
17
21
  "antd": "^5.29.3",
18
22
  "react": "^18.3.1",
19
23
  "react-dom": "^18.3.1",
@@ -20,6 +20,7 @@ export const PluginList: React.FC<PluginListProps> = ({
20
20
  const renderPluginItem = useCallback((plugin: Plugin) => {
21
21
  const state = pluginManager.getPluginState(plugin.id);
22
22
  const hasSettings = pluginManager.getUnifiedCapabilities(plugin.id).configurable;
23
+ const error = pluginManager.getPluginError(plugin.id);
23
24
 
24
25
  return (
25
26
  <div
@@ -27,7 +28,7 @@ export const PluginList: React.FC<PluginListProps> = ({
27
28
  className="rounded-lg px-4 py-3 shadow-sm flex items-center justify-between border transition-colors duration-200"
28
29
  style={{
29
30
  backgroundColor: 'rgb(var(--color-surface))',
30
- borderColor: 'rgb(var(--color-border))',
31
+ borderColor: error ? '#ff4d4f' : 'rgb(var(--color-border))',
31
32
  }}
32
33
  >
33
34
  <div className="flex-1">
@@ -39,6 +40,11 @@ export const PluginList: React.FC<PluginListProps> = ({
39
40
  {plugin.metadata.name}
40
41
  </span>
41
42
  <Tag color={plugin.metadata.type === 'business' ? 'blue' : 'green'}>{plugin.metadata.type}</Tag>
43
+ {error && (
44
+ <Tooltip title={`插件加载或运行出错: ${error.message}`}>
45
+ <Tag color="error">运行时错误</Tag>
46
+ </Tooltip>
47
+ )}
42
48
  </div>
43
49
  <div>
44
50
  <div className="text-xs mb-1 font-mono" style={{ color: 'rgb(var(--color-text-muted))' }}>{plugin.id}</div>
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "plugin": true,
23
23
  "peerDependencies": {
24
- "@chatbi-v/core": "^2.0.3",
24
+ "@chatbi-v/core": "^2.0.5",
25
25
  "antd": "^5.20.0",
26
26
  "react": ">=18.0.0",
27
27
  "react-dom": ">=18.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@chatbi-v/core": "^2.0.3",
31
- "@chatbi-v/tsconfig": "^2.0.3",
30
+ "@chatbi-v/core": "^2.0.5",
31
+ "@chatbi-v/tsconfig": "^2.0.5",
32
32
  "tsup": "^8.5.1",
33
33
  "vite": "^5.0.0"
34
34
  }
@@ -0,0 +1,2 @@
1
+ shamefully-hoist=true
2
+ auto-install-peers=true
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "chatbi-sandbox-{{version}}",
3
+ "private": true,
4
+ "dependencies": {{{json dependencies}}},
5
+ "devDependencies": {{{json devDependencies}}}
6
+ }
@@ -1,77 +0,0 @@
1
- import {
2
- createSpinner,
3
- logger,
4
- printBox,
5
- require_lib,
6
- require_picocolors
7
- } from "./chunk-2REG4NIZ.mjs";
8
- import {
9
- __toESM,
10
- init_esm_shims
11
- } from "./chunk-6YO7P2EG.mjs";
12
-
13
- // src/commands/bench.ts
14
- init_esm_shims();
15
- var import_picocolors = __toESM(require_picocolors());
16
- var import_fs_extra = __toESM(require_lib());
17
- import path from "path";
18
- import os from "os";
19
- async function bench() {
20
- logger.info("\u6B63\u5728\u542F\u52A8 CLI \u6027\u80FD\u57FA\u51C6\u6D4B\u8BD5...");
21
- const results = [];
22
- const tmpDir = path.join(os.tmpdir(), `chatbi-bench-${Date.now()}`);
23
- await import_fs_extra.default.ensureDir(tmpDir);
24
- try {
25
- const initSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u521D\u59CB\u5316\u63D2\u4EF6\u9879\u76EE (init)...").start();
26
- const startInit = Date.now();
27
- const { init } = await import("./init-P2UCTRNH.mjs");
28
- const testProjDir = path.join(tmpDir, "bench-proj");
29
- await init({ name: "bench-proj", projectType: "plugin", cwd: tmpDir });
30
- const endInit = Date.now();
31
- const initTime = (endInit - startInit) / 1e3;
32
- initSpinner.succeed(`\u521D\u59CB\u5316\u5B8C\u6210: ${import_picocolors.default.cyan(initTime.toFixed(2) + "s")}`);
33
- results.push({
34
- scene: "\u521D\u59CB\u5316\u63D2\u4EF6\u9879\u76EE (init)",
35
- target: "\u2264 5.0 s",
36
- actual: `${initTime.toFixed(2)} s`
37
- });
38
- const syncSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u6C99\u7BB1\u73AF\u5883\u540C\u6B65 (sync)...").start();
39
- const startSync = Date.now();
40
- const { sync } = await import("./sync-JWHGYK34.mjs");
41
- await sync({ cwd: testProjDir });
42
- const endSync = Date.now();
43
- const syncTime = (endSync - startSync) / 1e3;
44
- syncSpinner.succeed(`\u540C\u6B65\u5B8C\u6210: ${import_picocolors.default.cyan(syncTime.toFixed(2) + "s")}`);
45
- results.push({
46
- scene: "\u6C99\u7BB1\u73AF\u5883\u540C\u6B65 (sync)",
47
- target: "\u2264 2.0 s",
48
- actual: `${syncTime.toFixed(2)} s`
49
- });
50
- const buildSpinner = createSpinner("\u6B63\u5728\u6D4B\u8BD5: \u63D2\u4EF6\u9879\u76EE\u6784\u5EFA (build)...").start();
51
- const startBuild = Date.now();
52
- const { build } = await import("./build-66EM7X52.mjs");
53
- const originalCwd = process.cwd();
54
- process.chdir(testProjDir);
55
- await build({ watch: false });
56
- process.chdir(originalCwd);
57
- const endBuild = Date.now();
58
- const buildTime = (endBuild - startBuild) / 1e3;
59
- buildSpinner.succeed(`\u6784\u5EFA\u5B8C\u6210: ${import_picocolors.default.cyan(buildTime.toFixed(2) + "s")}`);
60
- results.push({
61
- scene: "\u63D2\u4EF6\u9879\u76EE\u6784\u5EFA (build)",
62
- target: "\u2264 10.0 s",
63
- actual: `${buildTime.toFixed(2)} s`
64
- });
65
- printBox(
66
- `${import_picocolors.default.green(import_picocolors.default.bold("\u2728 \u57FA\u51C6\u6D4B\u8BD5\u5B8C\u6210!"))}
67
-
68
- ` + results.map((r) => `${import_picocolors.default.white(r.scene.padEnd(20))}: ${import_picocolors.default.cyan(r.actual)} (\u76EE\u6807 ${r.target})`).join("\n"),
69
- "Benchmark Results"
70
- );
71
- } finally {
72
- await import_fs_extra.default.remove(tmpDir);
73
- }
74
- }
75
- export {
76
- bench
77
- };
@@ -1,11 +0,0 @@
1
- import {
2
- build
3
- } from "./chunk-7DA7PT2X.mjs";
4
- import "./chunk-AQNFMKFL.mjs";
5
- import "./chunk-DRBLMVU7.mjs";
6
- import "./chunk-2IR4PJIP.mjs";
7
- import "./chunk-2REG4NIZ.mjs";
8
- import "./chunk-6YO7P2EG.mjs";
9
- export {
10
- build
11
- };