fix: allow action scripts to be found inside the style directory#1121
Open
aireilly wants to merge 1 commit into
Open
fix: allow action scripts to be found inside the style directory#1121aireilly wants to merge 1 commit into
aireilly wants to merge 1 commit into
Conversation
The `suggest` action's script resolution only checked `config/actions/` for .tengo files. This forced package authors to ship action scripts in a separate `config/` directory, but `vale sync` drops sibling directories for style-only packages — it only copies the folder matching the package name (e.g., `RedHat/`). This created an impossible packaging constraint: the script had to be in `config/actions/` for the action to find it, but that directory was silently dropped during sync because it sat outside the style folder. Add a fallback so the `suggest` action also searches the style's own directory (e.g., `<StylesPath>/RedHat/NoGerundsInTitles.tengo`). This mirrors how dictionaries work — they live inside the style folder and are referenced via a relative path. The lookup order is: `config/actions/` first (backwards compatible), then `<StylesPath>/<StyleName>/`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
Contributor
|
Hm. I kind of wish things were a little more linked so we could simply traverse to fetch that data. Something like: Could cut down on a lot of duplicate struct values and allow us to do more advanced asset lookups without having to rely on arbitrary string parsing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hopefully this makes sense. I did create this with Claude, tested locally and it seems to work fine :/
Summary
suggestaction references a.tengoscript, Vale only searchesconfig/actions/for the filevale syncdrops theconfig/directory for style-only packages — it only copies the folder matching the package name (e.g.,RedHat/)config/actions/to be found, but that directory is silently dropped during syncThis PR adds a fallback so the
suggestaction also searches the style's own directory (e.g.,<StylesPath>/RedHat/NoGerundsInTitles.tengo), matching how dictionaries work — they live inside the style folder and get included in a simplezip -r RedHat.zip RedHat.Why this affects us
The vale-at-red-hat package ships as a style-only zip (
zip -r RedHat.zip RedHat). When we added asuggestaction with a Tengo script (NoGerundsInTitles), we hit a wall:.tengofile inconfig/actions/and addingconfigto the zip (zip -r RedHat.zip RedHat config) doesn't work —installPkgatsync.go:94enters the style-only code path and only copiesRedHat/, silently droppingconfig/styles/wrapper would work but breaks the simple packaging model that every other style-only package usesRedHat/alongside the rule files — but thenFindConfigAssetcan't find it because it only searchesconfig/actions/Lookup order (backwards compatible)
config/actions/<script>(existing behavior)<StylesPath>/<StyleName>/<script>(new fallback, derived fromalert.Check)Test plan
vale syncwith flatRedHat.zip,suggestaction findsRedHat/NoGerundsInTitles.tengoand returns correct suggestions ("Running" → "Run")config/actions/lookup)🤖 Generated with Claude Code