Skip to content

Commit 7d51b79

Browse files
committed
chore: wip
1 parent 8bc02bc commit 7d51b79

File tree

5 files changed

+56
-6
lines changed

5 files changed

+56
-6
lines changed

docs/advanced/cache-optimization.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ Cache keys are generated using a deterministic approach:
3131
- **Bun Cache:** `{version}` (e.g., `1.2.3`)
3232
- **Temporary Cache:** `{timestamp}-{hash}` for downloads in progress
3333

34+
### Environment Selection Cache
35+
36+
Launchpad also maintains a lightweight shell-side cache for environment activation. It stores:
37+
38+
- a persistent marker for fast-path activation, and
39+
- a `.deps_fingerprint` file inside the environment with the dependency fingerprint used to select it.
40+
41+
On directory change, Launchpad validates fast-path cache with two signals:
42+
43+
- "Cache invalid: dependency newer than cache" (dep file mtime > cache mtime)
44+
- "Cache invalid: fingerprint mismatch" (computed fingerprint != stored fingerprint)
45+
46+
When either triggers, Launchpad skips fast-path and refreshes the environment selection, ensuring the correct versions are active.
47+
3448
## Performance Optimization
3549

3650
### Cache Hit Optimization

docs/advanced/performance.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ cd /path/to/project # Even faster (cache hit)
6060
- Optimized PATH management (no duplicates)
6161
- Reduced filesystem syscalls
6262

63+
#### Dependency Fingerprint Overhead
64+
65+
Launchpad computes a dependency fingerprint by md5 hashing the dependency file (e.g. `deps.yaml`). This cost is O(file-size) and negligible for typical YAML/JSON files. The fingerprint is used only to select the environment directory and to validate cache freshness.
66+
6367
### 4. Dependency Detection Memoization
6468

6569
Intelligent caching of dependency analysis results:

docs/faq.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ producing a path like:
132132

133133
Changing versions in `deps.yaml` (or `dependencies.yml`, `pkgx.yml`, `launchpad.yml`, `package.json`, `pyproject.toml`, etc.) changes the fingerprint, so a new env dir is selected and the correct versions are installed/activated automatically.
134134

135+
Recognized dependency files include:
136+
137+
- `deps.yaml` / `deps.yml`
138+
- `dependencies.yaml` / `dependencies.yml`
139+
- `pkgx.yaml` / `pkgx.yml`
140+
- `launchpad.yaml` / `launchpad.yml`
141+
- `package.json`
142+
- `pyproject.toml`
143+
135144
To see this live, enable verbose logging and cd into the project:
136145

137146
```bash

docs/features/package-management.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,22 @@ Launchpad's update system provides:
271271
4. **Helpful messages**: Provides installation instructions for uninstalled packages
272272
5. **Dry-run mode**: Preview updates safely before applying changes
273273

274+
### Version Switching on cd
275+
276+
Launchpad encodes dependency versions into the environment directory via a dependency fingerprint (md5 of your dependency file). When you change pinned versions in your dependency file and `cd` into the project, Launchpad automatically selects a new env path:
277+
278+
```
279+
~/.local/share/launchpad/envs/<project>_<hash>-d<dep_hash>
280+
```
281+
282+
This guarantees immediate version switches without manual cleanup. Enable verbose logs to see the chosen `env_dir`, dependency file, and fingerprint:
283+
284+
```bash
285+
export LAUNCHPAD_VERBOSE=true
286+
cd my-project
287+
# 🔍 Env target: env_dir=… dep_file=… dep_hash=…
288+
```
289+
274290
### Update Examples
275291

276292
```bash

docs/usage.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Supported dependency file formats:
341341
### Environment Isolation
342342

343343
Each project gets its own isolated environment:
344-
- Project-specific installation directory: `~/.local/share/launchpad/envs/{project-hash}/`
344+
- Project-specific installation directory: `~/.local/share/launchpad/envs/<project>_<hash>-d<dep_hash>`
345345
- Isolated PATH and environment variables
346346
- Binary stubs with environment isolation
347347
- Automatic cleanup when leaving project directory
@@ -491,13 +491,20 @@ Launchpad uses human-readable hash identifiers for environments:
491491

492492
### Updating Dependencies
493493

494-
To update dependencies in your project, you'll need to manually edit your `dependencies.yaml` file and then reactivate the environment:
494+
To update dependencies in your project, edit your dependency file (e.g. `deps.yaml` / `dependencies.yaml`) and then reactivate the environment:
495495

496496
```bash
497-
# Edit your dependencies.yaml file
498-
# Change: node@22 to node@23
499-
# Then reactivate the environment
500-
cd . # This triggers environment reactivation with new dependencies
497+
# Edit your dependency file
498+
# Change: node@22 -> node@23 (or bun.sh: 1.2.19 -> 1.2.20)
499+
500+
# Reactivate the environment (new env_dir is selected automatically)
501+
cd .. && cd my-project
502+
503+
# Optional: inspect selection decisions
504+
export LAUNCHPAD_VERBOSE=true
505+
cd my-project
506+
# 🔍 Env target: env_dir=… dep_file=… dep_hash=…
507+
# 🔍 Cache check: dep=… dep_mtime=… cache_mtime=… fp_match=yes|no
501508
```
502509

503510
## Bootstrap Setup

0 commit comments

Comments
 (0)