3.5 KiB
3.5 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-shared-editor | Build shared prompt editor | done | 1 | plan.md | ../../specs/ui/settings-prompt-editor.md |
Task 01: Build shared prompt editor
Acceptance
SettingsPromptEditorprovides controlled plain text, configured placeholders, optional saved-prompt references, exclusions, accessibility, dirty state, and localized hints.- Two mounted Monaco editors return completion items only for their own model.
- Provider updates and unmounts dispose the correct Monaco registrations without changing existing script-editor behavior.
Verification
Follow TDD. Add the model-isolation and shared-component tests first. Make sure that they fail against the language-wide provider ownership.
cd apps && pnpm install --frozen-lockfile && pnpm --filter @kandev/web test -- --run components/settings/settings-prompt-editor.test.tsx components/settings/profile-edit/script-editor.test.tsx components/settings/profile-edit/script-editor-completions.test.ts && cd web && pnpm run typecheck && pnpm run i18n:check && pnpm run i18n:ratchet && pnpm exec eslint components/settings/settings-prompt-editor.tsx components/settings/settings-prompt-editor.test.tsx components/settings/profile-edit/script-editor.tsx components/settings/profile-edit/script-editor.test.tsx components/settings/profile-edit/script-editor-completions.ts components/settings/profile-edit/script-editor-completions.test.ts
Files likely touched
apps/web/components/settings/settings-prompt-editor.tsxapps/web/components/settings/settings-prompt-editor.test.tsxapps/web/components/settings/profile-edit/script-editor.tsxapps/web/components/settings/profile-edit/script-editor.test.tsxapps/web/components/settings/profile-edit/script-editor-completions.tsapps/web/components/settings/profile-edit/script-editor-completions.test.tsapps/web/src/locales/en/settings.jsonapps/web/src/locales/pt-pt/settings.jsonapps/web/src/locales/zh-cn/settings.jsonapps/web/src/locales/zh-hk/settings.jsonapps/web/src/locales/zh-tw/settings.json
Dependencies
None.
Parallelism
Sequential. All later tasks depend on this component and its provider ownership contract.
Inputs
- Spec:
What,Failure modes, and the model-isolation scenarios. - Plan:
Shared prompt editor,Monaco completion ownership, andRisks. - Existing patterns:
ScriptEditor,useCustomPrompts, andscript-editor-completions.test.ts.
Output contract
Report the RED error, final API, model-isolation method, files changed, exact command results, blockers, risks, and synchronized task and plan status.
Results
- The initial browser run exposed a lifecycle race: saved prompts loaded before Monaco mounted, but the one-shot
onMountcallback still held an empty prompt list. The editor now keeps the latest registration callbacks in refs and registers per-model providers. ScriptEditorowns one primary and one saved-prompt registration per mounted model, scopes both throughscopeCompletionProviderToModel, and disposes them independently.SettingsPromptEditorowns the controlled plain-text contract, localized completion hints, dirty attributes, stable editor attributes, prompt loading, and current-prompt exclusions.- Focused shared-editor/component/completion tests pass: 3 files, 13 tests; the regression test covers prompt data loading before Monaco mount.
pnpm run typecheckandpnpm exec tsc --noEmit --incremental falsepass.pnpm run i18n:checkandpnpm run i18n:ratchetpass.