Skip to content
Merged
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
11 changes: 9 additions & 2 deletions pkgm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,15 @@ async function* ls() {
}

async function uninstall(arg: string) {
let found: { project: string } | undefined =
(await hooks.usePantry().find(arg))?.[0];
let found: { project: string } | undefined;
try {
found = (await hooks.usePantry().find(arg))?.[0];
} catch {
console.error(
"%ci pantry not found, trying to find package another way",
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log format string looks incorrect: "%ci pantry not found..." will print an extra i (and may not apply styling as intended). If the goal is to color the whole message, it should start with %c immediately followed by the message text.

Suggested change
"%ci pantry not found, trying to find package another way",
"%c pantry not found, trying to find package another way",

Copilot uses AI. Check for mistakes.
"color:blue",
);
Comment on lines +555 to +559
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bare catch {} will swallow all errors from hooks.usePantry().find(arg), including unexpected I/O or parsing failures, and then proceed to plumbing.which, which can hide real problems and make debugging difficult. Consider catching the error as a variable and only falling back when the error indicates the pantry is missing/unavailable; otherwise rethrow (or at least include the error details in the log).

Suggested change
} catch {
console.error(
"%ci pantry not found, trying to find package another way",
"color:blue",
);
} catch (err) {
console.error(
"%cerror querying pantry, trying to find package another way",
"color:blue",
);
console.error(err);

Copilot uses AI. Check for mistakes.
}
if (!found) {
found = await plumbing.which(arg);
}
Expand Down
Loading