From 32978ba9db927b59b92082c2750c257addce11b4 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 8 Oct 2026 10:03:40 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20npm=20=E5=8C=85=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=89=93=E5=85=A5=20examples/jeepay=20=E8=AF=AD=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 插件运行时(CLI、生成与校验脚本、viewer)不读取 examples/,它只是仓库内的 测试与演示语料。从 package.json 的 files 中移除,包内文件 102 → 88, 解压体积 3.45 MB → 3.28 MB。 - graph-schema.md 的时序示例指针改为 GitHub 链接,安装后仍可查阅 - 打包测试改为断言包内不含 examples/,示例输入改从仓库读取 --- package.json | 3 +-- skills/q-flow/references/graph-schema.md | 2 +- tests/plugin-package.test.mjs | 11 +++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 666b365..2266bcf 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,7 @@ "skills/q-flow/assets/viewer/src/layout-refinement.js", "skills/q-flow/assets/viewer/src/layout-templates.js", "skills/q-flow/assets/viewer/src/presentation-graph.js", - "skills/q-flow/assets/viewer/src/layout-semantics.js", - "examples/jeepay/" + "skills/q-flow/assets/viewer/src/layout-semantics.js" ], "scripts": { "package": "node scripts/package.mjs" diff --git a/skills/q-flow/references/graph-schema.md b/skills/q-flow/references/graph-schema.md index d568cea..2a9896b 100644 --- a/skills/q-flow/references/graph-schema.md +++ b/skills/q-flow/references/graph-schema.md @@ -190,7 +190,7 @@ For an explicitly requested conceptual example, describe the relevant business m ### Execution, pairing and nested fragments -See `examples/jeepay/sequence.graph.json` in the repository and package for source-backed unified-order calls, explicit returns, executions and the success callback fragment. The Viewer keeps these fields optional, so legacy graphs still render; the CLI validator requires a bar on the callee of every `sync` call answered by a `return`, from the call's `receive` to the return's `send` (legacy graphs without `replyTo` are never asked). `--fix` adds the missing bars, each nested in the innermost bar of that participant around it. Two answered calls to one callee that interleave (the second opens inside the first and closes after it) are not asked for bars, since bars on one participant cannot cross. New source-grounded sequences must explicitly author known executions, nesting and call/return references; the renderer does not infer bars from paired messages. Include only fragment behavior established by the source. These fields require a Viewer built with sequence execution support. +See [`examples/jeepay/sequence.graph.json`](https://github.com/supermax92/qgraphflow/blob/main/examples/jeepay/sequence.graph.json) in the repository for source-backed unified-order calls, explicit returns, executions and the success callback fragment. The Viewer keeps these fields optional, so legacy graphs still render; the CLI validator requires a bar on the callee of every `sync` call answered by a `return`, from the call's `receive` to the return's `send` (legacy graphs without `replyTo` are never asked). `--fix` adds the missing bars, each nested in the innermost bar of that participant around it. Two answered calls to one callee that interleave (the second opens inside the first and closes after it) are not asked for bars, since bars on one participant cannot cross. New source-grounded sequences must explicitly author known executions, nesting and call/return references; the renderer does not infer bars from paired messages. Include only fragment behavior established by the source. These fields require a Viewer built with sequence execution support. A return declares `"replyTo": "call-id"`. It must reference an earlier sync/async call with reversed endpoints, in the same operand path, with at most one explicit return per call. Merge alternative outcomes before that return. Unpaired legacy messages stay legal. Paired labels display `C1` / `↩ C1` independently of editable text. Call and return share a color; nested calls form separate groups. Eight group colors are reused deterministically per theme; larger graphs retain unique pair IDs even when colors repeat. Node module colors are independent. diff --git a/tests/plugin-package.test.mjs b/tests/plugin-package.test.mjs index c4433ef..b130a2d 100644 --- a/tests/plugin-package.test.mjs +++ b/tests/plugin-package.test.mjs @@ -143,10 +143,9 @@ test('the distributed plugin runs independently from its installed location', t 'skills/q-flow/assets/viewer/src/radix-colors.js', 'skills/q-flow/assets/viewer/src/edge-routing.js', 'skills/q-flow/assets/viewer/src/diagrams/registry.js', 'skills/q-flow/assets/viewer/src/export-svg.js', 'skills/q-flow/assets/viewer/src/node-svg.js', - 'README.md', ...guides, 'examples/jeepay/flowchart.graph.json', 'bin/qgraphflow.mjs' + 'README.md', ...guides, 'bin/qgraphflow.mjs' ]) assert.ok(files.has(required), `Missing packaged file: ${required}`); - assert.ok(files.has('examples/jeepay/collection.graph.json')); - assert.ok([...files].filter(file => file.startsWith('examples/')).every(file => file.startsWith('examples/jeepay/'))); + assert.ok(![...files].some(file => file.startsWith('examples/')), 'Example corpora stay in the repository'); assert.ok(!files.has('docs/images/order-flow.svg')); // Fixed ELK runtime adds about 1.6MB; retain a bounded total install budget. assert.ok(packed.unpackedSize < 4_000_000, `Unexpected install size: ${packed.unpackedSize}`); @@ -186,9 +185,9 @@ test('the distributed plugin runs independently from its installed location', t } const installedManifest = readJson(path.join(plugin, 'package.json')); assert.deepEqual([installedManifest.bin, installedManifest.engines], [pkg.bin, pkg.engines], 'npx and npm resolve the command and the Node range'); - assert.match(run(process.execPath, ['bin/qgraphflow.mjs', 'validate', 'examples/jeepay/flowchart.graph.json', '--input-only'], plugin), /"valid":true/); + assert.match(run(process.execPath, ['bin/qgraphflow.mjs', 'validate', path.join(root, 'examples/jeepay/flowchart.graph.json'), '--input-only'], plugin), /"valid":true/); const graphPath = path.join(temp, '输入 graph.json'); - fs.copyFileSync(path.join(plugin, 'examples/jeepay/flowchart.graph.json'), graphPath); + fs.copyFileSync(path.join(root, 'examples/jeepay/flowchart.graph.json'), graphPath); const scripts = path.join(plugin, 'skills/q-flow/scripts'); run(process.execPath, [path.join(scripts, 'validate-graph.mjs'), graphPath, '--input-only'], temp); const output = path.join(temp, '项目输出'); @@ -257,6 +256,6 @@ test('the distributed plugin runs independently from its installed location', t assert.deepEqual(fs.readFileSync(path.join(npmPlugin, file)), fs.readFileSync(path.join(plugin, file)), file); if (file !== 'package.json') assert.deepEqual(fs.readFileSync(path.join(npmPlugin, file)), originalRuntime.get(file), file); } - run(process.execPath, [path.join(npmPlugin, 'skills/q-flow/scripts/generate-viewer.mjs'), path.join(npmPlugin, 'examples/jeepay/flowchart.graph.json'), path.join(temp, 'npm-graph')], temp); + run(process.execPath, [path.join(npmPlugin, 'skills/q-flow/scripts/generate-viewer.mjs'), path.join(root, 'examples/jeepay/flowchart.graph.json'), path.join(temp, 'npm-graph')], temp); assert.deepEqual(fs.readdirSync(path.join(temp, 'npm-graph')).sort(), ['diagram.svg', 'graph.json', 'index.html']); });