feat: add admin log access, totalCount pagination, fix docs accuracy#9
Open
whoabuddy wants to merge 13 commits into
Open
feat: add admin log access, totalCount pagination, fix docs accuracy#9whoabuddy wants to merge 13 commits into
whoabuddy wants to merge 13 commits into
Conversation
- Add staging/production environments in wrangler.jsonc - Add fork notice and maintenance docs to CLAUDE.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove logs.wbd.host route from top-level (only used for local dev) - Use staging KV namespace ID for local development - The previous ID was from whoabuddy account, not aibtcdev Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Previously DELETE /apps/:id required the app's own API key. Now admins can also delete apps using the X-Admin-Key header, consistent with other admin operations. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: allow admin key to delete apps Previously DELETE /apps/:id required the app's own API key. Now admins can also delete apps using the X-Admin-Key header, consistent with other admin operations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(dashboard): overhaul with unified view and advanced filtering (#3) - Add unified overview page showing all apps with error trends and health status - Add enhanced app detail page with 7-day stats chart (Chart.js) - Add advanced filtering: date range picker, request ID, context field filters - Add server-side search and context filtering to Durable Object - Modularize dashboard into separate files for maintainability - Integrate Alpine.js for declarative client-side state management - Add SVG sparklines and trend indicators for quick status overview New file structure: src/dashboard/ index.ts - Main router auth.ts - Session management styles.ts - Shared styles types.ts - Dashboard types pages/ - Login, overview, app-detail api/ - Overview aggregation endpoint components/ - Layout, charts utilities Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * chore: remove deprecated dashboard.ts Replaced by modular src/dashboard/ directory. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…tilities (#4) (#6) * refactor: remove dead code and extract shared utilities - Delete unused src/services/stats.ts (legacy KV-based stats, replaced by DO SQLite) - Extract getAppDO and countByLevel to src/utils.ts - countByLevel now uses Map for O(n) instead of O(n²) array scanning * refactor: consolidate duplicated code and remove unused functions Dashboard: - Extract getAppList, getAppName, getHealthUrls to shared helpers.ts - Fix type safety: replace `any` with proper Context type Result utilities: - Add wrapError() for consistent error handling in catch blocks - Remove unused exports: isOk, isErr, getErrorStatus, ErrorStatusMap Registry service: - Use wrapError() instead of inline error handling (6 occurrences) - Remove unused validateApiKey and regenerateApiKey functions * chore: remove unused dashboard code - Remove unused loadingSpinner component from layout.ts - Remove unused appOptions variable from header function - Remove unused types: SavedFilter, FilterState, HealthSummary - Remove unused HealthCheck import from types.ts --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
- Add GitHub Actions workflow for release-please - Configure extra-files to update version in src/index.ts - Sync package.json version to 0.4.0 to match API response - Add x-release-please-version marker for automatic version updates Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat(dashboard): apply AIBTC brand guidelines to dashboard UI Add AIBTC brand identity across all dashboard pages: logo, favicon, Roc Grotesk font, brand orange (#FF4F03) accent color, dark gradient background with pattern overlay, and card glow/hover effects matching the x402-api and x402-sponsor-relay dashboards. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * use css var over direct def Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * add safari explicit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix(dashboard): address PR review feedback - Use event delegation for card glow mouse tracking instead of per-element listeners to prevent memory leaks with dynamic content - Scope focus ring to focus-visible with opt-out classes (log-level, icon-button) so semantic elements keep default focus styling - Broaden text-blue-400 override to all elements except .log-level so non-anchor brand links also get orange accent - Replace hardcoded color values in Tailwind overrides with CSS variables (--bg-table-header, --bg-input, --bg-input-hover, etc.) - Add --accent-hover CSS variable, replace inline onmouseover/onmouseout on login button with .btn-accent CSS class - Add z-index layering to card glow (z-index: 0 on ::after, z-index: 1 on .brand-card > * children) so content renders above glow effect - Replace hardcoded #111 dropdown background with var(--bg-card) - Remove unused brand color object from styles.ts (CSS variables used) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* feat(dashboard): add BrandConfig type and getBrandConfig env reader Phase 1 of configurable branding quest. Defines BrandConfig interface with all brand values, AIBTC defaults, and getBrandConfig() that reads BRAND_* environment variables with automatic accent color derivation and CDN URL composition. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(dashboard): generate brand CSS from BrandConfig Phase 2 of configurable branding quest. Replaces static brandCss with buildBrandCss(config) that generates CSS from BrandConfig values. Updates htmlDocument and header to accept brand config via LayoutOptions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor(dashboard): thread BrandConfig through router and pages Phase 3 of configurable branding quest. Resolves brand config from env vars once per request via middleware. All page functions accept BrandConfig and forward it to layout components. Changes: - Add middleware to resolve brand config from env on each request - Update Hono generic to include Variables with brand config - Thread brand config through all page functions (login, overview, app-detail) - Update page functions to pass brand to layout components - Type helper functions to accept contexts with Variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(dashboard): add brand env vars to wrangler and brand config tests Add BRAND_NAME, BRAND_ACCENT, and BRAND_CDN_URL environment variables to staging and production wrangler.jsonc environments with AIBTC defaults. Add comprehensive tests for getBrandConfig() covering defaults, env overrides, CDN URL derivation, accent color derivation, and individual URL overrides. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(dashboard): address PR review feedback on brand config - Validate hex colors with regex, fallback to default on invalid input - Remove unused accentRgb variable - Add BrandEnv type to eliminate unsafe cast in router middleware - Escape brand values in HTML attributes (defense-in-depth) - Add tests for invalid hex inputs and accent fallback Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
The health-urls endpoint only accepted per-app API keys, preventing admin users from configuring health check URLs. Switch to requireApiKeyOrAdmin middleware to match the pattern used by other app management endpoints. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Remove claim that API keys are hashed; they are stored plaintext in KV - Add TODO to implement key hashing before storing - Fix KV Registry schema to use 'api_key' matching actual AppConfig type - Update auth table: GET /logs now accepts Admin Key (upcoming change) - Document LogsRPC copy-paste pattern and rationale for shared package extraction Co-Authored-By: Claude <noreply@anthropic.com>
…ponses
- GET /logs now accepts X-Admin-Key with X-App-ID for cross-app debugging
- query() returns { logs, totalCount } instead of bare array, enabling
clients to know full result size for pagination without extra requests
- Add LogQueryResult type to types.ts and export it for consumers
- Update rpc.ts query() return type to LogQueryResult
- Fix dashboard to use data.data.logs from new response shape
- Update tests to assert on new { logs, totalCount } structure
Co-Authored-By: Claude <noreply@anthropic.com>
worker-logs uses Durable Objects + KV only; D1 is not used. The API token template comment incorrectly included "D1: Edit" permission. Co-Authored-By: Claude <noreply@anthropic.com>
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
GET /logsviaX-Admin-Key+X-App-IDheaderstotalCountfield to all log query responses for pagination awareness.env.examplePart of the ax-ux-audit quest (phase 12 of 12).
Test plan
GET /logswithX-Admin-Keyheader hits admin auth path (code review)totalCountfield.env.examplehas no D1 references🤖 Generated with Claude Code