Files
coder/site
a46d514a23 feat(site): add the project instructions editor dialog (#30369)
Adds `ProjectInstructionsDialog`, the dialog for creating, editing, and
deleting a chat project's instructions. The Details panel in the next PR
opens it.

- Save is disabled when the draft is blank or unchanged once normalized
the way the server stores it. `sanitizePromptText` mirrors
`codersdk.SanitizePromptText`: it strips invisible characters, trims
trailing whitespace on each line, and collapses extra blank lines.
- If the saved instructions change while the dialog is open (another
editor saved them), a warning appears. Save and Delete stay disabled
until the user picks Load latest or Keep my draft. The check only
applies while the dialog is open, so the user's own save does not flash
the warning during the close animation.
- An error without an API message is labelled by the action that failed
("Failed to save instructions." or "Failed to delete instructions.").

**What to scrutinize:** the conflict handling in
`ProjectInstructionsForm`, which keeps the instructions the draft
started from as its baseline.

**Validation:** `ProjectInstructionsDialog.test.tsx` asserts the
`onSave`/`onDelete` callbacks for blank drafts, edits the server would
discard, and conflicts. `invisibleUnicode.test.ts` checks
`sanitizePromptText` against cases verified with the Go function.
Stories cover the create, edit, error, error-without-message,
invisible-character warning, saving, deleting, and conflict states.
`pnpm exec tsc`, biome, oxlint, and knip pass.

---

Stack (merge top to bottom). #30377 through #29583 are f0ssel's split of
the original #29583, and this stack sits on #29583:
- #30377 data layer and project dialog (f0ssel)
- #30378 new-chat form locked to a project (f0ssel)
- #30379 project page route (f0ssel)
- #29583 sidebar folders (f0ssel), the base of this stack
- #30291 composer frame
- #30292 project chat list caches
- #30293 project page header
- #30294 project chats list
- #30367 instructions storage and prompt injection
- #30368 instructions API
- #30369 instructions editor dialog 👈
- #30370 instructions Details panel

---------

Co-authored-by: Garrett Delfosse <delfossegarrett@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 09:29:28 +07:00
..
…
…
…
…
…