@qingflow-tech/qingflow-app-builder-mcp 1.0.44 → 1.1.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 (40) hide show
  1. package/README.md +4 -2
  2. package/npm/bin/qingflow-app-builder-mcp.mjs +31 -2
  3. package/npm/lib/runtime.mjs +43 -2
  4. package/package.json +1 -1
  5. package/pyproject.toml +1 -1
  6. package/skills/qingflow-app-builder-code-integrations/SKILL.md +1 -1
  7. package/skills/qingflow-mcp-setup/SKILL.md +115 -0
  8. package/skills/qingflow-mcp-setup/agents/openai.yaml +4 -0
  9. package/skills/qingflow-mcp-setup/references/claude-desktop.md +34 -0
  10. package/skills/qingflow-mcp-setup/references/environments.md +62 -0
  11. package/skills/qingflow-mcp-setup/references/generic-stdio.md +32 -0
  12. package/skills/qingflow-mcp-setup/scripts/check_local_server.sh +38 -0
  13. package/skills/qingflow-workflow-builder/SKILL.md +98 -0
  14. package/skills/qingflow-workflow-builder/manifest.yaml +8 -0
  15. package/skills/qingflow-workflow-builder/references/01-overview.md +45 -0
  16. package/skills/qingflow-workflow-builder/references/02-update-mode.md +53 -0
  17. package/skills/qingflow-workflow-builder/references/03-flow-patterns.md +57 -0
  18. package/skills/qingflow-workflow-builder/references/04-stage1-business-modeling.md +131 -0
  19. package/skills/qingflow-workflow-builder/references/05-stage2-members-roles.md +29 -0
  20. package/skills/qingflow-workflow-builder/references/06-stage3-build-spec.md +165 -0
  21. package/skills/qingflow-workflow-builder/references/07-stage4-validate-spec.md +33 -0
  22. package/skills/qingflow-workflow-builder/references/08-stage5-apply-verify.md +51 -0
  23. package/skills/qingflow-workflow-builder/references/09-stage6-summary.md +88 -0
  24. package/skills/qingflow-workflow-builder/references/10-node-config-reference.md +93 -0
  25. package/skills/qingflow-workflow-builder/references/11-troubleshooting.md +15 -0
  26. package/skills/qingflow-workflow-builder/scripts/diff_flow_spec.py +275 -0
  27. package/skills/qingflow-workflow-builder/scripts/validate_flow_spec.py +605 -0
  28. package/src/qingflow_mcp/__init__.py +1 -1
  29. package/src/qingflow_mcp/builder_facade/models.py +0 -39
  30. package/src/qingflow_mcp/builder_facade/service.py +262 -862
  31. package/src/qingflow_mcp/builder_facade/workflow_spec.py +111 -0
  32. package/src/qingflow_mcp/cli/commands/builder.py +44 -12
  33. package/src/qingflow_mcp/public_surface.py +2 -0
  34. package/src/qingflow_mcp/server_app_builder.py +16 -8
  35. package/src/qingflow_mcp/solution/compiler/__init__.py +1 -3
  36. package/src/qingflow_mcp/solution/executor.py +3 -133
  37. package/src/qingflow_mcp/tools/ai_builder_tools.py +92 -233
  38. package/src/qingflow_mcp/tools/solution_tools.py +30 -2
  39. package/src/qingflow_mcp/tools/workflow_tools.py +3 -31
  40. package/src/qingflow_mcp/solution/compiler/workflow_compiler.py +0 -173
package/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  Install:
4
4
 
5
5
  ```bash
6
- npm install @qingflow-tech/qingflow-app-builder-mcp@1.0.44
6
+ npm install @qingflow-tech/qingflow-app-builder-mcp@1.1.0
7
7
  ```
8
8
 
9
9
  Run:
10
10
 
11
11
  ```bash
12
- npx -y -p @qingflow-tech/qingflow-app-builder-mcp@1.0.44 qingflow-app-builder-mcp
12
+ npx -y -p @qingflow-tech/qingflow-app-builder-mcp@1.1.0 qingflow-app-builder-mcp
13
13
  ```
14
14
 
15
15
  Environment:
@@ -24,6 +24,8 @@ Bundled skills:
24
24
 
25
25
  - `skills/qingflow-app-builder`
26
26
  - `skills/qingflow-app-builder-code-integrations`
27
+ - `skills/qingflow-workflow-builder`
28
+ - `skills/qingflow-mcp-setup`
27
29
 
28
30
  Note:
29
31
 
@@ -1,7 +1,36 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
2
5
 
3
- import { getPackageRoot, spawnServer } from "../lib/runtime.mjs";
6
+ const PKG_BY_BIN = {
7
+ qingflow: "qingflow-cli",
8
+ "qingflow-app-user-mcp": "qingflow-app-user-mcp",
9
+ "qingflow-app-builder-mcp": "qingflow-app-builder-mcp",
10
+ };
4
11
 
