Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion apps/desktop/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"此 Issue 暂无评论。": "This issue has no comments.",
"已启动 Harness 创建 Issue。": "Started the harness to create the issue.",
"已启动 Harness 处理 Issue。": "Started the harness to handle the issue.",
"已启动 Harness 处理 PR。": "Started the harness to handle the PR.",
"Issue 已关闭。": "Issue closed.",
"Issue 已重新打开。": "Issue reopened.",
"已发送 CodeBuddy NPC 处理请求。": "The request for CodeBuddy NPC to handle the issue has been sent.",
Expand Down Expand Up @@ -681,5 +682,34 @@
"退出 Nexus Agent": "Quit Nexus Agent",
"退出": "Quit",
"有 {count} 个任务正在运行,退出 Nexus Agent 会立即中断它们。": "Tasks are still running. Quitting Nexus Agent will interrupt {count} of them.",
"正在运行的任务会被停止;重新启动后它们会显示为已中断,历史记录仍可阅读。": "Running tasks are stopped and marked as interrupted the next time Nexus starts; their history stays readable."
"正在运行的任务会被停止;重新启动后它们会显示为已中断,历史记录仍可阅读。": "Running tasks are stopped and marked as interrupted the next time Nexus starts; their history stays readable.",
"处理 PR 冲突": "Resolve PR conflicts",
"审查并评论 PR": "Review and comment on PR",
"处理审查意见": "Address review feedback",
"处理 CI 报错": "Fix failing CI",
"处理 Stack PR": "Process stacked PRs",
"合并 PR": "Merge PR",
"关闭 PR": "Close PR",
"{count} 个 PR": "{count} PRs",
"刷新 PR": "Refresh PRs",
"正在读取 PR…": "Loading PRs…",
"暂无 PR。": "No PRs found.",
"草稿": "Draft",
"已合并": "Merged",
"返回列表": "Back to list",
"正在读取 PR、全部审查讨论与 CI…": "Loading PR, all review conversations, and CI…",
"Stack PR(依赖顺序)": "Stacked PRs (dependency order)",
"审查结论": "Reviews",
"审查 Conversations": "Review conversations",
"已解决": "Resolved",
"未解决": "Unresolved",
"已过时": "Outdated",
"当前 Head 的 CI": "CI for the current head",
"当前 Head 暂无 CI 检查。": "No CI checks for the current head.",
"查看 CI": "View CI",
"确认{operation} #{number}?": "Confirm {operation} #{number}?",
"PR 已合并。": "PR merged.",
"PR 已关闭。": "PR closed.",
"平台返回了不同的 PR,请刷新后重试。": "The host returned a different PR. Refresh and try again.",
"PR 请求失败:{error}": "PR request failed: {error}"
}
2 changes: 1 addition & 1 deletion apps/desktop/src/infrastructure/cnb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ fn parse_page(output: &str) -> Result<IssuePage> {
})
}

fn page_total(response: &Value) -> Option<usize> {
pub(super) fn page_total(response: &Value) -> Option<usize> {
response["total"]
.as_u64()
.or_else(|| response["header"]["x-cnb-total"].as_str()?.parse().ok())?
Expand Down
8 changes: 6 additions & 2 deletions apps/desktop/src/infrastructure/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn decode<T: DeserializeOwned>(value: Value) -> Result<T> {
.map_err(|_| "GitHub 返回了无效数据,请检查 gh 版本后重试。".into())
}

async fn api(
pub(super) async fn api(
cli: &Cli,
endpoint: &str,
method: &str,
Expand Down Expand Up @@ -317,7 +317,11 @@ struct GitHubComment {
created_at: String,
}

async fn load_comments(cli: &Cli, repository: &str, number: &str) -> Result<Vec<Comment>> {
pub(super) async fn load_comments(
cli: &Cli,
repository: &str,
number: &str,
) -> Result<Vec<Comment>> {
let endpoint = format!(
"{}/comments?per_page=100",
issue_endpoint(repository, number)?
Expand Down
27 changes: 27 additions & 0 deletions apps/desktop/src/infrastructure/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub(crate) enum ActionResult {
}

pub(crate) enum Response {
PullRequests(super::pull_requests::Response),
Inspection {
repository: Option<String>,
cli: Result<Cli, LocalizedText>,
Expand Down Expand Up @@ -84,6 +85,32 @@ impl Default for Client {
}

impl Client {
pub(crate) fn request_pulls(
&self,
id: Uuid,
provider: IssueProvider,
cli: Cli,
repository: String,
request: super::pull_requests::Request,
) -> Result<()> {
#[cfg(test)]
if self.fake {
return Ok(());
}
let sender = self.sender.clone();
std::thread::Builder::new()
.name(format!("nexus-{}-pulls", provider.key()))
.spawn(move || {
let response = super::pull_requests::handle(provider, &cli, &repository, request);
let _ = sender.send(Event {
id,
provider,
response: Response::PullRequests(response),
});
})?;
Ok(())
}

#[cfg(test)]
pub(crate) fn fake() -> Self {
Self {
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/infrastructure/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub(crate) mod harness_installation;
pub(crate) mod issues;
pub(crate) mod paths;
pub(crate) mod pdf;
pub(crate) mod pull_requests;
pub(crate) mod runner_client;
pub(crate) mod sound;
#[cfg(target_os = "macos")]
Expand Down
Loading
Loading