acp-push 1.3.2 → 1.4.1
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 +27 -5
- package/bin/acp.js +230 -18
- package/lib/messages.js +30 -30
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -26,9 +26,11 @@ npm install -g acp-push
|
|
|
26
26
|
|
|
27
27
|
| Flag | Description |
|
|
28
28
|
| --- | --- |
|
|
29
|
-
| `-u`, `--upstream` | Push to
|
|
29
|
+
| `-u`, `--upstream` | Push to `origin`, then open a pull request to `upstream` |
|
|
30
|
+
| `-ua`, `--upstream-merge` | Same as `-u`, then merge the pull request if you have write access to `upstream` |
|
|
30
31
|
| `-b`, `--branch <name>` | Push to `<name>` instead of `main` |
|
|
31
32
|
| `-m`, `--message <text>` | Use your own commit message instead of a random one |
|
|
33
|
+
| `-c`, `--chunks` | Split your changes into 10 smaller commits (by change, not by file), then push |
|
|
32
34
|
| `-h`, `--help` | Show help |
|
|
33
35
|
| `-v`, `--version` | Show version |
|
|
34
36
|
|
|
@@ -36,13 +38,34 @@ npm install -g acp-push
|
|
|
36
38
|
|
|
37
39
|
```bash
|
|
38
40
|
acp # git push origin main
|
|
39
|
-
acp -u # git push
|
|
41
|
+
acp -u # git push origin main, then open a PR to upstream
|
|
42
|
+
acp -ua # same, then merge the PR if you have write access
|
|
40
43
|
acp -b dev # git push origin dev
|
|
41
44
|
acp --branch=dev # same as above
|
|
42
|
-
acp -u -b
|
|
45
|
+
acp -u -b fix # git push origin fix, then open a PR to upstream
|
|
43
46
|
acp -m "Fix login bug" # custom message
|
|
47
|
+
acp -c # 10 smaller commits, then push
|
|
44
48
|
```
|
|
45
49
|
|
|
50
|
+
## Pull requests to upstream
|
|
51
|
+
|
|
52
|
+
If `origin` is your fork and `upstream` is the original repo, `acp -u` pushes to your fork and opens a pull request:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git add .
|
|
56
|
+
git commit -m "<one of 25 random messages>"
|
|
57
|
+
git push origin HEAD:main
|
|
58
|
+
gh pr create --repo <upstream owner>/<repo> --head <your account>:main
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`acp -ua` does the same and then merges it with `gh pr merge --merge`, but only if your account has write access to `upstream` (the write, maintain or admin role). Without it, the pull request is left open for a maintainer and `acp` still finishes successfully.
|
|
62
|
+
|
|
63
|
+
- You need the [GitHub CLI](https://cli.github.com) (`gh`) and a remote called `upstream`. Add one with `git remote add upstream <url>`. Both remotes must be GitHub repos.
|
|
64
|
+
- The pull request goes into the default branch of `upstream`. Its title is your last commit message.
|
|
65
|
+
- If a pull request from that branch is already open, the push updates it and `acp` doesn't open a second one. `-ua` merges the open one.
|
|
66
|
+
- For the merge, `acp` checks two `gh` accounts for write access: the one named like the owner of `upstream` (if you're logged in to it), then the one that opened the pull request. It merges with the first that has it.
|
|
67
|
+
- If the merge fails, the pull request stays open and `acp` prints its link.
|
|
68
|
+
|
|
46
69
|
## Multiple GitHub accounts
|
|
47
70
|
|
|
48
71
|
If you have the [GitHub CLI](https://cli.github.com) (`gh`) installed, `acp` picks the right account for each repo automatically:
|
|
@@ -72,13 +95,12 @@ git commit -m "<one of 25 random messages>"
|
|
|
72
95
|
git-multi-commit
|
|
73
96
|
```
|
|
74
97
|
|
|
75
|
-
No `origin` remote is needed in this case, and `-u` / `-b` are ignored. Install it with `npm install -g git-multi-commit`.
|
|
98
|
+
No `origin` remote is needed in this case, and `-u` / `-ua` / `-b` are ignored. Install it with `npm install -g git-multi-commit`.
|
|
76
99
|
|
|
77
100
|
## Notes
|
|
78
101
|
|
|
79
102
|
- If there is nothing new to commit, `acp` skips the commit and still pushes, so any commits you made earlier get sent.
|
|
80
103
|
- `-b <name>` pushes your current local branch to `<name>` on the remote, creating it there if it doesn't exist yet.
|
|
81
|
-
- `-u` needs a remote called `upstream`. Add one with `git remote add upstream <url>`.
|
|
82
104
|
|
|
83
105
|
## Custom messages
|
|
84
106
|
|
package/bin/acp.js
CHANGED
|
@@ -22,9 +22,11 @@ ${cyan('acp')} — git add, commit and push in one go
|
|
|
22
22
|
Usage: acp [options]
|
|
23
23
|
|
|
24
24
|
Options:
|
|
25
|
-
-u, --upstream Push to
|
|
25
|
+
-u, --upstream Push to origin, then open a pull request to "upstream"
|
|
26
|
+
-ua, --upstream-merge Same as -u, then merge it if you have write access
|
|
26
27
|
-b, --branch <name> Push to <name> instead of "main"
|
|
27
28
|
-m, --message <text> Use your own commit message instead of a random one
|
|
29
|
+
-c, --chunks Split your changes into 10 smaller commits
|
|
28
30
|
-h, --help Show this help
|
|
29
31
|
-v, --version Show the version
|
|
30
32
|
|
|
@@ -33,17 +35,26 @@ GitHub accounts:
|
|
|
33
35
|
the repo owner (github.com/<owner>/...). If none matches, it uses the
|
|
34
36
|
account you used last. Log in to each account once with: gh auth login
|
|
35
37
|
|
|
38
|
+
Pull requests:
|
|
39
|
+
-u and -ua need the GitHub CLI (gh) and a remote called "upstream". The
|
|
40
|
+
pull request goes from <branch> on origin (your fork) to the default
|
|
41
|
+
branch of upstream. If one is already open, the push just updates it.
|
|
42
|
+
-ua only merges if your account can write to upstream (write, maintain
|
|
43
|
+
or admin role). Otherwise the pull request is left open.
|
|
44
|
+
|
|
36
45
|
git-multi-commit:
|
|
37
46
|
If the repo root has a .git-multi-commit.json file, acp still adds and
|
|
38
47
|
commits locally, then runs git-multi-commit instead of git push.
|
|
39
|
-
-u and -b are ignored in that case.
|
|
48
|
+
-u, -ua and -b are ignored in that case.
|
|
40
49
|
|
|
41
50
|
Examples:
|
|
42
51
|
acp ${dim('# push to origin/main')}
|
|
43
|
-
acp -u ${dim('# push to
|
|
52
|
+
acp -u ${dim('# push to origin/main, open a PR to upstream')}
|
|
53
|
+
acp -ua ${dim('# same, then merge the PR if you can')}
|
|
44
54
|
acp -b dev ${dim('# push to origin/dev')}
|
|
45
|
-
acp -u --branch
|
|
55
|
+
acp -u --branch fix ${dim('# push to origin/fix, open a PR to upstream')}
|
|
46
56
|
acp -m "Fix login bug" ${dim('# custom message, push to origin/main')}
|
|
57
|
+
acp -c ${dim('# commit in up to 10 chunks, then push')}
|
|
47
58
|
`;
|
|
48
59
|
|
|
49
60
|
function fail(message) {
|
|
@@ -53,7 +64,7 @@ function fail(message) {
|
|
|
53
64
|
|
|
54
65
|
// ---------- argument parsing ----------
|
|
55
66
|
function parseArgs(argv) {
|
|
56
|
-
const options = {
|
|
67
|
+
const options = { branch: 'main', message: null, pr: false, merge: false, chunks: false };
|
|
57
68
|
|
|
58
69
|
for (let i = 0; i < argv.length; i++) {
|
|
59
70
|
let flag = argv[i];
|
|
@@ -79,7 +90,12 @@ function parseArgs(argv) {
|
|
|
79
90
|
switch (flag) {
|
|
80
91
|
case '-u':
|
|
81
92
|
case '--upstream':
|
|
82
|
-
options.
|
|
93
|
+
options.pr = true;
|
|
94
|
+
break;
|
|
95
|
+
case '-ua':
|
|
96
|
+
case '--upstream-merge':
|
|
97
|
+
options.pr = true;
|
|
98
|
+
options.merge = true;
|
|
83
99
|
break;
|
|
84
100
|
case '-b':
|
|
85
101
|
case '--branch':
|
|
@@ -89,6 +105,10 @@ function parseArgs(argv) {
|
|
|
89
105
|
case '--message':
|
|
90
106
|
options.message = takeValue();
|
|
91
107
|
break;
|
|
108
|
+
case '-c':
|
|
109
|
+
case '--chunks':
|
|
110
|
+
options.chunks = true;
|
|
111
|
+
break;
|
|
92
112
|
case '-h':
|
|
93
113
|
case '--help':
|
|
94
114
|
console.log(HELP);
|
|
@@ -150,10 +170,82 @@ function randomMessage() {
|
|
|
150
170
|
return messages[Math.floor(Math.random() * messages.length)];
|
|
151
171
|
}
|
|
152
172
|
|
|
173
|
+
// ---------- chunked commits ----------
|
|
174
|
+
const MAX_CHUNKS = 10;
|
|
175
|
+
|
|
176
|
+
// The changes that are still uncommitted, as a list of units: each hunk of
|
|
177
|
+
// a tracked file's diff, any change without hunks (binary, mode change), and
|
|
178
|
+
// each untracked file as a whole. Units of one file stay in file order.
|
|
179
|
+
function changeUnits() {
|
|
180
|
+
const diff = git(['diff', '--no-color', '--no-renames', '--binary', '-U0'], { quiet: true }).stdout;
|
|
181
|
+
const units = [];
|
|
182
|
+
|
|
183
|
+
for (const section of diff.split(/^(?=diff --git )/m).filter(Boolean)) {
|
|
184
|
+
const at = section.search(/^@@ /m);
|
|
185
|
+
if (at === -1) {
|
|
186
|
+
units.push({ patch: section });
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const header = section.slice(0, at);
|
|
190
|
+
for (const hunk of section.slice(at).split(/^(?=@@ )/m)) units.push({ patch: header + hunk });
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const untracked = git(['ls-files', '-o', '--exclude-standard', '-z'], { quiet: true }).stdout;
|
|
194
|
+
for (const file of untracked.split('\0').filter(Boolean)) units.push({ file });
|
|
195
|
+
return units;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function stage(unit) {
|
|
199
|
+
if (unit.file) {
|
|
200
|
+
git(['add', '--', unit.file], { quiet: true });
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const result = spawnSync('git', ['apply', '--cached', '--unidiff-zero', '--binary'], {
|
|
204
|
+
input: unit.patch,
|
|
205
|
+
encoding: 'utf8',
|
|
206
|
+
});
|
|
207
|
+
if (result.status !== 0) fail(`Could not stage a change: ${(result.stderr || '').trim()}`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Commits the changes as MAX_CHUNKS commits (fewer if there are fewer separate
|
|
211
|
+
// changes), splitting the individual changes (hunks) as evenly as possible,
|
|
212
|
+
// even within one file. Returns false when there was nothing to commit.
|
|
213
|
+
function commitInChunks(message) {
|
|
214
|
+
// Start from a clean index so each commit holds only its own chunk.
|
|
215
|
+
git(['reset', '-q'], { quiet: true });
|
|
216
|
+
|
|
217
|
+
const total = changeUnits().length;
|
|
218
|
+
if (!total) return false;
|
|
219
|
+
|
|
220
|
+
const count = Math.min(MAX_CHUNKS, total);
|
|
221
|
+
console.log(cyan(`• Splitting ${total} change(s) into ${count} commit(s)`));
|
|
222
|
+
|
|
223
|
+
const pool = [...messages];
|
|
224
|
+
for (let i = 0; i < count; i++) {
|
|
225
|
+
// The diff is read again after every commit, so line numbers stay right.
|
|
226
|
+
const units = changeUnits();
|
|
227
|
+
const take = Math.ceil(units.length / (count - i));
|
|
228
|
+
units.slice(0, take).forEach(stage);
|
|
229
|
+
|
|
230
|
+
let text;
|
|
231
|
+
if (message) {
|
|
232
|
+
text = `${message} (${i + 1}/${count})`;
|
|
233
|
+
} else {
|
|
234
|
+
// Draw without repeats so the log doesn't show the same message twice.
|
|
235
|
+
text = pool.length ? pool.splice(Math.floor(Math.random() * pool.length), 1)[0] : randomMessage();
|
|
236
|
+
}
|
|
237
|
+
step(['commit', '-m', text]);
|
|
238
|
+
}
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
|
|
153
242
|
// ---------- GitHub account picking (via gh CLI) ----------
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
243
|
+
// Returns { owner, name } for a GitHub remote URL (HTTPS or SSH), or null.
|
|
244
|
+
function githubRepo(url) {
|
|
245
|
+
const match = url.match(
|
|
246
|
+
/^(?:https?:\/\/(?:[^@/]+@)?github\.com\/|(?:ssh:\/\/)?git@github\.com[:/])([^/]+)\/([^/]+?)(?:\.git)?\/?$/i
|
|
247
|
+
);
|
|
248
|
+
return match ? { owner: match[1], name: match[2] } : null;
|
|
157
249
|
}
|
|
158
250
|
|
|
159
251
|
// Returns { accounts: [...logins], active: login } or null.
|
|
@@ -202,8 +294,9 @@ function githubAuth(remoteUrl) {
|
|
|
202
294
|
return null;
|
|
203
295
|
}
|
|
204
296
|
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
297
|
+
const repo = githubRepo(remoteUrl);
|
|
298
|
+
if (!repo) return null; // not a GitHub https remote
|
|
299
|
+
const owner = repo.owner;
|
|
207
300
|
|
|
208
301
|
const gh = ghAccounts();
|
|
209
302
|
if (!gh) {
|
|
@@ -248,6 +341,114 @@ function githubAuth(remoteUrl) {
|
|
|
248
341
|
};
|
|
249
342
|
}
|
|
250
343
|
|
|
344
|
+
// ---------- pull requests (via gh CLI) ----------
|
|
345
|
+
// Checks everything -u needs before anything is committed. Returns the
|
|
346
|
+
// upstream repo ("owner/name") plus the owners of upstream and the fork.
|
|
347
|
+
function pullRequestTarget(originUrl) {
|
|
348
|
+
const upstreamUrl = git(['remote', 'get-url', 'upstream'], { quiet: true });
|
|
349
|
+
if (upstreamUrl.status !== 0) {
|
|
350
|
+
fail('Remote "upstream" does not exist. Add it with: git remote add upstream <url>');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const head = githubRepo(originUrl);
|
|
354
|
+
const base = githubRepo(upstreamUrl.stdout.trim());
|
|
355
|
+
if (!head || !base) fail('Pull requests need "origin" and "upstream" to both be GitHub repos.');
|
|
356
|
+
|
|
357
|
+
if (run('gh', ['--version'], { quiet: true }).status !== 0) {
|
|
358
|
+
fail('Pull requests need the GitHub CLI (gh). Install it from https://cli.github.com');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return { repo: `${base.owner}/${base.name}`, baseOwner: base.owner, headOwner: head.owner };
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// True when the gh account behind `env` has write access to `repo`
|
|
365
|
+
// (the write, maintain or admin role), which is what merging needs.
|
|
366
|
+
function canPush(repo, env) {
|
|
367
|
+
const result = run('gh', ['api', `repos/${repo}`], { quiet: true, env });
|
|
368
|
+
try {
|
|
369
|
+
return JSON.parse(result.stdout).permissions.push === true;
|
|
370
|
+
} catch (_) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function sleep(ms) {
|
|
376
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Opens a pull request from <branch> on the fork to upstream's default
|
|
380
|
+
// branch, and merges it when `merge` is set.
|
|
381
|
+
function pullRequest(target, branch, merge) {
|
|
382
|
+
const gh = ghAccounts();
|
|
383
|
+
const accountFor = (owner) => gh && gh.accounts.find((a) => a.toLowerCase() === owner.toLowerCase());
|
|
384
|
+
// GH_TOKEN makes gh act as that account. Without it gh uses its active one.
|
|
385
|
+
const envFor = (login) => {
|
|
386
|
+
const token = login && ghToken(login, login === gh.active);
|
|
387
|
+
return token ? { GH_TOKEN: token } : undefined;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const opener = accountFor(target.headOwner);
|
|
391
|
+
const head = `${target.headOwner}:${branch}`;
|
|
392
|
+
const title = git(['log', '-1', '--pretty=%s'], { quiet: true }).stdout.trim();
|
|
393
|
+
|
|
394
|
+
console.log(cyan(`› gh pr create --repo ${target.repo} --head ${head}`));
|
|
395
|
+
const created = run(
|
|
396
|
+
'gh',
|
|
397
|
+
['pr', 'create', '--repo', target.repo, '--head', head, '--title', title, '--body', ''],
|
|
398
|
+
{ quiet: true, env: envFor(opener) }
|
|
399
|
+
);
|
|
400
|
+
// gh prints the new PR's URL, or the open one's when it already exists.
|
|
401
|
+
const output = `${created.stdout || ''}\n${created.stderr || ''}`;
|
|
402
|
+
const found = output.match(/https:\/\/github\.com\/\S+\/pull\/\d+/);
|
|
403
|
+
if (!found || (created.status !== 0 && !/already exists/i.test(output))) {
|
|
404
|
+
if (created.stderr) process.stderr.write(created.stderr);
|
|
405
|
+
fail(`"gh pr create" failed (exit code ${created.status}).`);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
const url = found[0];
|
|
409
|
+
if (created.status === 0) {
|
|
410
|
+
console.log(green(`✔ Pull request opened: ${url}`));
|
|
411
|
+
} else {
|
|
412
|
+
console.log(yellow(`• Pull request already open, updated by this push: ${url}`));
|
|
413
|
+
}
|
|
414
|
+
if (!merge) return;
|
|
415
|
+
|
|
416
|
+
// Only merge with write access to upstream (write, maintain or admin).
|
|
417
|
+
// The fork's owner often doesn't have it, so the gh account that owns
|
|
418
|
+
// upstream is tried first when there is one.
|
|
419
|
+
const owner = accountFor(target.baseOwner);
|
|
420
|
+
let merger = owner || opener;
|
|
421
|
+
let env = envFor(merger);
|
|
422
|
+
let allowed = canPush(target.repo, env);
|
|
423
|
+
if (!allowed && merger !== opener) {
|
|
424
|
+
merger = opener;
|
|
425
|
+
env = envFor(merger);
|
|
426
|
+
allowed = canPush(target.repo, env);
|
|
427
|
+
}
|
|
428
|
+
if (!allowed) {
|
|
429
|
+
console.log(yellow(`• No write access to ${target.repo}, so the pull request stays open for a maintainer to merge.`));
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (merger && merger !== opener) {
|
|
433
|
+
console.log(cyan(`• Merging with GitHub account "${merger}" (owner of upstream)`));
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
console.log(cyan(`› gh pr merge ${url} --merge`));
|
|
437
|
+
let merged;
|
|
438
|
+
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
439
|
+
merged = run('gh', ['pr', 'merge', url, '--merge'], { quiet: true, env });
|
|
440
|
+
// GitHub needs a moment to work out whether a brand new PR can be merged.
|
|
441
|
+
if (merged.status === 0 || !/GraphQL: .*not mergeable/i.test(merged.stderr || '')) break;
|
|
442
|
+
if (attempt < 3) sleep(2000);
|
|
443
|
+
}
|
|
444
|
+
if (merged.status !== 0) {
|
|
445
|
+
if (merged.stderr) process.stderr.write(merged.stderr);
|
|
446
|
+
console.error(yellow(`⚠ The pull request is still open: ${url}`));
|
|
447
|
+
fail(`"gh pr merge" failed (exit code ${merged.status}).`);
|
|
448
|
+
}
|
|
449
|
+
console.log(green(`✔ Merged into ${target.repo}`));
|
|
450
|
+
}
|
|
451
|
+
|
|
251
452
|
// ---------- git-multi-commit ----------
|
|
252
453
|
// Projects set up with git-multi-commit keep this file in the repo root
|
|
253
454
|
// (the same place git-multi-commit looks for it). For those, acp runs
|
|
@@ -275,7 +476,8 @@ function multiCommit() {
|
|
|
275
476
|
|
|
276
477
|
// ---------- main ----------
|
|
277
478
|
function main() {
|
|
278
|
-
const {
|
|
479
|
+
const { branch, message, pr, merge, chunks } = parseArgs(process.argv.slice(2));
|
|
480
|
+
const remote = 'origin';
|
|
279
481
|
|
|
280
482
|
if (git(['rev-parse', '--is-inside-work-tree'], { quiet: true }).status !== 0) {
|
|
281
483
|
fail('Not inside a git repository.');
|
|
@@ -283,23 +485,31 @@ function main() {
|
|
|
283
485
|
|
|
284
486
|
const multi = usesMultiCommit();
|
|
285
487
|
let remoteUrl;
|
|
488
|
+
let target;
|
|
286
489
|
if (multi) {
|
|
287
490
|
console.log(cyan(`• Found ${MULTI_COMMIT_CONFIG}, pushing with git-multi-commit instead of git push.`));
|
|
288
|
-
if (
|
|
491
|
+
if (pr || branch !== 'main') console.log(yellow('⚠ -u, -ua and -b are ignored for git-multi-commit.'));
|
|
289
492
|
} else {
|
|
290
493
|
remoteUrl = git(['remote', 'get-url', remote], { quiet: true });
|
|
291
494
|
if (remoteUrl.status !== 0) {
|
|
292
495
|
fail(`Remote "${remote}" does not exist. Add it with: git remote add ${remote} <url>`);
|
|
293
496
|
}
|
|
497
|
+
if (pr) target = pullRequestTarget(remoteUrl.stdout.trim());
|
|
294
498
|
}
|
|
295
499
|
|
|
296
|
-
|
|
500
|
+
if (multi && chunks) console.log(yellow('⚠ -c is ignored for git-multi-commit.'));
|
|
297
501
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
console.log(yellow('• Nothing new to commit, pushing existing commits.'));
|
|
502
|
+
if (chunks && !multi) {
|
|
503
|
+
if (!commitInChunks(message)) console.log(yellow('• Nothing new to commit, pushing existing commits.'));
|
|
301
504
|
} else {
|
|
302
|
-
step(['
|
|
505
|
+
step(['add', '.']);
|
|
506
|
+
|
|
507
|
+
// "git diff --cached --quiet" exits 0 when nothing is staged.
|
|
508
|
+
if (git(['diff', '--cached', '--quiet'], { quiet: true }).status === 0) {
|
|
509
|
+
console.log(yellow('• Nothing new to commit, pushing existing commits.'));
|
|
510
|
+
} else {
|
|
511
|
+
step(['commit', '-m', message || randomMessage()]);
|
|
512
|
+
}
|
|
303
513
|
}
|
|
304
514
|
|
|
305
515
|
if (multi) {
|
|
@@ -314,6 +524,8 @@ function main() {
|
|
|
314
524
|
// to <branch> on the remote, so the default always lands on "main".
|
|
315
525
|
step(['push', remote, `HEAD:${branch}`], auth);
|
|
316
526
|
console.log(green(`✔ Pushed to ${remote}/${branch}`));
|
|
527
|
+
|
|
528
|
+
if (pr) pullRequest(target, branch, merge);
|
|
317
529
|
}
|
|
318
530
|
|
|
319
531
|
main();
|
package/lib/messages.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Edit this list freely — acp picks one at random for each commit.
|
|
4
|
-
module.exports = [
|
|
5
|
-
'Update project files',
|
|
6
|
-
'Minor improvements',
|
|
7
|
-
'Small fixes and tweaks',
|
|
8
|
-
'Code cleanup',
|
|
9
|
-
'Refactor for readability',
|
|
10
|
-
'Work in progress',
|
|
11
|
-
'Quick update',
|
|
12
|
-
'Polish things up',
|
|
13
|
-
'Improve code structure',
|
|
14
|
-
'Fix minor issues',
|
|
15
|
-
'Tidy up the codebase',
|
|
16
|
-
'Incremental progress',
|
|
17
|
-
'Save progress',
|
|
18
|
-
'Routine update',
|
|
19
|
-
'Make small adjustments',
|
|
20
|
-
'Keep moving forward',
|
|
21
|
-
'Improve overall quality',
|
|
22
|
-
'Housekeeping',
|
|
23
|
-
'Sync latest changes',
|
|
24
|
-
'Update content',
|
|
25
|
-
'Various small improvements',
|
|
26
|
-
'Clean up and reorganize',
|
|
27
|
-
'Iterate on existing work',
|
|
28
|
-
'Checkpoint commit',
|
|
29
|
-
'Apply latest changes',
|
|
30
|
-
];
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Edit this list freely — acp picks one at random for each commit.
|
|
4
|
+
module.exports = [
|
|
5
|
+
'Update project files',
|
|
6
|
+
'Minor improvements',
|
|
7
|
+
'Small fixes and tweaks',
|
|
8
|
+
'Code cleanup',
|
|
9
|
+
'Refactor for readability',
|
|
10
|
+
'Work in progress',
|
|
11
|
+
'Quick update',
|
|
12
|
+
'Polish things up',
|
|
13
|
+
'Improve code structure',
|
|
14
|
+
'Fix minor issues',
|
|
15
|
+
'Tidy up the codebase',
|
|
16
|
+
'Incremental progress',
|
|
17
|
+
'Save progress',
|
|
18
|
+
'Routine update',
|
|
19
|
+
'Make small adjustments',
|
|
20
|
+
'Keep moving forward',
|
|
21
|
+
'Improve overall quality',
|
|
22
|
+
'Housekeeping',
|
|
23
|
+
'Sync latest changes',
|
|
24
|
+
'Update content',
|
|
25
|
+
'Various small improvements',
|
|
26
|
+
'Clean up and reorganize',
|
|
27
|
+
'Iterate on existing work',
|
|
28
|
+
'Checkpoint commit',
|
|
29
|
+
'Apply latest changes',
|
|
30
|
+
];
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "acp-push",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "git add, commit (with a random message) and push in one command: acp",
|
|
5
|
-
"bin": {
|
|
6
|
-
"acp": "bin/acp.js"
|
|
7
|
-
},
|
|
8
|
-
"files": [
|
|
9
|
-
"bin",
|
|
10
|
-
"lib"
|
|
11
|
-
],
|
|
12
|
-
"keywords": [
|
|
13
|
-
"git",
|
|
14
|
-
"cli",
|
|
15
|
-
"add",
|
|
16
|
-
"commit",
|
|
17
|
-
"push",
|
|
18
|
-
"acp"
|
|
19
|
-
],
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=14"
|
|
22
|
-
},
|
|
23
|
-
"license": "MIT"
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "acp-push",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "git add, commit (with a random message) and push in one command: acp",
|
|
5
|
+
"bin": {
|
|
6
|
+
"acp": "bin/acp.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"lib"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"git",
|
|
14
|
+
"cli",
|
|
15
|
+
"add",
|
|
16
|
+
"commit",
|
|
17
|
+
"push",
|
|
18
|
+
"acp"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=14"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT"
|
|
24
|
+
}
|