feat: export UMBEL_RESOLVED_DIR + UMBEL_BUNDLE_VERSION on the bundle run path#23
Merged
Merged
Conversation
…run path
prepareBundleInvocation now sets UMBEL_RESOLVED_DIR (the resolved cache dir)
and UMBEL_BUNDLE_VERSION (0.0.0+<hash>) in claude's spawn env, giving
downstream tools a stable source for the running bundle's identity rather
than scraping the --plugin-dir entry off PATH.
compile() returns { cacheDir, version } so the version is sourced from the
same value it writes into plugin.json and the two can't drift. The vanilla
path (execVanilla) is untouched and sets neither var.
Closes #17
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.
Summary
umbel run <bundle>now exports two vars intoclaude's spawn env so downstream tools can read the running bundle's identity directly, instead of scraping the--plugin-direntry offPATH(a fragile dependency on Claude Code's plugin→PATH behavior):UMBEL_RESOLVED_DIR— the resolved cache dir (<cacheRoot>/bundles/<name>-<hash>).UMBEL_BUNDLE_VERSION— the bundle version (0.0.0+<hash>).To guarantee the version can't drift from what the compiler writes,
compile()now returns{ cacheDir, version }: the0.0.0+<hash>string is computed once and used both forplugin.jsonand the return value (no re-derivation, no second literal).exec.tsdestructures it straight intospawnEnv. The vanilla path (execVanilla) is untouched and sets neither var.Concrete first consumer: a dotfiles ccstatusline widget showing
name@versionof the active bundle.Changes
src/bundle/compile.ts—compile()→CompileResult { cacheDir, version }; single source for the version string.src/bundle/exec.ts— setUMBEL_RESOLVED_DIR+UMBEL_BUNDLE_VERSIONon the bundle-resolved path.src/run.ts—buildBundleuses.cacheDir.src/args.ts— both vars documented in the--helpEnv section.Test plan
exec.test.ts), incl.UMBEL_BUNDLE_VERSION== compiledplugin.jsonversion.run.vanilla-env.test.tsproves the vanilla path sets neither var (scopedspawnSyncmock).args.test.ts.compile.test.tsupdated mechanically for the new return shape.tsc --noEmitclean,biome check .clean.claudeconfirmsUMBEL_RESOLVED_DIR= on-disk dir andUMBEL_BUNDLE_VERSION=plugin.jsonversion.Out of scope (captured as follow-ups)
bundle.mdfrontmatter carries a barehashfield — the0.0.0+<hash>versionlives inplugin.json(the citedcompile.tsline). Implemented to the cited value/line; the bundle.md-vs-plugin.json divergence is filed for discovery.Closes #17