Steps 1-4: rename file-local and cross-package internal identifiers in @hexclave/shared (and their consumers) from stack*/Stack* to hexclave*/Hexclave*. Wire/compat names, public SDK aliases, and legacy stack-auth.com-side names (cloud-hosts) intentionally left unchanged. typecheck + lint green.
17 KiB
Hexclave Rename — PR 5 Plan (internal symbol & path cleanup)
Branch: cl/hexclave-rename-pr5
PR 5 finishes the internal, non-wire half of the Stack→Hexclave rename. PRs 1–3 + follow-ups already shipped the compatibility layer (wire dual-accept, env dual-read, @hexclave/* packages, public Hexclave* aliases, dual cookies, dual domains). PR 5 renames things that are safe because nobody outside the repo depends on the exact name: internal symbols, directory/file names, internal variables, and residual brand strings. It must NOT touch wire/compat identifiers or external-facing names.
Generated SDK packages (packages/js, packages/react, packages/stack, packages/tanstack-start) are copied from packages/template by scripts/generate-sdks.ts — only edit packages/template, then run pnpm -w run generate-sdks.
Scope decisions (maps the 12-section review feedback)
| # | Area | Decision |
|---|---|---|
| 1 | Package directory names (packages/stack*) |
Rename all dirs → hexclave-based names |
| 2 | @stackframe/template, @stackframe/init-stack |
Rename @stackframe/template → @hexclave/template; delete packages/init-stack/ entirely (deprecated) |
| 3 | Source dirs (lib/stack-app, stack-companion, apps/.../stack/); skills/stack-auth |
Rename all; skills/stack-auth → skills/hexclave directly |
| 4 | Source files with stack basename; logo assets |
Rename all code files. KEEP stack-auth-logo*.svg (verified: used intentionally by the rebrand modal as the old logo) |
| 5 | Public SDK Stack* aliases |
No action (kept as deprecated aliases) |
| 6 | Internal-only Stack* symbols + camelCase/infix internal vars |
Rename all (incl. newly-discovered stackGlobalsSymbol-class identifiers) |
| 7 | x-stack-* HTTP headers |
No action (dual-accept forever) |
| 8 | Cookies / storage / DOM / postMessage | Rename what's safe-to-reset (UI-only local state); keep compat for anything persisted/cross-version |
| 9 | STACK_PORT_PREFIX |
Env var already renamed (0 refs left). Rename the internal stackPortPrefix / expandStackPortPrefix / replaceStackPortPrefix vars/fns |
| 10 | doctor.ts, init prompt |
Update stale stack.config.ts-only references to prefer hexclave.config.ts |
| 11 | *.stack-auth.com domains |
No action (compat) |
| 12 | Brand strings | Update "Stack Auth"/"Stack dashboard" prose in code (incl. newly-found known-errors.tsx, backend messages) |
A. Directories to rename (§1, §3)
| Current | New |
|---|---|
packages/stack (npm @hexclave/next) |
packages/next |
packages/stack-shared (@hexclave/shared) |
packages/shared |
packages/stack-ui (@hexclave/ui) |
packages/ui |
packages/stack-sc (@hexclave/sc) |
packages/sc |
packages/stack-cli (@hexclave/cli) |
packages/cli |
packages/template (→ @hexclave/template) |
packages/template (dir name fine; npm name changes) |
**/src/lib/stack-app/ (template + generated) |
**/src/lib/hexclave-app/ |
apps/dashboard/src/stack/ |
apps/dashboard/src/hexclave/ |
apps/dashboard/src/components/stack-companion/ (+ stack-companion.tsx) |
…/hexclave-companion/ |
skills/stack-auth/ |
skills/hexclave/ |
app/handler/[...stack]/ (dashboard, internal-tool, all examples/*) |
app/handler/[...hexclave]/ — DECIDED: rename |
Decided (review): directory names drop the stack- prefix to match the npm names — packages/{next,shared,ui,sc,cli}.
[...stack] → [...hexclave] is internal/cosmetic: it changes the Next.js catch-all param key (params.stack → params.hexclave), NOT the public /handler/* URL. Update the param read site in the handler (packages/template/src/components-page/*handler*.tsx) and every examples/*/.../handler/[...stack]/page.tsx in lockstep. Public URLs are unchanged, so no wire/compat risk.
Do NOT rename: sdks/implementations/swift/Sources/StackAuth/ (frozen Swift package).
Each dir rename ripples into: tsconfig.json path aliases, pnpm-workspace.yaml, turbo.json, import specifiers (mostly already @hexclave/* so unaffected), scripts/generate-sdks.ts source/dest paths, and any relative imports. Use git mv; then sweep references.
B. Package renames / deletions (§2)
@stackframe/template→@hexclave/template: updatepackages/template/package.jsonname; update the ~3 dependents that reference@stackframe/template(find:rg '@stackframe/template'),scripts/generate-sdks.ts, any tsconfig path. It's never published, so no npm impact.- Delete
packages/init-stack/: remove the directory and de-wire all references —pnpm-workspace.yaml, rootpackage.jsonscripts (init-stack:localetc.),turbo.json- any CI workflow referencing it
- dashboard onboarding / docs that point at
npx @stackframe/init-stack(onboarding already moved to@hexclave/cli init) - The already-published
@stackframe/init-stacknpm package stays on npm (can't/shouldn't unpublish) — that's fine; we just stop building it. - Migrate-or-confirm: a few helper names live here (
getStackPackageName,StackAppFile*types,MCP_SERVER_NAME,EVENT_PREFIX="stack-init-"). Confirm nothing still-shipping imports from init-stack before deletion (rg 'init-stack').
C. Files to rename (§4)
Edit in packages/template (regenerated to SDKs):
components-page/stack-handler.tsx→hexclave-handler.tsx;stack-handler-client.tsx→hexclave-handler-client.tsxproviders/stack-context.tsx→hexclave-context.tsx;stack-provider.tsx→hexclave-provider.tsx;stack-provider-client.tsx→hexclave-provider-client.tsx
Apps:
apps/backend/src/stack.tsx→hexclave.tsxapps/internal-tool/src/stack.ts→hexclave.tsapps/dashboard/src/lib/stack-app-internals.ts→hexclave-app-internals.tsapps/dashboard/src/components/stack-companion.tsx→hexclave-companion.tsx(with dir rename in §A)
KEEP (do not rename/delete):
apps/dashboard/public/stack-auth-logo.svg,stack-auth-logo-bright.svg— old logo shown on purpose inhexclave-rebrand-modal.tsx..github/assets/stack-webhooks.png— only if it still depicts current product; low priority, leave unless re-capturing.
D. Internal symbols & variables to rename (§6, §9)
All internal-only (not exported from any customer entrypoint). Stack* → Hexclave*, stack* → hexclave*.
packages/stack-shared (→ packages/shared):
stackGlobalsSymbol(utils/globals.tsx) — theSymbol.for("__stack-globals")string is already__hexclave-globals; rename just the JS const.stackCapturedErrors(utils/errors.tsx),stackFs(utils/fs.tsx),stackPortPrefix(utils/redirect-urls.tsx),stackDevEnvStatePath(utils/dev-env-state-path.ts)stackAuthHost(loop var) +stackAuth(return-object key) inutils/cloud-hosts.tsx— internal shape, paired with ahexclavekey; safe.stackAuthUser/stackAuthUserId(utils/featurebase.tsx),StackAuthUsertype- yup
.meta()keys:stackSchemaInfo,stackConfigCanNoLongerBeOverridden,stackAllowUserIdMe,StackAdaptSentinel(schema-fields.ts,config/schema.ts) — internal metadata, renameable in lockstep stackApp/stackServerApplocal vars ininterface/page-component-versions.ts- ⚠️
showOnboardingStackConfigValue— rename the identifier, but VERIFY its string value isn't persisted in DB config rows before changing the value (rename name only if value is persisted).
packages/template (regenerate after):
stackAppInternalsSymbolconst (lib/stack-app/common.ts) — rename the const; keep the dualSymbol.for("StackAuth--…")+Symbol.for("Hexclave--app-internals")strings (customer-visible, dual-attach)._StackClientAppImplIncomplete,_StackServerAppImplIncomplete,_StackAdminAppImplIncomplete,_StackClientAppImpl/Server/Admin,LazyStackAdminAppImpl(impl classes/index)StackContext(providers/stack-context.tsx),StackContextValue,StackProviderClient,StackHandlerClient,StackHandlerProps,StackSDK,StackAppInternals,StackAppTokenInternals,StackAppRequestInternals,StackDevTool,StackSimple,StackRouter,StackConfigValue/StackConfigObject/StackConfigFileContent,StackOAuthCallback,StackIcon,StackAuthHeaders,StackAppImportreplaceStackPortPrefix(lib/stack-app/apps/implementations/common.ts).stack-devtoolCSS class (dev-tool-styles.ts + core) — rename className + selectors atomically. (Dev-tool storage/DOM keysSTORAGE_KEY/ROOT_ID/etc. are already__hexclave-dev-tool-*.)
apps/backend:
getStackStripe(lib/stripe.tsx),stackPortPrefix,expandStackPortPrefix(polyfills.tsx),stackAuthBaseUrl(oauth/index.tsx),stackAuthHost(loop var)getStackAuthApiBaseUrl(imported from shared — rename at source)- in-process global cache keys
__stack_actual_global_connection_string,__stack_actual_replica_connection_string,__stack_prisma_sigterm_registered(prisma-client.tsx) — process-local, safe - ⚠️
__stackComponent(email-rendering.tsx) — VERIFY it's a runtime-only marker, not serialized into stored/rendered templates, before renaming.
apps/dashboard:
stackAppInternalsSymbol(lib/stack-app-internals.ts+external-db-sync/page-client.tsx) — const rename, dual Symbol strings keptstackServerApp/stackAdminApplocal vars,StackAdminAppContext,expandStackPortPrefix(polyfills.tsx),isStackAppTokenInternals/getStackAppTokenInternalsdata-stack-handler-pageDOM attribute (internal)- ⚠️
stack-scopeCSS class (47×) — VERIFY it isn't referenced by the published@hexclave/dashboard-ui-components/ saved create-dashboard outputs. If purely dashboard-internal, rename className + globals.css selector atomically; else keep.
Other apps: createStackMcpHandler (apps/mcp), and e2e helper names (expandStackPortPrefix, stackTestTenancyId, localRedirectUrl test consts) — rename freely (internal test harness).
E. Safe-to-reset cookies/storage/DOM (§8)
Rename outright (UI-only local state, a one-time reset is harmless):
stack-devtool-trigger-position→ alreadyhexclave-devtool-trigger-position✅ (confirm propagated)__stack-dev-tool-state/-root/-instance→ already__hexclave-*✅_STACK_AUTH.lastUsed(OAuth last-provider hint) →_HEXCLAVE.lastUsed- dev-tool DOM ids/attrs,
data-stack-handler-page
Keep backwards-compatible (persisted / cross-version / saved-state): main auth + OAuth cookies (stack-access, stack-refresh-*, stack-oauth-* — dual-write already), stack:session-replay:v1:* (LEGACY prefix, dual-read), iframe postMessage types + window.Stack* globals + STACK_EDITABLE_*/STACK_EXPR_* email-HTML markers (saved dashboards/templates), stack-init-id query param.
F. Brand strings to reword (§12)
Update "Stack Auth" / "Stack dashboard" / "Stack" product prose in code (docs handled separately):
packages/stack-shared/src/known-errors.tsx—"…not a valid OAuth scope for Stack.","…on the Stack dashboard…"(×2)apps/backend—check-versionmessage,send-test-webhookbody,init-script-callbacktelegram text,purchase-session"Stack Auth price ID", code commentsapps/dashboard— OAuth confirm card alt text, domain-settings label, setup-page snippet labels- The ~25
"Stack Auth"literals across 12 files from the first pass - Init/CLI prompts:
packages/stack-cli/src/commands/init.tsuser-facing "Set up Stack Auth"/"Stack" strings
Keep brand strings that are intentional: the rebrand modal copy ("Stack Auth is now Hexclave"), compat comments documenting stack_response_mode / dual-emit, migration.mdx prose (the rebrand-explanation page must keep "Stack Auth").
docs-mintlify (DECIDED: in scope)
- Reword
"Stack Auth"/"Stack"product prose throughoutdocs-mintlify/(keepmigration.mdx's intentional mentions + any explicit compat notes). - Rename
stack-named doc files:docs-mintlify/guides/going-further/stack-app.mdx,docs-mintlify/sdk/objects/stack-app.mdx,docs-mintlify/sdk/hooks/use-stack-app.mdx→hexclave-app.mdx/use-hexclave-app.mdx. Updatedocs.jsonnav entries and every internal cross-link (rgthe old slugs). Add redirects if Mintlify supports them so old URLs don't 404. - Leave
tanstack-startdoc dir/files alone (framework name).
G. doctor.ts & init prompt (§10)
packages/stack-cli/src/commands/doctor.ts— config check looks only forstack.config.{ts,js}; make it preferhexclave.config.tsand acceptstack.config.tsas fallback (mirrorconfig-file.tsdiscovery).packages/stack-cli/src/commands/init.tsprompt text ("Path to your existing stack.config.ts") — mentionhexclave.config.ts(preferred) +stack.config.ts(legacy).
DO NOT TOUCH — verified compat-critical & false positives
Compat-critical (renaming breaks data/wire/cross-version):
- Crypto/vault/JWT domain-separation purpose tags —
crypto.tsx,jwt.tsx,helpers/vault/*carry explicitdo NOT renamenotes (break decryption/verification of existing data). - Brand sentinels
stack-known-error-brand-sentinel,stack-status-error-brand-sentinel(known-errors.tsx,errors.tsx) — cross-versionisKnownError/isStatusErrorchecks across coexisting SDK copies. - OTel telemetry attribute keys
stack.external-db-sync.*,stack.db-replication.*,stack.prisma.transaction.*(observability dashboards; plan scopes observability out). - DB table
_stack_sync_metadata; webhook event typestack.test; IdP idsstack-preconfigured-idp:*. - Bearer
stackauth_value;x-stack-*headers;stack-*cookies' legacy names;stack.config.tsfallback;*.stack-auth.comdomains. - Infra (plan-locked): Postgres DB
stackframe, ClickHouse userstackframe, Docker image/container names (stack-backend,stack-local-emulator,stackframe-server), hostnames,STACK_AUTH_*GitHub secrets,stack-auth-config-sync.yml. - Swift
StackAuthpackage +StackClientApp/StackServerApp/StackAuthErrorsymbols (frozen). - MCP
ask_stack_auth/ server namestack-auth(kept;ask_hexclavealready added). stack-auth-logo*.svg(old logo, used by rebrand modal).
False positives — contain "stack" but are NOT our brand:
stackable/Stackable/StackableQuantityField/handleStackableChange/isStackableSelfMatch/"Stackable products…"— payments product feature ("can be purchased multiple times").Stacked*charts —StackedTooltip,StackedBarChartDisplay,StackedDataPoint,filterStackedDatapointsByTimeRange,emailStackedChartConfig— "stacked bar chart" charting term.TanStack/TanStackStart*/StackStart*(the 66StackStartServerContexthits are the tail ofTanStackStartServerContext),tanstackStartOnlyTemplateFiles— TanStack Start framework.OrbStack(resolveConnectionStringWithOrbStack) — third-party Docker tool;localstack.- JS call-stack concepts (
error.stack,stackTrace, stack-trace length) — not brand.
Execution order
- Branch is ready (
cl/hexclave-rename-pr5). Work in slices; lint/typecheck between slices. - Symbols/vars first (§D, §F, §G) inside
packages/template+packages/stack-shared(mechanical, grep-driven), thenapps/*. Verify the ⚠️ items (showOnboardingStackConfigValuevalue,__stackComponent,stack-scope) before touching them. pnpm -w run generate-sdksto propagate template renames tojs/react/stack/tanstack-start.- File renames (§C) via
git mv, fix imports. - Directory renames (§A) via
git mv; updatetsconfig/turbo.json/pnpm-workspace.yaml/generate-sdks.ts; then a clean install (rm -rf node_modules && pnpm install --frozen-lockfile) — large workspace renames leave the.pnpmsymlink layout half-stitched otherwise. - Package rename + init-stack deletion (§B); de-wire workspace/CI.
skills/stack-auth→skills/hexclave;[...stack]→[...hexclave]across dashboard/internal-tool/examples (§A).- docs-mintlify (§F): reword prose + rename
stack-app.mdx/use-stack-app.mdx, fixdocs.jsonnav + cross-links. - Force-rebuild (
turbo run build --filter=./packages/* --force), thenpnpm typecheck+pnpm lint. - Targeted tests: SDK build/import, CLI
doctor/init, dashboard boot, e2e auth wire (must still pass with stack-named cookies/headers untouched).
Resolved decisions (review)
- Dir naming: drop the
stack-prefix →packages/{next,shared,ui,sc,cli}. - docs-mintlify: in scope — reword brand prose + rename
stack-*.mdxfiles. [...stack]: rename to[...hexclave](internal param key only; URL unchanged).
Still to verify during implementation (rename only if safe)
showOnboardingStackConfigValue— is the string value persisted in DB config rows?__stackComponent— serialized into stored/rendered email templates?stack-scopeCSS — referenced by published@hexclave/dashboard-ui-componentsor saved create-dashboard outputs?