@oh-gc/cli 0.4.1 → 0.4.3
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 +43 -37
- package/dist/api/prs.d.ts +18 -2
- package/dist/api/prs.js +9 -0
- package/dist/api/prs.js.map +1 -1
- package/dist/commands/pr/comment.d.ts +16 -0
- package/dist/commands/pr/comment.js +117 -0
- package/dist/commands/pr/comment.js.map +1 -0
- package/dist/commands/pr/create.js +4 -1
- package/dist/commands/pr/create.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
A command-line interface for [GitCode](https://gitcode.com), modeled after GitHub CLI (`gh`). Manage issues, pull requests, and authentication without leaving the terminal.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
oh-gc issue
|
|
7
|
-
oh-gc issue
|
|
8
|
-
oh-gc pr
|
|
9
|
-
oh-gc pr
|
|
6
|
+
oh-gc issue:list
|
|
7
|
+
oh-gc issue:view 12
|
|
8
|
+
oh-gc pr:create --title "Fix login bug" --base main
|
|
9
|
+
oh-gc pr:merge 5 --method squash
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
---
|
|
@@ -39,7 +39,7 @@ npm link
|
|
|
39
39
|
**1. Log in with your GitCode personal access token:**
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
oh-gc auth
|
|
42
|
+
oh-gc auth:login
|
|
43
43
|
# Enter your GitCode personal access token: ••••••••••
|
|
44
44
|
# Logged in as yourname (Your Name)
|
|
45
45
|
```
|
|
@@ -50,13 +50,13 @@ Get a token at: **GitCode → Settings → Access Tokens**
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
cd your-project # must be a git repo with a gitcode.com remote
|
|
53
|
-
oh-gc issue
|
|
53
|
+
oh-gc issue:list
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
If your remote is not named `origin`, configure it:
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
oh-gc repo
|
|
59
|
+
oh-gc repo:set-remote upstream
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
---
|
|
@@ -67,54 +67,60 @@ oh-gc repo set-remote upstream
|
|
|
67
67
|
|
|
68
68
|
| Command | Description |
|
|
69
69
|
|---|---|
|
|
70
|
-
| `oh-gc auth
|
|
71
|
-
| `oh-gc auth
|
|
72
|
-
| `oh-gc auth
|
|
70
|
+
| `oh-gc auth:login` | Log in with a personal access token |
|
|
71
|
+
| `oh-gc auth:logout` | Remove stored token |
|
|
72
|
+
| `oh-gc auth:status` | Show currently logged-in user |
|
|
73
73
|
|
|
74
74
|
### Issues
|
|
75
75
|
|
|
76
76
|
| Command | Description |
|
|
77
77
|
|---|---|
|
|
78
|
-
| `oh-gc issue
|
|
79
|
-
| `oh-gc issue
|
|
80
|
-
| `oh-gc issue
|
|
81
|
-
| `oh-gc issue
|
|
82
|
-
| `oh-gc issue
|
|
83
|
-
| `oh-gc issue
|
|
84
|
-
| `oh-gc issue
|
|
85
|
-
| `oh-gc issue
|
|
86
|
-
| `oh-gc issue
|
|
87
|
-
| `oh-gc issue
|
|
78
|
+
| `oh-gc issue:list` | List open issues |
|
|
79
|
+
| `oh-gc issue:list --state closed` | List closed issues |
|
|
80
|
+
| `oh-gc issue:list --state all` | List all issues |
|
|
81
|
+
| `oh-gc issue:list --assignee alice` | Filter by assignee |
|
|
82
|
+
| `oh-gc issue:list --search "login bug"` | Search by keyword |
|
|
83
|
+
| `oh-gc issue:view <number>` | Show issue detail + recent comments |
|
|
84
|
+
| `oh-gc issue:create` | Create issue interactively |
|
|
85
|
+
| `oh-gc issue:create --title "Bug" --body "..."` | Create issue with flags |
|
|
86
|
+
| `oh-gc issue:create --repo owner/repo --title "Bug"` | Create issue on different repo |
|
|
87
|
+
| `oh-gc issue:comment <number>` | Add a comment interactively |
|
|
88
|
+
| `oh-gc issue:comment <number> --body "..."` | Add a comment with a flag |
|
|
88
89
|
|
|
89
90
|
### Pull Requests
|
|
90
91
|
|
|
91
92
|
| Command | Description |
|
|
92
93
|
|---|---|
|
|
93
|
-
| `oh-gc pr
|
|
94
|
-
| `oh-gc pr
|
|
95
|
-
| `oh-gc pr
|
|
96
|
-
| `oh-gc pr
|
|
97
|
-
| `oh-gc pr
|
|
98
|
-
| `oh-gc pr
|
|
99
|
-
| `oh-gc pr
|
|
100
|
-
| `oh-gc pr
|
|
101
|
-
| `oh-gc pr
|
|
102
|
-
| `oh-gc pr
|
|
94
|
+
| `oh-gc pr:list` | List open pull requests |
|
|
95
|
+
| `oh-gc pr:list --state merged` | List merged PRs |
|
|
96
|
+
| `oh-gc pr:list --author alice` | Filter by author |
|
|
97
|
+
| `oh-gc pr:list --reviewer bob` | Filter by reviewer |
|
|
98
|
+
| `oh-gc pr:view <number>` | Show PR detail |
|
|
99
|
+
| `oh-gc pr:create` | Create PR interactively |
|
|
100
|
+
| `oh-gc pr:create --title "..." --base main` | Create PR with flags |
|
|
101
|
+
| `oh-gc pr:create --repo owner/repo --head feature` | Create cross-repo PR |
|
|
102
|
+
| `oh-gc pr:comment <number>` | Add a comment interactively |
|
|
103
|
+
| `oh-gc pr:comment <number> --body "..."` | Add a comment with a flag |
|
|
104
|
+
| `oh-gc pr:comment <number> --repo owner/repo --body "..."` | Add comment on different repo |
|
|
105
|
+
| `oh-gc pr:comment <number> --body "..." --path file.ts --line 10` | Comment on specific line |
|
|
106
|
+
| `oh-gc pr:merge <number>` | Merge PR (default: merge commit) |
|
|
107
|
+
| `oh-gc pr:merge <number> --method squash` | Squash merge |
|
|
108
|
+
| `oh-gc pr:merge <number> --method rebase` | Rebase merge |
|
|
103
109
|
|
|
104
110
|
### Release
|
|
105
111
|
|
|
106
112
|
| Command | Description |
|
|
107
113
|
|---|---|
|
|
108
|
-
| `oh-gc release
|
|
109
|
-
| `oh-gc release
|
|
110
|
-
| `oh-gc release
|
|
114
|
+
| `oh-gc release:create [VERSION]` | Build, test, and publish a release |
|
|
115
|
+
| `oh-gc release:create v0.3.0` | Create specific version |
|
|
116
|
+
| `oh-gc release:create --prerelease` | Create prerelease |
|
|
111
117
|
|
|
112
118
|
### Repo Config
|
|
113
119
|
|
|
114
120
|
| Command | Description |
|
|
115
121
|
|---|---|
|
|
116
|
-
| `oh-gc repo
|
|
117
|
-
| `oh-gc repo
|
|
122
|
+
| `oh-gc repo:get-remote` | Show which remote `oh-gc` uses |
|
|
123
|
+
| `oh-gc repo:set-remote <name>` | Set which remote `oh-gc` uses |
|
|
118
124
|
|
|
119
125
|
### Global Flags
|
|
120
126
|
|
|
@@ -131,11 +137,11 @@ All commands support:
|
|
|
131
137
|
|
|
132
138
|
### Token
|
|
133
139
|
|
|
134
|
-
Stored at `~/.config/gitcode-cli/config.json`. Set via `oh-gc auth
|
|
140
|
+
Stored at `~/.config/gitcode-cli/config.json`. Set via `oh-gc auth:login`, removed via `oh-gc auth:logout`.
|
|
135
141
|
|
|
136
142
|
### Remote
|
|
137
143
|
|
|
138
|
-
By default `oh-gc` uses the `origin` remote. To use a different remote for a specific repo, run `oh-gc repo
|
|
144
|
+
By default `oh-gc` uses the `origin` remote. To use a different remote for a specific repo, run `oh-gc repo:set-remote <name>`. This writes a `.gitcode` file in the repo root:
|
|
139
145
|
|
|
140
146
|
```json
|
|
141
147
|
{ "remote": "upstream" }
|
package/dist/api/prs.d.ts
CHANGED
|
@@ -48,15 +48,31 @@ export interface ListPRsParams {
|
|
|
48
48
|
}
|
|
49
49
|
export declare function listPRs(token: string, owner: string, repo: string, params?: ListPRsParams): Promise<PR[]>;
|
|
50
50
|
export declare function getPR(token: string, owner: string, repo: string, number: number): Promise<PR>;
|
|
51
|
-
export
|
|
51
|
+
export interface CreatePRParams {
|
|
52
52
|
title: string;
|
|
53
53
|
body: string;
|
|
54
54
|
head: string;
|
|
55
55
|
base: string;
|
|
56
56
|
draft?: boolean;
|
|
57
|
-
|
|
57
|
+
fork_path?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function createPR(token: string, owner: string, repo: string, params: CreatePRParams): Promise<PR>;
|
|
58
60
|
export declare function mergePR(token: string, owner: string, repo: string, number: number, params?: {
|
|
59
61
|
merge_method?: string;
|
|
60
62
|
title?: string;
|
|
61
63
|
description?: string;
|
|
62
64
|
}): Promise<MergeResult>;
|
|
65
|
+
export interface PRComment {
|
|
66
|
+
id: string;
|
|
67
|
+
body: string;
|
|
68
|
+
html_url?: string;
|
|
69
|
+
user?: {
|
|
70
|
+
login: string;
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
created_at?: string;
|
|
74
|
+
}
|
|
75
|
+
export declare function commentPR(token: string, owner: string, repo: string, number: number, body: string, options?: {
|
|
76
|
+
path?: string;
|
|
77
|
+
position?: number;
|
|
78
|
+
}): Promise<PRComment>;
|
package/dist/api/prs.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.listPRs = listPRs;
|
|
|
4
4
|
exports.getPR = getPR;
|
|
5
5
|
exports.createPR = createPR;
|
|
6
6
|
exports.mergePR = mergePR;
|
|
7
|
+
exports.commentPR = commentPR;
|
|
7
8
|
const client_1 = require("./client");
|
|
8
9
|
async function listPRs(token, owner, repo, params = {}) {
|
|
9
10
|
return (0, client_1.apiRequest)(`/repos/${owner}/${repo}/pulls`, token, {
|
|
@@ -22,4 +23,12 @@ async function createPR(token, owner, repo, params) {
|
|
|
22
23
|
async function mergePR(token, owner, repo, number, params = {}) {
|
|
23
24
|
return (0, client_1.apiRequest)(`/repos/${owner}/${repo}/pulls/${number}/merge`, token, { method: 'PUT', body: params });
|
|
24
25
|
}
|
|
26
|
+
async function commentPR(token, owner, repo, number, body, options) {
|
|
27
|
+
const requestBody = { body };
|
|
28
|
+
if (options?.path)
|
|
29
|
+
requestBody.path = options.path;
|
|
30
|
+
if (options?.position !== undefined)
|
|
31
|
+
requestBody.position = options.position;
|
|
32
|
+
return (0, client_1.apiRequest)(`/repos/${owner}/${repo}/pulls/${number}/comments`, token, { method: 'POST', body: requestBody });
|
|
33
|
+
}
|
|
25
34
|
//# sourceMappingURL=prs.js.map
|
package/dist/api/prs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prs.js","sourceRoot":"","sources":["../../src/api/prs.ts"],"names":[],"mappings":";;AAuCA,0BASC;AAED,sBAOC;
|
|
1
|
+
{"version":3,"file":"prs.js","sourceRoot":"","sources":["../../src/api/prs.ts"],"names":[],"mappings":";;AAuCA,0BASC;AAED,sBAOC;AAWD,4BAUC;AAED,0BAYC;AAUD,8BAiBC;AAvHD,qCAAqC;AAuC9B,KAAK,UAAU,OAAO,CAC3B,KAAa,EACb,KAAa,EACb,IAAY,EACZ,SAAwB,EAAE;IAE1B,OAAO,IAAA,mBAAU,EAAO,UAAU,KAAK,IAAI,IAAI,QAAQ,EAAE,KAAK,EAAE;QAC9D,KAAK,EAAE,MAAqD;KAC7D,CAAC,CAAA;AACJ,CAAC;AAEM,KAAK,UAAU,KAAK,CACzB,KAAa,EACb,KAAa,EACb,IAAY,EACZ,MAAc;IAEd,OAAO,IAAA,mBAAU,EAAK,UAAU,KAAK,IAAI,IAAI,UAAU,MAAM,EAAE,EAAE,KAAK,CAAC,CAAA;AACzE,CAAC;AAWM,KAAK,UAAU,QAAQ,CAC5B,KAAa,EACb,KAAa,EACb,IAAY,EACZ,MAAsB;IAEtB,OAAO,IAAA,mBAAU,EAAK,UAAU,KAAK,IAAI,IAAI,QAAQ,EAAE,KAAK,EAAE;QAC5D,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,MAAM;KACb,CAAC,CAAA;AACJ,CAAC;AAEM,KAAK,UAAU,OAAO,CAC3B,KAAa,EACb,KAAa,EACb,IAAY,EACZ,MAAc,EACd,SAA0E,EAAE;IAE5E,OAAO,IAAA,mBAAU,EACf,UAAU,KAAK,IAAI,IAAI,UAAU,MAAM,QAAQ,EAC/C,KAAK,EACL,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAChC,CAAA;AACH,CAAC;AAUM,KAAK,UAAU,SAAS,CAC7B,KAAa,EACb,KAAa,EACb,IAAY,EACZ,MAAc,EACd,IAAY,EACZ,OAA8C;IAE9C,MAAM,WAAW,GAAgD,EAAE,IAAI,EAAE,CAAA;IACzE,IAAI,OAAO,EAAE,IAAI;QAAE,WAAW,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IAClD,IAAI,OAAO,EAAE,QAAQ,KAAK,SAAS;QAAE,WAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IAE5E,OAAO,IAAA,mBAAU,EACf,UAAU,KAAK,IAAI,IAAI,UAAU,MAAM,WAAW,EAClD,KAAK,EACL,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CACtC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class PRComment extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
number: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
body: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
repo: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
path: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
line: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const core_1 = require("@oclif/core");
|
|
37
|
+
const readline = __importStar(require("node:readline"));
|
|
38
|
+
const base_command_1 = require("../../base-command");
|
|
39
|
+
const index_1 = require("../../config/index");
|
|
40
|
+
const index_2 = require("../../git/index");
|
|
41
|
+
const prs_1 = require("../../api/prs");
|
|
42
|
+
const client_1 = require("../../api/client");
|
|
43
|
+
const index_3 = require("../../ui/index");
|
|
44
|
+
class PRComment extends base_command_1.BaseCommand {
|
|
45
|
+
async run() {
|
|
46
|
+
const { args, flags } = await this.parse(PRComment);
|
|
47
|
+
const token = (0, index_1.getToken)();
|
|
48
|
+
if (!token)
|
|
49
|
+
this.error('Not logged in. Run: oh-gc auth:login');
|
|
50
|
+
let owner, repo;
|
|
51
|
+
try {
|
|
52
|
+
if (flags.repo) {
|
|
53
|
+
;
|
|
54
|
+
({ owner, repo } = (0, index_2.parseRepoString)(flags.repo));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
;
|
|
58
|
+
({ owner, repo } = (0, index_2.resolveRepo)());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.error(err.message);
|
|
63
|
+
}
|
|
64
|
+
let body = flags.body;
|
|
65
|
+
if (!body) {
|
|
66
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
67
|
+
body = await new Promise((resolve) => {
|
|
68
|
+
rl.question('Comment: ', (answer) => {
|
|
69
|
+
rl.close();
|
|
70
|
+
resolve(answer.trim());
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (!body)
|
|
75
|
+
this.error('Comment body cannot be empty.');
|
|
76
|
+
try {
|
|
77
|
+
const comment = await (0, prs_1.commentPR)(token, owner, repo, parseInt(args.number, 10), body, flags.path ? { path: flags.path, position: flags.line } : undefined);
|
|
78
|
+
if (flags.json) {
|
|
79
|
+
(0, index_3.printJson)(comment);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (flags.path && flags.line) {
|
|
83
|
+
this.log(`Added comment on PR #${args.number} at ${flags.path}:${flags.line}`);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.log(`Added comment on PR #${args.number}`);
|
|
87
|
+
}
|
|
88
|
+
if (comment.html_url) {
|
|
89
|
+
this.log(comment.html_url);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err instanceof client_1.GitCodeError)
|
|
95
|
+
this.error(err.message);
|
|
96
|
+
this.error('Could not connect to GitCode. Check your internet connection.');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
PRComment.description = 'Add a comment to a pull request';
|
|
101
|
+
PRComment.examples = [
|
|
102
|
+
'<%= config.bin %> pr:comment 12',
|
|
103
|
+
'<%= config.bin %> pr:comment 12 --body "Looks good to me!"',
|
|
104
|
+
'<%= config.bin %> pr:comment 12 --body "Nitpick" --path src/main.ts --line 10',
|
|
105
|
+
];
|
|
106
|
+
PRComment.args = {
|
|
107
|
+
number: core_1.Args.string({ description: 'Pull request number', required: true }),
|
|
108
|
+
};
|
|
109
|
+
PRComment.flags = {
|
|
110
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
111
|
+
body: core_1.Flags.string({ description: 'Comment body' }),
|
|
112
|
+
repo: core_1.Flags.string({ description: 'Target repository (owner/repo), defaults to current repo' }),
|
|
113
|
+
path: core_1.Flags.string({ description: 'File path for line-specific comment (e.g., src/main.ts)' }),
|
|
114
|
+
line: core_1.Flags.integer({ description: 'Line number for line-specific comment' }),
|
|
115
|
+
};
|
|
116
|
+
exports.default = PRComment;
|
|
117
|
+
//# sourceMappingURL=comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/commands/pr/comment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAyC;AACzC,wDAAyC;AACzC,qDAAgD;AAChD,8CAA6C;AAC7C,2CAA8D;AAC9D,uCAAyC;AACzC,6CAA+C;AAC/C,0CAA0C;AAE1C,MAAqB,SAAU,SAAQ,0BAAW;IAkBhD,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;AACM,cAAI,GAAG;IACZ,MAAM,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;CAC5E,CAAA;AACM,eAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;IACxB,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IACnD,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC;IAC/F,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yDAAyD,EAAE,CAAC;IAC9F,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;CAC9E,CAAA;kBAhBkB,SAAS"}
|
|
@@ -83,11 +83,13 @@ class PRCreate extends base_command_1.BaseCommand {
|
|
|
83
83
|
let head = flags.head ?? currentBranch;
|
|
84
84
|
if (!head)
|
|
85
85
|
this.error('Could not determine current branch. Use --head to specify.');
|
|
86
|
-
// For cross-repo PRs, prefix head with fork owner
|
|
86
|
+
// For cross-repo PRs, prefix head with fork owner and set fork_path
|
|
87
|
+
let forkPath;
|
|
87
88
|
if (flags.repo) {
|
|
88
89
|
const forkOwner = (0, index_2.getForkOwner)();
|
|
89
90
|
if (forkOwner && !head.includes(':')) {
|
|
90
91
|
head = `${forkOwner}:${head}`;
|
|
92
|
+
forkPath = `${forkOwner}/${(0, index_2.resolveRepo)().repo}`;
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
const title = flags.title ?? (await prompt('Title: '));
|
|
@@ -101,6 +103,7 @@ class PRCreate extends base_command_1.BaseCommand {
|
|
|
101
103
|
head,
|
|
102
104
|
base: flags.base,
|
|
103
105
|
draft: flags.draft,
|
|
106
|
+
fork_path: forkPath,
|
|
104
107
|
});
|
|
105
108
|
if (flags.json) {
|
|
106
109
|
(0, index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