@comate/zulu 1.1.0 → 1.2.0

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 (88) hide show
  1. package/README.md +8 -0
  2. package/comate-engine/assets/skills/auto-commit/SKILL.md +386 -0
  3. package/comate-engine/assets/skills/auto-commit/references/issue_type_mapping.json +19 -0
  4. package/comate-engine/assets/skills/auto-commit/references/new_version_instruction.md +196 -0
  5. package/comate-engine/assets/skills/auto-commit/references/old_version_instruction.md +189 -0
  6. package/comate-engine/assets/skills/auto-commit/references/query_reference.md +176 -0
  7. package/comate-engine/assets/skills/auto-commit/scripts/compat.py +86 -0
  8. package/comate-engine/assets/skills/auto-commit/scripts/create_card_cli.py +67 -0
  9. package/comate-engine/assets/skills/auto-commit/scripts/git_diff_cli.py +195 -0
  10. package/comate-engine/assets/skills/auto-commit/scripts/git_utils.py +225 -0
  11. package/comate-engine/assets/skills/auto-commit/scripts/icafe/__init__.py +66 -0
  12. package/comate-engine/assets/skills/auto-commit/scripts/icafe/client.py +444 -0
  13. package/comate-engine/assets/skills/auto-commit/scripts/icafe/farseer.py +53 -0
  14. package/comate-engine/assets/skills/auto-commit/scripts/icafe/matching.py +778 -0
  15. package/comate-engine/assets/skills/auto-commit/scripts/logger.py +32 -0
  16. package/comate-engine/assets/skills/auto-commit/scripts/recognize_card_cli.py +63 -0
  17. package/comate-engine/assets/skills/automation-browser-comate/SKILL.md +193 -90
  18. package/comate-engine/assets/skills/figma2code-comate/SKILL.md +2 -2
  19. package/comate-engine/assets/skills/figma2code-comate/references/codeConnect.md +7 -10
  20. package/comate-engine/assets/skills/smart-commit/SKILL.md +646 -0
  21. package/comate-engine/assets/skills/smart-commit/references/issue_type_mapping.json +19 -0
  22. package/comate-engine/assets/skills/smart-commit/references/query_reference.md +176 -0
  23. package/comate-engine/assets/skills/smart-commit/scripts/compat.py +86 -0
  24. package/comate-engine/assets/skills/smart-commit/scripts/create_card_cli.py +67 -0
  25. package/comate-engine/assets/skills/smart-commit/scripts/git_utils.py +220 -0
  26. package/comate-engine/assets/skills/smart-commit/scripts/icafe/__init__.py +66 -0
  27. package/comate-engine/assets/skills/smart-commit/scripts/icafe/client.py +444 -0
  28. package/comate-engine/assets/skills/smart-commit/scripts/icafe/farseer.py +53 -0
  29. package/comate-engine/assets/skills/smart-commit/scripts/icafe/matching.py +728 -0
  30. package/comate-engine/assets/skills/smart-commit/scripts/logger.py +32 -0
  31. package/comate-engine/assets/skills/smart-commit/scripts/recognize_card_cli.py +63 -0
  32. package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +7 -7
  33. package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
  34. package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
  35. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +8 -8
  36. package/comate-engine/node_modules/@comate/preview-proxy/package.json +2 -2
  37. package/comate-engine/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  38. package/comate-engine/package.json +2 -2
  39. package/comate-engine/server.js +61 -44
  40. package/dist/bundle/index.js +8 -8
  41. package/package.json +1 -1
  42. package/comate-engine/node_modules/@comate/plugin-engine/dist/index.d.ts +0 -188
  43. package/comate-engine/node_modules/@comate/plugin-host/dist/main.d.ts +0 -14
  44. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +0 -4817
  45. package/comate-engine/node_modules/better-sqlite3/README.md +0 -99
  46. package/comate-engine/node_modules/bindings/LICENSE.md +0 -22
  47. package/comate-engine/node_modules/bindings/README.md +0 -98
  48. package/comate-engine/node_modules/compare-versions/README.md +0 -133
  49. package/comate-engine/node_modules/compare-versions/lib/esm/compare.d.ts +0 -19
  50. package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.d.ts +0 -8
  51. package/comate-engine/node_modules/compare-versions/lib/esm/index.d.ts +0 -5
  52. package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.d.ts +0 -14
  53. package/comate-engine/node_modules/compare-versions/lib/esm/utils.d.ts +0 -7
  54. package/comate-engine/node_modules/compare-versions/lib/esm/validate.d.ts +0 -28
  55. package/comate-engine/node_modules/file-uri-to-path/History.md +0 -21
  56. package/comate-engine/node_modules/file-uri-to-path/README.md +0 -74
  57. package/comate-engine/node_modules/file-uri-to-path/index.d.ts +0 -2
  58. package/comate-engine/node_modules/pkce-challenge/README.md +0 -55
  59. package/comate-engine/node_modules/pkce-challenge/dist/index.browser.d.ts +0 -19
  60. package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.ts +0 -19
  61. package/comate-engine/node_modules/sqlite-vec/README.md +0 -1
  62. package/comate-engine/node_modules/sqlite-vec/index.d.ts +0 -17
  63. package/comate-engine/node_modules/sqlite-vec-darwin-arm64/README.md +0 -1
  64. package/comate-engine/node_modules/sqlite-vec-darwin-x64/README.md +0 -1
  65. package/comate-engine/node_modules/sqlite-vec-linux-arm64/README.md +0 -1
  66. package/comate-engine/node_modules/sqlite-vec-linux-x64/README.md +0 -1
  67. package/comate-engine/node_modules/sqlite-vec-windows-x64/README.md +0 -1
  68. package/comate-engine/node_modules/tree-sitter-bash/README.md +0 -44
  69. package/comate-engine/node_modules/tree-sitter-bash/bindings/node/binding_test.js +0 -9
  70. package/comate-engine/node_modules/tree-sitter-bash/bindings/node/index.d.ts +0 -28
  71. package/comate-engine/node_modules/tree-sitter-bash/bindings/node/index.js +0 -11
  72. package/comate-engine/node_modules/tree-sitter-bash/prebuilds/darwin-arm64/tree-sitter-bash.node +0 -0
  73. package/comate-engine/node_modules/tree-sitter-bash/prebuilds/darwin-x64/tree-sitter-bash.node +0 -0
  74. package/comate-engine/node_modules/tree-sitter-bash/prebuilds/linux-arm64/tree-sitter-bash.node +0 -0
  75. package/comate-engine/node_modules/tree-sitter-bash/prebuilds/linux-x64/tree-sitter-bash.node +0 -0
  76. package/comate-engine/node_modules/tree-sitter-bash/prebuilds/win32-arm64/tree-sitter-bash.node +0 -0
  77. package/comate-engine/node_modules/tree-sitter-bash/prebuilds/win32-x64/tree-sitter-bash.node +0 -0
  78. package/comate-engine/node_modules/tree-sitter-bash/src/grammar.json +0 -7145
  79. package/comate-engine/node_modules/tree-sitter-bash/src/node-types.json +0 -2894
  80. package/comate-engine/node_modules/web-streams-polyfill/README.md +0 -119
  81. package/comate-engine/node_modules/web-streams-polyfill/types/polyfill.d.ts +0 -28
  82. package/comate-engine/node_modules/web-streams-polyfill/types/ponyfill.d.ts +0 -809
  83. package/comate-engine/node_modules/web-tree-sitter/README.md +0 -269
  84. package/comate-engine/node_modules/web-tree-sitter/debug/tree-sitter.cjs +0 -4558
  85. package/comate-engine/node_modules/web-tree-sitter/debug/tree-sitter.js +0 -4516
  86. package/comate-engine/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
  87. package/comate-engine/node_modules/web-tree-sitter/web-tree-sitter.d.ts +0 -1030
  88. package/comate-engine/node_modules/win-ca/README.md +0 -648
@@ -0,0 +1,32 @@
1
+ """smart-commit 统一日志模块
2
+
3
+ 日志写入 ~/.comate-engine/log/kernel-yyyy-mm-dd.log
4
+ """
5
+
6
+ import logging
7
+ from datetime import date
8
+ from pathlib import Path
9
+
10
+
11
+ def get_logger(name: str = "smart-commit") -> logging.Logger:
12
+ """获取 smart-commit 日志实例
13
+
14
+ Args:
15
+ name: 日志名称,默认 "smart-commit"
16
+
17
+ Returns:
18
+ 配置好的 Logger 实例,写入 ~/.comate-engine/log/kernel-yyyy-mm-dd.log
19
+ """
20
+ logger = logging.getLogger(f"comate.{name}")
21
+ if not logger.handlers:
22
+ log_dir = Path.home() / ".comate-engine" / "log"
23
+ log_dir.mkdir(parents=True, exist_ok=True)
24
+ log_file = log_dir / f"kernel-{date.today().isoformat()}.log"
25
+ handler = logging.FileHandler(log_file, encoding="utf-8")
26
+ handler.setFormatter(logging.Formatter(
27
+ "[%(asctime)s] [smart-commit] [%(levelname)s] %(message)s",
28
+ datefmt="%Y-%m-%d %H:%M:%S"
29
+ ))
30
+ logger.addHandler(handler)
31
+ logger.setLevel(logging.DEBUG)
32
+ return logger
@@ -0,0 +1,63 @@
1
+ """命令行工具:通过链接或卡片 ID 识别并获取 iCafe 卡片详情
2
+
3
+ 用法:
4
+ python3 recognize_card_cli.py --link "DevOps-iScan-35835"
5
+ python3 recognize_card_cli.py --link "https://console.cloud.baidu-int.com/devops/icafe/issue/xxxx/show"
6
+
7
+ 输出:
8
+ JSON 格式的卡片详情,包含 sequence、title、type、status、spacePrefix 等字段。
9
+ 失败时输出 {"error": "错误信息"}。
10
+ """
11
+
12
+ import argparse
13
+ import json
14
+ import os
15
+ import sys
16
+
17
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
18
+
19
+ from icafe.client import ICafeQueryClient
20
+ from icafe.matching import parse_card_id_from_link
21
+
22
+
23
+ def main():
24
+ """识别 iCafe 卡片的主函数"""
25
+ parser = argparse.ArgumentParser(description="识别 iCafe 卡片")
26
+ parser.add_argument("--link", required=True,
27
+ help="卡片链接或卡片 ID,示例: "
28
+ "'DevOps-iScan-35835' 或 "
29
+ "'https://console.cloud.baidu-int.com/devops/icafe/issue/DevOps-iScan-35835/show'")
30
+ args = parser.parse_args()
31
+
32
+ try:
33
+ parsed = parse_card_id_from_link(args.link)
34
+ if not parsed:
35
+ print(json.dumps({"error": "无法解析卡片链接或 ID,请检查格式"}))
36
+ sys.exit(1)
37
+
38
+ space_prefix = parsed["space_prefix"]
39
+ card_id = parsed["card_id"]
40
+
41
+ client = ICafeQueryClient()
42
+ card_detail = client.get_card_by_id(space_id=space_prefix, card_id=card_id)
43
+
44
+ if card_detail and card_detail.get("cards"):
45
+ card = card_detail["cards"][0]
46
+ print(json.dumps({
47
+ "success": True,
48
+ "sequence": card_id,
49
+ "title": card.get("title", ""),
50
+ "type": card.get("type", ""),
51
+ "status": card.get("status", ""),
52
+ "spacePrefix": space_prefix,
53
+ }))
54
+ else:
55
+ print(json.dumps({"error": "无法获取卡片信息,请检查链接或 ID 是否正确"}))
56
+ sys.exit(1)
57
+ except Exception as e:
58
+ print(json.dumps({"error": f"识别卡片异常: {type(e).__name__}: {e}"}))
59
+ sys.exit(1)
60
+
61
+
62
+ if __name__ == "__main__":
63
+ main()
@@ -1,125 +1,228 @@
1
1
  ---
