mirror of
https://github.com/Comfy-Org/comfy-typescript-sdk.git
synced 2026-11-04 23:47:27 +00:00
[PR #20] [MERGED] fix: derive User-Agent version from package.json at build time #30
Labels
No labels
audit:ai-readiness
audit:community
audit:github
audit:health-scoring
audit:policy
audit:release
audit:supply-chain
bug
cursor-review-pin
effort:medium
effort:small
effort:trivial
priority:nice-to-have
priority:recommended
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-typescript-sdk#30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-typescript-sdk/pull/20
Author: @wei-hai
Created: 7/23/2026
Status: ✅ Merged
Merged: 7/23/2026
Merged by: @wei-hai
Base:
main← Head:fix/ts-user-agent-version📝 Commits (1)
59ee0f0fix: derive User-Agent version from package.json at build time📊 Changes
4 files changed (+22 additions, -7 deletions)
View changed files
📝
package.json(+1 -1)➕
scripts/gen-version.mjs(+18 -0)📝
src/low/transport.ts(+1 -6)➕
src/low/version.ts(+2 -0)📄 Description
What
Makes the TypeScript SDK's
User-Agentreport the real published version instead of a stale hardcoded constant.The bug
Versioning is tag-driven:
publish.ymlrunsnpm pkg set versionfrom the release tag before building. But the User-Agent used a hand-keptconst SDK_VERSION = "0.1.0"intransport.tsthat the workflow never touched — so every published npm build sentUser-Agent: comfy-sdk-typescript/0.1.0regardless of the actual version (0.1.1, 0.1.2, …). That defeats version-level SDK-adoption tracking. (The Python SDK is unaffected — it readsimportlib.metadata.version.)The drift-guard test added earlier couldn't catch this: it compares the constant against
package.json's committed placeholder (both 0.1.0); they only diverge at publish time.Fix
scripts/gen-version.mjs— writessrc/low/version.tsfrompackage.json'sversion.buildnow runs it beforetsc. Since the publish workflow setspackage.jsonto the tag version before build, the published bundle now carries that version.transport.tsimportsSDK_VERSIONfrom the generated file.src/low/version.tsis committed with the placeholder so typecheck/test/lint work without a build; the publish build regenerates it. No change topublish.yml.Verified
Full CI-mirroring pass locally:
format:check,lint,typecheck, 130 tests,build, hygiene. And simulated a release:npm pkg set version 0.1.3 && pnpm build→ the built bundle reportsUser-Agent: comfy-sdk-typescript/0.1.3. Takes effect from the next release (0.1.3+); 0.1.2 already shipped.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.