5
- const packageRoot = getPackageRoot(import.meta.url);
12
+ function resolvePackageModule(metaUrl, ...segments) {
13
+ const scriptPath = fileURLToPath(metaUrl);
14
+ const scriptDir = path.dirname(scriptPath);
15
+ const direct = path.join(scriptDir, ...segments);
16
+ if (fs.existsSync(direct)) {
17
+ return pathToFileURL(direct).href;
18
+ }
19
+ if (path.basename(scriptDir) === ".bin") {
20
+ const binName = path.basename(scriptPath);
21
+ const pkgName = PKG_BY_BIN[binName];
22
+ if (!pkgName) {
23
+ throw new Error(`Unknown qingflow command: ${binName}`);
24
+ }
25
+ const scope = process.env.QINGFLOW_NPM_SCOPE || "@qingflow-tech";
26
+ const fromBin = path.join(scriptDir, "..", scope, pkgName, "npm", ...segments);
27
+ if (fs.existsSync(fromBin)) {
28
+ return pathToFileURL(fromBin).href;
29
+ }
30
+ }
31
+ throw new Error(`Cannot locate ${segments.join("/")} from ${scriptPath}`);
32
+ }
6
33
 
34
+ const { getPackageRoot, spawnServer } = await import(resolvePackageModule(import.meta.url, "lib", "runtime.mjs"));
35
+ const packageRoot = getPackageRoot(import.meta.url);
7
36
  spawnServer(packageRoot, process.argv.slice(2), "qingflow-app-builder-mcp", { allowRuntimeBootstrap: false });
@@ -5,6 +5,12 @@ import { fileURLToPath } from "node:url";
5
5
 
6
6
  const WINDOWS = process.platform === "win32";
7
7
 
