@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.
- package/README.md +65 -1
- package/checksums.txt +6 -6
- package/cmd/canvas/canvas.go +2 -0
- package/cmd/canvas/canvas_test.go +2 -2
- package/cmd/canvas/command_help.go +40 -0
- package/cmd/root.go +4 -3
- package/cmd/root_test.go +38 -0
- package/dist/checksums.txt +6 -6
- package/dist/xyq-canvas-command-runtime.cjs +14 -14
- package/dist/xyq-canvas-command-runtime.cjs.LEGAL.txt +235 -3
- package/dist/xyq-canvas-command-runtime.cjs.sha256 +2 -2
- package/package.json +7 -3
- package/scripts/canvas-command-discovery.js +202 -0
- package/scripts/canvas-command-guides.js +171 -0
- package/scripts/canvas-command.js +100 -23
- package/scripts/install-wizard.js +46 -22
- package/scripts/run.js +58 -42
package/README.md
CHANGED
|
@@ -249,9 +249,21 @@ pippit-tool-cli canvas apply --project-id PROJECT_ID --file ./patch.json
|
|
|
249
249
|
通过 npm 安装的 CLI 还提供基于同一 Canvas SDK 的语义命令目录:
|
|
250
250
|
|
|
251
251
|
```bash
|
|
252
|
-
#
|
|
252
|
+
# 先看精简目录,再按类别或参数定位
|
|
253
253
|
pippit-tool-cli canvas command list
|
|
254
|
+
pippit-tool-cli canvas command list --category timeline
|
|
254
255
|
pippit-tool-cli canvas command describe create_biz_node
|
|
256
|
+
pippit-tool-cli canvas command describe create_biz_node --node-kind role
|
|
257
|
+
pippit-tool-cli canvas command describe xyq.timeline.apply --operation set_output_size
|
|
258
|
+
pippit-tool-cli canvas command describe xyq.generation.update_prompt --path properties.prompt
|
|
259
|
+
|
|
260
|
+
# 完整 schema 按需导出;不指定命令时导出全部
|
|
261
|
+
pippit-tool-cli canvas command schema xyq.timeline.apply
|
|
262
|
+
pippit-tool-cli canvas command schema
|
|
263
|
+
|
|
264
|
+
# 离线指南:先取主题索引,再读正文
|
|
265
|
+
pippit-tool-cli canvas command guide
|
|
266
|
+
pippit-tool-cli canvas command guide storyboard
|
|
255
267
|
|
|
256
268
|
# 由 SDK 业务工厂创建角色节点;修改会通过现有 canvas apply 原子提交
|
|
257
269
|
pippit-tool-cli canvas command run create_biz_node \
|
|
@@ -261,6 +273,58 @@ pippit-tool-cli canvas command run create_biz_node \
|
|
|
261
273
|
|
|
262
274
|
`canvas command` 由 npm 包内固定的 Canvas SDK 运行时提供,复用网页登录、`canvas get`、`canvas allocate` 和 `canvas apply`;不会读取或打印 Access Key,也不直接选择服务端地址。公开目录只包含已登记的 mutation 和业务命令,不开放任意内部 command 调用。
|
|
263
275
|
|
|
276
|
+
`list [--category <category>]` 返回精简命令目录;`describe <command>` 说明入口参数,按 `--operation <name>` 查看一种领域操作、按 `--node-kind <kind>` 查看业务节点初始字段、按 `--path <schema.path>` 查看 schema 子路径。需要完整嵌套结构时使用 `schema [command]` 显式导出。`create_biz_node.nodeKind` 包含 `scene3d` 与 `timeline-composition`;字段枚举、必填项、默认值与动态来源以当前安装版本的 schema 为准。
|
|
277
|
+
|
|
278
|
+
发现输出使用 `schema_version: 2`:`list` 只包含名称、分类和摘要;`describe` 的 `schema_view: "summary"` 表示展示视图,嵌套内容通过 `schema_path` 继续展开,不能直接当作完整校验 schema。原来从 `list` 或 `describe` 读取完整 `input_schema` 的脚本应改用 `schema [command]`。默认索引预算为 16 KiB,单次字段说明预算为 32 KiB;完整导出需要显式调用,执行命令的输入与返回值不受这一发现协议调整影响。
|
|
279
|
+
|
|
280
|
+
`guide [topic]` 提供无需登录的离线帮助。无主题时仅返回索引,可选 `storyboard`、`prompt-references`、`time`、`timeline`、`scene3d`;正文包含单位、ID 来源、前置条件和最小示例。指南不启用新能力,先用 `list` 确认本机运行时支持哪些命令。故事板指南说明原生 `<duration-ms>` 标签累加与引用格式;目前没有公开的故事板脚本编辑、镜头排序或指定镜头生成领域命令,通用视频生成与资产补丁不能替代其业务流程。
|
|
281
|
+
|
|
282
|
+
3D 导演台和多轨道都通过外层画布节点定位,其编辑内容保存在节点引用的独立文档或草稿资产中。先查询取得内部对象、轨道、片段 ID 和版本,再执行编辑:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
pippit-tool-cli canvas command describe xyq.scene3d.apply
|
|
286
|
+
pippit-tool-cli canvas command run xyq.scene3d.query \
|
|
287
|
+
--canvas-id CANVAS_ID --input '{"nodeId":"DIRECTOR_NODE_ID"}'
|
|
288
|
+
pippit-tool-cli canvas command run xyq.scene3d.apply \
|
|
289
|
+
--canvas-id CANVAS_ID \
|
|
290
|
+
--input '{"nodeId":"DIRECTOR_NODE_ID","operations":[{"command":"create_node","args":{"kind":"camera","id":"camera-2","name":"Close-up"}}]}'
|
|
291
|
+
|
|
292
|
+
pippit-tool-cli canvas command describe xyq.timeline.apply
|
|
293
|
+
pippit-tool-cli canvas command run xyq.timeline.query \
|
|
294
|
+
--canvas-id CANVAS_ID --input '{"nodeId":"TIMELINE_NODE_ID"}'
|
|
295
|
+
# expectedRevision 使用上一步返回的 draft.revision
|
|
296
|
+
pippit-tool-cli canvas command run xyq.timeline.apply \
|
|
297
|
+
--canvas-id CANVAS_ID \
|
|
298
|
+
--input '{"nodeId":"TIMELINE_NODE_ID","expectedRevision":0,"commands":[{"type":"set_output_size","payload":{"width":1920,"height":1080}}]}'
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
领域命令的 `dryRun:true` 会完整预演编辑并保留原文档。多轨时间以整数微秒表示;3D 关键帧以帧表示,动作片段 `trimStart/trimEnd` 以源动画秒数表示。3D 对象旋转以度表示,几何体的 `theta/phi/arc` 参数以弧度表示,具体以字段 schema 为准。新增多轨素材须复用已有来源,或关联真实画布素材节点。截图、渲染导出、上传和生成仍需各自的运行环境。
|
|
302
|
+
|
|
303
|
+
运行结构为 `npm 的 JS 入口 → Canvas SDK CJS → Go 二进制的资产命令`。Go 二进制可独立执行其原生命令,无需安装 Go;`canvas command` 需要 npm 包中的 Node.js 入口与 CJS 运行时。
|
|
304
|
+
|
|
305
|
+
图片或视频节点通过 `xyq.generation.update_prompt` 更新提示词,`prompt` 直接使用前端已有的标签文本。CLI 与前端粘贴调用同一份 SDK 标签解析、引用匹配和连边逻辑:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
pippit-tool-cli canvas command describe xyq.generation.update_prompt
|
|
309
|
+
pippit-tool-cli canvas command run xyq.generation.update_prompt \
|
|
310
|
+
--canvas-id CANVAS_ID \
|
|
311
|
+
--input '{"nodeId":"TARGET_IMAGE_NODE_ID","prompt":"参考 <node-asset label=\"人物\">REFERENCE_IMAGE_NODE_ID</node-asset> 的人物,改为雨夜街景"}'
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
示例 ID 应替换为查询到的真实节点或资产 ID。`get_asset` 可查看当前节点与草稿;`describe` 按需查看参数,`schema` 导出完整输入结构。角色连边沿用前端既有默认选择与草稿处理,标签属性原样保留给编辑器和提交解析器。无需另传 `text/reference` 数组、`asset` 包装或 `referenceSource`;引用类型和独立素材前置条件可查看 `guide prompt-references`。
|
|
315
|
+
|
|
316
|
+
直接上传或从素材库选出的素材可以没有节点。对于已在目标 `generation.references` 草稿中的素材,直接使用其 `pippitAssetId`:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
pippit-tool-cli canvas command run xyq.generation.update_prompt \
|
|
320
|
+
--canvas-id CANVAS_ID \
|
|
321
|
+
--input '{"nodeId":"TARGET_IMAGE_NODE_ID","prompt":"参考 <pippit-asset-id label=\"参考图\">PIPPIT_ASSET_ID_IN_DRAFT</pippit-asset-id> 的人物"}'
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
当前版本只解析已有画布候选与目标草稿中的引用;找不到的普通标签返回 `UNRESOLVED_PROMPT_REFERENCE`,不写入文档。仅拿到 `canvas upload` 返回的 ID,还不会自动查询并加入草稿。新独立素材 ID 的自动解析属于后续能力。已有独立素材草稿可由前端上传或素材库流程产生,视频生成可使用其中的图片、视频和音频。同一媒体 ID 若同时匹配到画布源节点,则遵循前端现有的节点优先规则建立关联。`canvas get --asset-id PIPPIT_ASSET_ID` 可查询外部素材,但查询本身不添加引用。
|
|
325
|
+
|
|
326
|
+
该命令先在隔离文档上按前端原有顺序执行 SDK commands,再把实际补丁一次性提交,保留模型参数、已有引用及 caption/title/name 等展示字段。`dryRun:true` 只执行隔离预演,原文档和撤销历史不变;清空 prompt 不移除引用。节点引用由现有生成流程转换成 `node_asset_refs`,独立图片进入 `pippit_asset_ids`,视频生成的独立素材按类型进入 `images`、`videos`、`audios`。本命令不触发生成、上传或远端素材查询。不要用浅合并的 `update_asset.contentPatch.generation` 更新提示词,否则可能覆盖其他生成参数。
|
|
327
|
+
|
|
264
328
|
## 生图 CLI
|
|
265
329
|
|
|
266
330
|
`generate-image` 会上传本地参考图片,然后向综合 Nest Agent 提交生图请求:
|
package/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
0ff3b8e87e45b5c39546b74588f7c45ffe5d463cc3618807855f498ed8bfa733 pippit-tool-cli-1.0.22-darwin-amd64.tar.gz
|
|
2
|
+
1deea5a6c69b88146319eeca111cb121ffa24d28253a5d043b2985846ebeb602 pippit-tool-cli-1.0.22-darwin-arm64.tar.gz
|
|
3
|
+
823e08be7d8a2a36176b95dc01a1b12d2dd50edb80901467629507a9ac5ff245 pippit-tool-cli-1.0.22-linux-amd64.tar.gz
|
|
4
|
+
c286697382d43023657bca553c2ad5e34181e95329c4c702323eef00f6d8b279 pippit-tool-cli-1.0.22-linux-arm64.tar.gz
|
|
5
|
+
ec53eae18219ce6456eebc43ba607f646c323b7e7f852d99d7e596e04fbd5591 pippit-tool-cli-1.0.22-windows-amd64.zip
|
|
6
|
+
a913cc47ef12eaa71ffb7de4d4e58286351491fa3109d87fa62fe84001dcc1a4 pippit-tool-cli-1.0.22-windows-arm64.zip
|
package/cmd/canvas/canvas.go
CHANGED
|
@@ -23,6 +23,7 @@ func NewCommand(stdout, stderr io.Writer, runner *common.Runner) *cobra.Command
|
|
|
23
23
|
cmd := &cobra.Command{
|
|
24
24
|
Use: "canvas",
|
|
25
25
|
Short: "Create and operate personal novel canvases",
|
|
26
|
+
Long: "Create and operate personal novel canvases.\n\n" + CommandDiscoveryHelp,
|
|
26
27
|
Args: cobra.NoArgs,
|
|
27
28
|
}
|
|
28
29
|
cmd.SetOut(stdout)
|
|
@@ -32,6 +33,7 @@ func NewCommand(stdout, stderr io.Writer, runner *common.Runner) *cobra.Command
|
|
|
32
33
|
cmd.AddCommand(newAllocateCommand(stdout, stderr, runner))
|
|
33
34
|
cmd.AddCommand(newApplyCommand(stdout, stderr, runner))
|
|
34
35
|
cmd.AddCommand(newUploadCommand(stdout, stderr, runner))
|
|
36
|
+
cmd.AddCommand(newCommandHelp())
|
|
35
37
|
return cmd
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -40,8 +40,8 @@ func TestCommandExposesOnlyProviderNeutralPublicVerbs(t *testing.T) {
|
|
|
40
40
|
for _, child := range cmd.Commands() {
|
|
41
41
|
got = append(got, child.Name())
|
|
42
42
|
}
|
|
43
|
-
if strings.Join(got, ",") != "allocate,apply,create,get,upload" {
|
|
44
|
-
t.Fatalf("commands = %v, want allocate/apply/create/get/upload", got)
|
|
43
|
+
if strings.Join(got, ",") != "allocate,apply,command,create,get,upload" {
|
|
44
|
+
t.Fatalf("commands = %v, want allocate/apply/command/create/get/upload", got)
|
|
45
45
|
}
|
|
46
46
|
for _, forbidden := range []string{"import", "bind", "team"} {
|
|
47
47
|
if strings.Contains(strings.ToLower(cmd.CommandPath()+" "+cmd.Short+" "+strings.Join(got, " ")), forbidden) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package canvas
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
|
|
6
|
+
"github.com/spf13/cobra"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
// CommandDiscoveryHelp connects native transport help to the npm command catalogue.
|
|
10
|
+
const CommandDiscoveryHelp = `Canvas command catalogue (provided by the npm launcher):
|
|
11
|
+
pippit-tool-cli canvas command list [--category <category>]
|
|
12
|
+
pippit-tool-cli canvas command describe <name> [--operation <operation>] [--node-kind <kind>] [--path <schema.path>]
|
|
13
|
+
pippit-tool-cli canvas command schema [name]
|
|
14
|
+
pippit-tool-cli canvas command guide [topic]
|
|
15
|
+
pippit-tool-cli canvas command run <name> --canvas-id <id> [--input <JSON> | --file <path|->]
|
|
16
|
+
|
|
17
|
+
Start with list, inspect inputs with describe/schema, then read guide for workflows.
|
|
18
|
+
Use the pippit-tool-cli installed by npm, or node <package>/scripts/run.js.
|
|
19
|
+
The standalone native binary provides Canvas transport commands and this help;
|
|
20
|
+
executing the command catalogue requires the npm launcher.`
|
|
21
|
+
|
|
22
|
+
func newCommandHelp() *cobra.Command {
|
|
23
|
+
return &cobra.Command{
|
|
24
|
+
Use: "command",
|
|
25
|
+
Short: "Discover list, describe, schema, guide, and run via the npm launcher",
|
|
26
|
+
Long: CommandDiscoveryHelp,
|
|
27
|
+
DisableFlagParsing: true,
|
|
28
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
29
|
+
if len(args) == 0 || (len(args) == 1 && (args[0] == "--help" || args[0] == "-h")) {
|
|
30
|
+
return cmd.Help()
|
|
31
|
+
}
|
|
32
|
+
switch args[0] {
|
|
33
|
+
case "list", "describe", "schema", "guide", "run":
|
|
34
|
+
return fmt.Errorf("canvas command %s requires the npm launcher; use the npm-installed pippit-tool-cli or node <package>/scripts/run.js canvas command %s; the standalone native binary cannot execute this command", args[0], args[0])
|
|
35
|
+
default:
|
|
36
|
+
return fmt.Errorf("unknown canvas command action %q; expected list, describe, schema, guide, or run via the npm launcher; see canvas command --help", args[0])
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
}
|
package/cmd/root.go
CHANGED
|
@@ -54,9 +54,10 @@ func newRunnerAuthorizer(runner *common.Runner) common.RequestAuthorizer {
|
|
|
54
54
|
|
|
55
55
|
func newRootCommand(stdout, stderr io.Writer, runner *common.Runner) *cobra.Command {
|
|
56
56
|
root := &cobra.Command{
|
|
57
|
-
Use:
|
|
58
|
-
Short:
|
|
59
|
-
Long:
|
|
57
|
+
Use: "pippit-tool-cli",
|
|
58
|
+
Short: "Pippit CLI",
|
|
59
|
+
Long: "Pippit CLI generates and processes videos and images, queries credit balances, submits short-drama workflows, downloads generated assets, and updates the installed CLI package.\n\n" +
|
|
60
|
+
canvascmd.CommandDiscoveryHelp + "\n\nInstallation help (npm launcher): pippit-tool-cli install --help",
|
|
60
61
|
Version: version.Current(),
|
|
61
62
|
SilenceUsage: true,
|
|
62
63
|
SilenceErrors: true,
|
package/cmd/root_test.go
CHANGED
|
@@ -67,3 +67,41 @@ func TestRootRegistersTopLevelBrowserAuthCommands(t *testing.T) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
func TestHelpDiscoversNpmCanvasCommands(t *testing.T) {
|
|
72
|
+
for _, args := range [][]string{{"--help"}, {"canvas", "--help"}, {"canvas", "command", "--help"}, {"canvas", "command"}} {
|
|
73
|
+
t.Run(strings.Join(args, " "), func(t *testing.T) {
|
|
74
|
+
var stdout, stderr bytes.Buffer
|
|
75
|
+
root := NewRootCommand(&stdout, &stderr)
|
|
76
|
+
root.SetArgs(args)
|
|
77
|
+
if err := root.Execute(); err != nil {
|
|
78
|
+
t.Fatalf("Execute() error = %v", err)
|
|
79
|
+
}
|
|
80
|
+
for _, action := range []string{"list", "describe", "schema", "guide", "run"} {
|
|
81
|
+
if !strings.Contains(stdout.String(), "canvas command "+action) {
|
|
82
|
+
t.Fatalf("help does not expose %s: %s", action, stdout.String())
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if !strings.Contains(stdout.String(), "npm launcher") {
|
|
86
|
+
t.Fatalf("help does not explain launcher boundary: %s", stdout.String())
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
func TestNativeCanvasCommandsRequireNpmLauncher(t *testing.T) {
|
|
93
|
+
for _, action := range []string{"list", "describe", "schema", "guide", "run", "unknown-action"} {
|
|
94
|
+
t.Run(action, func(t *testing.T) {
|
|
95
|
+
var stdout, stderr bytes.Buffer
|
|
96
|
+
root := NewRootCommand(&stdout, &stderr)
|
|
97
|
+
root.SetArgs([]string{"canvas", "command", action, "--category", "example"})
|
|
98
|
+
err := root.Execute()
|
|
99
|
+
if err == nil || !strings.Contains(err.Error(), "npm launcher") {
|
|
100
|
+
t.Fatalf("Execute() error = %v, want launcher guidance", err)
|
|
101
|
+
}
|
|
102
|
+
if stdout.Len() != 0 {
|
|
103
|
+
t.Fatalf("stdout = %q, must not claim execution success", stdout.String())
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
}
|
package/dist/checksums.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
0ff3b8e87e45b5c39546b74588f7c45ffe5d463cc3618807855f498ed8bfa733 pippit-tool-cli-1.0.22-darwin-amd64.tar.gz
|
|
2
|
+
1deea5a6c69b88146319eeca111cb121ffa24d28253a5d043b2985846ebeb602 pippit-tool-cli-1.0.22-darwin-arm64.tar.gz
|
|
3
|
+
823e08be7d8a2a36176b95dc01a1b12d2dd50edb80901467629507a9ac5ff245 pippit-tool-cli-1.0.22-linux-amd64.tar.gz
|
|
4
|
+
c286697382d43023657bca553c2ad5e34181e95329c4c702323eef00f6d8b279 pippit-tool-cli-1.0.22-linux-arm64.tar.gz
|
|
5
|
+
ec53eae18219ce6456eebc43ba607f646c323b7e7f852d99d7e596e04fbd5591 pippit-tool-cli-1.0.22-windows-amd64.zip
|
|
6
|
+
a913cc47ef12eaa71ffb7de4d4e58286351491fa3109d87fa62fe84001dcc1a4 pippit-tool-cli-1.0.22-windows-arm64.zip
|