feat(ui-admin): AuthGate + BaseClient + CollectionCRUD for hanzoai/base SPAs#2
Open
hanzo-dev wants to merge 3 commits into
Open
feat(ui-admin): AuthGate + BaseClient + CollectionCRUD for hanzoai/base SPAs#2hanzo-dev wants to merge 3 commits into
hanzo-dev wants to merge 3 commits into
Conversation
Existing logic overwrote HANZO_API_KEY with empty string on curl failure (no pipefail, no http-code check), then errored "No KMS auth available" even when an HANZO_API_KEY org secret was set. Also added NPM_TOKEN org-secret as last-resort fallback so this workflow ships @hanzogui/admin even if /publish path in KMS has not been provisioned with NPM_TOKEN.
@hanzogui/admin is the immediate publish target for auto/commerce/kms admin rollouts. The hanzogui umbrella has 50+ transitive workspace specs; smoke-installing it from a /tmp consumer hit unobservable failures (npm install --silent). Drop umbrella from the smoke install, make umbrella+@hanzo/gui alias publish steps continue-on-error so admin publish unblocks regardless. Umbrella republish can land on a follow-up tag once the workspace-spec resolution is debugged.
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
@hanzogui/admin/authAuthGate — single declarative guard for any hanzoai/base-backed admin SPA. Wraps the route subtree, intercepts/loginand/callback, drives the OIDC dance via the canonical IAM client. StructuralIAMClienttype keeps the gate version-agnostic against@hanzo/iam@^0.8.xand^0.9.x.@hanzogui/admin/datacreateBaseClient({apiPrefix, getToken})+BaseClientProvider+useBaseClient()+makeAuthedFetcher. Typed wrapper around any Base instance — one mount knob (/v1,/v1/auto,/v1/commerce) flips the entire surface.@hanzogui/admin/crud<CollectionCRUD collection="X">— schema-driven list + filter + paginate + detail-sheet + create-form for one Base collection. Phase 1 stops at create. Phase 2 = edit + delete (the client already exposes both).apps/admin-auto-stub/— 40 LOC of consumer wiring renders the full chrome end-to-end againstbase.hanzo.ai. Override target viaVITE_BASE_TARGET.This is the unblocking primitive for the unified admin UI vision. Every hanzoai/base-backed service (
base,auto,commerce,bot, custom org-bases) drops in<AuthGate>+<BaseClientProvider>+<AdminApp>+ one route per collection.Test plan
bun run typecheckpasses inpkgs/ui-adminandapps/admin-auto-stubbun run testpasses — 32 files / 237 tests (13 new acrosstest/data/baseClient.test.tsandtest/auth/authGate.test.tsx)bun run devinapps/admin-auto-stub→ AuthGate redirects to/loginand renders the default sign-in screen (Sign in to Hanzo Base)./superusersrenders the full chrome andCollectionCRUDsurfaces the canonical Base 401 error frombase.hanzo.ai/v1/collections/_superusers("The request requires valid record authorization token.").iam.hanzo.ai— requires an IAM app registration forhanzo-basewithhttp://localhost:5179/callbackwhitelisted. Out of scope for this PR.Why this lives in
@hanzogui/admin, not a new@hanzo/gui-adminpackageThe original task spec proposed
@hanzo/gui-admin.@hanzogui/adminv7.2.3 already exists atpkgs/ui-admin/with the canonicalAdminApp,Sidebar,TopBar,Empty,DataTable, etc. Per "one and only one way to do everything," extending the existing package is correct; spawning a parallel one would duplicate the surface.API additions (top-level barrel)
Subpath exports added:
./crud. Existing exports unchanged.