8
+ const PKG_BY_BIN = {
9
+ qingflow: "qingflow-cli",
10
+ "qingflow-app-user-mcp": "qingflow-app-user-mcp",
11
+ "qingflow-app-builder-mcp": "qingflow-app-builder-mcp",
12
+ };
13
+
8
14
  function runChecked(command, args, options = {}) {
9
15
  const result = spawnSync(command, args, {
10
16
  encoding: "utf8",
@@ -28,7 +34,18 @@ function commandWorks(command, args) {
28
34
  }
29
35
 
30
36
  export function getPackageRoot(metaUrl) {
31
- return path.resolve(path.dirname(fileURLToPath(metaUrl)), "..", "..");
37
+ const scriptPath = fileURLToPath(metaUrl);
38
+ const scriptDir = path.dirname(scriptPath);
39
+ if (path.basename(scriptDir) === ".bin") {
40
+ const binName = path.basename(scriptPath);
41
+ const pkgName = PKG_BY_BIN[binName];
42
+ if (!pkgName) {
43
+ throw new Error(`Unknown qingflow command: ${binName}`);
44
+ }
45
+ const scope = process.env.QINGFLOW_NPM_SCOPE || "@qingflow-tech";
46
+ return path.join(scriptDir, "..", scope, pkgName);
47
+ }
48
+ return path.resolve(scriptDir, "..", "..");
32
49
  }
33
50
 
34
51
  export function getCodexHome() {
@@ -480,6 +497,17 @@ function getVenvPip(packageRoot) {
480
497
  : path.join(getVenvDir(packageRoot), "bin", "pip");
481
498
  }
482
499
 
500
+ function findOfflineProjectWheel(findLinksDir) {
501
+ const wheels = fs
502
+ .readdirSync(findLinksDir)
503
+ .filter((name) => /^qingflow_mcp-.*\.whl$/i.test(name))
504
+ .sort();
505
+ if (wheels.length === 0) {
506
+ throw new Error(`Offline install expected a qingflow_mcp wheel in ${findLinksDir}`);
507
+ }
508
+ return path.join(findLinksDir, wheels[wheels.length - 1]);
509
+ }
510
+
483
511
  export function findPython() {
484
512
  const preferred = process.env.QINGFLOW_MCP_PYTHON?.trim();
485
513
  const candidates = preferred
@@ -528,7 +556,20 @@ export function ensurePythonEnv(packageRoot, { force = false, commandName = "qin
528
556
  }
529
557
 
530
558
  const pip = getVenvPip(packageRoot);
531
- runChecked(pip, ["install", "--disable-pip-version-check", "."], { cwd: packageRoot });
559
+ const pipArgs = ["install", "--disable-pip-version-check"];
560
+ const offlineFindLinks = process.env.QINGFLOW_MCP_PIP_FIND_LINKS?.trim();
561
+ if (process.env.QINGFLOW_MCP_PIP_NO_INDEX === "1") {
562
+ pipArgs.push("--no-index");
563
+ }
564
+ if (offlineFindLinks) {
565
+ pipArgs.push("--find-links", offlineFindLinks);
566
+ }
567
+ if (process.env.QINGFLOW_MCP_PIP_NO_INDEX === "1" && offlineFindLinks) {
568
+ pipArgs.push(findOfflineProjectWheel(offlineFindLinks));
569
+ } else {
570
+ pipArgs.push(".");
571
+ }
572
+ runChecked(pip, pipArgs, { cwd: packageRoot });
532
573
 
533
574
  fs.writeFileSync(
534
575
  stampPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingflow-tech/qingflow-app-builder-mcp",
3
- "version": "1.0.44",
3
+ "version": "1.1.0",
4
4
  "description": "Builder MCP for Qingflow app/package/system design and staged solution workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qingflow-mcp"
7
- version = "1.0.44"
7
+ version = "1.1.0"
8
8
  description = "User-authenticated MCP server for Qingflow"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -7,7 +7,7 @@ metadata:
7
7
 
8
8
  # Qingflow App Builder Code Integrations
9
9
 
10
- > **Skill 版本**:`qingflow-skills-2026.06.24.1`(入口文档版本;如需确认 CLI 包版本,使用 `qingflow --version` 或 `qingflow --json version`)。
10
+ > **Skill 版本**:`qingflow-skills-2026.06.24.2`(入口文档版本;如需确认 CLI 包版本,使用 `qingflow --version` 或 `qingflow --json version`)。
11
11
 
12
12
  Use this skill when the user wants to build or repair:
13
13
  - `code_block` fields
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: qingflow-mcp-setup
3
+ description: Install, connect, authenticate, and troubleshoot the Qingflow MCP server in local AI clients such as Claude Desktop or any stdio-compatible MCP client. Use when the user wants to configure the MCP, verify local startup, log in with token/password, select a workspace, or fix connection/authentication issues.
4
+ metadata:
5
+ short-description: Install and connect the Qingflow MCP locally
6
+ ---
7
+
8
+ # Qingflow MCP Setup
9
+
10
+ > **Skill 版本**:`qingflow-skills-2026.06.24.2`(入口文档版本;如需确认 CLI 包版本,使用 `qingflow --version` 或 `qingflow --json version`)。
11
+
12
+ ## Overview
13
+
14
+ This skill sets up the local Qingflow MCP server, connects it to a local AI client, and verifies authentication and workspace selection. Use it for installation, client configuration, token login, and connection troubleshooting.
15
+
16
+ ## Workflow
17
+
18
+ Follow these steps in order.
19
+
20
+ `feedback_submit` is also available as a cross-cutting helper when setup or MCP capability gaps still block the user after reasonable troubleshooting. It does not require Qingflow login or workspace selection, and should be called only after explicit user confirmation.
21
+
22
+ Before configuration or live calls, identify the target environment explicitly as `test` or `prod`, then read [references/environments.md](references/environments.md). If the user did not specify one, default to `prod`.
23
+
24
+ ### Step 1: Verify the local project path
25
+
26
+ Resolve the repository root first. In this repo, the MCP server should live at:
27
+
28
+ - `<repo_root>/qingflow-support/mcp-server`
29
+
30
+ Key entrypoint:
31
+
32
+ - `<repo_root>/qingflow-support/mcp-server/qingflow-mcp`
33
+
34
+ If the path differs, stop and update all client config snippets before proceeding.
35
+ If the skill is installed under `$CODEX_HOME/skills` instead of the repo-local `.codex/skills`, set `QINGFLOW_MCP_ROOT=<repo_root>/qingflow-support/mcp-server` before running `scripts/check_local_server.sh`.
36
+
37
+ ### Step 2: Install local dependencies
38
+
39
+ Run:
40
+
41
+ ```bash
42
+ cd <repo_root>/qingflow-support/mcp-server
43
+ python3 -m venv .venv
44
+ ./.venv/bin/pip install -e '.[dev]'
45
+ ```
46
+
47
+ Use `scripts/check_local_server.sh` to verify the entrypoint and virtualenv. The script will first try `QINGFLOW_MCP_ROOT`, then the current git repo, then a repo-local `.codex/skills` layout.
48
+
49
+ ### Step 3: Configure the local AI client
50
+
51
+ For any stdio-compatible MCP client, map these values:
52
+
53
+ - `command`: `<repo_root>/qingflow-support/mcp-server/qingflow-mcp`
54
+ - `args`: `[]`
55
+ - `env.QINGFLOW_MCP_DEFAULT_BASE_URL`: the target backend URL for the active environment
56
+ - `env.QINGFLOW_MCP_DEFAULT_QF_VERSION`: set this when the environment must route to a specific version such as `canary`
57
+
58
+ Client-specific snippets:
59
+
60
+ - Claude Desktop: read [references/claude-desktop.md](references/claude-desktop.md)
61
+ - Generic stdio MCP clients: read [references/generic-stdio.md](references/generic-stdio.md)
62
+
63
+ When both test and production are in play, keep separate config snippets or clearly labeled `env` blocks so the user can switch without ambiguity.
64
+
65
+ ### Step 4: Validate startup
66
+
67
+ The server is a stdio MCP process. A direct terminal launch may print nothing and wait for a client. That is normal.
68
+
69
+ Manual startup command:
70
+
71
+ ```bash
72
+ cd <repo_root>/qingflow-support/mcp-server
73
+ ./qingflow-mcp
74
+ ```
75
+
76
+ Prefer validating through the client after config is added.
77
+
78
+ ### Step 5: Use injected session first; authenticate only for setup or recovery
79
+
80
+ For Wingent Momo runtime conversations, the session normally already carries the credential-derived token, workspace, and route context. Do not run `auth_use_credential`, `auth_login`, `workspace_list`, or `workspace_select` before ordinary business tools. Start with the smallest read-only business call that fits the task; if it succeeds, continue.
81
+
82
+ For a standalone local MCP client that has no injected session, use this setup order:
83
+
84
+ 1. `auth_use_credential` or `auth_login`
85
+ 2. `workspace_list`
86
+ 3. `workspace_select`
87
+ 4. Run a small read-only business tool
88
+
89
+ `auth_use_credential` gets the selected workspace from the credential context. If the user needs a different workspace after authentication, use `workspace_list` and then `workspace_select`.
90
+ After auth, prefer one read-only tool call that returns `request_route` so you can confirm the live `base_url` and `qf_version` before proceeding.
91
+ `auth_use_credential` is a tool call, not a custom HTTP header. It exchanges the createClaw credential for a Qingflow token, `wsId`, and when needed `Cookie: qfVersion=...` after the session is established.
92
+ Do not run `workspace_select` on production paths unless the user explicitly asks to switch workspace or a business tool clearly reports that no workspace is selected. If `/user` does not return a version lane, the session now falls back to the workspace `systemVersion`.
93
+
94
+ ### Step 6: Troubleshoot in the right layer
95
+
96
+ - If the client cannot launch the server, check path, execute permission, and `.venv`
97
+ - If tools return `auth required`, re-run `auth_use_credential` or `auth_login`
98
+ - If tools return `workspace not selected`, call `workspace_list` and `workspace_select`
99
+ - If calls fail after a working session, assume token expiry and re-authenticate
100
+ - If the browser shows data but MCP does not, compare `request_route` against the browser environment and check whether `qf_version` should be `canary`
101
+
102
+ ## Guardrails
103
+
104
+ - Never write tokens into the skill files
105
+ - In Wingent Momo runtime, trust injected workspace context until a business tool proves otherwise; for standalone clients, confirm workspace with `auth_whoami`, `workspace_select`, or a successful read-only business call.
106
+ - When debugging, distinguish server startup issues from Qingflow auth issues
107
+ - When the user mentions production, restate the exact `base_url`, `qf_version`, and workspace before any live validation
108
+ - If setup is complete but the current MCP capability is still unsupported or the user's need still cannot be satisfied, summarize the gap, ask whether to submit feedback, and call `feedback_submit` only after explicit user confirmation
109
+
110
+ ## Resources
111
+
112
+ - Environment switching: [references/environments.md](references/environments.md)
113
+ - Claude Desktop config: [references/claude-desktop.md](references/claude-desktop.md)
114
+ - Generic stdio config: [references/generic-stdio.md](references/generic-stdio.md)
115
+ - Local checks: [scripts/check_local_server.sh](scripts/check_local_server.sh)
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Qingflow MCP Setup"
3
+ short_description: "Install and connect the Qingflow MCP locally"
4
+ default_prompt: "Use $qingflow-mcp-setup to install and connect the Qingflow MCP in a local AI client, and to verify the active base_url, qf_version, auth state, and workspace selection."
@@ -0,0 +1,34 @@
1
+ # Claude Desktop
2
+
3
+ Use this when the user wants to install Qingflow MCP in Claude Desktop.
4
+
5
+ ## Config snippet
6
+
7
+ ```json
8
+ {
9
+ "mcpServers": {
10
+ "qingflow": {
11
+ "command": "<ABSOLUTE_PATH_TO_REPO>/qingflow-support/mcp-server/qingflow-mcp",
12
+ "args": [],
13
+ "env": {
14
+ "QINGFLOW_MCP_DEFAULT_BASE_URL": "<QINGFLOW_BASE_URL>"
15
+ }
16
+ }
17
+ }
18
+ }
19
+ ```
20
+
21
+ ## Environment examples
22
+
23
+ - `prod` (default): set `QINGFLOW_MCP_DEFAULT_BASE_URL` to `https://qingflow.com/api`
24
+ - `test`: if needed, set `QINGFLOW_MCP_DEFAULT_BASE_URL` to the explicitly provided non-production backend
25
+
26
+ Keep separate snippets for `test` and `prod` so switching environments does not require editing values in-place under pressure.
27
+
28
+ ## Notes
29
+
30
+ - After updating the config, restart Claude Desktop
31
+ - Replace `<ABSOLUTE_PATH_TO_REPO>` with the real checkout path on the current machine
32
+ - If the server path changes, update the `command` field
33
+ - The server is local stdio MCP, so no remote URL is required
34
+ - Do not store Qingflow credentials in Claude Desktop config; pass the createClaw credential through `auth_use_credential` inside the chat, or use `auth_login` when credential exchange is unavailable
@@ -0,0 +1,62 @@
1
+ # Environment Switching
2
+
3
+ Use this reference before any setup, authentication, or live validation flow.
4
+
5
+ ## Step 1: Resolve the active environment
6
+
7
+ Decide explicitly whether the user is targeting:
8
+
9
+ - `test`: for smoke tests, trial setup, DSL validation, mock data, and integration debugging
10
+ - `prod`: for real business usage in the formal environment
11
+
12
+ If the user did not specify an environment, default to `prod`.
13
+
14
+ ## Test Environment
15
+
16
+ Default characteristics:
17
+
18
+ - preferred for first-time setup and local MCP validation
19
+ - mock or smoke data is acceptable when the user asks for it
20
+ - use read/write verification freely inside the intended test workspace
21
+
22
+ Known values in the current workspace:
23
+
24
+ - use an explicitly provided non-production backend
25
+ - common test workspace example: `ws_id=2`
26
+ - `qf_version`: usually unset unless the user explicitly needs a routed version
27
+
28
+ Setup behavior:
29
+
30
+ - prefer this environment for Claude Desktop or local MCP client onboarding
31
+ - for Wingent Momo runtime, use the injected session and skip auth/workspace preflight
32
+ - for standalone MCP client setup, use `auth_use_credential` or `auth_login`, then `workspace_list`, then `workspace_select`
33
+ - if the user asks to verify installation, a real read-only smoke path is acceptable
34
+
35
+ ## Production Environment
36
+
37
+ Production is the default environment when the user does not specify one. If the user explicitly says `test`, switch to the dedicated non-production backend they provide.
38
+
39
+ Expected behavior:
40
+
41
+ - default `base_url`: `https://qingflow.com/api`
42
+ - confirm the production `qf_version` explicitly when browser traffic depends on routed versions such as `canary`
43
+ - confirm the exact workspace before any live validation
44
+ - prefer read-only checks first
45
+ - avoid mock data, smoke writes, or destructive tests unless the user explicitly asks for them
46
+
47
+ Production guardrails:
48
+
49
+ - do not store credentials in skill files or examples
50
+ - do not assume the same workspace ids as test
51
+ - treat startup verification and auth verification as separate steps
52
+ - when sharing snippets, label them as `prod` and `test` clearly
53
+ - when MCP and browser results diverge, compare `request_route` with the browser route before blaming the query logic
54
+
55
+ ## Reporting Rule
56
+
57
+ When you give setup instructions, always state:
58
+
59
+ - active environment
60
+ - selected `base_url`
61
+ - selected `qf_version` when relevant
62
+ - whether the next step is read-only or write-impacting
@@ -0,0 +1,32 @@
1
+ # Generic Stdio MCP Clients
2
+
3
+ Use this for any local AI client that supports MCP over stdio.
4
+
5
+ ## Required mapping
6
+
7
+ - `command`: `<ABSOLUTE_PATH_TO_REPO>/qingflow-support/mcp-server/qingflow-mcp`
8
+ - `args`: `[]`
9
+ - `env.QINGFLOW_MCP_DEFAULT_BASE_URL`: backend base URL for the active environment
10
+
11
+ Environment examples:
12
+
13
+ - `prod` (default): `https://qingflow.com/api`
14
+ - `test`: use the explicitly provided non-production backend
15
+
16
+ Keep separate client entries or separate config snippets for `test` and `prod`.
17
+
18
+ ## Validation sequence
19
+
20
+ 1. Start the client
21
+ 2. Confirm the `qingflow` MCP server is visible
22
+ 3. In Wingent Momo runtime, skip auth/workspace preflight and run a read-only tool such as `app_list`
23
+ 4. In a standalone client without injected credentials, run `auth_use_credential` or `auth_login`
24
+ 5. Then run `workspace_list`
25
+ 6. Then run `workspace_select`
26
+ 7. Run a read-only tool such as `app_list`
27
+
28
+ ## Common failures
29
+
30
+ - Launch failure: bad `command` path or missing `.venv`
31
+ - Auth failure: invalid or expired credential/token
32
+ - Business tool failure before setup: workspace not selected
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
5
+ ROOT="${QINGFLOW_MCP_ROOT:-}"
6
+
7
+ if [[ -z "$ROOT" ]]; then
8
+ if git_root="$(git rev-parse --show-toplevel 2>/dev/null)" && [[ -d "$git_root/qingflow-support/mcp-server" ]]; then
9
+ ROOT="$git_root/qingflow-support/mcp-server"
10
+ elif [[ -d "$PWD/qingflow-support/mcp-server" ]]; then
11
+ ROOT="$PWD/qingflow-support/mcp-server"
12
+ else
13
+ repo_root="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
14
+ if [[ -d "$repo_root/qingflow-support/mcp-server" ]]; then
15
+ ROOT="$repo_root/qingflow-support/mcp-server"
16
+ fi
17
+ fi
18
+ fi
19
+
20
+ if [[ -z "$ROOT" ]]; then
21
+ echo "Unable to locate qingflow-support/mcp-server. Set QINGFLOW_MCP_ROOT to the repo copy of the MCP server." >&2
22
+ exit 1
23
+ fi
24
+
25
+ ENTRY="$ROOT/qingflow-mcp"
26
+ PY="$ROOT/.venv/bin/python"
27
+
28
+ echo "ROOT=$ROOT"
29
+ test -d "$ROOT"
30
+ echo "OK root exists"
31
+
32
+ test -x "$ENTRY"
33
+ echo "OK entrypoint exists and is executable"
34
+
35
+ test -x "$PY"
36
+ echo "OK virtualenv python exists"
37
+
38
+ PYTHONPATH="$ROOT/src" "$PY" -c "import qingflow_mcp.server; print('OK import qingflow_mcp.server')"
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: qingflow-workflow-builder
3
+ description: |
4
+ 在已有的轻流应用中,根据业务建模使用 qingflow CLI 声明式搭建工作流。
5
+ 适用场景:应用已存在、字段已就绪,需要创建或更新审批/填写/网关/自动化/抄送流程。
6
+ 不适用场景:应用不存在或字段缺失——应先完成应用搭建(schema apply)再使用本 Skill。
7
+ ---
8
+
9
+ # 轻流工作流搭建 Skill
10
+
11
+ > **Skill 版本**:`qingflow-skills-2026.06.24.2`(入口文档版本;如需确认 CLI 包版本,使用 `qingflow --version` 或 `qingflow --json version`)。
12
+
13
+ ## 快速索引
14
+
15
+ | 主题 | 文件 |
16
+ |------|------|
17
+ | 依赖命令、能力边界 | [references/01-overview.md](references/01-overview.md) |
18
+ | 更新模式与最小修改原则 | [references/02-update-mode.md](references/02-update-mode.md) |
19
+ | 流程模式速查(线性/分支/回退) | [references/03-flow-patterns.md](references/03-flow-patterns.md) |
20
+ | 阶段 1:业务建模与自检 | [references/04-stage1-business-modeling.md](references/04-stage1-business-modeling.md) |
21
+ | 阶段 2:成员/角色搜索 | [references/05-stage2-members-roles.md](references/05-stage2-members-roles.md) |
22
+ | 阶段 3:Schema + 构建 Spec | [references/06-stage3-build-spec.md](references/06-stage3-build-spec.md) |
23
+ | 阶段 4:验证 Spec | [references/07-stage4-validate-spec.md](references/07-stage4-validate-spec.md) |
24
+ | 阶段 5:Apply + 验证循环 | [references/08-stage5-apply-verify.md](references/08-stage5-apply-verify.md) |
25
+ | 阶段 6:总结报告与回退 | [references/09-stage6-summary.md](references/09-stage6-summary.md) |
26
+ | 节点配置参考 | [references/10-node-config-reference.md](references/10-node-config-reference.md) |
27
+ | 常见问题与排障 | [references/11-troubleshooting.md](references/11-troubleshooting.md) |
28
+
29
+ ---
30
+
31
+ ## 一、思考(Thought):何时启用与前置条件
32
+
33
+ ### 触发条件
34
+
35
+ 当用户要求**在轻流应用中搭建工作流**时启用本 Skill,典型触发语:
36
+
37
+ - "帮我搭建审批流程"
38
+ - "在这个应用里创建工作流"
39
+ - "按照这张流程图实现工作流"
40
+ - "配置流程分支条件"
41
+ - "给这个应用加一个审批节点"
42
+
43
+ ### 前提检查(进入行动前必须完成)
44
+
45
+ 在开始任何搭建操作前,按顺序确认以下条件:
46
+
47
+ 1. **应用存在性**:`qingflow --json app get --app-key <APP_KEY>` 成功返回
48
+ 2. **字段就绪**:`qingflow --json builder app get --app-key <APP_KEY> fields` 返回字段列表,确认业务建模所需字段(如单选框、成员、部门字段)均已存在
49
+ 3. **未启用已有流程**(新建场景):`qingflow --json builder app get --app-key <APP_KEY> flow` 查看 `enabled` 状态,若已有流程则为**更新模式**
50
+
51
+ **不满足时的处理**:
52
+ - 应用不存在 → 先完成应用搭建和字段配置,再继续工作流搭建
53
+ - 字段缺失 → 先补充缺失的字段定义,再继续工作流搭建
54
+ - 应用已启用流程 → 进入更新模式(读取现有 spec 再修改)
55
+
56
+ ### 能力边界
57
+
58
+ | 在范围内 | 超出范围 |
59
+ |----------|----------|
60
+ | 基于已有应用搭建工作流 | 从零创建应用 |
61
+ | 声明式 WorkflowSpec 生成与 apply | 操作复杂命令拼接 |
62
+ | 分支条件(gateway + autoJudges)配置 | 后端不支持的高级特性 |
63
+ | 审批/填写/抄送/自动化节点配置 | 修改字段定义 |
64
+ | 成员/角色搜索用于节点负责人 | 组织架构管理 |
65
+ | 验证 → apply → 校验循环 | 前端 UI 拖拽操作 |
66
+
67
+ 完整命令与依赖说明见 [references/01-overview.md](references/01-overview.md)。
68
+ 本 Skill 中的 `scripts/...` 路径均以 `qingflow-workflow-builder/` 技能根目录为基准;执行脚本时先解析为该技能目录下的实际文件。
69
+
70
+ ---
71
+
72
+ ## 二、行动(Action):核心 SOP
73
+
74
+ 按顺序执行以下阶段,每个阶段详见对应 reference 文件:
75
+
76
+ | 阶段 | 任务 | 参考文件 |
77
+ |------|------|----------|
78
+ | 阶段 0 | 判断是否为更新模式,确认最小修改原则 | [references/02-update-mode.md](references/02-update-mode.md) |
79
+ | 阶段 1 | 提取业务建模,完成七维度业务自检 | [references/04-stage1-business-modeling.md](references/04-stage1-business-modeling.md) |
80
+ | 阶段 2 | 搜索成员/角色,用于节点负责人配置 | [references/05-stage2-members-roles.md](references/05-stage2-members-roles.md) |
81
+ | 阶段 3 | 获取 Schema、读取现有 Spec、构建新 Spec | [references/06-stage3-build-spec.md](references/06-stage3-build-spec.md) |
82
+ | 阶段 4 | 验证 Spec(JSON Schema + 自定义约束) | [references/07-stage4-validate-spec.md](references/07-stage4-validate-spec.md) |
83
+ | 阶段 5 | Apply 工作流并验证部署结果 | [references/08-stage5-apply-verify.md](references/08-stage5-apply-verify.md) |
84
+
85
+ 构建 Spec 前,若对流程模式有疑问,先查阅 [references/03-flow-patterns.md](references/03-flow-patterns.md)。
86
+
87
+ ---
88
+
89
+ ## 三、反思(Reflection):验证与总结
90
+
91
+ | 阶段 | 任务 | 参考文件 |
92
+ |------|------|----------|
93
+ | 阶段 6 | 输出结构化搭建报告,回顾业务完整性 | [references/09-stage6-summary.md](references/09-stage6-summary.md) |
94
+
95
+ 搭建失败时的回退策略、节点配置细节、常见问题排障分别见:
96
+ - [references/09-stage6-summary.md](references/09-stage6-summary.md)
97
+ - [references/10-node-config-reference.md](references/10-node-config-reference.md)
98
+ - [references/11-troubleshooting.md](references/11-troubleshooting.md)
@@ -0,0 +1,8 @@
1
+ identity: qingflow_workflow_builder
2
+ type: skill
3
+ description: 在轻流应用中搭建工作流。从业务建模提取流程结构(含业务完整性自检:规模分级、组织层级、异常路径、状态闭环、角色分离),映射为声明式 WorkflowSpec,通过 qingflow CLI 的 schema/get/apply 三步部署工作流,并验证分支条件与自动化节点配置一致性。
4
+ tags:
5
+ - qingflow
6
+ - workflow
7
+ - builder
8
+ - flow
@@ -0,0 +1,45 @@
1
+ # 轻流工作流搭建:概览与依赖
2
+
3
+ ## 关联文件
4
+
5
+ | 文件 | 说明 |
6
+ |------|------|
7
+ | `manifest.yaml` | 技能清单 |
8
+ | `SKILL.md` | 主流程入口 |
9
+ | `scripts/validate_flow_spec.py` | 工作流 Spec 验证脚本,基于 JSON Schema + 自定义约束 |
10
+ | `scripts/diff_flow_spec.py` | 新旧 Spec 差异分析脚本,辅助更新模式下最小修改原则判断 |
11
+
12
+ ---
13
+
14
+ ## 依赖声明
15
+
16
+ 本 Skill 关键依赖 **qingflow CLI**(已安装于 PATH,详见 `qingflow_cli` Skill)。以下 qingflow 命令为核心操作:
17
+
18
+ | 命令 | 用途 |
19
+ |------|------|
20
+ | `qingflow builder flow schema --json` | 获取最新 WorkflowSpecDTO JSON Schema |
21
+ | `qingflow builder flow get --app-key <KEY>` | 读取当前工作流 spec |
22
+ | `qingflow builder flow apply --app-key <KEY> --spec-file <FILE>` | 部署/更新工作流 |
23
+ | `qingflow builder member search --query <关键词>` | 搜索成员 |
24
+ | `qingflow builder role search --keyword <关键词>` | 搜索角色 |
25
+ | `qingflow --json app get --app-key <KEY>` | 获取应用信息(字段列表等) |
26
+ | `qingflow --json builder app get --app-key <KEY> fields` | 获取应用可搭建字段详情 |
27
+ | `qingflow --json builder app get --app-key <KEY> flow` | 获取流程摘要(是否启用等) |
28
+
29
+ ---
30
+
31
+ ## 能力边界
32
+
33
+ | 在范围内 | 超出范围 |
34
+ |----------|----------|
35
+ | 基于已有应用搭建工作流 | 从零创建应用 |
36
+ | 声明式 WorkflowSpec 生成与 apply | 操作复杂命令拼接 |
37
+ | 分支条件(gateway + autoJudges)配置 | 后端不支持的高级特性 |
38
+ | 审批/填写/抄送/自动化节点配置 | 修改字段定义 |
39
+ | 成员/角色搜索用于节点负责人 | 组织架构管理 |
40
+ | 验证 → apply → 校验循环 | 前端 UI 拖拽操作 |
41
+
42
+ ---
43
+
44
+ ← 返回主流程:[../SKILL.md](../SKILL.md)
45
+ → 下一步:[02-update-mode.md](02-update-mode.md)
@@ -0,0 +1,53 @@
1
+ # 更新模式与最小修改原则
2
+
3
+ 当应用已有工作流时,进入**更新模式**。核心原则是**最小修改**——只改动必要的部分,保持其他结构不变。
4
+
5
+ ## 为什么要保持节点 ID 稳定
6
+
7
+ 后端可能存储了 spec 中不支持的运行时配置(如审批策略、超时规则、高级权限等),这些配置与节点 ID 绑定。一旦修改节点 ID,后端会将其视为「删除旧节点 + 创建新节点」,导致不支持的配置全部丢失。
8
+
9
+ **因此:修改已有节点时,只改 attrs/name,绝不改 id。**
10
+
11
+ ## 最小修改原则速查
12
+
13
+ | 操作 | ✅ 正确做法 | ❌ 错误做法 |
14
+ |------|-----------|-----------|
15
+ | 添加节点 | 使用新 ID,追加到 nodes 末尾 | 重排已有节点 ID |
16
+ | 删除节点 | 删除对应 node 和关联边 | 不删关联边导致孤立边 |
17
+ | 修改节点配置 | 同一 ID 下只改 attrs/name | 改 ID 导致节点重建 |
18
+ | 添加边 | 追加到 edges 数组 | 修改已有边的 from/to |
19
+ | 修改条件 | 同一条边内改 condition | 删除边再新建 |
20
+ | 调整流转 | 修改边的 from/to | 改节点 ID 来适配 |
21
+
22
+ ## 使用 diff 脚本辅助判断
23
+
24
+ 在构建新 spec 后、apply 前,使用 diff 脚本对比新旧 spec:
25
+
26
+ ```bash
27
+ python3 scripts/diff_flow_spec.py tmp/current_flow.json tmp/flow_spec.json
28
+ ```
29
+
30
+ 输出会显示删除的节点/边、新增的节点/边、修改的节点/边,并自动评估是否符合最小修改原则。
31
+
32
+ 验证脚本也支持在更新模式下进行最小修改原则校验:
33
+
34
+ ```bash
35
+ python3 scripts/validate_flow_spec.py \
36
+ tmp/flow_spec.json \
37
+ --schema tmp/flow_schema.json \
38
+ --previous tmp/current_flow.json
39
+ ```
40
+
41
+ ## 更新模式 SOP 调整
42
+
43
+ 在更新模式下,阶段 3.2 变为**必须执行**(读取现有 spec),阶段 5.2 的对比验证增加最小修改原则检查:
44
+
45
+ - 节点 ID 不应无故变更
46
+ - 删除的节点/边应为业务需要,而非误删
47
+ - 修改范围应仅限于业务建模中变更的部分
48
+
49
+ ---
50
+
51
+ ← 上一步:[01-overview.md](01-overview.md)
52
+ ← 返回主流程:[../SKILL.md](../SKILL.md)
53
+ → 下一步:[03-flow-patterns.md](03-flow-patterns.md)