git-stack-cli 0.5.2 → 0.7.0
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 +1 -1
- package/dist/__fixtures__/metadata.js +7 -30
- package/dist/app/AutoUpdate.js +5 -4
- package/dist/app/Brackets.js +3 -2
- package/dist/app/Command.js +2 -1
- package/dist/app/Debug.js +2 -1
- package/dist/app/DependencyCheck.js +10 -9
- package/dist/app/GatherMetadata.js +37 -4
- package/dist/app/GithubApiError.js +3 -2
- package/dist/app/LocalCommitStatus.js +2 -1
- package/dist/app/LocalMergeRebase.js +12 -10
- package/dist/app/ManualRebase.js +21 -6
- package/dist/app/MultiSelect.js +7 -5
- package/dist/app/Parens.js +2 -1
- package/dist/app/SelectCommitRanges.js +15 -14
- package/dist/app/Status.js +4 -3
- package/dist/app/StatusTable.js +29 -21
- package/dist/app/Store.js +3 -1
- package/dist/app/Table.js +10 -8
- package/dist/app/TextInput.js +16 -2
- package/dist/app/Url.js +2 -2
- package/dist/app/YesNoPrompt.js +5 -4
- package/dist/command.js +12 -1
- package/dist/core/CommitMetadata.js +6 -4
- package/dist/core/Metadata copy.js +37 -0
- package/dist/core/Metadata.js +0 -1
- package/dist/core/StackSummaryTable.js +35 -0
- package/dist/core/StackTable.js +38 -0
- package/dist/core/SummaryTable.js +38 -0
- package/dist/core/chalk.js +83 -0
- package/dist/core/colors.js +15 -0
- package/dist/core/github.js +23 -7
- package/package.json +3 -2
package/dist/core/github.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
2
5
|
import * as Ink from "ink";
|
|
3
6
|
import { Brackets } from "../app/Brackets.js";
|
|
4
7
|
import { Store } from "../app/Store.js";
|
|
8
|
+
import { colors } from "../core/colors.js";
|
|
5
9
|
import { cli } from "./cli.js";
|
|
6
10
|
import { invariant } from "./invariant.js";
|
|
7
11
|
import { safe_quote } from "./safe_quote.js";
|
|
8
12
|
// prettier-ignore
|
|
9
|
-
const JSON_FIELDS = "--json number,state,baseRefName,headRefName,commits,title,url";
|
|
13
|
+
const JSON_FIELDS = "--json number,state,baseRefName,headRefName,commits,title,body,url";
|
|
10
14
|
export async function pr_list() {
|
|
11
15
|
const state = Store.getState();
|
|
12
16
|
const actions = state.actions;
|
|
@@ -24,7 +28,7 @@ export async function pr_list() {
|
|
|
24
28
|
if (actions.isDebug()) {
|
|
25
29
|
actions.output(React.createElement(Ink.Text, { dimColor: true },
|
|
26
30
|
React.createElement(Ink.Text, null, "Github cache "),
|
|
27
|
-
React.createElement(Ink.Text, { bold: true, color:
|
|
31
|
+
React.createElement(Ink.Text, { bold: true, color: colors.yellow }, result_pr_list.length),
|
|
28
32
|
React.createElement(Ink.Text, null, " open PRs from "),
|
|
29
33
|
React.createElement(Brackets, null, repo_path),
|
|
30
34
|
React.createElement(Ink.Text, null, " authored by "),
|
|
@@ -50,7 +54,7 @@ export async function pr_status(branch) {
|
|
|
50
54
|
actions.output(React.createElement(Ink.Text, null,
|
|
51
55
|
React.createElement(Ink.Text, { dimColor: true }, "Github pr_status cache"),
|
|
52
56
|
React.createElement(Ink.Text, null, " "),
|
|
53
|
-
React.createElement(Ink.Text, { bold: true, color:
|
|
57
|
+
React.createElement(Ink.Text, { bold: true, color: colors.green }, "HIT "),
|
|
54
58
|
React.createElement(Ink.Text, null, " "),
|
|
55
59
|
React.createElement(Ink.Text, { dimColor: true }, branch)));
|
|
56
60
|
}
|
|
@@ -60,7 +64,7 @@ export async function pr_status(branch) {
|
|
|
60
64
|
actions.output(React.createElement(Ink.Text, null,
|
|
61
65
|
React.createElement(Ink.Text, { dimColor: true }, "Github pr_status cache"),
|
|
62
66
|
React.createElement(Ink.Text, null, " "),
|
|
63
|
-
React.createElement(Ink.Text, { bold: true, color:
|
|
67
|
+
React.createElement(Ink.Text, { bold: true, color: colors.red }, "MISS"),
|
|
64
68
|
React.createElement(Ink.Text, null, " "),
|
|
65
69
|
React.createElement(Ink.Text, { dimColor: true }, branch)));
|
|
66
70
|
}
|
|
@@ -79,13 +83,15 @@ export async function pr_status(branch) {
|
|
|
79
83
|
}
|
|
80
84
|
export async function pr_create(args) {
|
|
81
85
|
const title = safe_quote(args.title);
|
|
82
|
-
const cli_result = await cli(`gh pr create --fill --head ${args.branch} --base ${args.base} --title="${title}"`);
|
|
86
|
+
const cli_result = await cli(`gh pr create --fill --head ${args.branch} --base ${args.base} --title="${title}" --body="${args.body}"`);
|
|
83
87
|
if (cli_result.code !== 0) {
|
|
84
88
|
handle_error(cli_result.output);
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
|
-
export async function
|
|
88
|
-
const cli_result = await cli(
|
|
91
|
+
export async function pr_edit(args) {
|
|
92
|
+
const cli_result = await cli(
|
|
93
|
+
// prettier-ignore
|
|
94
|
+
`gh pr edit ${args.branch} --base ${args.base} --body-file="${body_file(args.body)}"`);
|
|
89
95
|
if (cli_result.code !== 0) {
|
|
90
96
|
handle_error(cli_result.output);
|
|
91
97
|
}
|
|
@@ -98,3 +104,13 @@ function handle_error(output) {
|
|
|
98
104
|
});
|
|
99
105
|
throw new Error(output);
|
|
100
106
|
}
|
|
107
|
+
// convert a string to a file for use via github cli `--body-file`
|
|
108
|
+
function body_file(body) {
|
|
109
|
+
const temp_dir = os.tmpdir();
|
|
110
|
+
const temp_path = path.join(temp_dir, "git-stack-body");
|
|
111
|
+
if (fs.existsSync(temp_path)) {
|
|
112
|
+
fs.rmSync(temp_path);
|
|
113
|
+
}
|
|
114
|
+
fs.writeFileSync(temp_path, body);
|
|
115
|
+
return temp_path;
|
|
116
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-stack-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "magus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"dev": "tsc --watch",
|
|
22
22
|
"lint": "eslint . --fix",
|
|
23
23
|
"prettier": "prettier ./src --write",
|
|
24
|
-
"test": "npm run prettier && npm run lint && npm run build"
|
|
24
|
+
"test": "npm run prettier && npm run lint && npm run build",
|
|
25
|
+
"prepublishOnly": "npm test"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"chalk": "^5.3.0",
|