@devflow-one/cli 0.1.3 → 0.1.5
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 +6 -3
- package/package.json +1 -1
- package/src/args.js +9 -1
- package/src/commands.js +28 -0
package/README.md
CHANGED
|
@@ -182,13 +182,16 @@ devflow mr ready 12 --profile prof-1
|
|
|
182
182
|
|
|
183
183
|
### Destructive actions
|
|
184
184
|
|
|
185
|
-
`branch delete` and `mr
|
|
186
|
-
confirm** with `--force` (or `--yes`); the gateway enforces the same
|
|
187
|
-
server-side, so the confirmation can't be bypassed:
|
|
185
|
+
`branch delete`, `mr close` and `mr merge` are destructive. They are **refused
|
|
186
|
+
unless you confirm** with `--force` (or `--yes`); the gateway enforces the same
|
|
187
|
+
gate server-side, so the confirmation can't be bypassed:
|
|
188
188
|
|
|
189
189
|
```sh
|
|
190
190
|
devflow branch delete old --project ABC # refused
|
|
191
191
|
devflow branch delete old --project ABC --force # executes
|
|
192
|
+
|
|
193
|
+
# merge a PR/MR, squashing and cleaning up the source branch
|
|
194
|
+
devflow mr merge 42 --method squash --delete-source-branch --force
|
|
192
195
|
```
|
|
193
196
|
|
|
194
197
|
Inference never softens this gate — a destructive command run with fully
|
package/package.json
CHANGED
package/src/args.js
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
// positionals.
|
|
5
5
|
|
|
6
6
|
/** Boolean flags never consume the following token. */
|
|
7
|
-
const BOOLEAN_FLAGS = new Set([
|
|
7
|
+
const BOOLEAN_FLAGS = new Set([
|
|
8
|
+
"json",
|
|
9
|
+
"all",
|
|
10
|
+
"help",
|
|
11
|
+
"force",
|
|
12
|
+
"yes",
|
|
13
|
+
"no-push",
|
|
14
|
+
"delete-source-branch",
|
|
15
|
+
]);
|
|
8
16
|
|
|
9
17
|
/**
|
|
10
18
|
* @param {string[]} argv the args after the node/script path
|
package/src/commands.js
CHANGED
|
@@ -20,6 +20,20 @@ function toInt(name, value) {
|
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** Valid `--method` values for `mr merge`, mirroring the provider merge strategies. */
|
|
24
|
+
const MERGE_METHODS = ["merge", "squash", "rebase"];
|
|
25
|
+
|
|
26
|
+
/** Parse a `--method` flag into a merge strategy, or fail with the allowed set. */
|
|
27
|
+
function toMergeMethod(value) {
|
|
28
|
+
const method = String(value);
|
|
29
|
+
|
|
30
|
+
if (!MERGE_METHODS.includes(method)) {
|
|
31
|
+
throw new UsageError(`"--method" must be one of ${MERGE_METHODS.join(", ")}, got "${method}".`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return method;
|
|
35
|
+
}
|
|
36
|
+
|
|
23
37
|
/** Parse a `--values` JSON-object flag into a plain object, or fail clearly. */
|
|
24
38
|
function toValues(flag, raw) {
|
|
25
39
|
if (raw === undefined) return undefined;
|
|
@@ -144,6 +158,20 @@ const COMMANDS = {
|
|
|
144
158
|
usage: "mr close <prId> [--issue KEY] [--project KEY] --force",
|
|
145
159
|
buildArgs: ([prId]) => [toInt("prId", prId)],
|
|
146
160
|
},
|
|
161
|
+
"mr merge": {
|
|
162
|
+
method: "POST",
|
|
163
|
+
action: "mergePullRequest",
|
|
164
|
+
destructive: true,
|
|
165
|
+
usage:
|
|
166
|
+
"mr merge <prId> [--method merge|squash|rebase] [--delete-source-branch] " +
|
|
167
|
+
"[--issue KEY] [--project KEY] --force",
|
|
168
|
+
buildArgs: ([prId], flags) => {
|
|
169
|
+
const mergeMethod = flags.method === undefined ? undefined : toMergeMethod(flags.method);
|
|
170
|
+
const deleteSourceBranch = flags["delete-source-branch"] ? true : undefined;
|
|
171
|
+
|
|
172
|
+
return [toInt("prId", prId), { mergeMethod, deleteSourceBranch }];
|
|
173
|
+
},
|
|
174
|
+
},
|
|
147
175
|
"mr assign": {
|
|
148
176
|
method: "POST",
|
|
149
177
|
action: "assignPr",
|