@qingflow-tech/qingflow-cli 1.1.61-beta.7 → 1.1.61-beta.8

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/README.md CHANGED
@@ -7,7 +7,7 @@ Qingflow CLI 是轻流面向开发者和 AI Agent 的命令行工具。它把轻
7
7
  ## 安装
8
8
 
9
9
  ```bash
10
- npm install @qingflow-tech/qingflow-cli@1.1.61-beta.7
10
+ npm install @qingflow-tech/qingflow-cli@1.1.61-beta.8
11
11
  ```
12
12
 
13
13
  推荐从官网复制这一条一键安装 Qingflow CLI:
@@ -21,7 +21,7 @@ npx qingflow-cli@latest install
21
21
  ## 运行
22
22
 
23
23
  ```bash
24
- npx -y -p @qingflow-tech/qingflow-cli@1.1.61-beta.7 qingflow
24
+ npx -y -p @qingflow-tech/qingflow-cli@1.1.61-beta.8 qingflow
25
25
  ```
26
26
 
27
27
  全局安装后可以直接运行:
@@ -62,7 +62,7 @@ qingflow-skills install --agent codex --scope user
62
62
  如果你通过一次性 `npx -p` 执行 skills 安装,建议加 `--copy`,避免 symlink 指向 npm 临时执行缓存:
63
63
 
64
64
  ```bash
65
- npx -y -p @qingflow-tech/qingflow-cli@1.1.61-beta.7 qingflow-skills install --agent codex --scope user --copy
65
+ npx -y -p @qingflow-tech/qingflow-cli@1.1.61-beta.8 qingflow-skills install --agent codex --scope user --copy
66
66
  ```
67
67
 
68
68
  `qingflow-skills install` 默认使用 symlink,且遇到同名 skill 不会覆盖;只有显式传入 `--force` 才会替换。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingflow-tech/qingflow-cli",
3
- "version": "1.1.61-beta.7",
3
+ "version": "1.1.61-beta.8",
4
4
  "description": "Human-friendly Qingflow command line interface for auth, record operations, import, tasks, and stable builder flows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qingflow-mcp"
