[feat] Share a page as a team template and reuse it from the library and /template - #837
Merged
Conversation
…and /template A lab could copy a shared note (fork) or a shared procedure, but there was no way to say "this is a blueprint" and hand it around as one. The "template" entry type existed only as a reserved folder. - Add "Share as template" to the note menu: the current page (blocks, labels, step attributes, table behaviors, embedded media via auto-blob) is written as a PageTemplate body under templates/ with a fresh id each time; the note's own sharedRef is untouched - Add a Templates tab to the shared library with a description column, the read-only preview, and "New note from template", which builds a note from the template, restores the media from the blob root, and records templateFrom plus a shared:<id> usage in provenance. Templates never offer fork: they are blueprints, not records - Add a "Team templates" section to the /template picker that inserts a shared template into the current page through the same path as the official templates, restoring labels, step attributes, and first-column behaviors - Count blob references across notes, templates, and data-manifests when unsharing, so a template's media is collected only when nothing else still points at it Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Three findings from trying the shared library on the desktop app: - Team templates looked different from the official ones in the /template picker. They now sit in the same table (template / source / tags), with a "Team" badge and the author in the source column - The Labels and Processes tabs had no visible way to "share" a label or a procedure. There is none by design: they are collected from shared notes. Say so with a persistent hint bar and an "Open note list" button, and reword the empty states the same way. The projection now runs regardless of the "include shared library in search and AI" switch, so the hint stays true when that switch is off - Materials had no bulk share. Add "Share with team" to the material gallery's selection bar, backed by the same bulk-share flow as notes (URL bookmarks become references, files become data manifests, with the effective folders written into the entry) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Adversarial probesClick to expand probe results |
Contributor
Migration fixturesClick to expand migration results |
Contributor
Bench delta比較できませんでした: main に bench/baseline.json がありません(この PR がベースラインを初めて追加する場合、マージ後の PR から delta が出ます) delta 表を出すには、tracked の |
Contributor
Performance regressionClick to expand performance results |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
何を変えたか
予約だけだった共有種別 テンプレート を実装した(#835 の続き。base は #835 のブランチ。#835 がマージされると自動的に main 向けになる)。
/templateピッカーに 「チームのテンプレート」 欄。選ぶと今のページに差し込む(公式テンプレートと同じ挿入経路。ラベル・連動属性・先頭列のふるまいを復元)設計上の判断
PageTemplate形式(blocks + labels + attributes、optional で tableMeta / mediaInlineLabels を追加)。記録(GraphiumDocument)と雛形を型で分け、来歴・チャット・共有参照を引き継がせないsharedRefは触らない)。雛形は独立した配布物で、ノートの共有状態と一対一に紐づけると「どちらを更新したか」が分からなくなるtemplateFrom { sharedId, hash, title, usedAt }(forkedFromと同型・別フィールド。optional。DATA_MODEL に追記)。初回 revision のusedにshared:<id>extra.blobsを持つ全種別(data-manifest / note / template)」の横断参照カウントに広げた。blob は content-addressed なので、同じ画像がノートとテンプレートで同じ hash になる。1 種別でも一覧が読めなければ GC しない(残す方が安全)TYPE_TO_FOLDERと Rust 許可リストのtemplatesは登録済み、rust-parity.testgreen)既知の非対称(設計の制約)
手順の連動属性(チェック・実行者・状態)は
GraphiumPageに保存されずラベルストアの実行時状態にしか無い。共有時にストアのスナップショットを本文に入れるので/templateからの差し込みでは復元されるが、「テンプレートから新規ノート」では復元されない(新規 doc に置き場所が無い)。両経路で復元するには属性の永続化(GraphiumPageの拡張)が要り、別 PR の判断。DATA_MODEL に明記済み。変更点
share-template.ts/ShareTemplateDialog.tsx(新規)、from-page-template.ts(新規・純関数: id 振り直し・blockId→path・doc 組み立て)SharedLibraryTable.tsx/SharedLibraryView.tsx(テンプレートタブ・説明列・新規ノート)、TemplatePickerModal.tsx(チーム欄)、note-app.tsx(メニュー・ダイアログ・新規ノート・挿入)、use-file-manager.ts(handleCreateNoteFromImportに optional sources)unshare-entry.ts(blob GC の横断化 + テスト)、document-types.ts(templateFrom)、template/types.ts/templates.ts(optional フィールド)レビュー
3 観点(正しさ・一貫性・共有フォーマットと安全)のレビューと各指摘への 3 名の反証を経て、確定 4 件を修正: 新規ノート作成失敗の握りつぶし、連動属性が常に空だった点(共有時にスナップショットを渡す)、英語直書き、blob GC の範囲。
Test Plan
pnpm exec tsc --noEmitpnpm vitest run(273 files / 3389 tests passed。新規: share-template、from-page-template、TemplatePickerModal、unshare-entry の GC、表のテンプレート行、i18n)pnpm build/pnpm lint:deps(新規 violation なし)/pnpm manual:checkSharing/SharedLibraryView: テンプレートタブ/template→ チームのテンプレートを選ぶと、その場に差し込まれ、手順のラベルとチェック状態が付くこと🤖 Generated with Claude Code