Skip to content

Conversation

@ephur
Copy link
Owner

@ephur ephur commented Dec 12, 2025

The compiled bytecode was being stored with the source files instead of in the zsh dirs cache, fix this error.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR relocates compiled Zsh bytecode (.zwc) files from source directories to a centralized cache directory. Previously, .zwc files were stored alongside their source files, which cluttered the source tree. Now they are stored in ${ZSH_CACHE_DIR}/compiled/ with systematically generated names.

Key changes:

  • Modified source_compiled() function to intelligently place .zwc files in cache/compiled/ directory (or alongside cache files if already in cache)
  • Updated zshrc to explicitly compile init.zsh to cache/compiled/ with a predictable name
  • Enhanced test cleanup to remove test-generated .zwc artifacts from source directories

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
zshrc Added explicit cache directory setup and compilation path for init.zsh to cache/compiled/
includes/init.zsh Refactored source_compiled() to determine .zwc location based on source file location and generate cache filenames by replacing path separators
tools/test_config.zsh Updated cleanup logic to explicitly list and remove test-generated .zwc files from source directories using zsh glob qualifiers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Clean up test compilation artifacts (they belong in cache/, not source dirs)
# Use (N) glob qualifier to make pattern null if no matches (zsh-specific)
local -a cleanup_files
cleanup_files=(zshrc.zwc includes/*.zwc(N) .antidote/*.zwc(N))
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The cleanup array initialization should use the (N) glob qualifier for zshrc.zwc as well, or check file existence before attempting removal. Currently, if zshrc.zwc doesn't exist, it will still be added to the array, and the check ${#cleanup_files[@]} > 0 will pass, causing rm -f to be called with a non-existent file. While rm -f silently ignores non-existent files, using the (N) qualifier consistently would be cleaner. Change to: cleanup_files=(zshrc.zwc(N) includes/.zwc(N) .antidote/.zwc(N))

Suggested change
cleanup_files=(zshrc.zwc includes/*.zwc(N) .antidote/*.zwc(N))
cleanup_files=(zshrc.zwc(N) includes/*.zwc(N) .antidote/*.zwc(N))

Copilot uses AI. Check for mistakes.
@ephur ephur merged commit ff60e25 into master Dec 13, 2025
8 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.

3 participants