2
2
  name: comate-automation-browser
3
3
  description: |
4
- 浏览器自动化,用于网页浏览、UI 测试、截图验证和网页内容抓取。
5
- 在以下场景使用此 skill:
6
- - 需要浏览网站、导航网页或与网页 UI 交互
7
- - 需要截图进行视觉验证
8
- - 需要测试 Web 应用的 UI 行为
9
- - 需要抓取或提取网页内容
10
- - 需要点击按钮或在网页中输入文本
4
+ Browser automation for web browsing, UI testing, screenshot verification, and web content scraping.
5
+ When to use:
6
+ - Pages requiring JavaScript rendering (SPA, React, Vue, Angular apps)
7
+ - Need to interact with UI: click buttons, fill forms, login
8
+ - Need screenshots or visual verification
9
+ - Content loads dynamically via AJAX/fetch
10
+ - Multi-step navigation, complex workflows, or authenticated sessions
11
+ - Testing UI behavior of web applications
12
+ When NOT to use (use `web_fetch` tool instead):
13
+ - Simple static HTML pages (no JS rendering needed)
14
+ - Server-rendered content that's immediately available in HTML
15
+ - API documentation, blog posts, or articles
16
+ - Quick content lookup without interaction
17
+ For complex tasks or information-heavy pages, use `delegate_subtask` to invoke a subagent with this skill.
11
18
  hidden: true
