reclaimable 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.claude/launch.json +11 -0
- data/.gitignore +11 -0
- data/.gitlab-ci.yml +16 -0
- data/AGENTS.md +88 -0
- data/CLAUDE.md +1 -0
- data/Gemfile +3 -0
- data/LICENSE +674 -0
- data/README.md +160 -0
- data/Rakefile +28 -0
- data/ai-skill/reclaimable/SKILL.md +94 -0
- data/benchmark/README.md +59 -0
- data/benchmark/experiments/lstat_scanner.rb +11 -0
- data/benchmark/experiments/ractor_scanner.rb +92 -0
- data/benchmark/experiments/verify_bulk_list.rb +34 -0
- data/benchmark/lib/fixture.rb +104 -0
- data/benchmark/lib/results.rb +62 -0
- data/benchmark/reports/00-baseline.md +75 -0
- data/benchmark/reports/01-jit.md +70 -0
- data/benchmark/reports/02-ractor.md +58 -0
- data/benchmark/reports/03-getattrlistbulk.md +84 -0
- data/benchmark/reports/04-others.md +52 -0
- data/benchmark/reports/05-outside-root.md +56 -0
- data/benchmark/reports/06-round2-discussion.md +374 -0
- data/benchmark/reports/06-round2.md +194 -0
- data/benchmark/reports/README.md +46 -0
- data/benchmark/results/baseline.yml +126 -0
- data/benchmark/results/bulk-list.yml +126 -0
- data/benchmark/results/final-yjit.yml +126 -0
- data/benchmark/results/final.yml +126 -0
- data/benchmark/results/ractor-exp.yml +38 -0
- data/benchmark/results/round2-after.yml +126 -0
- data/benchmark/results/round2-before.yml +126 -0
- data/benchmark/results/src-baseline.yml +32 -0
- data/benchmark/results/src-bulk-list.yml +32 -0
- data/benchmark/results/src-pair-none1.yml +38 -0
- data/benchmark/results/src-pair-none2.yml +38 -0
- data/benchmark/results/src-pair-yjit1.yml +38 -0
- data/benchmark/results/src-pair-yjit2.yml +38 -0
- data/benchmark/results/src-ractor-exp.yml +32 -0
- data/benchmark/results/src-round2-after1.yml +52 -0
- data/benchmark/results/src-round2-after2.yml +52 -0
- data/benchmark/results/src-round2-before1.yml +52 -0
- data/benchmark/results/src-round2-before2.yml +52 -0
- data/benchmark/results/yjit.yml +126 -0
- data/benchmark/results/zjit.yml +126 -0
- data/benchmark/run.rb +149 -0
- data/bin/reclaimable +10 -0
- data/doc/performance.md +179 -0
- data/lib/reclaimable/ai_skill.rb +138 -0
- data/lib/reclaimable/bulk_list.rb +91 -0
- data/lib/reclaimable/cache_dump.rb +125 -0
- data/lib/reclaimable/cli.rb +168 -0
- data/lib/reclaimable/cloud_files.rb +33 -0
- data/lib/reclaimable/config.rb +100 -0
- data/lib/reclaimable/i18n.rb +24 -0
- data/lib/reclaimable/locations.rb +89 -0
- data/lib/reclaimable/output.rb +154 -0
- data/lib/reclaimable/paths.rb +36 -0
- data/lib/reclaimable/report.rb +504 -0
- data/lib/reclaimable/ruby_abi.rb +69 -0
- data/lib/reclaimable/scan_cache.rb +97 -0
- data/lib/reclaimable/scanner.rb +440 -0
- data/lib/reclaimable/util.rb +34 -0
- data/lib/reclaimable.rb +42 -0
- data/locale/ja/LC_MESSAGES/reclaimable.mo +0 -0
- data/man/reclaimable.1.ronn +302 -0
- data/man/reclaimable.en.1 +234 -0
- data/man/reclaimable.ja.1 +452 -0
- data/po/ja/reclaimable-docs.po +668 -0
- data/po/ja/reclaimable.po +510 -0
- data/rakelib/benchmark.rake +22 -0
- data/rakelib/docs/japanese.rb +132 -0
- data/rakelib/docs/man_page.rb +73 -0
- data/rakelib/docs/site.rb +187 -0
- data/rakelib/docs/sources.rb +94 -0
- data/rakelib/docs/translation.rb +157 -0
- data/rakelib/docs.rake +62 -0
- data/rakelib/gettext.rake +30 -0
- data/rakelib/i18n.rake +199 -0
- data/reclaimable.gemspec +56 -0
- data/site/index.md +142 -0
- data/site/layout.html.erb +60 -0
- data/site/style.css +82 -0
- metadata +231 -0
data/rakelib/i18n.rake
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# 訳(画面の文言とドキュメントの両方)を更新するタスク。訳す人や AI の手間を減らすためのもの。
|
|
2
|
+
# rake i18n:todo po を原文(ソースと原稿)に合わせて更新し、訳が無い・fuzzy の項目を
|
|
3
|
+
# ID 付きで一覧にする(tmp/i18n/todo.yml にも書き出す)
|
|
4
|
+
# rake "i18n:find[TEXT]" 原文か訳に TEXT を含む項目を、訳済みのものも含めて ID 付きで一覧にする
|
|
5
|
+
# (訳済みの項目を直すときに ID を調べる)
|
|
6
|
+
# rake "i18n:apply[FILE]" FILE(「ID: 訳」の YAML)の訳を po に書き込み、.po・.mo・man page を作り直す。
|
|
7
|
+
# 訳済みの項目の ID なら、その訳を置き換える
|
|
8
|
+
#
|
|
9
|
+
# ID は msgctxt と msgid から作る短いハッシュ。訳を書くときに原文を書き写さずに済む。
|
|
10
|
+
# po の更新の途中の出力(新しい原文の一覧など)は長いので、失敗したときと VERBOSE=1 のときだけ出す
|
|
11
|
+
|
|
12
|
+
require "digest"
|
|
13
|
+
require "fileutils"
|
|
14
|
+
require "stringio"
|
|
15
|
+
require "yaml"
|
|
16
|
+
require "gettext/po"
|
|
17
|
+
require "gettext/po_parser"
|
|
18
|
+
|
|
19
|
+
module I18nTasks
|
|
20
|
+
TODO = "tmp/i18n/todo.yml"
|
|
21
|
+
PLACEHOLDER = /%\{\w+\}|%<\w+>[-+ 0#]*\d*(?:\.\d+)?[a-zA-Z]/
|
|
22
|
+
|
|
23
|
+
module_function
|
|
24
|
+
|
|
25
|
+
# 訳者が編集する po(.edit.po)。画面の文言(reclaimable)とドキュメント(reclaimable-docs)の両方
|
|
26
|
+
def edit_pos = Dir["po/*/*.edit.po"].sort
|
|
27
|
+
|
|
28
|
+
def id(entry) = Digest::SHA256.hexdigest("#{entry.msgctxt}\u0004#{entry.msgid}")[0, 8]
|
|
29
|
+
|
|
30
|
+
def load(path)
|
|
31
|
+
po = GetText::PO.new
|
|
32
|
+
parser = GetText::POParser.new
|
|
33
|
+
parser.ignore_fuzzy = false # fuzzy の項目も読む(既定では読み飛ばす)
|
|
34
|
+
parser.report_warning = false
|
|
35
|
+
parser.parse_file(path, po)
|
|
36
|
+
po
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# rake gettext:po:update が書くのと同じ形(長い行を折り返さない)で書く。読んで書き戻すと元と一致する
|
|
40
|
+
def save(path, po) = File.write(path, po.to_s(max_line_width: -1))
|
|
41
|
+
|
|
42
|
+
# 訳す対象の項目(ヘッダーと廃止された項目は除く)
|
|
43
|
+
def entries(po) = po.reject { it.header? || it.obsolete? }
|
|
44
|
+
|
|
45
|
+
# 訳が無いか fuzzy の項目
|
|
46
|
+
def pending(po) = entries(po).reject(&:translated?)
|
|
47
|
+
|
|
48
|
+
def placeholders(str) = str.to_s.scan(PLACEHOLDER).sort
|
|
49
|
+
|
|
50
|
+
# 中の出力を捨てる。失敗したら、原因が分かるよう捨てた出力を出してから例外を投げ直す
|
|
51
|
+
def quietly
|
|
52
|
+
return yield if ENV["VERBOSE"]
|
|
53
|
+
|
|
54
|
+
saved = [$stdout, $stderr]
|
|
55
|
+
$stdout = $stderr = buffer = StringIO.new
|
|
56
|
+
yield
|
|
57
|
+
rescue Exception
|
|
58
|
+
saved[1].write(buffer.string) if buffer
|
|
59
|
+
raise
|
|
60
|
+
ensure
|
|
61
|
+
$stdout, $stderr = saved if saved
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# 訳が無い・fuzzy の項目を { ID => 情報 } で返す。
|
|
65
|
+
# current は fuzzy の項目に msgmerge が当てた訳(似た原文の訳なので、正しいとは限らない)。
|
|
66
|
+
# note は抽出時のコメント(ドキュメントでは段落・見出しなどの種類)
|
|
67
|
+
def todo
|
|
68
|
+
edit_pos.each_with_object({}) do |path, items|
|
|
69
|
+
pending(load(path)).each do |entry|
|
|
70
|
+
item = item(path, entry)
|
|
71
|
+
item["current"] = entry.msgstr if entry.fuzzy? && !entry.msgstr.to_s.empty?
|
|
72
|
+
items[id(entry)] = item
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# 原文か訳に text を含む項目を { ID => 情報 } で返す。msgstr は今の訳(fuzzy なら fuzzy: true)
|
|
78
|
+
def find(text)
|
|
79
|
+
edit_pos.each_with_object({}) do |path, items|
|
|
80
|
+
entries(load(path)).each do |entry|
|
|
81
|
+
next unless [entry.msgid, entry.msgid_plural, entry.msgstr].any? { it.to_s.include?(text) }
|
|
82
|
+
|
|
83
|
+
item = item(path, entry)
|
|
84
|
+
item["msgstr"] = entry.msgstr.to_s
|
|
85
|
+
item["fuzzy"] = true if entry.fuzzy?
|
|
86
|
+
items[id(entry)] = item
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def item(path, entry)
|
|
92
|
+
item = { "file" => path, "msgid" => entry.msgid }
|
|
93
|
+
item["msgid_plural"] = entry.msgid_plural if entry.msgid_plural
|
|
94
|
+
item["msgctxt"] = entry.msgctxt if entry.msgctxt
|
|
95
|
+
item["note"] = entry.extracted_comment.strip if entry.extracted_comment && !entry.extracted_comment.strip.empty?
|
|
96
|
+
item
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def update_pos
|
|
100
|
+
quietly do
|
|
101
|
+
Rake::Task["gettext:po:update"].invoke
|
|
102
|
+
Rake::Task["docs:po"].invoke
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# .edit.po から .po・.mo・man page を作り直す。docs:po は .edit.po から .po も作る
|
|
107
|
+
def rebuild
|
|
108
|
+
quietly do
|
|
109
|
+
Rake::Task["gettext"].invoke
|
|
110
|
+
Rake::Task["docs:po"].reenable
|
|
111
|
+
Rake::Task["docs:gettext:po:update"].reenable
|
|
112
|
+
Rake::Task["docs:po"].invoke
|
|
113
|
+
Rake::Task["man"].invoke
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
namespace :i18n do
|
|
119
|
+
desc "po を原文に合わせて更新し、訳が無い・fuzzy の項目を ID 付きで一覧にする(#{I18nTasks::TODO} にも書く)"
|
|
120
|
+
task :todo do
|
|
121
|
+
I18nTasks.update_pos
|
|
122
|
+
items = I18nTasks.todo
|
|
123
|
+
if items.empty?
|
|
124
|
+
FileUtils.rm_f(I18nTasks::TODO)
|
|
125
|
+
puts "訳が無い・fuzzy の項目はありません"
|
|
126
|
+
next
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
yaml = <<~HEADER + YAML.dump(items).delete_prefix("---\n")
|
|
130
|
+
# 訳が無い・fuzzy の項目(#{items.size} 件)。訳は「ID: 訳」の YAML に書き、
|
|
131
|
+
# rake "i18n:apply[そのファイル]" で po に書き込む。
|
|
132
|
+
# current は似た原文の訳を msgmerge が当てたもので、正しいとは限らない。
|
|
133
|
+
# msgid の %{...} と %<...>d などは、訳にもそのまま残す
|
|
134
|
+
HEADER
|
|
135
|
+
FileUtils.mkdir_p(File.dirname(I18nTasks::TODO))
|
|
136
|
+
File.write(I18nTasks::TODO, yaml)
|
|
137
|
+
puts yaml
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
desc "原文か訳に TEXT を含む項目を、訳済みのものも含めて ID 付きで一覧にする(訳を直すとき用)"
|
|
141
|
+
task :find, [:text] do |_, args|
|
|
142
|
+
text = args[:text] or abort '探す文字列を指定してください: rake "i18n:find[文字列]"'
|
|
143
|
+
I18nTasks.update_pos
|
|
144
|
+
items = I18nTasks.find(text)
|
|
145
|
+
abort "#{text.inspect} を含む項目はありません" if items.empty?
|
|
146
|
+
|
|
147
|
+
puts <<~HEADER + YAML.dump(items).delete_prefix("---\n")
|
|
148
|
+
# #{text.inspect} を含む項目(#{items.size} 件)。直すときは「ID: 新しい訳」の YAML に書き、
|
|
149
|
+
# rake "i18n:apply[そのファイル]" で po に書き込む(今の訳を置き換える)
|
|
150
|
+
HEADER
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
desc "FILE(「ID: 訳」の YAML)の訳を po に書き込み、.po・.mo・man page を作り直す(訳済みの項目は置き換える)"
|
|
154
|
+
task :apply, [:file] do |_, args|
|
|
155
|
+
file = args[:file] or abort 'ファイルを指定してください: rake "i18n:apply[訳.yml]"'
|
|
156
|
+
translations = YAML.safe_load_file(file)
|
|
157
|
+
abort "#{file} は「ID: 訳」のマッピングではありません" unless translations.is_a?(Hash)
|
|
158
|
+
|
|
159
|
+
# 先に全部を確かめ、1 つでもおかしければ何も書かない
|
|
160
|
+
pos = I18nTasks.edit_pos.to_h { [it, I18nTasks.load(it)] }
|
|
161
|
+
found = {}
|
|
162
|
+
errors = []
|
|
163
|
+
pos.each do |path, po|
|
|
164
|
+
I18nTasks.entries(po).each do |entry|
|
|
165
|
+
msgstr = translations[I18nTasks.id(entry)] or next
|
|
166
|
+
|
|
167
|
+
found[I18nTasks.id(entry)] = true
|
|
168
|
+
unless msgstr.is_a?(String) && !msgstr.empty?
|
|
169
|
+
errors << "#{I18nTasks.id(entry)}: 訳が空か文字列ではありません"
|
|
170
|
+
next
|
|
171
|
+
end
|
|
172
|
+
if I18nTasks.placeholders(msgstr) != I18nTasks.placeholders(entry.msgid)
|
|
173
|
+
errors << "#{I18nTasks.id(entry)}: 置き換え部分が原文と違います(原文 #{I18nTasks.placeholders(entry.msgid).inspect}、" \
|
|
174
|
+
"訳 #{I18nTasks.placeholders(msgstr).inspect})"
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
unknown = translations.keys - found.keys
|
|
179
|
+
errors << "どの項目にも無い ID: #{unknown.join(', ')}(rake i18n:todo か i18n:find で ID を調べ直してください)" if unknown.any?
|
|
180
|
+
abort errors.join("\n") if errors.any?
|
|
181
|
+
|
|
182
|
+
pos.each do |path, po|
|
|
183
|
+
changed = false
|
|
184
|
+
I18nTasks.entries(po).each do |entry|
|
|
185
|
+
msgstr = translations[I18nTasks.id(entry)] or next
|
|
186
|
+
|
|
187
|
+
entry.msgstr = msgstr
|
|
188
|
+
entry.flags.delete("fuzzy")
|
|
189
|
+
changed = true
|
|
190
|
+
end
|
|
191
|
+
I18nTasks.save(path, po) if changed
|
|
192
|
+
end
|
|
193
|
+
I18nTasks.rebuild
|
|
194
|
+
|
|
195
|
+
rest = I18nTasks.todo.size
|
|
196
|
+
puts "#{translations.size} 件の訳を書き込み、.po・.mo・man page を作り直しました。" \
|
|
197
|
+
"#{rest.zero? ? '残りはありません' : "残り #{rest} 件(rake i18n:todo で一覧)"}"
|
|
198
|
+
end
|
|
199
|
+
end
|
data/reclaimable.gemspec
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
spec.name = "reclaimable"
|
|
3
|
+
spec.version = "0.1.0"
|
|
4
|
+
spec.authors = ["Kitaiti Makoto"]
|
|
5
|
+
spec.email = ["KitaitiMakoto@gmail.com"]
|
|
6
|
+
|
|
7
|
+
spec.summary = "macOS のストレージの削除候補を洗い出して一覧表示する(読み取り専用)"
|
|
8
|
+
spec.description = "ホーム以下を 1 回走査し、再生成できるキャッシュ・旧 Ruby 版の gem・ビルド成果物・" \
|
|
9
|
+
"コンテナ環境・巨大ファイルなどを容量順に表示する。何も削除しない。"
|
|
10
|
+
spec.required_ruby_version = ">= 4.0"
|
|
11
|
+
spec.licenses = ["GPL-3.0-or-later"]
|
|
12
|
+
|
|
13
|
+
spec.homepage = "https://kitaitimakoto.gitlab.io/reclaimable/"
|
|
14
|
+
spec.metadata = {
|
|
15
|
+
"homepage_uri" => spec.homepage,
|
|
16
|
+
"documentation_uri" => "https://kitaitimakoto.gitlab.io/reclaimable/reclaimable.1.html",
|
|
17
|
+
"source_code_uri" => "https://gitlab.com/KitaitiMakoto/reclaimable",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# 生成物(git には入れない)は、まだ無くても載るよう glob でなく po/ の訳から名前を決める。
|
|
21
|
+
# Rakefile がこれらをパッケージ(.gem など)の前提にするので、gem のビルドでは無いか古ければ先に作られる
|
|
22
|
+
# - locale/ の .mo は文言の訳(po/<言語>/reclaimable.po から作る)
|
|
23
|
+
# - man/ の roff は reclaimable --man か gem man コマンド(gem-man)で読む。gem-man は man/ の直下しか見ないので、
|
|
24
|
+
# どの言語も直下に reclaimable.<言語>.1 として置く(gem man reclaimable では一覧から選ぶ)
|
|
25
|
+
langs = ->(domain) { Dir["po/*/#{domain}.po"].map { File.basename(File.dirname(it)) }.sort }
|
|
26
|
+
generated = [
|
|
27
|
+
*langs.("reclaimable").map { "locale/#{it}/LC_MESSAGES/reclaimable.mo" },
|
|
28
|
+
*["en", *langs.("reclaimable-docs")].map { "man/reclaimable.#{it}.1" },
|
|
29
|
+
]
|
|
30
|
+
# git で追跡しているファイルは、すべて gem に入れる
|
|
31
|
+
tracked = IO.popen(["git", "ls-files", "-z", { chdir: __dir__ }], &:read).split("\0")
|
|
32
|
+
spec.files = tracked + generated
|
|
33
|
+
spec.executables = ["reclaimable"]
|
|
34
|
+
|
|
35
|
+
# gem install の最後に出る。AI エージェント向けのスキル(ai-skill/)は gem に入っているだけでは使われないので、
|
|
36
|
+
# 入れ方を案内する。gemspec はビルド時に評価されるので、ロケールでは切り替えられず、両方の言語で書く
|
|
37
|
+
spec.post_install_message = <<~MESSAGE
|
|
38
|
+
reclaimable comes with a skill for AI agents (Claude Code, Codex, and others).
|
|
39
|
+
AI エージェント(Claude Code・Codex など)向けのスキルが入っています。
|
|
40
|
+
|
|
41
|
+
reclaimable --ai-skill # show it and how to install it / 中身と入れ方を表示する
|
|
42
|
+
reclaimable --install-ai-skill # install it / インストールする
|
|
43
|
+
MESSAGE
|
|
44
|
+
|
|
45
|
+
# 実行時に依存する gem は gettext(文言の翻訳)だけ。ほかは標準添付ライブラリーで済ませる
|
|
46
|
+
spec.add_dependency "gettext", "~> 3.5"
|
|
47
|
+
|
|
48
|
+
spec.add_development_dependency "rake"
|
|
49
|
+
spec.add_development_dependency "rubygems-tasks"
|
|
50
|
+
# ベンチマーク(benchmark/)で使う。Ruby 4.0 では bundled gem なので、bundler を通すには依存に書く必要がある
|
|
51
|
+
spec.add_development_dependency "benchmark"
|
|
52
|
+
# ドキュメント(man page と GitLab Pages のサイト)を作る
|
|
53
|
+
spec.add_development_dependency "kramdown"
|
|
54
|
+
spec.add_development_dependency "kramdown-parser-gfm"
|
|
55
|
+
spec.add_development_dependency "ronn-ng"
|
|
56
|
+
end
|
data/site/index.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: reclaimable — find what is eating disk space on your Mac
|
|
3
|
+
description: reclaimable is a read-only Ruby command-line tool for macOS that lists caches, build artifacts, old gems, container disk images, and large files you can reclaim, sorted by size. It never deletes anything.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# reclaimable
|
|
7
|
+
|
|
8
|
+
**reclaimable is a read-only command-line tool for macOS that shows what is
|
|
9
|
+
taking up your disk space and what you can probably reclaim, sorted by size.
|
|
10
|
+
It never deletes anything and never needs `sudo`.**
|
|
11
|
+
It is written in Ruby 4.0, and its messages are in English or Japanese depending on your locale.
|
|
12
|
+
|
|
13
|
+
## What it finds
|
|
14
|
+
|
|
15
|
+
- Caches and downloads that are usually regenerable: `~/Library/Caches`, the
|
|
16
|
+
Homebrew cache, npm, pnpm, yarn, and bun caches, Cargo registries, Xcode
|
|
17
|
+
DerivedData, iOS simulators, Ollama and Hugging Face models, gem
|
|
18
|
+
documentation, iPhone backups, and more, each with a note on what happens if
|
|
19
|
+
you remove it
|
|
20
|
+
- Build artifacts and dependencies (`node_modules`, `.venv`, `venv`, `.build`,
|
|
21
|
+
`.dart_tool`, Cargo `target`) with the date they were last modified, so you
|
|
22
|
+
can spot projects you no longer touch
|
|
23
|
+
- Gems left behind by old Ruby versions, in `vendor/bundle` and in your user
|
|
24
|
+
gem directories (including the ones chruby manages)
|
|
25
|
+
- Container data: Docker Desktop, Colima, Lima, OrbStack, Podman, and Rancher
|
|
26
|
+
Desktop disk images (both real and apparent size), and `docker system df`
|
|
27
|
+
for each running Docker engine
|
|
28
|
+
- Large files, Time Machine local snapshots, and estimates from `brew cleanup -n`,
|
|
29
|
+
`ollama list`, and `rustup toolchain list`
|
|
30
|
+
- Folders it could not read, so you know what is missing from the totals, and
|
|
31
|
+
folders that live only in the cloud
|
|
32
|
+
|
|
33
|
+
## What it does not do
|
|
34
|
+
|
|
35
|
+
- It does not delete, move, or change any file. You decide what to remove.
|
|
36
|
+
- It does not use `sudo`. It reads only what your user account can read.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
reclaimable needs macOS and Ruby 4.0 or later.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
gem install reclaimable
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
reclaimable # scan your home directory
|
|
50
|
+
reclaimable -n 50 -s 500 # top 50 entries; files of 500 MB or more are "large"
|
|
51
|
+
reclaimable -d ~/src --fresh --no-save # scan ~/src only, ignore the cache, save nothing
|
|
52
|
+
reclaimable --freeze ~/archive/old-site # measure a folder that never changes once, and skip it from now on
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The report is printed to the terminal and also saved to
|
|
56
|
+
`~/Library/Logs/reclaimable/` (or under `$XDG_STATE_HOME` if you set it). It is in Japanese when your locale (`LC_ALL`,
|
|
57
|
+
`LC_MESSAGES`, or `LANG`) is Japanese, and in English otherwise.
|
|
58
|
+
|
|
59
|
+
## Read the manual
|
|
60
|
+
|
|
61
|
+
The full manual, [reclaimable(1)](reclaimable.1.html), is also included in the gem.
|
|
62
|
+
To read it in your terminal, run:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
reclaimable --man
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
It opens the Japanese version when your locale is Japanese, and the English version otherwise.
|
|
69
|
+
You can also read it with [gem-man](https://rubygems.org/gems/gem-man):
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
gem install gem-man
|
|
73
|
+
gem man reclaimable
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
When asked which manual to open, choose `reclaimable.en.1` for English or
|
|
77
|
+
`reclaimable.ja.1` for Japanese.
|
|
78
|
+
|
|
79
|
+
## Use it from an AI agent
|
|
80
|
+
|
|
81
|
+
The gem includes a skill for AI agents such as Claude Code and Codex, in the
|
|
82
|
+
[Agent Skills](https://agentskills.io) format. It tells the agent how to run
|
|
83
|
+
reclaimable, how to read the report, and never to delete anything without
|
|
84
|
+
asking you.
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
reclaimable --ai-skill # show the skill and how to install it by hand
|
|
88
|
+
reclaimable --install-ai-skill # ask where to install it, then install it
|
|
89
|
+
reclaimable --install-ai-skill=~/.claude/skills # install it there without asking
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The copy is not updated with the gem, so install it again after you update reclaimable.
|
|
93
|
+
|
|
94
|
+
## FAQ
|
|
95
|
+
|
|
96
|
+
### Why are Desktop, Documents, and Downloads missing from the totals?
|
|
97
|
+
|
|
98
|
+
macOS privacy controls protect these folders. Unless your terminal app has
|
|
99
|
+
Full Disk Access, reclaimable cannot read them and lists them under
|
|
100
|
+
"unreadable locations" at the end of the report. Give your terminal app Full
|
|
101
|
+
Disk Access in System Settings and run it again. `sudo` is not needed.
|
|
102
|
+
|
|
103
|
+
### Is it safe to delete what it lists?
|
|
104
|
+
|
|
105
|
+
reclaimable only shows candidates. Most locations in the "usually regenerable"
|
|
106
|
+
section are rebuilt or downloaded again when needed, and the report notes what
|
|
107
|
+
happens if you remove each one. For example, quit apps before clearing
|
|
108
|
+
`~/Library/Caches`. Check container volumes before removing them, because they
|
|
109
|
+
may hold databases.
|
|
110
|
+
|
|
111
|
+
### Why is `Docker.raw` so much smaller than Finder says?
|
|
112
|
+
|
|
113
|
+
Container disk images are sparse files. reclaimable shows both the space they
|
|
114
|
+
really use and their apparent size. Running `docker system prune` inside the VM
|
|
115
|
+
may not free space on the Mac right away.
|
|
116
|
+
|
|
117
|
+
### Does it download my iCloud Drive or Google Drive files?
|
|
118
|
+
|
|
119
|
+
No. Reading a folder whose contents live only in the cloud would normally make
|
|
120
|
+
macOS download it. reclaimable turns that off for its own process and lists
|
|
121
|
+
those folders in the report instead. They use almost no local space.
|
|
122
|
+
|
|
123
|
+
### Is the second run faster?
|
|
124
|
+
|
|
125
|
+
Yes. Scan results are cached in `~/Library/Caches/reclaimable/` (or under
|
|
126
|
+
`$XDG_CACHE_HOME` if you set it) for up to 7 days, and
|
|
127
|
+
folders that have not changed are not read again. Use `--fresh` to rescan
|
|
128
|
+
everything.
|
|
129
|
+
|
|
130
|
+
### Can I skip a large folder that never changes?
|
|
131
|
+
|
|
132
|
+
Yes. `reclaimable --freeze <folder>` measures it once and saves its size to the
|
|
133
|
+
config file (`~/Library/Application Support/reclaimable/config.yml`, or under
|
|
134
|
+
`$XDG_CONFIG_HOME` if you set it). Later scans use that size
|
|
135
|
+
without reading the folder, which helps when it holds many small files. The
|
|
136
|
+
report lists frozen folders and marks the ones that have changed since. Use
|
|
137
|
+
`--unfreeze <folder>` to scan it again.
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
reclaimable is free software, released under the GNU General Public License,
|
|
142
|
+
version 3 or (at your option) any later version.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<%# 全ページ共通の枠。変数は Docs::Site#render を参照 -%>
|
|
2
|
+
<%- h = ->(s) { CGI.escapeHTML(s.to_s) } -%>
|
|
3
|
+
<!doctype html>
|
|
4
|
+
<html lang="<%= page.lang %>">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
<title><%= h.(page.title) %></title>
|
|
9
|
+
<%- if page.description -%>
|
|
10
|
+
<meta name="description" content="<%= h.(page.description) %>">
|
|
11
|
+
<%- end -%>
|
|
12
|
+
<%- if page.kind == :not_found -%>
|
|
13
|
+
<meta name="robots" content="noindex">
|
|
14
|
+
<%- else -%>
|
|
15
|
+
<link rel="canonical" href="<%= h.(site.url(page.path)) %>">
|
|
16
|
+
<%- alternates.each do |alt| -%>
|
|
17
|
+
<link rel="alternate" hreflang="<%= alt.lang %>" href="<%= h.(site.url(alt.path)) %>">
|
|
18
|
+
<%- end -%>
|
|
19
|
+
<%- if (default = alternates.find { it.lang == "en" }) -%>
|
|
20
|
+
<link rel="alternate" hreflang="x-default" href="<%= h.(site.url(default.path)) %>">
|
|
21
|
+
<%- end -%>
|
|
22
|
+
<link rel="alternate" type="text/markdown" href="<%= h.(site.url(page.md_path)) %>" title="<%= h.(labels[:markdown]) %>">
|
|
23
|
+
<meta property="og:type" content="website">
|
|
24
|
+
<meta property="og:site_name" content="<%= h.(spec.name) %>">
|
|
25
|
+
<meta property="og:title" content="<%= h.(page.title) %>">
|
|
26
|
+
<meta property="og:description" content="<%= h.(page.description) %>">
|
|
27
|
+
<meta property="og:url" content="<%= h.(site.url(page.path)) %>">
|
|
28
|
+
<meta property="og:locale" content="<%= langs[page.lang][:locale] %>">
|
|
29
|
+
<%- alternates.reject { it.lang == page.lang }.each do |alt| -%>
|
|
30
|
+
<meta property="og:locale:alternate" content="<%= langs[alt.lang][:locale] %>">
|
|
31
|
+
<%- end -%>
|
|
32
|
+
<meta name="twitter:card" content="summary">
|
|
33
|
+
<%- end -%>
|
|
34
|
+
<link rel="stylesheet" href="<%= h.(site.href(page, "style.css")) %>">
|
|
35
|
+
<%- if json_ld -%>
|
|
36
|
+
<script type="application/ld+json"><%= json_ld %></script>
|
|
37
|
+
<%- end -%>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<header class="site-header">
|
|
41
|
+
<nav aria-label="<%= h.(spec.name) %>">
|
|
42
|
+
<a class="brand" href="<%= h.(site.href(page, home ? home.path : "")) %>"><%= h.(spec.name) %></a>
|
|
43
|
+
<%- if home -%>
|
|
44
|
+
<a href="<%= h.(site.href(page, home.path)) %>"<%= ' aria-current="page"' if page == home %>><%= h.(labels[:home]) %></a>
|
|
45
|
+
<a href="<%= h.(site.href(page, manual.path)) %>"<%= ' aria-current="page"' if page == manual %>><%= h.(labels[:manual]) %></a>
|
|
46
|
+
<%- end -%>
|
|
47
|
+
<a href="<%= h.(spec.metadata["source_code_uri"]) %>"><%= h.(labels[:source]) %></a>
|
|
48
|
+
<%- alternates.reject { it.lang == page.lang }.each do |alt| -%>
|
|
49
|
+
<a class="lang" href="<%= h.(site.href(page, alt.path)) %>" hreflang="<%= alt.lang %>" lang="<%= alt.lang %>"><%= h.(langs[alt.lang][:name]) %></a>
|
|
50
|
+
<%- end -%>
|
|
51
|
+
</nav>
|
|
52
|
+
</header>
|
|
53
|
+
<main>
|
|
54
|
+
<%= page.html %>
|
|
55
|
+
</main>
|
|
56
|
+
<footer class="site-footer">
|
|
57
|
+
<p><%= h.(spec.name) %> <%= h.(spec.version) %><%- if page.md_path -%> · <a href="<%= h.(site.href(page, page.md_path)) %>"><%= h.(labels[:markdown]) %></a><%- end -%></p>
|
|
58
|
+
</footer>
|
|
59
|
+
</body>
|
|
60
|
+
</html>
|
data/site/style.css
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--bg: #ffffff;
|
|
3
|
+
--fg: #1f2328;
|
|
4
|
+
--muted: #59636e;
|
|
5
|
+
--accent: #0b5cad;
|
|
6
|
+
--code-bg: #f3f4f6;
|
|
7
|
+
--border: #d8dee4;
|
|
8
|
+
color-scheme: light dark;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (prefers-color-scheme: dark) {
|
|
12
|
+
:root {
|
|
13
|
+
--bg: #15171a;
|
|
14
|
+
--fg: #e6e8eb;
|
|
15
|
+
--muted: #9aa4af;
|
|
16
|
+
--accent: #6cb6ff;
|
|
17
|
+
--code-bg: #22262b;
|
|
18
|
+
--border: #353a40;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
* { box-sizing: border-box; }
|
|
23
|
+
|
|
24
|
+
body {
|
|
25
|
+
margin: 0;
|
|
26
|
+
background: var(--bg);
|
|
27
|
+
color: var(--fg);
|
|
28
|
+
font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
|
|
29
|
+
line-height: 1.7;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
main, .site-header nav, .site-footer p {
|
|
33
|
+
max-width: 46rem;
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
padding: 0 1rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main { padding-bottom: 3rem; }
|
|
39
|
+
|
|
40
|
+
a { color: var(--accent); }
|
|
41
|
+
|
|
42
|
+
.site-header { border-bottom: 1px solid var(--border); }
|
|
43
|
+
.site-header nav {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
gap: 0.25rem 1.25rem;
|
|
47
|
+
align-items: baseline;
|
|
48
|
+
padding-top: 0.75rem;
|
|
49
|
+
padding-bottom: 0.75rem;
|
|
50
|
+
}
|
|
51
|
+
.site-header a { text-decoration: none; }
|
|
52
|
+
.site-header a[aria-current="page"] { color: var(--fg); font-weight: 600; }
|
|
53
|
+
.site-header .brand { color: var(--fg); font-weight: 700; margin-right: auto; }
|
|
54
|
+
|
|
55
|
+
.site-footer {
|
|
56
|
+
border-top: 1px solid var(--border);
|
|
57
|
+
color: var(--muted);
|
|
58
|
+
font-size: 0.875rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
h1 { font-size: 2rem; line-height: 1.3; margin: 2rem 0 1rem; }
|
|
62
|
+
h2 { font-size: 1.375rem; line-height: 1.4; margin: 2.25rem 0 0.75rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border); }
|
|
63
|
+
h3 { font-size: 1.125rem; margin: 1.75rem 0 0.5rem; }
|
|
64
|
+
|
|
65
|
+
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
|
|
66
|
+
code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 4px; }
|
|
67
|
+
pre {
|
|
68
|
+
background: var(--code-bg);
|
|
69
|
+
padding: 0.75rem 1rem;
|
|
70
|
+
border-radius: 6px;
|
|
71
|
+
overflow-x: auto;
|
|
72
|
+
line-height: 1.5;
|
|
73
|
+
}
|
|
74
|
+
pre code { background: none; padding: 0; }
|
|
75
|
+
|
|
76
|
+
/* ronn-ng が出す man page の断片 */
|
|
77
|
+
.man dl { margin: 0.5rem 0 1rem; }
|
|
78
|
+
.man dt { font-weight: 600; margin-top: 0.75rem; }
|
|
79
|
+
.man dd { margin-left: 1.5rem; }
|
|
80
|
+
.man dd p { margin: 0.25rem 0; }
|
|
81
|
+
.man var { font-style: italic; }
|
|
82
|
+
.man .man-name code { background: none; padding: 0; font-weight: 700; }
|