Skip to content

Commit 6af331f

Browse files
committed
test: fix cleanup tests
1 parent df120c7 commit 6af331f

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

packages/workshop-cli/src/commands/cleanup.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,14 @@ export async function cleanup({
881881
// explicit `--workshops` were provided, we treat the current workshop
882882
// as the only workshop candidate. This avoids suggesting other
883883
// workshops in prompts and keeps size estimates accurate.
884-
allWorkshops = [workshopFromCwd]
884+
updateSpinner(analysisSpinner, 'Resolving current workshop...')
885+
const repoWorkshops = await listWorkshopsInDirectory(reposDir)
886+
const matchingRepoWorkshop = repoWorkshops.find(
887+
(workshop) => workshop.repoName === workshopFromCwd.repoName,
888+
)
889+
// Prefer the repos-directory path when available so workshop IDs are
890+
// stable even when cwd uses an equivalent symlinked path.
891+
allWorkshops = [matchingRepoWorkshop ?? workshopFromCwd]
885892
} else {
886893
updateSpinner(analysisSpinner, 'Finding installed workshops...')
887894
allWorkshops = await listWorkshopsInDirectory(reposDir)
@@ -908,6 +915,13 @@ export async function cleanup({
908915
contextWorkshop =
909916
workshopIdentities.find((workshop) => workshop.id === cwdId) ?? null
910917
}
918+
if (
919+
!contextWorkshop &&
920+
shouldScopeToCwdWorkshop &&
921+
workshopIdentities.length === 1
922+
) {
923+
contextWorkshop = workshopIdentities[0]
924+
}
911925
}
912926

913927
if (selectedTargets.length === 0) {

0 commit comments

Comments
 (0)