@ricsam/r5dctl 0.0.104 → 0.0.105
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 +3 -3
- package/dist/cjs/cli.cjs +75 -16
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/cli.mjs +71 -16
- package/dist/mjs/package.json +1 -1
- package/dist/types/cli.d.ts +30 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -57,8 +57,8 @@ r5dctl -p <project> get branches
|
|
|
57
57
|
r5dctl -p <project> describe branch <branch>
|
|
58
58
|
r5dctl -p <project> create branch <branch> --source worktree:<branch> [--working-tree carry|clean] [--worker <label>]
|
|
59
59
|
r5dctl -p <project> describe branch-operation <operation-id>
|
|
60
|
-
r5dctl -p <project> delete branch <branch>
|
|
61
|
-
r5dctl -p <project> delete branch <branch> --confirm
|
|
60
|
+
r5dctl -p <project> delete branch <branch> [<branch>...] # preview the sessions that would be deleted, exit 1
|
|
61
|
+
r5dctl -p <project> delete branch <branch> [<branch>...] --confirm # delete the branches and their sessions through the platform
|
|
62
62
|
r5dctl -p <project> get envs
|
|
63
63
|
r5dctl -p <project> get envs --show-values
|
|
64
64
|
r5dctl -p <project> get env API_KEY
|
|
@@ -125,7 +125,7 @@ pull requests.
|
|
|
125
125
|
|
|
126
126
|
`create branch` creates a linked worktree branch through the platform from an existing branch's checkout, with the same `--source worktree:<branch>` and `--working-tree carry|clean` semantics as `session start --new-worktree` (carry is the default) and no session prompt. `--worker <label>` selects the connected worker that cuts the checkout; omitted, the platform chooses one, and an r5d worker shell's temporary credential is always bound to its own worker. The command returns as soon as the operation is accepted and prints its id; `describe branch-operation <operation-id>` reports `provisioning`, `ready`, or `failed` with the worker and any error. Neither prints a commit hash: read the branch with git in its checkout once it is ready.
|
|
127
127
|
|
|
128
|
-
`delete branch` removes
|
|
128
|
+
`delete branch` removes one or more branches and every session on them through the platform, which is the only supported way to remove a linked worktree: the platform owns those checkouts, so never run `git worktree remove`, `git worktree prune`, or `git branch -D` inside a project checkout. Without `--confirm` it prints each branch and its sessions and exits non-zero without deleting anything. With `--confirm` the branches are deleted one after another, each prints its own result line, a failure does not stop the remaining deletions, and the exit status is non-zero if any branch failed. The primary branch `main` is refused before anything is deleted, as is a branch with a running agent or active process (stop them first). A worker that is still applying a configuration refresh makes a deletion wait on the server for up to 45 seconds; if the refresh is still running after that, the result line says so and the branch can be retried. On a server that predates the route, the command explains that the server does not support `delete branch` yet instead of reporting a missing branch.
|
|
129
129
|
|
|
130
130
|
`get branches` lists every branch the project knows about, including managed branches without sessions. A worker whose workspace sync found a configured branch's checkout directory missing, or present but not a linked worktree of the project, skips that branch and reports it; the listing then shows `checkout=missing on <worker>` or `checkout=not_a_worktree on <worker>`, and `workspace status` prints a `Missing checkouts on <worker>` line. Recover either by deleting the branch with `delete branch <branch> --confirm` or by reconnecting that worker, which recreates the checkout without snapshotting the project's other checkouts.
|
|
131
131
|
|
package/dist/cjs/cli.cjs
CHANGED
|
@@ -30,9 +30,12 @@ var cli_exports = {};
|
|
|
30
30
|
__export(cli_exports, {
|
|
31
31
|
advanceTransientDevicePollBackoff: () => advanceTransientDevicePollBackoff,
|
|
32
32
|
branchDeletionConfirmationMessage: () => branchDeletionConfirmationMessage,
|
|
33
|
+
branchDeletionsConfirmationMessage: () => branchDeletionsConfirmationMessage,
|
|
34
|
+
branchDeletionsFailureMessage: () => branchDeletionsFailureMessage,
|
|
33
35
|
collectK8sUsage: () => collectK8sUsage,
|
|
34
36
|
createBranchThroughPlatform: () => createBranchThroughPlatform,
|
|
35
37
|
deleteBranchThroughPlatform: () => deleteBranchThroughPlatform,
|
|
38
|
+
deleteBranchesThroughPlatform: () => deleteBranchesThroughPlatform,
|
|
36
39
|
dispatchSessionRunCommand: () => dispatchSessionRunCommand,
|
|
37
40
|
followR5dctlSession: () => followR5dctlSession,
|
|
38
41
|
formatK8sCpu: () => formatK8sCpu,
|
|
@@ -70,6 +73,7 @@ __export(cli_exports, {
|
|
|
70
73
|
readDotenvFile: () => readDotenvFile,
|
|
71
74
|
renderBranchDeletion: () => renderBranchDeletion,
|
|
72
75
|
renderBranchDeletionPreview: () => renderBranchDeletionPreview,
|
|
76
|
+
renderBranchDeletionResult: () => renderBranchDeletionResult,
|
|
73
77
|
renderBranchList: () => renderBranchList,
|
|
74
78
|
renderBranchOperation: () => renderBranchOperation,
|
|
75
79
|
renderConversationForkResponse: () => renderConversationForkResponse,
|
|
@@ -221,8 +225,8 @@ const SHARED_HELP_ENTRIES = [
|
|
|
221
225
|
},
|
|
222
226
|
{
|
|
223
227
|
section: "branches",
|
|
224
|
-
usage: "-p <project> delete branch <branch> [--confirm]",
|
|
225
|
-
description: "Delete
|
|
228
|
+
usage: "-p <project> delete branch <branch> [<branch>...] [--confirm]",
|
|
229
|
+
description: "Delete one or more branches and their sessions through the platform; without --confirm, only preview what would be deleted."
|
|
226
230
|
},
|
|
227
231
|
{
|
|
228
232
|
section: "envs",
|
|
@@ -610,15 +614,18 @@ function parseBranchCreateArgs(args) {
|
|
|
610
614
|
};
|
|
611
615
|
}
|
|
612
616
|
function parseBranchDeleteArgs(args) {
|
|
617
|
+
const branchNames = [];
|
|
613
618
|
let confirmed = false;
|
|
614
619
|
for (const arg of args) {
|
|
615
620
|
if (arg === "--confirm") {
|
|
616
621
|
confirmed = true;
|
|
617
622
|
continue;
|
|
618
623
|
}
|
|
619
|
-
|
|
624
|
+
if (arg.startsWith("-")) throw new Error(`Unknown delete branch flag: ${arg}`);
|
|
625
|
+
if (branchNames.includes(arg)) throw new Error(`Branch ${arg} was given more than once`);
|
|
626
|
+
branchNames.push(arg);
|
|
620
627
|
}
|
|
621
|
-
return { confirmed };
|
|
628
|
+
return { branchNames, confirmed };
|
|
622
629
|
}
|
|
623
630
|
const PRIMARY_BRANCH_NAME = "main";
|
|
624
631
|
function isUnsupportedServerRoute(error) {
|
|
@@ -653,6 +660,50 @@ async function deleteBranchThroughPlatform(client, projectRef, branchName, optio
|
|
|
653
660
|
const result = await requireServerRouteSupport("delete branch", () => client.projects.branches.delete(projectRef, branchName));
|
|
654
661
|
return { kind: "deleted", result };
|
|
655
662
|
}
|
|
663
|
+
async function deleteBranchesThroughPlatform(client, projectRef, branchNames, options) {
|
|
664
|
+
if (branchNames.length === 0) throw new Error("Missing branch name");
|
|
665
|
+
for (const branchName of branchNames) {
|
|
666
|
+
if (branchName === PRIMARY_BRANCH_NAME) throw new Error(`The primary branch ${branchName} cannot be deleted`);
|
|
667
|
+
}
|
|
668
|
+
if (!options.confirmed) {
|
|
669
|
+
const branches = [];
|
|
670
|
+
for (const branchName of branchNames) {
|
|
671
|
+
branches.push(await client.projects.branches.describe(projectRef, branchName));
|
|
672
|
+
}
|
|
673
|
+
return { kind: "preview", branches };
|
|
674
|
+
}
|
|
675
|
+
const results = [];
|
|
676
|
+
for (const branchName of branchNames) {
|
|
677
|
+
let result;
|
|
678
|
+
try {
|
|
679
|
+
const deletion = await deleteBranchThroughPlatform(client, projectRef, branchName, { confirmed: true });
|
|
680
|
+
if (deletion.kind !== "deleted") throw new Error(`Branch ${branchName} was only previewed`);
|
|
681
|
+
result = { branchName, deleted: true, deletedSessionIds: deletion.result.deletedSessionIds };
|
|
682
|
+
} catch (error) {
|
|
683
|
+
result = {
|
|
684
|
+
branchName,
|
|
685
|
+
deleted: false,
|
|
686
|
+
error: error instanceof import_r5d_api.R5dctlApiError ? extractApiErrorMessage(error) : error instanceof Error ? error.message : String(error)
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
results.push(result);
|
|
690
|
+
options.onResult?.(result);
|
|
691
|
+
}
|
|
692
|
+
return { kind: "deleted", results };
|
|
693
|
+
}
|
|
694
|
+
function renderBranchDeletionResult(result) {
|
|
695
|
+
return result.deleted ? renderBranchDeletion(result) : `Failed to delete branch ${result.branchName}: ${result.error}
|
|
696
|
+
`;
|
|
697
|
+
}
|
|
698
|
+
function branchDeletionsConfirmationMessage(branches) {
|
|
699
|
+
const [only] = branches;
|
|
700
|
+
if (branches.length === 1 && only) return branchDeletionConfirmationMessage(only);
|
|
701
|
+
const sessionCount = branches.reduce((count, branch) => count + branch.sessions.length, 0);
|
|
702
|
+
return `Nothing was deleted. Re-run with --confirm to delete ${branches.length} branches and their ${sessionCount} session(s).`;
|
|
703
|
+
}
|
|
704
|
+
function branchDeletionsFailureMessage(results) {
|
|
705
|
+
return `Failed to delete ${results.filter((result) => !result.deleted).length} of ${results.length} branch(es).`;
|
|
706
|
+
}
|
|
656
707
|
function renderBranchDeletionPreview(branch) {
|
|
657
708
|
const count = branch.sessions.length;
|
|
658
709
|
const lines = [
|
|
@@ -2846,13 +2897,20 @@ Sessions: ${result.sessions.length}
|
|
|
2846
2897
|
if (first === "projects" && second === "branches" && third === "delete" || first === "delete" && second === "branch") {
|
|
2847
2898
|
const offset = first === "delete" ? 2 : 3;
|
|
2848
2899
|
const projectRef = requireValue(args[offset], "Missing project reference");
|
|
2849
|
-
const
|
|
2850
|
-
const deletion = await
|
|
2900
|
+
const { branchNames, confirmed } = parseBranchDeleteArgs(args.slice(offset + 1));
|
|
2901
|
+
const deletion = await deleteBranchesThroughPlatform(client, projectRef, branchNames, {
|
|
2902
|
+
confirmed,
|
|
2903
|
+
// Each deletion is its own round trip, so a reader sees results as they land.
|
|
2904
|
+
onResult: (result) => {
|
|
2905
|
+
if (!json) process.stdout.write(renderBranchDeletionResult(result));
|
|
2906
|
+
}
|
|
2907
|
+
});
|
|
2851
2908
|
if (deletion.kind === "preview") {
|
|
2852
|
-
write({
|
|
2853
|
-
throw new Error(
|
|
2909
|
+
write({ branches: deletion.branches, confirmed: false }, deletion.branches.map(renderBranchDeletionPreview).join("\n"));
|
|
2910
|
+
throw new Error(branchDeletionsConfirmationMessage(deletion.branches));
|
|
2854
2911
|
}
|
|
2855
|
-
write(deletion.
|
|
2912
|
+
if (json) write({ results: deletion.results }, "");
|
|
2913
|
+
if (deletion.results.some((result) => !result.deleted)) throw new Error(branchDeletionsFailureMessage(deletion.results));
|
|
2856
2914
|
return;
|
|
2857
2915
|
}
|
|
2858
2916
|
if (first === "get" && second === "envs") {
|
|
@@ -3387,17 +3445,14 @@ function resolveCommandExecution(options, rest) {
|
|
|
3387
3445
|
if (!options.project) {
|
|
3388
3446
|
throw new Error("--project/-p is required for `delete branch`");
|
|
3389
3447
|
}
|
|
3390
|
-
const
|
|
3391
|
-
const
|
|
3392
|
-
|
|
3393
|
-
if (!branch) {
|
|
3448
|
+
const parsed = parseBranchDeleteArgs(commandArgs.slice(1));
|
|
3449
|
+
const branchNames = parsed.branchNames.length > 0 ? parsed.branchNames : options.branch ? [options.branch] : [];
|
|
3450
|
+
if (branchNames.length === 0) {
|
|
3394
3451
|
throw new Error("Branch name is required for `delete branch`");
|
|
3395
3452
|
}
|
|
3396
|
-
const flagArgs = positionalBranch ? rawArgs.slice(1) : rawArgs;
|
|
3397
|
-
parseBranchDeleteArgs(flagArgs);
|
|
3398
3453
|
return {
|
|
3399
3454
|
kind: "plugin",
|
|
3400
|
-
pluginArgs: ["delete", "branch", options.project,
|
|
3455
|
+
pluginArgs: ["delete", "branch", options.project, ...branchNames, ...parsed.confirmed ? ["--confirm"] : []]
|
|
3401
3456
|
};
|
|
3402
3457
|
}
|
|
3403
3458
|
throw new Error("Unknown delete command");
|
|
@@ -3628,9 +3683,12 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
3628
3683
|
0 && (module.exports = {
|
|
3629
3684
|
advanceTransientDevicePollBackoff,
|
|
3630
3685
|
branchDeletionConfirmationMessage,
|
|
3686
|
+
branchDeletionsConfirmationMessage,
|
|
3687
|
+
branchDeletionsFailureMessage,
|
|
3631
3688
|
collectK8sUsage,
|
|
3632
3689
|
createBranchThroughPlatform,
|
|
3633
3690
|
deleteBranchThroughPlatform,
|
|
3691
|
+
deleteBranchesThroughPlatform,
|
|
3634
3692
|
dispatchSessionRunCommand,
|
|
3635
3693
|
followR5dctlSession,
|
|
3636
3694
|
formatK8sCpu,
|
|
@@ -3668,6 +3726,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
3668
3726
|
readDotenvFile,
|
|
3669
3727
|
renderBranchDeletion,
|
|
3670
3728
|
renderBranchDeletionPreview,
|
|
3729
|
+
renderBranchDeletionResult,
|
|
3671
3730
|
renderBranchList,
|
|
3672
3731
|
renderBranchOperation,
|
|
3673
3732
|
renderConversationForkResponse,
|
package/dist/cjs/package.json
CHANGED
package/dist/mjs/cli.mjs
CHANGED
|
@@ -126,8 +126,8 @@ const SHARED_HELP_ENTRIES = [
|
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
section: "branches",
|
|
129
|
-
usage: "-p <project> delete branch <branch> [--confirm]",
|
|
130
|
-
description: "Delete
|
|
129
|
+
usage: "-p <project> delete branch <branch> [<branch>...] [--confirm]",
|
|
130
|
+
description: "Delete one or more branches and their sessions through the platform; without --confirm, only preview what would be deleted."
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
section: "envs",
|
|
@@ -515,15 +515,18 @@ function parseBranchCreateArgs(args) {
|
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
517
|
function parseBranchDeleteArgs(args) {
|
|
518
|
+
const branchNames = [];
|
|
518
519
|
let confirmed = false;
|
|
519
520
|
for (const arg of args) {
|
|
520
521
|
if (arg === "--confirm") {
|
|
521
522
|
confirmed = true;
|
|
522
523
|
continue;
|
|
523
524
|
}
|
|
524
|
-
|
|
525
|
+
if (arg.startsWith("-")) throw new Error(`Unknown delete branch flag: ${arg}`);
|
|
526
|
+
if (branchNames.includes(arg)) throw new Error(`Branch ${arg} was given more than once`);
|
|
527
|
+
branchNames.push(arg);
|
|
525
528
|
}
|
|
526
|
-
return { confirmed };
|
|
529
|
+
return { branchNames, confirmed };
|
|
527
530
|
}
|
|
528
531
|
const PRIMARY_BRANCH_NAME = "main";
|
|
529
532
|
function isUnsupportedServerRoute(error) {
|
|
@@ -558,6 +561,50 @@ async function deleteBranchThroughPlatform(client, projectRef, branchName, optio
|
|
|
558
561
|
const result = await requireServerRouteSupport("delete branch", () => client.projects.branches.delete(projectRef, branchName));
|
|
559
562
|
return { kind: "deleted", result };
|
|
560
563
|
}
|
|
564
|
+
async function deleteBranchesThroughPlatform(client, projectRef, branchNames, options) {
|
|
565
|
+
if (branchNames.length === 0) throw new Error("Missing branch name");
|
|
566
|
+
for (const branchName of branchNames) {
|
|
567
|
+
if (branchName === PRIMARY_BRANCH_NAME) throw new Error(`The primary branch ${branchName} cannot be deleted`);
|
|
568
|
+
}
|
|
569
|
+
if (!options.confirmed) {
|
|
570
|
+
const branches = [];
|
|
571
|
+
for (const branchName of branchNames) {
|
|
572
|
+
branches.push(await client.projects.branches.describe(projectRef, branchName));
|
|
573
|
+
}
|
|
574
|
+
return { kind: "preview", branches };
|
|
575
|
+
}
|
|
576
|
+
const results = [];
|
|
577
|
+
for (const branchName of branchNames) {
|
|
578
|
+
let result;
|
|
579
|
+
try {
|
|
580
|
+
const deletion = await deleteBranchThroughPlatform(client, projectRef, branchName, { confirmed: true });
|
|
581
|
+
if (deletion.kind !== "deleted") throw new Error(`Branch ${branchName} was only previewed`);
|
|
582
|
+
result = { branchName, deleted: true, deletedSessionIds: deletion.result.deletedSessionIds };
|
|
583
|
+
} catch (error) {
|
|
584
|
+
result = {
|
|
585
|
+
branchName,
|
|
586
|
+
deleted: false,
|
|
587
|
+
error: error instanceof R5dctlApiError ? extractApiErrorMessage(error) : error instanceof Error ? error.message : String(error)
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
results.push(result);
|
|
591
|
+
options.onResult?.(result);
|
|
592
|
+
}
|
|
593
|
+
return { kind: "deleted", results };
|
|
594
|
+
}
|
|
595
|
+
function renderBranchDeletionResult(result) {
|
|
596
|
+
return result.deleted ? renderBranchDeletion(result) : `Failed to delete branch ${result.branchName}: ${result.error}
|
|
597
|
+
`;
|
|
598
|
+
}
|
|
599
|
+
function branchDeletionsConfirmationMessage(branches) {
|
|
600
|
+
const [only] = branches;
|
|
601
|
+
if (branches.length === 1 && only) return branchDeletionConfirmationMessage(only);
|
|
602
|
+
const sessionCount = branches.reduce((count, branch) => count + branch.sessions.length, 0);
|
|
603
|
+
return `Nothing was deleted. Re-run with --confirm to delete ${branches.length} branches and their ${sessionCount} session(s).`;
|
|
604
|
+
}
|
|
605
|
+
function branchDeletionsFailureMessage(results) {
|
|
606
|
+
return `Failed to delete ${results.filter((result) => !result.deleted).length} of ${results.length} branch(es).`;
|
|
607
|
+
}
|
|
561
608
|
function renderBranchDeletionPreview(branch) {
|
|
562
609
|
const count = branch.sessions.length;
|
|
563
610
|
const lines = [
|
|
@@ -2751,13 +2798,20 @@ Sessions: ${result.sessions.length}
|
|
|
2751
2798
|
if (first === "projects" && second === "branches" && third === "delete" || first === "delete" && second === "branch") {
|
|
2752
2799
|
const offset = first === "delete" ? 2 : 3;
|
|
2753
2800
|
const projectRef = requireValue(args[offset], "Missing project reference");
|
|
2754
|
-
const
|
|
2755
|
-
const deletion = await
|
|
2801
|
+
const { branchNames, confirmed } = parseBranchDeleteArgs(args.slice(offset + 1));
|
|
2802
|
+
const deletion = await deleteBranchesThroughPlatform(client, projectRef, branchNames, {
|
|
2803
|
+
confirmed,
|
|
2804
|
+
// Each deletion is its own round trip, so a reader sees results as they land.
|
|
2805
|
+
onResult: (result) => {
|
|
2806
|
+
if (!json) process.stdout.write(renderBranchDeletionResult(result));
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2756
2809
|
if (deletion.kind === "preview") {
|
|
2757
|
-
write({
|
|
2758
|
-
throw new Error(
|
|
2810
|
+
write({ branches: deletion.branches, confirmed: false }, deletion.branches.map(renderBranchDeletionPreview).join("\n"));
|
|
2811
|
+
throw new Error(branchDeletionsConfirmationMessage(deletion.branches));
|
|
2759
2812
|
}
|
|
2760
|
-
write(deletion.
|
|
2813
|
+
if (json) write({ results: deletion.results }, "");
|
|
2814
|
+
if (deletion.results.some((result) => !result.deleted)) throw new Error(branchDeletionsFailureMessage(deletion.results));
|
|
2761
2815
|
return;
|
|
2762
2816
|
}
|
|
2763
2817
|
if (first === "get" && second === "envs") {
|
|
@@ -3292,17 +3346,14 @@ function resolveCommandExecution(options, rest) {
|
|
|
3292
3346
|
if (!options.project) {
|
|
3293
3347
|
throw new Error("--project/-p is required for `delete branch`");
|
|
3294
3348
|
}
|
|
3295
|
-
const
|
|
3296
|
-
const
|
|
3297
|
-
|
|
3298
|
-
if (!branch) {
|
|
3349
|
+
const parsed = parseBranchDeleteArgs(commandArgs.slice(1));
|
|
3350
|
+
const branchNames = parsed.branchNames.length > 0 ? parsed.branchNames : options.branch ? [options.branch] : [];
|
|
3351
|
+
if (branchNames.length === 0) {
|
|
3299
3352
|
throw new Error("Branch name is required for `delete branch`");
|
|
3300
3353
|
}
|
|
3301
|
-
const flagArgs = positionalBranch ? rawArgs.slice(1) : rawArgs;
|
|
3302
|
-
parseBranchDeleteArgs(flagArgs);
|
|
3303
3354
|
return {
|
|
3304
3355
|
kind: "plugin",
|
|
3305
|
-
pluginArgs: ["delete", "branch", options.project,
|
|
3356
|
+
pluginArgs: ["delete", "branch", options.project, ...branchNames, ...parsed.confirmed ? ["--confirm"] : []]
|
|
3306
3357
|
};
|
|
3307
3358
|
}
|
|
3308
3359
|
throw new Error("Unknown delete command");
|
|
@@ -3532,9 +3583,12 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
3532
3583
|
export {
|
|
3533
3584
|
advanceTransientDevicePollBackoff,
|
|
3534
3585
|
branchDeletionConfirmationMessage,
|
|
3586
|
+
branchDeletionsConfirmationMessage,
|
|
3587
|
+
branchDeletionsFailureMessage,
|
|
3535
3588
|
collectK8sUsage,
|
|
3536
3589
|
createBranchThroughPlatform,
|
|
3537
3590
|
deleteBranchThroughPlatform,
|
|
3591
|
+
deleteBranchesThroughPlatform,
|
|
3538
3592
|
dispatchSessionRunCommand,
|
|
3539
3593
|
followR5dctlSession,
|
|
3540
3594
|
formatK8sCpu,
|
|
@@ -3572,6 +3626,7 @@ export {
|
|
|
3572
3626
|
readDotenvFile,
|
|
3573
3627
|
renderBranchDeletion,
|
|
3574
3628
|
renderBranchDeletionPreview,
|
|
3629
|
+
renderBranchDeletionResult,
|
|
3575
3630
|
renderBranchList,
|
|
3576
3631
|
renderBranchOperation,
|
|
3577
3632
|
renderConversationForkResponse,
|
package/dist/mjs/package.json
CHANGED
package/dist/types/cli.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export type R5dctlBranchCreateArgs = {
|
|
|
86
86
|
};
|
|
87
87
|
export declare function parseBranchCreateArgs(args: string[]): R5dctlBranchCreateArgs;
|
|
88
88
|
export declare function parseBranchDeleteArgs(args: string[]): {
|
|
89
|
+
branchNames: string[];
|
|
89
90
|
confirmed: boolean;
|
|
90
91
|
};
|
|
91
92
|
/** An older server strips unknown routes and answers with this generic 404; a route's own not-found carries a specific message. */
|
|
@@ -103,6 +104,35 @@ export type R5dctlBranchDeletionOutcome = {
|
|
|
103
104
|
export declare function deleteBranchThroughPlatform(client: R5dctlClient, projectRef: string, branchName: string, options: {
|
|
104
105
|
confirmed: boolean;
|
|
105
106
|
}): Promise<R5dctlBranchDeletionOutcome>;
|
|
107
|
+
export type R5dctlBranchDeletionResult = {
|
|
108
|
+
branchName: string;
|
|
109
|
+
deleted: true;
|
|
110
|
+
deletedSessionIds: string[];
|
|
111
|
+
} | {
|
|
112
|
+
branchName: string;
|
|
113
|
+
deleted: false;
|
|
114
|
+
error: string;
|
|
115
|
+
};
|
|
116
|
+
export type R5dctlBranchDeletionsOutcome = {
|
|
117
|
+
kind: "preview";
|
|
118
|
+
branches: R5dctlBranchDescription[];
|
|
119
|
+
} | {
|
|
120
|
+
kind: "deleted";
|
|
121
|
+
results: R5dctlBranchDeletionResult[];
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Delete several branches one request at a time: the server route stays
|
|
125
|
+
* one-branch-per-request. Every name is checked before the first request, a
|
|
126
|
+
* preview describes each branch, and a confirmed run continues past a failed
|
|
127
|
+
* branch so one refused deletion does not strand the rest of the list.
|
|
128
|
+
*/
|
|
129
|
+
export declare function deleteBranchesThroughPlatform(client: R5dctlClient, projectRef: string, branchNames: readonly string[], options: {
|
|
130
|
+
confirmed: boolean;
|
|
131
|
+
onResult?: (result: R5dctlBranchDeletionResult) => void;
|
|
132
|
+
}): Promise<R5dctlBranchDeletionsOutcome>;
|
|
133
|
+
export declare function renderBranchDeletionResult(result: R5dctlBranchDeletionResult): string;
|
|
134
|
+
export declare function branchDeletionsConfirmationMessage(branches: readonly R5dctlBranchDescription[]): string;
|
|
135
|
+
export declare function branchDeletionsFailureMessage(results: readonly R5dctlBranchDeletionResult[]): string;
|
|
106
136
|
export declare function renderBranchDeletionPreview(branch: R5dctlBranchDescription): string;
|
|
107
137
|
export declare function branchDeletionConfirmationMessage(branch: R5dctlBranchDescription): string;
|
|
108
138
|
export declare function renderBranchDeletion(result: R5dctlBranchDeleteResponse): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/r5dctl",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/cjs/cli.cjs",
|
|
6
6
|
"module": "./dist/mjs/cli.mjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"r5dctl": "dist/cjs/main.cjs"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ricsam/r5d-api": "^0.0.
|
|
29
|
+
"@ricsam/r5d-api": "^0.0.105",
|
|
30
30
|
"dotenv": "^17",
|
|
31
31
|
"qrcode": "^1.5.4",
|
|
32
32
|
"ws": "^8.18.3"
|