islandiguana 用于按 YAML front matter 递归搜索 Obsidian 库中的 Markdown 文件,查询使用 yq 表达式语法。用法为:islandiguana 加上库路径和作为最后一个位置参数的 yq 表达式,例如 islandiguana "/Users/mtm/Documents/Obsidian Vault" '.tags[] == "python"'。由于路径含空格,必须加引号。
主要能力:可按标签、状态等字段匹配,如 '.status == "draft"';可判断键是否存在,如 'has("filetype")';可查空值,如 '.author == null';可用 '(.tags // []) | length == 0' 查找无标签或无 front matter 的文件;可用 test 做不区分大小写的正则匹配;支持 or 组合条件与数值比较如 '.priority > 3'。
配合 ripgrep:不传目录时从标准输入读取文件路径;同时给出目录和管道输入时,两处来源会合并去重,例如 rg -l "Expresso" 路径 | islandiguana '.tags[] == "coffee"'。可用 --null-input 处理 null 分隔输入。
原地修改:加 --mutate 并在表达式中编辑匹配文件,如 --mutate 'del(.filetype)' 删除键、--mutate '.status = "published"' 更新字段,或 --mutate '.tags = ((.tags // []) + ["mytag"] | unique)' 幂等地追加标签(无 front matter 时会创建)。
输出与性能:-0 输出 null 分隔结果以便安全传给 xargs;--no-cache 跳过磁盘缓存始终重新解析;--max-depth 限制搜索深度。排除某标签时需写成 (.tags // []) | map(. == "product") | any | not,因为裸 not (.tags[] == "product") 会在 tags 缺失或为 null 时失败。
推荐流程:通过 Bash 运行 islandiguana,再读取它返回的文件来回答库内容相关问题;按主题搜索时可把 ripgrep 的全文匹配与 front matter 标签过滤结合,用标签作为降噪的筛选层。
限制:资料未提供安装方式、许可证、其他平台或版本兼容信息。