From 7cb2e0ad721a4c18b5b6c493821707aa64c9985b Mon Sep 17 00:00:00 2001 From: Roman Sirokov Date: Mon, 30 Nov 2026 10:30:32 +0100 Subject: [PATCH 1/2] feat: archive conversations and reclaim worktrees --- Cargo.lock | 5 +- Cargo.toml | 2 +- docs/desktop-coding.md | 4 +- scripts/check-desktop-history.py | 20 +++--- scripts/check-desktop-pull-requests.py | 8 +-- src/conversation.rs | 92 +++++++++++++++++++++++--- src/conversation/mcp_status.rs | 11 ++- src/conversation/project_actions.rs | 23 ++++--- src/conversation/sidebar.rs | 27 ++++---- src/conversation/terminal.rs | 4 ++ src/conversation/terminal_pane.rs | 10 ++- src/conversation/transcript.rs | 31 ++++++++- src/github.rs | 9 +-- src/settings/general.rs | 6 +- 14 files changed, 185 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6225c48..9287332 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2947,8 +2947,7 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "huggler" version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf4def238ab2dc0666061c1f2689abf961d2b9ef93ccca8931c01ed9325ab88" +source = "git+https://github.com/MrLightful/huggler.git?rev=97d84ce8cb90bb1c1d10782eb97103de1a67463f#97d84ce8cb90bb1c1d10782eb97103de1a67463f" dependencies = [ "axum", "base64 0.22.1", @@ -2958,6 +2957,7 @@ dependencies = [ "hmac", "libc", "lopdf", + "memchr", "mime_guess", "reqwest", "rmcp", @@ -2968,6 +2968,7 @@ dependencies = [ "tempfile", "thiserror 2.0.19", "tokio", + "unicode-segmentation", "url", "uuid", ] diff --git a/Cargo.toml b/Cargo.toml index 879baa5..e639a01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ futures-lite = "2" gpui = { version = "0.2.2", features = ["runtime_shaders"] } gpui-component = "0.5.1" gpui-component-assets = "0.5.1" -huggler = { version = "=0.0.1", features = ["application", "machine"] } +huggler = { git = "https://github.com/MrLightful/huggler.git", rev = "97d84ce8cb90bb1c1d10782eb97103de1a67463f", features = ["application", "machine"] } image = { version = "0.25", default-features = false, features = ["bmp", "gif", "jpeg", "png", "tiff", "webp"] } markdown = "1" mermaid-rs-renderer = { version = "0.3.1", default-features = false } diff --git a/docs/desktop-coding.md b/docs/desktop-coding.md index 9ab306f..1ecad48 100644 --- a/docs/desktop-coding.md +++ b/docs/desktop-coding.md @@ -98,13 +98,13 @@ Each refresh checks the checkout in a fresh Codex session. Servers that Huggler ## Find a conversation by status -The conversation sidebar is visible when Bear opens. Use the left sidebar button in the workspace header to hide or show conversations independently of Changes. The sidebar updates even while you work in another conversation. Needs attention and Ready sit at the top. Working, Stash, and Settled sit at the bottom. Click a section heading to collapse or expand it. Each section shows its count and lists the most recently active conversations first. +The conversation sidebar is visible when Bear opens. Use the left sidebar button in the workspace header to hide or show conversations independently of Changes. The sidebar updates even while you work in another conversation. Needs attention and Ready sit at the top. Working, Stash, and Archived sit at the bottom. Click a section heading to collapse or expand it. Each section shows its count and lists the most recently active conversations first. - **Needs attention** shows conversations that need an answer or approval, have a paused queue, or ended in an error. The reason appears below the conversation name. - **Ready** shows new conversations and conversations whose work completed or was stopped. - **Working** shows conversations with queued or active work, including running subagents. By default, only your open conversation appears in this group. A request for your input moves the conversation into **Needs attention** automatically. - **Stash** holds local conversations you want to set aside. Hover over an active conversation and click **Stash** (the inbox icon). Work in progress continues, and the conversation stays stashed across restarts. If a stashed run asks for an answer or approval, its conversation appears in **Needs attention** until the request clears. Expand **Stash** and click **Unstash** (the undo arrow) to return the conversation to the group that matches its current activity. -- **Settled** holds conversations you have marked as finished. Hover over an idle conversation and click its checkmark to settle it. Expand **Settled** to browse its history. Hover over a settled conversation and click its undo arrow to unsettle it. Sending a message also reopens the conversation. Settlement persists across restarts. By default, Bear also checks idle conversations every minute and settles them when their branch’s pull request has merged. The checkout must be clean and its current commit must match the merged PR’s head; reused branches with new work stay open. Turn off **Auto-settle merged PRs** in **Settings → General** to disable this behavior. Active or queued work prevents settlement. +- **Archived** keeps conversations you’ve finished. Hover over an idle conversation and click **Archive**. Bear removes an eligible managed worktree when all conversations sharing it are archived. Local edits, ignored files, unpublished commits, and running workspace activity keep the checkout on disk. Use **Reopen conversation** to restore a reclaimed checkout at its saved commit and continue. Bear can also archive idle conversations after verifying their current commit matches a merged pull request. Turn off **Auto-archive merged PRs** in **Settings → General** to disable this behavior. ## Desktop data directory diff --git a/scripts/check-desktop-history.py b/scripts/check-desktop-history.py index bd4b54f..b85e422 100644 --- a/scripts/check-desktop-history.py +++ b/scripts/check-desktop-history.py @@ -163,19 +163,19 @@ def main(): ] run_window(executable, starter_state, [ {"resize": [640, 440]}, - {"hover": "thread/" + first}, {"click": "Settle/" + first}, - {"in_lower_half": "section/Settled/1"}, {"absent": "thread/" + first}, - {"hover": "thread/Review my changes"}, {"click": "Settle/Review my changes"}, - {"absent": "section/Ready/1"}, {"in_lower_half": "section/Settled/2"}, - {"hover": "thread/Review my changes"}, {"click": "Unsettle/Review my changes"}, + {"hover": "thread/" + first}, {"click": "Archive/" + first}, + {"in_lower_half": "section/Archived/1"}, {"absent": "thread/" + first}, + {"hover": "thread/Review my changes"}, {"click": "Archive/Review my changes"}, + {"absent": "section/Ready/1"}, {"in_lower_half": "section/Archived/2"}, + {"hover": "thread/Review my changes"}, {"click": "Reopen/Review my changes"}, ], env) run_window(executable, starter_state, [ - {"click": "section/Settled/1"}, {"click": "thread/" + first}, - {"see": "Codex/reply " + first}, {"hover": "thread/" + first}, {"click": "Unsettle/" + first}, - {"see": "Ready/" + first + "/Completed"}, {"hover": "thread/" + first}, {"click": "Settle/" + first}, - {"see": "Settled/" + first + "/Settled"}, *send_message("Continue"), + {"click": "section/Archived/1"}, {"click": "thread/" + first}, + {"see": "Codex/reply " + first}, {"hover": "thread/" + first}, {"click": "Reopen/" + first}, + {"see": "Ready/" + first + "/Completed"}, {"hover": "thread/" + first}, {"click": "Archive/" + first}, + {"see": "Archived/" + first + "/Archived"}, *send_message("Continue"), {"see": "Codex/reply Continue"}, {"see": "Ready/" + first + "/Completed"}, - {"absent": "section/Settled/1"}, + {"absent": "section/Archived/1"}, ], env) attachment = checkout / "notes.txt" attachment.write_text("attachment fixture") diff --git a/scripts/check-desktop-pull-requests.py b/scripts/check-desktop-pull-requests.py index 7058a70..7839445 100644 --- a/scripts/check-desktop-pull-requests.py +++ b/scripts/check-desktop-pull-requests.py @@ -467,11 +467,11 @@ def assert_settled(expected): assert_settled(False) # Exercise the actual preference control and its persisted opt-out. show(pr, {"click": "Settings"}, {"click": "General"}, - {"click": "Auto-settle merged PRs"}) + {"click": "Auto-archive merged PRs"}) assert json.loads(preferences.read_text())["autoSettleMergedPrs"] is True for change in ("edit", "switch"): - show(dict(merged, fixture_change=change), {"see": "Merged"}, {"absent": "section/Settled/2"}) + show(dict(merged, fixture_change=change), {"see": "Merged"}, {"absent": "section/Archived/2"}) assert "fixture_change" not in json.loads(fixture.read_text()) assert_settled(False) (checkout / "new-work.txt").unlink(missing_ok=True) @@ -479,10 +479,10 @@ def assert_settled(expected): show(dict(pr, state="CLOSED"), {"see": "PR closed"}) assert_settled(False) - show(merged, {"see": "section/Settled/2"}) + show(merged, {"see": "section/Archived/2"}) assert_settled(True) show(pr, {"click": "Settings"}, {"click": "General"}, - {"click": "Auto-settle merged PRs"}) + {"click": "Auto-archive merged PRs"}) assert json.loads(preferences.read_text())["autoSettleMergedPrs"] is False with sqlite3.connect(state / "huggler.sqlite3") as db: db.execute("UPDATE thread SET settled=0") diff --git a/src/conversation.rs b/src/conversation.rs index 6ac2a5f..390b092 100644 --- a/src/conversation.rs +++ b/src/conversation.rs @@ -469,6 +469,80 @@ impl Desktop { view } + fn checkout_unavailable_for(&self, thread: &ThreadId) -> bool { + !self.workspaces[thread].root.is_dir() + || self + .runtime + .thread_checkout_is_archived(thread) + .unwrap_or(false) + } + + fn has_running_workspace_terminal(&self, thread: &ThreadId, cx: &App) -> bool { + #[cfg(target_os = "macos")] + { + let Ok(root) = self.runtime.thread_checkout(thread) else { + return false; + }; + self.workspaces.values().any(|workspace| { + workspace.root.starts_with(&root) && workspace.terminal.has_running_terminal(cx) + }) + } + #[cfg(not(target_os = "macos"))] + { + let _ = (thread, cx); + false + } + } + + fn dispatch_archive_action( + &mut self, + thread: ThreadId, + action: Action, + cx: &mut Context, + ) { + let automatic = matches!( + &action, + Action::ArchiveConversation { + merged_tip: Some(_) + } + ); + if matches!(&action, Action::ArchiveConversation { .. }) + && self.has_running_workspace_terminal(&thread, cx) + { + if !automatic { + self.report_error( + "Close the running workspace terminal before archiving.".into(), + cx, + ); + } + return; + } + let runtime = self.runtime.clone(); + let task = self.executor.spawn_blocking(move || { + runtime + .dispatch(Command { + id: CommandId(Uuid::new_v4().to_string()), + thread_id: thread, + action, + }) + .map(|_| ()) + }); + cx.spawn(async move |view, cx| { + let result = task + .await + .unwrap_or_else(|error| Err(huggler::Error::Worker(error.to_string()))); + let _ = view.update(cx, |view, cx| { + if let Some(current) = &view.current { + view.checkout_unavailable = view.checkout_unavailable_for(¤t.id); + } + if !automatic || !matches!(result, Err(huggler::Error::Busy)) { + view.report(result, cx); + } + }); + }) + .detach(); + } + fn report(&mut self, result: huggler::Result<()>, cx: &mut Context) { if let Err(error) = result { self.report_error(error.to_string(), cx); @@ -596,7 +670,7 @@ impl Desktop { .show_chat(); if self.current.as_ref().is_some_and(|thread| thread.id == id) { self.focus_workspace(window, cx); - self.checkout_unavailable = !self.workspaces[&id].root.is_dir(); + self.checkout_unavailable = self.checkout_unavailable_for(&id); self.watch_pull_request(cx); return Ok(()); } @@ -611,7 +685,7 @@ impl Desktop { self.command_log = None; self.expanded_activity.clear(); self.full_messages.clear(); - self.checkout_unavailable = !self.workspaces[&id].root.is_dir(); + self.checkout_unavailable = self.checkout_unavailable_for(&id); self.prompt = self.workspaces[&id].draft.clone(); self.suggestions = Default::default(); self.model_picker = None; @@ -835,11 +909,7 @@ impl Desktop { .iter() .any(|item| &item.message.id == id) }); - if thread.latest_run.as_ref().map(|r| (&r.id, r.status)) - != old.latest_run.as_ref().map(|r| (&r.id, r.status)) - { - self.checkout_unavailable = !self.workspaces[&thread.id].root.is_dir(); - } + self.checkout_unavailable = self.checkout_unavailable_for(&thread.id); let previous_sequence = old.history.sequence; self.current = Some(thread); self.refresh_traces(Some(previous_sequence)); @@ -1328,10 +1398,10 @@ impl Desktop { return Ok(()); } if thread.foreground_run.is_none() && thread.queued_count == 0 { - let root = &self.workspaces[&thread.id].root; - self.checkout_unavailable = !root.is_dir(); - if self.checkout_unavailable { - // Keep the draft while the user restores the checkout. + let archived = self.runtime.thread_checkout_is_archived(&thread.id)?; + self.checkout_unavailable = archived || !self.workspaces[&thread.id].root.is_dir(); + if self.checkout_unavailable && !archived { + // Keep the draft when the checkout was removed outside Bear. cx.notify(); return Ok(()); } diff --git a/src/conversation/mcp_status.rs b/src/conversation/mcp_status.rs index 66b5658..7626eac 100644 --- a/src/conversation/mcp_status.rs +++ b/src/conversation/mcp_status.rs @@ -63,10 +63,17 @@ impl Desktop { } else { let root = source.1.clone(); let command = command.to_owned(); + let runtime = self.runtime.clone(); if let Err(error) = cx.open_window(WindowOptions::default(), move |window, cx| { window.set_window_title("MCP authentication"); - let shell = super::terminal::TerminalView::start(&root, Some(&command), window, cx) - .map_err(|error| format!("{error:#}")); + let shell = super::terminal::TerminalView::start( + &runtime, + &root, + Some(&command), + window, + cx, + ) + .map_err(|error| format!("{error:#}")); if let Ok(shell) = &shell { shell.read(cx).focus(window); } diff --git a/src/conversation/project_actions.rs b/src/conversation/project_actions.rs index a4ec370..3efb481 100644 --- a/src/conversation/project_actions.rs +++ b/src/conversation/project_actions.rs @@ -179,11 +179,14 @@ impl Desktop { thread: Some(target), root, }; - checkout.has_current_merged_pr().await.then_some(sequence) + checkout + .current_merged_pr_tip() + .await + .map(|tip| (sequence, tip)) }) .await .unwrap_or(None); - if let Some(sequence) = checked_sequence + if let Some((sequence, tip)) = checked_sequence && view .update(cx, |view, cx| { if view.settings.read(cx).preferences().auto_settle_merged_prs @@ -199,15 +202,13 @@ impl Desktop { .detail(&id, None, "", 1) .is_ok_and(|thread| thread.history.sequence == sequence) { - // Busy means work arrived after the list snapshot; retry next poll. - if let Err(error) = view.runtime.dispatch(Command { - id: CommandId(Uuid::new_v4().to_string()), - thread_id: id, - action: Action::SetSettled { settled: true }, - }) && !matches!(error, huggler::Error::Busy) - { - view.report(Err(error), cx); - } + view.dispatch_archive_action( + id, + Action::ArchiveConversation { + merged_tip: Some(tip), + }, + cx, + ); } }) .is_err() diff --git a/src/conversation/sidebar.rs b/src/conversation/sidebar.rs index bb43a04..1cb6e39 100644 --- a/src/conversation/sidebar.rs +++ b/src/conversation/sidebar.rs @@ -140,7 +140,7 @@ pub(super) enum Section { Attention, Ready, Working, - Settled, + Archived, Stash, } @@ -150,7 +150,7 @@ impl Section { Self::Attention => "Needs attention", Self::Ready => "Ready", Self::Working => "Working", - Self::Settled => "Settled", + Self::Archived => "Archived", Self::Stash => "Stash", } } @@ -160,7 +160,7 @@ impl Section { Self::Attention => (IconName::TriangleAlert, 0x9a470c, 0xf6aa61), Self::Ready => (IconName::ArrowRight, 0x177243, 0x63ce91), Self::Working => (IconName::LoaderCircle, 0x285eaa, 0x7fb3ff), - Self::Settled => (IconName::Check, 0x5d6576, 0xaaa7bc), + Self::Archived => (IconName::Check, 0x5d6576, 0xaaa7bc), Self::Stash => { return Icon::new(IconName::Inbox) .small() @@ -184,7 +184,7 @@ fn activity(thread: &ConversationSummary, stashed: bool) -> (Section, &'static s return (Section::Stash, "Stashed"); } if thread.settled { - return (Section::Settled, "Settled"); + return (Section::Archived, "Archived"); } match thread.status { Some(RunStatus::Failed) => (Section::Attention, "Run failed"), @@ -251,7 +251,7 @@ impl Desktop { Section::Ready, Section::Working, Section::Stash, - Section::Settled, + Section::Archived, ] { // Keep the space above the lower groups even when Working is empty. if section == Section::Working { @@ -378,7 +378,7 @@ impl Desktop { ) }); let settled = thread.settled; - let action = if settled { "Unsettle" } else { "Settle" }; + let action = if settled { "Reopen" } else { "Archive" }; let group = "conversation-row"; let enabled = settled || (!thread.needs_approval @@ -434,15 +434,12 @@ impl Desktop { .disabled(!enabled) .on_click(cx.listener(move |view, _, _, cx| { cx.stop_propagation(); - let result = view - .runtime - .dispatch(Command { - id: CommandId(Uuid::new_v4().to_string()), - thread_id: target.clone(), - action: Action::SetSettled { settled: !settled }, - }) - .map(|_| ()); - view.report(result, cx); + let action = if settled { + Action::SetSettled { settled: false } + } else { + Action::ArchiveConversation { merged_tip: None } + }; + view.dispatch_archive_action(target.clone(), action, cx); })) ); control!( diff --git a/src/conversation/terminal.rs b/src/conversation/terminal.rs index 1cbbc64..e37a5ed 100644 --- a/src/conversation/terminal.rs +++ b/src/conversation/terminal.rs @@ -40,10 +40,12 @@ struct Session { _reader: Task<()>, _writer: Task<()>, pty: Pty, + _checkout_lease: huggler::services::CheckoutLease, } impl TerminalView { pub(super) fn start( + runtime: &huggler::Huggler, root: &Path, command: Option<&str>, window: &mut Window, @@ -59,6 +61,7 @@ impl TerminalView { let mut emulator = Emulator::new(size.cols, size.rows)?; palette.apply(&mut emulator); + let checkout_lease = runtime.lease_checkout(root)?; let (pty, io) = Pty::spawn(root, size, command)?; Ok(cx.new(move |cx: &mut Context| { let (input, writes) = channel::bounded::>(128); @@ -188,6 +191,7 @@ impl TerminalView { _reader: reader, _writer: writer, pty, + _checkout_lease: checkout_lease, }), status: None, composition: String::new(), diff --git a/src/conversation/terminal_pane.rs b/src/conversation/terminal_pane.rs index c4f5df4..ea92746 100644 --- a/src/conversation/terminal_pane.rs +++ b/src/conversation/terminal_pane.rs @@ -44,6 +44,14 @@ impl TerminalPane { self.active = None; } + pub(super) fn has_running_terminal(&self, cx: &App) -> bool { + self.tabs.iter().any(|tab| { + tab.shell + .as_ref() + .is_ok_and(|terminal| terminal.read(cx).is_running()) + }) + } + pub(super) fn is_focused(&self, window: &Window, cx: &App) -> bool { self.active_tab() .and_then(|tab| tab.shell.as_ref().ok()) @@ -105,7 +113,7 @@ impl Desktop { TerminalLaunch::Action(command) => Some(command), _ => None, }; - let shell = TerminalView::start(&workspace.root, command, window, cx) + let shell = TerminalView::start(&self.runtime, &workspace.root, command, window, cx) .map_err(|error| format!("{error:#}")); if let Ok(terminal) = &shell { cx.subscribe(terminal, |_, _, _: &StatusChanged, cx| cx.notify()) diff --git a/src/conversation/transcript.rs b/src/conversation/transcript.rs index 9f979fa..4c677f6 100644 --- a/src/conversation/transcript.rs +++ b/src/conversation/transcript.rs @@ -462,7 +462,36 @@ impl Desktop { .filter(|(_, error)| error.after.is_none()) .map(|error| error_row(error, cx)), ); - if self.checkout_unavailable { + if self.checkout_unavailable + && self + .runtime + .thread_checkout_is_archived(&thread.id) + .unwrap_or(false) + { + let id = thread.id.clone(); + let reopen = control!( + "Reopen conversation", + Button::new("reopen-archived-conversation") + .label("Reopen conversation") + .on_click(cx.listener(move |view, _, _, cx| { + view.dispatch_archive_action( + id.clone(), + Action::SetSettled { settled: false }, + cx, + ); + })) + ); + tail.push( + v_flex() + .w(response_width) + .gap_2() + .child(hint( + "Reopen to restore the workspace and continue this conversation.", + cx, + )) + .child(h_flex().child(reopen)), + ); + } else if self.checkout_unavailable { tail.push( v_flex() .w(response_width) diff --git a/src/github.rs b/src/github.rs index 6fbecb8..a3e89bb 100644 --- a/src/github.rs +++ b/src/github.rs @@ -274,14 +274,15 @@ impl PullRequestTarget { impl Checkout { /// Recheck the local checkout after the network lookup before applying policy. - pub async fn has_current_merged_pr(&self) -> bool { + pub async fn current_merged_pr_tip(&self) -> Option { let Status::Found { branch, pr, .. } = self.status().await else { - return false; + return None; }; - pr.state() == PullRequestState::Merged + (pr.state() == PullRequestState::Merged && pr.head_commit() == branch.local_oid && git::has_uncommitted_changes(&self.root).is_ok_and(|dirty| !dirty) - && git::github_branch(&self.root).is_ok_and(|current| current.same_target(&branch)) + && git::github_branch(&self.root).is_ok_and(|current| current.same_target(&branch))) + .then_some(branch.local_oid) } pub async fn status(&self) -> Status { diff --git a/src/settings/general.rs b/src/settings/general.rs index 9bbd776..975987d 100644 --- a/src/settings/general.rs +++ b/src/settings/general.rs @@ -98,9 +98,9 @@ impl Settings { }); v_flex() .child(setting( - "Auto-settle merged PRs", - "Move idle conversations to Settled when their pull request is merged. Checks all conversations every minute.", - control!("Auto-settle merged PRs", toggle("auto-settle-merged-prs", "Auto-settle merged PRs", self.prefs.auto_settle_merged_prs) + "Auto-archive merged PRs", + "Archive idle conversations when their pull request is merged and remove eligible worktrees.", + control!("Auto-archive merged PRs", toggle("auto-settle-merged-prs", "Auto-archive merged PRs", self.prefs.auto_settle_merged_prs) .on_click(cx.listener(|view, _, _, cx| { let mut prefs = view.prefs.clone(); prefs.auto_settle_merged_prs = !prefs.auto_settle_merged_prs; From ce6060b221a4c504559197a1530397fb71ddc04a Mon Sep 17 00:00:00 2001 From: Roman Sirokov Date: Mon, 30 Nov 2026 13:55:08 +0100 Subject: [PATCH 2/2] fix: include pinned Huggler source in package notices --- scripts/cargo_notices.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/cargo_notices.py b/scripts/cargo_notices.py index dfd9eda..296b37d 100644 --- a/scripts/cargo_notices.py +++ b/scripts/cargo_notices.py @@ -8,6 +8,19 @@ import tomllib +def source_url(name, version, source): + if source == "registry+https://github.com/rust-lang/crates.io-index": + return f"https://crates.io/api/v1/crates/{name}/{version}/download" + # Huggler can be pinned to a reviewed Git revision before its crates.io release. + match = re.fullmatch( + r"git\+https://github\.com/MrLightful/huggler\.git\?rev=([0-9a-f]{40})#\1", + source, + ) + if name == "huggler" and match: + return f"https://github.com/MrLightful/huggler/archive/{match[1]}.tar.gz" + raise ValueError(f"Verify source distribution for {name} {version}") + + def write_notices(root, resources, target, features, *, manifest="Cargo.toml", component="desktop"): resources.mkdir() shutil.copyfile(root / "LICENSE", resources / "LICENSE.txt") @@ -33,12 +46,11 @@ def write_notices(root, resources, target, features, *, manifest="Cargo.toml", c name, version = package["name"], package["version"] if package["source"] is None: continue - if package["source"] != "registry+https://github.com/rust-lang/crates.io-index": - raise ValueError(f"Verify source distribution for {name} {version}") + url = source_url(name, version, package["source"]) label = f"{name} {version}" authors = ", ".join(package["authors"]) packages[label] = (f"{label} — {item['license']}\n" - f" https://crates.io/api/v1/crates/{name}/{version}/download\n" + f" {url}\n" + (f" Manifest authors: {authors}\n" if authors else "")) folder = Path(package["manifest_path"]).parent for path in folder.rglob("*"):