跳到主要内容

开发 · 命令参考

qzx deployProject

作用

通过 SSH 预览或部署明确指定的构件,并提供经验证的远程备份、SHA-256 校验、原子提升、健康检查和自动回滚。

命令成熟度:Alpha

可用于真实使用和反馈,但其接口与行为仍可能继续演进。 这是当前开发 checkout 的评估。未来每个不可变发布标签都会保留该版本中包含的准确评估。 可在 PyPI 0.2.2.0.9 使用。文档对应 alpha checkout 0.2.2.0.9。

行为与内置保护

实际模式会应用你请求的更改

提供预览

需要时使用原生工具

为文档所述任务使用网络

使用你当前的权限;结果可能有所不同

默认模式只预览,不建立连接。真实部署要求已有可信的 SSH 身份——通过标准 OpenSSH 文件或明确的 known_hosts——,先备份本地构件和远程状态,上传到新目录,用 SHA-256 检查每个文件,在同一文件系统内提升,并要求执行 URL 中不含机密信息的 HTTP(S) 检查。若检查失败,会自动恢复之前的远程状态。QZX 不构建、不使用 rsync --delete、不更改权限、不执行任意远程命令,也不重启服务;同时不会自动删除返回的备份或恢复路径。

QZX 会在实际更改前创建恢复文件;只有在你明确决定故意跳过它时才使用 --dangerously-bypass-approvals-and-sandbox/--yolo。

使用文档所述外部服务,并仅共享下方描述的数据。

此安全分类由 OpenAI GPT-5.6 Pro 于 2026-08-25 对照实现摘要 sha256:240e73f477e23633addd75a0fcc9da0ec756665594164338a747bec91d09d58d 审阅。

准确语法

qzx deployProject <target_host> [path] <target_path> [port] [ssh_key] [known_hosts] [health_url] [health_expect] [health_attempts] [health_interval] [health_timeout] [deployment_id] [dry_run] --json

参数

滑动或使用横向滚动条查看所有列。

名称类型必填默认值描述
target_hoststr未声明格式为 host 或 用户@host 的 SSH 目标
pathstr"."要部署构件的明确本地目录;QZX 从不构建它,也不会将其替换为项目根目录
target_pathstr未声明将成为活动版本的绝对远程目录
portint22SSH 端口
ssh_keystr未声明可选的本地 SSH 私钥文件
known_hostsstr未声明用于验证远程服务器身份的可选明确 OpenSSH known_hosts 文件
health_urlstr未声明不含凭据、query 或 fragment 的 HTTP(S) endpoint;真实部署必须提供,并在提升后检查
health_expectstr未声明必须出现在健康响应正文中的可选文本
health_attemptsint5健康检查尝试次数,1 到 20
health_intervalfloat2健康检查尝试之间的秒数,0 到 30
health_timeoutfloat5每次健康检查的超时时间,0.1 到 30 秒
deployment_idstr未声明加入审计和恢复路径的可选稳定标识符
dry_runbooltrue无需连接即可预览精确构件和所有远程路径

输入示例

qzx deployProject --target-host [email protected] --path ./dist --target-path /srv/example/current

检查构件并预览所有远程恢复路径

qzx deployProject --target-host [email protected] --path ./dist --target-path /srv/example/current --health-url https://example.test/health --health-expect "ready" --dry-run false

备份构件并执行经验证的部署

要获得完整结构化载荷,请添加 --json: qzx deployProject <target_host> [path] <target_path> [port] [ssh_key] [known_hosts] [health_url] [health_expect] [health_attempts] [health_interval] [health_timeout] [deployment_id] [dry_run] --json

代表性输出示例

此示意 JSON 源自当前实现所支持的结果契约。它展示命令可能返回的内容,并不声称这是录制的实际执行;具体值会随输入、设备、权限和可选工具而变化。

示例命令: qzx deployProject --target-host [email protected] --path ./dist --target-path /srv/example/current --json

{
    "success": true,
    "message": "Previews or deploys one explicit artifact over SSH using a verified remote backup, SHA-256 validation, atomic promotion, health checks, and automatic rollback. In this illustrative example, the command completed successfully.",
    "meta": {
        "command": "deployProject",
        "command_maturity": {
            "stage": "alpha",
            "label": "Alpha",
            "sequence": 2,
            "public_executable": true,
            "stability": "interface_may_change",
            "summary": "Available for real use and feedback while its interface and behavior can still evolve.",
            "promotion_review_required": false,
            "assessment_scope": "development_checkout"
        },
        "duration_ms": 0,
        "schema_version": 1
    },
    "details": {
        "summary": "Additional structured context is included here."
    }
}
查看 JSON 结果契约
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
        "success",
        "message",
        "meta"
    ],
    "properties": {
        "success": {
            "type": "boolean"
        },
        "message": {
            "type": "string"
        },
        "meta": {
            "type": "object",
            "required": [
                "command",
                "command_maturity",
                "duration_ms",
                "schema_version"
            ],
            "properties": {
                "command": {
                    "type": "string"
                },
                "command_maturity": {
                    "type": "object",
                    "required": [
                        "stage",
                        "label",
                        "sequence",
                        "public_executable",
                        "stability",
                        "summary",
                        "promotion_review_required",
                        "assessment_scope"
                    ],
                    "properties": {
                        "stage": {
                            "type": "string"
                        },
                        "label": {
                            "type": "string"
                        },
                        "sequence": {
                            "type": "integer"
                        },
                        "public_executable": {
                            "type": "boolean"
                        },
                        "stability": {
                            "type": "string"
                        },
                        "summary": {
                            "type": "string"
                        },
                        "promotion_review_required": {
                            "type": "boolean"
                        },
                        "assessment_scope": {
                            "type": "string"
                        },
                        "note": {
                            "type": "string"
                        },
                        "review": {
                            "type": "object",
                            "required": [
                                "reviewed_on",
                                "rationale",
                                "evidence"
                            ],
                            "properties": {
                                "reviewed_on": {
                                    "type": "string",
                                    "format": "date"
                                },
                                "rationale": {
                                    "type": "string"
                                },
                                "evidence": {
                                    "type": "array",
                                    "minItems": 1,
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "replacement": {
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false
                        }
                    },
                    "additionalProperties": true
                },
                "duration_ms": {
                    "type": "number"
                },
                "schema_version": {
                    "type": "integer"
                }
            },
            "additionalProperties": true
        },
        "details": [],
        "error": [],
        "error_code": []
    },
    "additionalProperties": true
}

错误与限制

公开契约要求失败时返回 success=false 和具有描述性的 message。此目录尚未为每个命令声明专门的错误分类;请检查结果,不要推断不存在的错误码。

QZX 仍处于 alpha 阶段。可选依赖、权限和主机能力可能影响结果。

证据流程:需要获授权的端点或经审阅的 fixture。

证据与来源

文档渠道
开发文档 0.2.2.0.9 · main · sha256:cfba936e39931c286ca23add0ae546693db17d8b316e7cbc3891d26642d9b7e8
可用性
0.2.2.0.9 或更早

继续探索

这些命令同样属于 开发 类别。对比它们,选择最适合解决任务的操作。

浏览所有 QZX 命令