fix error line

This commit is contained in:
2026-08-17 17:33:56 +05:30
parent 69b38abced
commit 7fa21a4513
105 changed files with 1296 additions and 323 deletions

View File

@@ -4,13 +4,13 @@ import {
ChevronDown, ChevronLeft, LayoutTemplate, MoreHorizontal, Pencil, Plus, Sparkles, Trash2,
} from 'lucide-react';
import {
Badge, Button, ConfirmModal, DropdownMenu, DropdownMenuContent, DropdownMenuItem,
Alert, Badge, Button, ConfirmModal, DropdownMenu, DropdownMenuContent, DropdownMenuItem,
DropdownMenuTrigger, EmptyState, SearchInput, Select, SelectContent, SelectItem,
SelectTrigger, SelectValue, Surface, Switch, Tabs, toast,
} from '@/components/ds';
import { cn } from '@/lib/utils';
import { usePreferences, useUpdatePreferences } from '@/lib/krowHooks';
import { PAGE_KEYS, allSkills, skillsWithFacet } from '@/lib/skills/registry';
import { PAGE_KEYS, readSkillRegistry, skillsWithFacet } from '@/lib/skills/registry';
import { removeCustomSkill, upsertCustomSkill } from '@/lib/skills/customSkills';
import { countSections } from '@/lib/skills/uiConfig';
import {
@@ -211,7 +211,14 @@ export default function WorkspaceSkills() {
*/
const removedSkills = preferences.removedSkills || [];
const customSkills = preferences.customSkills || [];
const skills = useMemo(() => allSkills(customSkills), [customSkills]);
/* The registry and everything that went wrong assembling it, from one read.
A definition that failed to parse, lost a capability, or was overridden by
another used to disappear without a word — the skill simply stopped
answering and this page still looked healthy. */
const { skills, diagnostics } = useMemo(
() => readSkillRegistry(customSkills),
[customSkills]
);
/**
* Whether a skill is actually offered.
@@ -237,7 +244,6 @@ export default function WorkspaceSkills() {
const present = useMemo(
() => skills.filter((s) => !removedSkills.includes(s.id)),
/* Keyed on the content: `preferences` rebuilds its arrays every read. */
// eslint-disable-next-line react-hooks/exhaustive-deps
[skills, removedSkills.join('|')]
);
@@ -247,7 +253,6 @@ export default function WorkspaceSkills() {
/** The removed ones, for the drawer that lets them be put back. */
const removed = useMemo(
() => skills.filter((s) => removedSkills.includes(s.id)),
// eslint-disable-next-line react-hooks/exhaustive-deps
[skills, removedSkills.join('|')]
);
@@ -387,6 +392,29 @@ export default function WorkspaceSkills() {
<p className="text-caption leading-relaxed text-ink-3">{current.blurb}</p>
{/* What the registry could not read, or read only in part.
A skill that half-loads used to be indistinguishable from a skill that
works: the capabilities that resolved answered, the ones that did not
were dropped without a word, and the definition still appeared here as
Active. Saying so is the whole fix — the parser's leniency is correct,
its silence was not. */}
{diagnostics.length > 0 && (
<Alert
tone={diagnostics.some((d) => d.level === 'error') ? 'destructive' : 'warning'}
title={`${diagnostics.length} skill ${diagnostics.length === 1 ? 'problem' : 'problems'} in this workspace`}
>
<ul className="space-y-1">
{diagnostics.map((d, i) => (
<li key={`${d.kind}:${d.skillId ?? d.path}:${i}`} className="text-caption leading-relaxed">
<span className="font-mono text-[11px]">{d.skillId || d.path}</span>
{' — '}
{d.message}
</li>
))}
</ul>
</Alert>
)}
<div className="flex flex-col gap-2 lg:flex-row lg:items-center">
<div className="w-full lg:w-72">
<SearchInput value={search} onChange={setSearch} placeholder={`Search ${current.label.toLowerCase()}`} size="sm" />