@h-ai/cli 1.0.0-beta.20 → 1.0.0-beta.21

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@h-ai/cli",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.20",
4
+ "version": "1.0.0-beta.21",
5
5
  "description": "Hai Framework CLI for project scaffolding and code generation.",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
@@ -30,7 +30,7 @@
30
30
  "node": "^22.23.4 || ^24.22.1 || ^26.12.1"
31
31
  },
32
32
  "dependencies": {
33
- "@h-ai/core": "1.0.0-beta.20",
33
+ "@h-ai/core": "1.0.0-beta.21",
34
34
  "cac": "^7.1.0",
35
35
  "chalk": "^6.0.1",
36
36
  "fast-wrap-ansi": "^0.2.2",
@@ -41,18 +41,18 @@
41
41
  "yaml": "^2.9.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@h-ai/api-client": "1.0.0-beta.20",
45
- "@h-ai/cache": "1.0.0-beta.20",
46
- "@h-ai/crypto": "1.0.0-beta.20",
47
- "@h-ai/deploy": "1.0.0-beta.20",
48
- "@h-ai/feedback": "1.0.0-beta.20",
49
- "@h-ai/iam": "1.0.0-beta.20",
50
- "@h-ai/kit": "1.0.0-beta.20",
51
- "@h-ai/payment": "1.0.0-beta.20",
52
- "@h-ai/reach": "1.0.0-beta.20",
53
- "@h-ai/reldb": "1.0.0-beta.20",
54
- "@h-ai/storage": "1.0.0-beta.20",
55
- "@h-ai/vecdb": "1.0.0-beta.20",
44
+ "@h-ai/api-client": "1.0.0-beta.21",
45
+ "@h-ai/cache": "1.0.0-beta.21",
46
+ "@h-ai/crypto": "1.0.0-beta.21",
47
+ "@h-ai/deploy": "1.0.0-beta.21",
48
+ "@h-ai/feedback": "1.0.0-beta.21",
49
+ "@h-ai/iam": "1.0.0-beta.21",
50
+ "@h-ai/kit": "1.0.0-beta.21",
51
+ "@h-ai/payment": "1.0.0-beta.21",
52
+ "@h-ai/reach": "1.0.0-beta.21",
53
+ "@h-ai/reldb": "1.0.0-beta.21",
54
+ "@h-ai/storage": "1.0.0-beta.21",
55
+ "@h-ai/vecdb": "1.0.0-beta.21",
56
56
  "@types/fs-extra": "^11.0.4",
57
57
  "@types/node": "^26.6.6",
58
58
  "@types/prompts": "^2.4.9",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "engines": { "node": "^22.23.4 || ^24.22.1 || ^26.12.1" },
3
3
  "name": "{{projectName}}",
4
- "version": "1.0.0-beta.20",
4
+ "version": "1.0.0-beta.21",
5
5
  "private": true,
6
6
  "packageManager": "pnpm@12.11.2",
7
7
  "description": "{{#if_eq appType 'admin'}}Enterprise management system built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'website'}}Enterprise website built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'h5'}}Mobile H5 app built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'api'}}REST API service built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'mobile-app'}}Mobile app built with hai Agent Framework{{/if_eq}}",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hai-ui
3
- description: "使用 @h-ai/ui 构建 Svelte 5 表单、表格、看板图表、弹窗、引导、主题与 AI 内容展示。"
3
+ description: "使用 @h-ai/ui 构建 Svelte 5 表单、表格、看板图表、弹窗、引导、代码工作区、主题与 AI 内容展示。"
4
4
  ---
5
5
 
6
6
  # hai-ui
@@ -11,7 +11,7 @@ description: "使用 @h-ai/ui 构建 Svelte 5 表单、表格、看板图表、
11
11
 
12
12
  | 项目 | 契约 |
13
13
  | --- | --- |
14
- | 能力 | 使用 @h-ai/ui 构建 Svelte 5 表单、表格、弹窗、移动界面、主题与 AI 内容展示 |
14
+ | 能力 | 使用 @h-ai/ui 构建 Svelte 5 表单、表格、弹窗、代码工作区、移动界面、主题与 AI 内容展示 |
15
15
  | 适用场景 | 已有 Svelte 项目中的组件选择与交互实现 |
16
16
  | 输入 | 现有 Svelte 页面、组件 Props、Tailwind 扫描路径与主题 |
17
17
  | 输出 | 复用原子/组合/场景组件的界面及交互验证 |
@@ -63,6 +63,8 @@ AuthPanel 的 config.captcha.enabled 开启后,复用 createAuthActions 提供
63
63
 
64
64
  新手引导、首次 Cookie 提示、操作导览和帮助中心见 [guide.md](guide.md)。fullstack 默认在共享管理界面接入,新增业务只补内容与 data-guide 锚点。
65
65
 
66
+ 浏览源码、多文件标签、工作区搜索和选区操作见[代码工作区](reference.md#代码工作区)。只需提供目录列表和文件读取回调即可开始浏览,按需添加搜索和宿主面板。
67
+
66
68
  按任务读取 [reference.md](reference.md) 的对应小节;签名以当前源码或安装版本的公开类型为准,不默认加载全部资料。示例中的业务变量由应用提供。
67
69
 
68
70
  - 运行环境
@@ -75,6 +75,7 @@ HTTP/UI 边界只对明确的有效 4xx 状态公开业务提示;错误缺少
75
75
  | 登录/注册页布局 | `AuthShell` + `LoginForm` / `RegisterForm` | `variant='card'` 或 `'split'`;split 可通过 `illustration`/`description`/`highlights` 放大图与重点说明 |
76
76
  | 登录/注册/资料页 | `LoginForm` / `RegisterForm` / `UserProfile` | 页面只负责路由和提交逻辑 |
77
77
  | 文件/图片上传 | `FileUpload` / `ImageUpload` / `AvatarUpload` | 上传 URL、限制和业务状态由应用层提供 |
78
+ | 在线代码浏览与检查 | `CodeWorkspace` | 两个读取回调接入文件树与多标签,按需添加工作区搜索、检查面板和选区操作 |
78
79
  | 移动端页面骨架 | `SafeArea` + `AppBar` + `BottomNav` | 原生壳页面优先这一套 |
79
80
  | AI 文档/Markdown 展示 | `MarkdownRenderer` / `AiDocumentEditor` | Mermaid、代码高亮、复制/下载已内置 |
80
81
 
@@ -336,6 +337,33 @@ const p = usePlatform()
336
337
 
337
338
  内置中英日文翻译的业务场景组件。
338
339
 
340
+ #### 代码工作区
341
+
342
+ `CodeWorkspace` 提供异步文件树、只读 Monaco 代码区和可选的检查面板。从 `@h-ai/ui/components/scenes/code/index` 导入组件和类型。
343
+
344
+ ```svelte
345
+ <script lang="ts">
346
+ import type { CodeWorkspaceSource } from '@h-ai/ui/components/scenes/code/index'
347
+ import { CodeWorkspace } from '@h-ai/ui/components/scenes/code/index'
348
+
349
+ const source: CodeWorkspaceSource = {
350
+ listChildren: () => [{ kind: 'file', id: 'readme', name: 'README.md' }],
351
+ readFile: () => ({ text: '# Hello', language: 'markdown' }),
352
+ }
353
+ </script>
354
+
355
+ <CodeWorkspace {source} />
356
+ ```
357
+
358
+ - `listChildren(null, signal)` 读取根节点。目录展开时组件传入目录节点并复用已加载的结果。文件 ID 与版本用于复用标签和恢复视图。`initialFile` 与 `initialAncestors` 可预先打开文件并展开其父目录。保持 `source` 对象引用稳定,切换仓库或分支时替换对象。
359
+ - 可选的 `search({ mode, query, cursor }, signal)` 接入宿主索引。`mode` 是 `files` 或 `content`。命中包含 `node`,可附带 `ancestors`、`range` 和 `preview`。返回 `nextCursor` 启用续页。把收到的 `signal` 传给实际请求,后端负责授权与索引范围。回调失败时可抛错或拒绝 Promise,组件会提供重试入口。
360
+ - 节点的 `markers` 使用 `label` 提供可访问名称,按需附加 `text` 和 `tone`。`readFile` 返回的 `annotations` 使用 `range`、`label` 和可选的 `tone`、`display`,可在行前和对应范围内显示。搜索命中与标注应使用同一文件版本,行列从 1 开始,列按 UTF-16 计数,结束位置不含。
361
+ - `inspector` snippet 收到 `{ file, selection, reveal }`,其中 `selection` 可以为 `null`。`selectionActions` 收到非空选区、同一 `file`、`reveal` 和 `openInspector`。`reveal(range)` 仅在对应文档仍激活时跳转,`openInspector()` 可打开已有右栏。解释、标记保存等宿主操作从这两个入口接入。
362
+ - 工作区内 `Ctrl/⌘+P` 找文件,`Ctrl/⌘+Shift+F` 搜工作区内容;代码区 `Ctrl/⌘+F` 查找,`Ctrl/⌘+G` 跳行;`Alt+Shift+Enter` 聚焦可用的选区操作。通过 `options` 设置行号、缩略图、面包屑和换行的初始值,用户可在工具栏切换。
363
+ - `theme` 默认 `inherit`,另有 `vs-light`、`vs-dark`、`hc-light`、`hc-dark` 和 `github-dark`。自定义主题传入 `{ base, colors, tokens }`,其中 `base` 是 VS 或高对比预设,`colors` 和 `tokens` 可省略。同页 Monaco 实例共享编辑器主题。工作区外壳可 SSR,Monaco 及默认同源 worker 由 Vite 在浏览器按需加载。移动端和编辑器加载失败时使用纯文本视图。
364
+
365
+ 行前图标和浮层可通过 `annotationIcon`、`annotationHover` Snippet 自定义,两者收到 `{ file, annotation }`。仅需提示文字时,在标注上传入 `hoverText`,它优先于浮层 Snippet。图标锚定标注起始行,支持悬停、键盘和点击。
366
+
339
367
  #### 引导与帮助场景组件
340
368
 
341
369
  | 组件 | Props 要点 | 说明 |
@@ -651,6 +679,7 @@ AuthPanel 在 SSR 阶段禁用原生表单控件,客户端挂载并绑定事
651
679
  | `@h-ai/ui/auto-import` | Svelte 预处理器:组件自动导入 |
652
680
  | `@h-ai/ui/components/primitives/index` 等明确 barrel | 仅 package.exports 列出的组件目录;组件默认导出经 barrel 转发 |
653
681
  | `@h-ai/ui/components/primitives/index` | 公开原子组件目录入口,如 Button/Input |
682
+ | `@h-ai/ui/components/scenes/code/index` | `CodeWorkspace` 与代码工作区接入类型 |
654
683
  | `@h-ai/ui/styles/global.css` | 全局基础样式(重置/滚动条/焦点) |
655
684
  | `@h-ai/ui/styles/theme.css` | Tailwind v4 `@theme` Token |
656
685
  | `@h-ai/ui/styles/design-tokens.css`| CSS 自定义属性(间距/圆角/z-index) |