feat(ui): dedupe ui-core components#128
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (6)
📝 WalkthroughWalkthroughConsolidates DOM-free UI infrastructure into ChangesCore Library Consolidation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (5)
packages/ui/src/components/observability/renderers/OtelMetricTimeSeries.tsx (1)
1-2: LGTM! Import consolidation is correct.The final renderer component correctly updates its imports to
@kopai/ui-core, completing the consistent refactoring pattern across all observability renderers.Optional: Verify the complete build chain.
Since this PR refactors multiple import paths across the codebase, you may want to verify that the monorepo build order and resolution work correctly:
#!/bin/bash # Verify that all imports resolve correctly after the refactoring # Check that `@kopai/ui-core` builds successfully cd packages/ui-core && pnpm build && cd ../.. # Check that `@kopai/ui` builds successfully with the new imports cd packages/ui && pnpm build && cd ../.. # Run type checking to ensure all imports resolve cd packages/ui && pnpm type-check🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ui/src/components/observability/renderers/OtelMetricTimeSeries.tsx` around lines 1 - 2, The imports in OtelMetricTimeSeries.tsx were updated to `@kopai/ui-core` (observabilityCatalog and RendererComponentProps); run the monorepo build and type-check to ensure import resolution and build order are correct: build packages/ui-core then packages/ui and run type-check in packages/ui, fix any broken exports or tsconfig paths if errors surface, and ensure the component OtelMetricTimeSeries (and related observability renderers) compiles against the new package surface.packages/ui/src/components/observability/renderers/OtelTraceDetail.tsx (1)
3-8: Optional: consolidate@kopai/ui-coreimports.Lines 3, 4, and 8 all import from
@kopai/ui-corebut are split across an unrelated local import at lines 5–7. Merging them into a single import statement would be slightly tidier.♻️ Proposed refactor
-import { observabilityCatalog } from "@kopai/ui-core"; -import type { RendererComponentProps } from "@kopai/ui-core"; +import { observabilityCatalog, useKopaiSDK } from "@kopai/ui-core"; +import type { RendererComponentProps } from "@kopai/ui-core"; import { TraceDetail } from "../index.js"; import { TraceSearch } from "../TraceSearch/index.js"; import type { TraceSummary } from "../TraceSearch/index.js"; -import { useKopaiSDK } from "@kopai/ui-core";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ui/src/components/observability/renderers/OtelTraceDetail.tsx` around lines 3 - 8, Consolidate the three separate imports from `@kopai/ui-core` into a single import statement: replace the separate imports of observabilityCatalog, RendererComponentProps, and useKopaiSDK with one grouped import from "@kopai/ui-core" (while leaving local imports TraceDetail, TraceSearch, and TraceSummary unchanged) so the file imports observabilityCatalog, RendererComponentProps, and useKopaiSDK together to tidy the module imports..changeset/ui-core-dedup.md (1)
1-6: Consider bumping@kopai/ui-coreas minor rather than patch.The changeset notes that
@kopai/ui-coreis addingCatalogueComponentPropsto its public barrel. Under semver, adding a new public export is typically a minor bump (additive API change), not a patch. Patch is conventionally reserved for bug fixes / no public API surface changes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/ui-core-dedup.md around lines 1 - 6, The changeset incorrectly marks "@kopai/ui-core" as a patch even though it adds a new public export; update the changeset header so "@kopai/ui-core" is bumped to minor (change the value from patch to minor) and keep the descriptive note as-is; reference the package name "@kopai/ui-core" and ensure the YAML header reflects the minor bump for the added CatalogueComponentProps export.packages/ui/src/components/observability/DynamicDashboard/index.tsx (1)
1-3: Consolidate the three@kopai/ui-coreimports into one statement.All three lines source from the same module; merging improves readability.
♻️ Proposed consolidation
-import { createRendererFromCatalog, type UITree } from "@kopai/ui-core"; -import { KopaiSDKProvider, type KopaiClient } from "@kopai/ui-core"; -import { observabilityCatalog } from "@kopai/ui-core"; +import { + createRendererFromCatalog, + KopaiSDKProvider, + observabilityCatalog, + type KopaiClient, + type UITree, +} from "@kopai/ui-core";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ui/src/components/observability/DynamicDashboard/index.tsx` around lines 1 - 3, Consolidate the three separate imports from "@kopai/ui-core" into a single import statement: combine createRendererFromCatalog, UITree, KopaiSDKProvider, KopaiClient, and observabilityCatalog into one import to improve readability and reduce redundancy (referencing the symbols createRendererFromCatalog, UITree, KopaiSDKProvider, KopaiClient, and observabilityCatalog).packages/ui/src/pages/observability.tsx (1)
9-16: Consolidate the@kopai/ui-coreimports.Five separate import statements target the same module. A single combined statement improves readability and matches typical module-import style.
♻️ Proposed consolidation
-import { KopaiSDKProvider, useKopaiSDK } from "@kopai/ui-core"; import { useQuery } from "@tanstack/react-query"; import { KopaiClient } from "@kopai/sdk"; -import { useKopaiData } from "@kopai/ui-core"; -import { useLiveLogs } from "@kopai/ui-core"; import type { denormalizedSignals, dataFilterSchemas } from "@kopai/core"; -import type { DataSource } from "@kopai/ui-core"; -import { observabilityCatalog } from "@kopai/ui-core"; +import { + KopaiSDKProvider, + useKopaiSDK, + useKopaiData, + useLiveLogs, + observabilityCatalog, + type DataSource, +} from "@kopai/ui-core";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ui/src/pages/observability.tsx` around lines 9 - 16, Multiple imports from "@kopai/ui-core" should be consolidated into a single import statement: combine KopaiSDKProvider, useKopaiSDK, useKopaiData, useLiveLogs, DataSource, and observabilityCatalog into one import from "@kopai/ui-core" (replace the separate import lines that reference useKopaiSDK, useKopaiData, useLiveLogs, DataSource, and observabilityCatalog with a single grouped import while keeping the existing KopaiSDKProvider import merged).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/ui-core-dedup.md:
- Around line 1-6: The changeset incorrectly marks "@kopai/ui-core" as a patch
even though it adds a new public export; update the changeset header so
"@kopai/ui-core" is bumped to minor (change the value from patch to minor) and
keep the descriptive note as-is; reference the package name "@kopai/ui-core" and
ensure the YAML header reflects the minor bump for the added
CatalogueComponentProps export.
In `@packages/ui/src/components/observability/DynamicDashboard/index.tsx`:
- Around line 1-3: Consolidate the three separate imports from "@kopai/ui-core"
into a single import statement: combine createRendererFromCatalog, UITree,
KopaiSDKProvider, KopaiClient, and observabilityCatalog into one import to
improve readability and reduce redundancy (referencing the symbols
createRendererFromCatalog, UITree, KopaiSDKProvider, KopaiClient, and
observabilityCatalog).
In `@packages/ui/src/components/observability/renderers/OtelMetricTimeSeries.tsx`:
- Around line 1-2: The imports in OtelMetricTimeSeries.tsx were updated to
`@kopai/ui-core` (observabilityCatalog and RendererComponentProps); run the
monorepo build and type-check to ensure import resolution and build order are
correct: build packages/ui-core then packages/ui and run type-check in
packages/ui, fix any broken exports or tsconfig paths if errors surface, and
ensure the component OtelMetricTimeSeries (and related observability renderers)
compiles against the new package surface.
In `@packages/ui/src/components/observability/renderers/OtelTraceDetail.tsx`:
- Around line 3-8: Consolidate the three separate imports from `@kopai/ui-core`
into a single import statement: replace the separate imports of
observabilityCatalog, RendererComponentProps, and useKopaiSDK with one grouped
import from "@kopai/ui-core" (while leaving local imports TraceDetail,
TraceSearch, and TraceSummary unchanged) so the file imports
observabilityCatalog, RendererComponentProps, and useKopaiSDK together to tidy
the module imports.
In `@packages/ui/src/pages/observability.tsx`:
- Around line 9-16: Multiple imports from "@kopai/ui-core" should be
consolidated into a single import statement: combine KopaiSDKProvider,
useKopaiSDK, useKopaiData, useLiveLogs, DataSource, and observabilityCatalog
into one import from "@kopai/ui-core" (replace the separate import lines that
reference useKopaiSDK, useKopaiData, useLiveLogs, DataSource, and
observabilityCatalog with a single grouped import while keeping the existing
KopaiSDKProvider import merged).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 85a270ad-3310-434d-9c81-ba37ed09d849
⛔ Files ignored due to path filters (2)
packages/ui/src/lib/__snapshots__/generate-prompt-instructions.test.ts.snapis excluded by!**/*.snappnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (38)
.changeset/ui-core-dedup.mdpackages/ui-core/src/index.tspackages/ui/package.jsonpackages/ui/src/components/dashboard/Badge/index.tsxpackages/ui/src/components/dashboard/Card/index.tsxpackages/ui/src/components/dashboard/Divider/index.tsxpackages/ui/src/components/dashboard/Empty/index.tsxpackages/ui/src/components/dashboard/Grid/index.tsxpackages/ui/src/components/dashboard/Heading/index.tsxpackages/ui/src/components/dashboard/Stack/index.tsxpackages/ui/src/components/dashboard/Text/index.tsxpackages/ui/src/components/observability/DynamicDashboard/DynamicDashboard.test.tsxpackages/ui/src/components/observability/DynamicDashboard/index.tsxpackages/ui/src/components/observability/TraceComparison/index.tsxpackages/ui/src/components/observability/renderers/OtelLogTimeline.tsxpackages/ui/src/components/observability/renderers/OtelMetricDiscovery.tsxpackages/ui/src/components/observability/renderers/OtelMetricHistogram.tsxpackages/ui/src/components/observability/renderers/OtelMetricStat.tsxpackages/ui/src/components/observability/renderers/OtelMetricTable.tsxpackages/ui/src/components/observability/renderers/OtelMetricTimeSeries.tsxpackages/ui/src/components/observability/renderers/OtelTraceDetail.tsxpackages/ui/src/hooks/use-kopai-data.test.tspackages/ui/src/hooks/use-kopai-data.tspackages/ui/src/hooks/use-live-logs.test.tspackages/ui/src/hooks/use-live-logs.tspackages/ui/src/index.tspackages/ui/src/lib/component-catalog.test.tspackages/ui/src/lib/component-catalog.tspackages/ui/src/lib/generate-prompt-instructions.test.tspackages/ui/src/lib/generate-prompt-instructions.tspackages/ui/src/lib/log-buffer.test.tspackages/ui/src/lib/log-buffer.tspackages/ui/src/lib/observability-catalog.tspackages/ui/src/lib/renderer.test.tsxpackages/ui/src/lib/renderer.tsxpackages/ui/src/pages/observability.test.tsxpackages/ui/src/pages/observability.tsxpackages/ui/src/providers/kopai-provider.tsx
💤 Files with no reviewable changes (14)
- packages/ui/src/lib/generate-prompt-instructions.test.ts
- packages/ui/src/lib/observability-catalog.ts
- packages/ui/src/lib/log-buffer.test.ts
- packages/ui/src/hooks/use-live-logs.test.ts
- packages/ui/src/hooks/use-kopai-data.test.ts
- packages/ui/src/lib/log-buffer.ts
- packages/ui/src/lib/renderer.tsx
- packages/ui/src/providers/kopai-provider.tsx
- packages/ui/src/lib/generate-prompt-instructions.ts
- packages/ui/src/lib/renderer.test.tsx
- packages/ui/src/hooks/use-kopai-data.ts
- packages/ui/src/hooks/use-live-logs.ts
- packages/ui/src/lib/component-catalog.test.ts
- packages/ui/src/lib/component-catalog.ts
Summary by CodeRabbit
@kopai/uinow re-exports DOM-free runtime utilities, catalogs, and hooks from@kopai/ui-core.