From 07042a22884ec67998105f0621cc0c8bc833e679 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Thu, 22 Oct 2026 06:06:25 +0100 Subject: [PATCH] Keep Tailwind's scan off the server-side folders The task work added ref strings ([file:ID], [bot:3]) in new prompt and tool files, so the warning about "file" not being a known CSS property came back: Tailwind read them as arbitrary-property utilities and emitted `file: ID`. The exclusion list now covers every server-side directory whole instead of one file at a time (none of them holds a className, so nothing is lost), and `dict` stays scanned for the static hue classes. The ref literals that must live in scanned files are reworded in comments, and task-file-row builds its chip through `fileRef` rather than its own template literal. --- src/components/general/task-file-row.tsx | 8 +++-- .../[bot_id]/(data)/composer-mention-kinds.ts | 2 +- .../[bot_id]/(hooks)/use-composer-editor.ts | 4 +-- .../bots/[bot_id]/(utils)/mention-markdown.ts | 10 +++--- src/styles/main.css | 31 ++++++++++++++----- 5 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/components/general/task-file-row.tsx b/src/components/general/task-file-row.tsx index 84fa800..75cf43c 100644 --- a/src/components/general/task-file-row.tsx +++ b/src/components/general/task-file-row.tsx @@ -3,6 +3,7 @@ import Link from "@moduletrace/twui/layout/Link"; import { FileText, Image as ImageIcon } from "lucide-react"; import Span from "@moduletrace/twui/layout/Span"; import type { TaskFile } from "@/src/types"; +import fileRef from "@/src/utils/file-ref"; type Props = { file: TaskFile; @@ -15,8 +16,9 @@ type Props = { /** * One file on a task: its name, opening the bytes at - * `/media/private/`, and its `[file:ID]` chip when it lives in a bot's - * or workspace's folder (so the file's real home is reachable too). + * `/media/private/`, and its file ref (built by `fileRef`) when it + * lives in a bot's or workspace's folder (so the file's real home is + * reachable too). */ export default function TaskFileRow({ file, onDetach, busy }: Props) { if (file.missing) { @@ -51,7 +53,7 @@ export default function TaskFileRow({ file, onDetach, busy }: Props) { ) : null} {file.bot_file_id ? ( - {`[file:${file.bot_file_id}]`} + {fileRef({ id: file.bot_file_id })} ) : null} {onDetach ? ( diff --git a/src/pages/admin/bots/[bot_id]/(data)/composer-mention-kinds.ts b/src/pages/admin/bots/[bot_id]/(data)/composer-mention-kinds.ts index 6a63e57..a04c6d9 100644 --- a/src/pages/admin/bots/[bot_id]/(data)/composer-mention-kinds.ts +++ b/src/pages/admin/bots/[bot_id]/(data)/composer-mention-kinds.ts @@ -1,6 +1,6 @@ /** * What the composer can mention, by the character that starts it: `@` a - * bot (`[bot:ID]`), `#` a workspace (`[workspace:ID]`). + * bot, `#` a workspace (each written as its ref, `[bot:` + id). */ export const ComposerMentionKinds = { "@": "bot", diff --git a/src/pages/admin/bots/[bot_id]/(hooks)/use-composer-editor.ts b/src/pages/admin/bots/[bot_id]/(hooks)/use-composer-editor.ts index 0304582..d150073 100644 --- a/src/pages/admin/bots/[bot_id]/(hooks)/use-composer-editor.ts +++ b/src/pages/admin/bots/[bot_id]/(hooks)/use-composer-editor.ts @@ -43,8 +43,8 @@ type Params = { /** * The composer's editor (Tiptap): markdown in and out, with bold, italic, * strike, code, lists, quotes and links (no headings), and mentions of - * bots (`@`) and workspaces (`#`) written as `[bot:ID]` and - * `[workspace:ID]`. Enter sends and Shift+Enter breaks the line, except + * bots (`@`) and workspaces (`#`), written as their bot or workspace ref. + * Enter sends and Shift+Enter breaks the line, except * in a code block or list, where Enter is the editor's and Mod+Enter * sends. Enter picks from an open mention menu. Pasted text comes in * plain, without another site's styling; pasted or dropped files go to diff --git a/src/pages/admin/bots/[bot_id]/(utils)/mention-markdown.ts b/src/pages/admin/bots/[bot_id]/(utils)/mention-markdown.ts index 2f0af60..7c329c5 100644 --- a/src/pages/admin/bots/[bot_id]/(utils)/mention-markdown.ts +++ b/src/pages/admin/bots/[bot_id]/(utils)/mention-markdown.ts @@ -8,10 +8,10 @@ import { const RefPattern = /^\[(bot|workspace):(\d+)\](?!\()/; /** - * How the composer's mention node reads and writes markdown: a bot as - * `[bot:3]` (`botRef`), a workspace as `[workspace:2]` (`workspaceRef`), - * so a draft or a sent message holds the same refs bots write. A ref - * followed by `(` is a markdown link, not a mention. + * How the composer's mention node reads and writes markdown: a bot ref + * (`botRef`) or a workspace ref (`workspaceRef`), so a draft or a sent + * message holds the same refs bots write. A ref followed by `(` is a + * markdown link, not a mention. */ export const MentionMarkdown = { markdownTokenizer: { @@ -50,7 +50,7 @@ export const MentionMarkdown = { }; /** - * The ref a mention writes, `[bot:3]` unless it's a workspace's. + * The ref a mention writes, a bot's unless it's a workspace's. */ export function mentionRef({ id, char }: { id?: string | number | null; char?: string | null }) { const kind = ComposerMentionKinds[(char || "@") as ComposerMentionChar] || "bot"; diff --git a/src/styles/main.css b/src/styles/main.css index a40728a..1dd98cc 100755 --- a/src/styles/main.css +++ b/src/styles/main.css @@ -1,17 +1,32 @@ @import "@moduletrace/twui/base.css"; -/* Doc and prompt strings mention refs like `[file:12]`, which Tailwind would - read as an arbitrary-property utility and emit as `file: 12` (esbuild then - warns it is not a CSS property). None of these files holds a className. */ +/* Doc, prompt and tool strings mention refs like `[file:12]`, which Tailwind + reads as an arbitrary-property utility and emits as `file: 12` (esbuild then + warns it is not a CSS property). None of the server-side directories below + holds a className, so they are excluded from the scan whole; `dict` stays + scanned because it carries the static `bg-hue-*` class names. A new prompt + or tool file then cannot bring the warning back. */ @source not "../../AGENTS.md"; @source not "../../db/**"; +@source not "../../docs/**"; +@source not "../../assets/**"; +@source not "../../llm-code-assistant/**"; +@source not "../../packages/**"; @source not "../**/*.test.ts"; @source not "../**/*.test.tsx"; -@source not "../data/harness-prompts.ts"; -@source not "../utils/file-ref.ts"; -@source not "../utils/link-computer-refs.ts"; -@source not "../harness/tools/storage/list-files-tool.ts"; -@source not "../harness/tools/storage/storage-tool-context.ts"; +@source not "../bots-queue/**"; +@source not "../cron/**"; +@source not "../data/**"; +@source not "../file-ingest/**"; +@source not "../functions/**"; +@source not "../harness/**"; +@source not "../hooks/**"; +@source not "../live-relay/**"; +@source not "../schemas/**"; +@source not "../scripts/**"; +@source not "../styles/**"; +@source not "../utils/**"; +@source not "../websocket/**"; /* Cobble design tokens (handoff `tokens/tokens.css`). Light on `:root`, dark on `.dark` (twui's dark variant). Exposed to Tailwind in `@theme inline`. */