@digitalpresence/cliclaw 0.2.0 → 0.3.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/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/cron.d.ts.map +1 -1
- package/dist/commands/cron.js +1 -0
- package/dist/commands/cron.js.map +1 -1
- package/dist/commands/github.d.ts +6 -0
- package/dist/commands/github.d.ts.map +1 -0
- package/dist/commands/github.js +179 -0
- package/dist/commands/github.js.map +1 -0
- package/dist/cron/progress.d.ts +1 -0
- package/dist/cron/progress.d.ts.map +1 -1
- package/dist/cron/progress.js.map +1 -1
- package/dist/cron/ralph-wiggum.d.ts +1 -0
- package/dist/cron/ralph-wiggum.d.ts.map +1 -1
- package/dist/cron/ralph-wiggum.js +65 -19
- package/dist/cron/ralph-wiggum.js.map +1 -1
- package/dist/github/api.d.ts +5 -0
- package/dist/github/api.d.ts.map +1 -0
- package/dist/github/api.js +54 -0
- package/dist/github/api.js.map +1 -0
- package/dist/github/handlers.d.ts +18 -0
- package/dist/github/handlers.d.ts.map +1 -0
- package/dist/github/handlers.js +191 -0
- package/dist/github/handlers.js.map +1 -0
- package/package.json +1 -1
- package/src/cli.ts +3 -1
- package/src/commands/cron.ts +1 -0
- package/src/commands/github.ts +214 -0
- package/src/cron/progress.ts +1 -0
- package/src/cron/ralph-wiggum.ts +72 -20
- package/src/github/api.ts +73 -0
- package/src/github/handlers.ts +325 -0
- package/.turbo/turbo-dev.log +0 -7
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TokenStore } from "@digitalpresence/cliclaw-auth";
|
|
2
|
+
export declare function handleWhoami(tokenStore: TokenStore, account: string): Promise<void>;
|
|
3
|
+
export declare function handleRepos(tokenStore: TokenStore, account: string, maxResults: number, type: string, sort: string): Promise<void>;
|
|
4
|
+
export declare function handleRepoGet(tokenStore: TokenStore, account: string, owner: string, repo: string): Promise<void>;
|
|
5
|
+
export declare function handleIssues(tokenStore: TokenStore, account: string, owner: string, repo: string, state: string, maxResults: number): Promise<void>;
|
|
6
|
+
export declare function handleIssueGet(tokenStore: TokenStore, account: string, owner: string, repo: string, number: number): Promise<void>;
|
|
7
|
+
export declare function handleIssueCreate(tokenStore: TokenStore, account: string, owner: string, repo: string, title: string, body?: string, labels?: string[]): Promise<void>;
|
|
8
|
+
export declare function handleIssueComment(tokenStore: TokenStore, account: string, owner: string, repo: string, number: number, body: string): Promise<void>;
|
|
9
|
+
export declare function handleIssueClose(tokenStore: TokenStore, account: string, owner: string, repo: string, number: number): Promise<void>;
|
|
10
|
+
export declare function handlePulls(tokenStore: TokenStore, account: string, owner: string, repo: string, state: string, maxResults: number): Promise<void>;
|
|
11
|
+
export declare function handlePullGet(tokenStore: TokenStore, account: string, owner: string, repo: string, number: number): Promise<void>;
|
|
12
|
+
export declare function handlePullReviews(tokenStore: TokenStore, account: string, owner: string, repo: string, number: number): Promise<void>;
|
|
13
|
+
export declare function handlePullMerge(tokenStore: TokenStore, account: string, owner: string, repo: string, number: number, method: string): Promise<void>;
|
|
14
|
+
export declare function handleNotifications(tokenStore: TokenStore, account: string, maxResults: number): Promise<void>;
|
|
15
|
+
export declare function handleSearch(tokenStore: TokenStore, account: string, query: string, type: string, maxResults: number): Promise<void>;
|
|
16
|
+
export declare function handleWorkflowRuns(tokenStore: TokenStore, account: string, owner: string, repo: string, maxResults: number): Promise<void>;
|
|
17
|
+
export declare function handleWorkflowRunLogs(tokenStore: TokenStore, account: string, owner: string, repo: string, runId: number): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/github/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAMhE,wBAAsB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,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AM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { getToken, githubFetch, githubFetchPaginated } from "./api.js";
|
|
2
|
+
import { outputJson, outputError } from "../lib/output.js";
|
|
3
|
+
// --- User ---
|
|
4
|
+
export async function handleWhoami(tokenStore, account) {
|
|
5
|
+
const token = getToken(tokenStore, account);
|
|
6
|
+
try {
|
|
7
|
+
const user = await githubFetch(token, "/user");
|
|
8
|
+
outputJson(user);
|
|
9
|
+
}
|
|
10
|
+
catch (err) {
|
|
11
|
+
outputError("whoami_failed", err instanceof Error ? err.message : String(err));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// --- Repos ---
|
|
15
|
+
export async function handleRepos(tokenStore, account, maxResults, type, sort) {
|
|
16
|
+
const token = getToken(tokenStore, account);
|
|
17
|
+
try {
|
|
18
|
+
const repos = await githubFetchPaginated(token, `/user/repos?type=${type}&sort=${sort}`, maxResults);
|
|
19
|
+
outputJson(repos);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
outputError("repos_failed", err instanceof Error ? err.message : String(err));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function handleRepoGet(tokenStore, account, owner, repo) {
|
|
26
|
+
const token = getToken(tokenStore, account);
|
|
27
|
+
try {
|
|
28
|
+
const data = await githubFetch(token, `/repos/${owner}/${repo}`);
|
|
29
|
+
outputJson(data);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
outputError("repo_get_failed", err instanceof Error ? err.message : String(err));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// --- Issues ---
|
|
36
|
+
export async function handleIssues(tokenStore, account, owner, repo, state, maxResults) {
|
|
37
|
+
const token = getToken(tokenStore, account);
|
|
38
|
+
try {
|
|
39
|
+
const issues = await githubFetchPaginated(token, `/repos/${owner}/${repo}/issues?state=${state}`, maxResults);
|
|
40
|
+
outputJson(issues);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
outputError("issues_failed", err instanceof Error ? err.message : String(err));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export async function handleIssueGet(tokenStore, account, owner, repo, number) {
|
|
47
|
+
const token = getToken(tokenStore, account);
|
|
48
|
+
try {
|
|
49
|
+
const issue = await githubFetch(token, `/repos/${owner}/${repo}/issues/${number}`);
|
|
50
|
+
outputJson(issue);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
outputError("issue_get_failed", err instanceof Error ? err.message : String(err));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export async function handleIssueCreate(tokenStore, account, owner, repo, title, body, labels) {
|
|
57
|
+
const token = getToken(tokenStore, account);
|
|
58
|
+
try {
|
|
59
|
+
const payload = { title };
|
|
60
|
+
if (body)
|
|
61
|
+
payload.body = body;
|
|
62
|
+
if (labels?.length)
|
|
63
|
+
payload.labels = labels;
|
|
64
|
+
const issue = await githubFetch(token, `/repos/${owner}/${repo}/issues`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: { "Content-Type": "application/json" },
|
|
67
|
+
body: JSON.stringify(payload),
|
|
68
|
+
});
|
|
69
|
+
outputJson(issue);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
outputError("issue_create_failed", err instanceof Error ? err.message : String(err));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export async function handleIssueComment(tokenStore, account, owner, repo, number, body) {
|
|
76
|
+
const token = getToken(tokenStore, account);
|
|
77
|
+
try {
|
|
78
|
+
const comment = await githubFetch(token, `/repos/${owner}/${repo}/issues/${number}/comments`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: { "Content-Type": "application/json" },
|
|
81
|
+
body: JSON.stringify({ body }),
|
|
82
|
+
});
|
|
83
|
+
outputJson(comment);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
outputError("issue_comment_failed", err instanceof Error ? err.message : String(err));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export async function handleIssueClose(tokenStore, account, owner, repo, number) {
|
|
90
|
+
const token = getToken(tokenStore, account);
|
|
91
|
+
try {
|
|
92
|
+
const issue = await githubFetch(token, `/repos/${owner}/${repo}/issues/${number}`, {
|
|
93
|
+
method: "PATCH",
|
|
94
|
+
headers: { "Content-Type": "application/json" },
|
|
95
|
+
body: JSON.stringify({ state: "closed" }),
|
|
96
|
+
});
|
|
97
|
+
outputJson(issue);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
outputError("issue_close_failed", err instanceof Error ? err.message : String(err));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// --- Pull Requests ---
|
|
104
|
+
export async function handlePulls(tokenStore, account, owner, repo, state, maxResults) {
|
|
105
|
+
const token = getToken(tokenStore, account);
|
|
106
|
+
try {
|
|
107
|
+
const prs = await githubFetchPaginated(token, `/repos/${owner}/${repo}/pulls?state=${state}`, maxResults);
|
|
108
|
+
outputJson(prs);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
outputError("pulls_failed", err instanceof Error ? err.message : String(err));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export async function handlePullGet(tokenStore, account, owner, repo, number) {
|
|
115
|
+
const token = getToken(tokenStore, account);
|
|
116
|
+
try {
|
|
117
|
+
const pr = await githubFetch(token, `/repos/${owner}/${repo}/pulls/${number}`);
|
|
118
|
+
outputJson(pr);
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
outputError("pull_get_failed", err instanceof Error ? err.message : String(err));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export async function handlePullReviews(tokenStore, account, owner, repo, number) {
|
|
125
|
+
const token = getToken(tokenStore, account);
|
|
126
|
+
try {
|
|
127
|
+
const reviews = await githubFetch(token, `/repos/${owner}/${repo}/pulls/${number}/reviews`);
|
|
128
|
+
outputJson(reviews);
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
outputError("pull_reviews_failed", err instanceof Error ? err.message : String(err));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export async function handlePullMerge(tokenStore, account, owner, repo, number, method) {
|
|
135
|
+
const token = getToken(tokenStore, account);
|
|
136
|
+
try {
|
|
137
|
+
const result = await githubFetch(token, `/repos/${owner}/${repo}/pulls/${number}/merge`, {
|
|
138
|
+
method: "PUT",
|
|
139
|
+
headers: { "Content-Type": "application/json" },
|
|
140
|
+
body: JSON.stringify({ merge_method: method }),
|
|
141
|
+
});
|
|
142
|
+
outputJson(result);
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
outputError("pull_merge_failed", err instanceof Error ? err.message : String(err));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// --- Notifications ---
|
|
149
|
+
export async function handleNotifications(tokenStore, account, maxResults) {
|
|
150
|
+
const token = getToken(tokenStore, account);
|
|
151
|
+
try {
|
|
152
|
+
const notifications = await githubFetchPaginated(token, "/notifications", maxResults);
|
|
153
|
+
outputJson(notifications);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
outputError("notifications_failed", err instanceof Error ? err.message : String(err));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// --- Search ---
|
|
160
|
+
export async function handleSearch(tokenStore, account, query, type, maxResults) {
|
|
161
|
+
const token = getToken(tokenStore, account);
|
|
162
|
+
try {
|
|
163
|
+
const data = await githubFetch(token, `/search/${type}?q=${encodeURIComponent(query)}&per_page=${Math.min(maxResults, 100)}`);
|
|
164
|
+
outputJson(data);
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
outputError("search_failed", err instanceof Error ? err.message : String(err));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// --- Actions ---
|
|
171
|
+
export async function handleWorkflowRuns(tokenStore, account, owner, repo, maxResults) {
|
|
172
|
+
const token = getToken(tokenStore, account);
|
|
173
|
+
try {
|
|
174
|
+
const data = await githubFetch(token, `/repos/${owner}/${repo}/actions/runs?per_page=${Math.min(maxResults, 100)}`);
|
|
175
|
+
outputJson(data);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
outputError("workflow_runs_failed", err instanceof Error ? err.message : String(err));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export async function handleWorkflowRunLogs(tokenStore, account, owner, repo, runId) {
|
|
182
|
+
const token = getToken(tokenStore, account);
|
|
183
|
+
try {
|
|
184
|
+
const jobs = await githubFetch(token, `/repos/${owner}/${repo}/actions/runs/${runId}/jobs`);
|
|
185
|
+
outputJson(jobs);
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
outputError("workflow_logs_failed", err instanceof Error ? err.message : String(err));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/github/handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3D,eAAe;AAEf,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,UAAsB,EAAE,OAAe;IACxE,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,W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,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACxF,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAAsB,EACtB,OAAe,EACf,KAAa,EACb,IAAY,EACZ,KAAa;IAEb,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,WAAW,CAC5B,KAAK,EACL,UAAU,KAAK,IAAI,IAAI,iBAAiB,KAAK,OAAO,CACrD,CAAC;QACF,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,CAAC,sBAAsB,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACxF,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { registerCalendarCommands } from "./commands/calendar.js";
|
|
|
10
10
|
import { registerFormsCommands } from "./commands/forms.js";
|
|
11
11
|
import { registerAgentCommands } from "./commands/agent.js";
|
|
12
12
|
import { registerCronCommands } from "./commands/cron.js";
|
|
13
|
+
import { registerGithubCommands } from "./commands/github.js";
|
|
13
14
|
import { registerInitCommand } from "./commands/init.js";
|
|
14
15
|
import { outputError } from "./lib/output.js";
|
|
15
16
|
|
|
@@ -25,7 +26,7 @@ const program = new Command();
|
|
|
25
26
|
|
|
26
27
|
program
|
|
27
28
|
.name("cliclaw")
|
|
28
|
-
.description("CLI tool for Gmail, Google Drive, Google Slides, Google Sheets, Google Calendar,
|
|
29
|
+
.description("CLI tool for Gmail, Google Drive, Google Slides, Google Sheets, Google Calendar, Google Forms, and GitHub operations")
|
|
29
30
|
.version("0.1.0");
|
|
30
31
|
|
|
31
32
|
registerGmailCommands(program, getClientManager);
|
|
@@ -34,6 +35,7 @@ registerGSlidesCommands(program, getClientManager);
|
|
|
34
35
|
registerSheetsCommands(program, getClientManager);
|
|
35
36
|
registerCalendarCommands(program, getClientManager);
|
|
36
37
|
registerFormsCommands(program, getClientManager);
|
|
38
|
+
registerGithubCommands(program, () => new TokenStore(getTokensPath()));
|
|
37
39
|
registerAgentCommands(program, () => new AgentStore(getAgentsDir()));
|
|
38
40
|
registerCronCommands(program, () => new AgentStore(getAgentsDir()));
|
|
39
41
|
registerInitCommand(program);
|
package/src/commands/cron.ts
CHANGED
|
@@ -104,6 +104,7 @@ export function registerCronCommands(program: Command, getAgentStore: AgentStore
|
|
|
104
104
|
iterations: result.iterations,
|
|
105
105
|
completed: result.completed,
|
|
106
106
|
totalCostUsd: result.totalCostUsd,
|
|
107
|
+
report: result.report,
|
|
107
108
|
transcript: result.transcript,
|
|
108
109
|
};
|
|
109
110
|
writeRunLog(agent, jobId, log);
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { TokenStore } from "@digitalpresence/cliclaw-auth";
|
|
3
|
+
import {
|
|
4
|
+
handleWhoami,
|
|
5
|
+
handleRepos, handleRepoGet,
|
|
6
|
+
handleIssues, handleIssueGet, handleIssueCreate, handleIssueComment, handleIssueClose,
|
|
7
|
+
handlePulls, handlePullGet, handlePullReviews, handlePullMerge,
|
|
8
|
+
handleNotifications,
|
|
9
|
+
handleSearch,
|
|
10
|
+
handleWorkflowRuns, handleWorkflowRunLogs,
|
|
11
|
+
} from "../github/handlers.js";
|
|
12
|
+
|
|
13
|
+
type TokenStoreFactory = () => TokenStore;
|
|
14
|
+
|
|
15
|
+
export function registerGithubCommands(program: Command, getTokenStore: TokenStoreFactory): void {
|
|
16
|
+
let cached: TokenStore | null = null;
|
|
17
|
+
function resolve() {
|
|
18
|
+
if (!cached) cached = getTokenStore();
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const github = program.command("github").description("GitHub commands");
|
|
23
|
+
|
|
24
|
+
// --- User ---
|
|
25
|
+
|
|
26
|
+
github
|
|
27
|
+
.command("whoami")
|
|
28
|
+
.description("Show authenticated user info")
|
|
29
|
+
.option("--account <name>", "Account name", "default")
|
|
30
|
+
.action(async (opts) => {
|
|
31
|
+
await handleWhoami(resolve(), opts.account);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// --- Repos ---
|
|
35
|
+
|
|
36
|
+
github
|
|
37
|
+
.command("repos")
|
|
38
|
+
.description("List repositories")
|
|
39
|
+
.option("--max-results <n>", "Maximum repos to return", "30")
|
|
40
|
+
.option("--type <type>", "Filter: all, owner, public, private, member", "all")
|
|
41
|
+
.option("--sort <sort>", "Sort: created, updated, pushed, full_name", "updated")
|
|
42
|
+
.option("--account <name>", "Account name", "default")
|
|
43
|
+
.action(async (opts) => {
|
|
44
|
+
await handleRepos(resolve(), opts.account, parseInt(opts.maxResults), opts.type, opts.sort);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
github
|
|
48
|
+
.command("repo")
|
|
49
|
+
.description("Get repository details")
|
|
50
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
51
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
52
|
+
.option("--account <name>", "Account name", "default")
|
|
53
|
+
.action(async (opts) => {
|
|
54
|
+
await handleRepoGet(resolve(), opts.account, opts.owner, opts.repo);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// --- Issues ---
|
|
58
|
+
|
|
59
|
+
github
|
|
60
|
+
.command("issues")
|
|
61
|
+
.description("List issues in a repository")
|
|
62
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
63
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
64
|
+
.option("--state <state>", "Filter: open, closed, all", "open")
|
|
65
|
+
.option("--max-results <n>", "Maximum issues to return", "30")
|
|
66
|
+
.option("--account <name>", "Account name", "default")
|
|
67
|
+
.action(async (opts) => {
|
|
68
|
+
await handleIssues(resolve(), opts.account, opts.owner, opts.repo, opts.state, parseInt(opts.maxResults));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
github
|
|
72
|
+
.command("issue")
|
|
73
|
+
.description("Get a single issue")
|
|
74
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
75
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
76
|
+
.requiredOption("--number <number>", "Issue number")
|
|
77
|
+
.option("--account <name>", "Account name", "default")
|
|
78
|
+
.action(async (opts) => {
|
|
79
|
+
await handleIssueGet(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.number));
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
github
|
|
83
|
+
.command("issue-create")
|
|
84
|
+
.description("Create an issue")
|
|
85
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
86
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
87
|
+
.requiredOption("--title <title>", "Issue title")
|
|
88
|
+
.option("--body <body>", "Issue body")
|
|
89
|
+
.option("--labels <labels>", "Comma-separated labels")
|
|
90
|
+
.option("--account <name>", "Account name", "default")
|
|
91
|
+
.action(async (opts) => {
|
|
92
|
+
const labels = opts.labels ? opts.labels.split(",").map((l: string) => l.trim()) : undefined;
|
|
93
|
+
await handleIssueCreate(resolve(), opts.account, opts.owner, opts.repo, opts.title, opts.body, labels);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
github
|
|
97
|
+
.command("issue-comment")
|
|
98
|
+
.description("Comment on an issue")
|
|
99
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
100
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
101
|
+
.requiredOption("--number <number>", "Issue number")
|
|
102
|
+
.requiredOption("--body <body>", "Comment body")
|
|
103
|
+
.option("--account <name>", "Account name", "default")
|
|
104
|
+
.action(async (opts) => {
|
|
105
|
+
await handleIssueComment(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.number), opts.body);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
github
|
|
109
|
+
.command("issue-close")
|
|
110
|
+
.description("Close an issue")
|
|
111
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
112
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
113
|
+
.requiredOption("--number <number>", "Issue number")
|
|
114
|
+
.option("--account <name>", "Account name", "default")
|
|
115
|
+
.action(async (opts) => {
|
|
116
|
+
await handleIssueClose(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.number));
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// --- Pull Requests ---
|
|
120
|
+
|
|
121
|
+
github
|
|
122
|
+
.command("pulls")
|
|
123
|
+
.description("List pull requests")
|
|
124
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
125
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
126
|
+
.option("--state <state>", "Filter: open, closed, all", "open")
|
|
127
|
+
.option("--max-results <n>", "Maximum PRs to return", "30")
|
|
128
|
+
.option("--account <name>", "Account name", "default")
|
|
129
|
+
.action(async (opts) => {
|
|
130
|
+
await handlePulls(resolve(), opts.account, opts.owner, opts.repo, opts.state, parseInt(opts.maxResults));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
github
|
|
134
|
+
.command("pull")
|
|
135
|
+
.description("Get a single pull request")
|
|
136
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
137
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
138
|
+
.requiredOption("--number <number>", "PR number")
|
|
139
|
+
.option("--account <name>", "Account name", "default")
|
|
140
|
+
.action(async (opts) => {
|
|
141
|
+
await handlePullGet(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.number));
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
github
|
|
145
|
+
.command("pull-reviews")
|
|
146
|
+
.description("List reviews on a pull request")
|
|
147
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
148
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
149
|
+
.requiredOption("--number <number>", "PR number")
|
|
150
|
+
.option("--account <name>", "Account name", "default")
|
|
151
|
+
.action(async (opts) => {
|
|
152
|
+
await handlePullReviews(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.number));
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
github
|
|
156
|
+
.command("pull-merge")
|
|
157
|
+
.description("Merge a pull request")
|
|
158
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
159
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
160
|
+
.requiredOption("--number <number>", "PR number")
|
|
161
|
+
.option("--method <method>", "Merge method: merge, squash, rebase", "merge")
|
|
162
|
+
.option("--account <name>", "Account name", "default")
|
|
163
|
+
.action(async (opts) => {
|
|
164
|
+
await handlePullMerge(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.number), opts.method);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// --- Notifications ---
|
|
168
|
+
|
|
169
|
+
github
|
|
170
|
+
.command("notifications")
|
|
171
|
+
.description("List unread notifications")
|
|
172
|
+
.option("--max-results <n>", "Maximum notifications to return", "30")
|
|
173
|
+
.option("--account <name>", "Account name", "default")
|
|
174
|
+
.action(async (opts) => {
|
|
175
|
+
await handleNotifications(resolve(), opts.account, parseInt(opts.maxResults));
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// --- Search ---
|
|
179
|
+
|
|
180
|
+
github
|
|
181
|
+
.command("search")
|
|
182
|
+
.description("Search GitHub")
|
|
183
|
+
.requiredOption("--query <query>", "Search query")
|
|
184
|
+
.option("--type <type>", "Search type: repositories, code, issues, users", "repositories")
|
|
185
|
+
.option("--max-results <n>", "Maximum results to return", "30")
|
|
186
|
+
.option("--account <name>", "Account name", "default")
|
|
187
|
+
.action(async (opts) => {
|
|
188
|
+
await handleSearch(resolve(), opts.account, opts.query, opts.type, parseInt(opts.maxResults));
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// --- Actions ---
|
|
192
|
+
|
|
193
|
+
github
|
|
194
|
+
.command("runs")
|
|
195
|
+
.description("List workflow runs")
|
|
196
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
197
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
198
|
+
.option("--max-results <n>", "Maximum runs to return", "10")
|
|
199
|
+
.option("--account <name>", "Account name", "default")
|
|
200
|
+
.action(async (opts) => {
|
|
201
|
+
await handleWorkflowRuns(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.maxResults));
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
github
|
|
205
|
+
.command("run-jobs")
|
|
206
|
+
.description("List jobs for a workflow run")
|
|
207
|
+
.requiredOption("--owner <owner>", "Repository owner")
|
|
208
|
+
.requiredOption("--repo <repo>", "Repository name")
|
|
209
|
+
.requiredOption("--run-id <id>", "Workflow run ID")
|
|
210
|
+
.option("--account <name>", "Account name", "default")
|
|
211
|
+
.action(async (opts) => {
|
|
212
|
+
await handleWorkflowRunLogs(resolve(), opts.account, opts.owner, opts.repo, parseInt(opts.runId));
|
|
213
|
+
});
|
|
214
|
+
}
|