docs: prefer trans gh route for body patches

This commit is contained in:
Codex
2026-06-15 03:10:50 +00:00
parent 779721ea73
commit 008f7fbb62
4 changed files with 36 additions and 14 deletions
+15 -4
View File
@@ -172,6 +172,17 @@ function readDocument(route: GhContentRoute): GhRouteDocument {
};
}
function documentRoute(route: GhContentRoute): GhContentRoute {
if ((route.area === "pr-item" || route.area === "issue-item" || route.area === "legacy-item") && route.floor === null) {
return { ...route, floor: 1 };
}
return route;
}
function isPatchOperation(operation: string): boolean {
return operation === "patch-apply" || operation === "apply-patch" || operation === "apply_patch";
}
function numberFromUnknown(value: unknown): number | null {
return typeof value === "number" && Number.isFinite(value) ? value : null;
}
@@ -536,7 +547,7 @@ export async function runGhContentRoute(target: string, args: string[]): Promise
if (operation === "ls" || operation === "dir") {
return listRoute(route, opArgs);
}
const document = readDocument(route);
const document = readDocument(documentRoute(route));
if (operation === "cat") {
process.stdout.write(document.body);
return 0;
@@ -544,7 +555,7 @@ export async function runGhContentRoute(target: string, args: string[]): Promise
if (operation === "rg") {
return runRg(document.body, opArgs);
}
if (operation === "patch-apply" || operation === "apply-patch") {
if (isPatchOperation(operation)) {
const dryRun = opArgs.includes("--dry-run");
const unsupported = opArgs.filter((arg) => arg !== "--dry-run");
if (unsupported.length > 0) throw new Error(`unsupported gh ${operation} args: ${unsupported.join(" ")}`);
@@ -580,7 +591,7 @@ export async function runGhContentRoute(target: string, args: string[]): Promise
ok: false,
degradedReason: "unsupported-operation",
route,
message: "gh route floor 1 is the issue/PR body and cannot be removed safely; use patch-apply to delete reviewed sections.",
message: "gh route floor 1 is the issue/PR body and cannot be removed safely; use apply-patch to delete reviewed sections.",
});
return 2;
}
@@ -588,7 +599,7 @@ export async function runGhContentRoute(target: string, args: string[]): Promise
ok: false,
degradedReason: "unsupported-command",
route,
supported: ["cat", "rg", "patch-apply", "apply-patch", "rm"],
supported: ["cat", "rg", "patch-apply", "apply-patch", "apply_patch", "rm"],
});
return 2;
}
+1 -1
View File
@@ -23,7 +23,7 @@ export function rootHelp(): unknown {
{ command: "server restart <backend-core|frontend|dev-frontend-proxy|provider-gateway|todo-note|code-queue-mgr|project-manager|baidu-netdisk|oa-event-flow>", description: "No-build single-service Compose restart for reviewed main-server maintenance recovery; returns an async job and validates the recreated container." },
{ command: "provider attach <providerId> [--master-server URL] [--up] [--force] | provider triage <providerId> [--observed-error text] [--observed-scope scope] [--microservice id ...] [--full|--raw]", description: "Generate the minimal external provider-gateway env/compose bundle or run the low-noise read-only provider health triage contract." },
{ command: "trans <route> [operation args...] (alias of ssh <route> ...)", description: "Open a Host SSH / WSL SSH maintenance session; provider WebSocket carries control and host.ssh.tcp-pool carries stdin/stdout/stderr data." },
{ command: "trans gh:/owner/repo[/pr|/issue][/number[/1]] ls|cat|rg|patch-apply", description: "Treat GitHub PRs/issues as virtual text directories; `ls --full` shows state/floors/body length, and `patch-apply` updates first-floor `body.md` through UniDesk gh plus apply-patch v2." },
{ command: "trans gh:/owner/repo[/pr|/issue][/number[/1]] ls|cat|rg|apply-patch", description: "Treat GitHub PRs/issues as virtual text directories; `ls --full` shows state/floors/body length, and `apply-patch` updates first-floor `body.md` through UniDesk gh plus apply-patch v2." },
{ command: "trans <route> apply-patch < patch.diff", description: "Default remote text patch entry: apply a standard patch with the local TypeScript v2 engine while the remote route only reads and writes files." },
{ command: "trans <route> upload <local-file> <remote-file> | trans <route> download <remote-file> <local-file>", description: "Transfer whole files through SSH passthrough with automatic endpoint byte/SHA-256 verification; downloads stream stdout over host.ssh.tcp-pool." },
{ command: "trans <providerId> apply-patch-v1 [tool args...] < patch.diff", description: "Fallback to the injected legacy remote apply_patch helper directly over SSH passthrough and stream the patch from local stdin." },