husteno-o feat: AI reliability, LRU cache, Prometheus metrics, CI logs, dependency alerts · 9/10/2026
9fbbdd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import { githubClient } from "@devpulse/github";
import { SlashCommandBuilder } from "discord.js";
import { BrandColors } from "../ui/colors.js";
import { createActionsTreeEmbed, createBaseEmbed, createErrorEmbed } from "../ui/embeds.js";
import { NF } from "../ui/icons.js";
import type { Command } from "./types.js";
export const actionsCommand: Command = {
data: new SlashCommandBuilder()
.setName("actions")
.setDescription(
"GitHub Actions Control Center: inspect CI/CD workflows, runs, logs, and trigger reruns",
)
.addSubcommand((sub) =>
sub
.setName("status")
.setDescription("View visual CI/CD workflow status tree (CI, Tests, Build, Deploy)")
.addStringOption((opt) =>
opt.setName("repo").setDescription("Repository format 'owner/repo'").setRequired(true),
),
)
.addSubcommand((sub) =>
sub
.setName("runs")
.setDescription("List recent GitHub Actions workflow runs")
.addStringOption((opt) =>
opt.setName("repo").setDescription("Repository format 'owner/repo'").setRequired(true),
),
)
.addSubcommand((sub) =>
sub
.setName("logs")
.setDescription("View jobs and step details for a workflow run")
.addStringOption((opt) =>
opt.setName("repo").setDescription("Repository format 'owner/repo'").setRequired(true),
)
.addIntegerOption((opt) =>
opt.setName("run_id").setDescription("Workflow run ID to inspect").setRequired(true),
),
)
.addSubcommand((sub) =>
sub
.setName("rerun")
.setDescription("Rerun a workflow run by ID")
.addStringOption((opt) =>
opt.setName("repo").setDescription("Repository format 'owner/repo'").setRequired(true),
)
.addIntegerOption((opt) =>
opt.setName("run_id").setDescription("Workflow run ID to trigger").setRequired(true),
),
)
.addSubcommand((sub) =>
sub
.setName("cancel")
.setDescription("Cancel an in-progress workflow run")
.addStringOption((opt) =>
opt.setName("repo").setDescription("Repository format 'owner/repo'").setRequired(true),
)
.addIntegerOption((opt) =>
opt.setName("run_id").setDescription("Workflow run ID to cancel").setRequired(true),
),
),
async execute(interaction) {
await interaction.deferReply();
const subcommand = interaction.options.getSubcommand();
const repoInput = interaction.options.getString("repo", true);
try {
if (subcommand === "status") {
const runs = await githubClient.getWorkflowRuns(repoInput, 6);
const embed = createActionsTreeEmbed(repoInput, runs);
await interaction.editReply({ embeds: [embed] });
return;
}
if (subcommand === "runs") {
const runs = await githubClient.getWorkflowRuns(repoInput, 10);
const lines = runs.map((r) => {
const status =
r.conclusion === "success" ? "✅" : r.conclusion === "failure" ? "❌" : "🟡";
return `• [\`#${r.runNumber}\`](${r.htmlUrl}) **${r.name}** — ${status} \`${r.conclusion || r.status}\` on \`${r.headBranch}\` (\`${r.headSha.slice(0, 7)}\`)`;
});
const embed = createBaseEmbed(
`${NF.robot} Recent Workflow Runs: ${repoInput}`,
).setDescription(lines.length > 0 ? lines.join("\n") : "No recent workflow runs found.");
await interaction.editReply({ embeds: [embed] });
return;
}
if (subcommand === "logs") {
const runId = interaction.options.getInteger("run_id", true);
const jobs = await githubClient.getWorkflowRunJobs(repoInput, runId);
if (jobs.length === 0) {
await interaction.editReply({
embeds: [createBaseEmbed(`${NF.warning} No Jobs Found`).setDescription(
`No jobs found for workflow run \`#${runId}\`.`,
)],
});
return;
}
const jobLines: string[] = [];
let failedStep = "";
for (const job of jobs) {
const icon =
job.conclusion === "success"
? "✅"
: job.conclusion === "failure"
? "❌"
: job.conclusion === "cancelled"
? "⚪"
: "🟡";
jobLines.push(`**${icon} ${job.name}** — \`${job.conclusion || job.status}\``);
if (job.conclusion === "failure" && job.steps) {
for (const step of job.steps) {
if (step.conclusion === "failure") {
failedStep = `${job.name} → Step ${step.number}: ${step.name}`;
jobLines.push(` ↳ ❌ **${step.name}** (Step #${step.number})`);
}
}
}
}
const embed = createBaseEmbed(`${NF.robot} CI Logs: ${repoInput} #${runId}`)
.setDescription(jobLines.join("\n"));
if (failedStep) {
embed.addFields({
name: `${NF.warning} Failed Step`,
value: `\`${failedStep}\``,
inline: false,
});
}
const failedRun = jobs.find((j) => j.conclusion === "failure");
if (failedRun) {
embed.addFields({
name: `${NF.bug} Diagnosis`,
value: `**${failedRun.name}** failed. Check the [full logs on GitHub](https://github.com/${repoInput}/actions/runs/${runId}) for step-level details.`,
inline: false,
});
}
embed.setFooter({ text: `GITBOT CI Log Viewer • ${jobs.length} job(s)` });
await interaction.editReply({ embeds: [embed] });
return;
}
if (subcommand === "rerun") {
const runId = interaction.options.getInteger("run_id", true);
await githubClient.rerunWorkflow(repoInput, runId);
const embed = createBaseEmbed(`${NF.spinner} Workflow Rerun Triggered`)
.setColor(BrandColors.success)
.setDescription(
`Successfully triggered rerun for workflow run \`#${runId}\` in \`${repoInput}\`.`,
);
await interaction.editReply({ embeds: [embed] });
return;
}
if (subcommand === "cancel") {
const runId = interaction.options.getInteger("run_id", true);
await githubClient.cancelWorkflow(repoInput, runId);
const embed = createBaseEmbed(`${NF.cross} Workflow Run Cancelled`)
.setColor(BrandColors.warning)
.setDescription(
`Workflow run \`#${runId}\` in \`${repoInput}\` has been requested to cancel.`,
);
await interaction.editReply({ embeds: [embed] });
return;
}
} catch (err: unknown) {
await interaction.editReply({
embeds: [createErrorEmbed(err instanceof Error ? err : new Error(String(err)))],
});
}
},
};