@josephyan/qingflow-app-builder-mcp 0.2.0-beta.2 → 0.2.0-beta.4
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 +116 -0
- package/skills/qingflow-app-builder/agents/openai.yaml +4 -0
- package/skills/qingflow-app-builder/references/create-app.md +98 -0
- package/skills/qingflow-app-builder/references/environments.md +63 -0
- package/skills/qingflow-app-builder/references/gotchas.md +37 -0
- package/skills/qingflow-app-builder/references/solution-playbooks.md +51 -0
- package/skills/qingflow-app-builder/references/tool-selection.md +65 -0
- package/skills/qingflow-app-builder/references/update-flow.md +71 -0
- package/skills/qingflow-app-builder/references/update-layout.md +81 -0
- package/skills/qingflow-app-builder/references/update-schema.md +90 -0
- package/skills/qingflow-app-builder/references/update-views.md +96 -0
- package/src/qingflow_mcp/__init__.py +1 -1
- package/src/qingflow_mcp/builder_facade/service.py +158 -77
- package/src/qingflow_mcp/server_app_builder.py +10 -3
- package/src/qingflow_mcp/tools/ai_builder_tools.py +16 -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.4
|
|
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.4 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 skill:
|
|
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.4",
|
|
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,116 @@
|
|
|
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
|
+
- Authentication and workspace: `auth_*`, `workspace_*`
|
|
21
|
+
- File upload: `file_upload_local`
|
|
22
|
+
- Resource resolve/read: `package_list`, `package_resolve`, `app_resolve`, `app_read_summary`, `app_read_fields`, `app_read_layout_summary`, `app_read_views_summary`, `app_read_flow_summary`
|
|
23
|
+
- Resource plan: `app_schema_plan`, `app_layout_plan`, `app_flow_plan`, `app_views_plan`
|
|
24
|
+
- Resource patch: `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, `app_views_apply`, `package_attach_app`
|
|
25
|
+
- Publish and verify: `app_publish_verify`
|
|
26
|
+
|
|
27
|
+
Note:
|
|
28
|
+
- Do not try to handcraft raw Qingflow schema or internal solution payloads.
|
|
29
|
+
- Do not rely on low-level `view_*`, `workflow_*`, or `qingbi_report_*` write payloads from public builder flows.
|
|
30
|
+
- Public builder work should stay on the resource path: `resolve -> summary read -> plan -> apply -> attach -> publish_verify`.
|
|
31
|
+
- `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.
|
|
32
|
+
|
|
33
|
+
Default policy:
|
|
34
|
+
|
|
35
|
+
- 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.
|
|
36
|
+
- Do not create a new package unless the user explicitly asks for package separation.
|
|
37
|
+
|
|
38
|
+
## Standard Operating Order
|
|
39
|
+
|
|
40
|
+
Before any business tool:
|
|
41
|
+
|
|
42
|
+
1. Ensure auth exists
|
|
43
|
+
2. Ensure workspace is selected
|
|
44
|
+
3. Confirm whether the task is read-only or write-impacting
|
|
45
|
+
|
|
46
|
+
For builder work:
|
|
47
|
+
|
|
48
|
+
1. Resolve the target package with `package_resolve` when the user gives a package name. If resolution is ambiguous or you need a read-only fallback, use `package_list`.
|
|
49
|
+
2. Resolve the target app with `app_resolve` if the request is an update.
|
|
50
|
+
3. 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`.
|
|
51
|
+
4. Use `app_schema_plan`, `app_layout_plan`, `app_flow_plan`, or `app_views_plan` before any non-trivial write.
|
|
52
|
+
5. Use `app_schema_apply` for create/upsert/remove field work. It publishes by default after the patch lands.
|
|
53
|
+
6. If the app must belong to a package, use `package_attach_app` explicitly after schema work unless readback already shows the target `tag_id`.
|
|
54
|
+
7. 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.
|
|
55
|
+
8. Use `app_flow_apply` after schema exists. It publishes by default.
|
|
56
|
+
9. Use `app_views_apply` when the user wants explicit list/card/board views. It publishes by default.
|
|
57
|
+
10. Use `app_publish_verify` only when the user explicitly wants final publish/live verification or you need an explicit verification pass.
|
|
58
|
+
|
|
59
|
+
In `prod`, keep `plan` and `apply` as separate phases unless the user explicitly asks for a direct live execution.
|
|
60
|
+
|
|
61
|
+
For additive work on existing systems:
|
|
62
|
+
|
|
63
|
+
1. Confirm the target package or existing apps
|
|
64
|
+
2. Avoid creating a new package unless the user explicitly wants a separate solution
|
|
65
|
+
3. Use ordinary low-level tools for incremental change
|
|
66
|
+
4. Re-verify the affected apps, views, workflows, or portal after modification
|
|
67
|
+
|
|
68
|
+
## Safe Usage Rules
|
|
69
|
+
|
|
70
|
+
- 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
|
|
71
|
+
- `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.
|
|
72
|
+
- Prefer `*_plan` before `*_apply`; the plan tools do server-side normalization and return the next executable call skeleton.
|
|
73
|
+
- `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.
|
|
74
|
+
- `package_attach_app` is the source of truth for package ownership; do not assume app creation or publish implicitly attaches the app.
|
|
75
|
+
- `relation` and `subtable` must be explicit; do not infer them from vague natural language.
|
|
76
|
+
- In `prod`, prefer explicit patch tools and avoid any speculative create flow.
|
|
77
|
+
|
|
78
|
+
## Response Interpretation
|
|
79
|
+
|
|
80
|
+
- low-level list totals from the backend may report `0` while rows are present; prefer summary or aggregate readbacks for final conclusions
|
|
81
|
+
- `app_publish_verify` is the publish source of truth.
|
|
82
|
+
- If readback mismatches the UI, compare `request_route` and do not assume the builder hit the same `qf_version` as the browser
|
|
83
|
+
- Treat post-write readback as the source of truth, not just write status codes
|
|
84
|
+
|
|
85
|
+
## Practical Patterns
|
|
86
|
+
|
|
87
|
+
- List packages: `package_list`
|
|
88
|
+
- Resolve one package: `package_resolve`
|
|
89
|
+
- Resolve one app: `app_resolve`
|
|
90
|
+
- Read one app summary: `app_read_summary`
|
|
91
|
+
- Read fields only: `app_read_fields`
|
|
92
|
+
- Read layout summary: `app_read_layout_summary`
|
|
93
|
+
- Read views summary: `app_read_views_summary`
|
|
94
|
+
- Read flow summary: `app_read_flow_summary`
|
|
95
|
+
- Plan schema patch: `app_schema_plan`
|
|
96
|
+
- Plan layout patch: `app_layout_plan`
|
|
97
|
+
- Plan workflow patch: `app_flow_plan`
|
|
98
|
+
- Plan view patch: `app_views_plan`
|
|
99
|
+
- Add/update/remove fields: `app_schema_apply`
|
|
100
|
+
- Merge or replace layout: `app_layout_apply`
|
|
101
|
+
- Replace workflow: `app_flow_apply`
|
|
102
|
+
- Upsert/remove views: `app_views_apply`
|
|
103
|
+
- Attach one app to a package: `package_attach_app`
|
|
104
|
+
- Publish and verify: `app_publish_verify` when you need a separate verification pass beyond the default auto-publish behavior in apply tools
|
|
105
|
+
|
|
106
|
+
Detailed playbooks:
|
|
107
|
+
|
|
108
|
+
- Environment switching: [references/environments.md](references/environments.md)
|
|
109
|
+
- Tool choice and sequencing: [references/tool-selection.md](references/tool-selection.md)
|
|
110
|
+
- Result semantics and gotchas: [references/gotchas.md](references/gotchas.md)
|
|
111
|
+
- Create one app in an existing package: [references/create-app.md](references/create-app.md)
|
|
112
|
+
- Update fields only: [references/update-schema.md](references/update-schema.md)
|
|
113
|
+
- Update layout only: [references/update-layout.md](references/update-layout.md)
|
|
114
|
+
- Update workflow only: [references/update-flow.md](references/update-flow.md)
|
|
115
|
+
- Update views only: [references/update-views.md](references/update-views.md)
|
|
116
|
+
- 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,98 @@
|
|
|
1
|
+
# Create App
|
|
2
|
+
|
|
3
|
+
Use this when the user wants one new app inside an existing package.
|
|
4
|
+
|
|
5
|
+
## Minimal sequence
|
|
6
|
+
|
|
7
|
+
1. `package_resolve`
|
|
8
|
+
2. `app_resolve`
|
|
9
|
+
3. `app_schema_plan`
|
|
10
|
+
4. `app_schema_apply`
|
|
11
|
+
5. `package_attach_app`
|
|
12
|
+
6. `app_publish_verify` only when the user asks for explicit final verification
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
Resolve the package:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"tool_name": "package_resolve",
|
|
21
|
+
"arguments": {
|
|
22
|
+
"profile": "default",
|
|
23
|
+
"package_name": "测试应用包"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Plan schema for a new app:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"tool_name": "app_schema_plan",
|
|
33
|
+
"arguments": {
|
|
34
|
+
"profile": "default",
|
|
35
|
+
"app_name": "客户订单",
|
|
36
|
+
"package_tag_id": 1218950,
|
|
37
|
+
"create_if_missing": true,
|
|
38
|
+
"add_fields": [
|
|
39
|
+
{"name": "订单编号", "type": "text", "required": true},
|
|
40
|
+
{"name": "客户名称", "type": "text", "required": true},
|
|
41
|
+
{"name": "订单金额", "type": "amount"},
|
|
42
|
+
{"name": "状态", "type": "single_select", "options": ["草稿", "进行中", "已完成"], "required": true}
|
|
43
|
+
],
|
|
44
|
+
"update_fields": [],
|
|
45
|
+
"remove_fields": []
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Apply schema. This publishes by default:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"tool_name": "app_schema_apply",
|
|
55
|
+
"arguments": {
|
|
56
|
+
"profile": "default",
|
|
57
|
+
"app_name": "客户订单",
|
|
58
|
+
"package_tag_id": 1218950,
|
|
59
|
+
"create_if_missing": true,
|
|
60
|
+
"publish": true,
|
|
61
|
+
"add_fields": [
|
|
62
|
+
{"name": "订单编号", "type": "text", "required": true},
|
|
63
|
+
{"name": "客户名称", "type": "text", "required": true},
|
|
64
|
+
{"name": "订单金额", "type": "amount"},
|
|
65
|
+
{"name": "状态", "type": "single_select", "options": ["草稿", "进行中", "已完成"], "required": true}
|
|
66
|
+
],
|
|
67
|
+
"update_fields": [],
|
|
68
|
+
"remove_fields": []
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Attach explicitly if `tag_ids_after` does not yet contain the package:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"tool_name": "package_attach_app",
|
|
78
|
+
"arguments": {
|
|
79
|
+
"profile": "default",
|
|
80
|
+
"tag_id": 1218950,
|
|
81
|
+
"app_key": "APP_KEY_FROM_SCHEMA_APPLY"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Common failures
|
|
87
|
+
|
|
88
|
+
### `APP_NOT_FOUND`
|
|
89
|
+
|
|
90
|
+
Expected on create. Continue with `create_if_missing=true`.
|
|
91
|
+
|
|
92
|
+
### `CREATE_APP_ROUTE_NOT_FOUND`
|
|
93
|
+
|
|
94
|
+
The create route did not resolve in the current backend route context. Re-run `workspace_select`, then retry the same `app_schema_apply`.
|
|
95
|
+
|
|
96
|
+
### `PACKAGE_ATTACH_FAILED`
|
|
97
|
+
|
|
98
|
+
Do not retry schema creation. Re-run only `package_attach_app`, then verify with `app_read_summary`.
|
|
@@ -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
|
+
- do not create a new package unless the user explicitly wants package separation
|
|
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
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Builder Gotchas
|
|
2
|
+
|
|
3
|
+
## Auth and workspace
|
|
4
|
+
|
|
5
|
+
- `auth_*` success does not mean a workspace is selected
|
|
6
|
+
- Re-run `workspace_select` after auth changes or route changes
|
|
7
|
+
|
|
8
|
+
## Package ownership
|
|
9
|
+
|
|
10
|
+
- App creation and publish do not guarantee package attachment
|
|
11
|
+
- Treat `package_attach_app` as the source of truth for package ownership
|
|
12
|
+
- Check `tag_ids_after` after schema writes
|
|
13
|
+
|
|
14
|
+
## Auto publish
|
|
15
|
+
|
|
16
|
+
- `app_schema_apply`, `app_layout_apply`, `app_flow_apply`, and `app_views_apply` publish by default
|
|
17
|
+
- Pass `publish=false` only when the user explicitly wants to leave changes in draft
|
|
18
|
+
- `app_publish_verify` is for explicit final verification, not the default next step after every write
|
|
19
|
+
|
|
20
|
+
## Readback scope
|
|
21
|
+
|
|
22
|
+
- Prefer summary reads over large raw payloads
|
|
23
|
+
- Use `app_read_fields` before schema or view work
|
|
24
|
+
- Use `app_read_layout_summary` before layout work
|
|
25
|
+
- Use `app_read_flow_summary` before workflow work
|
|
26
|
+
|
|
27
|
+
## Workflow dependencies
|
|
28
|
+
|
|
29
|
+
- Approval-style flows usually require an explicit status field
|
|
30
|
+
- If `app_flow_plan` reports `FLOW_DEPENDENCY_MISSING`, fix schema first
|
|
31
|
+
- Do not switch to hidden `solution_*` tools from public builder flows
|
|
32
|
+
|
|
33
|
+
## Retry discipline
|
|
34
|
+
|
|
35
|
+
- If a write returns `partial_success`, read back before retrying
|
|
36
|
+
- Do not repeat create steps after `app_key` already exists
|
|
37
|
+
- For backend rejects, keep the retry narrow: retry only the failed tool, not the whole chain
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Builder Playbooks
|
|
2
|
+
|
|
3
|
+
Use these when you need a quick reminder of the standard v2 builder sequences.
|
|
4
|
+
|
|
5
|
+
## Create a new app in an existing package
|
|
6
|
+
|
|
7
|
+
1. `package_resolve`
|
|
8
|
+
2. `app_resolve`
|
|
9
|
+
3. `app_schema_plan`
|
|
10
|
+
4. `app_schema_apply`
|
|
11
|
+
5. `package_attach_app`
|
|
12
|
+
6. `app_publish_verify` only if the user asks for explicit live verification
|
|
13
|
+
|
|
14
|
+
## Update fields on an existing app
|
|
15
|
+
|
|
16
|
+
1. `app_resolve`
|
|
17
|
+
2. `app_read_fields`
|
|
18
|
+
3. `app_schema_plan`
|
|
19
|
+
4. `app_schema_apply`
|
|
20
|
+
|
|
21
|
+
## Rework layout
|
|
22
|
+
|
|
23
|
+
1. `app_read_layout_summary`
|
|
24
|
+
2. `app_layout_plan`
|
|
25
|
+
3. `app_layout_apply`
|
|
26
|
+
|
|
27
|
+
Prefer `mode=merge`. Use `mode=replace` only when every field placement is intentional.
|
|
28
|
+
|
|
29
|
+
## Add or update workflow
|
|
30
|
+
|
|
31
|
+
1. `app_read_fields`
|
|
32
|
+
2. `app_flow_plan`
|
|
33
|
+
3. `app_flow_apply`
|
|
34
|
+
|
|
35
|
+
If `app_flow_plan` reports `FLOW_DEPENDENCY_MISSING`, fix schema first.
|
|
36
|
+
|
|
37
|
+
## Add or update views
|
|
38
|
+
|
|
39
|
+
1. `app_read_fields`
|
|
40
|
+
2. `app_views_plan`
|
|
41
|
+
3. `app_views_apply`
|
|
42
|
+
|
|
43
|
+
## Final readback
|
|
44
|
+
|
|
45
|
+
Prefer these fields after writes:
|
|
46
|
+
|
|
47
|
+
- `app_read_summary.tag_ids`
|
|
48
|
+
- `app_read_summary.publish_status`
|
|
49
|
+
- `app_read_layout_summary.unplaced_fields`
|
|
50
|
+
- `app_read_views_summary.views`
|
|
51
|
+
- `app_read_flow_summary.nodes`
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Tool Selection
|
|
2
|
+
|
|
3
|
+
Use the smallest v2 builder tool chain that can finish the task.
|
|
4
|
+
|
|
5
|
+
## Default path
|
|
6
|
+
|
|
7
|
+
`resolve -> summary read -> plan -> apply -> attach -> publish_verify`
|
|
8
|
+
|
|
9
|
+
Use `plan` before `apply` unless the patch is trivial and already normalized.
|
|
10
|
+
|
|
11
|
+
## Resolve
|
|
12
|
+
|
|
13
|
+
- `package_resolve`: exact package lookup by name
|
|
14
|
+
- `package_list`: read-only fallback when package resolution is ambiguous
|
|
15
|
+
- `app_resolve`: locate an existing app by `app_key` or `app_name`
|
|
16
|
+
|
|
17
|
+
## Summary reads
|
|
18
|
+
|
|
19
|
+
- `app_read_summary`: overall app health, publish state, counts
|
|
20
|
+
- `app_read_fields`: field names, types, required flags, section ids
|
|
21
|
+
- `app_read_layout_summary`: sections, rows, unplaced fields
|
|
22
|
+
- `app_read_views_summary`: current view names, types, columns, group-by
|
|
23
|
+
- `app_read_flow_summary`: workflow enabled state, nodes, transitions
|
|
24
|
+
|
|
25
|
+
## Plan tools
|
|
26
|
+
|
|
27
|
+
Use these when the patch is non-trivial or the model is likely to drift.
|
|
28
|
+
|
|
29
|
+
- `app_schema_plan`: normalize field patches before add/update/remove
|
|
30
|
+
- `app_layout_plan`: preview merge/replace layout changes or layout presets
|
|
31
|
+
- `app_flow_plan`: validate workflow nodes, transitions, and dependencies
|
|
32
|
+
- `app_views_plan`: normalize view aliases and validate referenced fields
|
|
33
|
+
|
|
34
|
+
## Apply tools
|
|
35
|
+
|
|
36
|
+
These execute normalized patches and publish by default unless `publish=false`.
|
|
37
|
+
|
|
38
|
+
- `app_schema_apply`: create app shell or change fields
|
|
39
|
+
- `app_layout_apply`: merge or replace layout
|
|
40
|
+
- `app_flow_apply`: replace workflow
|
|
41
|
+
- `app_views_apply`: upsert or remove views
|
|
42
|
+
|
|
43
|
+
## Explicit post-apply tools
|
|
44
|
+
|
|
45
|
+
- `package_attach_app`: attach an app to a package; do not assume create or publish attaches it
|
|
46
|
+
- `app_publish_verify`: explicit final publish verification when the user asks for live confirmation
|
|
47
|
+
|
|
48
|
+
## Decision shortcuts
|
|
49
|
+
|
|
50
|
+
- Create one app inside an existing package:
|
|
51
|
+
`package_resolve -> app_resolve -> app_schema_plan -> app_schema_apply -> package_attach_app`
|
|
52
|
+
- Update fields on an existing app:
|
|
53
|
+
`app_resolve -> app_read_fields -> app_schema_plan -> app_schema_apply`
|
|
54
|
+
- Tidy layout:
|
|
55
|
+
`app_read_layout_summary -> app_layout_plan -> app_layout_apply`
|
|
56
|
+
- Add workflow:
|
|
57
|
+
`app_read_fields -> app_flow_plan -> app_flow_apply`
|
|
58
|
+
- Add views:
|
|
59
|
+
`app_read_fields -> app_views_plan -> app_views_apply`
|
|
60
|
+
|
|
61
|
+
## Avoid
|
|
62
|
+
|
|
63
|
+
- Do not handcraft raw Qingflow schema payloads
|
|
64
|
+
- Do not rely on internal `solution_*` tools in public builder flows
|
|
65
|
+
- Do not create a new package unless the user explicitly asks for package separation
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Update Flow
|
|
2
|
+
|
|
3
|
+
Use this when the app already exists and the task is only about workflow.
|
|
4
|
+
|
|
5
|
+
## Minimal sequence
|
|
6
|
+
|
|
7
|
+
1. `app_read_fields`
|
|
8
|
+
2. `app_read_flow_summary`
|
|
9
|
+
3. `app_flow_plan`
|
|
10
|
+
4. `app_flow_apply`
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
Plan a simple approval flow:
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
{
|
|
18
|
+
"tool_name": "app_flow_plan",
|
|
19
|
+
"arguments": {
|
|
20
|
+
"profile": "default",
|
|
21
|
+
"app_key": "APP_123",
|
|
22
|
+
"preset": "basic_approval"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or use explicit nodes:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"tool_name": "app_flow_apply",
|
|
32
|
+
"arguments": {
|
|
33
|
+
"profile": "default",
|
|
34
|
+
"app_key": "APP_123",
|
|
35
|
+
"mode": "replace",
|
|
36
|
+
"publish": true,
|
|
37
|
+
"nodes": [
|
|
38
|
+
{"id": "start", "type": "start", "name": "发起"},
|
|
39
|
+
{"id": "approve_1", "type": "approve", "name": "审批"},
|
|
40
|
+
{"id": "end", "type": "end", "name": "结束"}
|
|
41
|
+
],
|
|
42
|
+
"transitions": [
|
|
43
|
+
{"from": "start", "to": "approve_1"},
|
|
44
|
+
{"from": "approve_1", "to": "end"}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Common failures
|
|
51
|
+
|
|
52
|
+
### `FLOW_DEPENDENCY_MISSING`
|
|
53
|
+
|
|
54
|
+
The workflow depends on fields that do not exist yet, usually `status`. Fix schema first.
|
|
55
|
+
|
|
56
|
+
### `INVALID_FLOW_EDGE`
|
|
57
|
+
|
|
58
|
+
One or more transitions reference unknown nodes or create an invalid graph.
|
|
59
|
+
|
|
60
|
+
### `STATUS_FIELD_REQUIRED`
|
|
61
|
+
|
|
62
|
+
The app has no explicit status field recognized by the internal workflow compiler. Add one with `app_schema_apply`, then retry.
|
|
63
|
+
|
|
64
|
+
### `FLOW_STAGE_CONTEXT_MISSING`
|
|
65
|
+
|
|
66
|
+
Internal flow stage context was missing or invalid. Re-run `app_flow_plan`, then retry `app_flow_apply`. Do not switch to hidden `solution_*` tools.
|
|
67
|
+
|
|
68
|
+
## Notes
|
|
69
|
+
|
|
70
|
+
- `mode=replace` is the only supported flow apply mode
|
|
71
|
+
- `app_flow_apply` publishes by default
|