fix: export hooks subpaths and harden X-Glean env parsing#97
Merged
chris-freeman-glean merged 2 commits intomainfrom Feb 3, 2026
Merged
Conversation
Make hooks importable via ./hooks/* exports (regen-safe via .speakeasy/gen.yaml) and align X_GLEAN_INCLUDE_EXPERIMENTAL semantics to only enable on true; update docs and tests.
Add explicit ./hooks and ./hooks/*.js exports (regen-safe) so consumers can import hooks modules with .js specifiers without double-extension resolution issues.
travis-hoover-glean
approved these changes
Feb 3, 2026
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.
What
Follow-up to #96 to fix a couple of post-merge issues:
./hooks,./hooks/*.js,./hooks/*) so consumers can importXGleanOptionsas documented..speakeasy/gen.yaml(typescript.additionalPackageJSON).src/hooks/x-glean.tsby removing the unsafe cast, adding runtime guards, and aligningX_GLEAN_INCLUDE_EXPERIMENTALsemantics to only enable the header when the env var is explicitlytrue(case-insensitive). Any other non-empty value disables/omits the header; empty/whitespace falls back to constructor options.README.mdconstructor options example to be TS-safe (satisfies SDKOptions & XGleanOptions).Why
After #96, TypeScript consumers could no longer pass
excludeDeprecatedAfter/includeExperimentalas constructor options without excess-property errors, andXGleanOptionswas not importable from the published package. Also, env var parsing previously allowed accidental values likeX_GLEAN_INCLUDE_EXPERIMENTAL=falseto be sent as a header.Test Plan
npx vitest run src/__tests__/x-glean.test.tsnpm run lintnpm run buildimport('@gleanwork/api-client/hooks/x-glean-options.js')resolves with the new export map.