Skip to content

Use composite keys for package storage to support multiple types#6

Merged
fullstackjam merged 1 commit intomainfrom
claude/fix-checkbox-sync-bug-mGaGa
Apr 30, 2026
Merged

Use composite keys for package storage to support multiple types#6
fullstackjam merged 1 commit intomainfrom
claude/fix-checkbox-sync-bug-mGaGa

Conversation

@fullstackjam
Copy link
Copy Markdown
Contributor

Summary

This PR refactors the package storage mechanism to use composite keys that include both package type and name, enabling proper support for packages that can exist in multiple package managers (e.g., a package available as both a formula and a cask).

Key Changes

  • Added pkgKey() helper function in both ConfigEditor.svelte and PackageManager.svelte to generate composite keys in the format {type}:{name}
  • Updated selectedPackages Map to use composite keys instead of just package names, allowing the same package name to be stored with different types
  • Updated packageDescs Map to use composite keys for consistency with selectedPackages
  • Refactored all package operations to use the new key format:
    • Loading packages from presets
    • Toggling package selection
    • Importing packages from files
    • Restoring saved packages
    • Exporting packages
    • Searching and displaying packages
  • Updated package extraction logic to parse the package name from the composite key using key.slice(type.length + 1)

Implementation Details

  • The composite key format {type}:{name} allows reliable extraction of the package name by removing the type prefix and colon
  • All package lookup operations now require both the package name and type to generate the correct key
  • The changes maintain backward compatibility with the existing data structures while enabling multi-type package support

https://claude.ai/code/session_01EJFSDndq6gm1SDSjLP1o5x

Packages with the same name but different types (e.g. "ghostty" cask vs
"ghostty" npm) collided in the selection map, so toggling one would
visually toggle both. Switch the map key to "type:name" so each variant
is tracked independently.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullstackjam fullstackjam merged commit 1526ae0 into main Apr 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants