GAS: Google Drive 所有権一括譲渡ツール(スプレッドシート UI / clasp + TypeScript)と教科書ドキュメントを追加 - #22
Draft
pollenjp wants to merge 11 commits into
Draft
GAS: Google Drive 所有権一括譲渡ツール(スプレッドシート UI / clasp + TypeScript)と教科書ドキュメントを追加#22pollenjp wants to merge 11 commits into
pollenjp wants to merge 11 commits into
Conversation
Google Drive 内で自分が所有するファイル/フォルダの所有権を、指定ユーザーへ 再帰的に一括譲渡する Google Apps Script プロジェクト。 - clasp v3 + TypeScript (module: none / グローバルスコープ構成) - ツリー走査(BFS キュー)と検索走査の 2 戦略 - 6 分制限対策: チェックポイント保存 + 時間主導トリガーで自動再開 - 安全装置: DRY RUN 既定 / LockService 排他 / 所有者チェック - mise によるツールバージョン・タスク管理 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
- mise タスク (plantuml:download / run / generate) で out/*.svg を生成 - アーキテクチャ図 / アクティビティ図 / シーケンス図 / 状態遷移図 / コード構成図 / フォルダ走査順(WBS)の 6 枚 - 生成物は docs/textbook/images/ にコピーしてコミット (plantuml/out は gitignore) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
新規参画者向けの教科書ドキュメント(全 6 章 + 目次): - 01: 概要(課題・所有権・前提と制約) - 02: 環境構築から初回デプロイまで (mise / clasp v3) - 03: 設計解説(6 分制限・BFS キュー・継続トークン・排他制御) - 04: コードリーディング - 05: 運用マニュアル(DRY RUN → 本番 → 完了確認、トラブルシューティング) - 06: 付録(個人アカウント / PlantUML 再生成 / drawio-mcp / 発展課題) 専門用語はアコーディオン形式 (details タグ) で逐次解説し、 PlantUML 生成の SVG 図を各章に挿入。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
ブラウザのボタン操作で開始・進捗確認・停止ができる Web アプリ UI を追加。 - src/webapp.ts: doGet + google.script.run 用のサーバー関数群 - src/index.html: 設定表示 / 操作ボタン / 進捗表 / 本番モード時の二重確認 - Web からの開始は最初のバッチのみ 45 秒に短縮し応答性を確保 (以降は従来どおりトリガー連鎖で 4.5 分バッチ) - appsscript.json に webapp 設定を追加(USER_DEPLOYING x MYSELF の最安全既定) - 教科書に第 7 章を追加: デプロイ手順と共有範囲(executeAs x access)の 安全な組み合わせ / セルフサービス構成の注意点を解説 - コード構成図(05_code_structure)を更新 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
インターフェースの再設計: - 状態をユーザープロパティ / ユーザーロックに変更し、進捗・停止・ 再開トリガーを利用者ごとに完全分離(複数人の同時利用で干渉しない) - スプレッドシート UI (sheet.ts) を追加【推奨インターフェース】: カスタムメニュー実行、設定シート(B2 譲渡先 / B3 対象フォルダ / B4 モード)、 「譲渡ログ」台帳シートへのバッファ書き込み - Web アプリを セルフサービス型に変更: USER_ACCESSING x ANYONE、 譲渡先・対象フォルダ・モードを画面から利用者ごとに入力 - フォルダ ID 入力は URL 貼り付けにも対応 (normalizeFolderIdInput) - Node 22 -> 24 (mise.toml) - 教科書: 第 8 章(スプレッドシート UI)追加、第 7 章を全面改訂、 第 1・3・4・5 章とアーキテクチャ図をユーザープロパティ設計に更新 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
- パッケージマネージャを npm から pnpm 11.9.0 に変更(mise の npm バックエンドで管理) - pnpm-workspace.yaml に minimumReleaseAge: 10080 を設定し、 リリースから 1 週間未満のバージョンを依存解決の対象から除外 (npm サプライチェーン攻撃対策。除外リストの例もコメントで記載) - pnpm 自体のバージョン選定にも同じ 1 週間ルールを適用 (11.11.0 は 2 日前のため 11.9.0 を採用) - package.json に packageManager を明記、build スクリプトを npm 非依存に - mise タスク・教科書(第 2 章にサプライチェーン攻撃の用語解説を追加)・ README・アーキテクチャ図を pnpm 前提に更新 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
インターフェースをスプレッドシート UI に一本化: - webapp.ts / index.html / main.ts と webapp マニフェスト設定を削除 - resumeTransfer / stopTransfer / describeOwnedItems は transfer.ts に統合 - 教科書: 旧第 7 章(Web アプリ)を削除し、第 8 章を第 7 章 「スプレッドシート UI の仕組みと共有」として再構成。 第 5 章(運用)をメニュー操作前提の手順に全面書き換え。 第 1〜4 章・付録・README・全図をシート前提に更新 安全設計の強化(デフォルト値の撤廃): - config.ts から newOwnerEmail / rootFolderId / dryRun を削除し、 実行設定は「設定」シートの入力のみとする - 譲渡先(B2)未指定はエラー - 対象フォルダ(B3)は「空欄 = マイドライブ全体」仕様を廃止し、 ツリー走査では明示指定を必須化(シート側 + resolveRootFolder の二重検証) - 全所有物を対象にする経路は「開始(検索走査)」のみとし、 確認ダイアログで対象範囲を明示 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
- plantuml/ と drawio/ を docs/textbook/ 配下へ移動 (教科書用の図関連ファイルを教科書ディレクトリに集約) - ルート mise.toml の diagrams タスクと .gitignore のパスを追随 - 教科書(目次・第 4 章・付録 C/D)・README・drawio 手引きの 相対パスを更新 - 第 2 章の clasp login 説明を「開発者アカウント」に修正 (シート共有型ではデプロイ者 = 譲渡元とは限らないため) - 移動後のパスで mise run diagrams の生成〜コピーを動作確認 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC
教科書の図をこれまでの docs/textbook/images/ へコピーする方式から、 生成先の docs/textbook/plantuml/out/ を直接参照する方式へ変更する。 - SVG 6 枚を images/ から plantuml/out/ へ移動 - 教科書各章・README の画像参照を ./plantuml/out/ に更新 - mise の diagrams タスクから images/ へのコピー処理を削除 - .gitignore で out/ を追跡対象にし、生成物をコミットする - images/ は drawio エクスポート用の置き場として案内を残す Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PG8YYqW1fQsT92uuEaY1M9
PlantUML(plantuml/out/)と構成を揃え、drawio のエクスポート先も 生成元と同じ drawio/ 配下の out/ に集約する。 - drawio ガイドのエクスポート先を docs/textbook/images/ → docs/textbook/drawio/out/ に変更 - ディレクトリ構成の説明(README.md / 04-code-walkthrough.md)から images/ を削除し drawio/out/ を明記 - .gitignore のコメントを plantuml/out/・drawio/out/ の両生成物に対応するよう更新 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PG8YYqW1fQsT92uuEaY1M9
…tory-v76s8c 図の生成物を plantuml/out/・drawio/out/ に集約し images/ を廃止する
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.
概要
Google Drive 内で自分が所有するファイル/フォルダの所有権を、指定したユーザーへ再帰的に一括譲渡する Google Apps Script プロジェクトを、新規ディレクトリ
gas-drive-ownership-transfer-2026-07-11/として追加します。利用者インターフェースはスプレッドシート 1 本です。シートにバインドしてデプロイし、「設定」シートのセルに入力 → カスタムメニュー「所有権譲渡」から実行 → 結果は「譲渡ログ」シート(台帳)に記録されます。
構成
module: "none"(import/export なし・グローバルスコープ共有)構成。tscでdist/に出力し、clasp はdist/のみを push(コンテナバインドはclasp create-script --type sheetsで作成)setup/build/push/open/diagrams等のタスク定義pnpm-workspace.yamlのminimumReleaseAge: 10080で「リリースから 1 週間未満のバージョンを依存解決に使わない」ガードを設定(pnpm 自体の選定にも同ルールを適用し 11.9.0 を採用)スプレッドシート UI(sheet.ts)
setValues()で一括書き込み実装のポイント
'me' in ownersクエリでの全所有物総ざらい(検索走査)resolveRootFolder()の二重検証)教科書ドキュメント(docs/textbook/)
新規参画者向けに全 7 章 + 目次。専門用語はアコーディオン形式(
<details>)で用語が出た段落の直下に解説を挿入。図の生成元(plantuml/)と drawio の手引き(drawio/)もdocs/textbook/直下に集約。図(docs/textbook/plantuml/)
指定テンプレート構成の
docs/textbook/plantuml/mise.toml(java 25 / PlantUML 1.2026.6)で.puml→out/*.svgを生成し、docs/textbook/images/へコピーして各章に挿入(ルートのmise run diagramsで一括実行)。検証
mise run build: Node 24.18 + pnpm 11.9.0 + strict TypeScript でコンパイルエラーなし(dist/に JS 5 本 + manifest)pnpm config get minimumReleaseAge→ 10080 を確認、pnpm installで lockfile 生成(clasp 3.3.0 / typescript 5.9.3 / @types 2.0.11)mise run diagrams: 移動後のパスで SVG 6 枚の生成と教科書へのコピーを確認(日本語フォント描画も目視確認済み)create-script --type sheets/open-script/login --no-localhost等)を実機確認してドキュメントに反映備考
clasp login〜実行はユーザー環境での作業になります(手順は教科書第 2 章・第 5 章).clasp.jsonは個人ごとに異なるため gitignore し、.clasp.json.exampleを同梱🤖 Generated with Claude Code
https://claude.ai/code/session_01Uy3xv24ox1pbey5TDEjuFC