@oh-gc/cli 0.7.6 → 0.7.7
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 -0
- package/dist/commands/pr/discussions.d.ts +19 -0
- package/dist/commands/pr/discussions.js +111 -0
- package/dist/commands/pr/discussions.js.map +1 -0
- package/dist/commands/search/users.d.ts +16 -0
- package/dist/commands/search/users.js +52 -0
- package/dist/commands/search/users.js.map +1 -0
- package/dist/commands/user/key-get.d.ts +12 -0
- package/dist/commands/user/key-get.js +36 -0
- package/dist/commands/user/key-get.js.map +1 -0
- package/dist/commands/user/update.d.ts +15 -0
- package/dist/commands/user/update.js +60 -0
- package/dist/commands/user/update.js.map +1 -0
- package/package.json +2 -2
- package/skills/gitcode-cli/SKILL.md +2 -2
package/README.md
CHANGED
|
@@ -132,6 +132,7 @@ oh-gc repo set-remote upstream
|
|
|
132
132
|
| `oh-gc pr diff` | View PR changes | [→ Details](docs/commands/en/pr.md#oh-gc-pr-diff) |
|
|
133
133
|
| `oh-gc pr comment` | Add a comment | [→ Details](docs/commands/en/pr.md#oh-gc-pr-comment) |
|
|
134
134
|
| `oh-gc pr comments` | List or delete comments | [→ Details](docs/commands/en/pr.md#oh-gc-pr-comments) |
|
|
135
|
+
| `oh-gc pr discussions` | List discussion threads | [→ Details](docs/commands/en/pr.md#oh-gc-pr-discussions) |
|
|
135
136
|
| `oh-gc pr commits` | List commits in a PR | [→ Details](docs/commands/en/pr.md#oh-gc-pr-commits) |
|
|
136
137
|
| `oh-gc pr logs` | View operation logs | [→ Details](docs/commands/en/pr.md#oh-gc-pr-logs) |
|
|
137
138
|
| `oh-gc pr reactions` | List reactions | [→ Details](docs/commands/en/pr.md#oh-gc-pr-reactions) |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RepoCommand } from '../../repo-command';
|
|
2
|
+
export default class PRDiscussions extends RepoCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
number: import("@oclif/core/lib/interfaces").Arg<number, {
|
|
7
|
+
max?: number | undefined;
|
|
8
|
+
min?: number | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
static flags: {
|
|
12
|
+
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
'comment-type': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
tree: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
repo: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
};
|
|
18
|
+
run(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const repo_command_1 = require("../../repo-command");
|
|
5
|
+
const index_1 = require("../../config/index");
|
|
6
|
+
const prs_1 = require("../../api/prs");
|
|
7
|
+
const client_1 = require("../../api/client");
|
|
8
|
+
const index_2 = require("../../ui/index");
|
|
9
|
+
function stripHtml(html) {
|
|
10
|
+
return html.replace(/<[^>]+>/g, '').trim();
|
|
11
|
+
}
|
|
12
|
+
function truncate(text, max) {
|
|
13
|
+
const clean = stripHtml(text.replace(/\n/g, ' '));
|
|
14
|
+
return clean.length > max ? clean.slice(0, max) + '...' : clean;
|
|
15
|
+
}
|
|
16
|
+
class PRDiscussions extends repo_command_1.RepoCommand {
|
|
17
|
+
async run() {
|
|
18
|
+
const { args, flags } = await this.parse(PRDiscussions);
|
|
19
|
+
const token = (0, index_1.getToken)();
|
|
20
|
+
if (!token)
|
|
21
|
+
this.error('Not logged in. Run: oh-gc auth login');
|
|
22
|
+
let owner, repo;
|
|
23
|
+
try {
|
|
24
|
+
;
|
|
25
|
+
({ owner, repo } = this.resolveRepoFromFlags(flags));
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
this.error(err.message);
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const comments = await (0, prs_1.listPRComments)(token, owner, repo, args.number, {
|
|
32
|
+
per_page: flags.limit,
|
|
33
|
+
comment_type: flags['comment-type'],
|
|
34
|
+
});
|
|
35
|
+
if (flags.json) {
|
|
36
|
+
(0, index_2.printJson)(comments);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (comments.length === 0) {
|
|
40
|
+
this.log('No discussion threads found.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (flags.tree) {
|
|
44
|
+
this.log(`PR #${args.number} Discussions (${comments.length})`);
|
|
45
|
+
comments.forEach((c, i) => {
|
|
46
|
+
const isLast = i === comments.length - 1;
|
|
47
|
+
const branch = isLast ? '└── ' : '├── ';
|
|
48
|
+
const pipe = isLast ? ' ' : '│ ';
|
|
49
|
+
const resolvedTag = c.resolved === false ? ' [unresolved]' : c.resolved === true ? ' [resolved]' : '';
|
|
50
|
+
const author = c.user?.login ?? '-';
|
|
51
|
+
const created = c.created_at ? (0, index_2.formatDate)(c.created_at) : '-';
|
|
52
|
+
this.log(`${branch}#${c.id} @${author} ${created}${resolvedTag}`);
|
|
53
|
+
this.log(`${pipe}├── ${truncate(c.body || '(no body)', 100)}`);
|
|
54
|
+
const replies = c.reply ?? [];
|
|
55
|
+
replies.forEach((r, j) => {
|
|
56
|
+
const rLast = j === replies.length - 1;
|
|
57
|
+
const rBranch = rLast ? '└── ' : '├── ';
|
|
58
|
+
const rAuthor = r.user?.login ?? '-';
|
|
59
|
+
const rCreated = r.created_at ? (0, index_2.formatDate)(r.created_at) : '-';
|
|
60
|
+
this.log(`${pipe}${rBranch}@${rAuthor} ${rCreated}: ${truncate(r.body || '(no body)', 100)}`);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
for (const c of comments) {
|
|
66
|
+
const author = c.user?.login ?? '-';
|
|
67
|
+
const created = c.created_at ? (0, index_2.formatDate)(c.created_at) : '-';
|
|
68
|
+
const replies = c.reply ?? [];
|
|
69
|
+
const resolvedLabel = c.resolved === false ? ' [unresolved]' : c.resolved === true ? ' [resolved]' : '';
|
|
70
|
+
const replyLabel = replies.length > 0 ? ` (${replies.length} ${replies.length === 1 ? 'reply' : 'replies'})` : '';
|
|
71
|
+
this.log(`Thread #${c.id} @${author} ${created}${replyLabel}${resolvedLabel}`);
|
|
72
|
+
this.log(` ${truncate(c.body || '(no body)', 100)}`);
|
|
73
|
+
for (const reply of replies) {
|
|
74
|
+
const rAuthor = reply.user?.login ?? '-';
|
|
75
|
+
const rCreated = reply.created_at ? (0, index_2.formatDate)(reply.created_at) : '-';
|
|
76
|
+
this.log(` └─ @${rAuthor} ${rCreated}: ${truncate(reply.body || '(no body)', 100)}`);
|
|
77
|
+
}
|
|
78
|
+
this.log('');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
if (err instanceof client_1.GitCodeError)
|
|
83
|
+
this.error(err.message);
|
|
84
|
+
this.error('Could not connect to GitCode. Check your internet connection.');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
PRDiscussions.description = 'List discussion threads on a pull request';
|
|
89
|
+
PRDiscussions.examples = [
|
|
90
|
+
'<%= config.bin %> pr discussions 5',
|
|
91
|
+
'<%= config.bin %> pr discussions 5 --tree',
|
|
92
|
+
'<%= config.bin %> pr discussions 5 --limit 50',
|
|
93
|
+
'<%= config.bin %> pr discussions 5 --comment-type diff_comment',
|
|
94
|
+
];
|
|
95
|
+
PRDiscussions.args = {
|
|
96
|
+
number: core_1.Args.integer({ description: 'PR number', required: true }),
|
|
97
|
+
};
|
|
98
|
+
PRDiscussions.flags = {
|
|
99
|
+
...repo_command_1.RepoCommand.repoFlags,
|
|
100
|
+
limit: core_1.Flags.integer({ description: 'Max number of comments to fetch', default: 100 }),
|
|
101
|
+
'comment-type': core_1.Flags.string({
|
|
102
|
+
description: 'Filter by comment type',
|
|
103
|
+
options: ['diff_comment', 'pr_comment'],
|
|
104
|
+
}),
|
|
105
|
+
tree: core_1.Flags.boolean({
|
|
106
|
+
description: 'Display threads as a tree',
|
|
107
|
+
default: false,
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
exports.default = PRDiscussions;
|
|
111
|
+
//# sourceMappingURL=discussions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discussions.js","sourceRoot":"","sources":["../../../src/commands/pr/discussions.ts"],"names":[],"mappings":";;AAAA,sCAAyC;AACzC,qDAAgD;AAChD,8CAA6C;AAC7C,uCAA8C;AAC9C,6CAA+C;AAC/C,0CAAsD;AAoBtD,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AAC5C,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,GAAW;IACzC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IACjD,OAAO,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACjE,CAAC;AAED,MAAqB,aAAc,SAAQ,0BAAW;IAwBpD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAEvD,MAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAA;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AO,EAAE,KAAK;KACf,CAAC;CACH,CAAA;kBAtBkB,aAAa"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class SearchUsers extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
order: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
'per-page': import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static args: {
|
|
13
|
+
query: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_command_1 = require("../../base-command");
|
|
4
|
+
const search_1 = require("../../api/search");
|
|
5
|
+
const config_1 = require("../../config");
|
|
6
|
+
const ui_1 = require("../../ui");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
class SearchUsers extends base_command_1.BaseCommand {
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags, args } = await this.parse(SearchUsers);
|
|
11
|
+
const token = (0, config_1.getToken)();
|
|
12
|
+
if (!token) {
|
|
13
|
+
this.error('Not authenticated. Run: oh-gc auth login');
|
|
14
|
+
}
|
|
15
|
+
const result = await (0, search_1.searchUsers)(token, {
|
|
16
|
+
q: args.query,
|
|
17
|
+
sort: flags.sort,
|
|
18
|
+
order: flags.order,
|
|
19
|
+
page: flags.page,
|
|
20
|
+
per_page: flags['per-page'],
|
|
21
|
+
});
|
|
22
|
+
if (flags.json) {
|
|
23
|
+
(0, ui_1.printJson)(result);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.log(`Found ${result.total_count} users`);
|
|
27
|
+
if (result.items.length > 0) {
|
|
28
|
+
(0, ui_1.printTable)(result.items.map((u) => ({
|
|
29
|
+
login: u.login,
|
|
30
|
+
name: u.name,
|
|
31
|
+
})), ['login', 'name']);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
SearchUsers.description = 'Search users';
|
|
37
|
+
SearchUsers.examples = [
|
|
38
|
+
'<%= config.bin %> search users alice',
|
|
39
|
+
'<%= config.bin %> search users "john doe" --sort joined_at',
|
|
40
|
+
];
|
|
41
|
+
SearchUsers.flags = {
|
|
42
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
43
|
+
sort: core_1.Flags.string({ description: 'Sort field', options: ['joined_at'] }),
|
|
44
|
+
order: core_1.Flags.string({ description: 'Sort order', options: ['asc', 'desc'] }),
|
|
45
|
+
page: core_1.Flags.integer({ description: 'Page number', default: 1 }),
|
|
46
|
+
'per-page': core_1.Flags.integer({ description: 'Results per page', default: 30 }),
|
|
47
|
+
};
|
|
48
|
+
SearchUsers.args = {
|
|
49
|
+
query: core_1.Args.string({ description: 'Search query', required: true }),
|
|
50
|
+
};
|
|
51
|
+
exports.default = SearchUsers;
|
|
52
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/commands/search/users.ts"],"names":[],"mappings":";;AAAA,qDAAgD;AAChD,6CAA8C;AAC9C,yCAAuC;AACvC,iCAAgD;AAChD,sCAAyC;AAEzC,MAAqB,WAAY,SAAQ,0BAAW;IAoBlD,KAAK,CAAC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,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;IACzE,KAAK,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;IAC5E,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC/D,UAAU,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAC5E,CAAA;AAEM,gBAAI,GAAG;IACZ,KAAK,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;CACpE,CAAA;kBAlBkB,WAAW"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class UserKeyGet extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
static args: {
|
|
9
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_command_1 = require("../../base-command");
|
|
4
|
+
const user_1 = require("../../api/user");
|
|
5
|
+
const config_1 = require("../../config");
|
|
6
|
+
const ui_1 = require("../../ui");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
class UserKeyGet extends base_command_1.BaseCommand {
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags, args } = await this.parse(UserKeyGet);
|
|
11
|
+
const token = (0, config_1.getToken)();
|
|
12
|
+
if (!token) {
|
|
13
|
+
this.error('Not authenticated. Run: oh-gc auth login');
|
|
14
|
+
}
|
|
15
|
+
const key = await (0, user_1.getUserKey)(token, args.id);
|
|
16
|
+
if (flags.json) {
|
|
17
|
+
(0, ui_1.printJson)(key);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.log(`ID: ${key.id}`);
|
|
21
|
+
this.log(`Title: ${key.title}`);
|
|
22
|
+
this.log(`Key: ${key.key}`);
|
|
23
|
+
this.log(`Created: ${key.created_at}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
UserKeyGet.description = 'View an SSH public key';
|
|
28
|
+
UserKeyGet.examples = ['<%= config.bin %> user key-get 12345'];
|
|
29
|
+
UserKeyGet.flags = {
|
|
30
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
31
|
+
};
|
|
32
|
+
UserKeyGet.args = {
|
|
33
|
+
id: core_1.Args.string({ description: 'Key ID', required: true }),
|
|
34
|
+
};
|
|
35
|
+
exports.default = UserKeyGet;
|
|
36
|
+
//# sourceMappingURL=key-get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-get.js","sourceRoot":"","sources":["../../../src/commands/user/key-get.ts"],"names":[],"mappings":";;AAAA,qDAAgD;AAChD,yCAA2C;AAC3C,yCAAuC;AACvC,iCAAoC;AACpC,sCAAkC;AAElC,MAAqB,UAAW,SAAQ,0BAAW;IAajD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACpD,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAA;QACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACxD,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;QAE5C,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,IAAA,cAAS,EAAC,GAAG,CAAC,CAAA;QAChB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;YACzB,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YAC/B,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;YAC3B,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;;AA7BM,sBAAW,GAAG,wBAAwB,CAAA;AAEtC,mBAAQ,GAAG,CAAC,sCAAsC,CAAC,CAAA;AAEnD,gBAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;CACzB,CAAA;AAEM,eAAI,GAAG;IACZ,EAAE,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;CAC3D,CAAA;kBAXkB,UAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class UserUpdate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
company: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
bio: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
blog: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
location: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_command_1 = require("../../base-command");
|
|
4
|
+
const user_1 = require("../../api/user");
|
|
5
|
+
const config_1 = require("../../config");
|
|
6
|
+
const ui_1 = require("../../ui");
|
|
7
|
+
const core_1 = require("@oclif/core");
|
|
8
|
+
class UserUpdate extends base_command_1.BaseCommand {
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(UserUpdate);
|
|
11
|
+
const token = (0, config_1.getToken)();
|
|
12
|
+
if (!token) {
|
|
13
|
+
this.error('Not authenticated. Run: oh-gc auth login');
|
|
14
|
+
}
|
|
15
|
+
const data = {};
|
|
16
|
+
if (flags.name)
|
|
17
|
+
data.nickname = flags.name;
|
|
18
|
+
if (flags.company)
|
|
19
|
+
data.company = flags.company;
|
|
20
|
+
if (flags.bio)
|
|
21
|
+
data.description = flags.bio;
|
|
22
|
+
if (flags.email)
|
|
23
|
+
data.email = flags.email;
|
|
24
|
+
if (flags.blog)
|
|
25
|
+
data.website = flags.blog;
|
|
26
|
+
if (flags.location)
|
|
27
|
+
data.location = flags.location;
|
|
28
|
+
if (Object.keys(data).length === 0) {
|
|
29
|
+
this.error('Provide at least one field to update (--name, --company, --bio, --email, --blog, --location)');
|
|
30
|
+
}
|
|
31
|
+
const user = await (0, user_1.updateCurrentUser)(token, data);
|
|
32
|
+
if (flags.json) {
|
|
33
|
+
(0, ui_1.printJson)(user);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.log(`Updated profile for ${user.login}`);
|
|
37
|
+
this.log(`Name: ${user.name || 'N/A'}`);
|
|
38
|
+
this.log(`Company: ${user.company || 'N/A'}`);
|
|
39
|
+
this.log(`Bio: ${user.bio || 'N/A'}`);
|
|
40
|
+
this.log(`Location: ${user.location || 'N/A'}`);
|
|
41
|
+
this.log(`Blog: ${user.blog || 'N/A'}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
UserUpdate.description = 'Update authenticated user profile';
|
|
46
|
+
UserUpdate.examples = [
|
|
47
|
+
'<%= config.bin %> user update --name "New Name"',
|
|
48
|
+
'<%= config.bin %> user update --company "New Corp" --location "Shanghai"',
|
|
49
|
+
];
|
|
50
|
+
UserUpdate.flags = {
|
|
51
|
+
...base_command_1.BaseCommand.baseFlags,
|
|
52
|
+
name: core_1.Flags.string({ description: 'Display name' }),
|
|
53
|
+
company: core_1.Flags.string({ description: 'Company' }),
|
|
54
|
+
bio: core_1.Flags.string({ description: 'Bio / description' }),
|
|
55
|
+
email: core_1.Flags.string({ description: 'Public email' }),
|
|
56
|
+
blog: core_1.Flags.string({ description: 'Blog / website URL' }),
|
|
57
|
+
location: core_1.Flags.string({ description: 'Location' }),
|
|
58
|
+
};
|
|
59
|
+
exports.default = UserUpdate;
|
|
60
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/user/update.ts"],"names":[],"mappings":";;AAAA,qDAAgD;AAChD,yCAAkD;AAClD,yCAAuC;AACvC,iCAAoC;AACpC,sCAAmC;AAEnC,MAAqB,UAAW,SAAQ,0BAAW;IAkBjD,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;Q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I,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAA;YAC7C,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,CAAC,CAAA;YACrC,IAAI,CAAC,GAAG,CAAC,aAAa,IAAI,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAA;YAC/C,IAAI,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;;AAhDM,sBAAW,GAAG,mCAAmC,CAAA;AAEjD,mBAAQ,GAAG;IAChB,iDAAiD;IACjD,0EAA0E;CAC3E,CAAA;AAEM,gBAAK,GAAG;IACb,GAAG,0BAAW,CAAC,SAAS;IACxB,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IACnD,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;IACjD,GAAG,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACvD,KAAK,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IACpD,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACzD,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;CACpD,CAAA;kBAhBkB,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-gc/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "GitCode CLI — manage issues and PRs from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "guozejun",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"bin": {
|
|
29
|
-
"oh-gc": "
|
|
29
|
+
"oh-gc": "bin/run.js"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"bin/",
|
|
@@ -5,7 +5,7 @@ description: Use when managing GitCode repositories from the terminal with the o
|
|
|
5
5
|
|
|
6
6
|
# oh-gc CLI - GitCode Command Line Tool
|
|
7
7
|
|
|
8
|
-
**Version:** 0.7.
|
|
8
|
+
**Version:** 0.7.7 | **Updated:** 2026-05-27
|
|
9
9
|
|
|
10
10
|
`oh-gc` is a CLI for [GitCode](https://gitcode.com), modeled after GitHub CLI (`gh`). It manages authentication, issues, pull requests, releases, repository settings, and repository content from the terminal.
|
|
11
11
|
|
|
@@ -114,7 +114,7 @@ Read [references/commands.md](references/commands.md) for the full command catal
|
|
|
114
114
|
|
|
115
115
|
- Auth: `oh-gc auth login/status/logout`
|
|
116
116
|
- Issues: `oh-gc issue list/view/create/update/comment/close/reopen/labels/history/reactions/prs/branches`
|
|
117
|
-
- PRs: `oh-gc pr list/view/create/update/close/reopen/diff/comment/comments/reviewers/testers/review/test/labels/link/merge/files/history/logs`
|
|
117
|
+
- PRs: `oh-gc pr list/view/create/update/close/reopen/diff/comment/comments/discussions/reviewers/testers/review/test/labels/link/merge/files/history/logs`
|
|
118
118
|
- Repos: `oh-gc repo list/view/create/update/delete/fork/forks/settings/languages/contributors/events/stats/archive/transition/module/roles/transfer`
|
|
119
119
|
- Users: `oh-gc user view/edit/emails/followers/following/events/search/keys/starred/subscriptions/issues/prs/orgs`
|
|
120
120
|
- Branches/tags: `oh-gc branch ...`, `oh-gc tag ...`
|