@pippit-dev/cli 1.0.21 → 1.0.22

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.
@@ -1,9 +1,9 @@
1
1
  XYQ Canvas Command Runtime - Bundled Software Notices
2
2
 
3
3
  Generated from the exact esbuild input graph. No build paths or timestamps are included.
4
- 10 Pippit first-party modules are bundled and are not listed by internal package name.
4
+ 12 Pippit first-party modules are bundled and are not listed by internal package name.
5
5
 
6
- ===== @babel/runtime@7.29.2 =====
6
+ ===== @babel/runtime@7.29.7 =====
7
7
  License metadata: MIT
8
8
 
9
9
  --- LICENSE ---
@@ -304,6 +304,212 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304
304
  See the License for the specific language governing permissions and
305
305
  limitations under the License.
306
306
 
307
+ ===== @swc/helpers@0.5.6 =====
308
+ License metadata: Apache-2.0
309
+
310
+ --- LICENSE ---
311
+ Apache License
312
+ Version 2.0, January 2004
313
+ http://www.apache.org/licenses/
314
+
315
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
316
+
317
+ 1. Definitions.
318
+
319
+ "License" shall mean the terms and conditions for use, reproduction,
320
+ and distribution as defined by Sections 1 through 9 of this document.
321
+
322
+ "Licensor" shall mean the copyright owner or entity authorized by
323
+ the copyright owner that is granting the License.
324
+
325
+ "Legal Entity" shall mean the union of the acting entity and all
326
+ other entities that control, are controlled by, or are under common
327
+ control with that entity. For the purposes of this definition,
328
+ "control" means (i) the power, direct or indirect, to cause the
329
+ direction or management of such entity, whether by contract or
330
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
331
+ outstanding shares, or (iii) beneficial ownership of such entity.
332
+
333
+ "You" (or "Your") shall mean an individual or Legal Entity
334
+ exercising permissions granted by this License.
335
+
336
+ "Source" form shall mean the preferred form for making modifications,
337
+ including but not limited to software source code, documentation
338
+ source, and configuration files.
339
+
340
+ "Object" form shall mean any form resulting from mechanical
341
+ transformation or translation of a Source form, including but
342
+ not limited to compiled object code, generated documentation,
343
+ and conversions to other media types.
344
+
345
+ "Work" shall mean the work of authorship, whether in Source or
346
+ Object form, made available under the License, as indicated by a
347
+ copyright notice that is included in or attached to the work
348
+ (an example is provided in the Appendix below).
349
+
350
+ "Derivative Works" shall mean any work, whether in Source or Object
351
+ form, that is based on (or derived from) the Work and for which the
352
+ editorial revisions, annotations, elaborations, or other modifications
353
+ represent, as a whole, an original work of authorship. For the purposes
354
+ of this License, Derivative Works shall not include works that remain
355
+ separable from, or merely link (or bind by name) to the interfaces of,
356
+ the Work and Derivative Works thereof.
357
+
358
+ "Contribution" shall mean any work of authorship, including
359
+ the original version of the Work and any modifications or additions
360
+ to that Work or Derivative Works thereof, that is intentionally
361
+ submitted to Licensor for inclusion in the Work by the copyright owner
362
+ or by an individual or Legal Entity authorized to submit on behalf of
363
+ the copyright owner. For the purposes of this definition, "submitted"
364
+ means any form of electronic, verbal, or written communication sent
365
+ to the Licensor or its representatives, including but not limited to
366
+ communication on electronic mailing lists, source code control systems,
367
+ and issue tracking systems that are managed by, or on behalf of, the
368
+ Licensor for the purpose of discussing and improving the Work, but
369
+ excluding communication that is conspicuously marked or otherwise
370
+ designated in writing by the copyright owner as "Not a Contribution."
371
+
372
+ "Contributor" shall mean Licensor and any individual or Legal Entity
373
+ on behalf of whom a Contribution has been received by Licensor and
374
+ subsequently incorporated within the Work.
375
+
376
+ 2. Grant of Copyright License. Subject to the terms and conditions of
377
+ this License, each Contributor hereby grants to You a perpetual,
378
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
379
+ copyright license to reproduce, prepare Derivative Works of,
380
+ publicly display, publicly perform, sublicense, and distribute the
381
+ Work and such Derivative Works in Source or Object form.
382
+
383
+ 3. Grant of Patent License. Subject to the terms and conditions of
384
+ this License, each Contributor hereby grants to You a perpetual,
385
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
386
+ (except as stated in this section) patent license to make, have made,
387
+ use, offer to sell, sell, import, and otherwise transfer the Work,
388
+ where such license applies only to those patent claims licensable
389
+ by such Contributor that are necessarily infringed by their
390
+ Contribution(s) alone or by combination of their Contribution(s)
391
+ with the Work to which such Contribution(s) was submitted. If You
392
+ institute patent litigation against any entity (including a
393
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
394
+ or a Contribution incorporated within the Work constitutes direct
395
+ or contributory patent infringement, then any patent licenses
396
+ granted to You under this License for that Work shall terminate
397
+ as of the date such litigation is filed.
398
+
399
+ 4. Redistribution. You may reproduce and distribute copies of the
400
+ Work or Derivative Works thereof in any medium, with or without
401
+ modifications, and in Source or Object form, provided that You
402
+ meet the following conditions:
403
+
404
+ (a) You must give any other recipients of the Work or
405
+ Derivative Works a copy of this License; and
406
+
407
+ (b) You must cause any modified files to carry prominent notices
408
+ stating that You changed the files; and
409
+
410
+ (c) You must retain, in the Source form of any Derivative Works
411
+ that You distribute, all copyright, patent, trademark, and
412
+ attribution notices from the Source form of the Work,
413
+ excluding those notices that do not pertain to any part of
414
+ the Derivative Works; and
415
+
416
+ (d) If the Work includes a "NOTICE" text file as part of its
417
+ distribution, then any Derivative Works that You distribute must
418
+ include a readable copy of the attribution notices contained
419
+ within such NOTICE file, excluding those notices that do not
420
+ pertain to any part of the Derivative Works, in at least one
421
+ of the following places: within a NOTICE text file distributed
422
+ as part of the Derivative Works; within the Source form or
423
+ documentation, if provided along with the Derivative Works; or,
424
+ within a display generated by the Derivative Works, if and
425
+ wherever such third-party notices normally appear. The contents
426
+ of the NOTICE file are for informational purposes only and
427
+ do not modify the License. You may add Your own attribution
428
+ notices within Derivative Works that You distribute, alongside
429
+ or as an addendum to the NOTICE text from the Work, provided
430
+ that such additional attribution notices cannot be construed
431
+ as modifying the License.
432
+
433
+ You may add Your own copyright statement to Your modifications and
434
+ may provide additional or different license terms and conditions
435
+ for use, reproduction, or distribution of Your modifications, or
436
+ for any such Derivative Works as a whole, provided Your use,
437
+ reproduction, and distribution of the Work otherwise complies with
438
+ the conditions stated in this License.
439
+
440
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
441
+ any Contribution intentionally submitted for inclusion in the Work
442
+ by You to the Licensor shall be under the terms and conditions of
443
+ this License, without any additional terms or conditions.
444
+ Notwithstanding the above, nothing herein shall supersede or modify
445
+ the terms of any separate license agreement you may have executed
446
+ with Licensor regarding such Contributions.
447
+
448
+ 6. Trademarks. This License does not grant permission to use the trade
449
+ names, trademarks, service marks, or product names of the Licensor,
450
+ except as required for reasonable and customary use in describing the
451
+ origin of the Work and reproducing the content of the NOTICE file.
452
+
453
+ 7. Disclaimer of Warranty. Unless required by applicable law or
454
+ agreed to in writing, Licensor provides the Work (and each
455
+ Contributor provides its Contributions) on an "AS IS" BASIS,
456
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
457
+ implied, including, without limitation, any warranties or conditions
458
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
459
+ PARTICULAR PURPOSE. You are solely responsible for determining the
460
+ appropriateness of using or redistributing the Work and assume any
461
+ risks associated with Your exercise of permissions under this License.
462
+
463
+ 8. Limitation of Liability. In no event and under no legal theory,
464
+ whether in tort (including negligence), contract, or otherwise,
465
+ unless required by applicable law (such as deliberate and grossly
466
+ negligent acts) or agreed to in writing, shall any Contributor be
467
+ liable to You for damages, including any direct, indirect, special,
468
+ incidental, or consequential damages of any character arising as a
469
+ result of this License or out of the use or inability to use the
470
+ Work (including but not limited to damages for loss of goodwill,
471
+ work stoppage, computer failure or malfunction, or any and all
472
+ other commercial damages or losses), even if such Contributor
473
+ has been advised of the possibility of such damages.
474
+
475
+ 9. Accepting Warranty or Additional Liability. While redistributing
476
+ the Work or Derivative Works thereof, You may choose to offer,
477
+ and charge a fee for, acceptance of support, warranty, indemnity,
478
+ or other liability obligations and/or rights consistent with this
479
+ License. However, in accepting such obligations, You may act only
480
+ on Your own behalf and on Your sole responsibility, not on behalf
481
+ of any other Contributor, and only if You agree to indemnify,
482
+ defend, and hold each Contributor harmless for any liability
483
+ incurred by, or claims asserted against, such Contributor by reason
484
+ of your accepting any such warranty or additional liability.
485
+
486
+ END OF TERMS AND CONDITIONS
487
+
488
+ APPENDIX: How to apply the Apache License to your work.
489
+
490
+ To apply the Apache License to your work, attach the following
491
+ boilerplate notice, with the fields enclosed by brackets "[]"
492
+ replaced with your own identifying information. (Don't include
493
+ the brackets!) The text should be enclosed in the appropriate
494
+ comment syntax for the file format. We also recommend that a
495
+ file or class name and description of purpose be included on the
496
+ same "printed page" as the copyright notice for easier
497
+ identification within third-party archives.
498
+
499
+ Copyright [yyyy] [name of copyright owner]
500
+
501
+ Licensed under the Apache License, Version 2.0 (the "License");
502
+ you may not use this file except in compliance with the License.
503
+ You may obtain a copy of the License at
504
+
505
+ http://www.apache.org/licenses/LICENSE-2.0
506
+
507
+ Unless required by applicable law or agreed to in writing, software
508
+ distributed under the License is distributed on an "AS IS" BASIS,
509
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
510
+ See the License for the specific language governing permissions and
511
+ limitations under the License.
512
+
307
513
  ===== dagre@0.8.5 =====
308
514
  License metadata: MIT
309
515
 
@@ -442,7 +648,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
442
648
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
443
649
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
444
650
 
445
- ===== lodash-es@4.18.1 =====
651
+ ===== lodash-es@4.17.21 =====
446
652
  License metadata: MIT
447
653
 
448
654
  --- LICENSE ---
@@ -546,6 +752,32 @@ maintained libraries used by this software which have their own
546
752
  licenses; we recommend you read them, as their terms may differ from the
547
753
  terms above.
548
754
 
755
+ ===== three@0.184.0 =====
756
+ License metadata: MIT
757
+
758
+ --- LICENSE ---
759
+ The MIT License
760
+
761
+ Copyright © 2010-2026 three.js authors
762
+
763
+ Permission is hereby granted, free of charge, to any person obtaining a copy
764
+ of this software and associated documentation files (the "Software"), to deal
765
+ in the Software without restriction, including without limitation the rights
766
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
767
+ copies of the Software, and to permit persons to whom the Software is
768
+ furnished to do so, subject to the following conditions:
769
+
770
+ The above copyright notice and this permission notice shall be included in
771
+ all copies or substantial portions of the Software.
772
+
773
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
774
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
775
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
776
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
777
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
778
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
779
+ THE SOFTWARE.
780
+
549
781
  ===== tslib@2.6.2 =====
550
782
  License metadata: 0BSD
551
783
 
@@ -1,2 +1,2 @@
1
- b41829890fa1b85e111d5d9a347662329252d45745458350296152973895e92f xyq-canvas-command-runtime.cjs
2
- 66987d59c420a3ee807363b8e936fa0dbad7d08ea4e1adf8d0fc9bcbe0eb685f xyq-canvas-command-runtime.cjs.LEGAL.txt
1
+ 19661847115778622c6fbfc8c02e8d4c958d4f5f7729d56d51f5c8008e780028 xyq-canvas-command-runtime.cjs
2
+ e915ba38d7f96e9fc85f584bacaafaaad0b7a0d02b5746d9eea57ec626ef12da xyq-canvas-command-runtime.cjs.LEGAL.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pippit-dev/cli",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Pippit CLI",
5
5
  "bin": {
6
6
  "pippit-tool-cli": "scripts/run.js"
@@ -9,8 +9,10 @@
9
9
  "postinstall": "node scripts/install.js",
10
10
  "prepack": "node scripts/prepare-canvas-runtime.js",
11
11
  "prepare:canvas-runtime": "node scripts/prepare-canvas-runtime.js",
12
- "test": "node scripts/version-check.test.js && node scripts/skills.test.js && node scripts/install-wizard.test.js && node scripts/canvas-command.test.js && node scripts/prepare-canvas-runtime.test.js && go test ./... && go vet ./...",
13
- "verify:canvas-runtime": "node scripts/prepare-canvas-runtime.js --check-only"
12
+ "test": "node scripts/version-check.test.js && node scripts/skills.test.js && node scripts/install-wizard.test.js && node scripts/run-help.test.js && node scripts/canvas-command.test.js && node scripts/canvas-command-schema.test.js && node scripts/canvas-command-guides.test.js && node scripts/prepare-canvas-runtime.test.js && node scripts/canvas-command-runtime.test.js && npm run test:canvas-operations && go test ./... && go vet ./...",
13
+ "verify:canvas-runtime": "node scripts/prepare-canvas-runtime.js --check-only",
14
+ "test:canvas-runtime": "node scripts/canvas-command-runtime.test.js",
15
+ "test:canvas-operations": "node scripts/canvas-command-canvas-operations.test.js && node scripts/canvas-command-scene3d-operations.test.js && node scripts/canvas-command-timeline-operations.test.js"
14
16
  },
15
17
  "os": [
16
18
  "darwin",
@@ -36,6 +38,8 @@
36
38
  "scripts/install.js",
37
39
  "scripts/install-wizard.js",
38
40
  "scripts/canvas-command.js",
41
+ "scripts/canvas-command-discovery.js",
42
+ "scripts/canvas-command-guides.js",
39
43
  "scripts/platform.js",
40
44
  "scripts/run.js",
41
45
  "scripts/skills.js",
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+
3
+ // These are views over the SDK contract. Only `schema` exports a complete schema.
4
+ const SCHEMA_VERSION = 2;
5
+ const PREFIX = "pippit-tool-cli canvas command";
6
+ const LIMITS = { list: 16 * 1024, describe: 32 * 1024 };
7
+
8
+ function category(name) {
9
+ if (name.startsWith("xyq.")) return name.split(".")[1];
10
+ if (name.includes("checkpoint")) return "checkpoint";
11
+ if (name.includes("asset")) return "asset";
12
+ return "canvas";
13
+ }
14
+
15
+ function summary(description = "") {
16
+ const first = description.replace(/\s+/g, " ").split(/(?<=[.!?。])\s+/)[0];
17
+ return first.length > 160 ? `${first.slice(0, 159)}…` : first;
18
+ }
19
+
20
+ function commandIndex(entry) {
21
+ return { name: entry.name, category: category(entry.name), summary: summary(entry.description) };
22
+ }
23
+
24
+ function listCatalog(entries, selectedCategory) {
25
+ const categories = [...new Set(entries.map((entry) => category(entry.name)))].sort((a, b) =>
26
+ a.localeCompare(b, "en"),
27
+ );
28
+ if (selectedCategory && !categories.includes(selectedCategory)) {
29
+ throw new Error(`未知分类:${selectedCategory};可选:${categories.join(", ")}`);
30
+ }
31
+ return {
32
+ schema_version: SCHEMA_VERSION,
33
+ categories,
34
+ commands: entries
35
+ .filter((entry) => !selectedCategory || category(entry.name) === selectedCategory)
36
+ .map(commandIndex),
37
+ next: {
38
+ describe: `${PREFIX} describe <command>`,
39
+ guides: `${PREFIX} guide`,
40
+ full_schema: `${PREFIX} schema [command]`,
41
+ },
42
+ };
43
+ }
44
+
45
+ function operationCatalog(entry) {
46
+ const field =
47
+ entry.name === "xyq.timeline.apply" ? "commands" : entry.name === "xyq.scene3d.apply" ? "operations" : undefined;
48
+ if (!field) return undefined;
49
+ const discriminator = field === "commands" ? "type" : "command";
50
+ const variants = entry.input_schema.properties[field].items.oneOf;
51
+ return { field, variants, discriminator };
52
+ }
53
+
54
+ function selectOperation(schema, catalog, name) {
55
+ const selected = catalog?.variants.find((variant) => variant.properties?.[catalog.discriminator]?.const === name);
56
+ if (!selected) throw new Error(`未知或不适用的 operation:${name};请先 describe 此命令查看 operations`);
57
+ const result = {
58
+ ...schema,
59
+ properties: { ...schema.properties, [catalog.field]: { ...schema.properties[catalog.field], items: selected } },
60
+ };
61
+ if (schema.examples)
62
+ result.examples = schema.examples.filter((example) =>
63
+ example[catalog.field]?.every((operation) => operation[catalog.discriminator] === name),
64
+ );
65
+ return result;
66
+ }
67
+
68
+ function selectNodeKind(schema, name) {
69
+ const kinds = schema.properties?.nodeKind?.enum;
70
+ if (!kinds?.includes(name)) throw new Error(`未知或不适用的 node-kind:${name};请先 describe create_biz_node`);
71
+ const matching = (schema.allOf || []).filter((branch) => branch.if?.properties?.nodeKind?.const === name);
72
+ const remaining = (schema.allOf || []).filter((branch) => !branch.if?.properties?.nodeKind);
73
+ let result = {
74
+ ...schema,
75
+ properties: { ...schema.properties, nodeKind: { ...schema.properties.nodeKind, const: name } },
76
+ };
77
+ delete result.properties.nodeKind.enum;
78
+ delete result.allOf;
79
+ if (schema.examples) result.examples = schema.examples.filter((example) => example.nodeKind === name);
80
+ if (remaining.length) result.allOf = remaining;
81
+ for (const { then: branch } of matching) {
82
+ result = {
83
+ ...result,
84
+ ...branch,
85
+ properties: { ...result.properties, ...branch.properties },
86
+ required: [...new Set([...(result.required || []), ...(branch.required || [])])],
87
+ };
88
+ }
89
+ return result;
90
+ }
91
+
92
+ function resolveSchemaPath(schema, schemaPath) {
93
+ if (!schemaPath) return schema;
94
+ let value = schema;
95
+ for (const key of schemaPath.split(".")) {
96
+ if (!key || !value || typeof value !== "object" || !Object.prototype.hasOwnProperty.call(value, key)) {
97
+ throw new Error(`不存在的 schema 路径:${schemaPath};使用 describe 输出中的 schema_path`);
98
+ }
99
+ value = value[key];
100
+ }
101
+ return value;
102
+ }
103
+
104
+ function childPath(parent, key) {
105
+ return parent ? `${parent}.${key}` : key;
106
+ }
107
+
108
+ function branchSummary(branch, schemaPath) {
109
+ if (!branch || typeof branch !== "object") return branch;
110
+ const selectors = Object.fromEntries(
111
+ Object.entries(branch.properties || branch.if?.properties || {})
112
+ .filter(([, value]) => value.const !== undefined || value.enum)
113
+ .map(([name, value]) => [name, value.const ?? value.enum]),
114
+ );
115
+ return {
116
+ schema_path: schemaPath,
117
+ ...(branch.type ? { type: branch.type } : {}),
118
+ ...(branch.description ? { description: summary(branch.description) } : {}),
119
+ ...(Object.keys(selectors).length ? { selectors } : {}),
120
+ };
121
+ }
122
+
123
+ function schemaView(value, schemaPath = "", depth = 1) {
124
+ if (!value || typeof value !== "object") return value;
125
+ if (Array.isArray(value)) return value.map((branch, index) => branchSummary(branch, childPath(schemaPath, index)));
126
+ const output = {};
127
+ for (const [key, child] of Object.entries(value)) {
128
+ const path = childPath(schemaPath, key);
129
+ if (key === "properties" && depth >= 0) {
130
+ output.properties = Object.fromEntries(
131
+ Object.entries(child).map(([name, property]) => [name, schemaView(property, childPath(path, name), depth - 1)]),
132
+ );
133
+ } else if (["oneOf", "anyOf", "allOf"].includes(key)) {
134
+ output[key] = child.map((branch, index) => branchSummary(branch, childPath(path, index)));
135
+ } else if (
136
+ ["items", "additionalProperties", "if", "then", "else", "not"].includes(key) &&
137
+ typeof child === "object"
138
+ ) {
139
+ output[key] = depth > 0 ? schemaView(child, path, depth - 1) : { schema_path: path, expand: true };
140
+ } else if (key === "properties" || key === "$defs" || key === "definitions" || key === "patternProperties") {
141
+ output[key] = { schema_path: path, expand: true };
142
+ } else if (JSON.stringify(child).length > 2048) {
143
+ output[key] = { schema_path: path, expand: true };
144
+ } else {
145
+ output[key] = child;
146
+ }
147
+ }
148
+ return output;
149
+ }
150
+
151
+ function describeEntry(entry, options, entries) {
152
+ const operations = operationCatalog(entry);
153
+ let schema = entry.input_schema;
154
+ if (options.operation) schema = selectOperation(schema, operations, options.operation);
155
+ if (options.nodeKind) schema = selectNodeKind(schema, options.nodeKind);
156
+ const schemaPath = options.schemaPath || "";
157
+ const result = {
158
+ schema_version: SCHEMA_VERSION,
159
+ name: entry.name,
160
+ category: category(entry.name),
161
+ description: entry.description,
162
+ schema_view: "summary",
163
+ schema_note:
164
+ "Display only: nested schemas and conditional branches are indexed by schema_path. Use --path to expand a field; use schema to export the complete validation contract.",
165
+ ...(options.operation ? { operation: options.operation } : {}),
166
+ ...(options.nodeKind ? { node_kind: options.nodeKind } : {}),
167
+ ...(schemaPath ? { schema_path: schemaPath } : {}),
168
+ input_schema: schemaView(resolveSchemaPath(schema, schemaPath), schemaPath),
169
+ schema_export: `${PREFIX} schema ${entry.name}`,
170
+ };
171
+ if (options.operation && !schemaPath) {
172
+ const path = `properties.${operations.field}.items`;
173
+ result.input_schema.properties[operations.field].items = schemaView(resolveSchemaPath(schema, path), path);
174
+ }
175
+ if (!schemaPath && !options.operation && operations) {
176
+ result.operations = operations.variants.map((variant) => ({
177
+ name: variant.properties[operations.discriminator].const,
178
+ summary: summary(variant.description || variant.properties[operations.discriminator].const.replace(/_/g, " ")),
179
+ }));
180
+ result.describe_operation = `${PREFIX} describe ${entry.name} --operation <name>`;
181
+ }
182
+ if (!schemaPath && !options.nodeKind && schema.properties?.nodeKind?.enum) {
183
+ result.node_kinds = schema.properties.nodeKind.enum;
184
+ result.describe_node_kind = `${PREFIX} describe ${entry.name} --node-kind <kind>`;
185
+ }
186
+ if (!schemaPath && (entry.name === "apply_mutations" || entry.name === "invoke_command")) {
187
+ result.related_commands = entries.filter((item) => item.name !== entry.name).map((item) => item.name);
188
+ result.describe_related = `${PREFIX} describe <command>`;
189
+ }
190
+ result.guide = `${PREFIX} guide`;
191
+ return result;
192
+ }
193
+
194
+ function assertOutputBudget(value, action) {
195
+ const limit = LIMITS[action];
196
+ if (limit && Buffer.byteLength(`${JSON.stringify(value, null, 2)}\n`) > limit) {
197
+ throw new Error(`${action} 输出超过 ${limit / 1024} KiB 预算;请使用更具体的筛选或 schema 显式导出`);
198
+ }
199
+ return value;
200
+ }
201
+
202
+ module.exports = { assertOutputBudget, describeEntry, listCatalog, SCHEMA_VERSION };