Skip to content

Commit 5d744b5

Browse files
committed
chore: wip
1 parent a9c719a commit 5d744b5

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

packages/launchpad/src/dev/shellcode.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,27 @@ __launchpad_find_deps_file() {
576576
fi
577577
done
578578
579-
# Do not treat standalone version/lock files as a project to avoid false positives (e.g. $HOME)
579+
# Check common version files (useful signals for project directories)
580+
for file in ".nvmrc" ".node-version" ".ruby-version" ".python-version" ".terraform-version"; do
581+
if [[ -f "$dir/$file" ]]; then
582+
__launchpad_cache_dir="$dir"
583+
__launchpad_cache_timestamp=$current_time
584+
echo "$dir"
585+
return 0
586+
fi
587+
done
588+
589+
# Check package manager lock/config files (secondary signals)
590+
for file in "yarn.lock" "bun.lockb" ".yarnrc"; do
591+
if [[ -f "$dir/$file" ]]; then
592+
__launchpad_cache_dir="$dir"
593+
__launchpad_cache_timestamp=$current_time
594+
echo "$dir"
595+
return 0
596+
fi
597+
done
598+
599+
# Do not treat other standalone files as a project to avoid false positives (e.g. $HOME)
580600
581601
dir="$(/usr/bin/dirname "$dir")"
582602
done

packages/launchpad/test/clean-integration.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import path from 'node:path'
66
describe('Clean Command Integration Test', () => {
77
let tempDir: string
88
let cliPath: string
9+
let originalHome: string | undefined
910

1011
beforeEach(() => {
1112
// Create temporary directory for test
@@ -18,13 +19,18 @@ describe('Clean Command Integration Test', () => {
1819
if (!fs.existsSync(cliPath)) {
1920
throw new Error(`CLI not found at ${cliPath}`)
2021
}
22+
23+
// Sandbox HOME so cleanup only touches test directories
24+
originalHome = process.env.HOME
25+
process.env.HOME = tempDir
2126
})
2227

2328
// Helper to ensure proper PATH for tests
2429
function getTestEnv(extraEnv: Record<string, string> = {}) {
2530
return {
2631
...process.env,
2732
...extraEnv,
33+
HOME: tempDir,
2834
PATH: process.env.PATH?.includes('/usr/local/bin')
2935
? process.env.PATH
3036
: `/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:${process.env.PATH || ''}`,
@@ -36,6 +42,14 @@ describe('Clean Command Integration Test', () => {
3642
if (fs.existsSync(tempDir)) {
3743
fs.rmSync(tempDir, { recursive: true, force: true })
3844
}
45+
46+
// Restore HOME
47+
if (originalHome !== undefined) {
48+
process.env.HOME = originalHome
49+
}
50+
else {
51+
delete process.env.HOME
52+
}
3953
})
4054

4155
// Helper to check if binary exists

0 commit comments

Comments
 (0)