aicortexpy 0.1.0__py3-none-any.whl
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.
- aicortexpy/__init__.py +3 -0
- aicortexpy/__main__.py +5 -0
- aicortexpy/acp_client.py +559 -0
- aicortexpy/acp_conn.py +853 -0
- aicortexpy/acp_errors.py +107 -0
- aicortexpy/agent_env.py +88 -0
- aicortexpy/artifact_ws.py +233 -0
- aicortexpy/artifacts.py +67 -0
- aicortexpy/attachments.py +85 -0
- aicortexpy/auto_commit.py +106 -0
- aicortexpy/capabilities.py +92 -0
- aicortexpy/chat_acp_pool.py +321 -0
- aicortexpy/cli.py +133 -0
- aicortexpy/client.py +438 -0
- aicortexpy/codex_config.py +98 -0
- aicortexpy/config.py +298 -0
- aicortexpy/daemon.py +677 -0
- aicortexpy/data/default_skills/agent-memory/SKILL.md +67 -0
- aicortexpy/data/default_skills/aicorkit-atlassian/SKILL.md +144 -0
- aicortexpy/data/default_skills/aicorkit-graph/SKILL.md +145 -0
- aicortexpy/data/default_skills/aicorkit-outlook/SKILL.md +87 -0
- aicortexpy/data/default_skills/aicorkit-wxmsg/SKILL.md +96 -0
- aicortexpy/data/default_skills/aicortex-basics/SKILL.md +10 -0
- aicortexpy/data/default_skills/aicortex-bridge-cdp/SKILL.md +118 -0
- aicortexpy/data/default_skills/aicortex-cli-ops/SKILL.md +100 -0
- aicortexpy/data/default_skills/aicortex-graph/SKILL.md +30 -0
- aicortexpy/data/default_skills/graphify/SKILL.md +97 -0
- aicortexpy/data/default_skills/question-form/SKILL.md +162 -0
- aicortexpy/data/default_skills/test-report-generator/SKILL.md +179 -0
- aicortexpy/data/default_skills/test-report-generator/scripts/generate_cases.py +146 -0
- aicortexpy/data/default_skills/test-report-generator/scripts/generate_report.py +275 -0
- aicortexpy/design_seed.py +59 -0
- aicortexpy/diskusage.py +209 -0
- aicortexpy/execenv.py +264 -0
- aicortexpy/gc.py +286 -0
- aicortexpy/handoff_bundle.py +65 -0
- aicortexpy/health.py +178 -0
- aicortexpy/local_skills.py +157 -0
- aicortexpy/models.py +385 -0
- aicortexpy/openclaw_config.py +153 -0
- aicortexpy/pinned_workdir.py +60 -0
- aicortexpy/platform_info.py +61 -0
- aicortexpy/poisoned.py +44 -0
- aicortexpy/process.py +168 -0
- aicortexpy/procutil.py +61 -0
- aicortexpy/prompt.py +235 -0
- aicortexpy/repo.py +462 -0
- aicortexpy/runner.py +969 -0
- aicortexpy/runtime_config.py +540 -0
- aicortexpy/sandbox.py +264 -0
- aicortexpy/stream.py +422 -0
- aicortexpy/terminal.py +147 -0
- aicortexpy/tunnel.py +82 -0
- aicortexpy/wakeup.py +222 -0
- aicortexpy-0.1.0.dist-info/METADATA +106 -0
- aicortexpy-0.1.0.dist-info/RECORD +58 -0
- aicortexpy-0.1.0.dist-info/WHEEL +5 -0
- aicortexpy-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aicortex-cli-ops
|
|
3
|
+
description: >-
|
|
4
|
+
Manage AICortex agents, skills, and projects with the aicortex CLI.
|
|
5
|
+
Covers create/update, bind skills to agents, and create workspace skills
|
|
6
|
+
(default private). Use when the user mentions aicortex CLI, 上传 skill,
|
|
7
|
+
Agent 管理, or 项目管理.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# aicortex-cli-ops
|
|
11
|
+
|
|
12
|
+
用 **`aicortex` CLI** 管 Agent / Skill / 项目。不要直接改 Postgres。
|
|
13
|
+
|
|
14
|
+
新建 skill **默认 private**(仅当前工作空间)。
|
|
15
|
+
|
|
16
|
+
## 准备
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
aicortex auth status
|
|
20
|
+
aicortex config
|
|
21
|
+
aicortex workspace list
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- 已登录、`server_url` 指向当前云端、`workspace_id` 是目标空间。
|
|
25
|
+
- 换空间:`aicortex config set workspace_id <uuid>`
|
|
26
|
+
- 不确定参数:`aicortex <command> --help`
|
|
27
|
+
- 脚本输出:加 `--output json`
|
|
28
|
+
|
|
29
|
+
当前 PDC 示例:`server_url` = `https://app-portal-pdc1.envisioniot.com/aicortex-web`
|
|
30
|
+
|
|
31
|
+
## Agent
|
|
32
|
+
|
|
33
|
+
```powershell
|
|
34
|
+
aicortex runtime list --output json
|
|
35
|
+
aicortex agent list
|
|
36
|
+
aicortex agent get <id>
|
|
37
|
+
|
|
38
|
+
aicortex agent create --name "My Agent" --instructions "你是..." --runtime-id <runtime-uuid>
|
|
39
|
+
# 可选:--model "..." --visibility workspace --max-concurrent-tasks 6
|
|
40
|
+
# 从模板:--from-template code-reviewer
|
|
41
|
+
|
|
42
|
+
aicortex agent update <id> --instructions "..." --model "..."
|
|
43
|
+
aicortex agent archive <id>
|
|
44
|
+
aicortex agent restore <id>
|
|
45
|
+
|
|
46
|
+
aicortex agent skills list <agent-id>
|
|
47
|
+
aicortex agent skills set <agent-id> --skill-ids <skill-id-1,skill-id-2>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`agent create` 必须有 `--runtime-id`。`skills set` **整表替换**,要先 `skills list` 再带上要保留的 id。
|
|
51
|
+
|
|
52
|
+
Agent 的 `--visibility` 是 Agent 对工作空间是否可见(`private` / `workspace`),与 skill 无关。
|
|
53
|
+
|
|
54
|
+
## Skill
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
aicortex skill list
|
|
58
|
+
aicortex skill get <id>
|
|
59
|
+
aicortex skill create --name "my-skill" --description "何时使用..." --content "<完整 SKILL.md>"
|
|
60
|
+
aicortex skill update <id> --content "<完整 SKILL.md>" --description "..."
|
|
61
|
+
aicortex skill files upsert <skill-id> --path extra.md --content "..."
|
|
62
|
+
aicortex skill delete <id> --yes
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
规则:
|
|
66
|
+
|
|
67
|
+
- `name` 同空间唯一(小写、数字、连字符)。
|
|
68
|
+
- `content` 放完整 `SKILL.md`(含 YAML frontmatter)。
|
|
69
|
+
- `skill create` 默认 **private**。
|
|
70
|
+
- Windows 长正文不要用 PowerShell `--content "..."`,容易截断/乱码;把 SKILL.md 读入后再交给 CLI/API。
|
|
71
|
+
|
|
72
|
+
绑到 Agent:
|
|
73
|
+
|
|
74
|
+
```powershell
|
|
75
|
+
aicortex agent skills set <agent-id> --skill-ids <skill-id>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 项目
|
|
79
|
+
|
|
80
|
+
状态:`planned | in_progress | paused | completed | cancelled`
|
|
81
|
+
|
|
82
|
+
```powershell
|
|
83
|
+
aicortex project list
|
|
84
|
+
aicortex project get <id>
|
|
85
|
+
aicortex project create --title "项目名" --description "..." --prompt "给 Agent 的项目指令"
|
|
86
|
+
aicortex project update <id> --title "..." --status in_progress --prompt "..."
|
|
87
|
+
aicortex project status <id> in_progress
|
|
88
|
+
aicortex project resource add <project-id> --type github_repo --url https://github.com/org/repo
|
|
89
|
+
aicortex project resource list <project-id>
|
|
90
|
+
aicortex project delete <id>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Issue 挂到项目:`aicortex issue create --title "..." --project <project-id>`。
|
|
94
|
+
|
|
95
|
+
## 常见顺序
|
|
96
|
+
|
|
97
|
+
1. `runtime list` → `agent create`
|
|
98
|
+
2. 写 SKILL.md → `aicortex skill create`(默认 private)
|
|
99
|
+
3. `agent skills set` 绑到 Agent
|
|
100
|
+
4. `project create`,issue 带 `--project`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aicortex-graph
|
|
3
|
+
description: "Search and write workspace Knowledge collections bound to this Agent. Use for project documents when the user explicitly asks to save to 知识库. 「记住」is NOT this skill — use aicortex memory."
|
|
4
|
+
inclusion: always
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# aicortex-graph
|
|
8
|
+
|
|
9
|
+
工作区 **知识库**(团队可检索的资料)。和 **agent-memory** 是两个 skill。
|
|
10
|
+
|
|
11
|
+
- 检索:Agent 详情 **Knowledge** 勾选的库,用 `aicortex graph search`
|
|
12
|
+
- 写入:**仅当用户明确要求保存到知识库** 时才 `aicortex graph write`
|
|
13
|
+
- 「记住」、偏好、纠正 → **`aicortex memory`**,不要 `graph write`,不要写名叫 MEMORY 的库
|
|
14
|
+
|
|
15
|
+
不要用 `aicorkit graph remote login/use`。不要用本命令搜 Agent Memory(在 `.agent_context/memory.md`)。
|
|
16
|
+
|
|
17
|
+
## 命令
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
aicortex graph search "architecture"
|
|
21
|
+
aicortex graph search "API" --mode hybrid -n 10
|
|
22
|
+
aicortex graph fetch --chunk-ids "id1,id2"
|
|
23
|
+
aicortex graph walk "last week's decision" -n 5
|
|
24
|
+
aicortex graph collections
|
|
25
|
+
aicortex graph write --collection <slug-or-id> --title "api-auth-notes.md" --body-file ./note.md
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
不传 `--collection` 时,search 只搜已勾选的库。write 必须指定已勾选的库(只勾选一个时可省略)。没有勾选则没有命中、也不能写。
|
|
29
|
+
|
|
30
|
+
需要原文时先 search 再 `fetch`。Windows 长文本用 `--body-file`。
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: graphify
|
|
3
|
+
description: >-
|
|
4
|
+
Codebase AST knowledge graph for cheaper retrieval. Use when exploring
|
|
5
|
+
architecture, finding call paths, or answering code questions.
|
|
6
|
+
Run `graphify query` / `path` / `explain`. Install: `pip install graphifyy`
|
|
7
|
+
(https://github.com/Graphify-Labs/graphify).
|
|
8
|
+
inclusion: always
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# graphify
|
|
12
|
+
|
|
13
|
+
仓库**代码**知识图谱(AST)。先 `graphify query` / `path` / `explain`,再决定要不要 grep。
|
|
14
|
+
文档/邮件/会议用 **aicorkit-graph**;工作区知识库用 **aicortex-graph**。
|
|
15
|
+
|
|
16
|
+
上游:https://github.com/Graphify-Labs/graphify
|
|
17
|
+
PyPI 包名暂时是 **`graphifyy`**,CLI 仍是 **`graphify`**。
|
|
18
|
+
|
|
19
|
+
## Platform
|
|
20
|
+
|
|
21
|
+
Invoke `graphify` via Bash/PowerShell in the agent shell. On Windows prefer `python -m graphify` if `graphify` is not on PATH.
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Python 3.10+
|
|
26
|
+
- `pip install graphifyy`
|
|
27
|
+
- Test: `graphify --help`
|
|
28
|
+
- Windows:命令找不到时把 `%APPDATA%\Python\Python3xx\Scripts` 加进 PATH,或 `pipx install graphifyy`
|
|
29
|
+
- macOS / Linux(externally-managed):`pipx install graphifyy`,或 `pip install graphifyy --break-system-packages`
|
|
30
|
+
|
|
31
|
+
缺 CLI 再装,不要每次任务都重装。
|
|
32
|
+
|
|
33
|
+
## Storage
|
|
34
|
+
|
|
35
|
+
仓库根目录 `graphify-out/`(`graph.json`、`GRAPH_REPORT.md`、可选 `wiki/`)。不要把 `graphify-out/` 提交进 git。
|
|
36
|
+
|
|
37
|
+
## Keep the corpus small
|
|
38
|
+
|
|
39
|
+
大仓库全量扫描 / 频繁 update 很容易卡住或极慢。优先靠 **仓库根 `.graphifyignore`**(gitignore 语法)收窄语料:
|
|
40
|
+
|
|
41
|
+
- 排除静态资源、设计稿/示例页、生成物、文档、vendor、测试夹具等低价值目录
|
|
42
|
+
- `graphifyy` **对 JS/TS 不走 AST 缓存**:语料里若有大量前端文件,每次 `update` 都会重抽,成本很高。大 monorepo 可只索引后端/核心语言,或把前端树写进 ignore
|
|
43
|
+
- ignore 写法同 gitignore:**不要用** `{ts,tsx}` 花括号(不生效);扩展名分行写,例如 `*.ts` / `*.tsx`
|
|
44
|
+
- 改过 `.graphifyignore` 后:用 `graphify extract . --code-only --no-cluster` 全量重抽;普通 `update` 会对「仍在磁盘但已 ignore」的文件 fail-closed 保留旧节点
|
|
45
|
+
|
|
46
|
+
若仓库已有 `.graphifyignore`,以它为准;没有且 update 很慢时,再补一份再 extract。
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
| Command | Description |
|
|
51
|
+
|---------|-------------|
|
|
52
|
+
| `graphify query "<question>"` | 按问题取子图 |
|
|
53
|
+
| `graphify path "A" "B"` | 两个概念之间的最短路径 |
|
|
54
|
+
| `graphify explain "<concept>"` | 解释一个节点 |
|
|
55
|
+
| `graphify update . --no-cluster` | 在仓库根增量刷新(AST-only,跳过 community cluster) |
|
|
56
|
+
| `graphify extract . --code-only --no-cluster` | 全量重抽代码图谱(缺图或改 ignore 后用) |
|
|
57
|
+
| `graphify hook install` | 可选:post-commit 自动重建(只改 `.git/hooks`) |
|
|
58
|
+
|
|
59
|
+
不要默认 `--mode deep`(语义/LLM 抽取,耗 token)。
|
|
60
|
+
大仓避免无 `--no-cluster` 的全量 cluster。
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
checkout / 进入**仓库根**之后:
|
|
65
|
+
|
|
66
|
+
1. `graphify --help`,失败则 `pip install graphifyy`
|
|
67
|
+
2. 没有 `graphify-out/graph.json`:`graphify extract . --code-only --no-cluster`(或已有 ignore 时同样用这条建图)
|
|
68
|
+
3. 已有图谱:直接 query,**不要**每次任务全量重建
|
|
69
|
+
4. `.gitignore` 没有 `graphify-out/` 就补一行
|
|
70
|
+
|
|
71
|
+
查架构、调用关系、模块职责:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
graphify query "where is authentication handled?"
|
|
75
|
+
graphify query "request routing" --budget 1500
|
|
76
|
+
graphify path "Handler" "Repository"
|
|
77
|
+
graphify explain "main"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`graphify-out/wiki/index.md` 存在时顺着 wiki 走。`GRAPH_REPORT.md` 只在总览架构、或 query/path/explain 不够时再读。
|
|
81
|
+
|
|
82
|
+
### Update 纪律
|
|
83
|
+
|
|
84
|
+
- **默认不跑 update**。即使用 `--no-cluster`,合并写盘也可能很慢。
|
|
85
|
+
- 仅当本轮改了**图谱语料内**的代码、且后续还要靠图谱导航时:在仓库根执行 `graphify update . --no-cluster`
|
|
86
|
+
- 改动落在 ignore 之外(例如被排除的前端树)→ **跳过** update,直接读文件 / grep
|
|
87
|
+
- **禁止** `graphify update <subdir>`:会在子目录生成嵌套 `*/graphify-out/`,根目录 `query` 读不到
|
|
88
|
+
|
|
89
|
+
查询时若发现命中路径明显不在当前工作范围(例如全是静态页),说明语料过大或 ignore 未生效——先收窄 `.graphifyignore` 再 extract,不要靠反复全仓 update。
|
|
90
|
+
|
|
91
|
+
## Rules
|
|
92
|
+
|
|
93
|
+
1. 本 skill 已挂到 Agent 上 → 整场任务保持激活;语料内代码先图谱后 grep,语料外直接 grep。
|
|
94
|
+
2. **Read-only**(无需确认):`query` / `path` / `explain` / `--help`。
|
|
95
|
+
3. 缺图谱时的 `extract --code-only --no-cluster`、补 `.gitignore` / `.graphifyignore` 可直接做;`--mode deep` 仅当用户明确要求。
|
|
96
|
+
4. 不要提交 `graphify-out/`。
|
|
97
|
+
5. 文档/邮件检索走 **aicorkit-graph**;工作区知识库走 **aicortex-graph**。
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Interactive Question Forms
|
|
2
|
+
|
|
3
|
+
## When to use this skill
|
|
4
|
+
|
|
5
|
+
**When you need to ask the user more than one question, you MUST use a `<question-form>` block.** Never ask questions one at a time in prose — batch them into a single interactive form. The frontend renders these as tappable forms so users can answer by clicking instead of typing.
|
|
6
|
+
|
|
7
|
+
Use this skill for any multi-question scenario:
|
|
8
|
+
- Gathering personal info (name, preferences, background)
|
|
9
|
+
- Collecting project requirements (platform, audience, features)
|
|
10
|
+
- Design preferences (style, colors, mood)
|
|
11
|
+
- Feedback collection (ratings, comments, suggestions)
|
|
12
|
+
- Configuration setup (settings, options, parameters)
|
|
13
|
+
- Any situation where the user needs to provide multiple pieces of information
|
|
14
|
+
|
|
15
|
+
## Format
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<question-form id="unique-id" title="What you're asking about">
|
|
19
|
+
{
|
|
20
|
+
"questions": [
|
|
21
|
+
// ... question objects ...
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
</question-form>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The `id` and `title` can be set as attributes on the opening tag OR as keys in the JSON body. `title` is shown to the user as the form heading. `description` (optional, in JSON body) appears as a subtitle.
|
|
28
|
+
|
|
29
|
+
Use `id` values that are short, descriptive, and unique within the form (e.g. "name", "platform", "audience").
|
|
30
|
+
|
|
31
|
+
## Supported question types
|
|
32
|
+
|
|
33
|
+
### radio — single choice
|
|
34
|
+
```json
|
|
35
|
+
{"id": "platform", "label": "What platform?", "type": "radio",
|
|
36
|
+
"options": ["Mobile (iOS/Android)", "Desktop web", "Responsive"],
|
|
37
|
+
"required": true}
|
|
38
|
+
```
|
|
39
|
+
Aliases: `single`, `choice`. Renders as chip-style selectable buttons. Exactly one can be picked.
|
|
40
|
+
|
|
41
|
+
### checkbox — multiple choice
|
|
42
|
+
```json
|
|
43
|
+
{"id": "features", "label": "Must-have features?", "type": "checkbox",
|
|
44
|
+
"options": ["Authentication", "Payments", "Search", "Notifications"],
|
|
45
|
+
"maxSelections": 3}
|
|
46
|
+
```
|
|
47
|
+
Aliases: `multi`, `multiple`. Renders as chip-style toggle buttons. Use `maxSelections` to cap how many the user can pick.
|
|
48
|
+
|
|
49
|
+
### select — dropdown menu
|
|
50
|
+
```json
|
|
51
|
+
{"id": "style", "label": "Visual style?", "type": "select",
|
|
52
|
+
"options": ["Minimal", "Bold", "Classic", "Playful"]}
|
|
53
|
+
```
|
|
54
|
+
Alias: `dropdown`. Renders as a native dropdown. Good for lists of 5+ options.
|
|
55
|
+
|
|
56
|
+
### text — single line input
|
|
57
|
+
```json
|
|
58
|
+
{"id": "name", "label": "Your name?", "type": "text",
|
|
59
|
+
"placeholder": "e.g. Zhang San"}
|
|
60
|
+
```
|
|
61
|
+
Renders as a single-line text input.
|
|
62
|
+
|
|
63
|
+
### textarea — multi-line input
|
|
64
|
+
```json
|
|
65
|
+
{"id": "requirements", "label": "Additional requirements?", "type": "textarea",
|
|
66
|
+
"placeholder": "Describe any specific needs..."}
|
|
67
|
+
```
|
|
68
|
+
Aliases: `long`, `paragraph`. Renders as a resizable multi-line text area.
|
|
69
|
+
|
|
70
|
+
## Option formats
|
|
71
|
+
|
|
72
|
+
Options can be simple strings or objects:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
// Simple strings
|
|
76
|
+
"options": ["Mobile", "Desktop", "Responsive"]
|
|
77
|
+
|
|
78
|
+
// Objects with descriptions
|
|
79
|
+
"options": [
|
|
80
|
+
{"label": "Mobile", "value": "mobile", "description": "iOS and Android apps"},
|
|
81
|
+
{"label": "Desktop", "value": "desktop", "description": "Web browser on desktop"}
|
|
82
|
+
]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
When using objects:
|
|
86
|
+
- `label` — shown to the user (required)
|
|
87
|
+
- `value` — sent back in the answer (defaults to label if omitted)
|
|
88
|
+
- `description` — shown as a subtitle below the label (optional)
|
|
89
|
+
|
|
90
|
+
## Other field properties
|
|
91
|
+
|
|
92
|
+
- `required: true` — user must answer before submitting
|
|
93
|
+
- `placeholder: "..."` — shown when the field is empty (text/textarea only)
|
|
94
|
+
- `help: "..."` — hint text shown below the label
|
|
95
|
+
- `defaultValue: "..."` — pre-filled value (also accepts `default` as alias)
|
|
96
|
+
|
|
97
|
+
## How answers come back
|
|
98
|
+
|
|
99
|
+
When the user submits the form, you'll receive a message like:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
[form answers — discovery]
|
|
103
|
+
- Platform: Mobile (iOS/Android)
|
|
104
|
+
- Name: Zhang San
|
|
105
|
+
- Features: Auth, Payments
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Read this message to understand the user's answers, then continue the conversation.
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
### Example 1: Gathering user info
|
|
113
|
+
```html
|
|
114
|
+
<question-form id="user-info" title="Tell me about yourself">
|
|
115
|
+
{
|
|
116
|
+
"questions": [
|
|
117
|
+
{"id": "name", "label": "Your name", "type": "text", "required": true},
|
|
118
|
+
{"id": "gender", "label": "Gender", "type": "radio",
|
|
119
|
+
"options": ["Male", "Female", "Other"], "required": true},
|
|
120
|
+
{"id": "goal", "label": "What do you want to build?", "type": "textarea",
|
|
121
|
+
"placeholder": "Describe your goal or project..."}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
</question-form>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Example 2: Project requirements
|
|
128
|
+
```html
|
|
129
|
+
<question-form id="project-brief" title="Project requirements">
|
|
130
|
+
{
|
|
131
|
+
"description": "Help me understand what you need so I can build it right.",
|
|
132
|
+
"questions": [
|
|
133
|
+
{"id": "type", "label": "Project type", "type": "radio",
|
|
134
|
+
"options": ["Landing page", "Web app", "Mobile app", "API", "Other"],
|
|
135
|
+
"required": true},
|
|
136
|
+
{"id": "platform", "label": "Target platform", "type": "checkbox",
|
|
137
|
+
"options": ["Web", "iOS", "Android", "Desktop"], "maxSelections": 3},
|
|
138
|
+
{"id": "deadline", "label": "When do you need this?", "type": "text",
|
|
139
|
+
"placeholder": "e.g. Next week, End of month"},
|
|
140
|
+
{"id": "budget", "label": "Budget or constraints?", "type": "select",
|
|
141
|
+
"options": ["No limit", "Under $100", "$100-$500", "$500+", "Just exploring"]},
|
|
142
|
+
{"id": "details", "label": "Any other details?", "type": "textarea",
|
|
143
|
+
"placeholder": "Links, references, specific requirements..."}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
</question-form>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Example 3: Simple survey
|
|
150
|
+
```html
|
|
151
|
+
<question-form id="feedback">
|
|
152
|
+
{
|
|
153
|
+
"title": "Quick feedback",
|
|
154
|
+
"questions": [
|
|
155
|
+
{"id": "satisfaction", "label": "How satisfied are you?", "type": "radio",
|
|
156
|
+
"options": ["Very satisfied", "Satisfied", "Neutral", "Unsatisfied"],
|
|
157
|
+
"required": true},
|
|
158
|
+
{"id": "comments", "label": "Any comments?", "type": "textarea"}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
</question-form>
|
|
162
|
+
```
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-report-generator
|
|
3
|
+
description: >-
|
|
4
|
+
生成规范的软件功能测试文档:Word(.docx)测试报告 + Excel(.xlsx)测试用例清单。
|
|
5
|
+
含完整文档结构规范、字段定义和可直接运行的 Python 生成脚本(python-docx + openpyxl)。
|
|
6
|
+
Use when the user mentions 生成测试报告、编写测试用例、输出测试文档、or 测试总结.
|
|
7
|
+
inclusion: always
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 测试文档生成技能(Test Report Generator)
|
|
11
|
+
|
|
12
|
+
本技能用于指导 AGENT 生成两类交付物,二者配套使用:
|
|
13
|
+
|
|
14
|
+
1. **Word 测试报告(.docx)** —— 面向管理者/客户的总结性报告,说明测试目的、范围、环境、执行结果、缺陷统计与结论。
|
|
15
|
+
2. **Excel 测试用例清单(.xlsx)** —— 面向测试执行的详细用例明细,按功能模块分 Sheet 组织。
|
|
16
|
+
|
|
17
|
+
本技能的结构规范提炼自真实交付样例《天合户储云管理平台-P2功能测试报告》,请严格遵循下述结构与字段。
|
|
18
|
+
|
|
19
|
+
**执行用例(页面/交互验收)不在本技能范围内**:按 Excel 跑测、用宿主机 Chrome CDP 验页面、修缺陷并回写结果,改用工作区技能 `aicortex-bridge-cdp`。本技能只负责用例/报告的**文档结构与生成**。
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 何时使用本技能
|
|
24
|
+
|
|
25
|
+
命中以下任一意图时启用:
|
|
26
|
+
|
|
27
|
+
- "生成/编写测试报告"、"输出测试文档"、"测试总结报告"
|
|
28
|
+
- "编写测试用例"、"整理测试用例清单"、"用例明细表"
|
|
29
|
+
- 需求测试完成后需要交付测试文档
|
|
30
|
+
- 用户提供了功能清单/缺陷数据,要求整理成规范测试交付物
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 环境准备
|
|
35
|
+
|
|
36
|
+
生成脚本依赖两个 Python 库:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install python-docx openpyxl
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- `python-docx`:生成 Word(.docx)
|
|
43
|
+
- `openpyxl`:生成 Excel(.xlsx)
|
|
44
|
+
|
|
45
|
+
Windows / PowerShell 下用 `;` 串联命令,不要用 `&&`。脚本内已用 UTF-8,无需额外配置。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 一、Word 测试报告结构规范
|
|
50
|
+
|
|
51
|
+
报告采用固定章节结构。**除非用户明确要求增减,务必保留全部章节。** 章节与内容如下:
|
|
52
|
+
|
|
53
|
+
### 封面(首页)
|
|
54
|
+
居中依次排列:
|
|
55
|
+
- 平台/系统名称(如:`天合户储云管理平台`)
|
|
56
|
+
- 测试阶段(如:`P2阶段`)
|
|
57
|
+
- `测试报告`(大标题)
|
|
58
|
+
- 编制单位(如:`远景智能科技有限公司`)
|
|
59
|
+
- 报告日期(如:`2024年07月08日`)
|
|
60
|
+
|
|
61
|
+
### 文档修订信息(表格)
|
|
62
|
+
| 版本 | 修改内容描述 | 修改人 | 日期 | 审批人 |
|
|
63
|
+
|---|---|---|---|---|
|
|
64
|
+
| V1.0 | 初始编制 | 张三 | 2024/7/08 | 李四 |
|
|
65
|
+
|
|
66
|
+
### 目录
|
|
67
|
+
自动/占位目录,列出以下三级标题。
|
|
68
|
+
|
|
69
|
+
### 1. 概述
|
|
70
|
+
- **1.1 测试目的**:一段话说明本次测试针对的项目、环境、验证目标(新增功能 + 原有功能回归)。
|
|
71
|
+
- **1.2 测试范围**:用表格列出被测模块及核心功能。
|
|
72
|
+
| # | 模块 | 核心功能 |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| 1 | 三方登录和绑定 | 绑定三方账号 / 使用三方账号登录 / 解绑三方账号 |
|
|
75
|
+
- **1.3 参考资料**:项目符号列表,列出依赖文档(产品规格说明书、测试计划等)。
|
|
76
|
+
|
|
77
|
+
### 2. 测试内容
|
|
78
|
+
- **2.1 测试版本**:被测软件版本表。
|
|
79
|
+
| 软件名称及组织 | 软件版本 |
|
|
80
|
+
|---|---|
|
|
81
|
+
| 前端 | tag_1.0.8_xxx_2024070401 |
|
|
82
|
+
| 后端 | tag_1.2.8_240708 |
|
|
83
|
+
- **2.2 测试环境**:包含三张表:
|
|
84
|
+
- 环境地址表:`环境 | 地址`(功能测试 / 集成测试 / 设备集成等)
|
|
85
|
+
- 移动端机型表:`系统 | 型号 | 版本`(iOS / Android / HarmonyOS)
|
|
86
|
+
- Web 端浏览器表:`浏览器 | 版本`
|
|
87
|
+
- **2.3 测试执行**:
|
|
88
|
+
- **2.3.1 功能测试及结果**:`# | 模块 | 核心功能 | 测试结果`,测试结果取值 `Pass / Fail`。
|
|
89
|
+
- **2.3.2 集成测试及结果**:`ID | 所属模块 | 核心测试点 | 测试结果`。
|
|
90
|
+
- **2.3.3 详细测试用例**:一段说明,指向配套的 Excel 用例清单("详细测试用例见附件 Excel《xxx测试用例.xlsx》")。
|
|
91
|
+
|
|
92
|
+
### 3. 测试结论
|
|
93
|
+
- **3.1 测试结果**:
|
|
94
|
+
- 首行给出结论:`测试通过。` 或 `测试不通过。`
|
|
95
|
+
- 一段过程描述:执行了几轮功能/集成/回归测试、共执行多少用例、发现多少缺陷、修复率、是否达到上线标准。
|
|
96
|
+
- **缺陷统计表**:
|
|
97
|
+
| 问题总数 | 严重问题数 | 中等问题数 | 较轻问题 | 未解决问题数 | 问题解决率 | 严重问题比率 |
|
|
98
|
+
|---|---|---|---|---|---|---|
|
|
99
|
+
| 110 | 8 | 65 | 37 | 2 | 98% | 7% |
|
|
100
|
+
- **3.2 遗留问题列表**:
|
|
101
|
+
| 模块 | 问题描述 | 说明 |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| 建站管理 | 使用欧洲地址建站时时区显示错误 | 下一版本修复 |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 二、Excel 测试用例结构规范
|
|
108
|
+
|
|
109
|
+
### Sheet 组织
|
|
110
|
+
- **一个功能模块对应一个 Sheet**,Sheet 名即模块名(如 `三方登录注册和绑定`、`电价设置`、`消息中心`)。
|
|
111
|
+
- 用例数量多时按功能维度拆分 Sheet,保持每个 Sheet 聚焦单一模块。
|
|
112
|
+
|
|
113
|
+
### 列定义(标准 8 列,可选第 9 列责任人)
|
|
114
|
+
| 列 | 字段 | 说明 |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| A | ID | 用例唯一编号(数字或字符串)。多步骤用例仅首行填 ID,后续步骤行留空 |
|
|
117
|
+
| B | 用例名称 | 简短标题,描述测试点 |
|
|
118
|
+
| C | 所属模块 | **路径式层级**,如 `/0630需求/三方登录/APP端/账号登录/正常场景` |
|
|
119
|
+
| D | 前置条件 | 执行前需满足的条件,可为空 |
|
|
120
|
+
| E | 备注 | 补充说明,可为空 |
|
|
121
|
+
| F | 步骤描述 | 操作步骤;多步骤用 `1. … / 2. …` 或分行 |
|
|
122
|
+
| G | 预期结果 | 与步骤一一对应的预期 |
|
|
123
|
+
| H | 用例等级 | `P0`(冒烟/核心)/ `P1`(重要)/ `P2`(一般)/ `P3`(边缘) |
|
|
124
|
+
| I | 责任人(ID) | 可选,执行人标识 |
|
|
125
|
+
|
|
126
|
+
### 关键约定
|
|
127
|
+
- **表头行冻结、加粗、加背景色**,正文自动换行、顶端对齐。
|
|
128
|
+
- **多步骤用例**:一个用例含多组"步骤→预期"时,第一行填完整信息,后续每组步骤/预期各占一行,ID、用例名称、所属模块、前置条件列留空(表示延续上一用例)。
|
|
129
|
+
- **所属模块务必用 `/` 分隔的路径**表达功能层级,便于筛选与追溯。
|
|
130
|
+
- **用例等级必须落在 P0–P3**,缺省按 P1 处理。
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 三、生成脚本
|
|
135
|
+
|
|
136
|
+
本技能附带 `scripts/generate_report.py` 与 `scripts/generate_cases.py`,会随 skill 下发到 Agent 工作目录。
|
|
137
|
+
|
|
138
|
+
常见路径(按 runtime 取已存在的那个):
|
|
139
|
+
|
|
140
|
+
- Cursor:`.cursor/skills/test-report-generator/scripts/`
|
|
141
|
+
- 默认:`.agent_context/skills/test-report-generator/scripts/`
|
|
142
|
+
- Claude:`.claude/skills/test-report-generator/scripts/`
|
|
143
|
+
|
|
144
|
+
**推荐做法**:根据用户数据改脚本顶部的 `SAMPLE_DATA` / `SAMPLE_MODULES`(或调用 `build_report` / `build_workbook`),再运行脚本。
|
|
145
|
+
|
|
146
|
+
### 生成 Word 报告
|
|
147
|
+
|
|
148
|
+
```powershell
|
|
149
|
+
python ".cursor/skills/test-report-generator/scripts/generate_report.py" --output "功能测试报告.docx"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 生成 Excel 用例清单
|
|
153
|
+
|
|
154
|
+
```powershell
|
|
155
|
+
python ".cursor/skills/test-report-generator/scripts/generate_cases.py" --output "测试用例.xlsx"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Linux / aicortexpod 用同样相对路径,命令用 bash。
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 四、AGENT 工作流
|
|
163
|
+
|
|
164
|
+
1. **确认交付物**:明确用户要 Word 报告、Excel 用例,还是两者都要。
|
|
165
|
+
2. **收集数据**:向用户索取或从项目上下文提取——系统名称、测试阶段、模块清单、环境信息、版本号、执行结果、缺陷统计、遗留问题;用例则需模块 + 每条用例的名称/步骤/预期/等级。
|
|
166
|
+
3. **信息缺失时**:使用合理占位(如 `待补充`、`TBD`)并在回复中明确列出需要用户补充的字段,不要臆造缺陷数量、修复率等关键结论性数据。
|
|
167
|
+
4. **构造数据结构**:把数据填入脚本的 `data` / `modules`。
|
|
168
|
+
5. **运行脚本生成文件**,并校验:文件能被 python-docx / openpyxl 正常打开、表格行列数正确、无空 Sheet。
|
|
169
|
+
6. **交付**:告知文件路径,并列出使用了占位符、需人工复核的部分。
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 五、注意事项
|
|
174
|
+
|
|
175
|
+
- 测试结论中的**缺陷统计、修复率、是否达到上线标准**属于关键判断,必须来自真实数据,禁止编造。
|
|
176
|
+
- 生成后务必人工复核,尤其是缺陷数据与测试结论。
|
|
177
|
+
- 中文内容全程使用 UTF-8;文件名可含中文。
|
|
178
|
+
- 若用户提供了自有模板(.docx/.xlsx),优先按其模板的样式与字段调整,本规范作为兜底结构。
|
|
179
|
+
- 用户要求「完成测试 / CDP 验收 / 按用例测试并修复」时:先读并遵循 `aicortex-bridge-cdp`,再用本技能出 Word(若需要)。
|