feat(cli): default --auth to TRANSCEND_API_KEY env var#255
Open
Utsav-Patel wants to merge 5 commits into
Open
Conversation
The `--auth` flag now falls back to the `TRANSCEND_API_KEY` environment variable when not passed explicitly, mirroring the existing `TRANSCEND_API_URL` -> `--transcendUrl` convention. An explicit `--auth` still takes precedence; when the env var is unset, `--auth` remains required (backward compatible). This is a central change to `createAuthParameter`, so all ~43 API-authenticated commands (policy, request, consent, inventory, migration/sync-ot) benefit, including every `transcend policy *` API command (publish, activate, list, versions). Local-only policy commands (eval, lint, test) and `sombraAuth` are unaffected. Docs regenerated via `pnpm docgen`; env-only examples added to the four API policy commands and a top-level auth note added to the README. Closes LINK-7225.
@transcend-io/airgap.js-types
@transcend-io/cli
@transcend-io/internationalization
@transcend-io/privacy-types
@transcend-io/sdk
@transcend-io/type-utils
@transcend-io/utils
@transcend-io/mcp
@transcend-io/mcp-server-admin
@transcend-io/mcp-server-assessment
@transcend-io/mcp-server-base
@transcend-io/mcp-server-consent
@transcend-io/mcp-server-discovery
@transcend-io/mcp-server-dsr
@transcend-io/mcp-server-inventory
@transcend-io/mcp-server-preferences
@transcend-io/mcp-server-workflows
commit: |
…ar defaults The --transcendUrl and --consentUrl flags already fall back to the TRANSCEND_API_URL and TRANSCEND_CONSENT_API_URL environment variables (then the hardcoded defaults), but the flag brief text did not mention this, so users were unaware they could omit the flags by exporting the env vars. Surface the env-var default in each flag's help text and regenerate the README.
After a successful upload, log that publishing does not activate the policy and print the exact `transcend policy activate` command with the new version ID and bundle name.
Replace --versionId with optional --version on transcend policy activate. When omitted, activate the latest uploaded version by createdAt. Update the publish activation hint and docs accordingly.
When --version is omitted, transcend policy publish now labels uploads
as {bundleName}-yyyy-mm-dd-hh-mm-ss (UTC) instead of git SHA or a raw
ISO timestamp.
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.
Related Issues
Public Changelog
--authnow defaults to theTRANSCEND_API_KEYenvironment variable when set, so API-authenticated commands can omit the flag after exporting it once. When unset,--authremains required (backward compatible).--transcendUrland--consentUrlflag help now documents the existingTRANSCEND_API_URL/TRANSCEND_CONSENT_API_URLenv-var defaults.transcend policy publishlabels uploads{bundleName}-yyyy-mm-dd-hh-mm-ss(UTC) when--versionis omitted, and prints the exacttranscend policy activatecommand after a successful upload.transcend policy activateaccepts an optional--versionlabel instead of--versionId; when omitted, activates the latest uploaded version bycreatedAt.Internal Changelog
createAuthParameter.Implementation details
Why
Customers run
transcend policy publish/activate/list/versionsrepeatedly in a shell or CI session. Requiring--authon every invocation is friction; exportingTRANSCEND_API_KEYonce matches the existingTRANSCEND_API_URLconvention. Version labels and post-publish hints shorten the publish→activate loop.Resolution order
--authTRANSCEND_API_KEYenv--authflag--authrequired (unchanged)--transcendUrl(existing behavior, now documented)TRANSCEND_API_URLenv--transcendUrlflaghttps://api.transcend.io(unchanged)--consentUrlbehaves identically withTRANSCEND_CONSENT_API_URL→https://consent.transcend.io.Key files
packages/cli/src/constants.ts—DEFAULT_TRANSCEND_API_KEYfromprocess.env.TRANSCEND_API_KEYpackages/cli/src/lib/cli/common-parameters.ts— auth/url/consent parameter defaults and briefspackages/cli/src/commands/policy/publish/impl.ts— default version label + activation hintpackages/cli/src/commands/policy/activate/impl.ts—--versionlabel resolutionpackages/cli/src/commands/policy/helpers/resolvePolicyBundleVersion.ts— label lookup / latest-by-createdAtpackages/cli/src/commands/policy/helpers/defaultPolicyVersionLabel.ts—{bundleName}-yyyy-mm-dd-hh-mm-ss.changeset/transcend-api-key-env-default.md—@transcend-io/climinorEpic: LINK-6822