Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(ui): let embedding hosts hide CLI hints and the refactoring scope control, and fix the hotspot row hover (#3037)

Raghav Chamadiya0591b16ebc26
diff --git a/packages/ui/__tests__/overview/next-actions.test.tsx b/packages/ui/__tests__/overview/next-actions.test.tsx
index f074f5795..c58d6e45f 100644
--- a/packages/ui/__tests__/overview/next-actions.test.tsx
+++ b/packages/ui/__tests__/overview/next-actions.test.tsx
@@ -261,3 +261,48 @@ describe("the fix_first rule", () => {
});
});
+describe("host-configurable hints", () => {
+ const unavailable = (): ActionsResponse => ({
+ ...response([], [action()]),
+ unavailable: { coverage: "no report" },
+ });
+ const withCli = () =>
+ action({
+ commands: [
+ { purpose: "See the file", cli: "repowise get-risk src/a.py", mcp: "get_risk(src/a.py)" },
+ ],
+ } as Partial<NextAction>);
+
+ it("shows the repowise update hint by default", () => {
+ render(<NextActions data={unavailable()} hrefFor={() => null} />);
+ expect(screen.getByText("repowise update").tagName).toBe("CODE");
+ expect(screen.getByText(/to include them\./)).toBeInTheDocument();
+ });
+
+ it("hides the hint sentence when unavailableHint is null", () => {
+ render(<NextActions data={unavailable()} hrefFor={() => null} unavailableHint={null} />);
+ expect(screen.getByText(/Not checked: coverage\./)).toBeInTheDocument();
+ expect(screen.queryByText("repowise update")).toBeNull();
+ });
+
+ it("renders a custom hint in place of the default", () => {
+ render(
+ <NextActions data={unavailable()} hrefFor={() => null} unavailableHint="Ask your admin." />,
+ );
+ expect(screen.getByText(/Ask your admin\./)).toBeInTheDocument();
+ expect(screen.queryByText("repowise update")).toBeNull();
+ });
+
+ it("shows CLI command lines by default and hides them with showCliCommands=false", async () => {
+ const data = response([], [withCli()]);
+ const { unmount } = render(<NextActions data={data} hrefFor={() => null} />);
+ fireEvent.click(screen.getByRole("listitem", { name: /Open Raise test coverage/ }));
+ expect(await screen.findByText("repowise get-risk src/a.py")).toBeInTheDocument();
+ unmount();
+ render(<NextActions data={data} hrefFor={() => null} showCliCommands={false} />);
+ fireEvent.click(screen.getByRole("listitem", { name: /Open Raise test coverage/ }));
+ const dialog = await screen.findByRole("dialog");
+ expect(within(dialog).queryByText("repowise get-risk src/a.py")).toBeNull();
+ expect(within(dialog).getByText(/get_risk\(src\/a\.py\)/)).toBeInTheDocument();
+ });
+});
diff --git a/packages/ui/__tests__/refactoring/refactoring-board-scope.test.tsx b/packages/ui/__tests__/refactoring/refactoring-board-scope.test.tsx
index 5e00d718a..260fca5c4 100644
--- a/packages/ui/__tests__/refactoring/refactoring-board-scope.test.tsx
+++ b/packages/ui/__tests__/refactoring/refactoring-board-scope.test.tsx
@@ -105,3 +105,12 @@ describe("RefactoringBoard scope", () => {
).toBeTruthy();
});
});
+
+describe("RefactoringBoard without a host scope", () => {
+ it("shows no Scope control and no hidden-counts note", () => {
+ board({ scope: undefined, appliedScope: undefined, hidden: undefined, total: 1 });
+ expect(screen.queryByRole("radio", { name: "Worth doing" })).toBeNull();
+ expect(screen.queryByRole("radio", { name: "Full inventory" })).toBeNull();
+ expect(screen.queryByText(/more in the full inventory/)).toBeNull();
+ });
+});
diff --git a/packages/ui/src/health/untested-hotspot-warning.tsx b/packages/ui/src/health/untested-hotspot-warning.tsx
index 1f3848787..82fbee3c5 100644
--- a/packages/ui/src/health/untested-hotspot-warning.tsx
+++ b/packages/ui/src/health/untested-hotspot-warning.tsx
@@ -78,7 +78,7 @@ export function UntestedHotspotWarning({
<button
type="button"
onClick={() => onSelect(e.file_path)}
- className="group flex w-full items-baseline gap-x-4 py-2.5 text-left hover:bg-[var(--color-bg-elevated)]"
+ className="group/row flex w-full items-baseline gap-x-4 py-2.5 text-left hover:bg-[var(--color-bg-elevated)]"
>
{body}
<ArrowUpRight className="h-3 w-3 shrink-0 self-center text-[var(--color-text-tertiary)] group-hover/row:text-[var(--color-accent-primary)]" />
diff --git a/packages/ui/src/overview/action-drawer.tsx b/packages/ui/src/overview/action-drawer.tsx
index 5daa3ce20..69ba7c5cf 100644
--- a/packages/ui/src/overview/action-drawer.tsx
+++ b/packages/ui/src/overview/action-drawer.tsx
@@ -53,6 +53,8 @@ export interface ActionDrawerProps {
onAnswer?: ((state: ActionStateValue, message: string) => void) | undefined;
/** The agent prompt for an action, as core renders it. Omit to hide the prompt. */
loadPrompt?: ((action: NextAction, flavor: AiPromptFlavor) => Promise<string>) | undefined;
+ /** Show each command's CLI line. Set false for a host with no CLI; agent calls stay. */
+ showCliCommands?: boolean | undefined;
LinkComponent?: ElementType | undefined;
renderTitle: (title: string) => ReactNode;
}
@@ -81,6 +83,7 @@ export function ActionDrawer({
fileHref,
onAnswer,
loadPrompt,
+ showCliCommands = true,
LinkComponent,
renderTitle,
}: ActionDrawerProps) {
@@ -215,7 +218,7 @@ export function ActionDrawer({
{action.commands.map((c) => (
<li key={c.purpose} className="space-y-1">
<p className="text-sm text-[var(--color-text-secondary)]">{c.purpose}</p>
- {c.cli ? (
+ {showCliCommands && c.cli ? (
<pre className="overflow-x-auto rounded bg-[var(--color-bg-inset)] px-3 py-1.5 font-mono text-xs text-[var(--color-text-primary)]">
{c.cli}
</pre>
diff --git a/packages/ui/src/overview/next-actions.tsx b/packages/ui/src/overview/next-actions.tsx
index be408900e..216d0868f 100644
--- a/packages/ui/src/overview/next-actions.tsx
+++ b/packages/ui/src/overview/next-actions.tsx
@@ -38,6 +38,13 @@ export interface NextActionsProps {
onSetState?: (action: NextAction, state: ActionStateValue | null) => Promise<void>;
/** An action's agent prompt as core renders it. Omit to hide the prompt. */
loadPrompt?: ActionDrawerProps["loadPrompt"];
+ /**
+ * Replaces the sentence after the "Not checked" list. Omit for the default
+ * `repowise update` hint; pass `null` to show only the list.
+ */
+ unavailableHint?: ReactNode | null;
+ /** Show each command's CLI line in the drawer. Set false for a host with no CLI. */
+ showCliCommands?: boolean;
LinkComponent?: ElementType | undefined;
}
@@ -108,6 +115,8 @@ export function NextActions({
fileHref,
onSetState,
loadPrompt,
+ unavailableHint,
+ showCliCommands,
LinkComponent,
}: NextActionsProps) {
// Open on the week unless it holds no work and the quarter does: a lone
@@ -237,9 +246,16 @@ export function NextActions({
)}
{unavailable.length > 0 && (
<span>
- {`Not checked: ${unavailable.join(", ").replace(/_/g, " ")}. Run `}
- <code className="font-mono text-[0.85em]">repowise update</code>
- {" to include them."}
+ {`Not checked: ${unavailable.join(", ").replace(/_/g, " ")}.`}
+ {unavailableHint === undefined ? (
+ <>
+ {" Run "}
+ <code className="font-mono text-[0.85em]">repowise update</code>
+ {" to include them."}
+ </>
+ ) : unavailableHint === null ? null : (
+ <> {unavailableHint}</>
+ )}
</span>
)}
</div>
@@ -255,6 +271,7 @@ export function NextActions({
: undefined
}
loadPrompt={loadPrompt}
+ showCliCommands={showCliCommands}
LinkComponent={LinkComponent}
renderTitle={renderActionTitle}
/>
diff --git a/packages/ui/src/refactoring/refactoring-board.tsx b/packages/ui/src/refactoring/refactoring-board.tsx
index 0f20abec8..6f9c6e79e 100644
--- a/packages/ui/src/refactoring/refactoring-board.tsx
+++ b/packages/ui/src/refactoring/refactoring-board.tsx
@@ -80,11 +80,15 @@ export interface RefactoringBoardServerState {
confidence: Confidence | null;
mechanicalOnly: boolean;
/** The scope asked for: what Fix first would take, or the full inventory. */
- scope: RefactoringScope;
- /** The scope the server applied, which `total` counts. */
- appliedScope: RefactoringScope;
+ scope?: RefactoringScope | undefined;
+ /**
+ * The scope the server applied, which `total` counts. Omit when the host has
+ * no scoped listing: the Scope control is not shown and the list is the full
+ * inventory.
+ */
+ appliedScope?: RefactoringScope | undefined;
/** Under `fix_first`, what the filtered set leaves out, by reason. */
- hidden: RefactoringHiddenCounts | null;
+ hidden?: RefactoringHiddenCounts | null | undefined;
total: number;
offset: number;
nextOffset: number | null;
@@ -199,6 +203,7 @@ export function RefactoringBoard({
opens the same inspector with the full explanation.
</p>
</div>
+ {serverState.appliedScope ? (
<Segmented<RefactoringScope>
label="Scope"
value={serverState.appliedScope}
@@ -216,6 +221,7 @@ export function RefactoringBoard({
{ value: "all", label: "Full inventory", hint: "Every open opportunity" },
]}
/>
+ ) : null}
</div>
<div className="flex flex-wrap items-center gap-3">