12
19
  ---
13
20
 
14
21
  # Comate Automation Browser
15
22
 
16
- 通过 `run_command` 工具加 `comate-automation-browser` 前缀来调用浏览器自动化能力。
23
+ Invoke browser automation capabilities via the `run_command` tool with the `comate-automation-browser` prefix.
17
24
 
18
- ## 调用方式
25
+ ## Invocation
19
26
 
20
27
  ```json
21
- { "command": "comate-automation-browser <子命令> [参数]" }
28
+ { "command": "comate-automation-browser <subcommand> [arguments]" }
22
29
  ```
23
30
 
24
- **重要**:必须通过 `run_command` `comate-automation-browser` 前缀调用。不要将 `browser_use` 作为独立工具直接调用,也不要将 `comate-automation-browser` 作为 shell 命令执行。
31
+ **Important**: Must be invoked via `run_command` with the `comate-automation-browser` prefix. Do not call `browser_use` as a standalone tool directly, and do not execute `comate-automation-browser` as a shell command. The `run_command` call **MUST** contain only the `comate-automation-browser ...` command exactly as shown — do not prepend, append, or chain any other commands (e.g., no `&&`, `||`, `;`, `|`, or subshells). This is Comate's wrapper around the IDE browser, not Claude Code's native `browser-use` CLI.
25
32
 
26
- ## 可用命令
33
+ ## Core Workflow
27
34
 
28
- ### 导航
35
+ Follow this sequence by default, unless the task explicitly does not require it:
29
36
 
30
- | 命令 | 参数 | 说明 |
31
- |------|------|------|
32
- | `navigate <url>` | `url`(必填) | 导航到指定 URL |
33
- | `back` | — | 浏览器后退 |
34
- | `forward` | — | 浏览器前进 |
35
- | `reload` | — | 重新加载当前页面 |
36
-
37
- ### 页面检查
38
-
39
- | 命令 | 参数 | 说明 |
40
- |------|------|------|
41
- | `snapshot` | — | 获取无障碍快照(包含元素 UID 的 YAML 树),用于了解页面结构和获取交互所需的元素 UID |
42
- | `html [selector]` | `selector`(可选,CSS 选择器) | 获取页面 HTML,可通过选择器过滤 |
43
- | `screenshot` | 见下方选项 | 对当前页面截图 |
44
- | `status` | — | 显示浏览器状态和所有打开的标签页 |
45
- | `console` | — | 获取浏览器控制台消息 |
37
+ ```text
38
+ 1. navigate/open
39
+ 2. snapshot or status
40
+ 3. click/type/fill_form/drag/click_at
41
+ 4. snapshot/status
42
+ 5. screenshot/console/evaluate for verification
43
+ ```
46
44
 
