claudian: 田中雄一郎OS保管庫の場所とフォルダ構成を設定で解決する - #1
Merged
Conversation
The vault root was hardcoded to one Mac's layout, so the same plugin could not save on a second machine. Resolve it at runtime instead: --vault > CLAUDIAN_VAULT_ROOT > ~/.claudian/config.json > auto-detection of 田中雄一郎OS保管庫 under the usual parents (TANAKA-BRAIN, home, Documents, Obsidian/iCloud Drive, Dropbox, Google Drive). Also: - Fail loudly when the vault is missing instead of mkdir -p'ing a stray tree that looks like a successful save (--create-vault opts in). - Date notes by local calendar day, not UTC, so a 07:00 JST note is not filed under the previous day. - Never overwrite a same-day note with the same title (_2, _3, ...). - Reject unknown CLI flags so a typo like --foldr cannot silently file a note into the inbox. - Print the resolved vault to stderr, keeping the filename on stdout. - Add plugins/claudian/README.md with per-machine setup and 17 tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U2j9ygS1iB3oPmV5QcQqqr
保管庫を再編するたびにスクリプトを直すのを避ける。alias → directory の対応を 設定から読むようにし、レイヤを重ねて解決する: built-in defaults < ~/.claudian/config.json < <vault>/.claudian.json The vault-local file wins, so a reorganisation reaches the M1 and the M5 through the vault's own sync instead of being copied to each machine by hand. Per-alias merge keeps untouched aliases at their defaults, and a null value removes an alias so a folder deleted by the reorganisation stops being a save target instead of being silently recreated. Also: - --dir <vault-relative path> saves to a folder that has no alias yet, for use while the structure is still in flux. - --list-folders prints the live mapping and which files it came from. - Folder paths are validated: absolute paths and .. cannot escape the vault. - An unknown --folder now lists the aliases that do exist. - Aliases match case-insensitively, so --folder KEEP works. - Skill and command docs tell Claude to check --list-folders instead of trusting the built-in table. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U2j9ygS1iB3oPmV5QcQqqr
Writing .claudian.json by hand means retyping the new structure on the machine that holds 田中雄一郎OS保管庫. Read the vault instead and draft the file from what is actually there: --scan-folders print the draft, touch nothing --scan-folders --write save it into <vault>/.claudian.json Aliases still pointing at a surviving folder are kept as they are, new folders get an alias derived from their name (20_進行中 → 進行中, 03_PUBLIC → public), and aliases whose folder is gone are written as null so they stop being save targets. --write merges into the existing file rather than replacing it. Also align --list-folders output by display width so CJK aliases line up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U2j9ygS1iB3oPmV5QcQqqr
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
MacBook Air M1 / M5 の2台で claudian(Obsidian 連携)が同じように動くようにし、保管庫の再編にコード修正なしで追従できるようにします。
背景
obsidian-save.mjsは保存先が/Users/nesty/TANAKA-BRAIN/田中雄一郎OS保管庫にハードコードされており、mkdir -pで空のディレクトリを作り、「保存しました」と表示していた00_INBOXなど)がコード内にあるため、保管庫を再編するたびにスクリプト修正が必要という状態でした。
変更内容
1. 保管庫の場所をマシンごとに解決(419c96f)
優先順:
--vault→CLAUDIAN_VAULT_ROOT→~/.claudian/config.jsonのvaultRoot→ 自動検出(~/TANAKA-BRAIN、~、~/Documents、Obsidian/iCloud Drive、Dropbox、Google Drive 配下の田中雄一郎OS保管庫)。あわせて以下も修正:
--create-vault)_2,_3と退避--foldrのような打ち間違いが黙って inbox に落ちない)2. フォルダ構成を設定データ化(1223294)
alias → directory の対応をレイヤで解決: 組み込みデフォルト →
~/.claudian/config.json→<vault>/.claudian.json。保管庫内のファイルが最優先なので、再編内容は保管庫の同期経由で両マシンに反映されます。alias 単位のマージなので触っていない alias はデフォルトのまま、
nullを指定した alias は削除され、再編で消えたフォルダが保存先として復活しません。--dir <保管庫内の相対パス>: alias 未登録のフォルダへ直接保存(再編途中用)--list-folders: 現在有効な対応と、それがどのファイル由来かを表示..を拒否し、保管庫の外に書き出せないよう検証--folder KEEPが通る)3. 再編後の構成をスキャンして取り込む(3d299e3)
--scan-foldersで保管庫の実構造を読み、.claudian.jsonの下書きを生成します(表示のみ)。--writeを足すと保管庫に保存します。20_進行中→進行中、03_PUBLIC→public)nullとして記録--writeは.claudian.jsonの他のキーを保持したままマージテスト
npm testは 124 件すべてパス(うち claudian 分 33 件を新規追加)。別名の付け替え・削除・入れ子パス・保管庫外への書き出し拒否・CLI の終了コードと出力先を含みます。仮の保管庫を作って--scan-folders→--write→--list-folders→ 保存まで実際に通しています。ドキュメント
plugins/claudian/README.mdを新規追加し、マシンごとのセットアップと再編手順を記載。SKILL / コマンド定義にも「組み込みの表を信用せず--list-foldersを見る」「--writeは確認してから」と明記しました。claudian プラグインのバージョンは 1.0.0 → 1.3.0(codex 側のバージョンは変更なし、
npm run check-versionはパス)。🤖 Generated with Claude Code
https://claude.ai/code/session_01U2j9ygS1iB3oPmV5QcQqqr
Generated by Claude Code