🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🔧 chore(alint): UI review rules distilled from acceptance rejections (#20162)
Arvin Xu9c63818ae1fe
diff --git a/alint.audit.toml b/alint.audit.tomlnew file mode 100644index 00000000000..d70aaf70357--- /dev/null+++ b/alint.audit.toml@@ -0,0 +1,43 @@+# alint: model-backed rules that eslint cannot express.+# Repo-wide rules live in packages/alint/rules (fixtures in packages/alint/fixtures).+# Package-level rules live next to their package, in packages/<pkg>/alint/rules+# (fixtures in packages/<pkg>/alint/fixtures), registered under their own plugin+# prefix and scoped only to that package. Set up a provider with `bun run alint:setup`, then+# `bun run check --alint` or `bun run alint --dirty`. See packages/alint/README.md.+#+# Scope rules with group `files`; never with `includeFiles` inside a rule+# (it only filters reports, doubles the jobs, and disables the cache).+#+# Severity: `error` is reserved for rules measured at zero false positives on+# real PRs; an error turns the ALint check red. Everything else stays `warn`.+# Fixture groups stay `warn` so a rule PR does not fail on its own bad fixtures.++[[config.group]]+ignores = [+ "**/node_modules/**",+ "**/dist/**",+ "**/.next/**",+ "**/*.d.ts",+ "packages/sdk/src/generated/**",+ "packages/heterogeneous-agents/src/codex/protocol/generated.ts",+]++[config.group.ignore]+gitignore = true++# Whole-repo UI audit: review rules whose findings are worth reading in bulk+# but too many or too uncertain to report on every PR. ui-in-app-links cannot+# see the router from one file; a test against the route table is its real home.+# Run with `bun run alint:audit`; not used by CI or `bun run check --alint`.+[[config.group]]+files = [ "src/**/*.tsx", "packages/*/src/**/*.tsx" ]+ignores = [ "**/*.test.tsx", "**/__tests__/**", "src/app/**", "**/DevPanel/**", "**/*.stories.tsx" ]++[config.group.plugins]+lobehub = "./packages/alint/rules"++[config.group.rules]+"lobehub/ui-no-decorative-chrome" = "warn"+"lobehub/ui-restrained-color" = "warn"+"lobehub/ui-user-facing-copy" = "warn"+"lobehub/ui-in-app-links" = "warn"diff --git a/alint.config.toml b/alint.config.tomlindex 8c31d9ab8fa..7a4fcbe7a8f 100644--- a/alint.config.toml+++ b/alint.config.toml@@ -155,6 +155,37 @@ hetero = "./packages/heterogeneous-agents/alint/rules"[config.group.rules]"hetero/host-capability-placement" = "warn"+# UI review rules: the product owner's recurring acceptance rejections,+# distilled from 620 review comments over 30 days. Warn-only: they are taste+# with a rationale, meant to be read in review, not to block a merge. The+# broad ones (chrome, color, copy, links) are too noisy per PR and live in+# alint.audit.toml for periodic whole-repo audits instead.+[[config.group]]+files = [ "src/**/*.tsx", "packages/*/src/**/*.tsx" ]+ignores = [ "**/*.test.tsx", "**/__tests__/**", "src/app/**", "**/DevPanel/**", "**/*.stories.tsx" ]++[config.group.plugins]+lobehub = "./packages/alint/rules"++[config.group.rules]+"lobehub/ui-button-hierarchy" = "warn"+"lobehub/ui-view-switch-tabs" = "warn"+"lobehub/ui-edit-in-modal" = "warn"+"lobehub/ui-lightweight-errors" = "warn"++# Page width: only page bodies, where a missing width container is visible.+# A per-file model cannot see the layout, so layouts that already cap the+# width (community, workspace settings) are left out.+[[config.group]]+files = [ "src/routes/**/*.tsx", "src/features/Settings/*/index.tsx", "src/features/**/*Page.tsx" ]+ignores = [ "**/*.test.tsx", "**/_layout/**", "src/routes/(main)/community/**", "**/workspace/settings/**", "**/features/**/components/**" ]++[config.group.plugins]+lobehub = "./packages/alint/rules"++[config.group.rules]+"lobehub/ui-content-width" = "warn"+# Calibration fixtures: one group per rule so a fixture only meets its own rule.[[config.group]]files = [ "packages/alint/fixtures/pmap-over-promise-all/**" ]@@ -211,3 +242,66 @@ files = [ "packages/heterogeneous-agents/alint/fixtures/host-capability-placemenhetero = "./packages/heterogeneous-agents/alint/rules"[config.group.rules]"hetero/host-capability-placement" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-button-hierarchy/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-button-hierarchy" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-restrained-color/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-restrained-color" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-no-decorative-chrome/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-no-decorative-chrome" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-view-switch-tabs/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-view-switch-tabs" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-edit-in-modal/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-edit-in-modal" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-lightweight-errors/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-lightweight-errors" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-user-facing-copy/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-user-facing-copy" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-in-app-links/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-in-app-links" = "warn"++[[config.group]]+files = [ "packages/alint/fixtures/ui-content-width/**" ]+[config.group.plugins]+lobehub = "./packages/alint/rules"+[config.group.rules]+"lobehub/ui-content-width" = "warn"diff --git a/package.json b/package.jsonindex 0d1da93f8a6..1789cf2fa17 100644--- a/package.json+++ b/package.json@@ -43,6 +43,7 @@],"scripts": {"alint": "alint",+ "alint:audit": "alint --config alint.audit.toml --format json --rule-concurrency 48 src packages","alint:setup": "bun packages/alint/setup.ts","build": "bun run build:spa && bun run build:spa:auth && bun run build:spa:workbench && bun run build:spa:share && bun run build:spa:copy && bun run build:next","build:analyze": "cross-env NODE_OPTIONS=--max-old-space-size=81920 next experimental-analyze",diff --git a/packages/alint/README.md b/packages/alint/README.mdindex 7bac22040f7..85317943942 100644--- a/packages/alint/README.md+++ b/packages/alint/README.md@@ -80,6 +80,24 @@ The `alint ·` steps at the end of the "ALint & Test Desktop App" job in `.githuAbout 14 input tokens per source line per rule. Two cold runs over the same files differed by one finding; a finding can appear or vanish between runs, which is why fixtures exist and why only rules measured at zero false positives are promoted to `error`.+## UI review rules++The `ui-*` rules encode the product owner's recurring acceptance rejections. They were distilled from 620 review comments on 92 acceptances over 30 days (2026-08-30 to 2026-09-29); each rule quotes the comments it comes from, so the standard stays the owner's words rather than a paraphrase. About half of those comments are requirement or taste calls no rule can hold; the rules cover the part that recurs and can be read off one file.++| Rule | Where | Sample precision | Whole repo | What it holds |+| ------------------------- | ---------------- | ---------------- | ---------- | ------------------------------------------------------------------------------------- |+| `ui-button-hierarchy` | PR check | narrowed | 62 | only two primaries in one group, a primary on every list row, a small empty-state CTA |+| `ui-lightweight-errors` | PR check | \~70% | 73 | one readable error line, raw details folded |+| `ui-content-width` | PR check (pages) | \~100% | 7 | page bodies sit in `SettingContainer` or a max-width column |+| `ui-edit-in-modal` | PR check | ~57% | 36 | edit / rename / add opens a modal, not an inline input or a popover input |+| `ui-view-switch-tabs` | PR check | \~50% | 20 | whole views switch with `Tabs`, the active tab in the URL |+| `ui-no-decorative-chrome` | audit | \~56% | 1441 | no wrapper borders, fills, restating titles, bold labels, extra dividers |+| `ui-restrained-color` | audit | \~53% | 830 | color for state only; gray metadata and types; tokens, not literals |+| `ui-user-facing-copy` | audit | \~53% | 768 | no raw enums, hard-coded strings or jargon on screen |+| `ui-in-app-links` | audit | \~60% | 30 | links match the router's shapes and carry no marker params |++`ui-button-hierarchy` was narrowed after review to three patterns a single file can decide; which action deserves the primary, and whether a secondary should be `fill`, is left to review. Sample precision is measured on the same 20-finding samples the carve-outs were written from, so it is optimistic. Rules with many findings or weak precision run only in the audit (`bun run alint:audit`, `alint.audit.toml`): reported on every PR they would drown the sharper rules, as `test-the-exit-not-the-entry` once did. `ui-in-app-links` cannot see the route table from one file; a test that matches literal in-app paths against the router is its real home. `text-transform: uppercase` is a deterministic check: stylelint (`declaration-property-value-disallowed-list`) and ESLint (inline `textTransform`) report it as an error.+## Whole-repo calibration, 2026-09-29Every rule was run cold over all of canary (apps/server, packages, src: 14.7k model calls, 40M input tokens, about 10 minutes at `--rule-concurrency 32`), and each finding was read or sampled. Findings are legacy code; CI and `check --alint` only report changed lines, so they surface when someone edits that line.@@ -100,6 +118,6 @@ Known remaining false positives: `no-transactions-in-models` still reports a sub1. Create `rules/<name>/rule.alint.toml` with `name`, `builtInAgent = "basic-structured"`, and an `instruction`. Write the rule as the reviewer would: what to report, which line to anchor on, what the message and suggestion must contain, and an explicit "do not report" list. The carve-outs are where the false positives live.2. Add a `[[config.group]]` for its scope in `alint.config.toml`, and a fixture group `packages/alint/fixtures/<name>/**`.-3. Add fixtures under `fixtures/<name>/`: at least one `bad-*` file with a standalone `// alint-expect` comment on the line above the one the finding must anchor to, and one `good-*` file per carve-out. Keep them short and realistic.+3. Add fixtures under `fixtures/<name>/`: at least one `bad-*` file with a standalone `// alint-expect` comment (`{/* alint-expect */}` inside JSX) on the line above the one the finding must anchor to, and one `good-*` file per carve-out. Keep them short and realistic.4. Run `bun run alint plugin install`, then `cd packages/alint && bunx vitest run fixtures.test.ts` with a provider set up. The suite skips itself when there is no setup. Delete `.alintcache` after every rule edit while calibrating: the local cache is keyed by file content, so an edited rule otherwise replays the previous rule's findings.5. Before enabling the rule on a scope, run it over a few dozen real files and read every finding.diff --git a/packages/alint/fixtures.test.ts b/packages/alint/fixtures.test.tsindex 5722b70fa0e..e259cb9148f 100644--- a/packages/alint/fixtures.test.ts+++ b/packages/alint/fixtures.test.ts@@ -8,7 +8,7 @@ import { runFixtureLint } from './runFixtures';/*** Calibration: every `bad-*` fixture must produce a finding for its rule on- * the line below each standalone `// alint-expect` comment (±1 line), every+ * the line below each standalone `// alint-expect` (or its JSX-comment form inside JSX) comment (±1 line), every* `good-*` fixture must produce none. Runs only when a provider is set up (`bun run alint:setup`);* without `.alint/config.toml` the suite is skipped, not failed.*/@@ -52,10 +52,13 @@ const fixtures = (const fixtureFiles = fixtures.map(({ file }) => file);const ruleOf = (file: string) => fixtures.find((fixture) => fixture.file === file)!.rule;+/** `{/* … *\/}` is the only comment JSX children accept. */+const EXPECT_MARKERS = new Set(['// alint-expect', '{/* alint-expect */}']);+const expectedLines = async (file: string) =>(await readFile(path.join(rootDir, file), 'utf8')).split('\n')- .flatMap((line, index) => (line.trim() === '// alint-expect' ? [index + 2] : []));+ .flatMap((line, index) => (EXPECT_MARKERS.has(line.trim()) ? [index + 2] : []));describe.skipIf(!hasSetup)('alint rule fixtures', async () => {const diagnostics = hasSetup ? await runFixtureLint(rootDir, fixtureFiles) : [];diff --git a/packages/alint/fixtures/ui-button-hierarchy/bad-two-primaries.tsx b/packages/alint/fixtures/ui-button-hierarchy/bad-two-primaries.tsxnew file mode 100644index 00000000000..bfc1b102eb8--- /dev/null+++ b/packages/alint/fixtures/ui-button-hierarchy/bad-two-primaries.tsx@@ -0,0 +1,32 @@+// Fixture: a connection card whose secondary actions are all primary.+import { Flexbox } from '@lobehub/ui';+import { Button, Text } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++interface ChannelCardProps {+ name: string;+ onCheckUpdate: () => void;+ onReconnect: () => void;+}++const ChannelCard = memo<ChannelCardProps>(({ name, onCheckUpdate, onReconnect }) => {+ const { t } = useTranslation('setting');++ return (+ <Flexbox horizontal align={'center'} justify={'space-between'}>+ <Text>{name}</Text>+ <Flexbox horizontal gap={8}>+ <Button size={'small'} type={'primary'} onClick={onCheckUpdate}>+ {t('device.checkUpdate')}+ </Button>+ {/* alint-expect */}+ <Button type={'primary'} onClick={onReconnect}>+ {t('device.reconnect')}+ </Button>+ </Flexbox>+ </Flexbox>+ );+});++export default ChannelCard;diff --git a/packages/alint/fixtures/ui-button-hierarchy/good-modal-footer.tsx b/packages/alint/fixtures/ui-button-hierarchy/good-modal-footer.tsxnew file mode 100644index 00000000000..6e8a624f090--- /dev/null+++ b/packages/alint/fixtures/ui-button-hierarchy/good-modal-footer.tsx@@ -0,0 +1,32 @@+// Fixture: one primary commit action, a filled secondary, a text utility.+import { Flexbox } from '@lobehub/ui';+import { Button } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++interface CreateFooterProps {+ loading: boolean;+ onCancel: () => void;+ onCreate: () => void;+ onPreview: () => void;+}++const CreateFooter = memo<CreateFooterProps>(({ loading, onCancel, onCreate, onPreview }) => {+ const { t } = useTranslation('common');++ return (+ <Flexbox horizontal gap={8} justify={'flex-end'}>+ <Button type={'text'} onClick={onPreview}>+ {t('preview')}+ </Button>+ <Button type={'fill'} onClick={onCancel}>+ {t('cancel')}+ </Button>+ <Button loading={loading} type={'primary'} onClick={onCreate}>+ {t('create')}+ </Button>+ </Flexbox>+ );+});++export default CreateFooter;diff --git a/packages/alint/fixtures/ui-button-hierarchy/good-single-primary-card.tsx b/packages/alint/fixtures/ui-button-hierarchy/good-single-primary-card.tsxnew file mode 100644index 00000000000..2a39b37535b--- /dev/null+++ b/packages/alint/fixtures/ui-button-hierarchy/good-single-primary-card.tsx@@ -0,0 +1,31 @@+// Fixture: a card with one primary action and a fill secondary — taste, not this rule.+import { Flexbox } from '@lobehub/ui';+import { Button, Text } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++interface ConnectCardProps {+ name: string;+ onConnect: () => void;+ onLearnMore: () => void;+}++const ConnectCard = memo<ConnectCardProps>(({ name, onConnect, onLearnMore }) => {+ const { t } = useTranslation('setting');++ return (+ <Flexbox gap={12}>+ <Text>{name}</Text>+ <Flexbox horizontal gap={8}>+ <Button type={'fill'} onClick={onLearnMore}>+ {t('integration.learnMore')}+ </Button>+ <Button type={'primary'} onClick={onConnect}>+ {t('integration.connect')}+ </Button>+ </Flexbox>+ </Flexbox>+ );+});++export default ConnectCard;diff --git a/packages/alint/fixtures/ui-content-width/bad-full-width-settings.tsx b/packages/alint/fixtures/ui-content-width/bad-full-width-settings.tsxnew file mode 100644index 00000000000..83ab08c0578--- /dev/null+++ b/packages/alint/fixtures/ui-content-width/bad-full-width-settings.tsx@@ -0,0 +1,30 @@+// Fixture: a settings page body stretched across the whole main area.+import { Flexbox } from '@lobehub/ui';+import { createStaticStyles } from 'antd-style';+import { memo } from 'react';++import IntegrationCard from './IntegrationCard';+import { useIntegrations } from './useIntegrations';++const styles = createStaticStyles(({ css }) => ({+ body: css`+ width: 100%;+ padding-block: 24px;+ padding-inline: 32px;+ `,+}));++const IntegrationsPage = memo(() => {+ const integrations = useIntegrations();++ return (+ // alint-expect+ <Flexbox className={styles.body} gap={12}>+ {integrations.map((item) => (+ <IntegrationCard integration={item} key={item.id} />+ ))}+ </Flexbox>+ );+});++export default IntegrationsPage;diff --git a/packages/alint/fixtures/ui-content-width/good-centered-column.tsx b/packages/alint/fixtures/ui-content-width/good-centered-column.tsxnew file mode 100644index 00000000000..95217614a60--- /dev/null+++ b/packages/alint/fixtures/ui-content-width/good-centered-column.tsx@@ -0,0 +1,17 @@+// Fixture: page body centered in a max-width column; the canvas owns its width.+import { Flexbox } from '@lobehub/ui';+import { memo } from 'react';++import ExplorationCanvas from './ExplorationCanvas';+import GoalSummary from './GoalSummary';++const GoalPage = memo<{ goalId: string }>(({ goalId }) => (+ <Flexbox gap={24}>+ <Flexbox gap={12} style={{ marginInline: 'auto', maxWidth: 720, width: '100%' }}>+ <GoalSummary goalId={goalId} />+ </Flexbox>+ <ExplorationCanvas goalId={goalId} />+ </Flexbox>+));++export default GoalPage;diff --git a/packages/alint/fixtures/ui-edit-in-modal/bad-inline-rename.tsx b/packages/alint/fixtures/ui-edit-in-modal/bad-inline-rename.tsxnew file mode 100644index 00000000000..2e0848ee56d--- /dev/null+++ b/packages/alint/fixtures/ui-edit-in-modal/bad-inline-rename.tsx@@ -0,0 +1,39 @@+// Fixture: "Rename" from a menu swaps the project title for an inline input.+import { Flexbox } from '@lobehub/ui';+import { DropdownMenu, Input, Text } from '@lobehub/ui/base-ui';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++interface ProjectHeaderProps {+ onRename: (title: string) => void;+ title: string;+}++const ProjectHeader = memo<ProjectHeaderProps>(({ onRename, title }) => {+ const { t } = useTranslation('project');+ const [renaming, setRenaming] = useState(false);++ return (+ <Flexbox horizontal align={'center'} gap={8}>+ {renaming ? (+ // alint-expect+ <Input+ autoFocus+ defaultValue={title}+ onBlur={() => setRenaming(false)}+ onPressEnter={(event) => {+ onRename(event.currentTarget.value);+ setRenaming(false);+ }}+ />+ ) : (+ <Text>{title}</Text>+ )}+ <DropdownMenu+ items={[{ key: 'rename', label: t('rename'), onClick: () => setRenaming(true) }]}+ />+ </Flexbox>+ );+});++export default ProjectHeader;diff --git a/packages/alint/fixtures/ui-edit-in-modal/bad-popover-rename.tsx b/packages/alint/fixtures/ui-edit-in-modal/bad-popover-rename.tsxnew file mode 100644index 00000000000..8fb4ea4dcbe--- /dev/null+++ b/packages/alint/fixtures/ui-edit-in-modal/bad-popover-rename.tsx@@ -0,0 +1,42 @@+// Fixture: renaming a topic through a popover input anchored to the row.+import { Flexbox } from '@lobehub/ui';+import { DropdownMenu, Input, Popover, Text } from '@lobehub/ui/base-ui';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++interface TopicRowProps {+ onRename: (title: string) => void;+ title: string;+}++const TopicRow = memo<TopicRowProps>(({ onRename, title }) => {+ const { t } = useTranslation('topic');+ const [renaming, setRenaming] = useState(false);++ return (+ <Popover+ open={renaming}+ content={+ // alint-expect+ <Input+ autoFocus+ defaultValue={title}+ onPressEnter={(event) => {+ onRename(event.currentTarget.value);+ setRenaming(false);+ }}+ />+ }+ onOpenChange={setRenaming}+ >+ <Flexbox horizontal align={'center'} gap={8}>+ <Text>{title}</Text>+ <DropdownMenu+ items={[{ key: 'rename', label: t('rename'), onClick: () => setRenaming(true) }]}+ />+ </Flexbox>+ </Popover>+ );+});++export default TopicRow;diff --git a/packages/alint/fixtures/ui-edit-in-modal/good-rename-modal.tsx b/packages/alint/fixtures/ui-edit-in-modal/good-rename-modal.tsxnew file mode 100644index 00000000000..cbdc407ae5f--- /dev/null+++ b/packages/alint/fixtures/ui-edit-in-modal/good-rename-modal.tsx@@ -0,0 +1,28 @@+// Fixture: "Rename" opens a modal form.+import { Flexbox } from '@lobehub/ui';+import { DropdownMenu, Text } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { openRenameProjectModal } from './RenameProjectModal';++const ProjectHeader = memo<{ projectId: string; title: string }>(({ projectId, title }) => {+ const { t } = useTranslation('project');++ return (+ <Flexbox horizontal align={'center'} gap={8}>+ <Text>{title}</Text>+ <DropdownMenu+ items={[+ {+ key: 'rename',+ label: t('rename'),+ onClick: () => openRenameProjectModal({ projectId, title }),+ },+ ]}+ />+ </Flexbox>+ );+});++export default ProjectHeader;diff --git a/packages/alint/fixtures/ui-in-app-links/bad-legacy-topic-link.tsx b/packages/alint/fixtures/ui-in-app-links/bad-legacy-topic-link.tsxnew file mode 100644index 00000000000..c1406f3e8d1--- /dev/null+++ b/packages/alint/fixtures/ui-in-app-links/bad-legacy-topic-link.tsx@@ -0,0 +1,13 @@+// Fixture: a report linking back to its conversation through the legacy path.+import { Icon } from '@lobehub/ui';+import { MessagesSquare } from 'lucide-react';+import { memo } from 'react';++const OriginLink = memo<{ topicId: string }>(({ topicId }) => (+ // alint-expect+ <a href={`/chat?topic=${topicId}`} rel="noreferrer" target="_blank">+ <Icon icon={MessagesSquare} />+ </a>+));++export default OriginLink;diff --git a/packages/alint/fixtures/ui-in-app-links/good-canonical-links.tsx b/packages/alint/fixtures/ui-in-app-links/good-canonical-links.tsxnew file mode 100644index 00000000000..025b775218f--- /dev/null+++ b/packages/alint/fixtures/ui-in-app-links/good-canonical-links.tsx@@ -0,0 +1,26 @@+// Fixture: canonical agent-topic and image-topic links, plus an external URL.+import { Flexbox } from '@lobehub/ui';+import { memo } from 'react';+import { useNavigate } from 'react-router-dom';++interface LinksProps {+ agentId: string;+ imageTopicId: string;+ topicId: string;+}++const Links = memo<LinksProps>(({ agentId, imageTopicId, topicId }) => {+ const navigate = useNavigate();++ return (+ <Flexbox horizontal gap={8}>+ <span onClick={() => navigate(`/agent/${agentId}/${topicId}`)}>open</span>+ <span onClick={() => navigate(`/image?topic=${imageTopicId}`)}>image</span>+ <a href={'https://github.com/lobehub/lobehub'} rel="noreferrer" target="_blank">+ repo+ </a>+ </Flexbox>+ );+});++export default Links;diff --git a/packages/alint/fixtures/ui-lightweight-errors/bad-raw-error-panel.tsx b/packages/alint/fixtures/ui-lightweight-errors/bad-raw-error-panel.tsxnew file mode 100644index 00000000000..5d766a61eb6--- /dev/null+++ b/packages/alint/fixtures/ui-lightweight-errors/bad-raw-error-panel.tsx@@ -0,0 +1,29 @@+// Fixture: a card dumping the raw provider error into a red Alert.+import { Flexbox } from '@lobehub/ui';+import { Alert } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++interface RunResultProps {+ error?: { message: string; stack?: string };+ output?: string;+}++const RunResult = memo<RunResultProps>(({ error, output }) => {+ const { t } = useTranslation('chat');++ if (error)+ return (+ // alint-expect+ <Alert+ showIcon+ description={`${error.message}\n${error.stack ?? ''}`}+ message={t('run.failed')}+ type={'error'}+ />+ );++ return <Flexbox>{output}</Flexbox>;+});++export default RunResult;diff --git a/packages/alint/fixtures/ui-lightweight-errors/good-summary-with-details.tsx b/packages/alint/fixtures/ui-lightweight-errors/good-summary-with-details.tsxnew file mode 100644index 00000000000..b0b10845969--- /dev/null+++ b/packages/alint/fixtures/ui-lightweight-errors/good-summary-with-details.tsx@@ -0,0 +1,26 @@+// Fixture: one readable line with the raw details folded behind a toggle.+import { Flexbox, Icon } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { AlertCircle } from 'lucide-react';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++const RunError = memo<{ detail: string; summary: string }>(({ detail, summary }) => {+ const { t } = useTranslation('chat');+ const [open, setOpen] = useState(false);++ return (+ <Flexbox gap={4}>+ <Flexbox horizontal align={'center'} gap={6}>+ <Icon icon={AlertCircle} />+ <Text type={'secondary'}>{summary}</Text>+ <Text type={'secondary'} onClick={() => setOpen(!open)}>+ {open ? t('error.hideDetail') : t('error.showDetail')}+ </Text>+ </Flexbox>+ {open && <pre>{detail}</pre>}+ </Flexbox>+ );+});++export default RunError;diff --git a/packages/alint/fixtures/ui-no-decorative-chrome/bad-boxed-section.tsx b/packages/alint/fixtures/ui-no-decorative-chrome/bad-boxed-section.tsxnew file mode 100644index 00000000000..de1e1d7f7ff--- /dev/null+++ b/packages/alint/fixtures/ui-no-decorative-chrome/bad-boxed-section.tsx@@ -0,0 +1,33 @@+// Fixture: a bordered, filled box with a bold restating title around one list.+import { Flexbox } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo, type ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++const styles = createStaticStyles(({ css }) => ({+ // alint-expect+ box: css`+ padding: 16px;+ border: 2px solid ${cssVar.colorBorder};+ border-radius: 8px;+ background: ${cssVar.colorFillTertiary};+ `,+ title: css`+ padding-block-end: 8px;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};+ font-weight: 600;+ `,+}));++const IntegrationsSection = memo<{ children: ReactNode }>(({ children }) => {+ const { t } = useTranslation('setting');++ return (+ <div className={styles.box}>+ <div className={styles.title}>{t('integrations.title')}</div>+ <Flexbox gap={8}>{children}</Flexbox>+ </div>+ );+});++export default IntegrationsSection;diff --git a/packages/alint/fixtures/ui-no-decorative-chrome/good-spacing-only.tsx b/packages/alint/fixtures/ui-no-decorative-chrome/good-spacing-only.tsxnew file mode 100644index 00000000000..10306d83835--- /dev/null+++ b/packages/alint/fixtures/ui-no-decorative-chrome/good-spacing-only.tsx@@ -0,0 +1,23 @@+// Fixture: structure from spacing; the only boundary is on an input.+import { Flexbox } from '@lobehub/ui';+import { Input } from '@lobehub/ui/base-ui';+import { memo, type ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++const IntegrationsBody = memo<{ children: ReactNode; onSearch: (value: string) => void }>(+ ({ children, onSearch }) => {+ const { t } = useTranslation('setting');++ return (+ <Flexbox gap={16}>+ <Input+ placeholder={t('integrations.search')}+ onChange={(event) => onSearch(event.target.value)}+ />+ <Flexbox gap={8}>{children}</Flexbox>+ </Flexbox>+ );+ },+);++export default IntegrationsBody;diff --git a/packages/alint/fixtures/ui-restrained-color/bad-colored-type-and-link.tsx b/packages/alint/fixtures/ui-restrained-color/bad-colored-type-and-link.tsxnew file mode 100644index 00000000000..989963eeb65--- /dev/null+++ b/packages/alint/fixtures/ui-restrained-color/bad-colored-type-and-link.tsx@@ -0,0 +1,38 @@+// Fixture: event types as colored tags, a blue in-app link and heavy metadata.+import { Flexbox } from '@lobehub/ui';+import { Tag } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { memo } from 'react';++const styles = createStaticStyles(({ css }) => ({+ openLink: css`+ cursor: pointer;+ color: ${cssVar.colorLink};+ `,+ time: css`+ font-size: 12px;+ color: ${cssVar.colorText};+ `,+}));++interface EventRowProps {+ at: string;+ kindLabel: string;+ onOpen: () => void;+ title: string;+}++const EventRow = memo<EventRowProps>(({ at, kindLabel, onOpen, title }) => {+ return (+ <Flexbox horizontal gap={8}>+ {/* alint-expect */}+ <Tag color={'blue'}>{kindLabel}</Tag>+ <span className={styles.openLink} onClick={onOpen}>+ {title}+ </span>+ <span className={styles.time}>{at}</span>+ </Flexbox>+ );+});++export default EventRow;diff --git a/packages/alint/fixtures/ui-restrained-color/good-status-and-gray-meta.tsx b/packages/alint/fixtures/ui-restrained-color/good-status-and-gray-meta.tsxnew file mode 100644index 00000000000..619c4e473da--- /dev/null+++ b/packages/alint/fixtures/ui-restrained-color/good-status-and-gray-meta.tsx@@ -0,0 +1,39 @@+// Fixture: color only for a real failure; metadata and types stay gray.+import { Flexbox, Icon } from '@lobehub/ui';+import { createStaticStyles, cssVar } from 'antd-style';+import { AlertCircle, ListTodo } from 'lucide-react';+import { memo } from 'react';++const styles = createStaticStyles(({ css }) => ({+ error: css`+ color: ${cssVar.colorError};+ `,+ meta: css`+ font-size: 12px;+ color: ${cssVar.colorTextTertiary};+ `,+}));++interface TaskRowProps {+ at: string;+ failed: boolean;+ failedLabel: string;+ title: string;+}++const TaskRow = memo<TaskRowProps>(({ at, failed, failedLabel, title }) => {+ return (+ <Flexbox horizontal align={'center'} gap={8}>+ <Icon className={styles.meta} icon={ListTodo} />+ <span>{title}</span>+ <span className={styles.meta}>{at}</span>+ {failed && (+ <span className={styles.error}>+ <Icon icon={AlertCircle} /> {failedLabel}+ </span>+ )}+ </Flexbox>+ );+});++export default TaskRow;diff --git a/packages/alint/fixtures/ui-user-facing-copy/bad-raw-enum.tsx b/packages/alint/fixtures/ui-user-facing-copy/bad-raw-enum.tsxnew file mode 100644index 00000000000..633ba84b1e8--- /dev/null+++ b/packages/alint/fixtures/ui-user-facing-copy/bad-raw-enum.tsx@@ -0,0 +1,19 @@+// Fixture: an activity row printing the raw event kind and a hard-coded label.+import { Flexbox } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { memo } from 'react';++interface ActivityRowProps {+ event: { kind: 'attach_work' | 'cancelled' | 'created'; title: string };+}++const ActivityRow = memo<ActivityRowProps>(({ event }) => (+ <Flexbox horizontal gap={8}>+ {/* alint-expect */}+ <Text type={'secondary'}>{event.kind}</Text>+ <Text>{event.title}</Text>+ <Text type={'secondary'}>Auto</Text>+ </Flexbox>+));++export default ActivityRow;diff --git a/packages/alint/fixtures/ui-user-facing-copy/good-mapped-label.tsx b/packages/alint/fixtures/ui-user-facing-copy/good-mapped-label.tsxnew file mode 100644index 00000000000..b5801702529--- /dev/null+++ b/packages/alint/fixtures/ui-user-facing-copy/good-mapped-label.tsx@@ -0,0 +1,23 @@+// Fixture: the event kind maps to a translated label; the model id stays raw.+import { Flexbox } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++interface ActivityRowProps {+ event: { kind: 'attach_work' | 'cancelled' | 'created'; model: string; title: string };+}++const ActivityRow = memo<ActivityRowProps>(({ event }) => {+ const { t } = useTranslation('goal');++ return (+ <Flexbox horizontal gap={8}>+ <Text type={'secondary'}>{t(`activity.kind.${event.kind}`)}</Text>+ <Text>{event.title}</Text>+ <Text type={'secondary'}>{event.model}</Text>+ </Flexbox>+ );+});++export default ActivityRow;diff --git a/packages/alint/fixtures/ui-view-switch-tabs/bad-segmented-views.tsx b/packages/alint/fixtures/ui-view-switch-tabs/bad-segmented-views.tsxnew file mode 100644index 00000000000..0efb8d987ba--- /dev/null+++ b/packages/alint/fixtures/ui-view-switch-tabs/bad-segmented-views.tsx@@ -0,0 +1,34 @@+// Fixture: a Segmented switching whole panels, kept only in local state.+import { Flexbox } from '@lobehub/ui';+import { Segmented } from '@lobehub/ui/base-ui';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import DirectoryTree from './DirectoryTree';+import HealthOverview from './HealthOverview';++const DeviceDetail = memo<{ deviceId: string }>(({ deviceId }) => {+ const { t } = useTranslation('setting');+ const [view, setView] = useState<'overview' | 'files'>('overview');++ return (+ <Flexbox gap={16}>+ {/* alint-expect */}+ <Segmented+ value={view}+ options={[+ { label: t('device.overview'), value: 'overview' },+ { label: t('device.files'), value: 'files' },+ ]}+ onChange={(value) => setView(value as 'overview' | 'files')}+ />+ {view === 'overview' ? (+ <HealthOverview deviceId={deviceId} />+ ) : (+ <DirectoryTree deviceId={deviceId} />+ )}+ </Flexbox>+ );+});++export default DeviceDetail;diff --git a/packages/alint/fixtures/ui-view-switch-tabs/good-segmented-filter.tsx b/packages/alint/fixtures/ui-view-switch-tabs/good-segmented-filter.tsxnew file mode 100644index 00000000000..8cc23cb8d3d--- /dev/null+++ b/packages/alint/fixtures/ui-view-switch-tabs/good-segmented-filter.tsx@@ -0,0 +1,28 @@+// Fixture: a Segmented that only filters the same list.+import { Flexbox } from '@lobehub/ui';+import { Segmented } from '@lobehub/ui/base-ui';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import TaskList from './TaskList';++const TaskFilterList = memo(() => {+ const { t } = useTranslation('task');+ const [scope, setScope] = useState<'all' | 'mine'>('all');++ return (+ <Flexbox gap={8}>+ <Segmented+ value={scope}+ options={[+ { label: t('filter.all'), value: 'all' },+ { label: t('filter.mine'), value: 'mine' },+ ]}+ onChange={(value) => setScope(value as 'all' | 'mine')}+ />+ <TaskList scope={scope} />+ </Flexbox>+ );+});++export default TaskFilterList;diff --git a/packages/alint/rules/ui-button-hierarchy/rule.alint.toml b/packages/alint/rules/ui-button-hierarchy/rule.alint.tomlnew file mode 100644index 00000000000..748790b19ae--- /dev/null+++ b/packages/alint/rules/ui-button-hierarchy/rule.alint.toml@@ -0,0 +1,23 @@+name = "ui-button-hierarchy"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client. Buttons come from `@lobehub/ui/base-ui`, whose `Button` takes `type: 'default' | 'primary' | 'fill' | 'dashed' | 'link' | 'text'` and `size: 'small' | 'middle' | 'large'` (there is no `variant` prop).++Team rule, distilled from the product owner's review rejections ("按钮用 filled 而不是 primary", "这个需要用轻量的 filled,不是 primary", "检查更新用文本按钮", "声明指标做成文本按钮", "按钮太小了,换成默认按钮大小", "默认用 small 不对吧,应该默认 default"): a button's visual weight must match how important the action is on its surface.++Report ONLY these three patterns. They can be decided from this file alone; anything else about button weight is taste and is not this rule's job.+1. Two or more `type="primary"` buttons rendered in the same action group — one footer, one toolbar, one row of actions — including a `danger` primary next to another primary. Anchor on the second one. Suggest keeping the primary on the commit action and making the other `type="default"`.+2. A `type="primary"` button rendered once per item of a list — inside a `.map()` over rows, results, cards or options — so the list shows a column of primaries. Suggest `type="default"` (or `fill`) for the per-row action.+3. `size="small"` on the single call to action of an empty state or a centered failure / retry state. Suggest the default size ("默认用 small 不对吧,应该默认 default").+Anchor on the line of the button's opening tag. In the message, name the action (from its label or handler) and which pattern it matches.++Do not report:+- any single primary button that is not in a list row, whatever its label — deciding which action deserves the primary needs the product context;+- a secondary button that is `default`, `fill`, `text` or `link` — never suggest changing one non-primary type into another;+- `danger` buttons inside a destructive confirmation dialog;+- buttons whose type or size is a prop passed in by the caller;+- a primary inside an inline notice, banner or `Alert` action: when it is the notice's one way forward, primary is right;+- small buttons anywhere other than pattern 3 (toolbars, table cells, list rows, tags, popovers, section-title `extra`s, graph node headers).++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-content-width/rule.alint.toml b/packages/alint/rules/ui-content-width/rule.alint.tomlnew file mode 100644index 00000000000..8fc7a7f617d--- /dev/null+++ b/packages/alint/rules/ui-content-width/rule.alint.toml@@ -0,0 +1,20 @@+name = "ui-content-width"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React page, panel or section component from LobeHub's web client.++Team rule, distilled from the product owner's review rejections ("这个全宽不好看,你得限制下宽度", "还是那一条说的,需要加个限宽,全宽不好看", "顶上的选择器这个区域宽度应该是限宽而不是全宽", "底下这个验收条需要限制下宽度", "步骤图的模式下,宽度应该也要限定下,不能是全宽的", "840 有点宽了,应该改成默认六百多的"): reading content — settings forms, detail pages, lists of cards, integration pages, reports, step lists, bottom action bars — is centered in a column with a max width, not stretched across the whole main area. Comfortable widths are roughly 600–1024px depending on density.++The repo's width containers: `SettingContainer` (src/features/Setting/SettingContainer, used as `<SettingContainer maxWidth={1024}>` by every settings page), `WideScreenContainer` (the community layouts), and any wrapper with a `maxWidth`. This file is a route page or a top-level settings / feature page.++Report the page's outermost content container when it grows to the full available width (`width: 100%` / `flex: 1` / no max width) and neither it nor any wrapper in this file is one of the width containers above. Anchor on the line of that outer content container. In the message, name the page. In the suggestion, name the container to wrap it in (`SettingContainer maxWidth={1024}` for settings-like pages, a centered `maxWidth` of 720–1024 otherwise).++Do not report:+- pages whose main content is a canvas, graph, editor, table, split pane or chat message list, which own their full width by design;+- `_layout` files, skeletons, `Portal/*`, side / detail panels, modals, drawers and popovers;+- components passed as slots (`welcome=`, `render`, `extra`, `checkErrorRender`) or that do not render a page body;+- anything under the community routes and workspace settings, whose layouts already cap the width;+- a container that already has any `maxWidth`, even one above 1024.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-edit-in-modal/rule.alint.toml b/packages/alint/rules/ui-edit-in-modal/rule.alint.tomlnew file mode 100644index 00000000000..cae7ea61bba--- /dev/null+++ b/packages/alint/rules/ui-edit-in-modal/rule.alint.toml@@ -0,0 +1,20 @@+name = "ui-edit-in-modal"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client.++Team rule, distilled from the product owner's review rejections ("重命名不应该是行内编辑,应该是 modal 编辑", "点击编辑应该是打开弹窗而不是就地变成 input", "现在这个添加任务也特别难受,应该是一个 modal 打开做创建逻辑?现在变成了一个 input"): editing or creating an entity from a menu or an "edit" / "add" affordance opens a modal (or a dedicated panel), not an input that replaces the text in place.++Report a component that, on an edit / rename / add action, opens a Popover holding an input for the entity's name (`InlineRename`, a Popover wrapping an `Input`) — a popover rename is still inline editing — or swaps a displayed title, name, description or list row for an inline `Input` / `TextArea` / editable field (an `isEditing` / `editing` / `renaming` state toggling between text and input), for an entity such as a topic, document, project, task, goal, agent, file or criterion. Anchor on the line where the inline input is rendered. In the message, name the entity and the action. In the suggestion, say to open a modal (the repo's `createModal` helper from `@lobehub/ui/base-ui`) with the form.++Do not report:+- forms, settings pages and modals whose purpose is editing, where fields are inputs from the start;+- rich-text or code editors, chat inputs and search boxes;+- inline cell editing in data tables and spreadsheets;+- rename or create on nodes of any file / folder tree or explorer list (ResourceManager, FileTree, ExplorerTree, DocumentExplorerTree, LibraryHierarchy), from double-click or a context menu — the OS file-manager convention;+- inline editing inside a component that is itself a modal (`*Modal`, rendered through `createModal`);+- a persistent add-row that is always visible, and a title that is always an input (a page title editor);+- a menu action that only sets state which opens a modal. Report only when you can see this file render the inline input in place of the text.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-in-app-links/rule.alint.toml b/packages/alint/rules/ui-in-app-links/rule.alint.tomlnew file mode 100644index 00000000000..a5c51e3855b--- /dev/null+++ b/packages/alint/rules/ui-in-app-links/rule.alint.toml@@ -0,0 +1,24 @@+name = "ui-in-app-links"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component or client helper file from LobeHub's web client (React Router SPA).++Team rule, distilled from the product owner's review rejections ("回跳应该到 settings/Integration/github 这样才合理", "/agent/agt_x?topic=tpc_y 这个 url 不对,url 应该是 /agent/agt_x/tpc_y", "这个时候不需要 scm=github 吧?"): an in-app link must match the router's real route shape, and carry no parameter the target route does not read.++The router's canonical shapes (src/spa/router/desktopRouter.shared.tsx, mobileRouter.config.tsx). A path that fits any of these is valid:+- agent: `/agent/:aid` (index = new conversation), `/agent/:aid/:topicId`, and sub-pages `profile`, `share`, `statistics`, `topics`, `permission`, `channel/:platform`, `tasks`, `task/:taskId`, `goals`, `goal/:goalId`, `docs/:docId`, `self-evolving/…`;+- group: `/group/:gid`, `/group/:gid/:topicId`, `/group/:gid/profile`;+- top-level: `/agents`, `/apps`, `/tasks`, `/task/:taskId`, `/goal/:goalId`, `/projects`, `/project/:projectId/…`, `/page`, `/page/:id`, `/page/:id/permission`, `/acceptance/:id`, `/resource/:category` (`all`, `works`, `documents`, …), `/resource/library/:id`, `/memory/…`, `/community/…`, `/settings/…`, `/eval/…`, `/:workspaceSlug/…` (workspace-scoped copies of the same pages), and `/me/…` in mobile files;+- `/image?topic=…` and `/video?topic=…` are the correct shapes for generation topics (the topic IS a query parameter there).+- `/chat…` is a legacy path that permanently redirects to `/` and drops everything after it. `/agent/:aid?topic=…` is wrong: the topic is a path segment.++Report a hand-built in-app URL (string or template literal passed to `href`, `to`, `navigate`, `window.open`, or returned by a helper) that:+1. uses `/chat…`, puts the topic of an agent or group conversation in a query parameter, or otherwise contradicts the shapes above (wrong segment order, a segment that exists nowhere in the list);+2. adds a marker parameter that only tags where the link came from — `from=`, `ref=`, `scm=`, `active=` — or repeats an id already in the path (`/agent/:id?agent=:id`). Every other query parameter (`tab`, `file`, `message`, `preferenceId`, `source` on community pages, …) is read by its target page in another file; do not report it;+3. builds the same route in two different shapes within this file.+Anchor on the line of the URL. In the message, quote the URL shape and the canonical one. In the suggestion, give the corrected shape.++Do not report external URLs (http/https to other hosts), API endpoints (`/api/…`, `/trpc/…`, `/webapi/…`), asset paths, and links that fit the shapes above.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-lightweight-errors/rule.alint.toml b/packages/alint/rules/ui-lightweight-errors/rule.alint.tomlnew file mode 100644index 00000000000..f593c90f03a--- /dev/null+++ b/packages/alint/rules/ui-lightweight-errors/rule.alint.toml@@ -0,0 +1,25 @@+name = "ui-lightweight-errors"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client.++Team rule, distilled from the product owner's review rejections ("你能否把这种报错展示换成轻量化的?轻量化的情况下再有一个 show detail,这样比较舒服", "我记得我们的 UI 里面有一种是直接一个很轻量的展示", "这块 error 展示太丑了,间距没有配置好"): an error inside a feature is shown as one short, readable line — an icon, a human sentence of what failed and what to do — with the raw details (stack, response body, provider message, error code) folded behind a "show details" toggle. A full red panel with the raw message dumped in is not acceptable.++Report, anchoring on the line of the error element:+1. an error state rendered as a large `Alert type="error"`, red block or bordered box inside a card, list row, message or panel, when it is not a page-level failure;+2. a raw error string, `error.message`, `JSON.stringify(error)`, a stack or an HTTP body shown directly to the user without a readable summary and a details toggle;+3. an error `description` that repeats the technical message instead of saying what the user can do.+In the message, name the error surface. In the suggestion, describe the one-line summary plus the folded details.++Do not report:+- page-level error boundaries and full-page error screens;+- form field validation messages;+- developer-only surfaces (DevPanel, debug views, logs, test consoles);+- errors already rendered through a shared error component: `AsyncBoundary` / `AsyncError`, `ErrorContent`, `ErrorBoundary` / `AlertFallback`, `customErrorRender`;+- `toast.error(...)` / `message.error(...)` — a toast already is the lightweight form;+- full-page auth, OAuth and device-pairing screens;+- tool execution output (stdout / stderr / a result field whose value is the error), and eval result fields whose value is the failure reason;+- a single translated inline line that already reads as a sentence.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-no-decorative-chrome/rule.alint.toml b/packages/alint/rules/ui-no-decorative-chrome/rule.alint.tomlnew file mode 100644index 00000000000..df17440c2fc--- /dev/null+++ b/packages/alint/rules/ui-no-decorative-chrome/rule.alint.toml@@ -0,0 +1,30 @@+name = "ui-no-decorative-chrome"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client (styles through antd-style `createStaticStyles` with `cssVar.*` tokens, layout with `Flexbox` / `Block` from @lobehub/ui).++Team rule, distilled from the product owner's review rejections: structure comes from spacing and alignment, not from boxes. Quotes: "不需要有底色", "这个不应该有 border 吧?", "默认不用把底色加亮,就用透明底", "不要画框", "顶上加标题也不好看", "这些 title 感觉没有必要加粗", "不要这根线", "现在的问题是这块抱着 border 的没有任何必要", "我想把这个 header 头做轻量一些,不要加这个底色和 divider 线分割", "这个容器外面的 border 有点粗了,喧宾夺主", "去掉包裹容器", "为什么这里内部有一段无意义的 padding".++Report, anchoring on the line of the style rule or element:+1. a wrapper that only groups content and adds a border, a background fill (`cssVar.colorFillTertiary`, `cssVar.colorBgContainer` on a same-colored page, …) or a shadow around it — especially a card inside a card, or a bordered box around a single list or a single section;+2. a section title / heading added above content whose meaning is already clear from the surrounding page, tab or panel title (a heading restating the tab name, a "Details" header on a details panel);+3. a title or label that is bold (`fontWeight: 600|bold`, `strong`) when it is a plain field or list label, not the page or panel title;+4. a divider line or border between header and body, or between two sections that are already separated by spacing;+5. a border heavier than 1px (or a dark border color) on a container, or padding inside a wrapper that has no visual boundary of its own.++In the message, name the element and the chrome it adds. In the suggestion, say what to remove and what (spacing, alignment, a lighter token) carries the structure instead.++Do not report:+- interactive surfaces that need a boundary: inputs, dropdowns, popovers, modals, drawers, menus, tooltips, focus / selection / hover states;+- list items or cards in a grid of many peers, where a light border or fill separates items the user compares;+- code blocks, quotes, file previews, images and other embedded content;+- the page's or panel's own title;+- a divider inside one bordered code / debug box, or between side-by-side columns that scroll independently;+- fills on quoted or model-generated text (reasoning, excerpts) — that is embedded content;+- bold group / section headings in a grouped list (only bold FIELD labels count);+- loading skeletons that mirror the shape of the component they stand in for;+- settings or theme preview mocks, media thumbnails, embedded resource cards, icon tiles in a row of metric chips;+- a fill or border that shows the granted / selected / active state of a clickable row.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-restrained-color/rule.alint.toml b/packages/alint/rules/ui-restrained-color/rule.alint.tomlnew file mode 100644index 00000000000..5d1ed879eaf--- /dev/null+++ b/packages/alint/rules/ui-restrained-color/rule.alint.toml@@ -0,0 +1,31 @@+name = "ui-restrained-color"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client (styles through antd-style `createStaticStyles` with `cssVar.*` tokens, `Tag` / `Alert` from `@lobehub/ui/base-ui`).++Team rule, distilled from the product owner's review rejections: color carries state, not decoration. Quotes: "都不要用 link 色,弄成文本色,然后可以点击那种感觉就够了(用图标)", "不要再用色块表达类型了……不要再加颜色", "最好还是有一些图标,但是不用颜色,就是灰色的图标", "都用灰色,不要用这么 colorText 主色", "用 colorTextSecondary 吧,不要用最重一级颜色", "这个时间的颜色要换成浅的", "断开用蓝色很怪啊,你换成亮灰色", "不啊要用蓝色的,感觉是信息条了,换成那种白底的告知", "不要有这个黄 tag", "已解决应该默认折起然后置灰,也不应该有任何这种绿色的显眼的 tag", "你应该用 cssVar 的吧".++Report, anchoring on the line of the style declaration or element:+1. clickable text styled with the link / primary color (`cssVar.colorLink`, `cssVar.colorPrimary`, `cssVar.colorInfo` on text, antd `Typography.Link` / `<a>` styled blue) for an in-app action. It should use the text color plus an icon to signal it is clickable;+2. a category, kind or type expressed with a colored `Tag`, colored badge or colored block (`color="blue"`, `color="gold"`, `colorWarningBg`, …) when the value is not a status that needs attention. Types should be plain text with a gray icon;+3. metadata — timestamps, durations, sizes, token counts, costs, counters, secondary descriptions — rendered in `cssVar.colorText` (the heaviest text color) instead of `cssVar.colorTextSecondary` / `cssVar.colorTextTertiary` / `cssVar.colorTextDescription`;+4. neutral or inactive states — disconnected, offline, idle, cancelled, resolved, no data — shown in blue, green or another saturated color instead of gray;+5. an informational notice rendered as a colored (blue / info) `Alert` or banner when it is a plain heads-up, not a warning;+6. a hard-coded color literal (`#1677ff`, `rgb(...)`, `rgba(...)`, `'red'`) in a style where a theme token (`cssVar.*`) exists. Transparent / `currentColor` / `inherit` are fine.++In the message, name the element and the color used. In the suggestion, name the token or treatment to use instead.++Do not report:+- real statuses that need attention: error, failure, warning, running / in progress, success right after an action completes;+- brand colors of third-party logos and provider icons, charts and data visualizations with a palette, syntax highlighting, color pickers and avatars;+- the primary color on the single primary button, on selection / focus states, or on progress indicators;+- colors inside `rgba()` used only for shadows, overlays or gradients built from a token;+- a link or primary color that appears only on hover when the resting color is a text token — that is the requested treatment;+- external hyperlinks (`href` to another host, `target="_blank"`) that already carry an external-link icon;+- diff highlighting (added / removed / modified lines);+- verdict colors for uncertain or unknown results that need the reviewer's attention;+- a `Tag` with no color or the default gray color;+- preview mocks, and white text or icons on a dark scrim over an image or video.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-user-facing-copy/rule.alint.toml b/packages/alint/rules/ui-user-facing-copy/rule.alint.tomlnew file mode 100644index 00000000000..2a3211a550a--- /dev/null+++ b/packages/alint/rules/ui-user-facing-copy/rule.alint.toml@@ -0,0 +1,27 @@+name = "ui-user-facing-copy"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client. User-facing text goes through react-i18next (`t('key')`); the product ships Chinese and English.++Team rule, distilled from the product owner's review rejections: every piece of text on screen must make sense to a user seeing it for the first time. Quotes: "能否告诉我这里面的内容是个啥?类型是否可以作为状态说明?比如这个 cancelled 是直接可以变成「已取消任务」吗?", "这项如果是规范化的节点,应该用标准的 i18n 的展示", "环境为什么不写中文?", "review-repository 是个啥?我看不懂", "这个为什么要这样大写?不应该有这样的展示,全都改掉", "表达说明有点太 AI 味了", "不需要加例如", "为什么这里会是至少?", "不应该有 v1 v2 这些版本".++Report, anchoring on the line where the text is rendered:+1. a raw machine value shown as text: an enum / status / type / kind value (`{status}`, `{item.type}`, `{event.kind}`), an identifier, a slug or an internal key rendered directly instead of mapped to a translated label;+2. a hard-coded user-visible string in JSX, a `title`, `placeholder`, `label`, `message` or `tooltip`, instead of `t(...)` — in either language;+3. an internal version marker (`v1`, `v2`, `beta`, `new`) or engineering jargon (operation, payload, runtime, snapshot) shown to the user as part of a label.+In the message, name the text and why a user cannot read it. In the suggestion, give the i18n key shape or the treatment.++Do not report:+- brand and product names, model ids, file names, paths, URLs, code, numbers and units;+- values inside developer-only branches and surfaces: DevPanel, debug views, logs, test consoles, code under `showDebug` / `isDev` / `process.env.NODE_ENV` checks. The eval pages are a product surface and are NOT excluded;+- CSS of any kind — this rule is about text content;+- `alt` attributes and decorative watermark text;+- user- or agent-authored content fields rendered as data (a task title, an agent name, a check description);+- a raw value used only as the fallback after a translation lookup misses;+- third-party product, plan and brand names, even when their casing is off;+- `aria-*` attributes and `data-*` attributes;+- strings passed to `t()` as keys or default values;+- `text-transform: uppercase` in stylesheets — stylelint reports it (declaration-property-value-disallowed-list).++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""diff --git a/packages/alint/rules/ui-view-switch-tabs/rule.alint.toml b/packages/alint/rules/ui-view-switch-tabs/rule.alint.tomlnew file mode 100644index 00000000000..e8905c86580--- /dev/null+++ b/packages/alint/rules/ui-view-switch-tabs/rule.alint.toml@@ -0,0 +1,21 @@+name = "ui-view-switch-tabs"+builtInAgent = "basic-structured"+instruction = """+You are reviewing one React component file from LobeHub's web client.++Team rule, distilled from the product owner's review rejections ("这个用 tab 而不是 Segmented,URL 也要对应变的", "你怎么给我改成 segmented 了??我要的是 tab 啊??", "验收流程应该是第二个 tab,默认应该进到验收清单里"): switching between the main views of a page or panel is navigation. It uses tabs (`Tabs` from @lobehub/ui or antd), and the active tab lives in the URL (a route segment or a search param through the router), so a view can be linked, reloaded and navigated back to.++Report:+1. a `Segmented` (or a row of toggle buttons) whose options switch between whole views / panels of a page or portal — each option mounts a different section with its own content — rather than filtering or toggling one list;+2. page- or panel-level `Tabs` whose active key is kept only in `useState` when the surface has its own route (a page, a portal view, a settings panel), so the view is lost on reload and cannot be linked.+Anchor on the line of the `Segmented` / `Tabs` element. In the message, name the views being switched. In the suggestion, say to use `Tabs` and where the active key should live in the URL.++Do not report:+- `Segmented` used as a filter, a sort order, a unit or a display mode of the same data (list / grid, day / week, all / mine);+- small in-card or in-popover switches, form controls, and tabs inside modals;+- tabs whose key is already read from the URL or passed in by a parent (controlled `activeTab` / `onTabChange` props);+- tabs in a component hosted by a modal (`*Modal` files, `createModal`, `open*Modal` helpers). If you cannot see that the component is a routed page or portal view, return no finding;+- sheet / slide strips inside document viewers, filter pills in sidebar sections, and transient switchers inside a chat message.++If an exclusion applies, return no finding. If uncertain, use low confidence.+"""