diff --git a/.yoi/tickets/00001KX1JNJ2Y/item.md b/.yoi/tickets/00001KX1JNJ2Y/item.md index fddf8934..7ad45712 100644 --- a/.yoi/tickets/00001KX1JNJ2Y/item.md +++ b/.yoi/tickets/00001KX1JNJ2Y/item.md @@ -1,8 +1,8 @@ --- -title: 'Add ProfileSourceTree virtual filesystem for Decodal imports' +title: 'Add ProfileSourceTree virtual filesystem and Decodal profile editor' state: 'planning' created_at: '2026-07-08T19:18:25Z' -updated_at: '2026-07-08T19:19:23Z' +updated_at: '2026-07-08T19:27:00Z' assignee: null --- @@ -12,13 +12,13 @@ Decodal Profile は import を持つため、Profile source を単一文字列 そのため、Backend-owned な仮想 filesystem abstraction として `ProfileSourceTree` を導入する。ユーザーや Browser editor は file tree / relative path として Decodal source を扱い、Backend はその tree revision から import closure を解決して `ProfileSourceArchive` を生成する。Runtime は `ProfileSourceArchive` の manifest / virtual path だけを見て Decodal import を解決し、Workspace filesystem は読まない。 -既存 Ticket `00001KWZ5KERY` は Decodal ProfileSourceArchive migration を扱った。これは closed 済みなので、本 Ticket はその follow-up として virtual FS / source tree layer を追加する。 +既存 Ticket `00001KWZ5KERY` は Decodal ProfileSourceArchive migration を扱った。これは closed 済みなので、本 Ticket はその follow-up として virtual FS / source tree layer と Browser editor を追加する。 ## 実装順序 - depends_on: `00001KWZ5KERY` — Decodal ProfileSourceArchive / archive verify / Runtime FSなし resolution の基礎。 -- 本 Ticket: `ProfileSourceTree` virtual filesystem と import resolver / archive builder を実装する。 -- 後続: Workspace/Profile settings editor は、この `ProfileSourceTree` API 上で file tree / plain text or CodeMirror editor を実装する。 +- 本 Ticket: `ProfileSourceTree` virtual filesystem、import resolver / archive builder、Backend/Profile settings file-tree API、Decodal profile editor を実装する。 +- 後続: formatter、advanced editor integrations、runtime-local artifact sync は別 Ticket とする。 ## 実装目的 @@ -26,7 +26,9 @@ Decodal Profile は import を持つため、Profile source を単一文字列 - Browser editor は host path ではなく virtual relative path の file tree を編集する。 - Runtime は Workspace filesystem を読まず、archive manifest 内 virtual path だけで import を解決する。 - `ProfileSourceArchive` は `ProfileSourceTree` revision + selected root + import closure の snapshot として生成される。 -- 将来の CodeMirror editor / CM integration が source file tree に基づいて実装できる。 +- Workspace settings の Profiles 画面から Decodal source tree を閲覧・編集できる。 +- Decodal editor は `decodal-codemirror` を使い、CodeMirror 6 の highlighting / indentation / folding を提供する。 +- Backend validation が authority であり、Browser editor の diagnostics は補助として扱う。 ## 実装内容 @@ -84,36 +86,69 @@ Runtime は archive manifest の virtual path だけを信頼境界として扱 実装すること: - archive内 source path は manifest に存在するものだけ許可。 -- Decodal `SourceLoader::load(current_key, specifier)` は archive import map / virtual path resolver を使う。 +- Decodal `SourceLoader::load(current_key, specifier)` は archive manifest / import map / virtual path resolver を使う。 - archive tar path と virtual path の対応を検証する。 - absolute path / `..` / manifest外 import / unsupported namespace を拒否する。 ### 5. Backend/Profile settings API を file-tree model に寄せる -Profile settings API は source list だけではなく、将来 editor が使う file tree operation を前提にする。 +Profile settings API は source list だけではなく、editor が使う file tree operation を提供する。 v0 で追加する operation: -- list files。 +- list source trees。 +- list files in source tree。 - read file。 - write file。 - create file。 - delete file。 +- validate tree / validate file。 - rename/move file は v0 で必要なら追加、不要なら非目標。 Browser-facing API は virtual path と safe display path だけを返し、host path を返さない。 +### 6. Workspace settings に Decodal profile editor を追加する + +Profiles settings 画面に file tree editor を追加する。 + +実装すること: + +- `/w//settings/profiles` は Available profiles と Profile source tree list を表示する。 +- `/w//settings/profiles/trees/` で source tree を開く。 +- source tree page は file tree / selected file / diagnostics を表示する。 +- selected file は `decodal-codemirror@0.1.2` の CodeMirror 6 extension で編集する。 +- save は Backend file write API を使う。 +- create/delete file は Backend API を使う。 +- import diagnostics / validation diagnostics を表示する。 +- Browser editor は Backend validation の補助であり、Backend diagnostics を authority として表示する。 +- formatter は実装しない。 + +### 7. Editor dependency / packaging を追加する + +Frontend に Decodal editor dependency を追加する。 + +実装すること: + +- `decodal-codemirror@0.1.2` を frontend dependency に追加する。 +- CodeMirror 6 の必要 dependency を追加する。 +- `decodal()` extension を使う。 +- `decodal-wasm` による browser-side evaluation は必要になるまで非目標とし、入れる場合も Backend validation を authority とする。 +- Deno/SvelteKit check/test と Nix packaging に dependency 追加を反映する。 + ## 受け入れ条件 - `ProfileSourceTree` typed model が実装されている。 -- Backend が Decodal source files を virtual relative path の tree として list/read/write できる。 +- Backend が Decodal source files を virtual relative path の tree として list/read/write/create/delete できる。 - Backend virtual path resolver が relative import と採用 namespace import を解決できる。 - absolute path、URL、root escape、symlink escape、unsupported scheme、oversized closure は typed diagnostic になる。 - `ProfileSourceArchive` builder が `ProfileSourceTree` revision から selected root の import closure tar を生成する。 - Archive manifest に virtual path / digest / import map が含まれる。 - Runtime `ArchiveSourceLoader` は archive manifest 内 virtual path だけで import を解決し、Workspace filesystem を読まない。 +- Profiles settings 画面に source tree list と file tree editor がある。 +- Decodal file editor は `decodal-codemirror@0.1.2` / CodeMirror 6 を使って highlighting / indentation / folding を提供する。 +- Editor save/create/delete は Backend API を通り、host filesystem path を Browser が扱わない。 - Browser-facing API に host absolute path、Runtime endpoint、secret value、WorkingDirectory root が露出しない。 -- Focused tests が virtual path normalization、import closure build、archive manifest validation、Runtime archive import resolution、Browser payload redaction を確認する。 +- Focused tests が virtual path normalization、import closure build、archive manifest validation、Runtime archive import resolution、Browser payload redaction、settings file tree API、editor route smoke behavior を確認する。 - `cargo test -p yoi-workspace-server` が通る。 - `cargo test -p worker-runtime --features ws-server,fs-store` が通る。 - `cargo check -p yoi` が通る。 @@ -123,8 +158,8 @@ Browser-facing API は virtual path と safe display path だけを返し、host ## 非目標 -- CodeMirror editor UI の完成。 - Decodal formatter / formatter integration。 +- Browser-side Decodal materialization as authority。 - Profile source を RDB-like form に正規化する編集 UI。 - Plugin package / MCP executable / sandbox artifact sync。 - Memory / Ticket / Objective / Workflow の API migration。