@josephyan/qingflow-app-builder-mcp 0.2.0-beta.2 → 0.2.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/README.md +11 -2
- package/npm/lib/runtime.mjs +37 -0
- package/npm/scripts/postinstall.mjs +5 -1
- package/package.json +3 -2
- package/pyproject.toml +1 -1
- package/skills/qingflow-app-builder/SKILL.md +225 -0
- package/skills/qingflow-app-builder/agents/openai.yaml +4 -0
- package/skills/qingflow-app-builder/references/create-app.md +148 -0
- package/skills/qingflow-app-builder/references/environments.md +63 -0
- package/skills/qingflow-app-builder/references/flow-actors-and-permissions.md +124 -0
- package/skills/qingflow-app-builder/references/gotchas.md +64 -0
- package/skills/qingflow-app-builder/references/solution-playbooks.md +58 -0
- package/skills/qingflow-app-builder/references/tool-selection.md +96 -0
- package/skills/qingflow-app-builder/references/update-flow.md +233 -0
- package/skills/qingflow-app-builder/references/update-layout.md +91 -0
- package/skills/qingflow-app-builder/references/update-schema.md +90 -0
- package/skills/qingflow-app-builder/references/update-views.md +184 -0
- package/src/qingflow_mcp/__init__.py +1 -1
- package/src/qingflow_mcp/builder_facade/models.py +294 -1
- package/src/qingflow_mcp/builder_facade/service.py +2727 -235
- package/src/qingflow_mcp/server.py +7 -5
- package/src/qingflow_mcp/server_app_builder.py +80 -4
- package/src/qingflow_mcp/server_app_user.py +8 -182
- package/src/qingflow_mcp/solution/compiler/form_compiler.py +1 -1
- package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +21 -2
- package/src/qingflow_mcp/solution/executor.py +34 -7
- package/src/qingflow_mcp/tools/ai_builder_tools.py +1038 -30
- package/src/qingflow_mcp/tools/app_tools.py +1 -2
- package/src/qingflow_mcp/tools/approval_tools.py +357 -75
- package/src/qingflow_mcp/tools/directory_tools.py +158 -28
- package/src/qingflow_mcp/tools/record_tools.py +1954 -973
- package/src/qingflow_mcp/tools/task_tools.py +376 -225
- package/src/qingflow_mcp/tools/workflow_tools.py +78 -4
package/README.md
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Install:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @josephyan/qingflow-app-builder-mcp@0.2.0-beta.
|
|
6
|
+
npm install @josephyan/qingflow-app-builder-mcp@0.2.0-beta.21
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Run:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx -y -p @josephyan/qingflow-app-builder-mcp@0.2.0-beta.
|
|
12
|
+
npx -y -p @josephyan/qingflow-app-builder-mcp@0.2.0-beta.21 qingflow-app-builder-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Environment:
|
|
@@ -19,3 +19,12 @@ Environment:
|
|
|
19
19
|
- `QINGFLOW_MCP_HOME`
|
|
20
20
|
|
|
21
21
|
This package bootstraps a local Python runtime on first install and then starts the `qingflow-app-builder-mcp` stdio MCP server.
|
|
22
|
+
|
|
23
|
+
Bundled skills:
|
|
24
|
+
|
|
25
|
+
- `skills/qingflow-app-builder`
|
|
26
|
+
|
|
27
|
+
Note:
|
|
28
|
+
|
|
29
|
+
- The skill files are included in the npm package.
|
|
30
|
+
- On install, the package copies them to `$CODEX_HOME/skills` (or `~/.codex/skills` if `CODEX_HOME` is unset).
|
package/npm/lib/runtime.mjs
CHANGED
|
@@ -29,6 +29,43 @@ export function getPackageRoot(metaUrl) {
|
|
|
29
29
|
return path.resolve(path.dirname(fileURLToPath(metaUrl)), "..", "..");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export function getCodexHome() {
|
|
33
|
+
const configured = process.env.CODEX_HOME?.trim();
|
|
34
|
+
if (configured) {
|
|
35
|
+
return path.resolve(configured);
|
|
36
|
+
}
|
|
37
|
+
const home = process.env.HOME || process.env.USERPROFILE;
|
|
38
|
+
if (!home) {
|
|
39
|
+
throw new Error("Cannot resolve CODEX_HOME because HOME is not set.");
|
|
40
|
+
}
|
|
41
|
+
return path.join(home, ".codex");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function installBundledSkills(packageRoot) {
|
|
45
|
+
const skillsSrc = path.join(packageRoot, "skills");
|
|
46
|
+
if (!fs.existsSync(skillsSrc)) {
|
|
47
|
+
return { installed: [], skipped: true, destination: null };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const codexHome = getCodexHome();
|
|
51
|
+
const skillsDestRoot = path.join(codexHome, "skills");
|
|
52
|
+
fs.mkdirSync(skillsDestRoot, { recursive: true });
|
|
53
|
+
|
|
54
|
+
const installed = [];
|
|
55
|
+
for (const entry of fs.readdirSync(skillsSrc, { withFileTypes: true })) {
|
|
56
|
+
if (!entry.isDirectory()) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const src = path.join(skillsSrc, entry.name);
|
|
60
|
+
const dest = path.join(skillsDestRoot, entry.name);
|
|
61
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
62
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
63
|
+
installed.push(entry.name);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return { installed, skipped: false, destination: skillsDestRoot };
|
|
67
|
+
}
|
|
68
|
+
|
|
32
69
|
export function getVenvDir(packageRoot) {
|
|
33
70
|
return path.join(packageRoot, ".npm-python");
|
|
34
71
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ensurePythonEnv, getPackageRoot } from "../lib/runtime.mjs";
|
|
1
|
+
import { ensurePythonEnv, getPackageRoot, installBundledSkills } from "../lib/runtime.mjs";
|
|
2
2
|
|
|
3
3
|
const packageRoot = getPackageRoot(import.meta.url);
|
|
4
4
|
|
|
@@ -6,6 +6,10 @@ try {
|
|
|
6
6
|
console.log("[qingflow-mcp] Bootstrapping Python runtime...");
|
|
7
7
|
ensurePythonEnv(packageRoot, { commandName: "qingflow-app-builder-mcp" });
|
|
8
8
|
console.log("[qingflow-mcp] Python runtime is ready.");
|
|
9
|
+
const skills = installBundledSkills(packageRoot);
|
|
10
|
+
if (!skills.skipped) {
|
|
11
|
+
console.log(`[qingflow-mcp] Installed skills to ${skills.destination}: ${skills.installed.join(", ")}`);
|
|
12
|
+
}
|
|
9
13
|
} catch (error) {
|
|
10
14
|
console.error(`[qingflow-mcp] postinstall failed: ${error.message}`);
|
|
11
15
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@josephyan/qingflow-app-builder-mcp",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.21",
|
|
4
4
|
"description": "Builder MCP for Qingflow app/package/system design and staged solution workflows.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"src/qingflow_mcp/py.typed",
|
|
19
19
|
"qingflow-app-builder-mcp",
|
|
20
20
|
"npm/",
|
|
21
|
-
"docs/local-agent-install.md"
|
|
21
|
+
"docs/local-agent-install.md",
|
|
22
|
+
"skills/"
|
|
22
23
|
],
|
|
23
24
|
"engines": {
|
|
24
25
|
"node": ">=16.16.0"
|
package/pyproject.toml
CHANGED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qingflow-app-builder
|
|
3
|
+
description: Build, configure, and modify Qingflow apps and systems after the MCP is already connected and authenticated. Use when the user wants to apply or repair an existing SolutionSpec, modify an existing package with app, view, workflow, portal, navigation, or reporting tools, verify builder-side results, or troubleshoot system-building behavior. Do not use this skill to install the MCP or to author a brand new SolutionSpec from scratch.
|
|
4
|
+
metadata:
|
|
5
|
+
short-description: Build and modify Qingflow apps and systems
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Qingflow App Builder
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
This skill helps a system builder use the AI-native Qingflow builder surface safely. It assumes the MCP is already connected and authenticated. If not, switch to `$qingflow-mcp-setup` first.
|
|
13
|
+
|
|
14
|
+
Before any write or verification flow, identify whether the task targets `test` or `prod` and read [references/environments.md](references/environments.md). If the user did not specify one, default to `prod`.
|
|
15
|
+
|
|
16
|
+
## Tool Selection
|
|
17
|
+
|
|
18
|
+
Pick the smallest tool layer that can finish the task.
|
|
19
|
+
|
|
20
|
+
## Mental Model
|
|
21
|
+
|
|
22
|
+
Model builder requests in four layers. Do not flatten them.
|
|
23
|
+
|
|
24
|
+
- `package`: the solution container or app bundle, for example “研发项目管理” or “费控管理系统”
|
|
25
|
+
- `app`: one form/app inside that package, for example “项目”, “需求”, “任务”, “缺陷”, “团队”
|
|
26
|
+
- `field`: one field inside one app
|
|
27
|
+
- `relation`: a field that links one app to another app
|
|
28
|
+
|
|
29
|
+
Interpret user intent with this hierarchy:
|
|
30
|
+
|
|
31
|
+
- If the user says “应用包”, “系统”, “包含多个表单”, “多个模块”, or asks for several named forms that relate to each other, treat it as a `package` with multiple `apps`
|
|
32
|
+
- Do not compress a multi-app system into one app with several text fields
|
|
33
|
+
- Names like “项目/需求/任务/缺陷/团队” or “费用申请/预算管理/报销审批” are usually separate apps, not text fields
|
|
34
|
+
- Build the apps first, then add `relation` fields to connect them
|
|
35
|
+
|
|
36
|
+
Default modeling rules:
|
|
37
|
+
|
|
38
|
+
- One business object -> one app
|
|
39
|
+
- Attributes of that object -> fields inside that app
|
|
40
|
+
- Another business object -> a separate app, not a text field
|
|
41
|
+
- Cross-object links -> relation fields, not text fields
|
|
42
|
+
|
|
43
|
+
- Authentication and workspace: `auth_*`, `workspace_*`
|
|
44
|
+
- File upload: `file_upload_local`
|
|
45
|
+
- Resource resolve/read: `package_list`, `package_resolve`, `package_create`, `builder_tool_contract`, `member_search`, `role_search`, `app_resolve`, `app_read_summary`, `app_read_fields`, `app_read_layout_summary`, `app_read_views_summary`, `app_read_flow_summary`
|
|
46
|
+
- Resource plan: `app_schema_plan`, `app_layout_plan`, `app_flow_plan`, `app_views_plan`
|
|
47
|
+
- Resource patch: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `package_attach_app`, `app_release_edit_lock_if_mine`, `role_create`
|
|
48
|
+
- Publish and verify: `app_publish_verify`
|
|
49
|
+
|
|
50
|
+
Note:
|
|
51
|
+
- Do not try to handcraft raw Qingflow schema or internal solution payloads.
|
|
52
|
+
- Do not rely on low-level `view_*`, `workflow_*`, or `qingbi_report_*` write payloads from public builder flows.
|
|
53
|
+
- Public builder work should stay on the resource path: `resolve -> summary read -> plan -> apply -> attach -> publish_verify`.
|
|
54
|
+
- `app_schema_apply` / `app_layout_apply` / `app_flow_apply` / `app_views_apply` publish by default; pass `publish=false` only when you intentionally want to leave changes in draft.
|
|
55
|
+
- If you are unsure about a public builder tool's keys, aliases, presets, or minimal legal shape, call `builder_tool_contract` instead of guessing.
|
|
56
|
+
- For views, always write the canonical key `columns`. Do not emit `column_names`; treat `fields` only as a tolerated legacy alias, not the preferred shape.
|
|
57
|
+
- For flow presets, map natural language to canonical values before calling MCP:
|
|
58
|
+
- “默认审批/基础审批/普通审批” -> `basic_approval`
|
|
59
|
+
- “先填报再审批/提交后审批” -> `basic_fill_then_approve`
|
|
60
|
+
- For first-time flow or view work in a session, read `builder_tool_contract` before planning so keys, aliases, presets, and minimal examples come from MCP instead of memory.
|
|
61
|
+
- For workflow assignees, prefer roles over explicit members:
|
|
62
|
+
- use `role_search` first
|
|
63
|
+
- use `member_search` only when the user explicitly names members or no stable role exists
|
|
64
|
+
- use `role_create` when the business owner wants a reusable directory role instead of hard-coded members
|
|
65
|
+
- On any `VALIDATION_ERROR`, inspect `suggested_next_call` first and prefer reusing the MCP-normalized arguments over re-guessing from the original natural language.
|
|
66
|
+
|
|
67
|
+
Default policy:
|
|
68
|
+
|
|
69
|
+
- Creating or updating one app inside an existing package: resolve the package/app, read compact state, plan patches on the server, then apply schema/layout/flow/views patches explicitly.
|
|
70
|
+
- If package creation looks necessary or beneficial, ask the user to confirm before calling `package_create`.
|
|
71
|
+
- If the user describes a system/package with multiple forms or modules, do not start with `app_schema_apply` on the package name. Resolve or create the package first, then create each app separately.
|
|
72
|
+
|
|
73
|
+
## Standard Operating Order
|
|
74
|
+
|
|
75
|
+
Before any business tool:
|
|
76
|
+
|
|
77
|
+
1. Ensure auth exists
|
|
78
|
+
2. Ensure workspace is selected
|
|
79
|
+
3. Confirm whether the task is read-only or write-impacting
|
|
80
|
+
|
|
81
|
+
For builder work:
|
|
82
|
+
|
|
83
|
+
1. Resolve the target package with `package_resolve`; if resolution is ambiguous or you need a read-only fallback, use `package_list`. If you believe a new package should be created, ask the user to confirm before calling `package_create`.
|
|
84
|
+
2. Decide whether the target is one app or a multi-app package:
|
|
85
|
+
- one app: continue with `app_resolve`
|
|
86
|
+
- multi-app package/system: create or resolve the package, then create each app separately before adding relations
|
|
87
|
+
3. Resolve the target app with `app_resolve` if the request is an update.
|
|
88
|
+
4. Read only the smallest summary you need: `app_read_summary`, `app_read_fields`, `app_read_layout_summary`, `app_read_views_summary`, `app_read_flow_summary`.
|
|
89
|
+
5. Use `app_schema_plan`, `app_layout_plan`, `app_flow_plan`, or `app_views_plan` before any non-trivial write.
|
|
90
|
+
6. Use `app_schema_apply` for create/upsert/remove field work. It publishes by default after the patch lands.
|
|
91
|
+
7. If the app must belong to a package, use `package_attach_app` explicitly after schema work unless readback already shows the target `tag_id`.
|
|
92
|
+
8. Use `app_layout_apply` only when the user is explicitly changing layout. Prefer the default `mode=merge`; use `mode=replace` only when you intend to place every field explicitly. It publishes by default.
|
|
93
|
+
9. Use `app_flow_apply` after schema exists. It publishes by default.
|
|
94
|
+
10. Use `app_views_apply` when the user wants explicit table/card/board/gantt views. It publishes by default.
|
|
95
|
+
11. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need an explicit verification pass.
|
|
96
|
+
12. If a write fails with `APP_EDIT_LOCKED`, stop normal writes. Only use `app_release_edit_lock_if_mine` when the failed result shows the lock owner is the current logged-in user.
|
|
97
|
+
|
|
98
|
+
For view work, keep the order strict:
|
|
99
|
+
|
|
100
|
+
1. `builder_tool_contract`
|
|
101
|
+
2. `app_read_fields`
|
|
102
|
+
3. `app_read_views_summary`
|
|
103
|
+
4. `app_views_plan`
|
|
104
|
+
5. `app_views_apply`
|
|
105
|
+
6. `app_read_views_summary` again whenever `app_views_apply` returns `failed` or `partial_success`
|
|
106
|
+
|
|
107
|
+
For flow work, keep the order strict:
|
|
108
|
+
|
|
109
|
+
1. `builder_tool_contract`
|
|
110
|
+
2. `app_read_fields`
|
|
111
|
+
3. `app_read_flow_summary`
|
|
112
|
+
4. `role_search` or `member_search` if assignees need to come from the directory
|
|
113
|
+
5. `role_create` if the user wants a reusable role and no suitable role exists yet
|
|
114
|
+
6. Start from a canonical preset when possible
|
|
115
|
+
7. Use patch-style edits to that skeleton instead of freehand full-graph generation
|
|
116
|
+
8. When patching a preset skeleton, reuse the preset node ids:
|
|
117
|
+
- `basic_approval` -> patch `approve_1`
|
|
118
|
+
- `basic_fill_then_approve` -> patch `fill_1` and `approve_1`
|
|
119
|
+
Do not invent a second approval/fill node id unless you are intentionally replacing the skeleton and removing the preset node.
|
|
120
|
+
9. Declare approver/fill/copy assignees explicitly:
|
|
121
|
+
- prefer `assignees.role_names`
|
|
122
|
+
- support `assignees.member_names` / `assignees.member_emails` / `assignees.member_uids`
|
|
123
|
+
10. When a node must edit specific fields, declare `permissions.editable_fields`
|
|
124
|
+
11. `app_flow_plan`
|
|
125
|
+
12. `app_flow_apply`
|
|
126
|
+
13. `app_read_flow_summary` after apply whenever the user asked for verification or apply returns `partial_success`
|
|
127
|
+
|
|
128
|
+
In `prod`, keep `plan` and `apply` as separate phases unless the user explicitly asks for a direct live execution.
|
|
129
|
+
|
|
130
|
+
For additive work on existing systems:
|
|
131
|
+
|
|
132
|
+
1. Confirm the target package or existing apps
|
|
133
|
+
2. Avoid creating a new package unless the user explicitly wants a separate solution
|
|
134
|
+
3. Use ordinary low-level tools for incremental change
|
|
135
|
+
4. Re-verify the affected apps, views, workflows, or portal after modification
|
|
136
|
+
|
|
137
|
+
## Safe Usage Rules
|
|
138
|
+
|
|
139
|
+
- When using `package_name`, expect deterministic resolution only on a unique exact package name match; if multiple packages match, stop and resolve the ambiguity instead of guessing
|
|
140
|
+
- `app_schema_apply` is the only public patch tool allowed to create an app shell; `app_layout_apply`, `app_flow_apply`, and `app_views_apply` require an existing app.
|
|
141
|
+
- Prefer `*_plan` before `*_apply`; the plan tools do server-side normalization and return the next executable call skeleton.
|
|
142
|
+
- For abstract requests like “默认视图”, “基础审批流”, “灵活流程”, or “美观布局”, first translate the intent into a stable preset or explicit patch. Do not send those phrases to MCP unchanged.
|
|
143
|
+
- If the user asks for a business system or package that contains several forms, do not use the system/package name as `app_name` and do not try to store the child app names as text fields.
|
|
144
|
+
- For flexible workflow requests, split the work into two steps:
|
|
145
|
+
1. create a base skeleton with a preset
|
|
146
|
+
2. apply explicit business-specific changes as patchable nodes/transitions
|
|
147
|
+
- For preset-based flows, treat preset node ids as part of the public contract. Patch the skeleton nodes by the same ids instead of creating a parallel node with a new id and leaving the preset node unassigned.
|
|
148
|
+
- Approval, fill, and copy nodes must declare at least one assignee. Treat this as a hard requirement, not an optional detail.
|
|
149
|
+
- For workflow nodes, use the canonical public shape:
|
|
150
|
+
- `assignees.role_names`
|
|
151
|
+
- `assignees.member_names`
|
|
152
|
+
- `permissions.editable_fields`
|
|
153
|
+
- Reuse `app_flow_plan` output directly when it succeeds. Do not rewrite it into internal keys such as `role_entries` or `editable_que_ids`.
|
|
154
|
+
- Reuse `app_views_plan` output directly when it succeeds. Do not re-expand aliases such as `column_names`.
|
|
155
|
+
- For layout work, keep the public section shape canonical:
|
|
156
|
+
- `title`
|
|
157
|
+
- `rows`
|
|
158
|
+
Do not invent top-level layout `columns`, and do not prefer `fields` or `field_ids` once `rows` is known.
|
|
159
|
+
- Translate natural language like “一行四个字段 / 四列布局 / 每行放四个” into `rows` matrices, not guessed layout parameters.
|
|
160
|
+
- If the same layout-shape `VALIDATION_ERROR` repeats twice, stop guessing and re-read `builder_tool_contract(app_layout_plan)` or the layout reference before trying again.
|
|
161
|
+
- Do not guess role ids or member ids. Resolve them from the directory first.
|
|
162
|
+
- `app_schema_apply` does not treat package attachment as success criteria; if package ownership matters, verify `tag_ids_after` and call `package_attach_app` explicitly.
|
|
163
|
+
- `package_attach_app` is the source of truth for package ownership; do not assume app creation or publish implicitly attaches the app.
|
|
164
|
+
- `relation` and `subtable` must be explicit; do not infer them from vague natural language.
|
|
165
|
+
- Another app is not a field. If two business objects should both have their own records, build two apps and connect them with relation fields.
|
|
166
|
+
- In `prod`, prefer explicit patch tools and avoid any speculative create flow.
|
|
167
|
+
- Never try to bypass collaborative edit locks. `app_release_edit_lock_if_mine` is only for the case where the lock owner is the current authenticated user.
|
|
168
|
+
|
|
169
|
+
## Response Interpretation
|
|
170
|
+
|
|
171
|
+
- low-level list totals from the backend may report `0` while rows are present; prefer summary or aggregate readbacks for final conclusions
|
|
172
|
+
- `app_publish_verify` is the publish source of truth.
|
|
173
|
+
- If readback mismatches the UI, compare `request_route` and do not assume the builder hit the same `qf_version` as the browser
|
|
174
|
+
- Treat post-write readback as the source of truth, not just write status codes
|
|
175
|
+
- For views, a top-level `VIEW_APPLY_FAILED` does not prove all requested views failed. Read back the view list and verify which views actually landed.
|
|
176
|
+
- For views, “view exists” is not the same as “filters are active”. If `app_views_apply` returns `partial_success`, `views_verified=false`, or `details.filter_mismatches`, report the view as created but the filters as unverified until readback confirms them.
|
|
177
|
+
- If multiple views share the same name, do not guess which one to update. Read `view_key` from `app_read_views_summary` and pass it explicitly in `upsert_views[]`.
|
|
178
|
+
- In final user-facing summaries, distinguish clearly between:
|
|
179
|
+
- contract is visible / canonical shape is known
|
|
180
|
+
- plan succeeded
|
|
181
|
+
- apply landed and readback verified it
|
|
182
|
+
- base template/skeleton applied
|
|
183
|
+
- business-specific rules completed
|
|
184
|
+
- remaining gaps or follow-up patches
|
|
185
|
+
- Do not report “流程已满足业务需求” when only a preset skeleton has landed.
|
|
186
|
+
|
|
187
|
+
## Practical Patterns
|
|
188
|
+
|
|
189
|
+
- List packages: `package_list`
|
|
190
|
+
- Resolve one package: `package_resolve`
|
|
191
|
+
- Create one package: `package_create`
|
|
192
|
+
- Read one public tool contract: `builder_tool_contract`
|
|
193
|
+
- Resolve one app: `app_resolve`
|
|
194
|
+
- Read one app summary: `app_read_summary`
|
|
195
|
+
- Read fields only: `app_read_fields`
|
|
196
|
+
- Read layout summary: `app_read_layout_summary`
|
|
197
|
+
- Read views summary: `app_read_views_summary`
|
|
198
|
+
- Read flow summary: `app_read_flow_summary`
|
|
199
|
+
- Plan schema patch: `app_schema_plan`
|
|
200
|
+
- Plan layout patch: `app_layout_plan`
|
|
201
|
+
- Plan workflow patch: `app_flow_plan`
|
|
202
|
+
- Plan view patch: `app_views_plan`
|
|
203
|
+
- Search members for workflow assignees: `member_search`
|
|
204
|
+
- Search roles for workflow assignees: `role_search`
|
|
205
|
+
- Create reusable workflow role: `role_create`
|
|
206
|
+
- Add/update/remove fields: `app_schema_apply`
|
|
207
|
+
- Merge or replace layout: `app_layout_apply`
|
|
208
|
+
- Replace workflow: `app_flow_apply`
|
|
209
|
+
- Upsert/remove views: `app_views_apply`
|
|
210
|
+
- Attach one app to a package: `package_attach_app`
|
|
211
|
+
- Release your own stale edit lock: `app_release_edit_lock_if_mine`
|
|
212
|
+
- Publish and verify: `app_publish_verify` when you need a separate verification pass beyond the default auto-publish behavior in apply tools
|
|
213
|
+
|
|
214
|
+
Detailed playbooks:
|
|
215
|
+
|
|
216
|
+
- Environment switching: [references/environments.md](references/environments.md)
|
|
217
|
+
- Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
|
|
218
|
+
- Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
|
|
219
|
+
- Create one app in an existing package: [references/create-app.md](references/create-app.md)
|
|
220
|
+
- Update fields only: [references/update-schema.md](references/update-schema.md)
|
|
221
|
+
- Update layout only: [references/update-layout.md](references/update-layout.md)
|
|
222
|
+
- Update workflow only: [references/update-flow.md](references/update-flow.md)
|
|
223
|
+
- Workflow assignees and node permissions: [references/flow-actors-and-permissions.md](references/flow-actors-and-permissions.md)
|
|
224
|
+
- Update views only: [references/update-views.md](references/update-views.md)
|
|
225
|
+
- Standard end-to-end builder sequences: [references/solution-playbooks.md](references/solution-playbooks.md)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Qingflow App Builder"
|
|
3
|
+
short_description: "Build and modify Qingflow apps and systems"
|
|
4
|
+
default_prompt: "Use $qingflow-app-builder to build or modify a Qingflow app or system safely, and verify environment routing and post-write readbacks when builder flows touch live data."
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Create App
|
|
2
|
+
|
|
3
|
+
Use this when the user wants one new app inside an existing package.
|
|
4
|
+
|
|
5
|
+
Do not use this playbook when the user is really asking for a system/package with multiple forms or modules. In that case:
|
|
6
|
+
|
|
7
|
+
1. resolve or create the package
|
|
8
|
+
2. create each app separately
|
|
9
|
+
3. attach each app to the package
|
|
10
|
+
4. add relation fields between apps
|
|
11
|
+
|
|
12
|
+
Hierarchy reminder:
|
|
13
|
+
|
|
14
|
+
- package -> app -> field -> relation
|
|
15
|
+
- another business object is another app, not a text field
|
|
16
|
+
|
|
17
|
+
If creating a brand new package would help, ask the user to confirm package creation first. After confirmation, call `package_create` before this sequence.
|
|
18
|
+
|
|
19
|
+
## Minimal sequence
|
|
20
|
+
|
|
21
|
+
1. `package_resolve`
|
|
22
|
+
2. `app_resolve`
|
|
23
|
+
3. `app_schema_plan`
|
|
24
|
+
4. `app_schema_apply`
|
|
25
|
+
5. `package_attach_app`
|
|
26
|
+
6. `app_publish_verify` only when the user asks for explicit final verification
|
|
27
|
+
|
|
28
|
+
## Multi-app systems are different
|
|
29
|
+
|
|
30
|
+
If the user says things like:
|
|
31
|
+
|
|
32
|
+
- “创建一个完整应用包”
|
|
33
|
+
- “包含项目、需求、任务、缺陷、团队这几个表单”
|
|
34
|
+
- “这些表单之间建立关联关系”
|
|
35
|
+
|
|
36
|
+
then do not treat that as one app.
|
|
37
|
+
|
|
38
|
+
Use this pattern instead:
|
|
39
|
+
|
|
40
|
+
1. `package_resolve` or `package_create`
|
|
41
|
+
2. for each app name, run `app_schema_plan -> app_schema_apply -> package_attach_app`
|
|
42
|
+
3. once the apps exist, add `relation` fields between them
|
|
43
|
+
|
|
44
|
+
## Example
|
|
45
|
+
|
|
46
|
+
Create a new package only after the user confirms package creation:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"tool_name": "package_create",
|
|
51
|
+
"arguments": {
|
|
52
|
+
"profile": "default",
|
|
53
|
+
"package_name": "研发项目管理"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Resolve the package:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"tool_name": "package_resolve",
|
|
63
|
+
"arguments": {
|
|
64
|
+
"profile": "default",
|
|
65
|
+
"package_name": "测试应用包"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Plan schema for a new app:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"tool_name": "app_schema_plan",
|
|
75
|
+
"arguments": {
|
|
76
|
+
"profile": "default",
|
|
77
|
+
"app_name": "客户订单",
|
|
78
|
+
"package_tag_id": 1218950,
|
|
79
|
+
"create_if_missing": true,
|
|
80
|
+
"add_fields": [
|
|
81
|
+
{"name": "订单编号", "type": "text", "required": true},
|
|
82
|
+
{"name": "客户名称", "type": "text", "required": true},
|
|
83
|
+
{"name": "订单金额", "type": "amount"},
|
|
84
|
+
{"name": "状态", "type": "single_select", "options": ["草稿", "进行中", "已完成"], "required": true}
|
|
85
|
+
],
|
|
86
|
+
"update_fields": [],
|
|
87
|
+
"remove_fields": []
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Apply schema. This publishes by default:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"tool_name": "app_schema_apply",
|
|
97
|
+
"arguments": {
|
|
98
|
+
"profile": "default",
|
|
99
|
+
"app_name": "客户订单",
|
|
100
|
+
"package_tag_id": 1218950,
|
|
101
|
+
"create_if_missing": true,
|
|
102
|
+
"publish": true,
|
|
103
|
+
"add_fields": [
|
|
104
|
+
{"name": "订单编号", "type": "text", "required": true},
|
|
105
|
+
{"name": "客户名称", "type": "text", "required": true},
|
|
106
|
+
{"name": "订单金额", "type": "amount"},
|
|
107
|
+
{"name": "状态", "type": "single_select", "options": ["草稿", "进行中", "已完成"], "required": true}
|
|
108
|
+
],
|
|
109
|
+
"update_fields": [],
|
|
110
|
+
"remove_fields": []
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Attach explicitly if `tag_ids_after` does not yet contain the package:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"tool_name": "package_attach_app",
|
|
120
|
+
"arguments": {
|
|
121
|
+
"profile": "default",
|
|
122
|
+
"tag_id": 1218950,
|
|
123
|
+
"app_key": "APP_KEY_FROM_SCHEMA_APPLY"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Common failures
|
|
129
|
+
|
|
130
|
+
### `APP_NOT_FOUND`
|
|
131
|
+
|
|
132
|
+
Expected on create. Continue with `create_if_missing=true`.
|
|
133
|
+
|
|
134
|
+
### `CREATE_APP_ROUTE_NOT_FOUND`
|
|
135
|
+
|
|
136
|
+
The create route did not resolve in the current backend route context. Re-run `workspace_select`, then retry the same `app_schema_apply`.
|
|
137
|
+
|
|
138
|
+
### `PACKAGE_ATTACH_FAILED`
|
|
139
|
+
|
|
140
|
+
Do not retry schema creation. Re-run only `package_attach_app`, then verify with `app_read_summary`.
|
|
141
|
+
|
|
142
|
+
### Hierarchy modeling mistake
|
|
143
|
+
|
|
144
|
+
If the user asked for several named forms/apps but the draft patch turns them into text fields inside one app, stop and remodel the task as:
|
|
145
|
+
|
|
146
|
+
- one package
|
|
147
|
+
- many apps
|
|
148
|
+
- relation fields between those apps
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Environment Switching
|
|
2
|
+
|
|
3
|
+
Use this reference before any builder-side write, repair, or verification flow.
|
|
4
|
+
|
|
5
|
+
## Step 1: Resolve the active environment
|
|
6
|
+
|
|
7
|
+
Decide explicitly whether the task targets:
|
|
8
|
+
|
|
9
|
+
- `test`: build validation, mock data, trial package creation, safe iteration
|
|
10
|
+
- `prod`: formal business system changes in the live environment
|
|
11
|
+
|
|
12
|
+
If the user did not specify an environment, default to `prod`.
|
|
13
|
+
|
|
14
|
+
## Test Environment
|
|
15
|
+
|
|
16
|
+
Use test for:
|
|
17
|
+
|
|
18
|
+
- first application of a new `SolutionSpec`
|
|
19
|
+
- trying `solution_build_all(..., verify=true)`
|
|
20
|
+
- package initialization and schema evolution experiments
|
|
21
|
+
- mock data creation, with at least `5` records per relevant entity unless the user asks for fewer
|
|
22
|
+
|
|
23
|
+
Builder behavior in test:
|
|
24
|
+
|
|
25
|
+
- `preflight` or `plan` is still preferred, but fast `apply` is acceptable when the user explicitly wants an end-to-end smoke test
|
|
26
|
+
- package creation is acceptable
|
|
27
|
+
- verify should read back apps, views, portal, navigation, and sample records
|
|
28
|
+
|
|
29
|
+
Known current test backend:
|
|
30
|
+
|
|
31
|
+
- use an explicitly provided non-production backend
|
|
32
|
+
|
|
33
|
+
## Production Environment
|
|
34
|
+
|
|
35
|
+
Use production for:
|
|
36
|
+
|
|
37
|
+
- changes to real business systems
|
|
38
|
+
- additive modifications to live packages and apps
|
|
39
|
+
- controlled rollout of approved solution specs
|
|
40
|
+
|
|
41
|
+
Builder behavior in prod:
|
|
42
|
+
|
|
43
|
+
- always identify the target package or app set before changing anything
|
|
44
|
+
- default to `preflight` or `plan` before any `apply`
|
|
45
|
+
- additive requirements should modify the existing package with ordinary tools by default
|
|
46
|
+
- if creating a new package seems necessary in prod, ask the user to confirm package creation first
|
|
47
|
+
- do not seed mock data unless the user explicitly approves it for production
|
|
48
|
+
- verify is mandatory after writes
|
|
49
|
+
|
|
50
|
+
Production guardrails:
|
|
51
|
+
|
|
52
|
+
- restate the target workspace and target package before any write
|
|
53
|
+
- call out whether the action creates, mutates, or deletes builder-side configuration
|
|
54
|
+
- if a safer read-only inspection can answer the request, do that first
|
|
55
|
+
|
|
56
|
+
## Reporting Rule
|
|
57
|
+
|
|
58
|
+
For builder work, always report:
|
|
59
|
+
|
|
60
|
+
- active environment
|
|
61
|
+
- target workspace
|
|
62
|
+
- whether the operation is `plan`, `apply`, `repair`, or `verify`
|
|
63
|
+
- whether it touches an existing package or creates a new one
|