hub-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHub Creator
Hub 创建器
Author a NEW Datex Studio hub configuration (configurationTypeId=2) on a branch — top-level UI containers with filters, grouping options, tabs that mount grids/editors/forms/custom Angular components, toolbar buttons, and click flows.
See also:— modifying an EXISTING hub's toolbar/flows on a branch (this skill is for authoring NEW hubs).hub-editor
在分支上创建新的Datex Studio hub配置(configurationTypeId=2)——这是包含过滤器、分组选项、可挂载网格/编辑器/表单/自定义Angular组件的标签页、工具栏按钮及点击流程的顶级UI容器。
另请参阅:— 在分支上修改现有hub的工具栏/流程(本技能用于创建新hub)。hub-editor
References
参考资料
- ../datex-studio-shared/branch-setup.md — Branch/connection selection (shared across skills)
- references/hubs.md — Authoritative hub authoring reference: file shape, runtime globals, invocation contract, common patterns, pre-flight checklist
- ../datex-studio-conventions/file-format.md — table and TypeScript-expression encoding rules
configurationTypeId - ../datex-studio-conventions/naming-conventions.md — suffix, filename stem matching, display-name rule
_hub - ../datex-studio-runtime/runtime-globals.md — platform-injected globals available in hub code (,
$flows,$shell, ...)$utils - ../datex-studio-runtime/calling-conventions.md — UI-tier calling rules (call functions, never actions; dialog openers via )
$shell - ../component-wiring-check/references/component-wiring.md — host reference contracts, vars-must-be-declared rule, moduleId rule
- ../datex-studio-shared/branch-setup.md — 分支/连接选择(各技能通用)
- references/hubs.md — Hub创建权威参考:文件结构、运行时全局变量、调用契约、常见模式、预检清单
- ../datex-studio-conventions/file-format.md — 表格及TypeScript表达式编码规则
configurationTypeId - ../datex-studio-conventions/naming-conventions.md — 后缀、文件名主干匹配规则、显示名称规则
_hub - ../datex-studio-runtime/runtime-globals.md — Hub代码中可用的平台注入全局变量(、
$flows、$shell等)$utils - ../datex-studio-runtime/calling-conventions.md — UI层调用规则(调用函数,禁止直接调用动作;通过打开对话框)
$shell - ../component-wiring-check/references/component-wiring.md — 宿主参考契约、变量必须声明规则、moduleId规则
Dependencies
依赖技能
- skill — invoked to produce a requirements brief if one doesn't already exist in the conversation context
requirements-gathering - /
grid-creator/selector-creator/form-creatorskills — invoked when a tab grid, filter-backing selector, or dialog form/editor referenced by the hub doesn't exist yet on the brancheditor-creator - skill — invoked to audit
component-wiring-check↔ targetconfigParameterscontracts before push (the dead-wiring trap)inParams
- 技能 — 若对话上下文无需求简报,将调用该技能生成需求简报
requirements-gathering - /
grid-creator/selector-creator/form-creator技能 — 当hub引用的标签页网格、过滤器关联选择器或对话框表单/编辑器尚未在分支上存在时,将调用对应技能editor-creator - 技能 — 推送前将调用该技能审核
component-wiring-check↔ 目标configParameters契约(即死绑定陷阱)inParams
CLI Lifecycle
CLI生命周期
Hub authoring goes through — the generic CRUD primitive over every platform configuration type. There is no subcommand and no field-level patching; you build (or fetch + extract) the whole JSON body, edit it, and push the whole thing back.
dxs configurationdxs hubCreate a new hub:
bash
undefinedHub创建需通过完成——这是针对所有平台配置类型的通用CRUD原语。不存在子命令,也不支持字段级补丁;需构建(或获取并提取)完整JSON体,编辑后重新推送完整内容。
dxs configurationdxs hub创建新hub:
bash
undefined1. Build body.json from scratch (see references/hubs.md → Minimal Valid Skeleton)
1. 从零开始构建body.json(请参阅references/hubs.md → 最小有效骨架)
2. Validate (recommended)
2. 验证(推荐操作)
dxs configuration validate hub -b <branchId> -D body.json
dxs configuration validate hub -b <branchId> -D body.json
3. Create
3. 创建
dxs configuration upsert hub -b <branchId> -D body.json
**Edit an existing hub (only if scope creeps from "new" into "modify mid-authoring"):**
```bashdxs configuration upsert hub -b <branchId> -D body.json
**编辑现有hub(仅适用于从「创建」中途转为「修改」的场景):**
```bash1. Fetch — note the envelope wrapper
1. 获取配置——注意信封包装
dxs configuration get hub <configId> -b <branchId> -O envelope.json
dxs configuration get hub <configId> -b <branchId> -O envelope.json
2. EXTRACT THE INNER BODY (round-trip footgun guard — see "Round-trip rule" below)
2. 提取内部JSON体(往返操作防范机制——请参阅下方「往返规则」)
jq .json envelope.json > body.json
jq .json envelope.json > body.json
3. Edit body.json
3. 编辑body.json
4. Validate (recommended)
4. 验证(推荐操作)
dxs configuration validate hub -b <branchId> -D body.json
dxs configuration validate hub -b <branchId> -D body.json
5. Push
5. 推送
dxs configuration upsert hub -b <branchId> -D body.json
For purely-modify workflows (toolbar/flows changes on an existing hub), stop here and switch to the `hub-editor` skill — it carries the toolbar/click-flow editing patterns and the role-gating recipes.dxs configuration upsert hub -b <branchId> -D body.json
若仅需修改现有hub(如工具栏/流程变更),请停止当前操作并切换至`hub-editor`技能——该技能包含工具栏/点击流编辑模式及角色权限控制方案。Round-trip rule (critical)
往返规则(关键)
When editing an existing config, never pipe the envelope.json directly into — it silently destroys configuration content. The corrected sequence above (extract inner with before editing) is mandatory for any round-trip. See ../datex-studio-shared/configuration-roundtrip.md for the canonical round-trip and the underlying bug.
dxs configuration upsert.jsonjq编辑现有配置时,切勿直接将envelope.json传入——这会静默破坏配置内容。必须遵循上述修正流程(编辑前用提取内部)。如需了解标准往返流程及潜在问题,请参阅../datex-studio-shared/configuration-roundtrip.md。
dxs configuration upsertjq.jsonWorkflow
工作流程
[Phase 1: Setup + Requirements]
Follow branch-setup.md for branch/connection selection
|
[requirements brief in context?]
+-----+-----+
| |
YES NO -> invoke `requirements-gathering`
| |
+-----+------+
|
[Phase 2: Author hub body]
Decide what the hub IS:
- which filters scope the experience
- which tabs (grids / other components) mount inside it
- role-gating, on_init access guard, hub-local flows
Consult references/hubs.md for file shape, $hub runtime,
required top-level fields, common patterns
|
[Phase 3: Wire toolbar / flows]
Toolbar buttons + click flows; dialog openers via $shell
Audit dead-wiring trap (hub filter -> tab configParameters
-> grid inParams MUST stay in sync) — invoke
`component-wiring-check` if mounted grids/selectors
need extension
|
[Phase 4: Validate + push]
dxs configuration validate hub -b <branchId> -D body.json
|
+----+----+
| |
CREATE MODIFY-EXISTING
| |
| use the corrected round-trip
| (get -O envelope -> jq .json -> body)
| |
+----+----+
|
v
dxs configuration upsert hub -b <branchId> -D body.json
(upsert creates or updates by referenceName — one command for both)
|
[Phase 5: Verify in Studio (optional)]
Reload the hub in the running app; confirm filters render,
tabs query, toolbar buttons fire
|
[invoke `post-edit-verification`; then `component-validator`][阶段1:设置与需求收集]
遵循branch-setup.md完成分支/连接选择
|
[对话上下文是否有需求简报?]
+-----+-----+
| |
是 否 -> 调用`requirements-gathering`
| |
+-----+------+
|
[阶段2:编写hub配置体]
确定hub的功能:
- 哪些过滤器用于限定体验范围
- 内部挂载哪些标签页(网格/其他组件)
- 角色权限控制、初始化访问守卫、hub本地流程
查阅references/hubs.md了解文件结构、$hub运行时、
必填顶级字段及常见模式
|
[阶段3:绑定工具栏/流程]
工具栏按钮+点击流程;通过$shell打开对话框
审核死绑定陷阱(hub过滤器 -> 标签页configParameters
-> 网格inParams必须保持同步)——若需扩展已挂载的网格/选择器,
调用`component-wiring-check`
|
[阶段4:验证与推送]
dxs configuration validate hub -b <branchId> -D body.json
|
+----+----+
| |
创建 修改现有配置
| |
| 使用修正后的往返流程
| (获取-O envelope -> jq .json -> body)
| |
+----+----+
|
v
dxs configuration upsert hub -b <branchId> -D body.json
(upsert通过referenceName创建或更新——单个命令即可完成两种操作)
|
[阶段5:在Studio中验证(可选)]
在运行的应用中重新加载hub;确认过滤器渲染、
标签页查询、工具栏按钮触发正常
|
[调用`post-edit-verification`;随后调用`component-validator`]Phase Details
阶段详情
Phase 1: Setup + Requirements
阶段1:设置与需求收集
- Follow ../datex-studio-shared/branch-setup.md for branch and connection selection. Never assume a branch ID — ask the user to confirm, or run for selection.
dxs source branch list --all-repos --status feature - Check whether a requirements brief already exists in the conversation context (produced by or another calling skill).
requirements-gathering- Brief exists — use it. The brief provides intent (what the hub is for), the scoping filters users need, the tabs/grids that should mount inside, role-gating rules, and any toolbar actions.
- No brief — invoke the skill first. Hubs are top-level entry points; getting the filter set and tab layout right up front saves rework.
requirements-gathering
- 遵循../datex-studio-shared/branch-setup.md完成分支和连接选择。切勿默认分支ID——请让用户确认,或运行进行选择。
dxs source branch list --all-repos --status feature - 检查对话上下文是否已有需求简报(由或其他调用技能生成)。
requirements-gathering- 已有简报——直接使用。简报包含hub的用途、用户所需的范围过滤器、内部应挂载的标签页/网格、角色权限控制规则及工具栏操作。
- 无简报——先调用技能。Hub是顶级入口点,提前确定过滤器集和标签页布局可减少返工。
requirements-gathering
Phase 2: Author hub body
阶段2:编写hub配置体
Decide what the hub IS, then build :
body.json- File basics. Per the Pre-Flight Checklist below + ../datex-studio-conventions/universal-checklist.md; see references/hubs.md → File Location & Naming for the file shape.
-hub.json - Filters. Each filter field's /
configIdmust resolve to a real selector (moduleId). If the selector doesn't exist on the branch yet, invoke*-selector.jsonfirst. Every selectorselector-creatorgets an entry in the filter'sconfigParameter(usedropdownConfig.configParametersfor ones that don't apply).value: "" - Tabs. Every tab declares a pointing at a grid (or other component) on the branch. If the target grid doesn't exist yet, invoke
contentConfigfirst. The tab'sgrid-creatorarray must mirror the target'sconfigParametersexactly — see the Phase 3 dead-wiring check.inParams - array. Every
varswritten in hub flow code must be declared at the top-level$hub.vars.<id>array. See references/hubs.md → Runtime Globals and ../component-wiring-check/references/component-wiring.md.vars - . Common home for initial-filter defaulting, context loading, and the access-gated hub pattern (permission check →
onInitFlowConfigon deny). See references/hubs.md → Common Patterns.$hub.close() - TypeScript-expression encoding. ,
hubTitle, anyhubDescription/value/tooltip/placeholderfollows the three-encoding rule — display text wrapped in backticks:label. See ../datex-studio-conventions/file-format.md → Declarative String Values Are TypeScript Expressions."`Widget overview`"
确定hub功能后,构建:
body.json- 文件基础。遵循下方预检清单及../datex-studio-conventions/universal-checklist.md;请参阅references/hubs.md → 文件位置与命名了解文件结构。
-hub.json - 过滤器。每个过滤字段的/
configId必须指向真实的选择器(moduleId)。若选择器尚未在分支上存在,先调用*-selector.json。每个选择器的selector-creator需在过滤器的configParameter中添加条目(不适用的条目设为dropdownConfig.configParameters)。value: "" - 标签页。每个标签页需声明指向分支上的网格(或其他组件)。若目标网格尚未存在,先调用
contentConfig。标签页的grid-creator数组必须与目标组件的configParameters完全匹配——请参阅阶段3的死绑定检查。inParams - 数组。Hub流程代码中所有
vars必须在顶级$hub.vars.<id>数组中声明。请参阅references/hubs.md → 运行时全局变量及../component-wiring-check/references/component-wiring.md。vars - 。常用于设置初始过滤器默认值、加载上下文及实现权限控制hub模式(权限检查→拒绝时调用
onInitFlowConfig)。请参阅references/hubs.md → 常见模式。$hub.close() - TypeScript表达式编码。、
hubTitle、任何hubDescription/value/tooltip/placeholder需遵循三重编码规则——显示文本用反引号包裹:label。请参阅../datex-studio-conventions/file-format.md → 声明式字符串值为TypeScript表达式。"`Widget overview`"
Phase 3: Wire toolbar / flows
阶段3:绑定工具栏/流程
-
Toolbar buttons + click flows. Each toolbar button entry has apointing at a hub-local flow or an external function. From hub code, invoke functions via
clickFlowConfigand open forms/editors via$flows.<Package>.<fn>. Never call actions directly — wrap them in a function. See ../datex-studio-runtime/calling-conventions.md and references/hubs.md → Common Patterns for the engine-toggle, configure-options-dialog, access-gated$shell.<Package>.open<referenceName>Dialog(...), and shared-local-flow patterns.on_init -
Dead-wiring trap audit. The single most common hub bug: a hub filter binds into a tab'sfor an id the mounted grid doesn't actually declare as an inParam. The binding looks wired but the grid never receives the value.
configParametersThe rule: every binding in a tab'smust be named in the mounted grid'sconfigParameters— and every inParam the grid declares must have an entry in the tab'sinParams(unused entries useconfigParametersorvalue: "").value: nullWhen a hub filter exists to scope a specific tab's grid (e.g. afilter scoping a rules grid byprojects, or aproject_idsfilter scoping a documents grid bycontract), audit the mounted grid's top-levelcontract_idin the same edit. If a binding is needed and the grid doesn't declare a matching inParam, extend the grid in the same edit (and the underlying datasource, since grid flows readinParamswhen building the datasource call).$grid.inParams.<id>Invoketo audit the full reference contract — moduleId, configParameters mirror, vars declared — before push. See references/hubs.md → Invocation Contract and ../component-wiring-check/references/component-wiring.md.component-wiring-check -
Toolbar / tab IDs are unique within the hub. Flow code addresses them by(
id,$hub.toolbar.save.control...) — collisions silently overwrite.$hub.tabs.rules.hidden = ...
-
工具栏按钮+点击流程。每个工具栏按钮条目包含指向hub本地流程或外部函数。在hub代码中,通过
clickFlowConfig调用函数,通过$flows.<Package>.<fn>打开表单/编辑器。禁止直接调用动作——需将动作包装在函数中。请参阅../datex-studio-runtime/calling-conventions.md及references/hubs.md → 常见模式了解引擎切换、配置选项对话框、权限控制$shell.<Package>.open<referenceName>Dialog(...)及共享本地流程模式。on_init -
死绑定陷阱审核。最常见的hub错误:hub过滤器绑定到标签页中的某个ID,但挂载的网格并未将其声明为
configParameters。绑定看似正常,但网格永远无法接收该值。inParam规则:标签页中的每个绑定必须与挂载网格的configParameters中的名称一致——且网格声明的每个inParams必须在标签页的inParam中有对应条目(未使用的条目设为configParameters或value: "")。value: null当hub过滤器用于限定特定标签页网格的范围(如过滤器通过projects限定规则网格,或project_ids过滤器通过contract限定文档网格),需在同一编辑操作中审核挂载网格的顶级contract_id。若需要绑定但网格未声明匹配的inParams,需在同一编辑操作中扩展网格(及底层数据源,因为网格流程在构建数据源调用时会读取inParam)。$grid.inParams.<id>推送前调用审核完整参考契约——moduleId、configParameters匹配、变量声明。请参阅references/hubs.md → 调用契约及../component-wiring-check/references/component-wiring.md。component-wiring-check -
工具栏/标签页ID在hub内唯一。流程代码通过定位它们(
id、$hub.toolbar.save.control...)——重复ID会静默覆盖。$hub.tabs.rules.hidden = ...
Phase 4: Validate + push
阶段4:验证与推送
bash
undefinedbash
undefinedValidate the body locally against the branch
针对分支本地验证配置体
dxs configuration validate hub -b <branchId> -D body.json
dxs configuration validate hub -b <branchId> -D body.json
For a new hub
创建新hub
dxs configuration upsert hub -b <branchId> -D body.json
dxs configuration upsert hub -b <branchId> -D body.json
For modify-existing (round-trip — never skip the jq extract)
修改现有配置(往返流程——切勿跳过jq提取步骤)
dxs configuration get hub <configId> -b <branchId> -O envelope.json
jq .json envelope.json > body.json
dxs configuration get hub <configId> -b <branchId> -O envelope.json
jq .json envelope.json > body.json
... edit body.json ...
... 编辑body.json ...
dxs configuration upsert hub -b <branchId> -D body.json
Validation surfaces missing required fields, malformed `configParameters` shapes, and selector/grid reference errors before push. It does not catch the dead-wiring trap (configParameters whose `id` is absent from the mounted grid's `inParams`) — that's a contract concern between two components, audited via `component-wiring-check` and the Phase 3 rule above.dxs configuration upsert hub -b <branchId> -D body.json
验证会在推送前发现缺失的必填字段、格式错误的`configParameters`及选择器/网格引用错误。但无法检测死绑定陷阱(`configParameters`中的`id`未在挂载网格的`inParams`中存在)——这是两个组件间的契约问题,需通过`component-wiring-check`及上述阶段3的规则审核。Phase 5: Verify in Studio (optional)
阶段5:在Studio中验证(可选)
Reload the hub in the running app:
- Filters render and the dropdowns populate (selectors wired correctly).
- Tabs query when filters change (the tab ↔ grid
configParameterscontract holds).inParams - Toolbar buttons fire their click flows; dialog openers return; propagates state.
$hub.refresh() - Role-gated tabs hide for unauthorized users (access-gated flow runs).
on_init
If the running app isn't available, re-fetch the config and diff against (using the corrected extract pattern) to confirm the push landed.
body.jsonjq .json在运行的应用中重新加载hub:
- 过滤器正常渲染且下拉列表填充(选择器绑定正确)。
- 过滤器变更时标签页查询正常(标签页↔ 网格
configParameters契约有效)。inParams - 工具栏按钮触发点击流程;对话框正常打开;传播状态。
$hub.refresh() - 未授权用户无法看到角色权限控制的标签页(权限控制流程正常运行)。
on_init
若无法访问运行的应用,重新获取配置并与对比(使用修正后的提取模式)以确认推送成功。
body.jsonjq .jsonPre-Flight Checklist
预检清单
Before push, walk the full checklist in references/hubs.md → Pre-Flight Checklist. The fast version:
- File basics: ,
configurationTypeId: 2endsreferenceName— plus the universal checks (../datex-studio-conventions/universal-checklist.md)._hub - Tabs carry full contracts (mirrors the mounted grid's
configParametersexactly — no extras, no missing entries).inParams - Filter bindings are contract-complete (selector references resolve; every selector configParameter has an entry).
- Vars declared (every in flow code is in top-level
$hub.vars.<id>).vars - Calling-tier compliance (functions via ; dialog openers via
$flows.<Package>.<fn>; no direct action calls).$shell.<Package>.open<referenceName>Dialog(...) - Toolbar/tab IDs are unique within the hub.
- TypeScript-expression strings wrapped correctly; dynamic tooltips go through declared .
$hub.vars.<name>
推送前,请完成references/hubs.md → 预检清单中的所有检查。简化版:
- 文件基础:、
configurationTypeId: 2以referenceName结尾——加上通用检查项(../datex-studio-conventions/universal-checklist.md)。_hub - 标签页包含完整的契约(与挂载网格的
configParameters完全匹配——无多余或缺失条目)。inParams - 过滤器绑定契约完整(选择器引用有效;每个选择器configParameter都有对应条目)。
- 变量已声明(流程代码中所有都在顶级
$hub.vars.<id>中)。vars - 符合调用层规范(通过调用函数;通过
$flows.<Package>.<fn>打开对话框;禁止直接调用动作)。$shell.<Package>.open<referenceName>Dialog(...) - 工具栏/标签页ID在hub内唯一。
- TypeScript表达式字符串包裹正确;动态提示需绑定到已声明的。
$hub.vars.<name>
Common Mistakes
常见错误
| Mistake | Fix |
|---|---|
Tab | Dead wiring — the value is silently dropped. Either drop the binding, or extend the grid's |
Piping | Silently destroys config content. Always |
Writing | The var is undeclared — write fails silently or runtime error. Declare every var. |
Calling an action directly from hub code ( | UI-tier rule: invoke functions only; wrap actions in a function. See |
Assigning to a filter or toolbar button's | No-op for dynamic tooltips — must bind to a declared |
| SQL column limit — push will fail validation. Tighten. |
| Import / lookup breaks. Snake_case, |
Tab | Cross-component reference rule — |
Two toolbar buttons (or two tabs) sharing the same | Silent overwrite — flow code can only address one of them. Make IDs unique within the hub. |
After your edit, invoke to surface description/JSON/schema violations. For a final review, invoke .
post-edit-verificationcomponent-validator| 错误 | 修复方案 |
|---|---|
标签页 | 死绑定——值会被静默丢弃。要么删除绑定,要么在同一编辑操作中扩展网格的 |
直接将 | 静默破坏配置内容。编辑前必须执行 |
在流程代码中写入 | 变量未声明——写入操作静默失败或触发运行时错误。必须声明所有变量。 |
从hub代码中直接调用动作( | UI层规则:仅调用函数;将动作包装在函数中。请参阅 |
从流程代码中为过滤器或工具栏按钮的 | 动态提示无效——必须绑定到已声明的 |
| SQL列限制——推送会验证失败。请精简内容。 |
| 导入/查找失败。使用蛇形命名法、 |
标签页 | 跨组件引用规则—— |
两个工具栏按钮(或两个标签页)使用相同的 | 静默覆盖——流程代码只能定位其中一个。确保hub内ID唯一。 |
编辑完成后,调用检查描述/JSON/架构违规。如需最终审核,调用。",
post-edit-verificationcomponent-validator