7
- version = "1.1.61b7"
7
+ version = "1.1.61b8"
8
8
  description = "User-authenticated MCP server for Qingflow"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -318,7 +318,7 @@ CLI 校验(`PortalSectionPatch`):**chart** 须 **`chart`** 或 **`chart_re
318
318
 
319
319
  ### 3.5 **`grid` / `text` / `link` / `view`**
320
320
 
321
- - **grid**:**`config`** 并入 **`gridConfig`**;业务入口必须写 **`config.items[]`**。应用入口项推荐 `{ "type": 1, "jumpMode": 1, "linkAppKey": "APP_KEY", "linkFormType": 1, "title": "入口名" }`。空 `config` 或空 `items` 只会生成空入口容器,并触发 **`PORTAL_GRID_ITEMS_EMPTY`**。
321
+ - **grid**:**`config`** 并入 **`gridConfig`**;业务入口必须写 **`config.items[]`**。应用入口项推荐 `{ "type": 1, "jumpMode": 1, "linkAppKey": "APP_KEY", "linkFormType": 1, "title": "入口名" }`——**`linkFormType` 缺省时编译器按 1(数据列表)补齐**(缺失会让前端跳转目标为空、入口无法点击);1=数据列表、2=表单页。空 `config` 或空 `items` 只会生成空入口容器,并触发 **`PORTAL_GRID_ITEMS_EMPTY`**。
322
322
  - **text** / **link**:**`text`** / **`url`** 必填。
323
323
  - **view**:**`view_ref`**;**`view_key`** 来自 **`builder app get views`**。
324
324
 
@@ -2774,6 +2774,14 @@ class PortalApplyRequest(StrictModel):
2774
2774
  payload = dict(value)
2775
2775
  payload.pop("schema_version", None)
2776
2776
  payload.pop("schemaVersion", None)
2777
+ # 不发布场景已移除(负责人决策):apply 一律发布。显式 false 明确拒绝,
2778
+ # true/缺省按键消费走默认行为(publish 字段恒 true,仅保留内部默认)。
2779
+ if payload.get("publish") is False:
2780
+ raise ValueError(
2781
+ "portal apply always publishes; the draft-only (publish=false) scenario has been "
2782
+ "removed — delete the publish field from the declaration"
2783
+ )
2784
+ payload.pop("publish", None)
2777
2785
  # schema 文档声明的别名补全(dashKey/dashName):此前条件判断里出现了 dashName
2778
2786
  # 却从未消费,别名声明撞上 StrictModel 被拒,形成 validate 提示与 apply 行为
2779
2787
  # 不一致的观感(实测反馈失败二)。canonical 键优先;别名始终被消费(与 canonical
@@ -50,7 +50,7 @@
50
50
  "publish": {
51
51
  "type": "boolean",
52
52
  "default": true,
53
- "publishCompleteDescription": "apply 后是否发布(true=写后发布并回读线上态;false=仅落草稿)。这是生命周期动作参数,不属于声明内容,幂等重放时用 false。注意:对已发布门户用 false 更新会把发布状态降回草稿——需要保留线上态时不要用 false 试写。"
53
+ "publishCompleteDescription": "apply 一律自动发布(写后发布并回读线上态),不存在草稿-only 门户。本字段已废弃:显式 false 会被拒绝,true/缺省等同默认行为。"
54
54
  },
55
55
  "icon": {
56
56
  "type": "string",
@@ -1119,7 +1119,7 @@
1119
1119
  "integer",
1120
1120
  "null"
1121
1121
  ],
1122
- "gridItemFormTypeDescription": "目标应用页面形态(type=1 时使用)。",
1122
+ "gridItemFormTypeDescription": "目标应用页面形态(type=1 时使用):1=数据列表,2=表单页。缺省按 1(数据列表)——缺失时前端跳转目标为空、入口无法点击。",
1123
1123
  "x-backend": "ComponentGridItemInfo.linkFormType"
1124
1124
  },
1125
1125
  "linkDashKey": {
@@ -112,7 +112,7 @@
112
112
  "integer",
113
113
  "null"
114
114
  ],
115
- "gridItemFormTypeDescription": "目标应用页面形态(type=1 时使用)。",
115
+ "gridItemFormTypeDescription": "目标应用页面形态(type=1 时使用):1=数据列表,2=表单页。缺省按 1(数据列表)——缺失时前端跳转目标为空、入口无法点击。",
116
116
  "x-backend": "ComponentGridItemInfo.linkFormType"
117
117
  },
118
118
  "linkDashKey": {
@@ -49,7 +49,7 @@
49
49
  "publish": {
50
50
  "type": "boolean",
51
51
  "default": true,
52
- "publishDescription": "apply 后是否发布(true=写后发布并回读线上态;false=仅落草稿)。这是生命周期动作参数,不属于声明内容,幂等重放时用 false。注意:对已发布门户用 false 更新会把发布状态降回草稿——需要保留线上态时不要用 false 试写。",
52
+ "publishDescription": "apply 一律自动发布(写后发布并回读线上态),不存在草稿-only 门户。本字段已废弃:显式 false 会被拒绝,true/缺省等同默认行为。",
53
53
  "x-backend": "(编排层,不落库)"
54
54
  }
55
55
  }
@@ -607,7 +607,7 @@
607
607
  "integer",
608
608
  "null"
609
609
  ],
610
- "gridItemFormTypeDescription": "目标应用页面形态(type=1 时使用)。",
610
+ "gridItemFormTypeDescription": "目标应用页面形态(type=1 时使用):1=数据列表,2=表单页。缺省按 1(数据列表)——缺失时前端跳转目标为空、入口无法点击。",
611
611
  "x-backend": "ComponentGridItemInfo.linkFormType"
612
612
  },
613
613
  "linkDashKey": {
@@ -15534,6 +15534,7 @@ class AiBuilderFacade:
15534
15534
  suggested_next_call={"tool_name": "portal_apply", "arguments": {"profile": profile, **normalized_args}},
15535
15535
  )
15536
15536
  write_executed = False
15537
+ sections_write_completed = False
15537
15538
  draft_readback_error: JSONObject | None = None
15538
15539
  live_readback_error: JSONObject | None = None
15539
15540
  update_payload: dict[str, Any] = {}
@@ -15605,6 +15606,7 @@ class AiBuilderFacade:
15605
15606
  self._portal_writer.update_portal(profile=profile, dash_key=dash_key, payload=update_payload)
15606
15607
  portal_update_ms = _duration_ms(portal_update_started_at)
15607
15608
  write_executed = True
15609
+ sections_write_completed = True
15608
15610
  else:
15609
15611
  portal_component_build_ms = 0
15610
15612
  portal_update_ms = 0
@@ -15656,6 +15658,52 @@ class AiBuilderFacade:
15656
15658
  except (QingflowApiError, RuntimeError, ValueError) as error:
15657
15659
  api_error = _coerce_api_error(error) if not isinstance(error, ValueError) else None
15658
15660
  inline_chart_write_executed = any(bool(item.get("write_executed")) for item in inline_chart_results)
15661
+ # 本次 apply 创建的空壳回收:创建成功但 sections 未写入且无内联图表写入时,
15662
+ # 删除刚建的门户壳,阻断「失败重试 → 0 组件空门户堆积」(实测反馈 3 个空壳)。
15663
+ # 更新语义(dash_key 定位)与已有真实写入的场景不回收。
15664
+ if creating and dash_key and not sections_write_completed and not inline_chart_write_executed:
15665
+ cleanup: dict[str, Any] | None = None
15666
+ try:
15667
+ self.portals.portal_delete(profile=profile, dash_key=dash_key)
15668
+ cleanup = {"status": "deleted", "dash_key": dash_key}
15669
+ except (QingflowApiError, RuntimeError) as cleanup_error:
15670
+ cleanup = {
15671
+ "status": "failed",
15672
+ "dash_key": dash_key,
15673
+ "message": _coerce_api_error(cleanup_error).message,
15674
+ }
15675
+ if cleanup.get("status") == "deleted":
15676
+ return finalize(
15677
+ {
15678
+ "status": "failed",
15679
+ "error_code": "PORTAL_APPLY_FAILED",
15680
+ "recoverable": True,
15681
+ "message": (
15682
+ "portal apply failed before sections were written; the empty portal shell "
15683
+ "created in this call was cleaned up — retry the same declaration safely"
15684
+ ),
15685
+ "normalized_args": normalized_args,
15686
+ "missing_fields": [],
15687
+ "allowed_values": {},
15688
+ "details": {
15689
+ "created_portal_cleanup": cleanup,
15690
+ "write_error": (
15691
+ {"message": api_error.message, "transport_error": _transport_error_payload(api_error)}
15692
+ if api_error is not None
15693
+ else {"message": str(error)}
15694
+ ),
15695
+ **({"inline_chart_results": deepcopy(inline_chart_results)} if inline_chart_results else {}),
15696
+ },
15697
+ "request_id": api_error.request_id if api_error else None,
15698
+ "backend_code": api_error.backend_code if api_error else None,
15699
+ "http_status": None if api_error is None or api_error.http_status == 404 else api_error.http_status,
15700
+ "suggested_next_call": {"tool_name": "portal_apply", "arguments": {"profile": profile, **normalized_args}},
15701
+ "noop": False,
15702
+ "warnings": [],
15703
+ "verification": {"write_incomplete": True, "created_portal_cleaned_up": True},
15704
+ }
15705
+ )
15706
+ # 清理失败:空壳仍在,带 dash_key 走 partial 语义交人工处理
15659
15707
  if write_executed or inline_chart_write_executed:
15660
15708
  transport_error = _transport_error_payload(api_error) if api_error is not None else None
15661
15709
  warning = _warning(
@@ -17034,12 +17082,22 @@ class AiBuilderFacade:
17034
17082
  component = {"type": 10, "position": position_payload, "viewgraphConfig": _compact_dict(view_config)}
17035
17083
  layout_metadata.append({"source_type": section.source_type, "role": section.role})
17036
17084
  elif section.source_type == "grid":
17085
+ # 应用入口跳转页面缺省:声明未给 linkFormType 的 type=1 条目按 1(数据列表)
17086
+ # 补齐——缺失时前端渲染的跳转目标为空、入口无法点击(实测反馈)。其余
17087
+ # 入口类型(2=门户/3=应用包/4=外链)不走该键,显式值一律保留。
17088
+ grid_config_payload = deepcopy(section.config)
17089
+ grid_items = grid_config_payload.get("items") if isinstance(grid_config_payload, dict) else None
17090
+ if isinstance(grid_items, list):
17091
+ for grid_item in grid_items:
17092
+ if isinstance(grid_item, dict) and _coerce_positive_int(grid_item.get("type")) == 1:
17093
+ if _coerce_positive_int(grid_item.get("linkFormType")) is None:
17094
+ grid_item["linkFormType"] = 1
17037
17095
  component = {
17038
17096
  "type": 2,
17039
17097
  "position": position_payload,
17040
17098
  # gridTitle=None(存量空标题)剔除不落库;beingShowTitle 缺省 True、声明 config 内
17041
17099
  # beingShowTitle 键后置覆盖(提取侧 grid config 保留该键,存量 false 保真)。
17042
- "gridConfig": _compact_dict({"gridTitle": section.title, "beingShowTitle": True, **deepcopy(section.config)}),
17100
+ "gridConfig": _compact_dict({"gridTitle": section.title, "beingShowTitle": True, **(grid_config_payload if isinstance(grid_config_payload, dict) else {})}),
17043
17101
  }
17044
17102
  layout_metadata.append({"source_type": section.source_type, "role": section.role})
17045
17103
  elif section.source_type == "filter":
@@ -293,7 +293,6 @@ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) ->
293
293
  portal_apply.add_argument("--dash-key", default="")
294
294
  portal_apply.add_argument("--dash-name", default="")
295
295
  portal_apply.add_argument("--package-id", type=int)
296
- portal_apply.add_argument("--publish", action=argparse.BooleanOptionalAction, default=None, help="发布开关;--file 声明模式下缺省尊重声明内 publish 字段(再缺省 true),显式传参时覆盖声明值")
297
296
  portal_apply.add_argument("--payload-file", help="兼容:完整门户 payload JSON(裸 DTO 透传);新代码改用 --file")
298
297
  portal_apply.add_argument("--sections-file")
299
298
  portal_apply.add_argument("--layout-preset", default="")
@@ -1470,22 +1469,12 @@ def _handle_portal_apply(args: argparse.Namespace, context: CliContext) -> dict:
1470
1469
  file_declaration.setdefault("package_tag_id", args.package_id)
1471
1470
  if getattr(args, "dash_key", ""):
1472
1471
  file_declaration["dash_key"] = args.dash_key
1473
- # publish 三态对齐 MCP(声明值优先、显式 flag 最高):声明内 publish 弹出后由 flag 解析——
1474
- # flag 未传时尊重声明值(含幂等重放的 publish:false),声明也未写时才缺省 true。
1475
- flag_publish = getattr(args, "publish", None)
1476
- declaration_publish = file_declaration.pop("publish", None)
1477
- effective_publish = (
1478
- bool(flag_publish)
1479
- if flag_publish is not None
1480
- else (bool(declaration_publish) if declaration_publish is not None else True)
1481
- )
1482
1472
  file_schema_version = str(file_declaration.pop("schema_version", None) or file_declaration.pop("schemaVersion", None) or "").strip() or None
1483
1473
  effective_schema_version = getattr(args, "schema_version", None) or file_schema_version
1484
1474
  return context.builder.portal_apply(
1485
1475
  profile=args.profile,
1486
1476
  payload=file_declaration,
1487
1477
  schema_version=effective_schema_version,
1488
- publish=effective_publish,
1489
1478
  )
1490
1479
  # deprecation 提示仅在实际使用 patch 参数时打印(review §5 噪声收敛):
1491
1480
  # 纯 flag 调用(--dash-key/--publish/--schema-version/--package-id 定位或发布
@@ -1539,7 +1528,6 @@ def _handle_portal_apply(args: argparse.Namespace, context: CliContext) -> dict:
1539
1528
  dash_key=args.dash_key,
1540
1529
  dash_name=args.dash_name,
1541
1530
  package_id=args.package_id,
1542
- publish=bool(args.publish if args.publish is not None else True),
1543
1531
  sections=sections,
1544
1532
  layout_preset=args.layout_preset,
1545
1533
  visibility=load_object_arg(args.visibility_file, option_name="--visibility-file"),
@@ -637,7 +637,6 @@ def build_builder_server() -> PolicyAwareFastMCP:
637
637
  dash_name: str = "",
638
638
  name: str = "",
639
639
  package_id: int | None = None,
640
- publish: bool = True,
641
640
  sections: list[dict] | None = None,
642
641
  pages: list[dict] | None = None,
643
642
  layout_preset: str = "",
@@ -677,7 +676,6 @@ def build_builder_server() -> PolicyAwareFastMCP:
677
676
  dash_name=dash_name,
678
677
  name=name,
679
678
  package_id=package_id,
680
- publish=publish,
681
679
  sections=sections or [],
682
680
  pages=pages or [],
683
681
  layout_preset=layout_preset,
@@ -858,7 +858,6 @@ class AiBuilderTools(ToolBase):
858
858
  dash_name: str = "",
859
859
  name: str = "",
860
860
  package_id: int | None = None,
861
- publish: bool = True,
862
861
  sections: list[JSONObject] | None = None,
863
862
  pages: list[JSONObject] | None = None,
864
863
  layout_preset: str = "",
@@ -900,7 +899,6 @@ class AiBuilderTools(ToolBase):
900
899
  dash_name=dash_name,
901
900
  name=name,
902
901
  package_id=package_id,
903
- publish=publish,
904
902
  sections=sections or [],
905
903
  pages=pages or [],
906
904
  layout_preset=layout_preset,
@@ -4296,7 +4294,6 @@ class AiBuilderTools(ToolBase):
4296
4294
  dash_name: str = "",
4297
4295
  name: str = "",
4298
4296
  package_id: int | None = None,
4299
- publish: bool = True,
4300
4297
  sections: list[JSONObject] | None = None,
4301
4298
  pages: list[JSONObject] | None = None,
4302
4299
  layout_preset: str = "",
@@ -4318,7 +4315,6 @@ class AiBuilderTools(ToolBase):
4318
4315
  if patch_sections is not None:
4319
4316
  normalized_args = {
4320
4317
  "dash_key": dash_key,
4321
- "publish": publish,
4322
4318
  "patch_sections": patch_sections,
4323
4319
  }
4324
4320
  return self._attach_apply_envelope(profile, "portal_apply", _publicize_package_fields(_safe_tool_call(
@@ -4326,7 +4322,6 @@ class AiBuilderTools(ToolBase):
4326
4322
  profile=profile,
4327
4323
  dash_key=dash_key,
4328
4324
  patch_sections=patch_sections,
4329
- publish=publish,
4330
4325
  ),
4331
4326
  error_code="PORTAL_PATCH_FAILED",
4332
4327
  normalized_args=normalized_args,
@@ -4341,8 +4336,6 @@ class AiBuilderTools(ToolBase):
4341
4336
  request_payload["name"] = name
4342
4337
  if package_id is not None:
4343
4338
  request_payload["package_id"] = package_id
4344
- if "publish" not in request_payload or publish is False:
4345
- request_payload["publish"] = publish
4346
4339
  if sections:
4347
4340
  request_payload["sections"] = sections
4348
4341
  if pages:
@@ -4386,7 +4379,6 @@ class AiBuilderTools(ToolBase):
4386
4379
  "profile": profile,
4387
4380
  "dash_name": dash_name or "业务门户",
4388
4381
  "package_id": package_id or 1001,
4389
- "publish": True,
4390
4382
  "layout_preset": "dashboard_2col",
4391
4383
  "sections": [
4392
4384
  {