47
- **`screenshot` 选项**(均为可选):
48
- - 位置参数:`filePath` — 截图保存路径
49
- - `--format <png|jpeg|webp>` — 图片格式
50
- - `--full-page` — 截取整个可滚动页面
51
- - `--uid <uid>` 截取指定 UID 的元素
45
+ For asynchronously updating pages, do not assume success after a single action. Repeatedly verify using `snapshot`, `status`, `evaluate`, `console`, or `screenshot`.
46
+
47
+ ## Browser Modes
48
+
49
+ The current mode is determined by IDE settings; the agent does not need to choose.
50
+
51
+ - `builtin`
52
+ - Runs in the IDE's built-in browser or webview.
53
+ - `snapshot` returns an approximate accessibility tree, not a full Playwright snapshot.
54
+ - Post-action waits are heuristic-based; complex frontend pages may require additional verification.
55
+ - `chrome`
56
+ - Connects to the local Chrome/CDP, reusing a Comate-dedicated persistent profile.
57
+ - `standalone`
58
+ - Uses a standalone Chromium downloaded by Comate.
59
+ - `off`
60
+ - Browser capabilities are disabled; tool calls will fail.
61
+
62
+ ## Available Commands
63
+
64
+ ### Navigation
65
+
66
+ | Command | Arguments | Description |
67
+ |---------|-----------|-------------|
68
+ | `navigate <url>` | `url` (required) | Navigate to the specified URL |
69
+ | `open <url>` | `url` (required) | Alias for `navigate` |
70
+ | `back` | — | Go back in browser history |
71
+ | `forward` | — | Go forward in browser history |
72
+ | `reload` | — | Reload the current page |
73
+
74
+ ### Page Inspection
75
+
76
+ | Command | Arguments | Description |
77
+ |---------|-----------|-------------|
78
+ | `snapshot` | — | Get an accessibility snapshot (YAML tree with element UID/`ref`) |
79
+ | `html [selector]` | `selector` (optional) | Get page HTML, optionally filtered by CSS selector |
80
+ | `screenshot` | See options below | Take a screenshot of the current page |
81
+ | `status` | — | Show current browser state and all open tabs |
82
+ | `console` | See options below | Get console messages |
83
+ | `evaluate <script>` | `script` (required) | Execute JavaScript in the page context |
84
+
85
+ `screenshot` options:
86
+ - Positional argument: `filePath`, path to save the screenshot
87
+ - `--format <png|jpeg|webp>`, image format
88
+ - `--full-page`, capture the entire scrollable page
89
+ - `--uid <uid>`, capture a specific element by UID
90
+
91
+ `console` options:
92
+ - `--types <type...>`, filter by type, available values: `log info warn error debug`
93
+ - `--limit <n>`, limit the number of returned entries
94
+ - `--offset <n>`, start reading from the specified offset
95
+ - `--include-preserved`, include previously collected messages
96
+
97
+ ### Interaction
98
+
99
+ | Command | Arguments | Description |
100
+ |---------|-----------|-------------|
101
+ | `click <uid>` | `uid` (required) | Click an element |
102
+ | `dblclick <uid>` | `uid` (required) | Double-click an element |
103
+ | `rightclick <uid>` | `uid` (required) | Right-click an element |
104
+ | `click_at <x> <y>` | Coordinates (required) | Click at coordinates, suitable for canvas/special controls |
105
+ | `type <text>` | See options below | Type text |
106
+ | `scroll <direction>` | `up/down/left/right` | Scroll the page |
107
+ | `drag <startUid> <endUid>` | Start and end UIDs (required) | Drag an element |
108
+ | `fill_form <json>` | JSON (required) | Batch fill form fields |
109
+
110
+ `click` options:
111
+ - `--double`, double-click
112
+ - `--button <left|right|middle>`, specify mouse button
113
+ - `--modifiers <Alt Control Meta Shift>`, click with modifier keys
114
+
115
+ `type` options:
116
+ - `<text>` (required), the text to type; wrap multi-word text in quotes
117
+ - `--uid <uid>`, specify the target element
118
+ - `--submit`, press Enter after typing
119
+ - `--slowly`, type character by character
120
+
121
+ `scroll` options:
122
+ - `--amount <pixels>`, specify scroll distance in pixels
123
+
124
+ `fill_form` notes:
125
+ - Argument should be a JSON array, or a JSON object containing a `fields` array
126
+ - Each field object must include at least `name`, `type`, `ref`/`uid`, and `value`
127
+ - `ref`/`uid` must come from the most recent `snapshot`
128
+
129
+ Example:
130
+
131
+ ```text
132
+ comate-automation-browser fill_form '[{"name":"Email","type":"textbox","uid":"e3","value":"hi@example.com"}]'
133
+ ```
52
134
 
53
- ### 交互
135
+ ### Tab Management
54
136
 
