Skip to content

Commit 5cbc78c

Browse files
authored
0.17 phase 5 PR A: static alias file parser (#141)
* feat(gc-suggest): static alias-file parser; prefer over zsh subprocess Reads ~/.zshrc, .zshenv, .zsh_aliases, oh-my-zsh/custom/*.zsh, etc. Falls back to 'zsh -c alias' only when the static path is empty. Conservative: skips multi-line aliases and 'alias -g/s/L' forms. * chore(gc-suggest): align alias cache fingerprint with files actually parsed * style(gc-suggest): satisfy clippy::unnecessary_get_then_check in alias tests * fix(gc-suggest): harden static alias parser (quotes, names, file order) Address review findings on the new static alias parser: - Parse '#' inside quoted alias values via a quote-aware value scanner. Trailing inline comments are still stripped, but '#' in URLs, fragments, and hex colors inside quotes is now preserved instead of truncating the value to a corrupt fragment. - Accept dotted and hyphenated alias names (.., ..., git-st) while still rejecting `alias -g/-s/-L` global/suffix forms and punctuated names. - Drop every physical line of a backslash-continued statement so a continuation tail can no longer register a phantom alias. - Reorder STATIC_ALIAS_FILES / ALIAS_SOURCE_FILES to true last-read-wins precedence and restore .zprofile; make the file-order doc comment match the array and document the subprocess-fallback trade-off. - Add tracing::debug! breadcrumbs when an alias line is rejected or dropped. - Add tests: oh-my-zsh custom drop-in walk, cross-file override order, '#'-in-value, name acceptance/rejection, shlex whitespace fallback, and the empty-home subprocess-fallback precondition. * test(gc-suggest): lock alias read-set==watch-set invariant; polish drop paths Address iteration-2 review findings on the static alias parser: - Add a test asserting STATIC_ALIAS_FILES and ALIAS_SOURCE_FILES are set-equal in both directions and that the parser-walked .oh-my-zsh/custom dir is a member of ALIAS_SOURCE_DIRS, so the read-set/watch-set mirror invariant can no longer drift silently and reintroduce the stale-cache bug this PR exists to prevent. - Sort oh-my-zsh custom *.zsh drop-ins before ingest for deterministic override order across machines. - Log non-NotFound dotfile read errors (permission/encoding) at debug instead of swallowing them silently. - Add a debug breadcrumb when skipping a backslash-continued statement. - Drop the inaccurate "unescaped" wording from the continuation comment.
1 parent ca9f7dc commit 5cbc78c

1 file changed

Lines changed: 552 additions & 64 deletions

File tree

0 commit comments

Comments
 (0)