55
- | 命令 | 参数 | 说明 |
56
- |------|------|------|
57
- | `click <uid>` | `uid`(必填,来自 snapshot) | 通过 UID 点击元素 |
58
- | `type <text>` | 见下方选项 | 在页面或聚焦元素中输入文本 |
59
- | `scroll <direction>` | `up` `down`(默认 `down`) | 滚动页面 |
137
+ | Command | Arguments | Description |
138
+ |---------|-----------|-------------|
139
+ | `new_page [url]` | `url` (optional) | Open a new tab, optionally navigating to a URL |
140
+ | `select_page <index>` | `index` (integer) | Switch to a tab by index |
141
+ | `close_page <index>` | `index` (integer) | Close a tab by index |
60
142
 
61
- **`type` 选项**:
62
- - `<text>`(必填)— 要输入的文本,多词文本用 `"` 包裹
63
- - `--uid <uid>` — 输入前先聚焦该元素
64
- - `--submit` — 输入后按回车
65
- - `--slowly` — 逐字符输入
143
+ ## Execution Behavior
66
144
 
67
- ### 标签页管理
145
+ - Manual confirmation mode (default): Commands enter a `pending` state and wait for user confirmation.
146
+ - Auto-execute mode: When `autoExecute` is enabled in settings, commands execute immediately.
147
+ - Status flow: `pending -> running -> success / failed / aborted / skipped`
68
148
 
69
- | 命令 | 参数 | 说明 |
70
- |------|------|------|
71
- | `new_page [url]` | `url`(可选) | 打开新标签页,可选导航到指定 URL |
72
- | `select_page <index>` | `index`(整数) | 按索引切换标签页 |
73
- | `close_page <index>` | `index`(整数) | 按索引关闭标签页 |
149
+ ## Standard Workflows
74
150
 
75
- ### 高级
151
+ ### General Interaction
76
152
 
77
- | 命令 | 参数 | 说明 |
78
- |------|------|------|
79
- | `evaluate <script>` | `script`(剩余参数拼接为一个字符串) | 在页面上下文中执行 JavaScript |
153
+ ```text
154
+ 1. run_command: "comate-automation-browser navigate https://example.com"
155
+ 2. run_command: "comate-automation-browser snapshot"
156
+ 3. run_command: "comate-automation-browser click e15"
157
+ 4. run_command: "comate-automation-browser snapshot"
158
+ 5. run_command: "comate-automation-browser screenshot"
159
+ ```
80
160
 
81
- ## 执行行为
161
+ ### Reading Page Content
82
162
 
83
- - **手动确认模式**(默认):命令进入 `pending` 状态,等待用户手动确认。
84
- - **自动执行模式**:当设置中启用 `autoExecute` 时,命令立即执行,无需用户确认。
85
- - **状态流转**:`pending` -> `running` -> `success` / `failed` / `aborted` / `rejected`
163
+ ```text
164
+ 1. run_command: "comate-automation-browser navigate https://example.com"
165
+ 2. run_command: "comate-automation-browser evaluate document.body.innerText"
166
+ 3. For a specific section: evaluate document.querySelector('.article').innerText
167
+ ```
86
168
 
87
- ## 标准工作流
169
+ ### Form Filling
88
170
 
89
- ### 交互操作(点击、输入等)
90
- ```
91
- 1. run_command: "comate-automation-browser navigate https://example.com"
92
- 2. run_command: "comate-automation-browser snapshot"
93
- -> 读取 YAML 输出获取元素 UID
94
- 3. run_command: "comate-automation-browser click 15"
95
- -> 点击 UID 为 15 的元素
171
+ ```text
172
+ 1. run_command: "comate-automation-browser snapshot"
173
+ 2. Identify field UIDs/refs from the snapshot
174
+ 3. run_command: "comate-automation-browser fill_form '[{\"name\":\"Email\",\"type\":\"textbox\",\"uid\":\"e3\",\"value\":\"hi@example.com\"}]'"
96
175
  4. run_command: "comate-automation-browser snapshot"
97
- -> 获取更新后的页面状态和新的 UID
98
176
  5. run_command: "comate-automation-browser screenshot"
99
- -> 视觉验证
100
177
  ```
101
178
 
102
- ### 读取页面内容
179
+ ## Key Rules
180
+
181
+ - UIDs/refs come from `snapshot`. Always run `snapshot` before using `click`, `type --uid`, `drag`, `fill_form`, or `screenshot --uid`.
182
+ - Re-run `snapshot` after interactions by default. After clicking, navigating, scrolling, reloading, submitting forms, switching tabs, or executing `evaluate` that modifies the DOM, always refresh the page state.
183
+ - Use `snapshot` for structure and interaction; prefer `evaluate ...innerText` for reading body text. Do not use `html` as a text extraction tool.
184
+ - When `type` is used without `--uid`, only use it when an element is already focused. If the input target is unclear, run `snapshot` first and pass `--uid`.
185
+ - There is no explicit `wait` command for async pages. Poll and verify results using `snapshot`, `status`, `console`, `evaluate`, or `screenshot`.
186
+ - Fall back to alternative actions for complex controls. If a regular click fails, consider `dblclick`, `rightclick`, `click_at`, or `drag`.
187
+ - Always run `status` before tab operations. Closing the last tab is generally not possible.
188
+ - Sessions are automatically managed per conversation; no need to manually create or destroy sessions.
189
+ - Do not expose cache paths or temporary paths for screenshots, HTML, or script results in responses.
190
+ - When a command indicates that content has been written to a file, read the corresponding file directly to get the full result.
191
+
192
+ ## Pause for Manual User Actions
193
+
194
+ Pause automation and wait for the user to complete the following scenarios:
195
+
196
+ - CAPTCHA, slider verification, or bot detection challenges
197
+ - SMS or email verification codes
198
+ - QR code login
199
+ - User-specific sensitive credentials such as passwords, OTP, or security tokens
200
+ - Complex choices requiring the user's subjective judgment
201
+
202
+ Regular form filling, button clicking, and text input do not fall into this category and should be handled by the agent.
203
+
204
+ ## Troubleshooting
205
+
206
+ ### Element Not Found
207
+
208
+ ```text
209
+ 1. snapshot
210
+ 2. scroll down --amount 600
211
+ 3. snapshot
212
+ 4. If still failing, use screenshot or console to assist in locating the element
103
213
  ```
104
- 1. run_command: "comate-automation-browser navigate https://example.com"
105
- 2. run_command: "comate-automation-browser evaluate document.body.innerText"
106
- -> 获取页面纯文本内容(无 HTML 噪声)
107
- -> 如需特定区域:evaluate document.querySelector('.article').innerText
214
+
215
+ ### No Response After Action
216
+
217
+ ```text
218
+ 1. snapshot
219
+ 2. status
220
+ 3. console --types warn error --limit 20
221
+ 4. evaluate document.readyState
222
+ 5. screenshot
108
223
  ```
109
224
 
110
- ## 关键规则
111
-
112
- - **UID 来自 `snapshot`**:在使用 `click` `type --uid` 前,必须先执行 `snapshot` 获取当前元素的 UID。
113
- - **交互后重新 snapshot**:点击和导航后 UID 会变化,必须重新获取。
114
- - **`snapshot` 用于结构和交互**:`snapshot` 用于了解页面结构和获取元素 UID 以进行点击、输入等交互操作。需要读取页面文本内容时,不要使用 `snapshot` 或 `html`(HTML 噪声大),应使用 `evaluate document.body.innerText` 提取纯文本;如需读取特定区域内容,可用 `evaluate document.querySelector('选择器').innerText`。
115
- - **会话自动管理**:浏览器会话按对话自动管理,无需手动管理。
116
- - **不暴露缓存路径**:在回复中不得描述截图、文件等的缓存地址或本地临时路径(如 `/tmp/...`、`~/.cache/...` 等),仅描述操作结果或展示图片内容。
117
- - **需要用户手动操作时暂停**:当遇到需要用户手动操作的场景时(如:
118
- - 图形验证码、滑块验证、人机验证(CAPTCHA)
119
- - 短信/邮箱验证码
120
- - 扫码登录
121
- - 用户专属的敏感凭证(如密码、OTP、安全令牌)
122
- - 需要用户主观判断或选择的复杂交互
123
- ),暂停自动化执行,等待用户 10 秒并提示用户需要进行操作。用户完成操作后,继续执行后续自动化流程。
124
- **注意**:普通表单填写、文本输入、按钮点击等可自动化的操作由 agent 自行处理,不在此列。
125
- - **内容过长时读取文件**:当命令返回结果提示内容过长已写入文件时(如 `snapshot`、`html` 等命令),应直接读取对应文件获取完整内容,以确保任务正常完成。
225
+ ### IDE Built-in Browser Behaving Unexpectedly
226
+
227
+ - In `builtin` mode, waits and snapshots are approximate implementations.
228
+ - If the page relies heavily on animations, virtual lists, canvas, or complex focus management, always perform an additional verification step — do not assume the first action succeeded.
@@ -30,12 +30,12 @@ description: 根据Figma设计稿信息生成代码。当用户选择设计稿
30
30
 
31
31
 
32
32
  2. 图片资源管理
33
- - 请使用终端命令一次性将需要的图像复制到项目中的合适目录中 (请避免一个一个复制图片,尽可能一个命令复制整个图片目录),并记住复制后的【图片目录】。注意无需执行终端命令检查目录中是否有图片。
33
+ - 请使用终端命令一次性将需要的图像复制到项目中的合适目录中 (请避免一个一个复制图片,使用一个命令复制整个图片目录),并记住复制后的【图片目录】。注意无需执行终端命令检查目录中是否有图片。
34
34
  - 请确保在项目中使用正确的方法引用【图片目录】中的图片资源。【图片目录】中的图片名称和html代码中的图片名称是一致的。
35
35
  **请注意tailwind框架中不要使用bg-[url]来引入本地图片资源,比如bg-[url('/images.png')],而是使用style中的background-image属性。**
36
36
 
37
37
  3. 代码生成
38
- - 根据用户要求和上述分析,生成对应代码。
38
+ - 根据读取的userRule和上述分析,生成对应代码。
39
39
 
40
40
  # 其他
41
41
  生成的代码写入项目中。
@@ -1,7 +1,7 @@
1
1
  # Code Connect指南
2
2
  应当严格按下列步骤分析设计稿中使用的组件:
3
3
 
4
- 1. 解析【设计稿html】包含 **组件标记(Component Markers)**的注释。
4
+ 1. 解析【设计稿html】包含 **组件标记(Component Markers)**的注释,明确需要引入的组件列表。
5
5
  组件标记格式如下:
6
6
  \`\`\`html
7
7
  <!-- [START: ComponentName] -->
@@ -10,7 +10,7 @@
10
10
  <!-- [END: ComponentName] -->
11
11
  \`\`\`
12
12
 
13
- 2. 分析【设计稿图片】,识别其中未标记的可复用组件。请逐个检查是否包含下面这几个未标记的组件
13
+ 2. 分析【设计稿图片】,识别其中未标记的可复用组件作为补充。请逐个检查是否包含下面这几个未标记的组件:
14
14
  - 表单与表单项 (Form + Form-item)
15
15
  - 表格 (Table)
16
16
  - 按钮 (Button)
@@ -18,14 +18,11 @@
18
18
  - 单选框 (Radio)
19
19
  - 多选框 (Checkbox)
20
20
  - 模态框 (Modal)
21
+ 如果标记的组件与自动识别需要使用的组件不匹配,以标记的组件优先。如果有明显标记错误应当以友好方式提示用户。
21
22
 
22
23
  3. 确定需要引入的组件后,使用read_file工具在.comate/components目录下读取对应的组件文档。
23
-
24
- 4. 结合组件文档,正确引入组件,并根据原html的特征正确使用组件属性。
25
-
26
-
27
- ## 注意事项:
28
- - **冲突处理**:如果标记的组件与自动识别需要使用的组件不匹配,以标记的组件优先。如果有明显标记错误应当以友好方式提示用户。
29
- - 如果识别到的组件对应的文档在项目中不存在或无法找到,回退到根据 Figma HTML 实现
24
+ - 如果识别到的组件对应的文档在项目中不存在或无法找到,回退到根据 Figma HTML 实现。
30
25
  - 非用户要求禁止读取无关的组件知识。
31
- - 非用户要求禁止在.comate/components目录以外全局检索组件知识。
26
+ - 非用户要求禁止在.comate/components目录以外全局检索组件知识。
27
+
28
+ 4. 结合组件文档,正确引入组件,并根据原html的特征正确使用组件属性。